From 8055378bcecfc77af85b2bb07e7904edc9492789 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 19 Sep 2000 15:06:49 -0500 Subject: [svn-r2576] Purpose: Adding the Fortran interface to the HDF5 library Description: Fortran is now a subdirectory of the HDF5 library tree. Platforms tested: Solaris and IRIX (O2K) --- fortran/Makefile.dist | 24 + fortran/Makefile.in | 111 + fortran/acconfig.h | 53 + fortran/aclocal.m4 | 434 ++++ fortran/acsite.m4 | 377 +++ fortran/bin/config.guess | 1183 +++++++++ fortran/bin/config.sub | 1272 ++++++++++ fortran/bin/install-sh | 251 ++ fortran/bin/ltconfig | 3114 ++++++++++++++++++++++++ fortran/bin/ltmain.sh | 4024 +++++++++++++++++++++++++++++++ fortran/config.h.in | 19 + fortran/config/BlankForm | 126 + fortran/config/commence.in | 160 ++ fortran/config/conclude.in | 185 ++ fortran/config/dec-flags | 92 + fortran/config/dec-osf4.x | 20 + fortran/config/depend | 0 fortran/config/depend1.in | 60 + fortran/config/depend2.in | 11 + fortran/config/depend3.in | 7 + fortran/config/depend4.in | 7 + fortran/config/dependN.in | 4 + fortran/config/freebsd | 21 + fortran/config/gnu-flags | 227 ++ fortran/config/hpux10.20 | 36 + fortran/config/hpux11.00 | 36 + fortran/config/hpux9.03 | 36 + fortran/config/i386-pc-cygwin32 | 20 + fortran/config/intel-osf1 | 83 + fortran/config/irix5.x | 50 + fortran/config/irix6.x | 123 + fortran/config/linux-gnu | 4 + fortran/config/linux-gnulibc1 | 49 + fortran/config/linux-gnulibc2 | 10 + fortran/config/powerpc-ibm-aix4.2.1.0 | 22 + fortran/config/powerpc-ibm-aix4.3.2.0 | 63 + fortran/config/powerpc-ibm-aix4.x | 21 + fortran/config/rs6000-ibm-aix4.x | 10 + fortran/config/solaris2.x | 62 + fortran/config/unicos | 166 ++ fortran/config/unicosmk | 168 ++ fortran/configure | 2981 +++++++++++++++++++++++ fortran/configure.in | 586 +++++ fortran/examples/Dependencies | 0 fortran/examples/Makefile.in | 86 + fortran/examples/attrexample.f90 | 102 + fortran/examples/compound.f90 | 215 ++ fortran/examples/dsetexample.f90 | 70 + fortran/examples/fileexample.f90 | 27 + fortran/examples/groupexample.f90 | 42 + fortran/examples/grpdsetexample.f90 | 136 ++ fortran/examples/grpit.f90 | 189 ++ fortran/examples/grpsexample.f90 | 59 + fortran/examples/hyperslab.f90 | 199 ++ fortran/examples/mountexample.f90 | 183 ++ fortran/examples/refobjexample.f90 | 136 ++ fortran/examples/refregexample.f90 | 159 ++ fortran/examples/run_examples.sh | 13 + fortran/examples/rwdsetexample.f90 | 78 + fortran/examples/selectele.f90 | 282 +++ fortran/libtool | 4284 +++++++++++++++++++++++++++++++++ fortran/src/Dependencies | 0 fortran/src/H5Af.c | 433 ++++ fortran/src/H5Aff.f90 | 1024 ++++++++ fortran/src/H5Df.c | 391 +++ fortran/src/H5Dff.f90 | 2441 +++++++++++++++++++ fortran/src/H5Ef.c | 169 ++ fortran/src/H5Eff.f90 | 62 + fortran/src/H5Ff.c | 451 ++++ fortran/src/H5Fff.f90 | 199 ++ fortran/src/H5Gf.c | 536 +++++ fortran/src/H5Gff.f90 | 234 ++ fortran/src/H5Git.c | 220 ++ fortran/src/H5Git.h | 16 + fortran/src/H5If.c | 29 + fortran/src/H5Iff.f90 | 33 + fortran/src/H5Pf.c | 1748 ++++++++++++++ fortran/src/H5Pf_parallel.c | 161 ++ fortran/src/H5Pff.f90 | 744 ++++++ fortran/src/H5Pff_parallel.f90 | 59 + fortran/src/H5Rf.c | 267 ++ fortran/src/H5Rff.f90 | 138 ++ fortran/src/H5Sf.c | 874 +++++++ fortran/src/H5Sff.f90 | 460 ++++ fortran/src/H5Tf.c | 1543 ++++++++++++ fortran/src/H5Tff.f90 | 599 +++++ fortran/src/H5f90.h | 77 + fortran/src/H5f90global.f90 | 105 + fortran/src/H5f90i.h | 286 +++ fortran/src/H5f90kit.c | 105 + fortran/src/H5f90misc.c | 139 ++ fortran/src/H5f90miscf.f90 | 22 + fortran/src/H5f90proto.h | 872 +++++++ fortran/src/H5fortran_flags.f90 | 141 ++ fortran/src/H5fortran_types.f90.in | 29 + fortran/src/HDF5.f90 | 14 + fortran/src/HDF5_parallel.f90 | 15 + fortran/src/Makefile.in | 38 + fortran/src/README | 240 ++ fortran/test/Dependencies | 0 fortran/test/Makefile.in | 40 + fortran/test/fflush1.f90 | 128 + fortran/test/fflush2.f90 | 158 ++ fortran/test/fortranlib_test.f90 | 169 ++ fortran/test/hdf5test.f90 | 16 + fortran/test/tH5D.f90 | 452 ++++ fortran/test/tH5F.f90 | 516 ++++ fortran/test/tH5P.f90 | 101 + fortran/test/tH5R.f90 | 367 +++ fortran/test/tH5S.f90 | 247 ++ fortran/test/tH5Sselect.f90 | 991 ++++++++ fortran/test/tH5T.f90 | 691 ++++++ 112 files changed, 41358 insertions(+) create mode 100644 fortran/Makefile.dist create mode 100644 fortran/Makefile.in create mode 100644 fortran/acconfig.h create mode 100644 fortran/aclocal.m4 create mode 100644 fortran/acsite.m4 create mode 100755 fortran/bin/config.guess create mode 100755 fortran/bin/config.sub create mode 100755 fortran/bin/install-sh create mode 100755 fortran/bin/ltconfig create mode 100644 fortran/bin/ltmain.sh create mode 100644 fortran/config.h.in create mode 100644 fortran/config/BlankForm create mode 100644 fortran/config/commence.in create mode 100644 fortran/config/conclude.in create mode 100644 fortran/config/dec-flags create mode 100644 fortran/config/dec-osf4.x create mode 100644 fortran/config/depend create mode 100644 fortran/config/depend1.in create mode 100644 fortran/config/depend2.in create mode 100644 fortran/config/depend3.in create mode 100644 fortran/config/depend4.in create mode 100644 fortran/config/dependN.in create mode 100644 fortran/config/freebsd create mode 100644 fortran/config/gnu-flags create mode 100644 fortran/config/hpux10.20 create mode 100644 fortran/config/hpux11.00 create mode 100644 fortran/config/hpux9.03 create mode 100644 fortran/config/i386-pc-cygwin32 create mode 100644 fortran/config/intel-osf1 create mode 100644 fortran/config/irix5.x create mode 100644 fortran/config/irix6.x create mode 100644 fortran/config/linux-gnu create mode 100644 fortran/config/linux-gnulibc1 create mode 100644 fortran/config/linux-gnulibc2 create mode 100644 fortran/config/powerpc-ibm-aix4.2.1.0 create mode 100644 fortran/config/powerpc-ibm-aix4.3.2.0 create mode 100644 fortran/config/powerpc-ibm-aix4.x create mode 100644 fortran/config/rs6000-ibm-aix4.x create mode 100644 fortran/config/solaris2.x create mode 100644 fortran/config/unicos create mode 100644 fortran/config/unicosmk create mode 100755 fortran/configure create mode 100644 fortran/configure.in create mode 100644 fortran/examples/Dependencies create mode 100644 fortran/examples/Makefile.in create mode 100644 fortran/examples/attrexample.f90 create mode 100644 fortran/examples/compound.f90 create mode 100644 fortran/examples/dsetexample.f90 create mode 100644 fortran/examples/fileexample.f90 create mode 100644 fortran/examples/groupexample.f90 create mode 100644 fortran/examples/grpdsetexample.f90 create mode 100644 fortran/examples/grpit.f90 create mode 100644 fortran/examples/grpsexample.f90 create mode 100644 fortran/examples/hyperslab.f90 create mode 100644 fortran/examples/mountexample.f90 create mode 100644 fortran/examples/refobjexample.f90 create mode 100644 fortran/examples/refregexample.f90 create mode 100755 fortran/examples/run_examples.sh create mode 100644 fortran/examples/rwdsetexample.f90 create mode 100644 fortran/examples/selectele.f90 create mode 100755 fortran/libtool create mode 100644 fortran/src/Dependencies create mode 100644 fortran/src/H5Af.c create mode 100644 fortran/src/H5Aff.f90 create mode 100644 fortran/src/H5Df.c create mode 100644 fortran/src/H5Dff.f90 create mode 100644 fortran/src/H5Ef.c create mode 100644 fortran/src/H5Eff.f90 create mode 100644 fortran/src/H5Ff.c create mode 100644 fortran/src/H5Fff.f90 create mode 100644 fortran/src/H5Gf.c create mode 100644 fortran/src/H5Gff.f90 create mode 100644 fortran/src/H5Git.c create mode 100644 fortran/src/H5Git.h create mode 100644 fortran/src/H5If.c create mode 100644 fortran/src/H5Iff.f90 create mode 100644 fortran/src/H5Pf.c create mode 100644 fortran/src/H5Pf_parallel.c create mode 100644 fortran/src/H5Pff.f90 create mode 100644 fortran/src/H5Pff_parallel.f90 create mode 100644 fortran/src/H5Rf.c create mode 100644 fortran/src/H5Rff.f90 create mode 100644 fortran/src/H5Sf.c create mode 100644 fortran/src/H5Sff.f90 create mode 100644 fortran/src/H5Tf.c create mode 100644 fortran/src/H5Tff.f90 create mode 100644 fortran/src/H5f90.h create mode 100644 fortran/src/H5f90global.f90 create mode 100644 fortran/src/H5f90i.h create mode 100644 fortran/src/H5f90kit.c create mode 100644 fortran/src/H5f90misc.c create mode 100644 fortran/src/H5f90miscf.f90 create mode 100644 fortran/src/H5f90proto.h create mode 100644 fortran/src/H5fortran_flags.f90 create mode 100644 fortran/src/H5fortran_types.f90.in create mode 100644 fortran/src/HDF5.f90 create mode 100644 fortran/src/HDF5_parallel.f90 create mode 100644 fortran/src/Makefile.in create mode 100644 fortran/src/README create mode 100644 fortran/test/Dependencies create mode 100644 fortran/test/Makefile.in create mode 100644 fortran/test/fflush1.f90 create mode 100644 fortran/test/fflush2.f90 create mode 100644 fortran/test/fortranlib_test.f90 create mode 100644 fortran/test/hdf5test.f90 create mode 100644 fortran/test/tH5D.f90 create mode 100644 fortran/test/tH5F.f90 create mode 100644 fortran/test/tH5P.f90 create mode 100644 fortran/test/tH5R.f90 create mode 100644 fortran/test/tH5S.f90 create mode 100644 fortran/test/tH5Sselect.f90 create mode 100644 fortran/test/tH5T.f90 diff --git a/fortran/Makefile.dist b/fortran/Makefile.dist new file mode 100644 index 0000000..0b96c81 --- /dev/null +++ b/fortran/Makefile.dist @@ -0,0 +1,24 @@ +# Top-level distributed Makefile -*- makefile -*- + +# This Makefile is a stub (copied from Makefile.dist) which will run +# configure and then invoke the same target in the new Makefile created +# by configure. + +# Uncomment this variable if your make(1) doesn't set it automatically. +# +#MAKE=make + + +SHELL=/bin/sh + +all lib progs check test _test install uninstall dep depend: _config + $(MAKE) $@ + +clean mostlyclean distclean maintainer-clean TAGS: _config + $(MAKE) $@ + +_config: + sh configure + +.PHONY: all lib progs test install uninstall dep depend clean mostlyclean \ + distclean maintainer-clean _config diff --git a/fortran/Makefile.in b/fortran/Makefile.in new file mode 100644 index 0000000..3cc04e9 --- /dev/null +++ b/fortran/Makefile.in @@ -0,0 +1,111 @@ +## Top-level HDF5-Fortran Makefile(.in) +## +## Copyright (C) 2000 National Center for Supercomputing Applications. +## All rights reserved. +## +## +## This makefile mostly just reinvokes make in the various subdirectories +## but does so in the correct order. You can alternatively invoke make from +## each subdirectory manually. +## +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ + +@COMMENCE@ + +# Subdirectories in build-order (not including `examples') +SUBDIRS=src test + +############################################################################## +## T A R G E T S +## +## all: Build libraries, header files, tests, and programs in the +## various subdirectories but does not run tests or install the +## library, header files, or programs. The components can be +## built individually with the targets lib, progs, and tests. +## +## check: Test the uninstalled library to make sure it works. You may +## also say `test' or `_test' (`test' doesn't work from the top +## level directory for some versions of make because `test' is +## also a directory). +## +## install: Installs libraries, header files, programs, and documentation +## in the various directories under the prefix directory (lib, +## include, bin, man, info). Use the `--prefix=PATH' option +## to `configure' (or `config.status') or say `--help' for +## other alternatives. The default prefix is `/usr/local'. +## +## uninstall: Delete all the installed files that the `install' target +## created (but not the noninstalled files such as `make all' +## created). +## +## clean: Removes temporary files except those that record the +## configuration and those that are part of the distribution. +## +## mostlyclean: Like `clean' except it doesn't delete a few files like +## libraries, programs, and/or generated header files because +## regenerating them is rarely necessary and takes a lot of time. +## +## distclean: Deletes all files that are created by configuring or building +## HDF5. If you have unpacked the source and built HDF5 without +## creating any other files, then `make distclean' will leave +## only the files that were in the distrubution. +## +## maintainer-clean: +## Like `distclean' except it deletes more files. It deletes +## all generated files. This target is not intended for normal +## users; it deletes files that may require special tools to +## rebuild. +## +## TAGS: Updates the tags table for this program. +## +## dep depend: Builds dependencies in all subdirectories. These targets +## might not be available on certain combinations of make +## programs and C compilers. At the other extreme, the GNU +## make used in combination with gcc will maintain dependency +## information automatically. +lib progs check test _test uninstall: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +tests TAGS dep depend: + @@SETX@; for d in $(SUBDIRS) examples; do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +install: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + @$(LT) --mode=finish $(libdir); + +.PHONY: all lib progs test _test install uninstall dep depend clean \ + mostlyclean distclean maintainer-clean + +clean mostlyclean: + @@SETX@; for d in $(SUBDIRS) examples; do \ + (cd $$d && $(MAKE) $@); \ + done + -$(RM) conftest conftest.c + +distclean: + @@SETX@; for d in $(SUBDIRS) examples; do \ + (cd $$d && $(MAKE) $@); \ + done + -$(RM) config/commence config/conclude + -$(RM) config/stamp1 config/stamp2 config/depend? + -$(RM) config.cache config.log config.status + -$(RM) src/H5config.h src/H5pubconf.h + -$(RM) libtool Makefile + +maintainer-clean: + @echo "This target is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + @@SETX@; for d in $(SUBDIRS) examples; do \ + (cd $$d && $(MAKE) $@); \ + done + -$(RM) config.cache config.log config.status src/H5config.h + -$(RM) configure src/H5config.h.in + diff --git a/fortran/acconfig.h b/fortran/acconfig.h new file mode 100644 index 0000000..333fc38 --- /dev/null +++ b/fortran/acconfig.h @@ -0,0 +1,53 @@ +/* Define if the __attribute__(()) extension is present */ +#undef HAVE_ATTRIBUTE + +/* Define if the compiler understands the __FUNCTION__ keyword. */ +#undef HAVE_FUNCTION + +/* Define if we have parallel support */ +#undef HAVE_PARALLEL + +/* Define if we have thread safe support */ +#undef HAVE_THREADSAFE + +/* Define if it's safe to use `long long' for hsize_t and hssize_t */ +#undef HAVE_LARGE_HSIZET + +/* Width for printf() for type `long long' or `__int64', us. `ll' */ +#undef PRINTF_LL_WIDTH + +/* Define if `tm_gmtoff' is a member of `struct tm' */ +#undef HAVE_TM_GMTOFF + +/* Define if `__tm_gmtoff' is a member of `struct tm' */ +#undef HAVE___TM_GMTOFF + +/* Define if `timezone' is a global variable */ +#undef HAVE_TIMEZONE + +/* Define if `struct timezone' is defined */ +#undef HAVE_STRUCT_TIMEZONE + +/* Define if `struct stat' has the `st_blocks' field */ +#undef HAVE_STAT_ST_BLOCKS + +/* Define if `struct text_info' is defined */ +#undef HAVE_STRUCT_TEXT_INFO + +/* Define if `struct videoconfig' is defined */ +#undef HAVE_STRUCT_VIDEOCONFIG + +/* Define if the ioctl TIOCGETD is defined */ +#undef HAVE_TIOCGETD + +/* Define if the ioctl TIOCGWINSZ is defined */ +#undef HAVE_TIOCGWINSZ + +/* Define if the Globus GASS is defined */ +#undef HAVE_GASS + +/* Define if the SRB is defined */ +#undef HAVE_SRB + +/* Define if the Grid Storage is defined */ +#undef HAVE_GRIDSTORAGE diff --git a/fortran/aclocal.m4 b/fortran/aclocal.m4 new file mode 100644 index 0000000..c41d84a --- /dev/null +++ b/fortran/aclocal.m4 @@ -0,0 +1,434 @@ +## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- +## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 40 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_SHARED, [dnl +define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_STATIC, [dnl +define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl +define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. +changequote(,)dnl + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' +changequote([,])dnl + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$ac_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN(AC_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/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 + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(AC_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$lt_target" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl diff --git a/fortran/acsite.m4 b/fortran/acsite.m4 new file mode 100644 index 0000000..3ed83be --- /dev/null +++ b/fortran/acsite.m4 @@ -0,0 +1,377 @@ +dnl ------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------- +dnl +dnl Macros for HDF5 Fortran +dnl +dnl Copyright (C) 2000 National Center for Supercomputing Applications. +dnl All rights reserved. +dnl ------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------- + +dnl ------------------------------------------------------------------------- +dnl AC_PROG_F9X +dnl +dnl Check for a Fortran 9X compiler. +dnl +AC_DEFUN(AC_PROG_F9X, +[AC_CHECK_PROGS(F9X, f90 pgf90 f95 g95) +test -z "$CC" && AC_MSG_ERROR([no acceptable f9X compiler found in \$PATH]) + +AC_PROG_F9X_WORKS +AC_PROG_F9X_GNU + +if test $ac_cv_prog_g9x = yes; then + G9X=yes + dnl Check whether -g works, even if FFLAGS is set, in case the package + dnl plays around with FFLAGS (such as to build both debugging and + dnl normal versions of a library), tasteless as that idea is. + ac_test_FFLAGS="${FFLAGS+set}" + ac_save_FFLAGS="$FFLAGS" + FFLAGS= + AC_PROG_F9X_G + if test "$ac_test_FFLAGS" = set; then + FFLAGS="$ac_save_FFLAGS" + elif test $ac_cv_prog_f9x_g = yes; then + FFLAGS="-g -O2" + else + FFLAGS="-O2" + fi +else + G9X= + test "${FFLAGS+set}" = set || FFLAGS="-g" +fi +]) + +dnl ------------------------------------------------------------------------- +dnl AC_TRY_F9X_COMPILER() +dnl +dnl It would be nice if the compiler actually works. +dnl +AC_DEFUN(AC_TRY_F9X_COMPILER, [ +cat > conftest.$ac_ext << EOF +[$1] +EOF +if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + [$2]=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + [$3]=no + else + [$3]=yes + fi +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + [$2]=no +fi +rm -fr conftest* +]) + +dnl ------------------------------------------------------------------------- +dnl AC_LANG_F9X_WORKS() +dnl +dnl It would be nice if the compiler actually works. +dnl +AC_DEFUN(AC_PROG_F9X_WORKS, [ +AC_MSG_CHECKING([whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) works]) +AC_LANG_SAVE +AC_LANG_FORTRAN9X +AC_TRY_F9X_COMPILER([ + program conftest + end +], ac_cv_prog_f9x_works, ac_cv_prog_f9x_cross) +AC_LANG_RESTORE +AC_MSG_RESULT($ac_cv_prog_f9x_works) +if test $ac_cv_prog_f9x_works = no; then + AC_MSG_ERROR([installation or configuration problem: Fortran 9X compiler cannot create executables.]) +fi +AC_MSG_CHECKING([whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) is a cross-compiler]) +AC_MSG_RESULT($ac_cv_prog_f9x_cross) +cross_compiling=$ac_cv_prog_f9x_cross +]) + +dnl ------------------------------------------------------------------------- +dnl AC_LANG_FORTRAN9X() +dnl +dnl Generic macro to setup the Fortran 9X specific env variables. +dnl +AC_DEFUN(AC_LANG_FORTRAN9X, [ +define([AC_LANG], [FORTRAN9X]) +ac_ext=f90 +ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&AC_FD_CC' +ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +cross_compiling=$ac_cv_prog_f9x_cross +]) + +dnl ------------------------------------------------------------------------- +dnl AC_PROG_F9X_GNU +dnl +dnl Test whether for Fortran 9X compiler is `g95' (the GNU Fortran 95 +dnl Compiler). This test depends on whether the Fortran 9X compiler +dnl can do CPP pre-processing. +dnl +AC_DEFUN(AC_PROG_F9X_GNU, +[AC_CACHE_CHECK(whether we are using GNU Fortran 95, ac_cv_prog_g9x, +[cat > conftest.fpp </dev/null 2>&1; then + ac_cv_prog_g9x=yes +else + ac_cv_prog_g9x=no +fi])]) + +dnl ------------------------------------------------------------------------- +dnl AC_PROG_F9X_G +dnl +dnl Test whether the Fortran 9X compiler can accept the `-g' option +dnl to enable debugging. +dnl +AC_DEFUN(AC_PROG_F9X_G, +[AC_CACHE_CHECK(whether $F9X accepts -g, ac_cv_prog_f9x_g, +[cat > conftest.f << EOF + program conftest + end +EOF +if test -z "`$F9X -g -c conftest.f 2>&1`"; then + ac_cv_prog_f9x_g=yes +else + ac_cv_prog_f9x_g=no +fi +rm -f conftest* +])]) + +dnl ------------------------------------------------------------------------- +dnl AC_F9X_OPT_FLAGS() +dnl +dnl Check for optimizer flags the Fortran compiler can use. +dnl +AC_DEFUN(AC_F9X_OPT_FLAGS, +[AC_MSG_CHECKING([for $F9X optimizer flags]) +AC_LANG_SAVE +AC_LANG_FORTRAN9X + +for flags in "-fast" "-O3" "-O" "";do + cat > conftest.$ac_ext < /dev/null 2>&1; then :; else + FFLAGS="$FFLAGS $flags" + break + fi + fi +done + +if test -n "$flags"; then + echo "$flags" 1>&6 +else + echo "none" 1>&6 +fi +rm -f conftest*]) + +dnl ------------------------------------------------------------------------- +dnl AC_F9X_MODS() +dnl +dnl Check how F9X handles modules. This macro also checks which +dnl command-line option to use to include the module once it's built. +dnl +AC_DEFUN(AC_F9X_MODS, +[AC_MSG_CHECKING(what $F9X does with modules) +AC_LANG_SAVE +AC_LANG_FORTRAN9X + +test -d conftestdir || mkdir conftestdir +cd conftestdir +rm -rf * + +cat >conftest.$ac_ext <&1 +if test "$modfiles" = file.o; then + echo $ac_n "checking whether $F9X -em is saner""... $ac_c" 1>&6 + OLD_FFLAGS=$FFLAGS + FFLAGS="$FFLAGS -em" + eval $ac_compile + modfiles="" + for f in file.o module.mod MODULE.mod; do + test -f $f && modfiles="$f" + done + if test "$modfiles" = file.o;then + FFLAGS=$OLD_FFLAGS + echo no 6>&1 + else + echo yes 6>&1 + fi +fi +cd .. + +AC_MSG_CHECKING(how $F9X finds modules) + +for flag in "-p" "-M" "-I"; do + cat >conftest.$ac_ext <&6 +else + echo unknown 1>&6 +fi +AC_SUBST(F9XMODFLAG) +rm -rf conftest*]) + +dnl ------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------- +dnl +dnl Possible future tests for the Fortran stuff... +dnl +dnl ------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------- +dnl +dnl echo $ac_n "checking whether f90 real type has 12 digits of precision""... $ac_c" 1>&6 +dnl cat >conftest.f90 <<'EOF' +dnl program conftest +dnl if (selected_real_kind(12) .eq. kind(0.0)) then +dnl print '(a)','YES' +dnl else +dnl print '(a)','NO' +dnl end if +dnl end program conftest +dnl EOF +dnl $ac_cv_prog_F90 $FFLAGS -o conftest conftest.f90 > /dev/null 2>&1 +dnl if test "`./conftest | head -1`" = YES; then +dnl echo "yes" 1>&6 +dnl AC_DEFINE(HIPREC) +dnl else +dnl echo "no" 1>&6 +dnl fi + +dnl echo $ac_n "checking whether f90 precision of default real type""... $ac_c" 1>&6 +dnl cat >conftest.f90 <<'EOF' +dnl program conftest +dnl if (kind(0.0) .eq. selected_real_kind(12) .or.& +dnl &kind(0.0) .eq. selected_real_kind(6) ) then +dnl print '(a)','YES' +dnl else +dnl print '(a)','NO' +dnl end if +dnl end program conftest +dnl EOF +dnl $ac_cv_prog_F90 $FFLAGS -o conftest conftest.f90 > /dev/null 2>&1 +dnl if test "`./conftest | head -1`" = YES; then +dnl echo "OK" 1>&6 +dnl AC_DEFINE(REALOK) +dnl else +dnl echo "no" 1>&6 +dnl fi + +dnl echo $ac_n "checking accuracy of arithmetic""... $ac_c" 1>&6 +dnl cat >conftest.f90 <<'EOF' +dnl program conftest +dnl integer, parameter :: double=selected_real_kind(12) +dnl real(double), parameter :: ulp=2.0_double**(-47) +dnl real(double), parameter :: ans=0.92699498904359955986_double +dnl real(double) :: x,y,z +dnl integer i +dnl x=0.0_double +dnl y=ulp +dnl do i=2,100 +dnl z=x+y +dnl x=y +dnl y=z-int(z) +dnl end do +dnl if (y-ans .lt. ulp/2.0_double) then +dnl print '(a)','YES' +dnl else +dnl print '(a)','NO' +dnl end if +dnl end program conftest +dnl EOF +dnl $ac_cv_prog_F90 $FFLAGS -o conftest conftest.f90 > /dev/null 2>&1 +dnl if test "`./conftest | head -1`" = YES; then +dnl echo "OK" 1>&6 +dnl AC_DEFINE(ARITHOK) +dnl else +dnl echo "no" 1>&6 +dnl fi + +dnl echo $ac_n "checking whether int is the fastest way to truncate""... $ac_c" 1>&6 +dnl cat >conftest.f90 <<'EOF' +dnl program conftest +dnl integer, parameter :: double=selected_real_kind(12) +dnl real(double), parameter :: ulp=2.0_double**(-47) +dnl real(double) :: x,y,z,ya,yb +dnl integer :: t0,t1,i,timea,timeb +dnl +dnl x=0.0_double +dnl y=ulp +dnl call system_clock(t0) +dnl do i=2,1000000 +dnl z=x+y +dnl x=y +dnl y=z-int(z) +dnl end do +dnl ya=y +dnl call system_clock(t1) +dnl timea=t1-t0 +dnl +dnl x=0.0_double +dnl y=ulp +dnl call system_clock(t0) +dnl do i=2,1000000 +dnl z=x+y +dnl x=y +dnl if (z.ge.1.0_double) then +dnl y=z-1.0_double +dnl else +dnl y=z +dnl end if +dnl end do +dnl yb=y +dnl call system_clock(t1) +dnl timeb=t1-t0 +dnl +dnl if (timea.lt.timeb) then +dnl print '(a)','YES' +dnl else +dnl print '(a)','NO' +dnl end if +dnl print *,ya,yb +dnl end program conftest +dnl EOF +dnl $ac_cv_prog_F90 $FFLAGS -o conftest conftest.f90 > /dev/null 2>&1 +dnl if test "`./conftest | head -1`" = YES; then +dnl echo "yes" 1>&6 +dnl AC_DEFINE(USEINT) +dnl else +dnl echo "no" 1>&6 +dnl fi +dnl +dnl ------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------- diff --git a/fortran/bin/config.guess b/fortran/bin/config.guess new file mode 100755 index 0000000..0ce538b --- /dev/null +++ b/fortran/bin/config.guess @@ -0,0 +1,1183 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-cbm ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format. + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + *ia64) + echo "${UNAME_MACHINE}-unknown-linux" + exit 0 + ;; + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + echo "${UNAME_MACHINE}-pc-linux" + exit 0 + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + sparclinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + armlinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32arm*) + echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" + exit 0 + ;; + armelf_linux*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + m68klinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32ppc | elf32ppclinux) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 + ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >$dummy.c < /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + elif test "${UNAME_MACHINE}" = "s390"; then + echo s390-ibm-linux && exit 0 + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-W:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/fortran/bin/config.sub b/fortran/bin/config.sub new file mode 100755 index 0000000..7fd5332 --- /dev/null +++ b/fortran/bin/config.sub @@ -0,0 +1,1272 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# 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. + +# 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. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +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*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30 | avr) + basic_machine=$basic_machine-unknown + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # 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[34567]86) + 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. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tflop*) + basic_machine=i386-intel + os=-osf1 + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -*MiNT) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/fortran/bin/install-sh b/fortran/bin/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/fortran/bin/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/fortran/bin/ltconfig b/fortran/bin/ltconfig new file mode 100755 index 0000000..c14d83c --- /dev/null +++ b/fortran/bin/ltconfig @@ -0,0 +1,3114 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null`} + case X$UNAME in + *-DOS) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf "%s\n"' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.3.5 +TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +enable_static=yes +enable_fast_install=yes +enable_dlopen=unknown +enable_win32_dll=no +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +ac_ext=c +objext=o +libext=a +exeext= +cache_file= + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LDFLAGS="$LDFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_LIBS="$LIBS" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_OBJDUMP="$OBJDUMP" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi +if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi + +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# Set a sane default for `OBJDUMP'. +test -z "$OBJDUMP" && OBJDUMP=objdump + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc || test -f $dir/cc$ac_exeext; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:581: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:603: checking for object suffix" >& 5 +if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for executable suffix... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_exeext="no" + $rm conftest* + echo 'main () { return 0; }' > conftest.c + echo "$progname:629: checking for executable suffix" >& 5 + if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c | *.err | *.$objext ) ;; + *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; + esac + done + else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* +fi +if test "X$ac_cv_exeext" = Xno; then + exeext="" +else + exeext="$ac_cv_exeext" +fi +echo "$ac_t$ac_cv_exeext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + link_static_flag="$link_static_flag ${wl}-lC" + ;; + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + sysv4*MP*) + if test -d /usr/nec; then + pic_flag=-Kconform_pic + fi + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + sysv4*MP*) + if test -d /usr/nec ;then + pic_flag='-Kconform_pic' + link_static_flag='-Bstatic' + fi + ;; + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + case "$host_os" in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + ;; + *) + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + ;; + esac + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +$rm conftest* +echo "int some_variable = 0;" > conftest.c +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.o" +echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftest.dat + if ln -s X conftest.dat 2>/dev/null; then + $rm conftest.dat + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:991: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:1015: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:1018: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. + +case "$host_os" in +cygwin* | mingw*) + # 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 "$with_gcc" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case "$host_os" in + aix3* | aix4*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left by newer dlltools. + export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' + + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done~ + test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' + + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' + # can we support soname and/or expsyms with a.out? -oliva + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' + hardcode_libdir_separator=':' + if test "$with_gcc" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + shared_flag='${wl}-bM:SRE' + hardcode_direct=yes + fi + allow_undefined_flag=' ${wl}-berok' + archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' + archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' + case "$host_os" in aix4.[01]|aix4.[01].*) + # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on + always_export_symbols=yes ;; + esac + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /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 $linkopts' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case "$host_os" in + hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF + fi + hardcode_libdir_flag_spec='${wl}-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3*) + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # As osf3* with the addition of the -msym flag + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + rhapsody*) + archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flags_spec='-L$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + 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 $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case "$host_os" in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + 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 $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + unixware7*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/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 + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + break + else + NM=${NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + $rm conftest* + cat > conftest.c <&5 + if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftstm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + global_symbol_pipe= + fi +done +if test "$pipe_works" = yes; then + echo "${ac_t}ok" 1>&6 +else + echo "${ac_t}failed" 1>&6 +fi + +if test -z "$global_symbol_pipe"; then + global_symbol_to_cdecl= +fi + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +file_magic_cmd= +file_magic_test_file= +deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4*) + version_type=linux + # AIX has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + # We preserve .a as extension for shared libraries though AIX4.2 + # and later linker supports .so + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + deplibs_check_method=pass_all + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw*) + version_type=windows + need_version=no + need_lib_prefix=no + if test "$with_gcc" = yes; then + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + file_magic_cmd='${OBJDUMP} -f' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case "$version_type" in + freebsd-elf*) + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + deplibs_check_method=unknown + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case "$host_os" in + freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + case "$host_os" in + hpux10.20*) + # TODO: Does this work for hpux-11 too? + deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' + case "$host_os" in + irix5*) + libsuff= shlibsuff= + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib${libsuff}/libc.so*` + deplibs_check_method='pass_all' + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + deplibs_check_method=pass_all + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method='file_magic COFF format alpha shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + deplibs_check_method='pass_all' + 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" + ;; + +rhapsody*) + version_type=sunos + library_names_spec='${libname}.so' + soname_spec='${libname}.so' + shlibpath_var=DYLD_LIBRARY_PATH + deplibs_check_method=pass_all + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/lib/libc.so + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case "$host_vendor" in + sequent) + file_magic_cmd='/bin/file' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + ncr) + deplibs_check_method='pass_all' + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + 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]' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in +# configure.in, otherwise build static only libraries. +case "$host_os" in +cygwin* | mingw* | os2*) + if test x$can_build_shared = xyes; then + test x$enable_win32_dll = xno && can_build_shared=no + echo "checking if package supports dlls... $can_build_shared" 1>&6 + fi +;; +esac + +if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac +fi + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:2248: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:2288: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:2335: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:2375: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "$progname:2423: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname:2488: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int fnord = 0; +EOF +ac_try="$ac_compile >/dev/null 2>conftest.out" +{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2526: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + 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 + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +LTCONFIG_VERSION="$VERSION" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ + AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat < "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat < "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +EOF + ;; +esac + +cat <> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ +# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$LTCONFIG_VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_expsym_cmds=$archive_expsym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$include_expsyms + +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + # 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? + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/fortran/bin/ltmain.sh b/fortran/bin/ltmain.sh new file mode 100644 index 0000000..605ea80 --- /dev/null +++ b/fortran/bin/ltmain.sh @@ -0,0 +1,4024 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + esac + + case "$user_target" in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case "$user_target" in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag" && test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + command="$base_compile $srcfile" + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (!dll) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: not more than one -exported-symbols argument allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" + ;; + esac + case " $deplibs " in + *" $arg "*) ;; + *) deplibs="$deplibs $arg";; + esac + case " $lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir";; + esac + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + case ":$dllsearchpath:" in + ::) dllsearchpath="$dllsearchdir";; + *":$dllsearchdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + esac + ;; + esac + ;; + + -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi + deplibs="$deplibs $arg" + ;; + + -module) + module=yes + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.obj | *.a | *.lib) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test "X$installed" = Xyes; then + dir="$libdir" + else + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + fi + + if test -n "$dependency_libs"; then + # Extract -R and -L from dependency_libs + temp_deplibs= + for deplib in $dependency_libs; do + case "$deplib" in + -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + case " $rpath $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + -L*) case "$compile_command $temp_deplibs " in + *" $deplib "*) ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + done + dependency_libs="$temp_deplibs" + fi + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs$dependency_libs" + compile_command="$compile_command $dir/$old_library$dependency_libs" + finalize_command="$finalize_command $dir/$old_library$dependency_libs" + continue + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking statically, + # we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # We need an absolute path. + case "$dir" in + [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + ;; + esac + + # This is the magic to use -rpath. + # Skip directories that are in the system default run-time + # search path, unless they have been requested with -R. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + deplibs="$deplibs $dir/$linklib" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + if test -n "$dllsearchpath"; then + dllsearchpath="$dllsearchpath:$dllsearchdir" + else + dllsearchpath="$dllsearchdir" + fi + ;; + esac + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + deplibs="$deplibs $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$absdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *.a | *.lib) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + dependency_libs="$deplibs" + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case "$version_type" in + none) ;; + + irix) + major=`expr $current - $age + 1` + versuffix="$major.$revision" + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + windows) + # Like Linux, but with '-' rather than '.', since we only + # want one extension on Windows 95. + major=`expr $current - $age` + versuffix="-$major-$age-$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + dependency_libs="$deplibs" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody*) + # rhapsody is a little odd... + deplibs="$deplibs -framework System" + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + if test "$build_libtool_libs" = yes; then + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + *.lo | *.o | *.obj) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + # Anything else should be a program. + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + 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 "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case "$dlsyms" in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case "$host" in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case "$0" in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + link_against_libtool_libs='$link_against_libtool_libs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$finalize_shlibpath$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + if test -n "$xrpath"; then + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a | *.lib) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.o | *.obj) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + link_against_libtool_libs= + relink_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/fortran/config.h.in b/fortran/config.h.in new file mode 100644 index 0000000..8375f3ab --- /dev/null +++ b/fortran/config.h.in @@ -0,0 +1,19 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if we have parallel support */ +#undef HAVE_PARALLEL + +/* Define if you have the header file. */ +#undef HAVE_ZLIB_H + +/* Define if you have the mpi library (-lmpi). */ +#undef HAVE_LIBMPI + +/* Define if you have the mpich library (-lmpich). */ +#undef HAVE_LIBMPICH + +/* Define if you have the mpio library (-lmpio). */ +#undef HAVE_LIBMPIO + +/* Define if you have the z library (-lz). */ +#undef HAVE_LIBZ diff --git a/fortran/config/BlankForm b/fortran/config/BlankForm new file mode 100644 index 0000000..83b6ef5 --- /dev/null +++ b/fortran/config/BlankForm @@ -0,0 +1,126 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + + +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. +#---------------------------------------------------------------------------- + + +# Choosing a C Compiler +# --------------------- +# +# The user should be able to specify the compiler by setting the CC +# environment variable to the name of the compiler and any switches it +# requires for proper operation. If CC is unset then this script may +# set it. If CC is unset by time this script completes then configure +# will try `gcc' and `cc' in that order (perhaps some others too). +# +# Note: Code later in this file may depend on the value of $CC_BASENAME +# in order to distinguish between different compilers when +# deciding which compiler command-line switches to use. This +# variable is set based on the incoming value of $CC and is only +# used within this file. + +if test "X-" = "X-$CC"; then + CC="/some/default/compiler/named/foo -ansi" + CC_BASENAME=foo +fi + + +# C Compiler and Preprocessor Flags +# --------------------------------- +# +# Flags that end with `_CFLAGS' are always passed to the compiler. +# Flags that end with `_CPPFLAGS' are passed to the compiler when +# compiling but not when linking. +# +# DEBUG_CFLAGS Flags to pass to the compiler to create a +# DEBUG_CPPFLAGS library suitable for use with debugging +# tools. Usually this list will exclude +# optimization switches (like `-O') and include +# switches that turn on symbolic debugging +# support (like `-g'). +# +# PROD_CFLAGS Flags to pass to the compiler to create a +# PROD_CPPFLAGS production version of the library. These +# usualy exclude symbolic debugging switches +# (like `-g') and include optimization switches +# (like `-O'). +# +# PROFILE_CFLAGS Flags to pass to the compiler to create a +# PROFILE_CPPFLAGS library suitable for performance testing (like +# `-pg'). This may or may not include debugging +# or production flags. +# +# CFLAGS Flags can be added to this variable which +# might already be partially initialized. These +# flags will always be passed to the compiler +# and should include switches to turn on full +# warnings. HDF5 attempts to be ANSI and Posix +# compliant and employ good programming +# practices resulting in few if any +# warnings. +# +# Warning flags do not have to be added to CFLAGS +# variable if the compiler is the GNU gcc +# compiler or a descendent of gcc such as EGCS or PGCC. +# +# The CFLAGS should contains *something* or else +# configure will probably add `-g'. For most +# systems this isn't a problem but some systems +# will disable optimizations in favor of the +# `-g'. +# +# +# These flags should be set according to the compiler being used. +# There are two ways to check the compiler. You can try using `-v' or +# `--version' to see if the compiler will print a version string. You +# can use the value of $CC_BASENAME which is the base name of the +# first word in $CC (note that the value of CC may have changed +# above). + +case $CC_BASENAME in + gcc) + CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O3 -fomit-frame-pointer" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; + + *) + CFLAGS="$CFLAGS -ansi" + DEBUG_CFLAGS="-g" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; +esac + + + +# Overriding Configure Tests +# -------------------------- +# +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. + +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} + +# Set this to the width required by printf() to print type `long +# long'. For instance, if the format would be `%lld' then set it to +# `ll' or if the format would be `%qd' set it to `q'. +#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} diff --git a/fortran/config/commence.in b/fortran/config/commence.in new file mode 100644 index 0000000..879f27b --- /dev/null +++ b/fortran/config/commence.in @@ -0,0 +1,160 @@ +##------------------------------------------------------------ -*- makefile -*- +## The following section of this makefile comes from the +## `./config/commence' file which was generated with config.status +## from `./config/commence.in'. +##----------------------------------------------------------------------------- + +## Things that Make needs +.SUFFIXES: +.SUFFIXES: .c .f90 .o .lo +@SET_MAKE@ + +## Directories to search +@SEARCH@ + +## Programs +SHELL=/bin/sh +CC=@CC@ +F9X=@F9X@ +CFLAGS=@CFLAGS@ +CPPFLAGS=@CPPFLAGS@ +FFLAGS=@FFLAGS@ +LDFLAGS=@LDFLAGS@ +ROOT=@ROOT@ +LIBS=@LIBS@ +AR=@AR@ +RANLIB=@RANLIB@ +RM=rm -f +CP=cp +INSTALL=@INSTALL@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_DATA=@INSTALL_DATA@ +PARALLEL=@PARALLEL@ +RUNSERIAL=@RUNSERIAL@ +RUNPARALLEL=@RUNPARALLEL@ +RUNTEST=$(RUNSERIAL) +TRACE=: + +## Installation points +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +libdir=@libdir@ +includedir=@includedir@ +docdir=@exec_prefix@/doc +PUB_LIB=$(LIB) + +## Shared libraries +DYNAMIC_DIRS=@DYNAMIC_DIRS@ +LT=$(top_builddir)/libtool +LT_CCOMPILE=$(LT) --mode=compile $(CC) +LT_LINK_CLIB=$(LT) --mode=link $(CC) -rpath $(libdir) +LT_LINK_CEXE=$(LT) --mode=link $(CC) $(DYNAMIC_DIRS) -rpath $(bindir) +LT_RUN=$(LT) --mode=execute +LT_INSTALL_PROG=$(LT) --mode=install $(INSTALL_PROGRAM) +LT_INSTALL_LIB=$(LT) --mode=install $(INSTALL_DATA) +LT_UNINSTALL=$(LT) --mode=uninstall $(RM) + +# Fortran compilation/linking stuff +LT_FCOMPILE=$(LT) --mode=compile $(F9X) +LT_LINK_FLIB=$(LT) --mode=link $(F9X) -static $(DYNAMIC_DIRS) +LT_LINK_FEXE=$(LT) --mode=link $(F9X) -static $(DYNAMIC_DIRS) + +## Optional variables. We must declare them here because Irix pmake +## complains if it sees a reference to a variable which has never been +## defined. The main makefile is free to redefine these to something else. +DOCDIR=$(docdir) +LIB= +LIB_SRC= +LIB_OBJ= +PUB_HDR= +PUB_PROGS= +PROGS= +TEST_PROGS= +TEST_FLAGS= +TEST_SCRIPTS= + +## The default is to build the library and/or programs. We must build +## them sequentially. +all: + $(MAKE) lib + $(MAKE) progs + $(MAKE) tests + +## The following rules insure that the Makefile is up-to-date by rerunning +## various autoconf components (although not all versions of make assume +## that the makefile is implicitly a target). We use time stamp files to +## keep track of the most recent update of H5config.h.in and H5config.h +## because autoheader and config.status don't update the modification time +## if the contents don't change. +## Invoke it by "gmake reconfigure". +## +## Graphically, the dependencies are: +## +## configure.in +## | | +## +-----------------+ +------------+ +## | | +## stamp1 configure +## (H5config.h.in) | +## | | | +## | +---------------+ +-----------+ +## | | | +## | config.status +## | | +## | +------------------+ +## | | +## stamp2 +## (H5config.h) Makefile.in et al +## | | +## +------------------+ +-----------+ +## | | +## Makefile +## +## A side effect of updating stamp1 is to generate H5config.h.in and a +## side effect of updating stamp2 is to generate H5config.h. When using +## a version of make that doesn't treat the makefile as the initial target +## the user may want to occassionally type `make Makefile' in any source +## directory. +## The `Makefile' target has been renamed to `reconfigure' so that the +## autoconf and make depend processes do not start up automatically. +## One must do `make reconfigure' explicitedly to start the process. +## (When srcdir is used and if more than one machines are running, +## this automatic Makefile/autoconf can get things unstable.) +## +STAMP1=$(top_builddir)/config/stamp1 +STAMP2=$(top_builddir)/config/stamp2 + +MAKEFILE_PARTS=$(srcdir)/Makefile.in \ + $(top_srcdir)/config/commence.in \ + $(top_srcdir)/config/conclude.in \ + $(top_srcdir)/config/depend1.in \ + $(top_srcdir)/config/depend2.in \ + $(top_srcdir)/config/depend3.in \ + $(top_srcdir)/config/depend4.in \ + $(top_srcdir)/config/dependN.in + +$(STAMP1): $(top_srcdir)/configure.in + touch $(STAMP1) + -cd $(top_srcdir); autoheader + +$(STAMP2): $(STAMP1) $(top_builddir)/config.status + touch $(STAMP2) + -cd $(top_builddir); \ + CONFIG_FILES= CONFIG_HEADERS=src/H5config.h ./config.status + +$(top_srcdir)/configure: $(top_srcdir)/configure.in + -cd $(top_srcdir); autoconf + +$(top_builddir)/config.status: $(top_srcdir)/configure $(STAMP1) + -cd $(top_builddir); ./config.status --recheck + +# rerun the autoconf process if any configure components have changed. +reconfigure: $(MAKEFILE_PARTS) $(STAMP2) + -cd $(top_builddir); CONFIG_HEADERS= ./config.status + +##----------------------------------------------------------------------------- +## The following section of this makefile comes from the middle of +## `Makefile.in' from this directory. It was generated by running +## `config.status'. +##----------------------------------------------------------------------------- diff --git a/fortran/config/conclude.in b/fortran/config/conclude.in new file mode 100644 index 0000000..2f3c11e --- /dev/null +++ b/fortran/config/conclude.in @@ -0,0 +1,185 @@ +##------------------------------------------------------------ -*- makefile -*- +## The following section of this makefile comes from the +## `./config/conclude' file which was generated with config.status +## from `./config/conclude.in'. +##----------------------------------------------------------------------------- + +## This is the target for the library described in the main body of the +## makefile. +## +lib: $(LIB) +$(LIB) __no_library__: $(LIB_OBJ) + @$(LT_LINK_FLIB) -o $@ $(FFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS) + +progs: $(LIB) $(PROGS) + +## Build a tags file in this directory. +TAGS: $(LIB_SRC) + $(RM) $@ + -etags $(LIB_SRC) + +## Runs each test in order, passing $(TEST_FLAGS) to the program. +tests: $(TEST_PROGS) $(LIB) +check test _test: tests + @for test in $(TEST_PROGS) dummy; do \ + if test $$test != dummy; then \ + echo "============================"; \ + echo "Testing $$test $(TEST_FLAGS)"; \ + echo "============================"; \ + PATH=".:$$PATH" srcdir=$(srcdir) \ + $(RUNTEST) $$test $(TEST_FLAGS) || \ + exit 1; \ + echo ""; \ + fi; \ + done; + @for test in $(TEST_SCRIPTS) dummy; do \ + if test $$test != dummy; then \ + echo "============================"; \ + echo "Testing $$test $(TEST_FLAGS)"; \ + echo "============================"; \ + RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \ + srcdir=$(srcdir) \ + /bin/sh $$test $(TEST_FLAGS) || \ + exit 1; \ + echo ""; \ + fi; \ + done; + +## Make installation directories directories if they don't exist. +$(libdir): + mkdir $@ && chmod 755 $@ + +$(includedir): + mkdir $@ && chmod 755 $@ + +$(bindir): + mkdir $@ && chmod 755 $@ + +$(DOCDIR): + mkdir $@ && chmod 755 $@ + +## Install the library, the public header files, and public programs. +install: $(PUB_LIB) $(PUB_HDR) $(PUB_PROGS) $(libdir) $(includedir) $(bindir) + @for f in X $(PUB_LIB); do \ + if test $$f != X; then \ + ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \ + fi; \ + done + @if test -f libhdf5.settings; then \ + (set -x; $(INSTALL_DATA) libhdf5.settings $(libdir)/. || exit 1); \ + fi + @for f in X $(PUB_HDR); do \ + if test $$f != X; then \ + if test -f $$f; then \ + (set -x; $(INSTALL_DATA) $$f $(includedir)/. || exit 1); \ + else \ + (set -x; $(INSTALL_DATA) $(srcdir)/$$f $(includedir)/. || \ + exit 1); \ + fi; \ + fi; \ + done + @for f in X $(PUB_PROGS); do \ + if test $$f != X; then \ + ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \ + fi; \ + done + +## Install the documents. +install-doc: $(PUB_DOCS) $(DOCDIR) + @for d in X $(SUBDIRS); do \ + if test $$d != X; then \ + (set -x; cd $$d && $(MAKE) $@) || exit 1; \ + fi; \ + done + @for f in X $(PUB_DOCS); do \ + if test $$f != X; then \ + if test -f $$f; then \ + (set -x; $(INSTALL_DATA) $$f $(DOCDIR)/. || exit 1); \ + else \ + (set -x; $(INSTALL_DATA) $(srcdir)/$$f $(DOCDIR)/. || \ + exit 1); \ + fi; \ + fi; \ + done + +## Removes those things that `make install' (would have) installed. +uninstall: + @for f in libhdf5.settings $(LIB); do \ + $(LT_UNINSTALL) $(libdir)/$$f; \ + done + @if test "X$(PUB_HDR)" != X; then \ + set -x; cd $(includedir) && $(RM) $(PUB_HDR); \ + fi + @for f in X $(PUB_PROGS); do \ + if test $$f != X; then \ + $(LT_UNINSTALL) $(bindir)/$$f; \ + fi; \ + done + +## Removes those things that `make install-doc' (would have) installed. +uninstall-doc: + @for d in X $(SUBDIRS); do \ + if test $$d != X; then \ + (set -x; cd $$d && $(MAKE) $@) || exit 1; \ + fi; \ + done + @if test "X$(PUB_DOCS)" != X; then \ + set -x; cd $(DOCDIR) && $(RM) $(PUB_DOCS); \ + fi + +## Removes temporary files without removing the final target files. That is, +## remove things like object files but not libraries or executables. +## +mostlyclean: + -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o) + -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o) + -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN) + +## Like `mostlyclean' except it also removes the final targets: things like +## libraries and executables. This target doesn't remove any file that +## is part of the HDF5 distribution. +## +clean: mostlyclean + -$(RM) $(LIB) $(TEST_PROGS) $(PROGS) $(CLEAN) + -$(RM) *.M *.a *.mod + -$(RM) -r .libs + +## Like `clean' except it also removes files that were created by running +## configure. If you've unpacked the source and built HDF5 without creating +## any other files, then `make distclean' will leave only the files that were +## in the distribution. +## +distclean: clean + -$(RM) .depend TAGS *~ core *.core *.bak *.old *.new $(DISTCLEAN) + @if test -f $(srcdir)/Makefile.in; then \ + (set -x; $(RM) Makefile); \ + fi + + +## Like `distclean' except it deletes all files that can be regenerated from +## the makefile, including those generated from autoheader and autoconf. +## +maintainer-clean: distclean + -$(RM) *~ core core.* *.core *.bak *.contrib gmon.out + +## Implicit rules +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + +.c.lo: + @$(LT_CCOMPILE) $(CFLAGS) $(CPPFLAGS) -c $< + +.f90.o: + $(F9X) $(FFLAGS) -c $< + +.f90.lo: + @$(LT_FCOMPILE) $(FFLAGS) -c $< + +##----------------------------------------------------------------------------- +## The following section of this makefile contains dependencies between the +## source files and the header files. +##----------------------------------------------------------------------------- +.PHONY: dep depend +dep depend: Dependencies + +@DEPEND@ diff --git a/fortran/config/dec-flags b/fortran/config/dec-flags new file mode 100644 index 0000000..c9a34b3 --- /dev/null +++ b/fortran/config/dec-flags @@ -0,0 +1,92 @@ +# -*- shell-script -*- +# +# This file should be sourced into configure if the compiler is a DEC +# compiler. It is careful not to do anything if the compiler is not +# DEC; otherwise `cc_flags_set' is set to `yes' +# + +# Get the compiler version unless it's already known. +# +# cc_vendor: The compiler vendor: DEC +# cc_version: Version number, like: V5.2-038 +# +if test X = "X$cc_flags_set"; then + cc_vendor=DEC + cc_version="`$CC $CFLAGS -V 2>&1 |head -1 |\ + sed 's/.*DEC C \(V[0-9][-\.0-9]*\).*/\1/'`" + if test X != "$gcc_version"; then + echo "compiler '$CC' is $cc_vendor-$cc_version" + else + cc_vendor= + fi +fi + +# Warn about old compilers that don't work right. +case "$cc_vendor-$cc_version" in + DEC-V5.2-038) + cat <$@; \ + echo '## Only temporary changes may be made here.' \ + >>$@; \ + echo >>$@; \ + perl -p $(top_srcdir)/bin/distdep .depend >>$@; \ + fi + +.PRECIOUS: .depend +.depend: $(LIB_SRC) $(TEST_SRC) $(PROG_SRC) + @touch .depend + @for dep in $? dummy; do \ + if [ $$dep != "dummy" ]; then \ + echo Building dependencies for $$dep; \ + obj=`basename $$dep .c`.lo; \ + sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \ + $(TRACE) $$dep; \ + $(CC) -M -MG $(CPPFLAGS) $$dep 2>/dev/null | \ + sed 's% $(srcdir)/% $$(srcdir)/%g' | \ + sed 's% $(top_srcdir)/% $$(top_srcdir)/%g' | \ + sed 's% $(top_builddir)/% $$(top_builddir)/%g' | \ + sed 's/\.o/.lo/' >>$@; \ + fi; \ + done; + @if test "$(srcdir)" != "."; then \ + echo '## This file is machine generated on GNU systems.' \ + >Dependencies; \ + echo '## Only temporary changes may be made here.' \ + >>Dependencies; \ + echo >>Dependencies; \ + perl -p $(top_srcdir)/bin/distdep .depend>>Dependencies;\ + fi + +-include .depend + diff --git a/fortran/config/depend2.in b/fortran/config/depend2.in new file mode 100644 index 0000000..ae49989 --- /dev/null +++ b/fortran/config/depend2.in @@ -0,0 +1,11 @@ +## -*- makefile -*- + +## This platform doesn't support automatic dependencies because we're +## not using GNU gcc. GNU gcc is needed in order to generate the list +## of header files included by a source file. + +## Since automatic dependencies are not being used, we attempt to include the +## `.distdep' file from the source tree. This file was automatically generated +## on some system that satisfies the above requirements. + +-include Dependencies diff --git a/fortran/config/depend3.in b/fortran/config/depend3.in new file mode 100644 index 0000000..26056d2 --- /dev/null +++ b/fortran/config/depend3.in @@ -0,0 +1,7 @@ +## -*- makefile -*- + +## Since automatic dependencies are not being used, we attempt to include the +## `.distdep' file from the source tree. This file was automatically generated +## on some system that satisfies the above requirements. + +.include diff --git a/fortran/config/depend4.in b/fortran/config/depend4.in new file mode 100644 index 0000000..84e0f53 --- /dev/null +++ b/fortran/config/depend4.in @@ -0,0 +1,7 @@ +## -*- makefile -*- + +## Since automatic dependencies are not being used, we attempt to include the +## `.distdep' file from the source tree. This file was automatically generated +## on some system that satisfies the above requirements. + +include Dependencies diff --git a/fortran/config/dependN.in b/fortran/config/dependN.in new file mode 100644 index 0000000..7ece270 --- /dev/null +++ b/fortran/config/dependN.in @@ -0,0 +1,4 @@ +## -*- makefile -*- + +## Automatic dependencies are not being used and we cannot include other +## files. diff --git a/fortran/config/freebsd b/fortran/config/freebsd new file mode 100644 index 0000000..8608a85 --- /dev/null +++ b/fortran/config/freebsd @@ -0,0 +1,21 @@ +# -*- shell-script -*- +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# The default compiler is `gcc' +if test "X-" = "X-$CC"; then + CC=gcc + CC_BASENAME=gcc +fi + +# Architecture-specific flags +ARCH= + +# Omit frame pointer for optimized code? +NOFP=${NOFP:=-fomit-frame-pointer} + +# Figure out compiler flags +. $srcdir/config/gnu-flags diff --git a/fortran/config/gnu-flags b/fortran/config/gnu-flags new file mode 100644 index 0000000..99c9419 --- /dev/null +++ b/fortran/config/gnu-flags @@ -0,0 +1,227 @@ +# -*- shell-script -*- +# +# This file should be sourced into configure if the compiler is the +# GNU gcc compiler or a derivative. It is careful not to do anything +# if the compiler is not GNU; otherwise `cc_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for gcc, egcs, and +# pgcc unless a compiler version is already known +# +# cc_vendor: The compiler name: gcc, egcs, or pgcc +# cc_version: Version number: 2.91.60, 2.7.2.1 +# +if test X = "X$cc_flags_set"; then + cc_version="`$CC $CFLAGS -v 2>&1 |grep 'gcc version' |\ + sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` + cc_version=`echo $cc_version |sed 's/[-a-z]//g'` + if test X = "X$cc_vendor" -a X != "X$cc_version"; then + cc_vendor=gcc + fi + if test "-" != "$cc_vendor-$cc_version"; then + echo "compiler '$CC' is GNU $cc_vendor-$cc_version" + fi + + # Some version numbers + cc_vers_major=`echo $cc_version | cut -f1 -d.` + cc_vers_minor=`echo $cc_version | cut -f2 -d.` + cc_vers_patch=`echo $cc_version | cut -f3 -d.` + test -n "$cc_vers_major" || cc_vers_major=0 + test -n "$cc_vers_minor" || cc_vers_minor=0 + test -n "$cc_vers_patch" || cc_vers_patch=0 + cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch` +fi + +# GCC compilers before gcc-2.8.1 have problems with `long long'. +if test gcc = $cc_vendor -a $cc_vers_all -lt 2008001; then + cat <&1 |head -1`" in + "Mongoose Compilers: Version 7.00") + echo " +---------------------------------------------------+" + echo " | You have an old version of cc (Mongoose Compilers |" + echo " | version 7.00). Please upgrade to MIPSpro version |" + echo " | 7.2.1.2m (patches are available from the SGI web |" + echo " | site). The 7.00 version may generate incorrect |" + echo " | code, especially when optimizations are enabled. |" + echo " +---------------------------------------------------+" + sleep 5 + ;; + esac + + # Do *not* use -ansi because it prevents hdf5 from being able + # to read modification dates from the file. On some systems it + # can also result in compile errors in system header files + # since hdf5 includes a couple non-ANSI header files. + #CFLAGS="$CFLAGS -ansi" + + # Always turn off these compiler warnings for the -64 compiler: + # 1174: function declared but not used + # 1196: __vfork() (this is an SGI config problem) + # 1209: constant expressions + # 1429: the `long long' type is not standard + # 1685: turn off warnings about turning off invalid warnings + # 3201: remark - parameter not referenced + CFLAGS="$CFLAGS -woff 1174,1429,1209,1196,1685,3201" + + # Always turn off these compiler warnings for the old compiler: + # 799: the `long long' type is not standard + # 803: turn off warnings about turning off invalid warnings + # 835: __vfork() (this is an SGI config problem) + CFLAGS="$CFLAGS -woff 799,803,835" + + # Always turn off these loader warnings: + # (notice the peculiar syntax) + # 47: branch instructions that degrade performance on R4000 + # 84: a library is not used + # 85: duplicate definition preemption (from -lnsl) + # 134: duplicate weak definition preemption (from -lnsl) + CFLAGS="$CFLAGS -Wl,-woff,47,-woff,84,-woff,85,-woff,134" + + # Extra debugging flags + DEBUG_CFLAGS="-g -fullwarn" + DEBUG_CPPFLAGS= + + # Extra production flags + PROD_CFLAGS="-64 -mips4 -O -s" + PROD_CPPFLAGS= + + # Extra profiling flags + PROFILE_CFLAGS=-pg + PROFILE_CPPFLAGS= + ;; +esac + +# Use SGI supplied C compiler by default. There is no ranlib +if test "X-" = "X-$F9X"; then + F9X="f90" + FFLAGS="-64 -mips4 -O -s" + DEBUG_FFLAGS="-64 -mips4 -O -s" + PROD_FFLAGS="-64 -mips4 -O -s" + PROFILE_FFLAGS="-64 -mips4 -O -s" +fi + +# The default Fortran 90 compiler + +# +# HDF5 integers +# +# R_LARGE is the number of digits for the bigest integer supported. +# R_INTEGER is the number of digits in INTEGER +# +# (for the IRIX architechture) +# +R_LARGE=18 +R_INTEGER=9 +HSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HSSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HID_T='SELECTED_INT_KIND(R_INTEGER)' +SIZE_T='SELECTED_INT_KIND(R_LARGE)' +OBJECT_NAMELEN_DEFAULT_F=-1 + +if test "X-" = "X-$F9X"; then + F9X=f90 +fi + +if test "X-" = "X-$f9x_flags_set"; then + FFLAGS="-64 -mips4 -O -s" + DEBUG_FFLAGS="-64 -mips4 -O -s" + PROD_FFLAGS="-64 -mips4 -O -s" + PROFILE_FFLAGS="-64 -mips4 -O -s" + f9x_flags_set=yes +fi diff --git a/fortran/config/linux-gnu b/fortran/config/linux-gnu new file mode 100644 index 0000000..d139966 --- /dev/null +++ b/fortran/config/linux-gnu @@ -0,0 +1,4 @@ +# -*- shell-script -*- +# This is the same as linux-gnulibc1 + +. $srcdir/config/linux-gnulibc1 diff --git a/fortran/config/linux-gnulibc1 b/fortran/config/linux-gnulibc1 new file mode 100644 index 0000000..6765b0b --- /dev/null +++ b/fortran/config/linux-gnulibc1 @@ -0,0 +1,49 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# The default compiler is `gcc'. +if test "X-" = "X-$CC"; then + CC=gcc + CC_BASENAME=gcc +fi + +# Omit frame pointer for optimized code? +NOFP=${NOFP:=-fomit-frame-pointer} + +# Figure out compiler flags +. $srcdir/config/gnu-flags + +# The default Fortran 90 compiler + +# +# HDF5 integers +# +# R_LARGE is the number of digits for the bigest integer supported. +# R_INTEGER is the number of digits in INTEGER +# +# (for the Linux architechture) +# +R_LARGE=18 +R_INTEGER=9 +HSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HSSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HID_T='SELECTED_INT_KIND(R_INTEGER)' +SIZE_T='SELECTED_INT_KIND(R_INTEGER)' +OBJECT_NAMELEN_DEFAULT_F=-1 + +if test "X-" = "X-$F9X"; then + F9X=pgf90 +fi + +if test "X-" = "X-$f9x_flags_set"; then + FFLAGS= + DEBUG_FFLAGS= + PROD_FFLAGS= + PROFILE_FFLAGS= + f9x_flags_set=yes +fi diff --git a/fortran/config/linux-gnulibc2 b/fortran/config/linux-gnulibc2 new file mode 100644 index 0000000..4551fb6 --- /dev/null +++ b/fortran/config/linux-gnulibc2 @@ -0,0 +1,10 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# Same as with gnulibc1 for now +. $srcdir/config/linux-gnulibc1 diff --git a/fortran/config/powerpc-ibm-aix4.2.1.0 b/fortran/config/powerpc-ibm-aix4.2.1.0 new file mode 100644 index 0000000..cab0d8b --- /dev/null +++ b/fortran/config/powerpc-ibm-aix4.2.1.0 @@ -0,0 +1,22 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# Cross compiling defaults +hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} +ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} +ac_cv_header_stdc=${ac_cv_header_stdc='yes'} +ac_cv_sizeof_short=${ac_cv_sizeof_short=2} +ac_cv_sizeof_int=${ac_cv_sizeof_int=4} +ac_cv_sizeof_long=${ac_cv_sizeof_long=4} +ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} +ac_cv_sizeof_float=${ac_cv_sizeof_float=4} +ac_cv_sizeof_double=${ac_cv_sizeof_double=8} +ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} +ac_cv_sizeof_int=${ac_cv_sizeof_int=4} +ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=4} +ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t=8} diff --git a/fortran/config/powerpc-ibm-aix4.3.2.0 b/fortran/config/powerpc-ibm-aix4.3.2.0 new file mode 100644 index 0000000..db5eb05 --- /dev/null +++ b/fortran/config/powerpc-ibm-aix4.3.2.0 @@ -0,0 +1,63 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + + +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. + +# What must *always* be present for things to compile correctly? +#CFLAGS="$CFLAGS -ansi" +#CPPFLAGS="$CPPFLAGS -I." + +# What compiler flags should be used for code development? +DEBUG_CFLAGS= +DEBUG_CPPFLAGS= + +# What compiler flags should be used for building a production +# library? +PROD_CFLAGS= +PROD_CPPFLAGS= + +# What compiler flags enable code profiling? +PROFILE_CFLAGS= +PROFILE_CPPFLAGS= + + +#---------------------------------------------------------------------------- +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. + +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} +ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} +ac_cv_header_stdc=${ac_cv_header_stdc='yes'} +ac_cv_sizeof_short=${ac_cv_sizeof_short=2} +ac_cv_sizeof_int=${ac_cv_sizeof_int=4} +ac_cv_sizeof_long=${ac_cv_sizeof_long=4} +ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} +ac_cv_sizeof_float=${ac_cv_sizeof_float=4} +ac_cv_sizeof_double=${ac_cv_sizeof_double=8} +ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} +ac_cv_sizeof_int=${ac_cv_sizeof_int=4} +ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=4} +ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t=8} +ac_cv_sizeof_uint8_t=${ac_cv_sizeof_uint8_t=1} +ac_cv_sizeof_uint16_t=${ac_cv_sizeof_uint16_t=2} +ac_cv_sizeof_uint32_t=${ac_cv_sizeof_uint32_t=4} +ac_cv_sizeof_uint64_t=${ac_cv_sizeof_uint64_t=8} +ac_cv_sizeof_int8_t=${ac_cv_sizeof_int8_t=1} +ac_cv_sizeof_int16_t=${ac_cv_sizeof_int16_t=2} +ac_cv_sizeof_int32_t=${ac_cv_sizeof_int32_t=4} +ac_cv_sizeof_int64_t=${ac_cv_sizeof_int64_t=8} +ac_cv_sizeof___int64=${ac_cv_sizeof___int64=8} +ac_cv_sizeof_char=${ac_cv_sizeof_char=1} +ac_cv_header_sys_ioctl_h=${ac_cv_header_sys_ioctl_h=yes} +ac_cv_path_install=${ac_cv_path_install='cp -r'} +RUNPARALLEL="MP_PROCS=2 poe" diff --git a/fortran/config/powerpc-ibm-aix4.x b/fortran/config/powerpc-ibm-aix4.x new file mode 100644 index 0000000..24176a5 --- /dev/null +++ b/fortran/config/powerpc-ibm-aix4.x @@ -0,0 +1,21 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# Cross compiling defaults +ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} +ac_cv_header_stdc=${ac_cv_header_stdc='yes'} +ac_cv_sizeof_short=${ac_cv_sizeof_short=2} +ac_cv_sizeof_int=${ac_cv_sizeof_int=4} +ac_cv_sizeof_long=${ac_cv_sizeof_long=4} +ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} +ac_cv_sizeof_float=${ac_cv_sizeof_float=4} +ac_cv_sizeof_double=${ac_cv_sizeof_double=8} +ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} +ac_cv_sizeof_int=${ac_cv_sizeof_int=4} +ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=4} +ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t=8} diff --git a/fortran/config/rs6000-ibm-aix4.x b/fortran/config/rs6000-ibm-aix4.x new file mode 100644 index 0000000..2f7cc86 --- /dev/null +++ b/fortran/config/rs6000-ibm-aix4.x @@ -0,0 +1,10 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# Cross compiling defaults +ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} diff --git a/fortran/config/solaris2.x b/fortran/config/solaris2.x new file mode 100644 index 0000000..9758cfc --- /dev/null +++ b/fortran/config/solaris2.x @@ -0,0 +1,62 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details + +# The default compiler is `sunpro cc' +if test "X-" = "X-$CC"; then + CC=cc + CC_BASENAME=cc +fi + +# Try gcc compiler flags +. $srcdir/config/gnu-flags + +# Try solaris native compiler flags +if test "X-" = "X-$cc_flags_set"; then + CFLAGS="-erroff=%none" + DEBUG_CFLAGS=-g + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O -s" + PROD_CPPFLAGS= + PROFILE_CFLAGS=-xpg + PROFILE_CPPFLAGS= + cc_flags_set=yes + # Turn off optimization flag for SUNpro compiler versions 4.x which + # have an optimization bug. Version 5.0 works. + ($CC -V 2>&1) | grep -s 'cc: .* C 4\.' >/dev/null 2>&1 \ + && PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O//'`" +fi + +# The default Fortran 90 compiler + +# +# HDF5 integers +# +# R_LARGE is the number of digits for the bigest integer supported. +# R_INTEGER is the number of digits in INTEGER +# +# (for the Sparc Solaris architechture) +# +R_LARGE=9 +R_INTEGER=9 +HSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HSSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HID_T='SELECTED_INT_KIND(R_INTEGER)' +SIZE_T='SELECTED_INT_KIND(R_LARGE)' +OBJECT_NAMELEN_DEFAULT_F=-1 + +if test "X-" = "X-$F9X"; then + F9X=f90 +fi + +if test "X-" = "X-$f9x_flags_set"; then + FFLAGS= + DEBUG_FFLAGS= + PROD_FFLAGS= + PROFILE_FFLAGS= + f9x_flags_set=yes +fi diff --git a/fortran/config/unicos b/fortran/config/unicos new file mode 100644 index 0000000..71201af --- /dev/null +++ b/fortran/config/unicos @@ -0,0 +1,166 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + + +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. +#---------------------------------------------------------------------------- + + +# Choosing a C Compiler +# --------------------- +# +# The user should be able to specify the compiler by setting the CC +# environment variable to the name of the compiler and any switches it +# requires for proper operation. If CC is unset then this script may +# set it. If CC is unset by time this script completes then configure +# will try `gcc' and `cc' in that order (perhaps some others too). +# +# Note: Code later in this file may depend on the value of $CC_BASENAME +# in order to distinguish between different compilers when +# deciding which compiler command-line switches to use. This +# variable is set based on the incoming value of $CC and is only +# used within this file. + +if test "X-" = "X-$CC"; then + CC=cc + CC_BASENAME=cc +fi +# no need to use RANLIB +RANLIB=: + + +# C Compiler and Preprocessor Flags +# --------------------------------- +# +# Flags that end with `_CFLAGS' are always passed to the compiler. +# Flags that end with `_CPPFLAGS' are passed to the compiler when +# compiling but not when linking. +# +# DEBUG_CFLAGS Flags to pass to the compiler to create a +# DEBUG_CPPFLAGS library suitable for use with debugging +# tools. Usually this list will exclude +# optimization switches (like `-O') and include +# switches that turn on symbolic debugging +# support (like `-g'). +# +# PROD_CFLAGS Flags to pass to the compiler to create a +# PROD_CPPFLAGS production version of the library. These +# usualy exclude symbolic debugging switches +# (like `-g') and include optimization switches +# (like `-O'). +# +# PROFILE_CFLAGS Flags to pass to the compiler to create a +# PROFILE_CPPFLAGS library suitable for performance testing (like +# `-pg'). This may or may not include debugging +# or production flags. +# +# CFLAGS Flags can be added to this variable which +# might already be partially initialized. These +# flags will always be passed to the compiler +# and should include switches to turn on full +# warnings. HDF5 attempts to be ANSI and Posix +# compliant and employ good programming +# practices resulting in few if any +# warnings. +# +# Warning flags do not have to be added to CFLAGS +# variable if the compiler is the GNU gcc +# compiler or a descendent of gcc such as EGCS or PGCC. +# +# The CFLAGS should contains *something* or else +# configure will probably add `-g'. For most +# systems this isn't a problem but some systems +# will disable optimizations in favor of the +# `-g'. +# +# +# These flags should be set according to the compiler being used. +# There are two ways to check the compiler. You can try using `-v' or +# `--version' to see if the compiler will print a version string. You +# can use the value of $CC_BASENAME which is the base name of the +# first word in $CC (note that the value of CC may have changed +# above). + +case $CC_BASENAME in + gcc) + CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-O3 -fomit-frame-pointer" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; + + cc) + CFLAGS="$CFLAGS" + DEBUG_CFLAGS="-g -h zero -h scalar0" + DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-O2 -h scalar0" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; + + *) + CFLAGS="$CFLAGS -ansi" + DEBUG_CFLAGS="-g" + DEBUG_CPPFLAGS="-DH5F_OPT_SEEK=0 -DH5F_LOW_DFLT=H5F_LOW_SEC2" + PROD_CFLAGS="-O" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; +esac + +# Overriding Configure Tests +# -------------------------- +# +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. + +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} + +# Set this to the width required by printf() to print type `long +# long'. For instance, if the format would be `%lld' then set it to +# `ll' or if the format would be `%qd' set it to `q'. +#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} + +# The default Fortran 90 compiler + +# +# HDF5 integers +# +# R_LARGE is the number of digits for the bigest integer supported. +# R_INTEGER is the number of digits in INTEGER +# +# (for the UNICOS architechture) +# +R_LARGE=18 +R_INTEGER=18 +HSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HSSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HID_T='SELECTED_INT_KIND(R_INTEGER)' +SIZE_T='SELECTED_INT_KIND(R_LARGE)' +OBJECT_NAMELEN_DEFAULT_F=-1 + +if test "X-" = "X-$F9X"; then + F9X=f90 +fi + +if test "X-" = "X-$f9x_flags_set"; then + FFLAGS="-dp" + DEBUG_FFLAGS="-dp" + PROD_FFLAGS="-dp" + PROFILE_FFLAGS="-dp" + f9x_flags_set=yes +fi diff --git a/fortran/config/unicosmk b/fortran/config/unicosmk new file mode 100644 index 0000000..3c46387 --- /dev/null +++ b/fortran/config/unicosmk @@ -0,0 +1,168 @@ +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + + +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. +#---------------------------------------------------------------------------- + + +# Choosing a C Compiler +# --------------------- +# +# The user should be able to specify the compiler by setting the CC +# environment variable to the name of the compiler and any switches it +# requires for proper operation. If CC is unset then this script may +# set it. If CC is unset by time this script completes then configure +# will try `gcc' and `cc' in that order (perhaps some others too). +# +# Note: Code later in this file may depend on the value of $CC_BASENAME +# in order to distinguish between different compilers when +# deciding which compiler command-line switches to use. This +# variable is set based on the incoming value of $CC and is only +# used within this file. + +if test "X-" = "X-$CC"; then + CC=cc + CC_BASENAME=cc +fi +# no need to use RANLIB +RANLIB=: + + +# C Compiler and Preprocessor Flags +# --------------------------------- +# +# Flags that end with `_CFLAGS' are always passed to the compiler. +# Flags that end with `_CPPFLAGS' are passed to the compiler when +# compiling but not when linking. +# +# DEBUG_CFLAGS Flags to pass to the compiler to create a +# DEBUG_CPPFLAGS library suitable for use with debugging +# tools. Usually this list will exclude +# optimization switches (like `-O') and include +# switches that turn on symbolic debugging +# support (like `-g'). +# +# PROD_CFLAGS Flags to pass to the compiler to create a +# PROD_CPPFLAGS production version of the library. These +# usualy exclude symbolic debugging switches +# (like `-g') and include optimization switches +# (like `-O'). +# +# PROFILE_CFLAGS Flags to pass to the compiler to create a +# PROFILE_CPPFLAGS library suitable for performance testing (like +# `-pg'). This may or may not include debugging +# or production flags. +# +# CFLAGS Flags can be added to this variable which +# might already be partially initialized. These +# flags will always be passed to the compiler +# and should include switches to turn on full +# warnings. HDF5 attempts to be ANSI and Posix +# compliant and employ good programming +# practices resulting in few if any +# warnings. +# +# Warning flags do not have to be added to CFLAGS +# variable if the compiler is the GNU gcc +# compiler or a descendent of gcc such as EGCS or PGCC. +# +# The CFLAGS should contains *something* or else +# configure will probably add `-g'. For most +# systems this isn't a problem but some systems +# will disable optimizations in favor of the +# `-g'. +# +# +# These flags should be set according to the compiler being used. +# There are two ways to check the compiler. You can try using `-v' or +# `--version' to see if the compiler will print a version string. You +# can use the value of $CC_BASENAME which is the base name of the +# first word in $CC (note that the value of CC may have changed +# above). + +case $CC_BASENAME in + gcc) + CFLAGS="$CFLAGS -Wsign-compare" #Only works for some versions + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O3 -fomit-frame-pointer" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; + + cc) + CFLAGS="$CFLAGS" + DEBUG_CFLAGS="-g -h zero" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O2 -h scalar0" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; + + *) + CFLAGS="$CFLAGS -ansi" + DEBUG_CFLAGS="-g" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; +esac + + + +# Overriding Configure Tests +# -------------------------- +# +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. + +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} + +# Set this to the width required by printf() to print type `long +# long'. For instance, if the format would be `%lld' then set it to +# `ll' or if the format would be `%qd' set it to `q'. +#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} + +# The default Fortran 90 compiler + +# +# HDF5 integers +# +# R_LARGE is the number of digits for the bigest integer supported. +# R_INTEGER is the number of digits in INTEGER +# +# (for the UNICOS architechture) +# +R_LARGE=18 +R_INTEGER=18 +HSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HSSIZE_T='SELECTED_INT_KIND(R_LARGE)' +HID_T='SELECTED_INT_KIND(R_INTEGER)' +SIZE_T='SELECTED_INT_KIND(R_LARGE)' +OBJECT_NAMELEN_DEFAULT_F=-1 + +if test "X-" = "X-$F9X"; then + F9X=f90 +fi + +if test "X-" = "X-$f9x_flags_set"; then + FFLAGS="-dp" + DEBUG_FFLAGS="-dp" + PROD_FFLAGS="-dp" + PROFILE_FFLAGS="-dp" + f9x_flags_set=yes +fi diff --git a/fortran/configure b/fortran/configure new file mode 100755 index 0000000..30f17b3 --- /dev/null +++ b/fortran/configure @@ -0,0 +1,2981 @@ +#! /bin/sh + +# From configure.in Id: configure.in + + + + + + + + + + + + + + + + + + + + +## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- +## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 40 AC_PROG_LIBTOOL + + + + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support + + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's + + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. + + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared + + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. + + +# AC_DISABLE_STATIC - set the default static flag to --disable-static + + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. + + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker + + + + +# AC_PROG_NM - find the path to a BSD-compatible name lister + + +# AC_CHECK_LIBM - check for math library + + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. + + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. + + + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-shared[=PKGS] build shared libraries [default=yes]" +ac_help="$ac_help + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-zlib=INC,LIB Use the GNU zlib compression" +ac_help="$ac_help + --enable-parallel=TYPE Search for MPI-IO and MPI support files" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # 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 << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --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 +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=src/HDF5.f90 + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +ac_aux_dir= +for ac_dir in bin $srcdir/bin; 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 + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in bin $srcdir/bin" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:685: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + + + + + + + + + + +echo $ac_n "checking shell variables initial values""... $ac_c" 1>&6 +echo "configure:716: checking shell variables initial values" >&5 +set >&5 +echo "$ac_t""done" 1>&6 + +if test -x /bin/pwd; then + pwd=/bin/pwd +else + pwd=pwd +fi + ROOT=`$pwd` + +echo $ac_n "checking for cached host""... $ac_c" 1>&6 +echo "configure:728: checking for cached host" >&5 +if eval "test \"`echo '$''{'hdf5_cv_host'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + hdf5_cv_host="none" +fi + +echo "$ac_t""$hdf5_cv_host" 1>&6; +if test "X$hdf5_cv_host" = "Xnone"; then + hdf5_cv_host=$host +elif test "$hdf5_cv_host" != "$host"; then + echo "The config.cache file was generated on $hdf5_cv_host but" + echo "this is $host. Please remove that file and try again." + { echo "configure: error: config.cache file is invalid" 1>&2; exit 1; } +fi + +case "$host_os" in + aix4.*) + host_os_novers=aix4.x + ;; + freebsd*) + host_os_novers=freebsd + ;; + irix5.*) + host_os_novers=irix5.x + ;; + irix6.*) + host_os_novers=irix6.x + ;; + osf4.*) + host_os_novers=osf4.x + ;; + solaris2.*) + host_os_novers=solaris2.x + ;; + *) + host_os_novers=$host_os + ;; +esac + +host_config="none" +for f in $host_cpu-$host_vendor-$host_os \ + $host_cpu-$host_vendor-$host_os_novers \ + $host_vendor-$host_os \ + $host_vendor-$host_os_novers \ + $host_cpu-$host_os \ + $host_cpu-$host_os_novers \ + $host_cpu-$host_vendor \ + $host_os \ + $host_os_novers \ + $host_vendor \ + $host_cpu ; do + echo $ac_n "checking for config $f""... $ac_c" 1>&6 +echo "configure:781: checking for config $f" >&5 + if test -f $srcdir/config/$f; then + host_config=$srcdir/config/$f + echo "$ac_t""found" 1>&6 + break + fi + echo "$ac_t""no" 1>&6 +done +if test "X$host_config" != "Xnone"; then + CC_BASENAME="`echo $CC |cut -f1 -d' ' |xargs basename 2>/dev/null`" + . $host_config +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:797: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:827: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_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 $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:878: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:910: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 921 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:952: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:957: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:985: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1017: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1055: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1072: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + CC_BASENAME="`echo $CC |cut -f1 -d' ' |xargs basename 2>/dev/null`" +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1097: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1135: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:1257: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1277: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1316: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1340: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1343: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$ac_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1378: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 + + +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1394: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/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 + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi +fi + +NM="$ac_cv_path_NM" +echo "$ac_t""$NM" 1>&6 + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1430: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : +fi + +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 1479 "configure"' > conftest.$ac_ext + if { (eval echo configure:1480: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:1501: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + + +esac + + +# Save cache, so that ltconfig can load it +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + +# Reload cache, that may have been modified by ltconfig +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log + + +if test -z "$AR"; then + for ac_prog in ar xar +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1621: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AR" && break +done +test -n "$AR" || AR=":" + +fi + + +echo $ac_n "checking how make searches directories""... $ac_c" 1>&6 +echo "configure:1655: checking how make searches directories" >&5 +while true; do #for break + cat >maketest </dev/null 2>&1; then + SEARCH_RULE='VPATH=' + SEARCH_SEP=' ' + echo "$ac_t""VPATH=DIR1 DIR2 ..." 1>&6 + break + fi + + cat >maketest </dev/null 2>&1; then + SEARCH_RULE='VPATH=' + SEARCH_SEP=':' + echo "$ac_t""VPATH=DIR1:DIR2:..." 1>&6 + break + fi + + cat >maketest </dev/null 2>&1; then + SEARCH_RULE='.PATH: ' + SEARCH_SEP=' ' + echo "$ac_t"".PATH: DIR1 DIR2 ..." 1>&6 + break + fi + + SEARCH_RULE='## SEARCH DISABLED: ' + SEARCH_SEP=' ' + echo "$ac_t""it doesn't" 1>&6 + if test ! -f configure; then + { echo "configure: error: ${MAKE-make} requires the build and source directories to be the same" 1>&2; exit 1; } + fi + break +done +rm maketest + +for ac_prog in f90 pgf90 f95 g95 +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1722: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_F9X'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$F9X"; then + ac_cv_prog_F9X="$F9X" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_F9X="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +F9X="$ac_cv_prog_F9X" +if test -n "$F9X"; then + echo "$ac_t""$F9X" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$F9X" && break +done + +test -z "$CC" && { echo "configure: error: no acceptable f9X compiler found in \$PATH" 1>&2; exit 1; } + + +echo $ac_n "checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1755: checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) works" >&5 + + + +ac_ext=f90 +ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' +ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_f9x_cross + + +cat > conftest.$ac_ext << EOF + + program conftest + end + +EOF +if { (eval echo configure:1771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_f9x_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_f9x_cross=no + else + ac_cv_prog_f9x_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_f9x_works=no +fi +rm -fr conftest* + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_f9x_works" 1>&6 +if test $ac_cv_prog_f9x_works = no; then + { echo "configure: error: installation or configuration problem: Fortran 9X compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1798: checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_f9x_cross" 1>&6 +cross_compiling=$ac_cv_prog_f9x_cross + +echo $ac_n "checking whether we are using GNU Fortran 95""... $ac_c" 1>&6 +echo "configure:1803: checking whether we are using GNU Fortran 95" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_g9x'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.fpp <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_g9x=yes +else + ac_cv_prog_g9x=no +fi +fi + +echo "$ac_t""$ac_cv_prog_g9x" 1>&6 + +if test $ac_cv_prog_g9x = yes; then + G9X=yes + ac_test_FFLAGS="${FFLAGS+set}" + ac_save_FFLAGS="$FFLAGS" + FFLAGS= + echo $ac_n "checking whether $F9X accepts -g""... $ac_c" 1>&6 +echo "configure:1827: checking whether $F9X accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_f9x_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.f << EOF + program conftest + end +EOF +if test -z "`$F9X -g -c conftest.f 2>&1`"; then + ac_cv_prog_f9x_g=yes +else + ac_cv_prog_f9x_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_f9x_g" 1>&6 + if test "$ac_test_FFLAGS" = set; then + FFLAGS="$ac_save_FFLAGS" + elif test $ac_cv_prog_f9x_g = yes; then + FFLAGS="-g -O2" + else + FFLAGS="-O2" + fi +else + G9X= + test "${FFLAGS+set}" = set || FFLAGS="-g" +fi + +echo $ac_n "checking what $F9X does with modules""... $ac_c" 1>&6 +echo "configure:1858: checking what $F9X does with modules" >&5 + + + +ac_ext=f90 +ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' +ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_f9x_cross + + +test -d conftestdir || mkdir conftestdir +cd conftestdir +rm -rf * + +cat >conftest.$ac_ext <&1 +if test "$modfiles" = file.o; then + echo $ac_n "checking whether $F9X -em is saner""... $ac_c" 1>&6 + OLD_FFLAGS=$FFLAGS + FFLAGS="$FFLAGS -em" + eval $ac_compile + modfiles="" + for f in file.o module.mod MODULE.mod; do + test -f $f && modfiles="$f" + done + if test "$modfiles" = file.o;then + FFLAGS=$OLD_FFLAGS + echo no 6>&1 + else + echo yes 6>&1 + fi +fi +cd .. + +echo $ac_n "checking how $F9X finds modules""... $ac_c" 1>&6 +echo "configure:1905: checking how $F9X finds modules" >&5 + +for flag in "-p" "-M" "-I"; do + cat >conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + F9XMODFLAG=$flag + break + fi +done + +if test -n "$F9XMODFLAG"; then + echo $F9XMODFLAG 1>&6 +else + echo unknown 1>&6 +fi + +rm -rf conftest* + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + + + +# Check whether --with-zlib or --without-zlib was given. +if test "${with_zlib+set}" = set; then + withval="$with_zlib" + : +else + withval=yes +fi + +case "$withval" in + yes) + for ac_hdr in zlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1953: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + echo $ac_n "checking for compress in -lz""... $ac_c" 1>&6 +echo "configure:1990: checking for compress in -lz" >&5 +ac_lib_var=`echo z'_'compress | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lz $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo z | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + ;; + no) + echo $ac_n "checking for GNU zlib""... $ac_c" 1>&6 +echo "configure:2039: checking for GNU zlib" >&5 + echo "$ac_t""suppressed" 1>&6 + ;; + *) + zlib_inc="`echo $withval |cut -f1 -d,`" + if test -n "$zlib_inc"; then + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$zlib_inc" + for ac_hdr in zlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2051: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2061: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +CPPFLAGS="$saved_CPPFLAGS" +fi +done + + else + for ac_hdr in zlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2093: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2103: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + fi + + zlib_lib="`echo $withval |cut -f2 -d, -s`" + if test -n "$zlib_lib"; then + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -L$zlib_lib" + ZLIB_DIR=$zlib_lib + echo $ac_n "checking for compress in -lz""... $ac_c" 1>&6 +echo "configure:2137: checking for compress in -lz" >&5 +ac_lib_var=`echo z'_'compress | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lz $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo z | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +LDFLAGS="$saved_LDFLAGS" +fi + + else + echo $ac_n "checking for compress in -lz""... $ac_c" 1>&6 +echo "configure:2186: checking for compress in -lz" >&5 +ac_lib_var=`echo z'_'compress | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lz $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo z | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + fi + ;; +esac + + +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + + + + + + + +case "$CC_BASENAME" in + mpicc) + PARALLEL=mpicc + echo $ac_n "checking for mpirun""... $ac_c" 1>&6 +echo "configure:2294: checking for mpirun" >&5 + + cmd=`echo $CC |cut -f1 -d' '` + if (echo $cmd |grep / >/dev/null); then + path="`echo $cmd |sed 's/\(.*\)\/.*$/\1/'`" + else + for path in `echo $PATH |tr : ' '`; do + if test -x $path/$cmd; then + break; + fi + done + fi + + if test -x $path/mpirun; then + echo "$ac_t""$path/mpirun" 1>&6 + RUNSERIAL="${RUNSERIAL:-none}" + if test -z "$RUNPARALLEL"; then + RUNPARALLEL="$path/mpirun -np \$\${NPROCS:=2}" + fi + else + echo "$ac_t""none" 1>&6 + fi + ;; + + mpcc|mpcc_r) + PARALLEL="$CC_BASENAME" + ;; + + *) + ;; +esac + +# Check whether --enable-parallel or --disable-parallel was given. +if test "${enable_parallel+set}" = set; then + enableval="$enable_parallel" + : +fi + + +echo $ac_n "checking for parallel support files""... $ac_c" 1>&6 +echo "configure:2334: checking for parallel support files" >&5 +case "X-$enable_parallel" in + X-|X-no|X-none) + echo "$ac_t""skipped" 1>&6 + ;; + + X-yes) + echo "$ac_t""provided by compiler" 1>&6 + PARALLEL=yes + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo $ac_n "checking for MPI_Init in -lmpi""... $ac_c" 1>&6 +echo "configure:2359: checking for MPI_Init in -lmpi" >&5 +ac_lib_var=`echo mpi'_'MPI_Init | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lmpi $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo mpi | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +PARALLEL=no +fi + +fi +rm -f conftest* + + if test "X$PARALLEL" = "Xyes"; then + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo $ac_n "checking for MPI_File_open in -lmpio""... $ac_c" 1>&6 +echo "configure:2425: checking for MPI_File_open in -lmpio" >&5 +ac_lib_var=`echo mpio'_'MPI_File_open | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lmpio $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo mpio | sed -e 's/^a-zA-Z0-9_/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +PARALLEL=no +fi + +fi +rm -f conftest* + fi + + if test "X$PARALLEL" = "Xyes" && test -z "$RUNPARALLEL"; then + RUNPARALLEL="mpirun -np \$\${NPROCS:=2}" + fi + ;; + + X-mpich) + echo "$ac_t""mpich" 1>&6 + echo "configure: warning: *** Why aren't you using an mpicc compiler? ***" 1>&2 + + PARALLEL=mpich + echo $ac_n "checking for MPI_Init in -lmpich""... $ac_c" 1>&6 +echo "configure:2487: checking for MPI_Init in -lmpich" >&5 +ac_lib_var=`echo mpich'_'MPI_Init | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lmpich $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo mpich | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +{ echo "configure: error: no mpich library" 1>&2; exit 1; } +fi + + ;; + + *) + echo "$ac_t""error" 1>&6 + { echo "configure: error: \'$enable_parallel\' is not a valid parallel search type" 1>&2; exit 1; } + ;; +esac + +if test -n "$PARALLEL"; then + cat >> confdefs.h <<\EOF +#define HAVE_PARALLEL 1 +EOF + + + echo $ac_n "checking prefix for running on one processor""... $ac_c" 1>&6 +echo "configure:2549: checking prefix for running on one processor" >&5 + echo "$ac_t""$RUNSERIAL" 1>&6 + echo $ac_n "checking prefix for running in parallel""... $ac_c" 1>&6 +echo "configure:2552: checking prefix for running in parallel" >&5 + echo "$ac_t""$RUNPARALLEL" 1>&6 + + echo $ac_n "checking whether a simple MPI-IO program can be linked""... $ac_c" 1>&6 +echo "configure:2556: checking whether a simple MPI-IO program can be linked" >&5 + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 + { echo "configure: error: 'unable to link a simple MPI-IO application'" 1>&2; exit 1; } +fi +rm -f conftest* + + if test -z "$RUNPARALLEL"; then + { echo "configure: error: no way to run a parallel program" 1>&2; exit 1; } + fi + + if test "X$RUNSERIAL" = "Xnone"; then + RUNSERIAL= + fi + if test "X$RUNPARALLEL" = "Xnone"; then + RUNPARALLEL= + fi +fi + +echo $ac_n "checking make""... $ac_c" 1>&6 +echo "configure:2590: checking make" >&5 + +if test "`${MAKE-make} --version -f /dev/null 2>/dev/null |\ + sed -n 1p|cut -c1-8`" = "GNU Make"; then + echo "$ac_t""GNU make" 1>&6 + GMAKE=yes + if test "X$GCC" = "Xyes"; then + DEPEND=config/depend1 + else + DEPEND=config/depend2 + fi +else + echo "$ac_t""generic" 1>&6 +fi + +if test -n "$DEPEND"; then + echo $ac_n "checking how to include a makefile""... $ac_c" 1>&6 +echo "configure:2607: checking how to include a makefile" >&5 + + cat >makeinc <' >maketest + if (MAKE= ${MAKE-make} -f maketest foo) >/dev/null 2>&1; then + echo "$ac_t"".include " 1>&6 + DEPEND=config/depend3 + break + fi + + echo 'include makeinc' >maketest + if (${MAKE-make} -f maketest foo) >/dev/null 2>&1; then + echo "$ac_t""include FILE" 1>&6 + DEPEND=config/depend4 + break; + fi + + echo "$ac_t""you have a deficient make command" 1>&6 + DEPEND=config/dependN + break + done + rm makeinc maketest +fi + +rm -f conftest core core.* *.core conftest.o conftest.c dummy.o $ac_clean_files + +DYNAMIC_DIRS="" +if test -n "$LDFLAGS"; then + for d in $LDFLAGS ; do + d=`echo $d | sed -e 's/-L//g'` + case "$d" in + .*) + d=${ROOT}/$d + ;; + esac + DYNAMIC_DIRS="-R${d} $DYNAMIC_DIRS" + done +fi + + + COMMENCE=config/commence + CONCLUDE=config/conclude + + SEARCH='$(srcdir) $(top_builddir)/src $(top_srcdir)/src' +cmd='echo $SEARCH |sed "s/ /'$SEARCH_SEP'/g"' +SEARCH="$SEARCH_RULE`eval $cmd`" + +if test "X$GMAKE" = "Xyes"; then + SETX=":" +else + SETX="set -x" +fi + +rm -rf conftest* confdefs* core core.* *.core dummy.o + + +mkdir ./config >/dev/null 2>&1 +touch ./config/stamp1 + +saved_no_create=$no_create +no_create=yes +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "config/depend1 config/depend2 config/depend3 config/depend4 \ + config/dependN config/commence config/conclude Makefile \ + src/H5fortran_types.f90 src/Makefile test/Makefile \ + examples/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@R_LARGE@%$R_LARGE%g +s%@R_INTEGER@%$R_INTEGER%g +s%@HSIZE_T@%$HSIZE_T%g +s%@HSSIZE_T@%$HSSIZE_T%g +s%@HID_T@%$HID_T%g +s%@SIZE_T@%$SIZE_T%g +s%@OBJECT_NAMELEN_DEFAULT_F@%$OBJECT_NAMELEN_DEFAULT_F%g +s%@ROOT@%$ROOT%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@SET_MAKE@%$SET_MAKE%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@RANLIB@%$RANLIB%g +s%@LN_S@%$LN_S%g +s%@LIBTOOL@%$LIBTOOL%g +s%@AR@%$AR%g +s%@F9X@%$F9X%g +s%@F9XMODFLAG@%$F9XMODFLAG%g +s%@PARALLEL@%$PARALLEL%g +s%@RUNSERIAL@%$RUNSERIAL%g +s%@RUNPARALLEL@%$RUNPARALLEL%g +s%@TESTPARALLEL@%$TESTPARALLEL%g +/@DEPEND@/r $DEPEND +s%@DEPEND@%%g +s%@DYNAMIC_DIRS@%$DYNAMIC_DIRS%g +/@COMMENCE@/r $COMMENCE +s%@COMMENCE@%%g +/@CONCLUDE@/r $CONCLUDE +s%@CONCLUDE@%%g +s%@SEARCH@%$SEARCH%g +s%@SETX@%$SETX%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +no_create=$saved_no_create + +touch ./config/stamp2 + +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 diff --git a/fortran/configure.in b/fortran/configure.in new file mode 100644 index 0000000..0ccd7c0 --- /dev/null +++ b/fortran/configure.in @@ -0,0 +1,586 @@ +dnl ---------------------------------------------------------------------- +dnl Process this file with autoconf to produce configure. +dnl +dnl Copyright (C) 2000 National Center for Supercomputing Applications. +dnl All rights reserved. +dnl ---------------------------------------------------------------------- + +dnl ---------------------------------------------------------------------- +dnl Initialize configure. +dnl +AC_REVISION($Id$) +AC_INIT(src/HDF5.f90) +dnl AC_CONFIG_HEADER(config.h) +AC_CONFIG_AUX_DIR(bin) +AC_CANONICAL_HOST +AC_SUBST(CPPFLAGS) + +dnl ---------------------------------------------------------------------- +dnl HDF5 integer variables for the H5fortran_types.f90 file. +dnl +AC_SUBST(R_LARGE) +AC_SUBST(R_INTEGER) +AC_SUBST(HSIZE_T) +AC_SUBST(HSSIZE_T) +AC_SUBST(HID_T) +AC_SUBST(SIZE_T) +AC_SUBST(OBJECT_NAMELEN_DEFAULT_F) + +dnl ---------------------------------------------------------------------- +dnl Dump all shell variables values. +dnl +AC_MSG_CHECKING(shell variables initial values) +set >&5 +AC_MSG_RESULT(done) + +dnl ---------------------------------------------------------------------- +dnl Where is the root of the source tree. Give an absolute address so +dnl we can find it no matter which directory of the distribution is our +dnl current directory. The built-in pwd fails on some systems, but the +dnl /bin/pwd version works OK. +dnl +if test -x /bin/pwd; then + pwd=/bin/pwd +else + pwd=pwd +fi +AC_SUBST(ROOT) ROOT=`$pwd` + +dnl ---------------------------------------------------------------------- +dnl Check that the cache file was build on the same host as what we're +dnl running on now. +dnl +AC_CACHE_CHECK(for cached host,hdf5_cv_host,hdf5_cv_host="none"); +if test "X$hdf5_cv_host" = "Xnone"; then + hdf5_cv_host=$host +elif test "$hdf5_cv_host" != "$host"; then + echo "The config.cache file was generated on $hdf5_cv_host but" + echo "this is $host. Please remove that file and try again." + AC_MSG_ERROR(config.cache file is invalid) +fi + +dnl ---------------------------------------------------------------------- +dnl Source any special files that we need. These files normally aren't +dnl present but can be used by the maintainers to fine tune things like +dnl turning on debug or profiling flags for the compiler. The search order +dnl is: +dnl +dnl CPU-VENDOR-OS +dnl VENDOR-OS +dnl CPU-OS +dnl CPU-VENDOR +dnl OS +dnl VENDOR +dnl CPU +dnl +dnl If the `OS' ends with a version number then remove it. For instance, +dnl `freebsd3.1' would become `freebsd' +case "$host_os" in + aix4.*) + host_os_novers=aix4.x + ;; + freebsd*) + host_os_novers=freebsd + ;; + irix5.*) + host_os_novers=irix5.x + ;; + irix6.*) + host_os_novers=irix6.x + ;; + osf4.*) + host_os_novers=osf4.x + ;; + solaris2.*) + host_os_novers=solaris2.x + ;; + *) + host_os_novers=$host_os + ;; +esac + +host_config="none" +for f in $host_cpu-$host_vendor-$host_os \ + $host_cpu-$host_vendor-$host_os_novers \ + $host_vendor-$host_os \ + $host_vendor-$host_os_novers \ + $host_cpu-$host_os \ + $host_cpu-$host_os_novers \ + $host_cpu-$host_vendor \ + $host_os \ + $host_os_novers \ + $host_vendor \ + $host_cpu ; do + AC_MSG_CHECKING(for config $f) + if test -f $srcdir/config/$f; then + host_config=$srcdir/config/$f + AC_MSG_RESULT(found) + break + fi + AC_MSG_RESULT(no) +done +if test "X$host_config" != "Xnone"; then + CC_BASENAME="`echo $CC |cut -f1 -d' ' |xargs basename 2>/dev/null`" + . $host_config +fi + +dnl ---------------------------------------------------------------------- +dnl Check for programs. +dnl +AC_PROG_CC +AC_PROG_CPP dnl this is checked for when AC_HEADER_STDC is done +CC_BASENAME="`echo $CC |cut -f1 -d' ' |xargs basename 2>/dev/null`" +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AM_PROG_LIBTOOL + +if test -z "$AR"; then + AC_CHECK_PROGS(AR,ar xar,:,$PATH) +fi +AC_SUBST(AR) + +dnl ---------------------------------------------------------------------- +dnl Sometimes makes think the `.PATH:' appearing before the first rule +dnl with an action should override the `all' default target. So we have +dnl to decide what the proper syntax is. +dnl +AC_MSG_CHECKING(how make searches directories) +while true; do #for break + dnl The most common method is `VPATH=DIR1 DIR2 ...' + cat >maketest </dev/null 2>&1; then + SEARCH_RULE='VPATH=' + SEARCH_SEP=' ' + AC_MSG_RESULT([VPATH=DIR1 DIR2 ...]) + break + fi + + dnl The second most common method is like above except with the + dnl directories separated by colons. + cat >maketest </dev/null 2>&1; then + SEARCH_RULE='VPATH=' + SEARCH_SEP=':' + AC_MSG_RESULT([VPATH=DIR1:DIR2:...]) + break + fi + + dnl pmake uses the construct `.PATH: DIR1 DIR2 + cat >maketest </dev/null 2>&1; then + SEARCH_RULE='.PATH: ' + SEARCH_SEP=' ' + AC_MSG_RESULT([.PATH: DIR1 DIR2 ...]) + break + fi + + dnl No way for make to search directories + SEARCH_RULE='## SEARCH DISABLED: ' + SEARCH_SEP=' ' + AC_MSG_RESULT([it doesn't]) + if test ! -f configure; then + AC_MSG_ERROR(${MAKE-make} requires the build and source directories to be the same) + fi + break +done +rm maketest + +dnl ---------------------------------------------------------------------- +dnl Check for a Fortran 9X compiler, how to optimize it, and how to +dnl include modules. +dnl +AC_PROG_F9X +dnl AC_F9X_OPT_FLAGS +AC_F9X_MODS + +dnl Change back to the C language +AC_LANG_C + +dnl ---------------------------------------------------------------------- +dnl Checks for libraries. +dnl + +dnl Is the GNU zlib present? It has a header file `zlib.h' and a library +dnl `-lz' and their locations might be specified with the `--enable-zlib' +dnl command-line switch. The value is an include path and/or a library path. +dnl If the library path is specified then it must be preceded by a comma. +AC_ARG_WITH(zlib,[ --with-zlib=INC,LIB Use the GNU zlib compression], + ,withval=yes) +case "$withval" in + yes) + AC_CHECK_HEADERS(zlib.h) + AC_CHECK_LIB(z, compress) + ;; + no) + AC_MSG_CHECKING(for GNU zlib) + AC_MSG_RESULT(suppressed) + ;; + *) + zlib_inc="`echo $withval |cut -f1 -d,`" + if test -n "$zlib_inc"; then + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$zlib_inc" + AC_CHECK_HEADERS(zlib.h,,CPPFLAGS="$saved_CPPFLAGS") + else + AC_CHECK_HEADERS(zlib.h) + fi + + zlib_lib="`echo $withval |cut -f2 -d, -s`" + if test -n "$zlib_lib"; then + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -L$zlib_lib" + ZLIB_DIR=$zlib_lib + AC_CHECK_LIB(z, compress,,LDFLAGS="$saved_LDFLAGS") + else + AC_CHECK_LIB(z, compress) + fi + ;; +esac + +dnl ---------------------------------------------------------------------- +dnl Checks for header files. +dnl + +dnl Checkpoint the cache +AC_CACHE_SAVE + +dnl ---------------------------------------------------------------------- +dnl The following variables are used to distinguish between building a +dnl serial and parallel library. +dnl +dnl HAVE_PARALLEL -- defined in H5config.h if we are building +dnl a parallel library even if configure wasn't +dnl able to find some header file or library that +dnl might be required. This is defined if the +dnl compiler looks like a parallel compiler (e.g., +dnl mpicc or mpcc) or if the user explicitly states +dnl that a parallel library is being built by supplying +dnl the `--enable-parallel' configure switch. +dnl +dnl PARALLEL -- This variable is set to a non-null value if +dnl configure thinks we're compiling a parallel +dnl version of the library. +dnl +dnl RUNSERIAL -- This is a command which will be prepended to +dnl the executable name to run the executable using +dnl a single process. For serial versions of the +dnl library this will normally be empty. For parallel +dnl versions it might be something like `mpirun -np 1'. +dnl The value of this variable is substituted in *.in +dnl files. +dnl +dnl RUNPARALLEL -- This is a command which will be prepended to +dnl the executable name to run the executable on +dnl multiple processors. For the serial library the +dnl value will normally be the empty string. For +dnl parallel library it should be something like +dnl `mpi -np $$NPROCS' where NPROCS will eventually +dnl contain the number of processors on which to run +dnl the executable (the double dollarsigns are to +dnl protect the expansion until make executes the +dnl command). The value of this variable is +dnl substituted in *.in files. +dnl +AC_SUBST(PARALLEL) +AC_SUBST(RUNSERIAL) +AC_SUBST(RUNPARALLEL) +AC_SUBST(TESTPARALLEL) + +dnl ---------------------------------------------------------------------- +dnl If the compiler is obviously a parallel compiler then we're building +dnl a parallel version of hdf5 and should define HAVE_PARALLEL. Furthermore, +dnl the name of the compiler might tell us how to run the resulting +dnl executable. For `mpicc' the executable should be run with `mpirun' from +dnl the same directory as mpicc if it exists. +dnl +case "$CC_BASENAME" in + mpicc) + dnl The mpich compiler. Use mpirun from the same directory if it + dnl exists. + PARALLEL=mpicc + AC_MSG_CHECKING(for mpirun) + + dnl Find the path where mpicc is located. + cmd=`echo $CC |cut -f1 -d' '` + if (echo $cmd |grep / >/dev/null); then + path="`echo $cmd |sed 's/\(.*\)\/.*$/\1/'`" + else + for path in `echo $PATH |tr : ' '`; do + if test -x $path/$cmd; then + break; + fi + done + fi + + dnl Is there an mpirun at that path? + if test -x $path/mpirun; then + AC_MSG_RESULT($path/mpirun) + RUNSERIAL="${RUNSERIAL:-none}" + if test -z "$RUNPARALLEL"; then + RUNPARALLEL="$path/mpirun -np \$\${NPROCS:=2}" + fi + else + AC_MSG_RESULT(none) + fi + ;; + + mpcc|mpcc_r) + dnl The IBM compiler + PARALLEL="$CC_BASENAME" + ;; + + *) + dnl Probably not a parallel compiler, but if `--enable-parallel' + dnl is defined below then we're still building a parallel hdf5. + ;; +esac + +dnl ---------------------------------------------------------------------- +dnl What header files and libraries do we have to look for for parallel +dnl support? For the most part, search paths are already specified with +dnl CPPFLAGS and LDFLAGS or are known to the compiler. If the user says +dnl `--disable-parallel' but specifies a known parallel compiler (like mpicc +dnl or mpcc) then parallel support is enabled but configure doesn't search +dnl for any parallel header files or libraries. +dnl +AC_ARG_ENABLE(parallel, + [ --enable-parallel=TYPE Search for MPI-IO and MPI support files]) + +AC_MSG_CHECKING(for parallel support files) +case "X-$enable_parallel" in + X-|X-no|X-none) + dnl Either we are not compiling for parallel or the header and library + dnl files and locations are known to the compiler (this is the case + dnl for a correct installation of mpicc for instance). + AC_MSG_RESULT(skipped) + ;; + + X-yes) + dnl We want to compile a parallel library with a compiler that + dnl may already know how to link with MPI and MPI-IO. + AC_MSG_RESULT(provided by compiler) + PARALLEL=yes + + dnl Try link a simple MPI program. If fail, try again with -lmpi. + AC_TRY_LINK(,MPI_Init(),,AC_CHECK_LIB(mpi,MPI_Init,,PARALLEL=no)) + + dnl Then try link a simple MPI-IO program. If fail, try again with + dnl -lmpio. + if test "X$PARALLEL" = "Xyes"; then + AC_TRY_LINK(,MPI_File_open(),, + AC_CHECK_LIB(mpio,MPI_File_open,,PARALLEL=no)) + fi + + dnl Set RUNPARALLEL to mpirun if not set yet. + if test "X$PARALLEL" = "Xyes" && test -z "$RUNPARALLEL"; then + RUNPARALLEL="mpirun -np \$\${NPROCS:=2}" + fi + ;; + + X-mpich) + dnl For normal mpich installation the compiler, mpicc, should know + dnl where the MPI and MPI-IO header files are located and know which + dnl extra libraries need to be linked and will supply appropriate + dnl flags to the underlying compiler. + AC_MSG_RESULT(mpich) + AC_MSG_WARN(*** Why aren't you using an mpicc compiler? ***) + + dnl Apparently mpicc isn't installed correctly so configure must + dnl search for the header files and libraries. Actually we only + dnl have to search for the libraries in order to get the onto the + dnl link line, the user will have already told us about the + dnl locations. Fail if something is missing. + PARALLEL=mpich + AC_CHECK_LIB(mpich,MPI_Init,,AC_MSG_ERROR(no mpich library)) + ;; + + *) + AC_MSG_RESULT(error) + AC_MSG_ERROR(\'$enable_parallel\' is not a valid parallel search type) + ;; +esac + +dnl ---------------------------------------------------------------------- +dnl Print some other parallel information and do some sanity checks. +dnl +if test -n "$PARALLEL"; then + dnl We are building a parallel library + AC_DEFINE(HAVE_PARALLEL) + + dnl Display what we found about running programs + AC_MSG_CHECKING(prefix for running on one processor) + AC_MSG_RESULT($RUNSERIAL) + AC_MSG_CHECKING(prefix for running in parallel) + AC_MSG_RESULT($RUNPARALLEL) + + dnl Check that we can link a simple MPI and MPI-IO application + AC_MSG_CHECKING(whether a simple MPI-IO program can be linked) + AC_TRY_LINK(,[MPI_Init();MPI_File_open();], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + AC_MSG_ERROR('unable to link a simple MPI-IO application')) + + dnl There *must* be some way to run in parallel even if it's just the + dnl word `none'. + if test -z "$RUNPARALLEL"; then + AC_MSG_ERROR(no way to run a parallel program) + fi + + dnl If RUNSERIAL or RUNPARALLEL is the word `none' then replace it with + dnl the empty string. + if test "X$RUNSERIAL" = "Xnone"; then + RUNSERIAL= + fi + if test "X$RUNPARALLEL" = "Xnone"; then + RUNPARALLEL= + fi +fi + +AC_MSG_CHECKING(make) +AC_SUBST_FILE(DEPEND) +if test "`${MAKE-make} --version -f /dev/null 2>/dev/null |\ + sed -n 1p|cut -c1-8`" = "GNU Make"; then + AC_MSG_RESULT(GNU make) + GMAKE=yes + if test "X$GCC" = "Xyes"; then + DEPEND=config/depend1 + else + DEPEND=config/depend2 + fi +else + AC_MSG_RESULT(generic) +fi + +dnl How do we include another file into a Makefile? +if test -n "$DEPEND"; then + AC_MSG_CHECKING(how to include a makefile) + + dnl The include file contains the target for `foo' + cat >makeinc <' >maketest + if (MAKE= ${MAKE-make} -f maketest foo) >/dev/null 2>&1; then + AC_MSG_RESULT([.include ]) + DEPEND=config/depend3 + break + fi + + dnl Most make's use `include FILE' + echo 'include makeinc' >maketest + if (${MAKE-make} -f maketest foo) >/dev/null 2>&1; then + AC_MSG_RESULT(include FILE) + DEPEND=config/depend4 + break; + fi + + dnl default + AC_MSG_RESULT(you have a deficient make command) + DEPEND=config/dependN + break + done + rm makeinc maketest +fi + +dnl Some cleanup stuff +rm -f conftest core core.* *.core conftest.o conftest.c dummy.o $ac_clean_files + +dnl ---------------------------------------------------------------------- +dnl Determine the runtime libraries we may need to include in the +dnl libtools command so that executables will find the correct dynamic +dnl libraries. +dnl +DYNAMIC_DIRS="" +if test -n "$LDFLAGS"; then + for d in $LDFLAGS ; do + d=`echo $d | sed -e 's/-L//g'` + case "$d" in + .*) + dnl If the path isn't absolute, make it so by prepending the + dnl ROOT directory to it. + d=${ROOT}/$d + ;; + esac + DYNAMIC_DIRS="-R${d} $DYNAMIC_DIRS" + done +fi +AC_SUBST(DYNAMIC_DIRS) + +dnl ---------------------------------------------------------------------- +dnl Build the Makefiles. Almost every Makefile.in will begin with the line +dnl `@COMMENCE@' and end with the line `@CONCLUDE@'. These lines insert +dnl various files from the config directory into the Makefile. +dnl +AC_SUBST_FILE(COMMENCE) COMMENCE=config/commence +AC_SUBST_FILE(CONCLUDE) CONCLUDE=config/conclude + +dnl The directory search list +AC_SUBST(SEARCH) SEARCH='$(srcdir) $(top_builddir)/src $(top_srcdir)/src' +cmd='echo $SEARCH |sed "s/ /'$SEARCH_SEP'/g"' +SEARCH="$SEARCH_RULE`eval $cmd`" + +dnl We don't need to say when we're entering directories if we're using +dnl GNU make becuase make does it for us. +if test "X$GMAKE" = "Xyes"; then + AC_SUBST(SETX) SETX=":" +else + AC_SUBST(SETX) SETX="set -x" +fi + +dnl Some cleanup stuff +rm -rf conftest* confdefs* core core.* *.core dummy.o + +dnl Build config.status, touch the stamp files, and build all the Makefiles. +dnl The order is such that the first `make' does not need to update any +dnl configuration information. See config/commence.in for the order in which +dnl things need to be done. + +dnl First the stamp1 file for H5config.h.in +mkdir ./config >/dev/null 2>&1 +touch ./config/stamp1 + +dnl Then the config.status file (but not makefiles) +saved_no_create=$no_create +no_create=yes +AC_OUTPUT(config/depend1 config/depend2 config/depend3 config/depend4 \ + config/dependN config/commence config/conclude Makefile \ + src/H5fortran_types.f90 src/Makefile test/Makefile \ + examples/Makefile) +no_create=$saved_no_create + +dnl Then the stamp2 file for H5config.h +touch ./config/stamp2 + +dnl Finally the makefiles +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 diff --git a/fortran/examples/Dependencies b/fortran/examples/Dependencies new file mode 100644 index 0000000..e69de29 diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in new file mode 100644 index 0000000..0ef7d55 --- /dev/null +++ b/fortran/examples/Makefile.in @@ -0,0 +1,86 @@ +## HDF5-Fortran test/Makefile(.in) +## +## Copyright (C) 2000 National Center for Supercomputing Applications. +## All rights reserved. +## +## +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +@COMMENCE@ + +hdf5_dir=$(top_srcdir)/../src + +## Add include directory to the C preprocessor flags and the h5test and hdf5 +## libraries to the library list. +LT_LINK_LIB=$(LT) --mode=link $(F9X) -static -rpath $(libdir) +MFLAG=@F9XMODFLAG@ +FFLAGS=$(MFLAG). $(MFLAG)../src +FLIB=../src/libhdf5_fortran.la +HDF5LIB=$(hdf5_dir)/libhdf5.la + +## These are the programs that `make all' or `make tests' will build and which +## `make check' will run. List them in the order they should be run. +TEST_PROGS=dsetexample fileexample rwdsetexample attrexample groupexample \ + grpsexample grpdsetexample hyperslab selectele grpit refobjexample \ + refregexample mountexample compound + +## These are the files that `make clean' (and derivatives) will remove from +## this directory. +CLEAN=*.h5 + +## List all source files here. The list of object files will be +## created by replacing the `.f90' with a `.o'. This list is necessary +## for building automatic dependencies. +TEST_SRC=dsetexample.f90 fileexample.f90 rwdsetexample.f90 attrexample.f90 \ + groupexample.f90 grpsexample.f90 grpdsetexample.f90 hyperslab.f90 \ + selectele.f90 grpit.f90 refobjexample.f90 refregexample.f90 \ + mountexample.f90 compound.f90 +TEST_OBJ=$(TEST_SRC:.f90=.lo) + +## How to build the programs... they all depend on the Fortran HDF5 library +$(TEST_PROGS): $(FLIB) + +dsetexample: dsetexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ dsetexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +fileexample: fileexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fileexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +rwdsetexample: rwdsetexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ rwdsetexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +attrexample: attrexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ attrexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +groupexample: groupexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ groupexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +grpsexample: grpsexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ grpsexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +grpdsetexample: grpdsetexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ grpdsetexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +hyperslab: hyperslab.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ hyperslab.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +selectele: selectele.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ selectele.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +grpit: grpit.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ grpit.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +refobjexample: refobjexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ refobjexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +refregexample: refregexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ refregexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +mountexample: mountexample.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ mountexample.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +compound: compound.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ compound.f90 $(FLIB) $(LIBS) $(HDF5LIB) + +@CONCLUDE@ diff --git a/fortran/examples/attrexample.f90 b/fortran/examples/attrexample.f90 new file mode 100644 index 0000000..c71939e --- /dev/null +++ b/fortran/examples/attrexample.f90 @@ -0,0 +1,102 @@ +! This example shows how to create and write a dataset attribute. +! It opens the existing file 'dset.h5', obtains the identifier of +! the dataset "/dset", defines attribute's dataspace, +! creates dataset attribute, writes the attribute, and then closes +! the attribute's dataspace, attribute, dataset, and file. + + PROGRAM ATTREXAMPLE + + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + CHARACTER(LEN=9), PARAMETER :: aname = "attr_long" ! Attribute name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: attr_id ! Attribute identifier + INTEGER(HID_T) :: aspace_id ! Attribute Dataspace identifier + INTEGER(HID_T) :: atype_id ! Attribute Dataspace identifier + INTEGER(HSIZE_T), DIMENSION(1) :: adims = (/2/) ! Attribute dimension + INTEGER :: arank = 1 ! Attribure rank + INTEGER(SIZE_T) :: attrlen ! Length of the attribute string + +! CHARACTER*27, DIMENSION(2) :: attr_data ! Attribute data + CHARACTER*80, DIMENSION(2) :: attr_data ! Attribute data + + INTEGER :: error ! Error flag + + + ! + ! Initialize attribute's data + ! + attr_data(1) = "Dataset character attribute" + attr_data(2) = "Some other string here " +! attrlen = 27 + attrlen = 80 + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5init_types_f(error) + + ! + ! Open an existing file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + + ! + ! Open an existing dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + + ! + ! Create scalar data space for the attribute. + ! + CALL h5screate_simple_f(arank, adims, aspace_id, error) + ! + ! Create datatype for the attribute. + ! + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, error) + CALL h5tset_size_f(atype_id, attrlen, error) + + ! + ! Create dataset attribute. + ! + CALL h5acreate_f(dset_id, aname, atype_id, aspace_id, & + attr_id, error) + + ! + ! Write the attribute data. + ! + CALL h5awrite_f(attr_id, atype_id, attr_data, error) + + ! + ! Close the attribute. + ! + CALL h5aclose_f(attr_id, error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(aspace_id, error) + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM ATTREXAMPLE + diff --git a/fortran/examples/compound.f90 b/fortran/examples/compound.f90 new file mode 100644 index 0000000..f2954e8 --- /dev/null +++ b/fortran/examples/compound.f90 @@ -0,0 +1,215 @@ +! +! This program creates a dataset that is one dimensional array of +! structures { +! character*2 +! integer +! double precision +! real +! } +! Data is written and read back by fields. +! + + PROGRAM COMPOUNDEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=11), PARAMETER :: filename = "compound.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: dsetname = "Compound" ! Dataset name + INTEGER, PARAMETER :: dimsize = 6 ! Size of the dataset + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dspace_id ! Dataspace identifier + INTEGER(HID_T) :: dtype_id ! Compound datatype identifier + INTEGER(HID_T) :: dt1_id ! Memory datatype identifier (for character field) + INTEGER(HID_T) :: dt2_id ! Memory datatype identifier (for integer field) + INTEGER(HID_T) :: dt3_id ! Memory datatype identifier (for double precision field) + INTEGER(HID_T) :: dt4_id ! Memory datatype identifier (for real field) + INTEGER(HID_T) :: dt5_id ! Memory datatype identifier + INTEGER(HID_T) :: plist_id ! Dataset trasfer property + INTEGER(SIZE_T) :: typesize + + + INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/dimsize/) ! Dataset dimensions + INTEGER :: rank = 1 ! Dataset rank + + INTEGER :: error ! Error flag + INTEGER(SIZE_T) :: type_size ! Size of the datatype + INTEGER(SIZE_T) :: type_sizec ! Size of the character datatype + INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype + INTEGER(SIZE_T) :: type_sized ! Size of the double precision datatype + INTEGER(SIZE_T) :: type_sizer ! Size of the real datatype + INTEGER(SIZE_T) :: offset ! Member's offset + CHARACTER*2, DIMENSION(dimsize) :: char_member + CHARACTER*2, DIMENSION(dimsize) :: char_member_out ! Buffer to read data out + INTEGER, DIMENSION(dimsize) :: int_member + DOUBLE PRECISION, DIMENSION(dimsize) :: double_member + REAL, DIMENSION(dimsize) :: real_member + INTEGER :: i + ! + ! Initialize data buffer. + ! + do i = 1, dimsize + char_member(i)(1:1) = char(65+i) + char_member(i)(2:2) = char(65+i) + char_member_out(i)(1:1) = char(65) + char_member_out(i)(2:2) = char(65) + int_member(i) = i + double_member(i) = 2.* i + real_member(i) = 3. * i + enddo + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5init_types_f(error) + ! + ! Set dataset transfer property to preserve partially initialized fields + ! during write/read to/from dataset with compound datatype. + ! + CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) + CALL h5pset_preserve_f(plist_id, 1, error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create the dataspace. + ! + CALL h5screate_simple_f(rank, dims, dspace_id, error) + ! + ! Create compound datatype. + ! + ! First calculate total size by calculating sizes of each member + ! + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, dt5_id, error) + typesize = 2 + CALL h5tset_size_f(dt5_id, typesize, error) + CALL h5tget_size_f(dt5_id, type_sizec, error) + CALL h5tget_size_f(H5T_NATIVE_INTEGER, type_sizei, error) + CALL h5tget_size_f(H5T_NATIVE_DOUBLE, type_sized, error) + CALL h5tget_size_f(H5T_NATIVE_REAL, type_sizer, error) + type_size = type_sizec + type_sizei + type_sized + type_sizer + CALL h5tcreate_f(H5T_COMPOUND_F, type_size, dtype_id, error) + ! + ! Insert memebers + ! + ! CHARACTER*2 memeber + ! + offset = 0 + CALL h5tinsert_f(dtype_id, "char_field", offset, dt5_id, error) + ! + ! INTEGER member + ! + offset = offset + type_sizec ! Offset of the second memeber is 2 + CALL h5tinsert_f(dtype_id, "integer_field", offset, H5T_NATIVE_INTEGER, error) + ! + ! DOUBLE PRECISION member + ! + offset = offset + type_sizei ! Offset of the third memeber is 6 + CALL h5tinsert_f(dtype_id, "double_field", offset, H5T_NATIVE_DOUBLE, error) + ! + ! REAL member + ! + offset = offset + type_sized ! Offset of the last member is 14 + CALL h5tinsert_f(dtype_id, "real_field", offset, H5T_NATIVE_REAL, error) + + ! + ! Create the dataset with compound datatype. + ! + CALL h5dcreate_f(file_id, dsetname, dtype_id, dspace_id, & + dset_id, error) + ! + ! Create memory types. We have to create a compound datatype + ! for each member we want to write. + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizec, dt1_id, error) + offset = 0 + CALL h5tinsert_f(dt1_id, "char_field", offset, dt5_id, error) + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizei, dt2_id, error) + offset = 0 + CALL h5tinsert_f(dt2_id, "integer_field", offset, H5T_NATIVE_INTEGER, error) + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sized, dt3_id, error) + offset = 0 + CALL h5tinsert_f(dt3_id, "double_field", offset, H5T_NATIVE_DOUBLE, error) + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizer, dt4_id, error) + offset = 0 + CALL h5tinsert_f(dt4_id, "real_field", offset, H5T_NATIVE_REAL, error) + ! + ! Write data by fields in the datatype. Fields order is not important. + ! + CALL h5dwrite_f(dset_id, dt4_id, real_member, error, xfer_prp = plist_id) + CALL h5dwrite_f(dset_id, dt1_id, char_member, error, xfer_prp = plist_id) + CALL h5dwrite_f(dset_id, dt3_id, double_member, error, xfer_prp = plist_id) + CALL h5dwrite_f(dset_id, dt2_id, int_member, error, xfer_prp = plist_id) + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + ! + ! Terminate access to the datatype + ! + CALL h5tclose_f(dtype_id, error) + CALL h5tclose_f(dt1_id, error) + CALL h5tclose_f(dt2_id, error) + CALL h5tclose_f(dt3_id, error) + CALL h5tclose_f(dt4_id, error) + CALL h5tclose_f(dt5_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Open the file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + ! + ! Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + ! + ! Create memeory datatyoe to read character member of the compound datatype. + ! + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, dt2_id, error) + typesize = 2 + CALL h5tset_size_f(dt2_id, typesize, error) + CALL h5tget_size_f(dt2_id, type_size, error) + CALL h5tcreate_f(H5T_COMPOUND_F, type_size, dt1_id, error) + offset = 0 + CALL h5tinsert_f(dt1_id, "char_field", offset, dt2_id, error) + ! + ! Read part of the datatset and display it. + ! + CALL h5dread_f(dset_id, dt1_id, char_member_out, error) + write(*,*) (char_member_out(i), i=1, dimsize) + + ! + ! Close all open objects. + ! + CALL h5dclose_f(dset_id, error) + CALL h5tclose_f(dt1_id, error) + CALL h5tclose_f(dt2_id, error) + CALL h5fclose_f(file_id, error) + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM COMPOUNDEXAMPLE + + diff --git a/fortran/examples/dsetexample.f90 b/fortran/examples/dsetexample.f90 new file mode 100644 index 0000000..00974a9 --- /dev/null +++ b/fortran/examples/dsetexample.f90 @@ -0,0 +1,70 @@ +! +! The following example shows how to create an empty dataset. +! It creates a file called 'dsetf.h5', defines the +! dataset dataspace, creates a dataset which is a 4x6 integer array, +! and then closes the dataspace, the dataset, and the file. +! + + PROGRAM DSETEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dspace_id ! Dataspace identifier + + + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions + INTEGER :: rank = 2 ! Dataset rank + + INTEGER :: error ! Error flag + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5init_types_f(error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create the dataspace. + ! + CALL h5screate_simple_f(rank, dims, dspace_id, error) + + ! + ! Create the dataset with default properties. + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & + dset_id, error) + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM DSETEXAMPLE + + diff --git a/fortran/examples/fileexample.f90 b/fortran/examples/fileexample.f90 new file mode 100644 index 0000000..33c3bc2 --- /dev/null +++ b/fortran/examples/fileexample.f90 @@ -0,0 +1,27 @@ +! +! The following example demonstrates how to create and close an HDF5 file. +! It creates a file called 'file.h5', and then closes the file. +! + + PROGRAM FILEEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename = "filef.h5" ! File name + INTEGER(HID_T) :: file_id ! File identifier + + INTEGER :: error ! Error flag + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Terminate access to the file. + ! + CALL h5fclose_f(file_id, error) + + END PROGRAM FILEEXAMPLE diff --git a/fortran/examples/groupexample.f90 b/fortran/examples/groupexample.f90 new file mode 100644 index 0000000..148a796 --- /dev/null +++ b/fortran/examples/groupexample.f90 @@ -0,0 +1,42 @@ +! +! The following example shows how to create and close a group. +! It creates a file called 'group.h5', creates a group +! called MyGroup in the root group, and then closes the group and file. +! + + + PROGRAM GROUPEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=9), PARAMETER :: filename = "groupf.h5" ! File name + CHARACTER(LEN=7), PARAMETER :: groupname = "MyGroup" ! Group name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: group_id ! Group identifier + + INTEGER :: error ! Error flag + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create a group named "/MyGroup" in the file. + ! + CALL h5gcreate_f(file_id, groupname, group_id, error) + + ! + ! Close the group. + ! + CALL h5gclose_f(group_id, error) + + ! + ! Terminate access to the file. + ! + CALL h5fclose_f(file_id, error) + + END PROGRAM GROUPEXAMPLE diff --git a/fortran/examples/grpdsetexample.f90 b/fortran/examples/grpdsetexample.f90 new file mode 100644 index 0000000..75bc335 --- /dev/null +++ b/fortran/examples/grpdsetexample.f90 @@ -0,0 +1,136 @@ +! +! This example shows how to create a dataset in a particular group. +! It opens the file created in the previous example and creates two datasets. +! Absolute and relative dataset names are used. +! + + + PROGRAM GRPDSETEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=10), PARAMETER :: filename = "groupsf.h5" ! File name + CHARACTER(LEN=15), PARAMETER :: groupname = "MyGroup/Group_A" ! Group name + CHARACTER(LEN=13), PARAMETER :: dsetname1 = "MyGroup/dset1" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: group_id ! Group identifier + INTEGER(HID_T) :: dataset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace_id ! Data space identifier + + INTEGER :: i, j + INTEGER :: error ! Error flag + + INTEGER, DIMENSION(3,3) :: dset1_data ! Data arrays + INTEGER, DIMENSION(2,10) :: dset2_data ! + + INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/3,3/) ! Datasets dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: dims2 = (/2,10/)! + + INTEGER :: rank = 2 ! Datasets rank + + ! + !Initialize dset1_data array + ! + do i = 1, 3 + do j = 1, 3 + dset1_data(i,j) = j; + end do + end do + + + ! + !Initialize dset2_data array + ! + do i = 1, 2 + do j = 1, 10 + dset2_data(i,j) = j; + end do + end do + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5init_types_f(error) + + ! + ! Open an existing file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + + ! + ! Create the data space for the first dataset. + ! + CALL h5screate_simple_f(rank, dims1, dataspace_id, error) + + ! + ! Create a dataset in group "MyGroup" with default properties. + ! + CALL h5dcreate_f(file_id, dsetname1, H5T_NATIVE_INTEGER, dataspace_id, & + dataset_id, error) + + ! + ! Write the first dataset. + ! + CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, dset1_data, error) + + ! + ! Close the dataspace for the first dataset. + ! + CALL h5sclose_f(dataspace_id, error) + + ! + ! Close the first dataset. + ! + CALL h5dclose_f(dataset_id, error) + + ! + ! Open an existing group in the specified file. + ! + CALL h5gopen_f(file_id, groupname, group_id, error) + + ! + !Create the data space for the second dataset. + ! + CALL h5screate_simple_f(rank, dims2, dataspace_id, error) + + ! + ! Create the second dataset in group "Group_A" with default properties. + ! + CALL h5dcreate_f(group_id, dsetname2, H5T_NATIVE_INTEGER, dataspace_id, & + dataset_id, error) + + ! + ! Write the second dataset. + ! + CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, dset2_data, error) + + ! + ! Close the dataspace for the second dataset. + ! + CALL h5sclose_f(dataspace_id, error) + + ! + ! Close the second dataset. + ! + CALL h5dclose_f(dataset_id, error) + + ! + ! Close the group. + ! + CALL h5gclose_f(group_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM GRPDSETEXAMPLE diff --git a/fortran/examples/grpit.f90 b/fortran/examples/grpit.f90 new file mode 100644 index 0000000..66fb09e --- /dev/null +++ b/fortran/examples/grpit.f90 @@ -0,0 +1,189 @@ +! +! In this example we iterate through the members of the groups. +! + + + PROGRAM GRPITEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=11), PARAMETER :: filename = "iteratef.h5" ! File name + CHARACTER(LEN=7), PARAMETER :: groupname1 = "MyGroup" ! Group name + CHARACTER(LEN=15), PARAMETER :: groupname2 = "Group_A" ! Group name + CHARACTER(LEN=13), PARAMETER :: dsetname1 = "dset1" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! + + CHARACTER(LEN=20) :: name_buffer ! Buffer to hold object's name + INTEGER :: type ! Type of the object + INTEGER :: nmembers ! Number of group members + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dataset1_id ! Dataset1 identifier + INTEGER(HID_T) :: dataset2_id ! Dataset2 identifier + INTEGER(HID_T) :: dataspace1_id ! Data space identifier + INTEGER(HID_T) :: dataspace2_id ! Data space identifier + INTEGER(HID_T) :: group1_id, group2_id ! Group identifiers + + INTEGER :: i, j + + INTEGER :: error ! Error flag + + INTEGER, DIMENSION(3,3) :: dset1_data ! Arrays to hold data + INTEGER, DIMENSION(2,10) :: dset2_data ! + + INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/3,3/) ! Dataset dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: dims2 = (/2,10/)! + INTEGER :: rank = 2 ! Datasets rank + + ! + ! Initialize dset1_data array. + ! + do i = 1, 3 + do j = 1, 3 + dset1_data(i,j) = j; + end do + end do + + + ! + ! Initialize dset2_data array. + ! + do i = 1, 2 + do j = 1, 10 + dset2_data(i,j) = j; + end do + end do + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5init_types_f(error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create group "MyGroup" in the root group using absolute name. + ! + CALL h5gcreate_f(file_id, groupname1, group1_id, error) + + ! + ! Create group "Group_A" in group "MyGroup" using relative name. + ! + CALL h5gcreate_f(group1_id, groupname2, group2_id, error) + + ! + ! Create the data space for the first dataset. + ! + CALL h5screate_simple_f(rank, dims1, dataspace1_id, error) + + ! + ! Create a dataset in group "MyGroup" with default properties. + ! + CALL h5dcreate_f(group1_id, dsetname1, H5T_NATIVE_INTEGER, dataspace1_id, & + dataset1_id, error) + + ! + ! Write the first dataset. + ! + CALL h5dwrite_f(dataset1_id, H5T_NATIVE_INTEGER, dset1_data, error) + + ! + ! Create the data space for the second dataset. + ! + CALL h5screate_simple_f(rank, dims2, dataspace2_id, error) + + ! + ! Create the second dataset in group "Group_A" with default properties + ! + CALL h5dcreate_f(group2_id, dsetname2, H5T_NATIVE_INTEGER, dataspace2_id, & + dataset2_id, error) + + ! + ! Write the second dataset + ! + CALL h5dwrite_f(dataset2_id, H5T_NATIVE_INTEGER, dset2_data, error) + + ! + ! Get number of members in the root group. + ! + CALL h5gn_members_f(file_id, "/", nmembers, error) + write(*,*) "Number of root group member is " , nmembers + + ! + ! Print each group member's name and type. + ! + do i = 0, nmembers - 1 + CALL h5gget_obj_info_idx_f(file_id, "/", i, name_buffer, type, & + error) + write(*,*) name_buffer, type + end do + + ! + ! Get number of members in MyGroup. + ! + CALL h5gn_members_f(file_id, "MyGroup", nmembers, error) + write(*,*) "Number of group MyGroup member is ", nmembers + + ! + ! Print each group member's name and type in "MyGroup" group. + ! + do i = 0, nmembers - 1 + CALL h5gget_obj_info_idx_f(file_id, groupname1, i, name_buffer, type, & + error) + write(*,*) name_buffer, type + end do + + + ! + ! Get number of members in MyGroup/Group_A. + ! + CALL h5gn_members_f(file_id, "MyGroup/Group_A", nmembers, error) + write(*,*) "Number of group MyGroup/Group_A member is ", nmembers + + ! + ! Print each group member's name and type in "MyGroup/Group_A" group. + ! + do i = 0, nmembers - 1 + CALL h5gget_obj_info_idx_f(file_id,"MyGroup/Group_A" , i, name_buffer, type, & + error) + write(*,*) name_buffer, type + end do + + ! + ! Close the dataspace for the first dataset. + ! + CALL h5sclose_f(dataspace1_id, error) + + ! + ! Close the first dataset. + ! + CALL h5dclose_f(dataset1_id, error) + + ! + ! Close the dataspace for the second dataset. + ! + CALL h5sclose_f(dataspace2_id, error) + + ! + ! Close the second dataset. + ! + CALL h5dclose_f(dataset2_id, error) + + ! + ! Close the groups. + ! + CALL h5gclose_f(group1_id, error) + + CALL h5gclose_f(group2_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + END PROGRAM GRPITEXAMPLE diff --git a/fortran/examples/grpsexample.f90 b/fortran/examples/grpsexample.f90 new file mode 100644 index 0000000..abbc6ea --- /dev/null +++ b/fortran/examples/grpsexample.f90 @@ -0,0 +1,59 @@ +! +! The following example code shows how to create groups +! using absolute and relative names. It creates three groups: +! the first two groups are created using the file identifier and +! the group absolute names, and the third group is created using +! a group identifier and the name relative to the specified group. +! + + + PROGRAM GRPSEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=10), PARAMETER :: filename = "groupsf.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: groupname1 = "/MyGroup" ! Group name + CHARACTER(LEN=16), PARAMETER :: groupname2 = "/MyGroup/Group_A" + ! Group name + CHARACTER(LEN=7), PARAMETER :: groupname3 = "Group_B" ! Group name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: group1_id, group2_id, group3_id ! Group identifiers + + INTEGER :: error ! Error flag + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create group "MyGroup" in the root group using absolute name. + ! + CALL h5gcreate_f(file_id, groupname1, group1_id, error) + + ! + ! Create group "Group_A" in group "MyGroup" using absolute name. + ! + CALL h5gcreate_f(file_id, groupname2, group2_id, error) + + ! + ! Create group "Group_B" in group "MyGroup" using relative name. + ! + CALL h5gcreate_f(group1_id, groupname3, group3_id, error) + + ! + ! Close the groups. + ! + CALL h5gclose_f(group1_id, error) + CALL h5gclose_f(group2_id, error) + CALL h5gclose_f(group3_id, error) + + ! + ! Terminate access to the file. + ! + CALL h5fclose_f(file_id, error) + + END PROGRAM GRPSEXAMPLE diff --git a/fortran/examples/hyperslab.f90 b/fortran/examples/hyperslab.f90 new file mode 100644 index 0000000..0be4b60 --- /dev/null +++ b/fortran/examples/hyperslab.f90 @@ -0,0 +1,199 @@ +! +! This example shows how to write and read a hyperslab. +! + + PROGRAM SELECTEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=7), PARAMETER :: filename = "sdsf.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier + + INTEGER(HSIZE_T), DIMENSION(3) :: dimsm = (/7,7,3/) ! Dataset dimensions + ! in memory + INTEGER(HSIZE_T), DIMENSION(2) :: dims_out ! Buffer to read in dataset + ! dimesions + INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/5,6/) ! Dataset dimensions. + + INTEGER(HSIZE_T), DIMENSION(2) :: count = (/3,4/) + ! Size of the hyperslab in the file + INTEGER(HSIZE_T), DIMENSION(2) :: offset = (/1,2/) + !hyperslab offset in the file + INTEGER(HSIZE_T), DIMENSION(3) :: count_out = (/3,4,1/) + !Size of the hyperslab in memory + INTEGER(HSIZE_T), DIMENSION(3) :: offset_out = (/3,0,0/) + !hyperslab offset in memory + INTEGER, DIMENSION(5,6) :: data ! Data to write + INTEGER, DIMENSION(7,7,3) :: data_out ! Output buffer + INTEGER :: dsetrank = 2 ! Dataset rank ( in file ) + INTEGER :: memrank = 3 ! Dataset rank ( in memory ) + INTEGER :: rank + INTEGER :: i, j, k + + INTEGER :: error, error_n ! Error flags + + + ! + ! Write data to the HDF5 file. + ! + + ! + ! Data initialization. + ! + do i = 1, 5 + do j = 1, 6 + data(i,j) = (i-1) + (j-1); + end do + end do + ! + ! 0, 1, 2, 3, 4, 5 + ! 1, 2, 3, 4, 5, 6 + ! 2, 3, 4, 5, 6, 7 + ! 3, 4, 5, 6, 7, 8 + ! 4, 5, 6, 7, 8, 9 + ! + + ! + ! Initialize FORTRAN predefined datatypes + ! + CALL h5init_types_f(error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create the data space for the dataset. + ! + CALL h5screate_simple_f(dsetrank, dimsf, dataspace, error) + + ! + ! Create the dataset with default properties. + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, & + dset_id, error) + + ! + ! Write the dataset. + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, error) + + ! + ! Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + + ! + ! Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! This part of the code reads the hyperslab from the sds.h5 file just + ! created, into a 2-dimensional plane of the 3-dimensional dataset. + ! + + ! + ! Initialize data_out array. + ! + do i = 1, 7 + do j = 1, 7 + do k = 1,3 + data_out(i,j,k) = 0; + end do + end do + end do + + ! + ! Open the file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + + ! + ! Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + + ! + ! Get dataset's dataspace identifier. + ! + CALL h5dget_space_f(dset_id, dataspace, error) + + ! + ! Select hyperslab in the dataset. + ! + CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & + offset, count, error) + ! + ! Create memory dataspace. + ! + CALL h5screate_simple_f(memrank, dimsm, memspace, error) + + ! + ! Select hyperslab in memory. + ! + CALL h5sselect_hyperslab_f(memspace, H5S_SELECT_SET_F, & + offset_out, count_out, error) + + ! + ! Read data from hyperslab in the file into the hyperslab in + ! memory and display. + ! + CALL H5Dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, error, & + memspace, dataspace) + + ! + ! Display data_out array + ! + do i = 1, 7 + print *, (data_out(i,j,1), j = 1,7) + end do + + ! 0 0 0 0 0 0 0 + ! 0 0 0 0 0 0 0 + ! 0 0 0 0 0 0 0 + ! 3 4 5 6 0 0 0 + ! 4 5 6 7 0 0 0 + ! 5 6 7 8 0 0 0 + ! 0 0 0 0 0 0 0 + ! + + ! + ! Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + + ! + ! Close the memoryspace. + ! + CALL h5sclose_f(memspace, error) + + ! + ! Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM SELECTEXAMPLE diff --git a/fortran/examples/mountexample.f90 b/fortran/examples/mountexample.f90 new file mode 100644 index 0000000..561b018 --- /dev/null +++ b/fortran/examples/mountexample.f90 @@ -0,0 +1,183 @@ +! +!In the following example we create one file with a group in it, +!and another file with a dataset. Mounting is used to +!access the dataset from the second file as a member of a group +!in the first file. +! + + PROGRAM MOUNTEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + ! + !the respective filename is "mount1.h5" and "mount2.h5" + ! + CHARACTER(LEN=9), PARAMETER :: filename1 = "mount1.h5" + CHARACTER(LEN=9), PARAMETER :: filename2 = "mount2.h5" + + ! + !data space rank and dimensions + ! + INTEGER, PARAMETER :: RANK = 2 + INTEGER, PARAMETER :: NX = 4 + INTEGER, PARAMETER :: NY = 5 + + ! + ! File identifiers + ! + INTEGER(HID_T) :: file1_id, file2_id + + ! + ! Group identifier + ! + INTEGER(HID_T) :: gid + + ! + ! dataset identifier + ! + INTEGER(HID_T) :: dset_id + + ! + ! data space identifier + ! + INTEGER(HID_T) :: dataspace + + ! + ! data type identifier + ! + INTEGER(HID_T) :: dtype_id + + ! + !The dimensions for the dataset. + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/) + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !general purpose integer + ! + INTEGER :: i, j + + ! + !data buffers + ! + INTEGER, DIMENSION(NX,NY) :: data_in, data_out + + ! + !Initialize FORTRAN predifined datatypes + ! + CALL h5init_types_f(error) + + ! + !Initialize data_in buffer + ! + do i = 1, NX + do j = 1, NY + data_in(i,j) = (i-1) + (j-1) + end do + end do + + ! + !Create first file "mount1.h5" using default properties. + ! + CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + + ! + !Create group "/G" inside file "mount1.h5". + ! + CALL h5gcreate_f(file1_id, "/G", gid, error) + + ! + !close file and group identifiers. + ! + CALL h5gclose_f(gid, error) + CALL h5fclose_f(file1_id, error) + + ! + !Create second file "mount2.h5" using default properties. + ! + CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + + ! + !Create data space for the dataset. + ! + CALL h5screate_simple_f(RANK, dims, dataspace, error) + + ! + !Create dataset "/D" inside file "mount2.h5". + ! + CALL h5dcreate_f(file2_id, "/D", H5T_NATIVE_INTEGER, dataspace, & + dset_id, error) + + ! + ! Write data_in to the dataset + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data_in, error) + + ! + !close file, dataset and dataspace identifiers. + ! + CALL h5sclose_f(dataspace, error) + CALL h5dclose_f(dset_id, error) + CALL h5fclose_f(file2_id, error) + + ! + !reopen both files. + ! + CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + + ! + !mount the second file under the first file's "/G" group. + ! + CALL h5fmount_f (file1_id, "/G", file2_id, error) + + + ! + !Access dataset D in the first file under /G/D name. + ! + CALL h5dopen_f(file1_id, "/G/D", dset_id, error) + + ! + !Get dataset's data type. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + + ! + !Read the dataset. + ! + CALL h5dread_f(dset_id, dtype_id, data_out, error) + + ! + !Print out the data. + ! + do i = 1, NX + print *, (data_out(i,j), j = 1, NY) + end do + + + ! + !Close dset_id and dtype_id. + ! + CALL h5dclose_f(dset_id, error) + CALL h5tclose_f(dtype_id, error) + + ! + !unmount the second file. + ! + CALL h5funmount_f(file1_id, "/G", error); + + ! + !Close both files. + ! + CALL h5fclose_f(file1_id, error) + CALL h5fclose_f(file2_id, error) + + END PROGRAM MOUNTEXAMPLE + diff --git a/fortran/examples/refobjexample.f90 b/fortran/examples/refobjexample.f90 new file mode 100644 index 0000000..0050cbe --- /dev/null +++ b/fortran/examples/refobjexample.f90 @@ -0,0 +1,136 @@ +! +! This program shows how to create and store references to the objects. +! Program creates a file, two groups, a dataset to store integer data and +! a dataset to store references to the objects. +! Stored references are used to open the objects they are point to. +! Data is written to the dereferenced dataset, and class type is displayed for +! the shared datatype. +! + PROGRAM OBJ_REFERENCES + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + CHARACTER(LEN=10), PARAMETER :: filename = "FORTRAN.h5" ! File + CHARACTER(LEN=8), PARAMETER :: dsetnamei = "INTEGERS" ! Dataset with the integer data + CHARACTER(LEN=17), PARAMETER :: dsetnamer = "OBJECT_REFERENCES" ! Dataset wtih object + ! references + CHARACTER(LEN=6), PARAMETER :: groupname1 = "GROUP1" ! Groups in the file + CHARACTER(LEN=6), PARAMETER :: groupname2 = "GROUP2" ! + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: grp1_id ! Group identifiers + INTEGER(HID_T) :: grp2_id ! + INTEGER(HID_T) :: dset_id ! Dataset identifiers + INTEGER(HID_T) :: dsetr_id ! + INTEGER(HID_T) :: type_id ! Type identifier + INTEGER(HID_T) :: space_id ! Dataspace identifiers + INTEGER(HID_T) :: spacer_id ! + INTEGER :: error + INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/5/) + INTEGER(HSIZE_T), DIMENSION(1) :: dimsr= (/4/) + INTEGER(HSIZE_T), DIMENSION(1) :: my_maxdims = (/5/) + INTEGER :: rank = 1 + INTEGER :: rankr = 1 + TYPE(hobj_ref_t_f), DIMENSION(4) :: ref + TYPE(hobj_ref_t_f), DIMENSION(4) :: ref_out + INTEGER, DIMENSION(5) :: data = (/1, 2, 3, 4, 5/) + INTEGER :: class + ! + ! Initialize FORTRAN predefined datatypes + ! + CALL h5init_types_f(error) + ! + ! Create a file + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + ! Default file access and file creation + ! properties are used. + ! + ! Create a group in the file + ! + CALL h5gcreate_f(file_id, groupname1, grp1_id, error) + ! + ! Create a group inside the created gorup + ! + CALL h5gcreate_f(grp1_id, groupname2, grp2_id, error) + ! + ! Create dataspaces for datasets + ! + CALL h5screate_simple_f(rank, dims, space_id, error, maxdims=my_maxdims) + CALL h5screate_simple_f(rankr, dimsr, spacer_id, error) + ! + ! Create integer dataset + ! + CALL h5dcreate_f(file_id, dsetnamei, H5T_NATIVE_INTEGER, space_id, & + dset_id, error) + ! + ! Create dataset to store references to the objects + ! + CALL h5dcreate_f(file_id, dsetnamer, H5T_STD_REF_OBJ, spacer_id, & + dsetr_id, error) + ! + ! Create a datatype and store in the file + ! + CALL h5tcopy_f(H5T_NATIVE_REAL, type_id, error) + CALL h5tcommit_f(file_id, "MyType", type_id, error) + ! + ! Close dataspaces, groups and integer dataset + ! + CALL h5sclose_f(space_id, error) + CALL h5sclose_f(spacer_id, error) + CALL h5tclose_f(type_id, error) + CALL h5dclose_f(dset_id, error) + CALL h5gclose_f(grp1_id, error) + CALL h5gclose_f(grp2_id, error) + ! + ! Create references to two groups, integer dataset and shared datatype + ! and write it to the dataset in the file + ! + CALL h5rcreate_f(file_id, groupname1, ref(1), error) + CALL h5rcreate_f(file_id, "/GROUP1/GROUP2", ref(2), error) + CALL h5rcreate_f(file_id, dsetnamei, ref(3), error) + CALL h5rcreate_f(file_id, "MyType", ref(4), error) + CALL h5dwrite_f(dsetr_id, H5T_STD_REF_OBJ, ref, error) + ! + ! Close the dataset + ! + CALL h5dclose_f(dsetr_id, error) + ! + ! Reopen the dataset with object references and read references to the buffer + ! + CALL h5dopen_f(file_id, dsetnamer,dsetr_id,error) + CALL h5dread_f(dsetr_id, H5T_STD_REF_OBJ, ref_out, error) + ! + ! Dereference the third reference. We know that it is a dataset. On practice + ! one should use h5rget_object_type_f function to find out + ! the type of an object the reference points to. + ! + CALL h5rdereference_f(dsetr_id, ref(3), dset_id, error) + ! + ! Write data to the dataset. + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, error) + if (error .eq. 0) write(*,*) "Data has been successfully written to the dataset " + ! + ! Dereference the fourth reference. We know that it is a datatype. On practice + ! one should use h5rget_object_type_f function to find out + ! the type of an object the reference points to. + ! + CALL h5rdereference_f(dsetr_id, ref(4), type_id, error) + ! + ! Get datatype class and display it if it is of a FLOAT class. + ! + CALL h5tget_class_f(type_id, class, error) + if(class .eq. H5T_FLOAT_F) write(*,*) "Stored datatype is of a FLOAT class" + ! + ! Close all objects. + ! + CALL h5dclose_f(dset_id, error) + CALL h5tclose_f(type_id, error) + CALL h5dclose_f(dsetr_id, error) + CALL h5fclose_f(file_id, error) + + END PROGRAM OBJ_REFERENCES + + diff --git a/fortran/examples/refregexample.f90 b/fortran/examples/refregexample.f90 new file mode 100644 index 0000000..47ebaac --- /dev/null +++ b/fortran/examples/refregexample.f90 @@ -0,0 +1,159 @@ +! +! This program shows how to create, store and dereference references +! to the dataset regions. +! Program creates a file and writes two dimensional integer dataset +! to it. Then program creates and stores references to the hyperslab +! and 3 points selected in the integer dataset, in the second dataset. +! Program reopens the second dataset, reads and dereferences region +! references, and then reads and displays selected data from the +! integer dataset. +! + PROGRAM REG_REFERENCE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + CHARACTER(LEN=10), PARAMETER :: filename = "FORTRAN.h5" + CHARACTER(LEN=6), PARAMETER :: dsetnamev = "MATRIX" + CHARACTER(LEN=17), PARAMETER :: dsetnamer = "REGION_REFERENCES" + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: space_id ! Dataspace identifier + INTEGER(HID_T) :: spacer_id ! Dataspace identifier + INTEGER(HID_T) :: dsetv_id ! Dataset identifier + INTEGER(HID_T) :: dsetr_id ! Dataset identifier + INTEGER :: error + TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref ! Buffers to store references + TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref_out ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/2,9/) ! Datasets dimensions + INTEGER(HSIZE_T), DIMENSION(1) :: dimsr = (/2/) ! + INTEGER(HSSIZE_T), DIMENSION(2) :: start + INTEGER(HSIZE_T), DIMENSION(2) :: count + INTEGER :: rankr = 1 + INTEGER :: rank = 2 + INTEGER , DIMENSION(2,9) :: data + INTEGER , DIMENSION(2,9) :: data_out = 0 + INTEGER(HSSIZE_T) , DIMENSION(2,3) :: coord + INTEGER(SIZE_T) ::num_points = 3 ! Number of selected points + INTEGER :: i, j + coord = reshape((/1,1,2,7,1,9/), (/2,3/)) ! Coordinates of selected points + data = reshape ((/1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6/), (/2,9/)) + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5init_types_f(error) + ! + ! Create a new file. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + ! Default file access and file creation + ! properties are used. + ! + ! Create dataspaces: + ! + ! for dataset with references to dataset regions + ! + CALL h5screate_simple_f(rankr, dimsr, spacer_id, error) + ! + ! for integer dataset + ! + CALL h5screate_simple_f(rank, dims, space_id, error) + ! + ! Create and write datasets: + ! + ! Integer dataset + ! + CALL h5dcreate_f(file_id, dsetnamev, H5T_NATIVE_INTEGER, space_id, & + dsetv_id, error) + CALL h5dwrite_f(dsetv_id, H5T_NATIVE_INTEGER, data, error) + CALL h5dclose_f(dsetv_id, error) + ! + ! Dataset with references + ! + CALL h5dcreate_f(file_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, & + dsetr_id, error) + ! + ! Create a reference to the hyperslab selection. + ! + start(1) = 0 + start(2) = 3 + count(1) = 2 + count(2) = 3 + CALL h5sselect_hyperslab_f(space_id, H5S_SELECT_SET_F, & + start, count, error) + CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(1), error) + ! + ! Create a reference to elements selection. + ! + CALL h5sselect_none_f(space_id, error) + CALL h5sselect_elements_f(space_id, H5S_SELECT_SET_F, rank, num_points,& + coord, error) + CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(2), error) + ! + ! Write dataset with the references. + ! + CALL h5dwrite_f(dsetr_id, H5T_STD_REF_DSETREG, ref, error) + ! + ! Close all objects. + ! + CALL h5sclose_f(space_id, error) + CALL h5sclose_f(spacer_id, error) + CALL h5dclose_f(dsetr_id, error) + CALL h5fclose_f(file_id, error) + ! + ! Reopen the file to test selections. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + CALL h5dopen_f(file_id, dsetnamer, dsetr_id, error) + ! + ! Read references to the dataset regions. + ! + CALL h5dread_f(dsetr_id, H5T_STD_REF_DSETREG, ref_out, error) + ! + ! Dereference the first reference. + ! + CALL H5rdereference_f(dsetr_id, ref_out(1), dsetv_id, error) + CALL H5rget_region_f(dsetr_id, ref_out(1), space_id, error) + ! + ! Read selected data from the dataset. + ! + CALL h5dread_f(dsetv_id, H5T_NATIVE_INTEGER, data_out, error, & + mem_space_id = space_id, file_space_id = space_id) + write(*,*) "Hypeslab selection" + write(*,*) + do i = 1,2 + write(*,*) (data_out (i,j), j = 1,9) + enddo + write(*,*) + CALL h5sclose_f(space_id, error) + CALL h5dclose_f(dsetv_id, error) + data_out = 0 + ! + ! Dereference the second reference. + ! + CALL H5rdereference_f(dsetr_id, ref_out(2), dsetv_id, error) + CALL H5rget_region_f(dsetr_id, ref_out(2), space_id, error) + ! + ! Read selected data from the dataset. + ! + CALL h5dread_f(dsetv_id, H5T_NATIVE_INTEGER, data_out, error, & + mem_space_id = space_id, file_space_id = space_id) + write(*,*) "Point selection" + write(*,*) + do i = 1,2 + write(*,*) (data_out (i,j), j = 1,9) + enddo + ! + ! Close all objects + ! + CALL h5sclose_f(space_id, error) + CALL h5dclose_f(dsetv_id, error) + CALL h5dclose_f(dsetr_id, error) + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM REG_REFERENCE + + diff --git a/fortran/examples/run_examples.sh b/fortran/examples/run_examples.sh new file mode 100755 index 0000000..3126a6c --- /dev/null +++ b/fortran/examples/run_examples.sh @@ -0,0 +1,13 @@ +#!/bin/csh +./dsetexample +./fileexample +./rwdsetexample +./attrexample +./groupexample +./grpsexample +./grpdsetexample +./hyperslab +./selectele +./grpit +./refobjexample +./refregexample diff --git a/fortran/examples/rwdsetexample.f90 b/fortran/examples/rwdsetexample.f90 new file mode 100644 index 0000000..085b4e8 --- /dev/null +++ b/fortran/examples/rwdsetexample.f90 @@ -0,0 +1,78 @@ +! +! The following example shows how to write and read to/from an existing dataset. +! It opens the file created in the previous example, obtains the dataset +! identifier, writes the data to the dataset in the file, +! then reads the dataset to memory. +! + + + PROGRAM RWDSETEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + + INTEGER :: error ! Error flag + INTEGER :: i, j + + INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers + + ! + ! Initialize the dset_data array. + ! + do i = 1, 4 + do j = 1, 6 + dset_data(i,j) = (i-1)*6 + j; + end do + end do + + ! + ! Initialize FORTRAN predefined datatypes + ! + CALL h5init_types_f(error) + + ! + ! Open an existing file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + + ! + ! Open an existing dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + + ! + ! Write the dataset. + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, error) + + ! + ! Read the dataset. + ! + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, error) + + ! + ! Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM RWDSETEXAMPLE + + + diff --git a/fortran/examples/selectele.f90 b/fortran/examples/selectele.f90 new file mode 100644 index 0000000..db91a77 --- /dev/null +++ b/fortran/examples/selectele.f90 @@ -0,0 +1,282 @@ +! +! This program creates two files, copy1.h5, and copy2.h5. +! In copy1.h5, it creates a 3x4 dataset called 'Copy1', +! and write 0's to this dataset. +! In copy2.h5, it create a 3x4 dataset called 'Copy2', +! and write 1's to this dataset. +! It closes both files, reopens both files, selects two +! points in copy1.h5 and writes values to them. Then it +! uses an H5Scopy to write the same selection to copy2.h5. +! Program reopens the files, and reads and prints the contents of +! the two datasets. +! + + PROGRAM SELECTEXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename1 = "copy1.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: filename2 = "copy2.h5" ! + CHARACTER(LEN=5), PARAMETER :: dsetname1 = "Copy1" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname2 = "Copy2" ! + + INTEGER, PARAMETER :: RANK = 2 ! Dataset rank + + INTEGER(SIZE_T), PARAMETER :: NUMP = 2 ! Number of points selected + + INTEGER(HID_T) :: file1_id ! File1 identifier + INTEGER(HID_T) :: file2_id ! File2 identifier + INTEGER(HID_T) :: dset1_id ! Dataset1 identifier + INTEGER(HID_T) :: dset2_id ! Dataset2 identifier + INTEGER(HID_T) :: dataspace1 ! Dataspace identifier + INTEGER(HID_T) :: dataspace2 ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier + + INTEGER(HSIZE_T), DIMENSION(1) :: dimsm = (/2/) + ! Memory dataspace dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/3,4/) + ! File dataspace dimensions + INTEGER(HSSIZE_T), DIMENSION(RANK,NUMP) :: coord ! Elements coordinates + ! in the file + + INTEGER, DIMENSION(3,4) :: buf1, buf2, bufnew ! Data buffers + INTEGER, DIMENSION(2) :: val = (/53, 59/) ! Values to write + + INTEGER :: memrank = 1 ! Rank of the dataset in memory + + INTEGER :: i, j + + INTEGER :: error ! Error flag + LOGICAL :: status + + + ! + ! Create two files containing identical datasets. Write 0's to one + ! and 1's to the other. + ! + + ! + ! Data initialization. + ! + do i = 1, 3 + do j = 1, 4 + buf1(i,j) = 0; + end do + end do + + do i = 1, 3 + do j = 1, 4 + buf2(i,j) = 1; + end do + end do + + ! + ! Initialize FORTRAN predefined datatypes + ! + CALL h5init_types_f(error) + + ! + ! Create file1, file2 using default properties. + ! + CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + + CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + + ! + ! Create the data space for the datasets. + ! + CALL h5screate_simple_f(RANK, dimsf, dataspace1, error) + + CALL h5screate_simple_f(RANK, dimsf, dataspace2, error) + + ! + ! Create the datasets with default properties. + ! + CALL h5dcreate_f(file1_id, dsetname1, H5T_NATIVE_INTEGER, dataspace1, & + dset1_id, error) + + CALL h5dcreate_f(file2_id, dsetname2, H5T_NATIVE_INTEGER, dataspace2, & + dset2_id, error) + + ! + ! Write the datasets. + ! + CALL h5dwrite_f(dset1_id, H5T_NATIVE_INTEGER, buf1, error) + + CALL h5dwrite_f(dset2_id, H5T_NATIVE_INTEGER, buf2, error) + + ! + ! Close the dataspace for the datasets. + ! + CALL h5sclose_f(dataspace1, error) + + CALL h5sclose_f(dataspace2, error) + + ! + ! Close the datasets. + ! + CALL h5dclose_f(dset1_id, error) + + CALL h5dclose_f(dset2_id, error) + + ! + ! Close the files. + ! + CALL h5fclose_f(file1_id, error) + + CALL h5fclose_f(file2_id, error) + + ! + ! Open the two files. Select two points in one file, write values to + ! those point locations, then do H5Scopy and write the values to the + ! other file. Close files. + ! + + ! + ! Open the files. + ! + CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + + ! + ! Open the datasets. + ! + CALL h5dopen_f(file1_id, dsetname1, dset1_id, error) + + CALL h5dopen_f(file2_id, dsetname2, dset2_id, error) + + ! + ! Get dataset1's dataspace identifier. + ! + CALL h5dget_space_f(dset1_id, dataspace1, error) + + ! + ! Create memory dataspace. + ! + CALL h5screate_simple_f(memrank, dimsm, memspace, error) + + ! + ! Set the selected point positions. Because Fortran array index starts + ! from 1, so add one to the actual select points in C. + ! + coord(1,1) = 1 + coord(2,1) = 2 + coord(1,2) = 1 + coord(2,2) = 4 + + ! + ! Select the elements in file space. + ! + CALL h5sselect_elements_f(dataspace1, H5S_SELECT_SET_F, RANK, NUMP,& + coord, error) + + ! + ! Write value into the selected points in dataset1. + ! + CALL H5dwrite_f(dset1_id, H5T_NATIVE_INTEGER, val, error, & + mem_space_id=memspace, file_space_id=dataspace1) + + ! + ! Copy the daspace1 into dataspace2. + ! + CALL h5scopy_f(dataspace1, dataspace2, error) + + ! + ! Write value into the selected points in dataset2. + ! + CALL H5dwrite_f(dset2_id, H5T_NATIVE_INTEGER, val, error, & + mem_space_id=memspace, file_space_id=dataspace2) + + ! + ! Close the dataspace for the datasets. + ! + CALL h5sclose_f(dataspace1, error) + + CALL h5sclose_f(dataspace2, error) + + ! + ! Close the memoryspace. + ! + CALL h5sclose_f(memspace, error) + + ! + ! Close the datasets. + ! + CALL h5dclose_f(dset1_id, error) + + CALL h5dclose_f(dset2_id, error) + + ! + ! Close the files. + ! + CALL h5fclose_f(file1_id, error) + + CALL h5fclose_f(file2_id, error) + + ! + ! Open both files and print the contents of the datasets. + ! + + ! + ! Open the files. + ! + CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + + ! + ! Open the datasets. + ! + CALL h5dopen_f(file1_id, dsetname1, dset1_id, error) + + CALL h5dopen_f(file2_id, dsetname2, dset2_id, error) + + ! + ! Read dataset from the first file. + ! + CALL h5dread_f(dset1_id, H5T_NATIVE_INTEGER, bufnew, error) + + ! + ! Display the data read from dataset "Copy1" + ! + write(*,*) "The data in dataset Copy1 is: " + do i = 1, 3 + print *, (bufnew(i,j), j = 1,4) + end do + + ! + ! Read dataset from the second file. + ! + CALL h5dread_f(dset2_id, H5T_NATIVE_INTEGER, bufnew, error) + + ! + ! Display the data read from dataset "Copy2" + ! + write(*,*) "The data in dataset Copy2 is: " + do i = 1, 3 + print *, (bufnew(i,j), j = 1,4) + end do + + ! + ! Close datasets. + ! + CALL h5dclose_f(dset1_id, error) + + CALL h5dclose_f(dset2_id, error) + + ! + ! Close files. + ! + CALL h5fclose_f(file1_id, error) + + CALL h5fclose_f(file2_id, error) + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_types_f(error) + + END PROGRAM SELECTEXAMPLE diff --git a/fortran/libtool b/fortran/libtool new file mode 100755 index 0000000..81b73b0 --- /dev/null +++ b/fortran/libtool @@ -0,0 +1,4284 @@ +#! /bin/sh + +# libtool - Provide generalized library-building support services. +# Generated automatically by ltconfig (GNU libtool 1.3.5 (1.385.2.206 2000/05/27 11:12:27)) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +# Libtool was configured as follows, on host dangermouse.ncsa.uiuc.edu: +# +# CC="gcc" CFLAGS=" -march=i686 -malign-double -Wsign-compare" CPPFLAGS="" \ +# LD="/usr/bin/ld" LDFLAGS="" LIBS="" \ +# NM="/usr/bin/nm -B" RANLIB="ranlib" LN_S="ln -s" \ +# DLLTOOL="" OBJDUMP="" AS="" \ +# bin/ltconfig --with-gcc --with-gnu-ld --no-verify bin/ltmain.sh i686-pc-linux-gnu +# +# Compiler and other test output produced by ltconfig, useful for +# debugging ltconfig, is in ./config.log if it exists. + +# The version of ltconfig that generated this script. +LTCONFIG_VERSION="1.3.5" + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias=i686-pc-linux-gnu +host=i686-pc-linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" + +# The default C compiler. +CC="gcc" + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -B" + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC" + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Can we write directly to a .lo ? +compiler_o_lo="yes" + +# Must we lock files when doing compilation ? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# 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="\${libname}\${release}.so\$versuffix \${libname}\${release}.so\$major \$libname.so" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}.so\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR cru \$oldlib\$oldobjs~\$RANLIB \$oldlib" +old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$linkopts \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$CC -shared \$libobjs \$deplibs \$linkopts \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGISTW]\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern char \\1;/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Compile-time system search path for libraries +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | sed 's/.* //' | sort | uniq > \$export_symbols" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + +# Symbols that must always be exported. +include_expsyms="" + +### END LIBTOOL CONFIG + +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + esac + + case "$user_target" in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case "$user_target" in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag" && test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + command="$base_compile $srcfile" + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (!dll) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: not more than one -exported-symbols argument allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" + ;; + esac + case " $deplibs " in + *" $arg "*) ;; + *) deplibs="$deplibs $arg";; + esac + case " $lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir";; + esac + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + case ":$dllsearchpath:" in + ::) dllsearchpath="$dllsearchdir";; + *":$dllsearchdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + esac + ;; + esac + ;; + + -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi + deplibs="$deplibs $arg" + ;; + + -module) + module=yes + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.obj | *.a | *.lib) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test "X$installed" = Xyes; then + dir="$libdir" + else + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + fi + + if test -n "$dependency_libs"; then + # Extract -R and -L from dependency_libs + temp_deplibs= + for deplib in $dependency_libs; do + case "$deplib" in + -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + case " $rpath $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + -L*) case "$compile_command $temp_deplibs " in + *" $deplib "*) ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + done + dependency_libs="$temp_deplibs" + fi + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs$dependency_libs" + compile_command="$compile_command $dir/$old_library$dependency_libs" + finalize_command="$finalize_command $dir/$old_library$dependency_libs" + continue + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking statically, + # we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # We need an absolute path. + case "$dir" in + [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + ;; + esac + + # This is the magic to use -rpath. + # Skip directories that are in the system default run-time + # search path, unless they have been requested with -R. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + deplibs="$deplibs $dir/$linklib" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + if test -n "$dllsearchpath"; then + dllsearchpath="$dllsearchpath:$dllsearchdir" + else + dllsearchpath="$dllsearchdir" + fi + ;; + esac + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + deplibs="$deplibs $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$absdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *.a | *.lib) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + dependency_libs="$deplibs" + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case "$version_type" in + none) ;; + + irix) + major=`expr $current - $age + 1` + versuffix="$major.$revision" + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + windows) + # Like Linux, but with '-' rather than '.', since we only + # want one extension on Windows 95. + major=`expr $current - $age` + versuffix="-$major-$age-$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + dependency_libs="$deplibs" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody*) + # rhapsody is a little odd... + deplibs="$deplibs -framework System" + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + if test "$build_libtool_libs" = yes; then + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + *.lo | *.o | *.obj) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + # Anything else should be a program. + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + 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 "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case "$dlsyms" in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case "$host" in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case "$0" in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + link_against_libtool_libs='$link_against_libtool_libs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$finalize_shlibpath$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + if test -n "$xrpath"; then + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a | *.lib) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.o | *.obj) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + link_against_libtool_libs= + relink_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/fortran/src/Dependencies b/fortran/src/Dependencies new file mode 100644 index 0000000..e69de29 diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c new file mode 100644 index 0000000..504e937 --- /dev/null +++ b/fortran/src/H5Af.c @@ -0,0 +1,433 @@ +#include "H5f90.h" + +/*---------------------------------------------------------------------------- + * Name: h5acreate_c + * Purpose: Call H5Acreate to create an attribute + * Inputs: obj_id - object identifier + * name - name of the attribute + * namelen - name length + * type_id - datatype identifier + * space_id - dataspace identifier + * crt_pr - identifier of creation property list + * Outputs: attr_id - attribute identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5acreate_c (hid_t_f *obj_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *attr_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_obj_id; + hid_t c_type_id; + hid_t c_space_id; + hid_t c_attr_id; + hid_t c_crt_prp; + /* + * Define creation property + */ + c_crt_prp = *crt_prp; + if ( H5P_DEFAULT_F == c_crt_prp ) c_crt_prp = H5P_DEFAULT; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Acreate function. + */ + c_obj_id = *obj_id; + c_type_id = *type_id; + c_space_id = *space_id; + c_attr_id = H5Acreate(c_obj_id, c_name, c_type_id, c_space_id, c_crt_prp); + + + if (c_attr_id < 0) return ret_value; + *attr_id = (hid_t_f)c_attr_id; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5aopen_name _c + * Purpose: Call H5Aopen_name to open an attribute + * Inputs: obj_id - object identifier + * name - name of the attribute + * namelen - name length + * Outputs: attr_id - dataset identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5aopen_name_c (hid_t_f *obj_id, _fcd name, int_f *namelen, hid_t_f *attr_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_obj_id; + hid_t c_attr_id; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + /* + * Call H5Aopen function. + */ + c_obj_id = *obj_id; + c_attr_id = H5Aopen_name(c_obj_id, c_name); + + if (c_attr_id < 0) return ret_value; + *attr_id = (hid_t_f)c_attr_id; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5awritec_c + * Purpose: Call h5awrite_c to write a character attribute + * Inputs: attr_id - dataset identifier + * mem_type_id - memory datatype identifier + * buf - character data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday , August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5awritec_c (hid_t_f *attr_id, hid_t_f *mem_type_id, _fcd buf) +{ + int ret_value = -1; + + /* + * Call h5awrite_c function. + */ + ret_value = nh5awrite_c(attr_id, mem_type_id, _fcdtocp(buf)); + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5awrite_c + * Purpose: Call H5Awrite to write a attribute + * Inputs: attr_id - attribute identifier + * mem_type_id - memory datatype identifier + * buf - data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5awrite_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf) +{ + int ret_value = -1; + herr_t ret; + hid_t c_attr_id; + hid_t c_mem_type_id; + + /* + * Call H5Awrite function. + */ + c_attr_id = *attr_id; + c_mem_type_id = *mem_type_id; + ret = H5Awrite(c_attr_id, c_mem_type_id, buf); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5areadc_c + * Purpose: Call h5aread_c to read character attribute + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * Outputs: buf - character data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5areadc_c (hid_t_f *attr_id, hid_t_f *mem_type_id, _fcd buf) +{ + int ret_value = -1; + + /* + * Call h5aread_c function. + */ + ret_value = nh5aread_c(attr_id, mem_type_id, (_fcdtocp(buf))); + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5aread_c + * Purpose: Call H5Araed to read an attribute + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * Outputs: buf - data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5aread_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf) +{ + int ret_value = -1; + herr_t ret; + hid_t c_attr_id; + hid_t c_mem_type_id; + + /* + * Call H5Aread function. + */ + c_attr_id = *attr_id; + c_mem_type_id = *mem_type_id; + ret = H5Aread(c_attr_id, c_mem_type_id, buf); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5aclose_c + * Purpose: Call H5Aclose to close an attribute + * Inputs: attr_id - identifier of an attribute to be closed + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5aclose_c ( hid_t_f *attr_id ) +{ + int ret_value = 0; + hid_t c_attr_id; + c_attr_id = *attr_id; + if ( H5Aclose(c_attr_id) < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5adelete_c + * Purpose: Call H5Adelete to delete an attribute + * Inputs: obj_id - object identifier + * name - name of the attribute + * namelen - name length + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5adelete_c (hid_t_f *obj_id, _fcd name, int_f *namelen) +{ + int ret_value = -1; + herr_t status; + hid_t c_obj_id; + char *c_name; + int c_namelen; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Adelete function. + */ + c_obj_id = *obj_id; + status = H5Adelete(c_obj_id, c_name); + + if (status < 0) return ret_value; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5aopen_idx_c + * Purpose: Call H5Aopen_idx to open an attribute + * Inputs: obj_id - object identifier + * idx - attribute index ( zero based) + * Outputs: attr_id - attribute identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5aopen_idx_c (hid_t_f *obj_id, int_f *idx, hid_t_f *attr_id) +{ + int ret_value = -1; + hid_t c_obj_id; + hid_t c_attr_id; + unsigned c_idx; + c_idx = (unsigned)*idx; + + /* + * Call H5Aopen_idx function. + */ + c_obj_id = *obj_id; + c_attr_id = H5Aopen_idx(c_obj_id, c_idx); + + if (c_attr_id < 0) return ret_value; + *attr_id = (hid_t_f)c_attr_id; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5aget_space_c + * Purpose: Call H5Aget_space to get attribute's dataspace + * Inputs: attr_id - attribute identifier + * Outputs: space_id - dataspace identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5aget_space_c (hid_t_f *attr_id, hid_t_f *space_id) +{ + int ret_value = -1; + hid_t c_attr_id; + hid_t c_space_id; + + /* + * Call H5Aget_space function. + */ + c_attr_id = *attr_id; + c_space_id = H5Aget_space(c_attr_id); + + if (c_space_id < 0) return ret_value; + *space_id = (hid_t_f)c_space_id; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5aget_type_c + * Purpose: Call H5Aget_space to get attribute's datatype + * Inputs: attr_id - attribute identifier + * Outputs: type_id - datatype identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5aget_type_c (hid_t_f *attr_id, hid_t_f *type_id) +{ + int ret_value = -1; + hid_t c_attr_id; + hid_t c_type_id; + + /* + * Call H5Aget_type function. + */ + c_attr_id = *attr_id; + c_type_id = H5Aget_type(c_attr_id); + + if (c_type_id < 0) return ret_value; + *type_id = (hid_t_f)c_type_id; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5aget_num_attrs_c + * Purpose: Call H5Aget_num_attrs to determine number of + * attributes of an object + * Inputs: obj_id - object identifier + * attr_num - number of attributes + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num) +{ + int ret_value = -1; + hid_t c_obj_id; + int c_attr_num; + + /* + * Call H5Aget_num_attrs function. + */ + c_obj_id = *obj_id; + c_attr_num = H5Aget_num_attrs(c_obj_id); + + if (c_attr_num < 0) return ret_value; + *attr_num = c_attr_num; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5aget_name_c + * Purpose: Call H5Aget_name to get attribute's name + * Inputs: attr_id - attribute identifier + * bufsize -size of the buffer + * Outputs: buf - buffer to hold the name + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5aget_name_c(hid_t_f *attr_id, size_t_f *bufsize, _fcd buf) +{ + int ret_value = -1; + hid_t c_attr_id; + ssize_t c_size; + size_t c_bufsize; + char *c_buf =NULL; + + /* + * Allocate buffer to hold name of an attribute + */ + c_bufsize = *bufsize; + c_buf = (char *)HDmalloc(c_bufsize +1); + if (c_buf == NULL) return ret_value; + + /* + * Call H5Aget_name function + */ + c_attr_id = *attr_id; + c_size = H5Aget_name(c_attr_id, c_bufsize, c_buf); + if (c_size < 0) return ret_value; + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + + HDpackFstring(c_buf, _fcdtocp(buf), c_bufsize); + HDfree( c_buf); + ret_value = c_size; + return ret_value; +} diff --git a/fortran/src/H5Aff.f90 b/fortran/src/H5Aff.f90 new file mode 100644 index 0000000..b24de00 --- /dev/null +++ b/fortran/src/H5Aff.f90 @@ -0,0 +1,1024 @@ +! +! This file contains Fortran90 interfaces for H5A functions. +! + MODULE H5A + + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + INTERFACE h5awrite_f + + MODULE PROCEDURE h5awrite_integer_scalar + MODULE PROCEDURE h5awrite_integer_1 + MODULE PROCEDURE h5awrite_integer_2 + MODULE PROCEDURE h5awrite_integer_3 + MODULE PROCEDURE h5awrite_integer_4 + MODULE PROCEDURE h5awrite_integer_5 + MODULE PROCEDURE h5awrite_integer_6 + MODULE PROCEDURE h5awrite_integer_7 + MODULE PROCEDURE h5awrite_char_scalar + MODULE PROCEDURE h5awrite_char_1 + MODULE PROCEDURE h5awrite_char_2 + MODULE PROCEDURE h5awrite_char_3 + MODULE PROCEDURE h5awrite_char_4 + MODULE PROCEDURE h5awrite_char_5 + MODULE PROCEDURE h5awrite_char_6 + MODULE PROCEDURE h5awrite_char_7 + MODULE PROCEDURE h5awrite_real_scalar + MODULE PROCEDURE h5awrite_real_1 + MODULE PROCEDURE h5awrite_real_2 + MODULE PROCEDURE h5awrite_real_3 + MODULE PROCEDURE h5awrite_real_4 + MODULE PROCEDURE h5awrite_real_5 + MODULE PROCEDURE h5awrite_real_6 + MODULE PROCEDURE h5awrite_real_7 +! Comment if on T3E + MODULE PROCEDURE h5awrite_double_scalar + MODULE PROCEDURE h5awrite_double_1 + MODULE PROCEDURE h5awrite_double_2 + MODULE PROCEDURE h5awrite_double_3 + MODULE PROCEDURE h5awrite_double_4 + MODULE PROCEDURE h5awrite_double_5 + MODULE PROCEDURE h5awrite_double_6 + MODULE PROCEDURE h5awrite_double_7 +! End commnet if on T3E + + END INTERFACE + + INTERFACE h5aread_f + + MODULE PROCEDURE h5aread_integer_scalar + MODULE PROCEDURE h5aread_integer_1 + MODULE PROCEDURE h5aread_integer_2 + MODULE PROCEDURE h5aread_integer_3 + MODULE PROCEDURE h5aread_integer_4 + MODULE PROCEDURE h5aread_integer_5 + MODULE PROCEDURE h5aread_integer_6 + MODULE PROCEDURE h5aread_integer_7 + MODULE PROCEDURE h5aread_char_scalar + MODULE PROCEDURE h5aread_char_1 + MODULE PROCEDURE h5aread_char_2 + MODULE PROCEDURE h5aread_char_3 + MODULE PROCEDURE h5aread_char_4 + MODULE PROCEDURE h5aread_char_5 + MODULE PROCEDURE h5aread_char_6 + MODULE PROCEDURE h5aread_char_7 + MODULE PROCEDURE h5aread_real_scalar + MODULE PROCEDURE h5aread_real_1 + MODULE PROCEDURE h5aread_real_2 + MODULE PROCEDURE h5aread_real_3 + MODULE PROCEDURE h5aread_real_4 + MODULE PROCEDURE h5aread_real_5 + MODULE PROCEDURE h5aread_real_6 + MODULE PROCEDURE h5aread_real_7 +! Comment if on T3E + MODULE PROCEDURE h5aread_double_scalar + MODULE PROCEDURE h5aread_double_2 + MODULE PROCEDURE h5aread_double_3 + MODULE PROCEDURE h5aread_double_4 + MODULE PROCEDURE h5aread_double_5 + MODULE PROCEDURE h5aread_double_6 + MODULE PROCEDURE h5aread_double_7 +! End commnet if on T3E + END INTERFACE + + CONTAINS + SUBROUTINE h5acreate_f(obj_id, name, type_id, space_id, attr_id, & + hdferr, creation_prp) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name + INTEGER(HID_T), INTENT(IN) :: type_id + ! Attribute datatype identifier + INTEGER(HID_T), INTENT(IN) :: space_id + ! Attribute dataspace identifier + INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp + ! Attribute creation property + ! list identifier + INTEGER :: creation_prp_default + INTEGER :: namelen + INTEGER, EXTERNAL :: h5acreate_c + creation_prp_default = H5P_DEFAULT_F + namelen = LEN(NAME) + if (present(creation_prp)) creation_prp_default = creation_prp + hdferr = h5acreate_c(obj_id, name, namelen, type_id, space_id, & + creation_prp_default, attr_id) + END SUBROUTINE h5acreate_f + + + + SUBROUTINE h5aopen_name_f(obj_id, name, attr_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name + INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen + INTEGER, EXTERNAL :: h5aopen_name_c + namelen = LEN(name) + hdferr = h5aopen_name_c(obj_id, name, namelen, attr_id) + END SUBROUTINE h5aopen_name_f + + + + SUBROUTINE h5aopen_idx_f(obj_id, index, attr_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + INTEGER, INTENT(IN) :: index ! Attribute index + INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aopen_idx_c + hdferr = h5aopen_idx_c(obj_id, index, attr_id) + END SUBROUTINE h5aopen_idx_f + + + + SUBROUTINE h5awrite_integer_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, INTENT(IN) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_scalar + + SUBROUTINE h5awrite_integer_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_1 + + + SUBROUTINE h5awrite_integer_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_2 + + + SUBROUTINE h5awrite_integer_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_3 + + + SUBROUTINE h5awrite_integer_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_4 + + + SUBROUTINE h5awrite_integer_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_5 + + + SUBROUTINE h5awrite_integer_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_6 + + + SUBROUTINE h5awrite_integer_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_integer_7 + + + SUBROUTINE h5awrite_real_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, INTENT(IN) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_scalar + + SUBROUTINE h5awrite_real_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_1 + + + SUBROUTINE h5awrite_real_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_2 + + + SUBROUTINE h5awrite_real_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_3 + + + SUBROUTINE h5awrite_real_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_4 + + + SUBROUTINE h5awrite_real_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_5 + + + SUBROUTINE h5awrite_real_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_6 + + + SUBROUTINE h5awrite_real_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_real_7 + + + SUBROUTINE h5awrite_double_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, INTENT(IN) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_scalar + + SUBROUTINE h5awrite_double_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_1 + + + SUBROUTINE h5awrite_double_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_2 + + + SUBROUTINE h5awrite_double_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_3 + + + SUBROUTINE h5awrite_double_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_4 + + + SUBROUTINE h5awrite_double_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_5 + + + SUBROUTINE h5awrite_double_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_6 + + + SUBROUTINE h5awrite_double_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awrite_c + hdferr = h5awrite_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_double_7 + + SUBROUTINE h5awrite_char_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*),INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_scalar + + SUBROUTINE h5awrite_char_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(*), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_1 + + + SUBROUTINE h5awrite_char_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_2 + + + SUBROUTINE h5awrite_char_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_3 + + + SUBROUTINE h5awrite_char_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_4 + + + SUBROUTINE h5awrite_char_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_5 + + + SUBROUTINE h5awrite_char_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_6 + + + SUBROUTINE h5awrite_char_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:,:,:,:), INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5awritec_c + hdferr = h5awritec_c(attr_id, memtype_id, buf) + END SUBROUTINE h5awrite_char_7 + + + SUBROUTINE h5aread_integer_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, INTENT(OUT) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_scalar + + SUBROUTINE h5aread_integer_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_1 + + + SUBROUTINE h5aread_integer_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_2 + + + SUBROUTINE h5aread_integer_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_3 + + + SUBROUTINE h5aread_integer_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_4 + + + SUBROUTINE h5aread_integer_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_5 + + + SUBROUTINE h5aread_integer_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_6 + + + SUBROUTINE h5aread_integer_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER, DIMENSION(:,:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_integer_7 + + + SUBROUTINE h5aread_real_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, INTENT(OUT) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_scalar + + SUBROUTINE h5aread_real_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_1 + + + SUBROUTINE h5aread_real_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_2 + + + SUBROUTINE h5aread_real_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_3 + + + SUBROUTINE h5aread_real_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_4 + + + SUBROUTINE h5aread_real_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_5 + + + SUBROUTINE h5aread_real_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_6 + + + SUBROUTINE h5aread_real_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + REAL, DIMENSION(:,:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_real_7 + + + SUBROUTINE h5aread_double_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, INTENT(OUT) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_scalar + + SUBROUTINE h5aread_double_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_1 + + + SUBROUTINE h5aread_double_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_2 + + + SUBROUTINE h5aread_double_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_3 + + + SUBROUTINE h5aread_double_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_4 + + + SUBROUTINE h5aread_double_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_5 + + + SUBROUTINE h5aread_double_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_6 + + + SUBROUTINE h5aread_double_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + DOUBLE PRECISION, DIMENSION(:,:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aread_c + hdferr = h5aread_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_double_7 + + SUBROUTINE h5aread_char_scalar(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_scalar + + + SUBROUTINE h5aread_char_1(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_1 + + + SUBROUTINE h5aread_char_2(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_2 + + + SUBROUTINE h5aread_char_3(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_3 + + + SUBROUTINE h5aread_char_4(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_4 + + + SUBROUTINE h5aread_char_5(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_5 + + + SUBROUTINE h5aread_char_6(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_6 + + + SUBROUTINE h5aread_char_7(attr_id, memtype_id, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + CHARACTER(LEN=*), DIMENSION(:,:,:,:,:,:,:), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5areadc_c + hdferr = h5areadc_c(attr_id, memtype_id, buf) + END SUBROUTINE h5aread_char_7 + + + SUBROUTINE h5aget_space_f(attr_id, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(OUT) :: space_id + ! Attribute dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL:: h5aget_space_c + hdferr = h5aget_space_c(attr_id, space_id) + END SUBROUTINE h5aget_space_f + + + SUBROUTINE h5aget_type_f(attr_id, type_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(OUT) :: type_id + ! Attribute datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aget_type_c + hdferr = h5aget_type_c(attr_id, type_id) + END SUBROUTINE h5aget_type_f + + + + SUBROUTINE h5aget_name_f(attr_id, size, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER, INTENT(IN) :: size ! Buffer size + CHARACTER(LEN=*), INTENT(OUT) :: buf + ! Buffer to hold attribute name + INTEGER, INTENT(OUT) :: hdferr ! Error code: + ! name length is successful, + ! -1 if fail + INTEGER, EXTERNAL :: h5aget_name_c + hdferr = h5aget_name_c(attr_id, size, buf) + END SUBROUTINE h5aget_name_f + + + + SUBROUTINE h5aget_num_attrs_f(obj_id, attr_num, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + INTEGER, INTENT(OUT) :: attr_num ! Number of attributes of the + ! object + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5aget_num_attrs_c + hdferr = h5aget_num_attrs_c(obj_id, attr_num) + END SUBROUTINE h5aget_num_attrs_f + + + SUBROUTINE h5adelete_f(obj_id, name, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen + INTEGER, EXTERNAL :: h5adelete_c + namelen = LEN(name) + hdferr = h5adelete_c(obj_id, name, namelen) + END SUBROUTINE h5adelete_f + + + SUBROUTINE h5aclose_f(attr_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code: + INTEGER, EXTERNAL :: h5aclose_c + hdferr = h5aclose_c(attr_id) + END SUBROUTINE h5aclose_f + + END MODULE H5A diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c new file mode 100644 index 0000000..968e9a1 --- /dev/null +++ b/fortran/src/H5Df.c @@ -0,0 +1,391 @@ +#include "H5f90.h" + +/*---------------------------------------------------------------------------- + * Name: h5dcreate_c + * Purpose: Call H5Dcreate to create a dataset + * Inputs: loc_id - file or group identifier + * name - name of the dataset + * namelen - name length + * type_id - datatype identifier + * space_id - dataspace identifier + * crt_pr - identifier of creation property list + * Outputs: dset_id - dataset identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 4, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dcreate_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *dset_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_loc_id; + hid_t c_type_id; + hid_t c_space_id; + hid_t c_dset_id; + hid_t c_crt_prp; + + /* + * Define creation property + */ + c_crt_prp = *crt_prp; + if ( H5P_DEFAULT_F == c_crt_prp ) c_crt_prp = H5P_DEFAULT; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Dcreate function. + */ + c_loc_id = *loc_id; + c_type_id = *type_id; + c_space_id = *space_id; + c_dset_id = H5Dcreate(c_loc_id, c_name, c_type_id, c_space_id, c_crt_prp); + if (c_dset_id < 0) return ret_value; + *dset_id = (hid_t_f)c_dset_id; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dopen_c + * Purpose: Call H5Dopen to open a dataset + * Inputs: loc_id - file or group identifier + * name - name of the dataset + * namelen - name length + * Outputs: dset_id - dataset identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 4, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dset_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_loc_id; + hid_t c_dset_id; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Dopen function. + */ + c_loc_id = *loc_id; + c_dset_id = H5Dopen(c_loc_id, c_name); + + if (c_dset_id < 0) return ret_value; + *dset_id = (hid_t_f)c_dset_id; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dwritec_c + * Purpose: Call h5dwrite_c to write a dataset of characters + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * buf - character data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 6, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dwritec_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf) +{ + int ret_value = -1; + + /* + * Call h5dwrite_c function. + */ + ret_value = nh5dwrite_c(dset_id, mem_type_id, mem_space_id, file_space_id, xfer_prp, _fcdtocp(buf)); + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dwrite_c + * Purpose: Call H5Dwrite to write a dataset + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * buf - data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 6, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dwrite_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf) +{ + int ret_value = -1; + herr_t ret; + hid_t c_dset_id; + hid_t c_mem_type_id; + hid_t c_mem_space_id; + hid_t c_file_space_id; + hid_t c_xfer_prp; + + /* + * Define transfer property + */ + c_xfer_prp = *xfer_prp; + if ( H5P_DEFAULT_F == c_xfer_prp ) c_xfer_prp = H5P_DEFAULT; + + /* + * Call H5Dwrite function. + */ + c_dset_id = *dset_id; + c_mem_type_id = *mem_type_id; + c_mem_space_id = *mem_space_id; + c_file_space_id = *file_space_id; + ret = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5dreadc_c + * Purpose: Call h5dread_c to read a dataset of characters + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * Outputs: buf - character data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Monday, August 9, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dreadc_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf) +{ + int ret_value = -1; + + /* + * Call h5dread_c function. + */ + ret_value = nh5dread_c(dset_id, mem_type_id, mem_space_id, file_space_id, xfer_prp, _fcdtocp(buf)); + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dread_c + * Purpose: Call H5Draed to read a dataset + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * Outputs: buf - data buffer + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Monday, August 9, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dread_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf) +{ + int ret_value = -1; + herr_t ret; + hid_t c_dset_id; + hid_t c_mem_type_id; + hid_t c_mem_space_id; + hid_t c_file_space_id; + hid_t c_xfer_prp; + + /* + * Define transfer property + */ + c_xfer_prp = *xfer_prp; + if ( H5P_DEFAULT_F == c_xfer_prp ) c_xfer_prp = H5P_DEFAULT; + + /* + * Call H5Dread function. + */ + c_dset_id = *dset_id; + c_mem_type_id = *mem_type_id; + c_mem_space_id = *mem_space_id; + c_file_space_id = *file_space_id; + ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dclose_c + * Purpose: Call H5Dclose to close a dataset + * Inputs: dset_id - identifier of the dataset to be closed + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 4, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5dclose_c ( hid_t_f *dset_id ) +{ + int ret_value = 0; + hid_t c_dset_id; + c_dset_id = *dset_id; + if ( H5Dclose(c_dset_id) < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dget_space_c + * Purpose: Call H5Dget_space to obtain dataspace of a dataset + * Inputs: dset_id - identifier of the dataset + * Outputs: space_id - identifier of the dataset's dataspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 19, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5dget_space_c ( hid_t_f *dset_id , hid_t_f *space_id) +{ + int ret_value = -1; + hid_t c_dset_id; + hid_t c_space_id; + + c_dset_id = *dset_id; + c_space_id = H5Dget_space(c_dset_id); + if(c_space_id < 0 ) return ret_value; + ret_value = 0; + *space_id = (hid_t_f)c_space_id; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dget_type_c + * Purpose: Call H5Dget_type to obtain datatype of a dataset + * Inputs: dset_id - identifier of the dataset + * Outputs: type_id - identifier of the dataset's datatype + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 19, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5dget_type_c ( hid_t_f *dset_id , hid_t_f *type_id) +{ + int ret_value = -1; + hid_t c_dset_id; + hid_t c_type_id; + + c_dset_id = *dset_id; + c_type_id = H5Dget_type(c_dset_id); + + if(c_type_id < 0 ) return ret_value; + + *type_id = (hid_t_f)c_type_id; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dget_create_plist_c + * Purpose: Call H5Dget_create_plist to obtain creation property list + * of a dataset + * Inputs: dset_id - identifier of the dataset + * Outputs: plist_id - identifier of he dataset creation property list + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 19, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5dget_create_plist_c ( hid_t_f *dset_id , hid_t_f *plist_id) +{ + int ret_value = -1; + hid_t c_dset_id; + hid_t c_plist_id; + + c_dset_id = *dset_id; + c_plist_id = H5Dget_create_plist(c_dset_id); + + if(c_plist_id < 0 ) return ret_value; + + ret_value = 0; + *plist_id = (hid_t_f)c_plist_id; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5dextend_c + * Purpose: Call H5Dextend to extend dataset with unlimited dimensions + * Inputs: dset_id - identifier of the dataset + * Outputs: dims - array with the dimension sizes + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, August 19, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5dextend_c ( hid_t_f *dset_id , hsize_t_f *dims) +{ + int ret_value = -1; + hsize_t *c_dims; + int status; + int rank; + int i; + hid_t c_dset_id; + hid_t c_space_id; + + c_dset_id = *dset_id; + c_space_id = H5Dget_space(c_dset_id); + if (c_space_id < 0) return ret_value; + + rank = H5Sget_simple_extent_ndims(c_space_id); + if (rank < 0) return ret_value; + + c_dims = malloc(sizeof(hsize_t)*rank); + if (!c_dims) return ret_value; + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for (i=0; i < rank; i++) + c_dims[i] = dims[rank - i - 1]; + + status = H5Dextend(c_dset_id, c_dims); + + if ( status >= 0 ) ret_value = 0; + HDfree(c_dims); + return ret_value; +} + diff --git a/fortran/src/H5Dff.f90 b/fortran/src/H5Dff.f90 new file mode 100644 index 0000000..5af83b8 --- /dev/null +++ b/fortran/src/H5Dff.f90 @@ -0,0 +1,2441 @@ +! +! This file contains Fortran90 interfaces for H5D functions. +! + MODULE H5D + USE H5FORTRAN_TYPES +! USE H5FORTRAN_FLAGS - do not need it here since it is included in H5R already + USE H5R + + INTERFACE h5dwrite_f + + MODULE PROCEDURE h5dwrite_reference_obj + MODULE PROCEDURE h5dwrite_reference_dsetreg + MODULE PROCEDURE h5dwrite_integer_scalar + MODULE PROCEDURE h5dwrite_integer_1 + MODULE PROCEDURE h5dwrite_integer_2 + MODULE PROCEDURE h5dwrite_integer_3 + MODULE PROCEDURE h5dwrite_integer_4 + MODULE PROCEDURE h5dwrite_integer_5 + MODULE PROCEDURE h5dwrite_integer_6 + MODULE PROCEDURE h5dwrite_integer_7 + MODULE PROCEDURE h5dwrite_char_scalar + MODULE PROCEDURE h5dwrite_char_1 + MODULE PROCEDURE h5dwrite_char_2 + MODULE PROCEDURE h5dwrite_char_3 + MODULE PROCEDURE h5dwrite_char_4 + MODULE PROCEDURE h5dwrite_char_5 + MODULE PROCEDURE h5dwrite_char_6 + MODULE PROCEDURE h5dwrite_char_7 + MODULE PROCEDURE h5dwrite_real_scalar + MODULE PROCEDURE h5dwrite_real_1 + MODULE PROCEDURE h5dwrite_real_2 + MODULE PROCEDURE h5dwrite_real_3 + MODULE PROCEDURE h5dwrite_real_4 + MODULE PROCEDURE h5dwrite_real_5 + MODULE PROCEDURE h5dwrite_real_6 + MODULE PROCEDURE h5dwrite_real_7 +! Comment if on T3E + MODULE PROCEDURE h5dwrite_double_scalar + MODULE PROCEDURE h5dwrite_double_1 + MODULE PROCEDURE h5dwrite_double_2 + MODULE PROCEDURE h5dwrite_double_3 + MODULE PROCEDURE h5dwrite_double_4 + MODULE PROCEDURE h5dwrite_double_5 + MODULE PROCEDURE h5dwrite_double_6 + MODULE PROCEDURE h5dwrite_double_7 +! End comment if on T3E + END INTERFACE + + INTERFACE h5dread_f + + MODULE PROCEDURE h5dread_reference_obj + MODULE PROCEDURE h5dread_reference_dsetreg + MODULE PROCEDURE h5dread_integer_scalar + MODULE PROCEDURE h5dread_integer_1 + MODULE PROCEDURE h5dread_integer_2 + MODULE PROCEDURE h5dread_integer_3 + MODULE PROCEDURE h5dread_integer_4 + MODULE PROCEDURE h5dread_integer_5 + MODULE PROCEDURE h5dread_integer_6 + MODULE PROCEDURE h5dread_integer_7 + MODULE PROCEDURE h5dread_char_scalar + MODULE PROCEDURE h5dread_char_1 + MODULE PROCEDURE h5dread_char_2 + MODULE PROCEDURE h5dread_char_3 + MODULE PROCEDURE h5dread_char_4 + MODULE PROCEDURE h5dread_char_5 + MODULE PROCEDURE h5dread_char_6 + MODULE PROCEDURE h5dread_char_7 + MODULE PROCEDURE h5dread_real_scalar + MODULE PROCEDURE h5dread_real_1 + MODULE PROCEDURE h5dread_real_2 + MODULE PROCEDURE h5dread_real_3 + MODULE PROCEDURE h5dread_real_4 + MODULE PROCEDURE h5dread_real_5 + MODULE PROCEDURE h5dread_real_6 + MODULE PROCEDURE h5dread_real_7 +! Comment if on T3E + MODULE PROCEDURE h5dread_double_scalar + MODULE PROCEDURE h5dread_double_1 + MODULE PROCEDURE h5dread_double_2 + MODULE PROCEDURE h5dread_double_3 + MODULE PROCEDURE h5dread_double_4 + MODULE PROCEDURE h5dread_double_5 + MODULE PROCEDURE h5dread_double_6 + MODULE PROCEDURE h5dread_double_7 +! End comment if on T3E + + END INTERFACE + + CONTAINS + + + SUBROUTINE h5dcreate_f(loc_id, name, type_id, space_id, dset_id, & + hdferr, creation_prp) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the dataset + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HID_T), INTENT(OUT) :: dset_id ! Dataset identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp + ! Dataset creation propertly + ! list identifier + INTEGER :: creation_prp_default + INTEGER :: namelen ! Name length + INTEGER, EXTERNAL :: h5dcreate_c + + creation_prp_default = H5P_DEFAULT_F + if (present(creation_prp)) creation_prp_default = creation_prp + namelen = LEN(name) + hdferr = h5dcreate_c(loc_id, name, namelen, type_id, space_id, & + creation_prp_default, dset_id) + END SUBROUTINE h5dcreate_f + + SUBROUTINE h5dopen_f(loc_id, name, dset_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the dataset + INTEGER(HID_T), INTENT(OUT) :: dset_id ! Dataset identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen ! Name length + INTEGER, EXTERNAL :: h5dopen_c + namelen = LEN(name) + hdferr = h5dopen_c(loc_id, name, namelen, dset_id) + + END SUBROUTINE h5dopen_f + + SUBROUTINE h5dclose_f(dset_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5dclose_c + + hdferr = h5dclose_c(dset_id) + + END SUBROUTINE h5dclose_f + + SUBROUTINE h5dwrite_reference_obj(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + TYPE(hobj_ref_t_f), DIMENSION(:), INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_reference_obj + + SUBROUTINE h5dwrite_reference_dsetreg(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + TYPE(hdset_reg_ref_t_f), DIMENSION(:), INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_reference_dsetreg + + + SUBROUTINE h5dwrite_integer_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_integer_scalar + + SUBROUTINE h5dwrite_integer_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN), DIMENSION(:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_integer_1 + + SUBROUTINE h5dwrite_integer_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dwrite_integer_2 + + SUBROUTINE h5dwrite_integer_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dwrite_integer_3 + + SUBROUTINE h5dwrite_integer_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN), DIMENSION(:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default = H5P_DEFAULT_F + INTEGER(HID_T) :: mem_space_id_default = H5S_ALL_F + INTEGER(HID_T) :: file_space_id_default = H5S_ALL_F + INTEGER, EXTERNAL :: h5dwrite_c + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dwrite_integer_4 + + SUBROUTINE h5dwrite_integer_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dwrite_integer_5 + + SUBROUTINE h5dwrite_integer_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN), DIMENSION(:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dwrite_integer_6 + + SUBROUTINE h5dwrite_integer_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(IN), DIMENSION(:,:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dwrite_integer_7 + + + SUBROUTINE h5dwrite_char_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_scalar + + SUBROUTINE h5dwrite_char_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN), DIMENSION(*) :: buf ! Data buffer + ! CHARACTER, INTENT(IN), DIMENSION(*) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_1 + + SUBROUTINE h5dwrite_char_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_2 + + SUBROUTINE h5dwrite_char_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_3 + + SUBROUTINE h5dwrite_char_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN), DIMENSION(:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_4 + + SUBROUTINE h5dwrite_char_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_5 + + SUBROUTINE h5dwrite_char_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN), DIMENSION(:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_6 + + SUBROUTINE h5dwrite_char_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(IN), DIMENSION(:,:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwritec_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwritec_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_char_7 + + SUBROUTINE h5dwrite_real_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + INTEGER(HID_T) :: xfer_prp_default = H5P_DEFAULT_F + INTEGER(HID_T) :: mem_space_id_default = H5S_ALL_F + INTEGER(HID_T) :: file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_scalar + + SUBROUTINE h5dwrite_real_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN), DIMENSION(:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_1 + + SUBROUTINE h5dwrite_real_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_2 + + SUBROUTINE h5dwrite_real_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_3 + + SUBROUTINE h5dwrite_real_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN), DIMENSION(:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_4 + + SUBROUTINE h5dwrite_real_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_5 + + SUBROUTINE h5dwrite_real_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN), DIMENSION(:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_6 + + SUBROUTINE h5dwrite_real_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(IN), DIMENSION(:,:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dwrite_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_real_7 + + + SUBROUTINE h5dwrite_double_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_scalar + + SUBROUTINE h5dwrite_double_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN), DIMENSION(:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_1 + + SUBROUTINE h5dwrite_double_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_2 + + SUBROUTINE h5dwrite_double_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_3 + + SUBROUTINE h5dwrite_double_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN), DIMENSION(:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_4 + + SUBROUTINE h5dwrite_double_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_5 + + SUBROUTINE h5dwrite_double_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN), DIMENSION(:,:,:,:,:,:) :: buf + ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_6 + + SUBROUTINE h5dwrite_double_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(IN), DIMENSION(:,:,:,:,:,:,:) :: buf + ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dwrite_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dwrite_double_7 + + SUBROUTINE h5dread_reference_obj(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + TYPE(hobj_ref_t_f), DIMENSION(:), INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_reference_obj + + SUBROUTINE h5dread_reference_dsetreg(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + TYPE(hdset_reg_ref_t_f), DIMENSION(:), INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_reference_dsetreg + + + SUBROUTINE h5dread_integer_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_integer_scalar + + SUBROUTINE h5dread_integer_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT), DIMENSION(:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_integer_1 + + SUBROUTINE h5dread_integer_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dread_integer_2 + + SUBROUTINE h5dread_integer_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dread_integer_3 + + SUBROUTINE h5dread_integer_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT), DIMENSION(:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dread_integer_4 + + SUBROUTINE h5dread_integer_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dread_integer_5 + + SUBROUTINE h5dread_integer_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT), DIMENSION(:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dread_integer_6 + + SUBROUTINE h5dread_integer_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + INTEGER, INTENT(INOUT), DIMENSION(:,:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, & + buf) + + END SUBROUTINE h5dread_integer_7 + + SUBROUTINE h5dread_char_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_scalar + + SUBROUTINE h5dread_char_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_1 + + SUBROUTINE h5dread_char_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_2 + + SUBROUTINE h5dread_char_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_3 + + SUBROUTINE h5dread_char_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_4 + + SUBROUTINE h5dread_char_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_5 + + SUBROUTINE h5dread_char_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_6 + + SUBROUTINE h5dread_char_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(:,:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dreadc_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dreadc_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_char_7 + + SUBROUTINE h5dread_real_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_scalar + + SUBROUTINE h5dread_real_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT), DIMENSION(:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_1 + + SUBROUTINE h5dread_real_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_2 + + SUBROUTINE h5dread_real_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_3 + + SUBROUTINE h5dread_real_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT), DIMENSION(:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_4 + + SUBROUTINE h5dread_real_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_5 + + SUBROUTINE h5dread_real_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT), DIMENSION(:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_6 + + SUBROUTINE h5dread_real_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + REAL, INTENT(INOUT), DIMENSION(:,:,:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + INTEGER, EXTERNAL :: h5dread_c + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_real_7 + + SUBROUTINE h5dread_double_scalar(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_scalar + + SUBROUTINE h5dread_double_1(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_1 + + SUBROUTINE h5dread_double_2(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_2 + + SUBROUTINE h5dread_double_3(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_3 + + SUBROUTINE h5dread_double_4(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:,:,:,:) :: buf + ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_4 + + SUBROUTINE h5dread_double_5(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:,:,:,:,:) :: buf ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_5 + + SUBROUTINE h5dread_double_6(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:,:,:,:,:,:) :: buf + ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_6 + + SUBROUTINE h5dread_double_7(dset_id, mem_type_id, buf, hdferr, & + mem_space_id, file_space_id, xfer_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier + DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:,:,:,:,:,:,:) :: buf + ! Data buffer + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id + ! Memory dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id + ! File dataspace identfier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp + ! Transfer property list identifier + + INTEGER(HID_T) :: xfer_prp_default + INTEGER(HID_T) :: mem_space_id_default + INTEGER(HID_T) :: file_space_id_default + INTEGER, EXTERNAL :: h5dread_c + + xfer_prp_default = H5P_DEFAULT_F + mem_space_id_default = H5S_ALL_F + file_space_id_default = H5S_ALL_F + + if (present(xfer_prp)) xfer_prp_default = xfer_prp + if (present(mem_space_id)) mem_space_id_default = mem_space_id + if (present(file_space_id)) file_space_id_default = file_space_id + + hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, buf) + + END SUBROUTINE h5dread_double_7 + + SUBROUTINE h5dget_space_f(dataset_id, dataspace_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dataset_id ! Dataset identifier + INTEGER(HID_T), INTENT(OUT) :: dataspace_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5dget_space_c + hdferr = h5dget_space_c(dataset_id, dataspace_id) + END SUBROUTINE h5dget_space_f + + + SUBROUTINE h5dget_type_f(dataset_id, datatype_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dataset_id ! Dataset identifier + INTEGER(HID_T), INTENT(OUT) :: datatype_id ! Datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5dget_type_c + hdferr = h5dget_type_c (dataset_id, datatype_id) + END SUBROUTINE h5dget_type_f + + SUBROUTINE h5dextend_f(dataset_id, size, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dataset_id ! Dataset identifier + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: size + ! Array containing + ! dimensions' sizes + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5dextend_c + hdferr = h5dextend_c(dataset_id, size) + END SUBROUTINE h5dextend_f + + + SUBROUTINE h5dget_create_plist_f(dataset_id, plist_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dataset_id ! Dataset identifier + INTEGER(HID_T), INTENT(OUT) :: plist_id ! Dataset creation + ! property list identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5dget_create_plist_c + hdferr = h5dget_create_plist_c(dataset_id, plist_id) + END SUBROUTINE h5dget_create_plist_f + + END MODULE H5D diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c new file mode 100644 index 0000000..0ae4255 --- /dev/null +++ b/fortran/src/H5Ef.c @@ -0,0 +1,169 @@ +#include "H5f90.h" + + +/*---------------------------------------------------------------------------- + * Name: h5eclear_c + * Purpose: Call H5Eclear to clear the error stack for the current thread + * Inputs: + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5eclear_c( ) +{ + int ret_val = -1; + herr_t status; + + /* + * Call H5Eclear function. + */ + status = H5Eclear(); + if(status < 0) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eprint_c1 + * Purpose: Call H5Eprint to print the error stack in a default manner. + * Inputs: name - file name + * namelen - length of name + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eprint_c1(_fcd name, int_f* namelen) +{ + int ret_val = -1; + herr_t status; + FILE * file; + char* c_name; + int c_namelen; + c_namelen = *namelen; + c_name = (char*)HD5f2cstring(name, c_namelen); + file = fopen(c_name, "w"); + + /* + * Call H5Eprint function. + */ + status = H5Eprint(file); + if(status < 0) return ret_val; + ret_val = 0; + return ret_val; +} + + +/*---------------------------------------------------------------------------- + * Name: h5eprint_c2 + * Purpose: Call H5Eprint to print the error stack to stderr + * in a default manner. + * Inputs: + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eprint_c2() +{ + int ret_val = -1; + herr_t status; + + /* + * Call H5Eprint function. + */ + status = H5Eprint(NULL); + if(status < 0) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eget_major_c + * Purpose: Call H5Eget_major to get a character string + * describing an error specified by a major error number. + * Inputs: error_no - Major error number + * Outputs: name - character string describing the error + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eget_major_c(int_f* error_no, _fcd name) +{ + int ret_val = -1; + const char* c_name; + H5E_major_t c_error_no; + c_error_no = (H5E_major_t)*error_no; + + /* + * Call H5Eget_major function. + */ + c_name = H5Eget_major(c_error_no); + HDpackFstring((char*)c_name, _fcdtocp(name), strlen(c_name)); + + if(!strcmp(c_name, "Invalid major error number")) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eget_minor_c + * Purpose: Call H5Eget_minor to get a character string + * describing an error specified by a minor error number. + * Inputs: error_no - Major error number + * Outputs: name - character string describing the error + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eget_minor_c(int_f* error_no, _fcd name) +{ + int ret_val = -1; + const char* c_name; + H5E_minor_t c_error_no; + c_error_no = (H5E_minor_t)*error_no; + + /* + * Call H5Eget_minor function. + */ + c_name = H5Eget_minor(c_error_no); + HDpackFstring((char*)c_name, _fcdtocp(name), strlen(c_name)); + + if(!strcmp(c_name, "Invalid minor error number")) return ret_val; + ret_val = 0; + return ret_val; +} + +/*---------------------------------------------------------------------------- + * Name: h5eset_auto_c + * Purpose: Call H5Eset_auto to turn automatic error printing on or off. + * Inputs: printflag - flag to turn automatic error printing on or off. + * Outputs: + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, March 29, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5eset_auto_c(int_f* printflag) +{ + int ret_val = -1; + herr_t status; + + if (*printflag == 1) + status = H5Eset_auto((H5E_auto_t)H5Eprint, stderr); + if (status >= 0) ret_val = 0; + return ret_val; +} diff --git a/fortran/src/H5Eff.f90 b/fortran/src/H5Eff.f90 new file mode 100644 index 0000000..a8393dd --- /dev/null +++ b/fortran/src/H5Eff.f90 @@ -0,0 +1,62 @@ +! +! This file contains FORTRAN90 interfaces for H5E functions +! + MODULE H5E + + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + CONTAINS + + SUBROUTINE h5eclear_f(hdferr) + IMPLICIT NONE + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5eclear_c + + hdferr = h5eclear_c() + END SUBROUTINE h5eclear_f + + SUBROUTINE h5eprint_f(hdferr, name) + CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: name ! File name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5eprint_c1, h5eprint_c2 + + INTEGER :: namelen + + namelen = LEN(NAME) + if (present(name)) hdferr = h5eprint_c1(name, namelen) + hdferr = h5eprint_c2() + END SUBROUTINE h5eprint_f + + SUBROUTINE h5eget_major_f(error_no, name, hdferr) + INTEGER, INTENT(IN) :: error_no !Major error number + CHARACTER(LEN=*), INTENT(OUT) :: name ! File name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5eget_major_c + + hdferr = h5eget_major_c(error_no, name) + END SUBROUTINE h5eget_major_f + + SUBROUTINE h5eget_minor_f(error_no, name, hdferr) + INTEGER, INTENT(IN) :: error_no !Major error number + CHARACTER(LEN=*), INTENT(OUT) :: name ! File name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5eget_minor_c + + hdferr = h5eget_minor_c(error_no, name) + END SUBROUTINE h5eget_minor_f + + SUBROUTINE h5eset_auto_f(printflag, hdferr) + INTEGER, INTENT(IN) :: printflag !flag to turn automatic error + !printing on or off + !possible values are: + !printon (1) + !printoff(0) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5eset_auto_c + + hdferr = h5eset_auto_c(printflag) + END SUBROUTINE h5eset_auto_f + + END MODULE H5E + diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c new file mode 100644 index 0000000..9e3d56d --- /dev/null +++ b/fortran/src/H5Ff.c @@ -0,0 +1,451 @@ +#include "H5f90.h" + +/*---------------------------------------------------------------------------- + * Name: h5fcreate_c + * Purpose: Call H5Fcreate to create the file + * Inputs: name - name of the file + * namelen - name length + * access_flags - file access flags + * crt_pr - identifier of creation property list + * acc_prp - identifier of access property list + * Outputs: file_id - file identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Monday, July 26, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f* crt_prp, hid_t_f *acc_prp, hid_t_f *file_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_file_id; + unsigned c_access_flags; + hid_t c_crt_prp; + hid_t c_acc_prp; + int CASE; + hid_t CASE_prp; + + /* + * Define access flags + */ + CASE = (int)*access_flags; + switch (CASE) { + + case H5F_ACC_RDWR_F: + c_access_flags = H5F_ACC_RDWR; + break; + + case H5F_ACC_RDONLY_F: + c_access_flags = H5F_ACC_RDONLY; + break; + + case H5F_ACC_TRUNC_F: + c_access_flags = H5F_ACC_TRUNC; + break; + + case H5F_ACC_EXCL_F: + c_access_flags = H5F_ACC_EXCL; + break; + + case H5F_ACC_DEBUG_F: + c_access_flags = H5F_ACC_DEBUG; + break; + + default: + return ret_value; + } + + /* + * Define creation property + */ + c_crt_prp = *crt_prp; + if ( H5P_DEFAULT_F == c_crt_prp ) c_crt_prp = H5P_DEFAULT; + + /* + * Define access property + */ + c_acc_prp = *acc_prp; + if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Fcreate function. + */ + c_file_id = H5Fcreate(c_name, c_access_flags, c_crt_prp, c_acc_prp); + + if (c_file_id < 0) return ret_value; + *file_id = c_file_id; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5fflush_c + * Purpose: Call H5Fflush to flush the object + * Inputs: object_id - identifier of either a file, a dataset, + * a group, an attribute or a named data type + * scope - integer to specify the flushing action, either + * H5F_SCOPE_GLOBAL or H5F_SCOPE_LOCAL + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, November 5, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5fflush_c (hid_t_f *object_id, int_f *scope) +{ + int ret_value = -1; + hid_t c_file_id; + int CASE; + H5F_scope_t c_scope; + htri_t status; + + /* + * Define scope flags + */ + CASE = (int)*scope; + switch (CASE) { + + case H5F_SCOPE_LOCAL_F: + c_scope = H5F_SCOPE_LOCAL; + break; + + case H5F_SCOPE_GLOBAL_F: + c_scope = H5F_SCOPE_GLOBAL; + break; + + default: + return ret_value; + } + + /* + * Call H5Fflush function. + */ + + c_file_id = *object_id; + + status = H5Fflush(c_file_id, c_scope); + + if (status >= 0) ret_value = 0; + + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5fmount_c + * Purpose: Call H5Fmount to mount the file + * Inputs: loc_id - Identifier for file or group + * dsetname - name of dataset + * namelen - dsetname length + * file_id - file identifier for the file to be mounted + * acc_prp - identifier of access property list + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Monday, October 25, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5fmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_loc_id; + hid_t c_file_id; + hid_t c_acc_prp; + htri_t status; + + /* + * Define access property + */ + c_acc_prp = *acc_prp; + if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT; + + c_loc_id = *loc_id; + c_file_id = *file_id; + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Fmount function. + */ + status = H5Fmount(c_loc_id, c_name, c_file_id, c_acc_prp); + + if (status >= 0) ret_value = 0; + + HDfree(c_name); + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5funmount_c + * Purpose: Call H5Funmount to unmount the file + * Inputs: loc_id - Identifier for file or group + * dsetname - name of dataset + * namelen - dsetname length + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Monday, October 25, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_loc_id; + htri_t status; + + c_loc_id = *loc_id; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(dsetname, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Fmount function. + */ + status = H5Funmount(c_loc_id, c_name); + + if (status >= 0) ret_value = 0; + + HDfree(c_name); + return ret_value; +} + + + +/*---------------------------------------------------------------------------- + * Name: h5fopen_c + * Purpose: Call H5Fopen to open the file + * Inputs: name - name of the file + * namelen - name length + * access_flags - file access flags + * acc_prp - identifier of access property list + * Outputs: file_id - file identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 3, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_file_id; + unsigned c_access_flags; + hid_t c_acc_prp; + int CASE; + hid_t CASE_prp; + + /* + * Define access flags + */ + CASE = (int)*access_flags; + switch (CASE) { + + case H5F_ACC_RDWR_F: + c_access_flags = H5F_ACC_RDWR; + break; + + case H5F_ACC_RDONLY_F: + c_access_flags = H5F_ACC_RDONLY; + break; + + case H5F_ACC_TRUNC_F: + c_access_flags = H5F_ACC_TRUNC; + break; + + case H5F_ACC_EXCL_F: + c_access_flags = H5F_ACC_EXCL; + break; + + case H5F_ACC_DEBUG_F: + c_access_flags = H5F_ACC_DEBUG; + break; + + default: + return ret_value; + } + + /* + * Define access property + */ + c_acc_prp = *acc_prp; + if ( H5P_DEFAULT_F == c_acc_prp ) c_acc_prp = H5P_DEFAULT; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Fopen function. + */ + c_file_id = H5Fopen(c_name, c_access_flags, c_acc_prp); + + if (c_file_id < 0) return ret_value; + *file_id = (hid_t_f)c_file_id; + + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5freopen_c + * Purpose: Call H5Freopen to open the file + * Inputs: file_id1 - file identifier + * Outputs: file_id2 - file identifier + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, November 3, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2) +{ + int ret_value = -1; + hid_t c_file_id1, c_file_id2; + + c_file_id1 = *file_id1; + c_file_id2 = H5Freopen(c_file_id1); + + if (c_file_id2 < 0) return ret_value; + *file_id2 = (hid_t_f)c_file_id2; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5fget_create_plist_c + * Purpose: Call H5Fget_create_plist to get the file creation property list + * Inputs: file_id - file identifier + * Outputs: prop_id - creation property list identifier + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, November 3, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id) +{ + int ret_value = -1; + hid_t c_file_id, c_prop_id; + + c_file_id = *file_id; + c_prop_id = H5Fget_create_plist(c_file_id); + + if (c_prop_id < 0) return ret_value; + *prop_id = (hid_t_f)c_prop_id; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5fget_access_plist_c + * Purpose: Call H5Fget_access_plist to get the file access property list + * Inputs: file_id - file identifier + * Outputs: access_id - access property list identifier + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, November 5, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id) +{ + int ret_value = -1; + hid_t c_file_id, c_access_id; + + c_file_id = *file_id; + c_access_id = H5Fget_access_plist(c_file_id); + + if (c_access_id < 0) return ret_value; + *access_id = (hid_t_f)c_access_id; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5fis_hdf5_c + * Purpose: Call H5Fis_hdf5 to determone if the file is an HDF5 file + * Inputs: name - name of the file + * namelen - name length + * Outputs: flag - 0 if file is not HDF5 file , positive if a file + * is an HDF5 file, and negative on failure. + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 3, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5fis_hdf5_c (_fcd name, int_f *namelen, int_f *flag) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + htri_t status; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Fopen function. + */ + status = H5Fis_hdf5(c_name); + *flag = (int_f)status; + if (status >= 0) ret_value = 0; + + HDfree(c_name); + return ret_value; +} +/*---------------------------------------------------------------------------- + * Name: h5fclose_c + * Purpose: Call H5Fclose to close the file + * Inputs: file_id - identifier of the file to be closed + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Monday, July 26, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5fclose_c ( hid_t_f *file_id ) +{ + int ret_value = 0; + hid_t c_file_id; + + c_file_id = *file_id; + if ( H5Fclose(c_file_id) < 0 ) ret_value = -1; + return ret_value; +} diff --git a/fortran/src/H5Fff.f90 b/fortran/src/H5Fff.f90 new file mode 100644 index 0000000..817978b --- /dev/null +++ b/fortran/src/H5Fff.f90 @@ -0,0 +1,199 @@ +! +! This file contains Fortran90 interfaces for H5F functions. +! + MODULE H5F + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + CONTAINS + + SUBROUTINE h5fcreate_f(name, access_flags, file_id, hdferr, & + creation_prp, access_prp) + + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file + INTEGER, INTENT(IN) :: access_flags ! File access flags + INTEGER(HID_T), INTENT(OUT) :: file_id ! File identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp + ! File creation propertly + ! list identifier + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp + ! File access property list + ! identifier + INTEGER :: creation_prp_default + INTEGER :: access_prp_default + INTEGER :: namelen ! Length of the name character string + INTEGER, EXTERNAL :: h5fcreate_c + + creation_prp_default = H5P_DEFAULT_F + access_prp_default = H5P_DEFAULT_F + + if (present(creation_prp)) creation_prp_default = creation_prp + if (present(access_prp)) access_prp_default = access_prp + namelen = LEN(name) + hdferr = h5fcreate_c(name, namelen, access_flags, & + creation_prp_default, access_prp_default, file_id) + + END SUBROUTINE h5fcreate_f + + SUBROUTINE h5fflush_f(object_id, scope, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: object_id !identifier for any object + !associate with a file, + !including the file itself, + !a dataset, a group, an + !attribute, or a named + !data type + + INTEGER, INTENT(IN) :: scope !scope of the flushing + !action, possible values + !are: H5F_SCOPE_GLOBAL_F + ! which flushes the entire + !virtual file, + !and H5F_SCOPE_LOCAL_F + !which flushes only the + !specified file. + + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5fflush_c + + hdferr = h5fflush_c(object_id, scope) + + END SUBROUTINE h5fflush_f + + + SUBROUTINE h5fmount_f(loc_id, dsetname, file_id, hdferr, access_prp) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for file or group + ! in which dsetname is defined + CHARACTER(LEN=*), INTENT(IN) :: dsetname ! Name of the dataset + INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier for the + ! file to be mounted + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp + ! File access property list + ! identifier + INTEGER :: access_prp_default + INTEGER :: namelen ! Length of the dsetname character string + INTEGER, EXTERNAL :: h5fmount_c + + access_prp_default = H5P_DEFAULT_F + if (present(access_prp)) access_prp_default = access_prp + namelen = LEN(dsetname) + hdferr = h5fmount_c(loc_id, dsetname, namelen, file_id, access_prp_default) + + END SUBROUTINE h5fmount_f + + + SUBROUTINE h5funmount_f(loc_id, dsetname, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for file or group + ! in which dsetname is defined + CHARACTER(LEN=*), INTENT(IN) :: dsetname ! Name of the dataset + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen ! Length of the dsetname character string + INTEGER, EXTERNAL :: h5funmount_c + + namelen = LEN(dsetname) + hdferr = h5funmount_c(loc_id, dsetname, namelen) + + END SUBROUTINE h5funmount_f + + SUBROUTINE h5fopen_f(name, access_flags, file_id, hdferr, & + access_prp) + + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file + INTEGER, INTENT(IN) :: access_flags ! File access flags + INTEGER(HID_T), INTENT(OUT) :: file_id ! File identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp + ! File access property list + ! identifier + INTEGER :: access_prp_default + INTEGER :: namelen ! Length of the name character string + INTEGER, EXTERNAL :: h5fopen_c + + access_prp_default = H5P_DEFAULT_F + if (present(access_prp)) access_prp_default = access_prp + namelen = LEN(name) + hdferr = h5fopen_c(name, namelen, access_flags, & + access_prp_default, file_id) + + END SUBROUTINE h5fopen_f + + SUBROUTINE h5freopen_f(file_id, ret_file_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier + INTEGER(HID_T), INTENT(OUT) :: ret_file_id ! New File identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5freopen_c + + hdferr = h5freopen_c(file_id, ret_file_id) + + END SUBROUTINE h5freopen_f + + SUBROUTINE h5fget_create_plist_f(file_id, prop_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier + INTEGER(HID_T), INTENT(OUT) :: prop_id ! File creation property + ! list identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5fget_create_plist_c + + hdferr = h5fget_create_plist_c(file_id, prop_id) + + END SUBROUTINE h5fget_create_plist_f + + SUBROUTINE h5fget_access_plist_f(file_id, access_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier + INTEGER(HID_T), INTENT(OUT) :: access_id ! File access property + ! list identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5fget_access_plist_c + + hdferr = h5fget_access_plist_c(file_id, access_id) + + END SUBROUTINE h5fget_access_plist_f + + + SUBROUTINE h5fis_hdf5_f(name, status, hdferr) + + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file + LOGICAL, INTENT(OUT) :: status ! Indicates if file + ! is an HDF5 file + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen ! Length of the name character string + INTEGER :: flag ! "TRUE/FALSE" flag from C routine + ! to define status value. + INTEGER, EXTERNAL :: h5fis_hdf5_c + + namelen = LEN(name) + hdferr = h5fis_hdf5_c(name, namelen, flag) + status = .TRUE. + if (flag .EQ. 0) status = .FALSE. + + END SUBROUTINE h5fis_hdf5_f + + SUBROUTINE h5fclose_f(file_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5fclose_c + + hdferr = h5fclose_c(file_id) + + END SUBROUTINE h5fclose_f + + END MODULE H5F diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c new file mode 100644 index 0000000..110db73 --- /dev/null +++ b/fortran/src/H5Gf.c @@ -0,0 +1,536 @@ +#include "H5f90.h" + +/*---------------------------------------------------------------------------- + * Name: h5gcreate_c + * Purpose: Call H5Gcreate to create a group + * Inputs: loc_id - file or group identifier + * name - name of the group + * namelen - name length + * size_hint - length of names in the group + * Outputs: grp_id - group identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 5, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5gcreate_c (hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + size_t c_size_hint; + hid_t c_grp_id; + hid_t c_loc_id; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + /* + * Call H5Gcreate function. + */ + c_loc_id = *loc_id; + if ( *size_hint == OBJECT_NAMELEN_DEFAULT_F ) + c_grp_id = H5Gcreate(c_loc_id, c_name, NULL); + else { + c_size_hint = *size_hint; + c_grp_id = H5Gcreate(c_loc_id, c_name, c_size_hint); + } + if (c_grp_id < 0) return ret_value; + *grp_id = (hid_t_f)c_grp_id; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5gopen_c + * Purpose: Call H5Gopen to open a dataset + * Inputs: loc_id - file or group identifier + * name - name of the group + * namelen - name length + * Outputs: grp_id - group identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 5, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5gopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *grp_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_grp_id; + hid_t c_loc_id; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Gopen function. + */ + c_loc_id = *loc_id; + c_grp_id = H5Gopen(c_loc_id, c_name); + + HDfree(c_name); + if (c_grp_id < 0) return ret_value; + *grp_id = (hid_t_f)c_grp_id; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5gget_obj_info_idx_c + * Purpose: Call H5Gget_obj_info to return name and the type of group + * member + * Inputs: loc_id - file or group identifier + * name - name of the group + * namelen - name length + * idx - index of the group member + * Outputs: obj_name - buffer to store member's name + * obj_namelen - length of the buffer + * obj_type - type of the object + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 5, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5gget_obj_info_idx_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type) +{ + int ret_value = -1; + hid_t c_loc_id; + char *c_name; + int c_namelen; + int c_obj_namelen; + char *c_obj_name = NULL; + int type; + int c_idx; + herr_t c_ret_value; + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Allocate buffer to hold name of the object + */ + if (*obj_namelen) c_obj_name = (char *)HDmalloc(*obj_namelen + 1); + if (c_obj_name == NULL) return ret_value; + /* + * Call H5Gget_obj_info_idx function. + */ + c_loc_id = *loc_id; + c_idx = *idx; + c_ret_value = H5Gget_obj_info_idx(c_loc_id, c_name, c_idx, &c_obj_name, &type); + + if (c_ret_value < 0) { + HDfree(c_obj_name); + return ret_value; + } + switch (type) { + case H5G_LINK: + *obj_type = H5G_LINK_F; + break; + + case H5G_GROUP: + *obj_type = H5G_GROUP_F; + break; + + case H5G_DATASET: + *obj_type = H5G_DATASET_F; + break; + + case H5G_TYPE: + *obj_type = H5G_TYPE_F; + break; + default: + return ret_value; + } + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + c_obj_namelen = *obj_namelen; + HDpackFstring(c_obj_name, _fcdtocp(obj_name), c_obj_namelen); + if (c_obj_name) HDfree(c_obj_name); + if (c_name) HDfree(c_name); + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5gn_members_c + * Purpose: Call H5Gn_members to find number of objects in the group + * Inputs: loc_id - file or group identifier + * name - name of the group + * namelen - name length + * Outputs: nmemebers - number of members + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 5, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5gn_members_c (hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers) +{ + int ret_value = -1; + hid_t c_loc_id; + char *c_name; + int c_namelen; + int c_nmembers; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Gn_members function. + */ + c_loc_id = *loc_id; + c_nmembers = H5Gn_members(c_loc_id, c_name); + + HDfree(c_name); + if (c_nmembers < 0) return ret_value; + *nmembers = (int_f)c_nmembers; + ret_value = 0; + return ret_value; +} +/*---------------------------------------------------------------------------- + * Name: h5gclose_c + * Purpose: Call H5Gclose to close the group + * Inputs: grp_id - identifier of the group to be closed + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 5, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5gclose_c ( hid_t_f *grp_id ) +{ + int ret_value = 0; + hid_t c_grp_id; + + c_grp_id = *grp_id; + if ( H5Gclose(c_grp_id) < 0 ) ret_value = -1; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5glink_c + * Purpose: Call H5Glink to link the specified type + * Inputs: loc_id - identifier of file or group + * link_type - link type + * current_name - name of the existing object for hard link, + * anything for the soft link + * current_namelen - current name lenghth + * new_name - new name for the object + * new_namelen - new_name lenghth + * Returns: 0 on success, -1 on failure + * Programmer: Mingshi Chen + * Friday, August 6, 1999 + * Modifications: Elena Pourmal + *---------------------------------------------------------------------------*/ + +int_f +nh5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name, int_f *new_namelen) +{ + int ret_value = -1; + hid_t c_loc_id; + H5G_link_t c_link_type; + char *c_current_name, *c_new_name; + int c_current_namelen, c_new_namelen; + herr_t c_ret_value; + /* + * Convert Fortran name to C name + */ + c_current_namelen =*current_namelen; + c_new_namelen =*new_namelen; + c_current_name = (char *)HD5f2cstring(current_name, c_current_namelen); + c_new_name = (char *)HD5f2cstring(new_name, c_new_namelen); + if((c_current_name == NULL)||(c_new_name == NULL)) + return ret_value; + /* + * Call H5Glink function + */ + c_loc_id = *loc_id; + c_link_type = (H5G_link_t)*link_type; + c_ret_value = H5Glink(c_loc_id, c_link_type, c_current_name, c_new_name); + if(c_current_name) HDfree(c_current_name); + if(c_new_name) HDfree(c_new_name); + if(c_ret_value < 0) return ret_value; + + ret_value = 0; + return ret_value ; +} + +/*---------------------------------------------------------------------------- + * Name: h5gunlink_c + * Purpose: Call H5Gunlink to remove the specified name + * Inputs: loc_id - identifier of file or group + * name - name of the object to unlink + * Returns: 0 on success, -1 on failure + * Programmer: Mingshi Chen + * Friday, August 6, 1999 + * Modifications: Elena Pourmal + *---------------------------------------------------------------------------*/ + +int_f +nh5gunlink_c(hid_t_f *loc_id, _fcd name, int_f *namelen) +{ + int ret_value = -1; + hid_t c_loc_id; + char *c_name; + int c_namelen; + herr_t c_ret_value; + /* + * Convert Fortran name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if(c_name == NULL) return ret_value; + /* + * Call H5Gunlink function + */ + c_loc_id = *loc_id; + c_ret_value = H5Gunlink(c_loc_id, c_name); + if(c_name) HDfree(c_name); + if(c_ret_value < 0) return ret_value; + ret_value = 0; + return ret_value ; +} + +/*---------------------------------------------------------------------------- + * Name: h5gmove_c + * Purpose: Call H5Gmove to rename an object within an HDF5 file + * Inputs: loc_id - identifier of file or group + * src_name - name of the original object + * src_namelen - original name lenghth + * dst_name - new name for the object + * dst_namelen - new name lenghth + * Returns: 0 on success, -1 on failure + * Programmer: Mingshi Chen + * Friday, August 6, 1999 + * Modifications: Elena Pourmal + *---------------------------------------------------------------------------*/ + +int_f +nh5gmove_c(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f*dst_namelen) +{ + int ret_value = -1; + hid_t c_loc_id; + char *c_src_name, *c_dst_name; + int c_src_namelen, c_dst_namelen; + herr_t c_ret_value; + /* + * Convert Fortran name to C name + */ + c_src_namelen = *src_namelen; + c_dst_namelen = *dst_namelen; + c_src_name = (char *)HD5f2cstring(src_name, c_src_namelen); + c_dst_name = (char *)HD5f2cstring(dst_name, c_dst_namelen); + if((c_src_name == NULL)||(c_dst_name == NULL)) + return ret_value; + /* + * Call H5Gmove function + */ + c_loc_id = *loc_id; + c_ret_value = H5Gmove(c_loc_id, c_src_name, c_dst_name); + if(c_src_name) HDfree(c_src_name); + if(c_dst_name) HDfree(c_dst_name); + if(c_ret_value < 0) return ret_value; + + ret_value = 0; + return ret_value ; +} + +/*---------------------------------------------------------------------------- + * Name: h5gget_linkval_c + * Purpose: Call H5Gget_linkval to return the name of object + * Inputs: loc_id - identifier of file or group + * name - name of the object that symbolic link points to + * namelen - the name lenghth + * size - lenghth of retrurned value + * Outputs: value - name to be returned + * Returns: 0 on success, -1 on failure + * Programmer: Mingshi Chen + * Friday, August 6, 1999 + * Modifications: Elena Pourmal + *---------------------------------------------------------------------------*/ + +int_f +nh5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value ) +{ + int ret_value = -1; + hid_t c_loc_id; + char *c_name; + int c_namelen; + char *c_value = NULL; + size_t c_size; + herr_t c_ret_value; + /* + * Convert Fortran name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if(c_name == NULL) return ret_value; + + /* + * Allocate buffer to hold name of the value + */ + if(*size) c_value = (char *)HDmalloc(*size); + if(c_value == NULL) { + HDfree(c_name); + return ret_value; + } + + /* + * Call H5Gget_linkval function + */ + + c_size = (size_t)*size; + c_loc_id = *loc_id; + c_ret_value = H5Gget_linkval(c_loc_id, c_name, c_size, c_value); + if(c_ret_value < 0) { + if(c_value) HDfree(c_value); + if(c_name) HDfree(c_name); + return ret_value; + } + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + HDpackFstring(c_value, _fcdtocp(value), (int)*size); + + if(c_value) HDfree(c_value); + if(c_name) HDfree(c_name); + + ret_value = 0; + return ret_value ; +} + +/*---------------------------------------------------------------------------- + * Name: h5gset_comment_c + * Purpose: Call H5Gset_comment to set comments for the specified object + * Inputs: loc_id - identifier of file or group + * name - name of object whose comment is to be set or reset + * namelen - the name lenghth + * comment - the new comment + * commentlen - new comment lenghth + * Returns: 0 on success, -1 on failure + * Programmer: Mingshi Chen + * Friday, August 6, 1999 + * Modifications: Elena Pourmal + *---------------------------------------------------------------------------*/ + +int_f +nh5gset_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f*commentlen) +{ + int ret_value = -1; + hid_t c_loc_id; + char *c_name, *c_comment; + int c_namelen, c_commentlen; + herr_t c_ret_value; + /* + * Convert Fortran name to C name + */ + c_namelen = *namelen; + c_commentlen =*commentlen; + c_name = (char *)HD5f2cstring(name, c_namelen); + c_comment = (char *)HD5f2cstring(comment, c_commentlen); + if((c_name == NULL)||(c_comment == NULL)) + return ret_value; + /* + * Call H5Gset_comment function + */ + c_loc_id = *loc_id; + c_ret_value = H5Gset_comment(c_loc_id, c_name, c_comment); + if(c_name) HDfree(c_name); + if(c_comment) HDfree(c_comment); + if(c_ret_value < 0) return ret_value; + + ret_value = 0; + return ret_value ; +} + + +/*---------------------------------------------------------------------------- + * Name: h5gget_comment_c + * Purpose: Call H5Gget_comment to retrieve comments for the specified object + * Inputs: loc_id - identifier of file or group + * name - name of object whose comment is to be set or reset + * namelen - the name lenghth + * bufsize - at most bufsize characters + * comment - the new comment + * Returns: 0 on success, -1 on failure + * Programmer: Mingshi Chen + * Friday, August 6, 1999 + * Modifications: Elena Pourmal + *---------------------------------------------------------------------------*/ + +int_f +nh5gget_comment_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment) +{ + int ret_value = -1; + hid_t c_loc_id; + char *c_name; + int c_namelen; + char *c_comment = NULL; + size_t c_bufsize; + herr_t c_ret_value; + + /* + * Convert Fortran name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if(c_name == NULL) return ret_value; + + /* + * Allocate buffer to hold the comment + */ + c_bufsize = (size_t)*bufsize; + if(c_bufsize) c_comment = (char *)malloc(c_bufsize); + if(c_comment == NULL) { + HDfree(c_name); + return ret_value; + } + + /* + * Call H5Gget_comment function + */ + c_loc_id = *loc_id; + c_ret_value = H5Gget_comment(c_loc_id, c_name, c_bufsize, c_comment); + if(c_ret_value < 0) { + HDfree(c_name); + HDfree(c_comment); + return ret_value; + } + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + HDpackFstring(c_comment, _fcdtocp(comment), (int)*bufsize); + + if(c_name) HDfree(c_name); + if(c_comment) HDfree(c_comment); + + ret_value = 0; + return ret_value ; +} diff --git a/fortran/src/H5Gff.f90 b/fortran/src/H5Gff.f90 new file mode 100644 index 0000000..de6a8f0 --- /dev/null +++ b/fortran/src/H5Gff.f90 @@ -0,0 +1,234 @@ +! +! This file contains Fortran90 interfaces for H5F functions. +! + MODULE H5G + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + CONTAINS + + !!!============================================================ + + SUBROUTINE h5gcreate_f(loc_id, name, grp_id, hdferr, size_hint) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the group + INTEGER(HID_T), INTENT(OUT) :: grp_id ! Group identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(SIZE_T), OPTIONAL, INTENT(IN) :: size_hint + ! Parameter indicating + ! the number of bytes + ! to reserve for the + ! names that will appear + ! in the group + INTEGER :: namelen ! Length of the name character string + INTEGER(SIZE_T) :: size_hint_default + INTEGER, EXTERNAL :: h5gcreate_c + size_hint_default = OBJECT_NAMELEN_DEFAULT_F + if (present(size_hint)) size_hint_default = size_hint + namelen = LEN(name) + hdferr = h5gcreate_c(loc_id, name, namelen, size_hint_default, & + grp_id) + + END SUBROUTINE h5gcreate_f + + !!!============================================================ + + SUBROUTINE h5gopen_f(loc_id, name, grp_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the group + INTEGER(HID_T), INTENT(OUT) :: grp_id ! File identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Length of the name character string + INTEGER, EXTERNAL :: h5gopen_c + + namelen = LEN(name) + hdferr = h5gopen_c(loc_id, name, namelen, grp_id) + + END SUBROUTINE h5gopen_f + + !!!============================================================ + + SUBROUTINE h5gclose_f(grp_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: grp_id ! Group identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5gclose_c + + hdferr = h5gclose_c(grp_id) + + END SUBROUTINE h5gclose_f + + !!!============================================================ + + SUBROUTINE h5gget_obj_info_idx_f(loc_id, name, idx, & + obj_name, obj_type, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the group + INTEGER, INTENT(IN) :: idx ! Index of member object + CHARACTER(LEN=*), INTENT(OUT) :: obj_name ! Name of the object + INTEGER, INTENT(OUT) :: obj_type ! Object type + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Length of the name character string + INTEGER :: obj_namelen ! Length of the obj_name character string + INTEGER, EXTERNAL :: h5gget_obj_info_idx_c + + namelen = LEN(name) + obj_namelen = LEN(obj_name) + hdferr = h5gget_obj_info_idx_c(loc_id, name, namelen, idx, & + obj_name, obj_namelen, obj_type) + + END SUBROUTINE h5gget_obj_info_idx_f + + !!!============================================================ + + SUBROUTINE h5gn_members_f(loc_id, name, nmembers, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the group + INTEGER, INTENT(OUT) :: nmembers ! Number of members in the + ! group + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Length of the name character string + INTEGER, EXTERNAL :: h5gn_members_c + + namelen = LEN(name) + hdferr = h5gn_members_c(loc_id, name, namelen, nmembers) + + END SUBROUTINE h5gn_members_f + + !!!============================================================ + + SUBROUTINE h5glink_f(loc_id, link_type, current_name, & + new_name, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + INTEGER, INTENT(IN) :: link_type ! link type + ! Possible values are: + ! H5G_LINK_HARD_F (0) or + ! H5G_LINK_SOFT_F (1) + + CHARACTER(LEN=*), INTENT(IN) :: current_name + ! Current name of an object + CHARACTER(LEN=*), INTENT(IN) :: new_name ! New name of an object + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: current_namelen ! Lenghth of the current_name string + INTEGER :: new_namelen ! Lenghth of the new_name string + INTEGER, EXTERNAL :: h5glink_c + + current_namelen = LEN(current_name) + new_namelen = LEN(new_name) + hdferr = h5glink_c(loc_id, link_type, current_name, & + current_namelen, new_name, new_namelen) + END SUBROUTINE h5glink_f + + !!!============================================================ + + SUBROUTINE h5gunlink_f(loc_id, name, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of an object + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Lenghth of the name character string + + INTEGER, EXTERNAL :: h5gunlink_c + + namelen = LEN(name) + hdferr = h5gunlink_c(loc_id, name, namelen) + END SUBROUTINE h5gunlink_f + + !!!============================================================ + + SUBROUTINE h5gmove_f(loc_id, name, new_name, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Current name of an object + CHARACTER(LEN=*), INTENT(IN) :: new_name ! New name of an object + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Lenghth of the current_name string + INTEGER :: new_namelen ! Lenghth of the new_name string + INTEGER, EXTERNAL :: h5gmove_c + + namelen = LEN(name) + new_namelen = LEN(new_name) + hdferr = h5gmove_c(loc_id, name, namelen, new_name, new_namelen) + END SUBROUTINE h5gmove_f + + !!!============================================================ + + SUBROUTINE h5gget_linkval_f(loc_id, name, size, buffer, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Current name of an object + INTEGER(SIZE_T), INTENT(IN) :: size ! Maximum number of buffer + CHARACTER(LEN=size), INTENT(OUT) :: buffer + ! Buffer to hold a name of + ! the object symbolic link + ! points to + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Lenghth of the current_name string + INTEGER, EXTERNAL :: h5gget_linkval_c + + namelen = LEN(name) + hdferr = h5gget_linkval_c(loc_id, name, namelen, size, buffer) + END SUBROUTINE h5gget_linkval_f + + !!!============================================================ + + SUBROUTINE h5gset_comment_f(loc_id, name, comment, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Current name of an object + CHARACTER(LEN=*), INTENT(IN) :: comment ! New name of an object + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Lenghth of the current_name string + INTEGER :: commentlen ! Lenghth of the comment string + INTEGER, EXTERNAL :: h5gset_comment_c + + namelen = LEN(name) + commentlen = LEN(comment) + hdferr = h5gset_comment_c(loc_id, name, namelen, comment, commentlen) + END SUBROUTINE h5gset_comment_f + + !!!============================================================ + + SUBROUTINE h5gget_comment_f(loc_id, name, size, buffer, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Current name of an object + INTEGER(SIZE_T), INTENT(IN) :: size ! Maximum number of buffer + CHARACTER(LEN=size), INTENT(OUT) :: buffer + ! Buffer to hold a comment + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Lenghth of the current_name string + INTEGER, EXTERNAL :: h5gget_comment_c + + namelen = LEN(name) + hdferr = h5gget_comment_c(loc_id, name, namelen, size, buffer) + END SUBROUTINE h5gget_comment_f + + !!!============================================================ + + END MODULE H5G diff --git a/fortran/src/H5Git.c b/fortran/src/H5Git.c new file mode 100644 index 0000000..51db86f --- /dev/null +++ b/fortran/src/H5Git.c @@ -0,0 +1,220 @@ +/*------------------------------------------------------------------------- + * Copyright (C) 1999 National Center for Supercomputing Applications. + * All rights reserved. + * + *------------------------------------------------------------------------- + */ + +#include +#include "H5Git.h" +#define FALSE 0 + +herr_t count_elems(hid_t loc_id, const char *name, void *opdata); +/*herr_t obj_info(hid_t loc_id, const char *name, void *opdata);*/ +herr_t obj_info(hid_t loc_id, char *name, void *opdata); + +typedef struct retval { + char * name; + int type; +} retval_t; + + +/*------------------------------------------------------------------------- + * Function: H5Gn_members + * + * Purpose: Return the number of members of a group. The "members" + * are the datasets, groups, and named datatypes in the + * group. + * + * This function wraps the H5Ginterate() function in + * a completely obvious way, uses the operator + * function 'count_members()' below; + * + * See also: H5Giterate() + * + * IN: hid_t file: the file id + * IN: char *group_name: the name of the group + * + * Errors: + * + * Return: Success: The object number of members of + * the group. + * + * Failure: FAIL + * + * Programmer: REMcG + * Monday, Aug 2, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +H5Gn_members( hid_t loc_id, char *group_name ) +{ + int res; + int nelems = 0; + + res = H5Giterate(loc_id, group_name, NULL, count_elems, (void *)&nelems); + if (res < 0) { + return res; + } else { + return( nelems ); + } +} + + + +/*------------------------------------------------------------------------- + * Function: H5Gget_obj_info_idx + * + * Purpose: Return the name and type of the member of the group + * at index 'idx', as defined by the H5Giterator() + * function. + * + * This function wraps the H5Ginterate() function in + * a completely obvious way, uses the operator + * function 'get_objinfo()' below; + * + * See also: H5Giterate() + * + * IN: hid_t file: the file id + * IN: char *group_name: the name of the group + * IN: int idx: the index of the member object (see + * H5Giterate() + * OUT: char **objname: the name of the member object + * OUT: int *type: the type of the object (dataset, + * group, or named datatype) + * + * Errors: + * + * Return: Success: The object number of members of + * the group. + * + * Failure: FAIL + * + * Programmer: REMcG + * Monday, Aug 2, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Gget_obj_info_idx( hid_t loc_id, char *group_name, int idx, char **objname, int *type ) +{ + int res; + retval_t retVal; + + res = H5Giterate(loc_id, group_name, &idx, obj_info, (void *)&retVal); + if (res < 0) { + return res; + } + *objname = retVal.name; + *type = retVal.type; + return 0; +} + + + +/*------------------------------------------------------------------------- + * Function: count_elems + * + * Purpose: this is the operator function called by H5Gn_members(). + * + * This function is passed to H5Ginterate(). + * + * See also: H5Giterate() + * + * OUT: 'opdata' is returned as an integer with the + * number of members in the group. + * + * Errors: + * + * Return: Success: The object number of members of + * the group. + * + * Failure: FAIL + * + * Programmer: REMcG + * Monday, Aug 2, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +static herr_t +count_elems(hid_t loc_id, const char *name, void *opdata) +{ + herr_t res; + H5G_stat_t statbuf; + + res = H5Gget_objinfo(loc_id, name, FALSE, &statbuf); + if (res < 0) { + return 1; + } + switch (statbuf.type) { + case H5G_GROUP: + (*(int *)opdata)++; + break; + case H5G_DATASET: + (*(int *)opdata)++; + break; + case H5G_TYPE: + (*(int *)opdata)++; + break; + default: + (*(int *)opdata)++; /* ???? count links or no? */ + break; + } + return 0; + } + + +/*------------------------------------------------------------------------- + * Function: obj_info + * + * Purpose: this is the operator function called by H5Gn_members(). + * + * This function is passed to H5Ginterate(). + * + * See also: H5Giterate() + * + * OUT: 'opdata' is returned as a 'recvar_t', containing + * the object name and type. + * + * Errors: + * + * Return: Success: The object number of members of + * the group. + * + * Failure: FAIL + * + * Programmer: REMcG + * Monday, Aug 2, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + * group, or named datatype) + */ +static herr_t +/*obj_info(hid_t loc_id, const char *name, void *opdata)*/ +obj_info(hid_t loc_id, char *name, void *opdata) +{ + herr_t res; + H5G_stat_t statbuf; + + res = H5Gget_objinfo(loc_id, name, FALSE, &statbuf); + if (res < 0) { + ((retval_t *)opdata)->type = 0; + ((retval_t *)opdata)->name = NULL; + return 1; + } else { + ((retval_t *)opdata)->type = statbuf.type; +/* ((retval_t *)opdata)->name = strdup(name); */ + ((retval_t *)opdata)->name = name; + return 1; + } + } diff --git a/fortran/src/H5Git.h b/fortran/src/H5Git.h new file mode 100644 index 0000000..e243a18 --- /dev/null +++ b/fortran/src/H5Git.h @@ -0,0 +1,16 @@ +/*------------------------------------------------------------------------- + * Copyright (C) 1997 National Center for Supercomputing Applications. + * All rights reserved. + * + *------------------------------------------------------------------------- + */ +#ifndef _H5Git_H +#define _H5Git_H + +#include + +int H5Gn_members( hid_t loc_id, char *group_name ); + +herr_t H5Gget_obj_info_idx( hid_t loc_id, char *group_name, int idx, char **objname, int *type ); + +#endif /*_H5Git_H*/ diff --git a/fortran/src/H5If.c b/fortran/src/H5If.c new file mode 100644 index 0000000..f17dc01 --- /dev/null +++ b/fortran/src/H5If.c @@ -0,0 +1,29 @@ +#include "H5f90.h" + +/*---------------------------------------------------------------------------- + * Name: h5iget_type_c + * Purpose: Call H5Iget_type to get the type of an object + * Inputs: obj_id - object identifier + * Outputs: type - object type + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Thursday, March 24, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5iget_type_c (hid_t_f *obj_id, int_f *type) +{ + int ret_value = -1; + hid_t c_obj_id; + H5I_type_t c_type; + + /* + * Call H5Iget_type function. + */ + c_obj_id = *obj_id; + c_type = H5Iget_type(c_obj_id); + if (c_type == H5I_BADID) return ret_value; + *type = (int_f)c_type; + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5Iff.f90 b/fortran/src/H5Iff.f90 new file mode 100644 index 0000000..cd50da3 --- /dev/null +++ b/fortran/src/H5Iff.f90 @@ -0,0 +1,33 @@ +! +! This file contains FORTRAN90 interfaces for H5I functions +! + MODULE H5I + + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + CONTAINS + + SUBROUTINE h5iget_type_f(obj_id, type, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id !Object identifier + INTEGER, INTENT(OUT) :: type !type of an object. + !possible values are: + !H5I_FILE_F(1) + !H5I_GROUP_F(2) + !H5I_DATATYPE_F(3) + !H5I_DATASPACE_F(4) + !H5I_DATASET_F(5) + !H5I_ATTR_F(6) + !H5I_BADID_F(-1) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5iget_type_c + hdferr = h5iget_type_c(obj_id, type) + END SUBROUTINE h5iget_type_f + + END MODULE H5I + + + + + diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c new file mode 100644 index 0000000..038e083 --- /dev/null +++ b/fortran/src/H5Pf.c @@ -0,0 +1,1748 @@ +#include "H5f90.h" + + +/*---------------------------------------------------------------------------- + * Name: h5pcreate_c + * Purpose: Call H5Pcreate to create a property list + * Inputs: classtype - type of the property list + * Outputs: prp_id - identifier of the created property list + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pcreate_c ( int_f *classtype, hid_t_f *prp_id ) +{ + H5P_class_t c_classtype; + int CASE; + int ret_value = 0; + hid_t c_prp_id; + CASE = (int)*classtype; + + switch (CASE) { + + case (H5P_FILE_CREATE_F): + c_classtype = H5P_FILE_CREATE; + break; + + case(H5P_FILE_ACCESS_F): + c_classtype = H5P_FILE_ACCESS; + break; + + case(H5P_DATASET_CREATE_F): + c_classtype = H5P_DATASET_CREATE; + break; + + case(H5P_DATASET_XFER_F): + c_classtype = H5P_DATASET_XFER; + break; + + case(H5P_MOUNT_F): + c_classtype = H5P_MOUNT; + break; + + default: + ret_value = -1; + return ret_value; + } + c_prp_id = H5Pcreate(c_classtype); + + if ( c_prp_id < 0 ) ret_value = -1; + *prp_id = (hid_t_f)c_prp_id; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pclose_c + * Purpose: Call H5Pclose to close property lis + * Inputs: prp_id - identifier of the property list to be closed + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pclose_c ( hid_t_f *prp_id ) +{ + int ret_value = 0; + hid_t c_prp_id; + + c_prp_id = *prp_id; + if ( H5Pclose(c_prp_id) < 0 ) ret_value = -1; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5pcopy_c + * Purpose: Call H5Pcopy to copy property list + * Inputs: prp_id - identifier of the property list to be copied + * Outputs: new_prp_id - identifier of the new property list + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id) +{ + int ret_value = 0; + hid_t c_prp_id; + hid_t c_new_prp_id; + + c_prp_id = *prp_id; + c_new_prp_id = H5Tcopy(c_prp_id); + if ( c_new_prp_id < 0 ) ret_value = -1; + *new_prp_id = (hid_t_f)c_new_prp_id; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5pget_class_c + * Purpose: Call H5Pget_class to determine property list class + * Inputs: prp_id - identifier of the dataspace + * Outputs: classtype - class type; possible values are: + * H5P_NO_CLASS_F -1 + * H5P_FILE_CREATE_F 0 + * H5P_FILE_ACCESS_F 1 + * H5P_DATASET_CREATE_F 2 + * H5P_DATASET_XFER_F 3 + * H5P_MOUNT_F 4 + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pget_class_c ( hid_t_f *prp_id , int_f *classtype) +{ + int ret_value = 0; + hid_t c_prp_id; + H5P_class_t c_classtype; + + c_prp_id = *prp_id; + c_classtype = H5Pget_class(c_prp_id); + if (c_classtype == H5P_NO_CLASS ) { + *classtype = H5P_NO_CLASS_F; + ret_value = -1; + return ret_value; + } + if (c_classtype == H5P_FILE_CREATE) *classtype = H5P_FILE_CREATE_F; + if (c_classtype == H5P_FILE_ACCESS) *classtype = H5P_FILE_ACCESS_F; + if (c_classtype == H5P_DATASET_CREATE) *classtype = H5P_DATASET_CREATE_F; + if (c_classtype == H5P_DATASET_XFER) *classtype = H5P_DATASET_XFER_F; + if (c_classtype == H5P_MOUNT_F) *classtype = H5P_MOUNT_F; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_preserve_c + * Purpose: Call H5Pset_preserve to set transfer property for compound + * datatype + * Inputs: prp_id - property list identifier + * flag - TRUE/FALSE flag + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, February 17, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pset_preserve_c ( hid_t_f *prp_id , int_f *flag) +{ + int ret_value = 0; + hid_t c_prp_id; + herr_t status; + hbool_t c_flag = 0; + + if (*flag > 0) c_flag = 1; + c_prp_id = *prp_id; + status = H5Pset_preserve(c_prp_id, c_flag); + if ( status < 0 ) ret_value = -1; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5pget_preserve_c + * Purpose: Call H5Pget_preserve to set transfer property for compound + * datatype + * Inputs: prp_id - property list identifier + * Outputs: flag - TRUE/FALSE flag + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, February 17, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pget_preserve_c ( hid_t_f *prp_id , int_f *flag) +{ + int ret_value = 0; + hid_t c_prp_id; + herr_t status; + int c_flag; + + c_prp_id = *prp_id; + c_flag = H5Pget_preserve(c_prp_id); + if ( c_flag < 0 ) ret_value = -1; + *flag = (int_f)c_flag; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_deflate_c + * Purpose: Call H5Pset_deflate to set deflate level + * Inputs: prp_id - property list identifier + * level - level of deflation + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pset_deflate_c ( hid_t_f *prp_id , int_f *level) +{ + int ret_value = 0; + hid_t c_prp_id; + int c_level; + herr_t status; + + c_prp_id = *prp_id; + c_level = *level; + status = H5Pset_deflate(c_prp_id, c_level); + if ( status < 0 ) ret_value = -1; + return ret_value; +} + + + +/*---------------------------------------------------------------------------- + * Name: h5pset_chunk_c + * Purpose: Call H5Pset_chunk to set the sizes of chunks for a chunked + * layout dataset + * Inputs: prp_id - property list identifier + * rank - number of dimensions of each chunk + * dims - array of the size of each chunk + * Returns: 0 on success, -1 on failure + * Saturday, August 14, 1999 + * Programmer: Elena Pourmal + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pset_chunk_c ( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims ) +{ + int ret_value = -1; + hid_t c_prp_id; + int c_rank; + hsize_t *c_dims; + herr_t status; + int i; + + c_dims = malloc(sizeof(hsize_t) * (*rank )); + if (!c_dims) return ret_value; + + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + for (i = 0; i < *rank ; i++) { + c_dims[i] = dims[*rank - i - 1]; + } + + c_prp_id = *prp_id; + c_rank = *rank; + status = H5Pset_chunk(c_prp_id, c_rank, c_dims); + if (status < 0) return ret_value; + ret_value = 0; + HDfree (c_dims); + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5pget_chunk_c + * Purpose: Call H5Pget_chunk to get the sizes of chunks for a chunked + * layout dataset for at list max_rank number of dimensions + * Inputs: prp_id - property list identifier + * max rank - maximum number of dimensions to return + * dims - array of the size of each chunk + * Returns: number of chunk's dimnesion on success, -1 on failure + * Saturday, August 14, 1999 + * Programmer: Elena Pourmal + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims ) +{ + int ret_value = -1; + hid_t c_prp_id; + hsize_t *c_dims; + int rank; + int c_max_rank; + int i; + + c_dims = malloc(sizeof(hsize_t) * (*max_rank )); + if (!c_dims) return ret_value; + + c_prp_id = *prp_id; + c_max_rank = *max_rank; + rank = H5Pget_chunk(c_prp_id, c_max_rank, c_dims); + + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + for (i = 0; i < *max_rank ; i++) { + dims[*max_rank - i - 1] = c_dims[i]; + } + HDfree (c_dims); + if (rank < 0) return ret_value; + ret_value = (int_f)rank; + return ret_value; +} + + + +/*---------------------------------------------------------------------------- + * Name: h5pset_fill_valuec_c + * Purpose: Call h5pset_fill_value_c to a character fill value + * Inputs: prp_id - property list identifier + * type_id - datatype identifier (fill value is of type type_id) + * fillvalue - character value + * Returns: 0 on success, -1 on failure + * Saturday, August 14, 1999 + * Programmer: Elena Pourmal + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue) +{ + int ret_value = -1; + + /* + * Call h5pset_fill_value_c function. + */ + ret_value = nh5pset_fill_value_c(prp_id, type_id, _fcdtocp(fillvalue)); + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_fill_value_c + * Purpose: Call H5Pset_fill_value to set a fillvalue for a dataset + * Inputs: prp_id - property list identifier + * type_id - datatype identifier (fill value is of type type_id) + * fillvalue - fillvalue + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue) +{ + int ret_value = -1; + hid_t c_prp_id; + hid_t c_type_id; + herr_t ret; + + /* + * Call H5Pset_fill_value function. + */ + c_prp_id = *prp_id; + c_type_id = *type_id; + ret = H5Pset_fill_value(c_prp_id, c_type_id, fillvalue); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5pget_fill_valuec_c + * Purpose: Call h5pget_fill_value_c to a character fill value + * Inputs: prp_id - property list identifier + * type_id - datatype identifier (fill value is of type type_id) + * fillvalue - character value + * Returns: 0 on success, -1 on failure + * Saturday, August 14, 1999 + * Programmer: Elena Pourmal + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue) +{ + int ret_value = -1; + + /* + * Call h5pget_fill_value_c function. + */ + ret_value = nh5pset_fill_value_c(prp_id, type_id, _fcdtocp(fillvalue)); + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_fill_value_c + * Purpose: Call H5Pget_fill_value to set a fillvalue for a dataset + * Inputs: prp_id - property list identifier + * type_id - datatype identifier (fill value is of type type_id) + * fillvalue - fillvalue + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue) +{ + int ret_value = -1; + hid_t c_prp_id; + hid_t c_type_id; + herr_t ret; + + /* + * Call H5Pget_fill_value function. + */ + c_prp_id = *prp_id; + c_type_id = *type_id; + ret = H5Pget_fill_value(c_prp_id, c_type_id, fillvalue); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_version_c + * Purpose: Call H5Pget_version to get the version information + * of various objects for a file creation property list + * Inputs: prp_id - property list identifier + * Outputs: boot - array to put boot block version number + * freelist - array to put global freelist version number + * stab - array to put symbol table version number + * shhdr - array to put shared object header version number + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: Removed extra length parameters EP 7/6/00 + *---------------------------------------------------------------------------*/ +int_f +nh5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr) +{ + int ret_value = -1; + hid_t c_prp_id; + int i; + herr_t ret; + int c_boot; + int c_freelist; + int c_stab; + int c_shhdr; + + /* + * Call H5Pget_version function. + */ + c_prp_id = *prp_id; + ret = H5Pget_version(c_prp_id, &c_boot, &c_freelist, &c_stab, &c_shhdr); + *boot = (int_f)c_boot; + *freelist = (int_f)c_freelist; + *stab = (int_f)c_stab; + *shhdr = (int_f)c_shhdr; + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_userblock_c + * Purpose: Call H5Pget_userblock to get the size of a user block in + * a file creation property list + * Inputs: prp_id - property list identifier + * Outputs size - Size of the user-block in bytes + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_userblock_c (hid_t_f *prp_id, hsize_t_f * size) +{ + int ret_value = -1; + hid_t c_prp_id; + int i; + herr_t ret; + hsize_t c_size; + + /* + * Call H5Pget_userblock function. + */ + c_prp_id = *prp_id; + ret = H5Pget_userblock(c_prp_id, &c_size); + + *size = (hsize_t_f)c_size; + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_userblock_c + * Purpose: Call H5Pset_userblock to set the size of a user block in + * a file creation property list + * Inputs: prp_id - property list identifier + * size - Size of the user-block in bytes + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_userblock_c (hid_t_f *prp_id, hsize_t_f * size) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + hsize_t c_size; + c_size = (hsize_t)*size; + + /* + * Call H5Pset_userblock function. + */ + c_prp_id = *prp_id; + ret = H5Pset_userblock(c_prp_id, c_size); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_sizes_c + * Purpose: Call H5Pget_sizes to get the size of the offsets + * and lengths used in an HDF5 file + * Inputs: prp_id - property list identifier + * Outputs sizeof_addr - Size of an object offset in bytes + * sizeof_size - Size of an object length in bytes + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: Deleted extra length parameters. EP 6/7/00 + *---------------------------------------------------------------------------*/ +int_f +nh5pget_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size) +{ + int ret_value = -1; + hid_t c_prp_id; + int i; + herr_t ret; + size_t c_sizeof_addr; + size_t c_sizeof_size; + + /* + * Call H5Pget_sizes function. + */ + c_prp_id = *prp_id; + ret = H5Pget_sizes(c_prp_id, &c_sizeof_addr, &c_sizeof_size); + + *sizeof_addr = (size_t_f)c_sizeof_addr; + *sizeof_size = (size_t_f)c_sizeof_size; + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_sizes_c + * Purpose: Call H5Pset_sizes to set the size of the offsets + * Inputs: prp_id - property list identifier + * sizeof_addr - Size of an object offset in bytes + * sizeof_size - Size of an object length in bytes + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + size_t c_addr, c_size; + c_addr = (size_t)*sizeof_addr; + c_size = (size_t)*sizeof_size; + + /* + * Call H5Pset_sizes function. + */ + c_prp_id = *prp_id; + ret = H5Pset_sizes(c_prp_id, c_addr, c_size); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_sym_k_c + * Purpose: Call H5Pset_sym_k to set the size of parameters used + * to control the symbol table node + * Inputs: prp_id - property list identifier + * ik - Symbol table tree rank + * lk - Symbol table node size + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk) +{ + int ret_value = -1; + hid_t c_prp_id; + int c_ik; + int c_lk; + herr_t ret; + + /* + * Call H5Pset_sym_k function. + */ + c_prp_id = *prp_id; + c_ik = *ik; + c_lk = *lk; + ret = H5Pset_sym_k(c_prp_id, c_ik, c_lk); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_sym_k_c + * Purpose: Call H5Pget_sym_k to get the size of parameters used + * to control the symbol table node + * Inputs: prp_id - property list identifier + * Outputs: ik - Symbol table tree rank + * lk - Symbol table node size + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk) +{ + int ret_value = -1; + hid_t c_prp_id; + int i; + herr_t ret; + int c_ik; + int c_lk; + + /* + * Call H5Pget_sym_k function. + */ + c_prp_id = *prp_id; + ret = H5Pget_sym_k(c_prp_id, &c_ik, &c_lk); + *ik = (int_f)c_ik; + *lk = (int_f)c_lk; + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_istore_k_c + * Purpose: Call H5Pset_istore_k to set the size of the parameter + * used to control the B-trees for indexing chunked datasets + * Inputs: prp_id - property list identifier + * ik - Symbol table tree rank + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_istore_k_c (hid_t_f *prp_id, int_f* ik) +{ + int ret_value = -1; + hid_t c_prp_id; + int c_ik; + herr_t ret; + + /* + * Call H5Pset_istore_k function. + */ + c_prp_id = *prp_id; + c_ik = *ik; + ret = H5Pset_istore_k(c_prp_id, c_ik); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_istore_k_c + * Purpose: Call H5Pget_istore_k to get the size of parameters used + * to control the B-trees for indexing chunked datasets + * Inputs: prp_id - property list identifier + * Outputs: ik - Symbol table tree rank + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_istore_k_c (hid_t_f *prp_id, int_f* ik) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + int c_ik; + + /* + * Call H5Pget_istore_k function. + */ + c_prp_id = *prp_id; + ret = H5Pget_istore_k(c_prp_id, &c_ik); + *ik = (int_f)c_ik; + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_driver_c + * Purpose: Call H5Pget_driver to get low-level file driver identifier + * Inputs: prp_id - property list identifier + * Outputs: driver - low-level file driver identifier + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_driver_c (hid_t_f *prp_id, int_f* driver) +{ + int ret_value = -1; + hid_t c_prp_id; + H5F_driver_t c_driver; + + /* + * Call H5Pget_driver function. + */ + c_prp_id = *prp_id; + c_driver = H5Pget_driver(c_prp_id); + *driver = (int_f) c_driver; + if (c_driver < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_stdio_c + * Purpose: Call H5Pset_stdio to set the low level file driver to + * use the functions declared in the stdio.h + * Inputs: prp_id - property list identifier + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_stdio_c (hid_t_f *prp_id) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + /* + * Call H5Pset_stdio function. + */ + c_prp_id = *prp_id; + ret = H5Pset_stdio(c_prp_id); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_stdio_c + * Purpose: Call H5Pget_stdio to determine whther the low level file driver + * uses the functions declared in the stdio.h + * Inputs: prp_id - property list identifier + * Outputs: io - value indicates whether the file driver uses + * the functions declared in the stdio.h + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_stdio_c (hid_t_f *prp_id, int_f* io) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + /* + * Call H5Pget_stdio function. + */ + c_prp_id = *prp_id; + ret = H5Pget_stdio(c_prp_id); + if (ret < 0) return ret_value; + *io = (int_f)ret; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_sec2_c + * Purpose: Call H5Pset_sec2 to set the low level file driver to + * use the functions declared in the unistd.h + * Inputs: prp_id - property list identifier + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_sec2_c (hid_t_f *prp_id) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + /* + * Call H5Pset_sec2 function. + */ + c_prp_id = *prp_id; + ret = H5Pset_sec2(c_prp_id); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_sec2_c + * Purpose: Call H5Pget_stdio to determine whther the low level file driver + * uses the functions declared in the unistd.h + * Inputs: prp_id - property list identifier + * Outputs: sec2 - value indicates whether the file driver uses + * the functions declared in the unistd.h + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_sec2_c (hid_t_f *prp_id, int_f* sec2) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + /* + * Call H5Pget_sec2 function. + */ + c_prp_id = *prp_id; + ret = H5Pget_sec2(c_prp_id); + if (ret < 0) return ret_value; + *sec2 = (int_f)ret; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_alignment_c + * Purpose: Call H5Pset_alignment to set alignment properties of + * a file access property list + * Inputs: prp_id - property list identifier + * threshold - Threshold value + * alignment - Alignment value + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_alignment_c (hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + hsize_t c_threshold, c_alignment; + c_threshold = *threshold; + c_alignment = * alignment; + /* + * Call H5Pset_alignment function. + */ + c_prp_id = *prp_id; + ret = H5Pset_alignment(c_prp_id, c_threshold, c_alignment); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_alignment_c + * Purpose: Call H5Pget_alignment to get alignment properties of + * a file access property list + * Inputs: prp_id - property list identifier + * threshold - Threshold value + * alignment - Alignment value + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_alignment_c (hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + hsize_t c_threshold, c_alignment; + /* + * Call H5Pget_alignment function. + */ + c_prp_id = *prp_id; + ret = H5Pget_alignment(c_prp_id, &c_threshold, &c_alignment); + if (ret < 0) return ret_value; + *threshold = (hsize_t_f)c_threshold; + *alignment = (hsize_t_f)c_alignment; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_core_c + * Purpose: Call H5Pset_core to set the low-level file driver + * to use malloc() and free() + * Inputs: prp_id - property list identifier + * increment - File block size in bytes + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_core_c (hid_t_f *prp_id, size_t_f* increment) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + size_t c_increment; + c_increment = (size_t)*increment; + /* + * Call H5Pset_core function. + */ + c_prp_id = *prp_id; + ret = H5Pset_core(c_prp_id, c_increment); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_core_c + * Purpose: Call H5Pget_core to determine whether the file access + * property list is set to the core drive + * Inputs: prp_id - property list identifier + * Outputs increment - File block size in bytes + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_core_c (hid_t_f *prp_id, size_t_f* increment) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + size_t c_increment; + /* + * Call H5Pset_increment function. + */ + c_prp_id = *prp_id; + ret = H5Pget_core(c_prp_id, &c_increment); + if (ret < 0) return ret_value; + *increment = (size_t_f)c_increment; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_family_c + * Purpose: Call H5Pset_family to set the file access properties list + * to the family driver + * Inputs: prp_id - property list identifier + * memb_size - Logical size, in bytes, of each family member. + * memb_plist - Identifier of the file access property list + * for each member of the family + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + hsize_t c_memb_size; + hid_t c_memb_plist; + c_memb_size =(hsize_t) *memb_size; + c_memb_plist =(hsize_t) *memb_plist; + /* + * Call H5Pset_family function. + */ + c_prp_id = *prp_id; + ret = H5Pset_family(c_prp_id, c_memb_size, c_memb_plist); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_family_c + * Purpose: Call H5Pget_family to determine whether the file access + * property list is set to the family driver + * Inputs: prp_id - property list identifier + * memb_size - Logical size, in bytes, of each family member. + * memb_plist - Identifier of the file access property list + * for each member of the family + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + hsize_t c_memb_size; + hid_t c_memb_plist; + /* + * Call H5Pget_family function. + */ + c_prp_id = *prp_id; + ret = H5Pget_family(c_prp_id, &c_memb_size, &c_memb_plist); + if (ret < 0) return ret_value; + *memb_size = (hsize_t_f)c_memb_size; + *memb_plist = (hsize_t_f)c_memb_plist; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_cache_c + * Purpose: Call H5Pset_cache to set he number of elements in + * the meta data cache and the total number of bytes in + * the raw data chunk cache + * Inputs: prp_id - property list identifier + * mdc_nelmts - Number of elements (objects) in the + * meta data cache + * rdcc_nbytes - Total size of the raw data chunk cache, in bytes + * rdcc_w0 - Preemption policy + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: Changed the type of the rdcc_w0 parameter to be real_f EP 7/7/00 + * instead of double + *---------------------------------------------------------------------------*/ +int_f +nh5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_f* rdcc_nbytes , real_f* rdcc_w0 ) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + int c_mdc_nelmts; + int c_rdcc_nelmts; + size_t c_rdcc_nbytes; + double c_rdcc_w0; + c_rdcc_nbytes =(size_t) *rdcc_nbytes; + c_rdcc_w0 = (double)*rdcc_w0; + + /* + * Call H5Pset_cache function. + */ + c_prp_id = *prp_id; + c_mdc_nelmts = *mdc_nelmts; + c_rdcc_nelmts = *rdcc_nelmts; + ret = H5Pset_cache(c_prp_id, c_mdc_nelmts, c_rdcc_nelmts, c_rdcc_nbytes, c_rdcc_w0 ); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_cache_c + * Purpose: Call H5Pget_cache to get he number of elements in + * the meta data cache and the total number of bytes in + * the raw data chunk cache + * Inputs: prp_id - property list identifier + * Outputs: mdc_nelmts - Number of elements (objects) in the + * meta data cache + * rdcc_nelmts - Number of elements in the raw data chunk + * rdcc_nbytes - Total size of the raw data chunk cache, in bytes + * rdcc_w0 - Preemption policy + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: Changed type of the rdcc_w0 parameter to be real_f instead of double + *---------------------------------------------------------------------------*/ +int_f +nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_f* rdcc_nbytes , real_f* rdcc_w0) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + int c_mdc_nelmts, c_rdcc_nelmts; + size_t c_rdcc_nbytes; + hid_t c_memb_plist; + double c_rdcc_w0; + /* + * Call H5Pget_cache function. + */ + c_prp_id = *prp_id; + ret = H5Pget_cache(c_prp_id, &c_mdc_nelmts, &c_rdcc_nelmts, &c_rdcc_nbytes, &c_rdcc_w0); + if (ret < 0) return ret_value; + *mdc_nelmts = (int_f)c_mdc_nelmts; + *rdcc_nelmts = (int_f)c_rdcc_nelmts; + *rdcc_nbytes = (size_t_f)c_rdcc_nbytes; + *rdcc_w0 = (real_f)c_rdcc_w0; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_split_c + * Purpose: Call H5Pset_split to set he low-level driver to split meta data + * from raw data + * Inputs: prp_id - property list identifier + * meta_len - Length of meta_ext + * meta_ext - Name of the extension for the metafile filename. + * meta_plist - Identifier of the meta file access property list + * raw_len - Length of raw _ext + * raw_ext - Name of the extension for the raw file filename. + * raw_plist - Identifier of the raw file access property list + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_split_c(hid_t_f *prp_id, int_f* meta_len, _fcd meta_ext, hid_t_f* meta_plist, int_f* raw_len, _fcd raw_ext, hid_t_f * raw_plist) +{ + int ret_value = -1; + hid_t c_prp_id; + hid_t c_meta_plist; + hid_t c_raw_plist; + herr_t ret; + char* c_meta_ext; + char* c_raw_ext; + c_meta_ext = (char *)HD5f2cstring(meta_ext, (int)*meta_len); + if (c_meta_ext == NULL) return ret_value; + c_raw_ext = (char *)HD5f2cstring(raw_ext, (int)*raw_len); + if (c_raw_ext == NULL) return ret_value; + + /* + * Call H5Pset_split function. + */ + c_prp_id = *prp_id; + c_meta_plist = *meta_plist; + c_raw_plist = *raw_plist; + ret = H5Pset_split(c_prp_id, c_meta_ext, c_meta_plist, c_raw_ext, c_raw_plist ); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5pget_split_c + * Purpose: Call H5Pget_split to determine whether the file access + * property list is set to the split driver + * Inputs: prp_id - property list identifier + * meta_ext_size - Number of characters of the meta file extension + * to be copied to the meta_ext buffer + * raw_ext_size - Number of characters of the raw file extension + * to be copied to the raw_ext buffer + *Outputs: meta_ext - Name of the extension for the metafile filename. + * meta_plist - Identifier of the meta file access property list + * raw_ext - Name of the extension for the raw file filename. + * raw_plist - Identifier of the raw file access property list + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_f* meta_plist, size_t_f* raw_ext_size, _fcd raw_ext, hid_t_f * raw_plist) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + size_t c_meta_ext_size, c_raw_ext_size; + hid_t c_meta_plist, c_raw_plist; + + char* c_meta_ext; + char* c_raw_ext; + + c_meta_ext_size = (size_t) *meta_ext_size; + c_raw_ext_size = (size_t) *raw_ext_size; + c_meta_ext = (char*)malloc(sizeof(char)*c_meta_ext_size); + c_raw_ext = (char*)malloc(sizeof(char)*c_raw_ext_size); + if(c_meta_ext == NULL || c_raw_ext == NULL) return ret_value; + + /* + * Call H5Pget_split function. + */ + c_prp_id = *prp_id; + ret = H5Pget_split(c_prp_id, c_meta_ext_size, c_meta_ext,&c_meta_plist, c_raw_ext_size, c_raw_ext, &c_raw_plist ); + + if (ret < 0) return ret_value; + *meta_plist = c_meta_plist; + *raw_plist = c_raw_plist; + HDpackFstring(c_meta_ext, _fcdtocp(meta_ext), strlen(c_meta_ext)); + HDpackFstring(c_raw_ext, _fcdtocp(raw_ext), strlen(c_raw_ext)); + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_gc_references_c + * Purpose: Call H5Pset_gc_references to set garbage + * collecting references flag + * Inputs: prp_id - property list identifier + * gc_reference - flag for garbage collecting references + * for the file + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_gc_references_c (hid_t_f *prp_id, int_f* gc_references) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + unsigned c_gc_references; + c_gc_references = (unsigned)*gc_references; + + /* + * Call H5Pset_gc_references function. + */ + c_prp_id = *prp_id; + ret = H5Pset_gc_references(c_prp_id, c_gc_references); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_gc_references_c + * Purpose: Call H5Pget_gc_references to set garbage + * collecting references flag + * Inputs: prp_id - property list identifier + * Outputs gc_reference - flag for garbage collecting references + * for the file + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_gc_references_c (hid_t_f *prp_id, int_f* gc_references) +{ + int ret_value = -1; + hid_t c_prp_id; + unsigned c_gc_references; + herr_t ret; + /* + * Call H5Pget_gc_references function. + */ + c_prp_id = *prp_id; + ret = H5Pget_gc_references(c_prp_id, &c_gc_references); + if (ret < 0) return ret_value; + *gc_references = (int_f)c_gc_references; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_layout_c + * Purpose: Call H5Pset_layout to the type of storage used + * store the raw data for a dataset + * Inputs: prp_id - property list identifier + * layout - Type of storage layout for raw data. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_layout_c (hid_t_f *prp_id, int_f* layout) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + H5D_layout_t c_layout; + c_layout = (H5D_layout_t)*layout; + /* + * Call H5Pset_layout function. + */ + c_prp_id = *prp_id; + ret = H5Pset_layout(c_prp_id, c_layout); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_layout_c + * Purpose: Call H5Pget_layout to the type of storage used + * store the raw data for a dataset + * Inputs: prp_id - property list identifier + * Outputs: layout - Type of storage layout for raw data. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_layout_c (hid_t_f *prp_id, int_f* layout) +{ + int ret_value = -1; + hid_t c_prp_id; + H5D_layout_t c_layout; + /* + * Call H5Pget_layout function. + */ + c_prp_id = *prp_id; + c_layout = H5Pget_layout(c_prp_id); + if (c_layout < 0) return ret_value; + *layout = (int_f)c_layout; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_filter_c + * Purpose: Call H5Pset_filter to add a filter to the filter pipeline. + * Inputs: prp_id - property list identifier + * filter - Filter to be added to the pipeline. + * flags - Bit vector specifying certain general + * properties of the filter. + * cd_nelmts - Number of elements in cd_values. + * cd_values - Auxiliary data for the filter. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + size_t c_cd_nelmts; + unsigned int c_flags; + H5Z_filter_t c_filter; + unsigned int * c_cd_values; + int i; + + c_filter = (H5Z_filter_t)*filter; + c_flags = (unsigned)*flags; + c_cd_nelmts = (size_t)*cd_nelmts; + c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts)); + if (!c_cd_values) return ret_value; + for (i = 0; i < c_cd_nelmts; i++) + c_cd_values[i] = (unsigned int)cd_values[i]; + + /* + * Call H5Pset_filter function. + */ + c_prp_id = *prp_id; + ret = H5Pset_filter(c_prp_id, c_filter, c_flags, c_cd_nelmts,c_cd_values ); + + if (ret < 0) return ret_value; + ret_value = 0; + free(c_cd_values); + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_nfilters_c + * Purpose: Call H5Pget_nfilters to get the number of filters + * in the pipeline + * Inputs: prp_id - property list identifier + * Outputs: nfilters - number of filters defined in the filter pipline + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters) +{ + int ret_value = -1; + hid_t c_prp_id; + int c_nfilters; + /* + * Call H5Pget_nfilters function. + */ + c_prp_id = *prp_id; + c_nfilters = H5Pget_nfilters(c_prp_id); + if (c_nfilters < 0) return ret_value; + *nfilters = (int_f)c_nfilters; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_filter_c + * Purpose: Call H5Pget_filter to get information about a filter + * in a pipeline + * Inputs: prp_id - property list identifier + * filter_number - Sequence number within the filter + * pipeline of the filter for which + * information is sought. + * namelen - Anticipated number of characters in name. + *Outputs: flags - Bit vector specifying certain general + * properties of the filter. + * cd_nelmts - Number of elements in cd_value + * cd_values - Auxiliary data for the filter. + * name - Name of the filter + * filter_id - filter identification number + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id) +{ + int ret_value = -1; + hid_t c_prp_id; + int c_filter_number; + unsigned int c_flags; + size_t c_cd_nelmts, c_namelen; + H5Z_filter_t c_filter; + unsigned int * c_cd_values; + char* c_name; + int i; + + c_cd_nelmts = (size_t)*cd_nelmts; + c_namelen = (size_t)*namelen; + c_name = (char*)malloc(sizeof(char)*c_namelen); + if (!c_name) return ret_value; + + c_cd_values = (unsigned int*)malloc(sizeof(unsigned int)*((int)c_cd_nelmts)); + if (!c_cd_values) return ret_value; + + /* + * Call H5Pget_filter function. + */ + c_prp_id = *prp_id; + c_filter_number = *filter_number; + c_filter = H5Pget_filter(c_prp_id, c_filter_number, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name); + + if (c_filter < 0) return ret_value; + + *filter_id = c_filter; + *cd_nelmts = c_cd_nelmts; + *flags = c_flags; + HDpackFstring(c_name, _fcdtocp(name), strlen(c_name)); + + for (i = 0; i < c_cd_nelmts; i++) + cd_values[i] = (int_f)c_cd_values[i]; + + HDfree(c_name); + HDfree(c_cd_values); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_external_c + * Purpose: Call H5Pset_external to add an external file to the + * list of external files. + * Inputs: prp_id - property list identifier + * name - Name of an external file + * namelen - length of name + * offset - Offset, in bytes, from the beginning of the file + * to the location in the file where the data starts. + * bytes - Number of bytes reserved in the file for the data. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + hsize_t c_bytes; + char* c_name; + int c_namelen; + off_t c_offset; + + c_bytes = (hsize_t) *bytes; + c_offset = (off_t)*offset; + + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Pset_external function. + */ + c_prp_id = *prp_id; + ret = H5Pset_external(c_prp_id, c_name, c_offset, c_bytes); + + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_external_count_c + * Purpose: Call H5Pget_external_count to get the number of external + * files for the specified dataset. + * Inputs: prp_id - property list identifier + * Outputs: count - number of external files + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_external_count_c (hid_t_f *prp_id, int_f* count) +{ + int ret_value = -1; + hid_t c_prp_id; + int c_count; + /* + * Call H5Pget_external_count function. + */ + c_prp_id = *prp_id; + c_count = H5Pget_external_count(c_prp_id); + if (c_count < 0) return ret_value; + *count = (int_f)c_count; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_external_c + * Purpose: Call H5Pget_external to get nformation about an external file. + * Inputs: prp_id - property list identifier + * name_size - length of name + * idx - External file index. + *Outputs: name - Name of an external file + * offset - Offset, in bytes, from the beginning of the file + * to the location in the file where the data starts. + * bytes - Number of bytes reserved in the file for the data. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, February 23, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_external_c(hid_t_f *prp_id,int*idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes) +{ + int ret_value = -1; + hid_t c_prp_id; + int c_idx; + herr_t status; + size_t c_namelen; + char* c_name; + int i; + off_t c_offset; + hsize_t size; + + c_namelen = (size_t)*name_size; + /* + * Allocate memory to store the name of the external file. + */ + if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1); + + /* + * Call H5Pget_external function. + */ + c_prp_id = *prp_id; + c_idx = *idx; + status = H5Pget_external(c_prp_id, c_idx, c_namelen, c_name, &c_offset, &size ); + + if (status < 0) { + HDfree(c_name); + return ret_value; + } + + *offset = (int_f)c_offset; + *bytes = (hsize_t_f)size; + HDpackFstring(c_name, _fcdtocp(name), strlen(c_name)); + + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_hyper_cache_c + * Purpose: Call H5Pset__hyper_cache to indicate whether to + * cache hyperslab blocks during I/O. + * Inputs: prp_id - property list identifier + * cache - + * limit - Maximum size of the hyperslab block to cache. + * 0 (zero) indicates no limit. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_hyper_cache_c(hid_t_f *prp_id, int_f* cache, int_f* limit) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + unsigned c_cache, c_limit; + c_cache = (unsigned) *cache; + c_limit = (unsigned) *limit; + + /* + * Call H5Pset_hyper_cache function. + */ + c_prp_id = *prp_id; + ret = H5Pset_hyper_cache(c_prp_id, c_cache, c_limit); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_hyper_cache_c + * Purpose: Call H5Pget_hyper_cache to get information regarding + * the caching of hyperslab blocks + * Inputs: prp_id - property list identifier + * cache - + * limit - Maximum size of the hyperslab block to cache. + * 0 (zero) indicates no limit. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_hyper_cache_c(hid_t_f *prp_id, int_f* cache, int_f* limit) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + unsigned c_cache, c_limit; + /* + * Call H5Pget__hyper_cache function. + */ + c_prp_id = *prp_id; + ret = H5Pget_hyper_cache(c_prp_id, &c_cache, &c_limit); + if (ret < 0) return ret_value; + *cache = (int_f)c_cache; + *limit = (int_f)c_limit; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pset_btree_ratios_c + * Purpose: Call H5Pset_btree_ratios to set B-tree split ratios for B-tree split ratios for a dataset transfer property list. a + * dataset transfer property list. + * Inputs: prp_id - property list identifier + * left - The B-tree split ratio for left-most nodes. + * middle - The B-tree split ratio for all other nodes + * right - The B-tree split ratio for right-most nodes + * and lone nodes. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: Changed the type of the last three parameters from double to real_f + *---------------------------------------------------------------------------*/ +int_f +nh5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + double c_left; + double c_middle; + double c_right; + c_left = (double)*left; + c_middle = (double)*middle; + c_right = (double)*right; + + /* + * Call H5Pset_btree_ratios function. + */ + c_prp_id = *prp_id; + ret = H5Pset_btree_ratios(c_prp_id, c_left, c_middle, c_right); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_btree_ratios_c + * Purpose: Call H5Pget_btree_ratios to Gets B-tree split ratios + * for a dataset transfer property list. + * Inputs: prp_id - property list identifier + * left - The B-tree split ratio for left-most nodes. + * middle - The B-tree split ratio for all other nodes + * right - The B-tree split ratio for right-most nodes + * and lone nodes. + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, February 25, 2000 + * Modifications: Changed the type of the last three parameters from double to real_f + *---------------------------------------------------------------------------*/ +int_f +nh5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + double c_left, c_right, c_middle; + + /* + * Call H5Pget_btree_ratios function. + */ + c_prp_id = *prp_id; + ret = H5Pget_btree_ratios(c_prp_id, &c_left, &c_middle, &c_right); + *left = (real_f)c_left; + *middle = (real_f)c_middle; + *right = (real_f)c_right; + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5Pf_parallel.c b/fortran/src/H5Pf_parallel.c new file mode 100644 index 0000000..6dc0850 --- /dev/null +++ b/fortran/src/H5Pf_parallel.c @@ -0,0 +1,161 @@ +#include "H5f90.h" +#include + +/*---------------------------------------------------------------------------- + * Name: h5pset_mpi_c + * Purpose: Call H5Pset_mpi to set mode for parallel I/O and the user + * supplied communicator and info object + * Inputs: prp_id - property list identifier + * comm - MPI communicator + * info - MPI info object + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, June 8, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_mpi_c(hid_t_f *prp_id, int_f* comm, int_f* info) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + MPI_Comm c_comm; + MPI_Info c_info; + c_comm = (MPI_Comm) *comm; + c_info = (MPI_Info) *info; + + /* + * Call H5Pset_mpi function. + */ + c_prp_id = *prp_id; + ret = H5Pset_mpi(c_prp_id, c_comm, c_info); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_mpi_c + * Purpose: Call H5Pget_mpi to retrieve communicator and info object + * Inputs: prp_id - property list identifier + * comm - buffer to return MPI communicator + * info - buffer to return MPI info object + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, June 8, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_mpi_c(hid_t_f *prp_id, int_f* comm, int_f* info) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + MPI_Comm c_comm; + MPI_Info c_info; + + /* + * Call H5Pget_mpi function. + */ + c_prp_id = *prp_id; + ret = H5Pget_mpi(c_prp_id, &c_comm, &c_info); + if (ret < 0) return ret_value; + *comm = (int_f) c_comm; + *info = (int_f) c_info; + ret_value = 0; + return ret_value; +} +/*---------------------------------------------------------------------------- + * Name: h5pset_xfer_c + * Purpose: Call H5Pset_xfer to set transfer mode of the dataset + * trasfer property list + * Inputs: prp_id - property list identifier + * data_xfer_mode - transfer mode + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, June 15, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pset_xfer_c(hid_t_f *prp_id, int_f* data_xfer_mode) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + H5D_transfer_t c_data_xfer_mode; + int CASE; + CASE = *data_xfer_mode; + switch (CASE) { + + case H5D_XFER_INDEPENDENT_F: + c_data_xfer_mode = H5D_XFER_INDEPENDENT; + break; + + case H5D_XFER_COLLECTIVE_F: + c_data_xfer_mode = H5D_XFER_COLLECTIVE; + break; + + case H5D_XFER_DFLT_F: + c_data_xfer_mode = H5D_XFER_DFLT; + break; + default: + return ret_value; + } + /* + * Call H5Pset_xfer function. + */ + c_prp_id = *prp_id; + ret = H5Pset_xfer(c_prp_id, c_data_xfer_mode); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_xfer_c + * Purpose: Call H5Pget_xfer to get transfer mode of the dataset + * trasfer property list + * Inputs: prp_id - property list identifier + * data_xfer_mode - buffer to retrieve transfer mode + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, June 15, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pget_xfer_c(hid_t_f *prp_id, int_f* data_xfer_mode) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + H5D_transfer_t c_data_xfer_mode; + int CASE; + + /* + * Call H5Pget_xfer function. + */ + c_prp_id = *prp_id; + ret = H5Pget_xfer(c_prp_id, &c_data_xfer_mode); + if (ret < 0) return ret_value; + + CASE = (int)c_data_xfer_mode; + switch (CASE) { + + case H5D_XFER_INDEPENDENT: + *data_xfer_mode = H5D_XFER_INDEPENDENT_F; + break; + + case H5D_XFER_COLLECTIVE: + *data_xfer_mode = H5D_XFER_COLLECTIVE_F; + break; + + case H5D_XFER_DFLT: + *data_xfer_mode = H5D_XFER_DFLT_F; + break; + + default: + return ret_value; + } + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 new file mode 100644 index 0000000..ec3414c --- /dev/null +++ b/fortran/src/H5Pff.f90 @@ -0,0 +1,744 @@ +! +! This file contains Fortran90 interfaces for H5P functions. +! + MODULE H5P + + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + INTERFACE h5pset_fill_value_f + MODULE PROCEDURE h5pset_fill_value_integer + MODULE PROCEDURE h5pset_fill_value_real +! Comment if on T3E + MODULE PROCEDURE h5pset_fill_value_double +! End comment if on T3E + MODULE PROCEDURE h5pset_fill_value_char + END INTERFACE + + INTERFACE h5pget_fill_value_f + MODULE PROCEDURE h5pget_fill_value_integer + MODULE PROCEDURE h5pget_fill_value_real +! Comment if on T3E + MODULE PROCEDURE h5pget_fill_value_double +! End comment if on T3E + MODULE PROCEDURE h5pget_fill_value_char + END INTERFACE + + CONTAINS + + SUBROUTINE h5pcreate_f(classtype, prp_id, hdferr) + IMPLICIT NONE + INTEGER, INTENT(IN) :: classtype ! The type of the property list + ! to be created. Possible values + ! are: + ! H5P_FILE_CREATE_F (0) + ! H5P_FILE_ACCESS_F (1) + ! H5P_DATASET_CREATE_F (2) + ! H5P_DATASET_XFER_F (3) + ! H5P_MOUNT_F (4) + INTEGER(HID_T), INTENT(OUT) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pcreate_c + hdferr = h5pcreate_c(classtype, prp_id) + END SUBROUTINE h5pcreate_f + + + SUBROUTINE h5pset_preserve_f(prp_id, flag, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: flag ! TRUE/FALSE flag to set the dataset + ! transfer property for partila writing/reading + ! compound datatype + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_preserve_c + hdferr = h5pset_preserve_c(prp_id, flag) + END SUBROUTINE h5pset_preserve_f + + SUBROUTINE h5pget_preserve_f(prp_id, flag, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: flag ! TRUE/FALSE flag. Shows status of the dataset's + ! transfer property for partial writing/reading + ! compound datatype + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_preserve_c + hdferr = h5pget_preserve_c(prp_id, flag) + END SUBROUTINE h5pget_preserve_f + + SUBROUTINE h5pget_class_f(prp_id, classtype, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: classtype ! The type of the property list + ! to be created. Possible values + ! are: + ! H5P_NO_CLASS (-1) + ! H5P_FILE_CREATE_F (0) + ! H5P_FILE_ACCESS_F (1) + ! H5PE_DATASET_CREATE_F (2) + ! H5P_DATASET_XFER_F (3) + ! H5P_MOUNT_F (4) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_class_c + hdferr = h5pget_class_c(prp_id, classtype) + END SUBROUTINE h5pget_class_f + + + SUBROUTINE h5pcopy_f(prp_id, new_prp_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(OUT) :: new_prp_id + ! Identifier of property list + ! copy + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pcopy_c + hdferr = h5pcopy_c(prp_id, new_prp_id) + END SUBROUTINE h5pcopy_f + + + SUBROUTINE h5pclose_f(prp_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pclose_c + hdferr = h5pclose_c(prp_id) + END SUBROUTINE h5pclose_f + + + SUBROUTINE h5pset_chunk_f(prp_id, ndims, dims, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: ndims ! Number of chunk dimensions + INTEGER(HSIZE_T), DIMENSION(ndims), INTENT(IN) :: dims + ! Array containing sizes of + ! chunk dimensions + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_chunk_c + hdferr = h5pset_chunk_c(prp_id, ndims, dims) + END SUBROUTINE h5pset_chunk_f + + + SUBROUTINE h5pget_chunk_f(prp_id, ndims, dims, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: ndims ! Number of chunk dimensions to + ! to return + INTEGER(HSIZE_T), DIMENSION(ndims), INTENT(OUT) :: dims + ! Array containing sizes of + ! chunk dimensions + INTEGER, INTENT(OUT) :: hdferr ! Error code; number of + ! chunk dimensions on success, + ! -1 on failure + INTEGER, EXTERNAL :: h5pget_chunk_c + hdferr = h5pget_chunk_c(prp_id, ndims, dims) + END SUBROUTINE h5pget_chunk_f + + + SUBROUTINE h5pset_deflate_f(prp_id, level, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: level ! Compression level + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_deflate_c + hdferr = h5pset_deflate_c(prp_id, level) + END SUBROUTINE h5pset_deflate_f + + + SUBROUTINE h5pset_fill_value_integer(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + INTEGER, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_fill_value_c + hdferr = h5pset_fill_value_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pset_fill_value_integer + + + SUBROUTINE h5pget_fill_value_integer(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + INTEGER, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_fill_value_c + hdferr = h5pget_fill_value_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pget_fill_value_integer + + + SUBROUTINE h5pset_fill_value_real(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + REAL, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_fill_value_c + hdferr = h5pset_fill_value_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pset_fill_value_real + + + SUBROUTINE h5pget_fill_value_real(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + REAL, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_fill_value_c + hdferr = h5pget_fill_value_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pget_fill_value_real + + + SUBROUTINE h5pset_fill_value_double(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + DOUBLE PRECISION, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_fill_value_c + hdferr = h5pset_fill_value_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pset_fill_value_double + + + SUBROUTINE h5pget_fill_value_double(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + DOUBLE PRECISION, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_fill_value_c + hdferr = h5pget_fill_value_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pget_fill_value_double + + + SUBROUTINE h5pset_fill_value_char(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + CHARACTER, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_fill_valuec_c + hdferr = h5pset_fill_valuec_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pset_fill_value_char + + + SUBROUTINE h5pget_fill_value_char(prp_id, type_id, fillvalue, & + hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier of + ! of fillvalue datatype + ! (in memory) + CHARACTER, INTENT(IN) :: fillvalue ! Fillvalue + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_fill_valuec_c + hdferr = h5pget_fill_valuec_c(prp_id, type_id, fillvalue) + END SUBROUTINE h5pget_fill_value_char + + SUBROUTINE h5pget_version_f(prp_id, boot, freelist, & + stab, shhdr, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, DIMENSION(:), INTENT(OUT) :: boot !array to put boot + !block version number + INTEGER, DIMENSION(:), INTENT(OUT) :: freelist !array to put global + !freelist version number + + INTEGER, DIMENSION(:), INTENT(OUT) :: stab !array to put symbol + !table version number + INTEGER, DIMENSION(:), INTENT(OUT) :: shhdr !array to put shared + !object header version number + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_version_c + hdferr = h5pget_version_c(prp_id, boot, freelist, stab, shhdr) + END SUBROUTINE h5pget_version_f + + SUBROUTINE h5pset_userblock_f (prp_id, size, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HSIZE_T), INTENT(IN) :: size !Size of the user-block in bytes + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_userblock_c + hdferr = h5pset_userblock_c(prp_id, size) + END SUBROUTINE h5pset_userblock_f + + + SUBROUTINE h5pget_userblock_f(prp_id, block_size, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HSIZE_T), DIMENSION(:), INTENT(OUT) :: block_size !Size of the + !user-block in bytes + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_userblock_c + INTEGER :: len + hdferr = h5pget_userblock_c(prp_id, block_size) + END SUBROUTINE h5pget_userblock_f + + SUBROUTINE h5pset_sizes_f (prp_id, sizeof_addr, sizeof_size, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(SIZE_T), INTENT(IN) :: sizeof_addr !Size of an object + !offset in bytes + INTEGER(SIZE_T), INTENT(IN) :: sizeof_size !Size of an object + !length in bytes + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_sizes_c + hdferr = h5pset_sizes_c(prp_id, sizeof_addr, sizeof_size) + END SUBROUTINE h5pset_sizes_f + + + SUBROUTINE h5pget_sizes_f(prp_id, sizeof_addr, sizeof_size, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(SIZE_T), DIMENSION(:), INTENT(OUT) :: sizeof_addr !Size of an object + !offset in bytes + INTEGER(SIZE_T), DIMENSION(:), INTENT(OUT) :: sizeof_size !Size of an object + !length in bytes + + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_sizes_c + hdferr = h5pget_sizes_c(prp_id, sizeof_addr, sizeof_size) + END SUBROUTINE h5pget_sizes_f + + SUBROUTINE h5pset_sym_k_f (prp_id, ik, lk, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: ik ! Symbol table tree rank + INTEGER, INTENT(IN) :: lk ! Symbol table node size + + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_sym_k_c + hdferr = h5pset_sym_k_c(prp_id, ik, lk) + END SUBROUTINE h5pset_sym_k_f + + + SUBROUTINE h5pget_sym_k_f(prp_id, ik, lk, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: ik !Symbol table tree rank + INTEGER, INTENT(OUT) :: lk !Symbol table node size + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_sym_k_c + hdferr = h5pget_sym_k_c(prp_id, ik, lk) + END SUBROUTINE h5pget_sym_k_f + + SUBROUTINE h5pset_istore_k_f (prp_id, ik, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: ik ! 1/2 rank of chunked storage B-tree + + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_istore_k_c + hdferr = h5pset_istore_k_c(prp_id, ik) + END SUBROUTINE h5pset_istore_k_f + + + SUBROUTINE h5pget_istore_k_f(prp_id, ik, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: ik !1/2 rank of chunked storage B-tree + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_istore_k_c + hdferr = h5pget_istore_k_c(prp_id, ik) + END SUBROUTINE h5pget_istore_k_f + + SUBROUTINE h5pget_driver_f(prp_id, driver, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: driver !low-level file driver identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_driver_c + hdferr = h5pget_driver_c(prp_id, driver) + END SUBROUTINE h5pget_driver_f + + SUBROUTINE h5pset_stdio_f (prp_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_stdio_c + hdferr = h5pset_stdio_c(prp_id) + END SUBROUTINE h5pset_stdio_f + + SUBROUTINE h5pget_stdio_f (prp_id, io, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: io ! value indicates that the file + !access property list is set to + !the stdio driver + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_stdio_c + hdferr = h5pget_stdio_c(prp_id, io) + END SUBROUTINE h5pget_stdio_f + + SUBROUTINE h5pset_sec2_f (prp_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_sec2_c + hdferr = h5pset_sec2_c(prp_id) + END SUBROUTINE h5pset_sec2_f + + SUBROUTINE h5pget_sec2_f (prp_id, sec2, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: sec2 ! value indicates whether the file + !driver uses the functions declared + !in the unistd.h file + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_sec2_c + hdferr = h5pget_sec2_c(prp_id, sec2) + END SUBROUTINE h5pget_sec2_f + + SUBROUTINE h5pset_alignment_f(prp_id, threshold, alignment, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HSIZE_T), INTENT(IN) :: threshold ! Threshold value + INTEGER(HSIZE_T), INTENT(IN) :: alignment ! alignment value + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_alignment_c + hdferr = h5pset_alignment_c(prp_id, threshold, alignment) + END SUBROUTINE h5pset_alignment_f + + SUBROUTINE h5pget_alignment_f(prp_id, threshold, alignment, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HSIZE_T), INTENT(OUT) :: threshold ! Threshold value + INTEGER(HSIZE_T), INTENT(OUT) :: alignment ! alignment value + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_alignment_c + hdferr = h5pget_alignment_c(prp_id, threshold, alignment) + END SUBROUTINE h5pget_alignment_f + + SUBROUTINE h5pset_core_f(prp_id, increment, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(SIZE_T), INTENT(IN) :: increment ! File block size in bytes. + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_core_c + hdferr = h5pset_core_c(prp_id, increment) + END SUBROUTINE h5pset_core_f + + SUBROUTINE h5pget_core_f(prp_id, increment, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(SIZE_T), INTENT(OUT) :: increment ! File block size in bytes. + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_core_c + hdferr = h5pget_core_c(prp_id, increment) + END SUBROUTINE h5pget_core_f + + SUBROUTINE h5pset_family_f(prp_id, memb_size, memb_plist , hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HSIZE_T), INTENT(IN) :: memb_size ! Logical size, in bytes, + !of each family member + INTEGER(HID_T), INTENT(IN) :: memb_plist !Identifier of the file + !access property list for + !each member of the family + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_family_c + hdferr = h5pset_family_c(prp_id, memb_size, memb_plist) + END SUBROUTINE h5pset_family_f + + + SUBROUTINE h5pget_family_f(prp_id, memb_size, memb_plist , hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(HSIZE_T), INTENT(OUT) :: memb_size ! Logical size, in bytes, + !of each family member + INTEGER(HID_T), INTENT(OUT) :: memb_plist !Identifier of the file + !access property list for + !each member of the family + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_family_c + hdferr = h5pget_family_c(prp_id, memb_size, memb_plist) + END SUBROUTINE h5pget_family_f + + SUBROUTINE h5pset_cache_f(prp_id, mdc_nelmts,rdcc_nelmts, rdcc_nbytes, rdcc_w0, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: mdc_nelmts !Number of elements (objects) + ! in the meta data cache + INTEGER, INTENT(IN) :: rdcc_nelmts !Number of elements (objects) + ! in the meta data cache + INTEGER(SIZE_T), INTENT(IN) :: rdcc_nbytes !Total size of the raw data + !chunk cache, in bytes + REAL, INTENT(IN) :: rdcc_w0 !Preemption policy + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pset_cache_c + hdferr = h5pset_cache_c(prp_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 ) + END SUBROUTINE h5pset_cache_f + + SUBROUTINE h5pget_cache_f(prp_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: mdc_nelmts !Number of elements (objects) + ! in the meta data cache + INTEGER, INTENT(OUT) :: rdcc_nelmts !Number of elements (objects) + ! in the meta data cache + INTEGER(SIZE_T), INTENT(OUT) :: rdcc_nbytes !Total size of the raw data + !chunk cache, in bytes + REAL, INTENT(OUT) :: rdcc_w0 !Preemption policy + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_cache_c + hdferr = h5pget_cache_c(prp_id, mdc_nelmts,rdcc_nelmts, rdcc_nbytes, rdcc_w0 ) + END SUBROUTINE h5pget_cache_f + + SUBROUTINE h5pset_split_f(prp_id, meta_ext, meta_plist, raw_ext, raw_plist, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + CHARACTER(LEN=*), INTENT(IN) :: meta_ext !Name of the extension for + !the metafile filename + INTEGER(HID_T), INTENT(IN) :: meta_plist ! Identifier of the meta file + ! access property list + CHARACTER(LEN=*), INTENT(IN) :: raw_ext !Name extension for the raw file filename + INTEGER(HID_T), INTENT(IN) :: raw_plist !Identifier of the raw file + !access property list + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: meta_len, raw_len; + + INTEGER, EXTERNAL :: h5pset_split_c + meta_len = LEN(meta_ext) + raw_len = LEN(raw_ext) + hdferr = h5pset_split_c(prp_id, meta_len, meta_ext, meta_plist, raw_len, raw_ext, raw_plist ) + END SUBROUTINE h5pset_split_f + + SUBROUTINE h5pget_split_f(prp_id, meta_ext_size, meta_ext, meta_plist,raw_ext_size,& + raw_ext, raw_plist, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER(SIZE_T), INTENT(IN) :: meta_ext_size ! Number of characters of the meta + ! file extension to be copied to the + ! meta_ext buffer + + CHARACTER(LEN=*), INTENT(OUT) :: meta_ext !Name of the extension for + !the metafile filename + INTEGER(HID_T), INTENT(OUT) :: meta_plist ! Identifier of the meta file + ! access property list + INTEGER(SIZE_T), INTENT(IN) :: raw_ext_size ! Number of characters of the raw + ! file extension to be copied to the + ! raw_ext buffer + CHARACTER(LEN=*), INTENT(OUT) :: raw_ext !Name extension for the raw file filename + INTEGER(HID_T), INTENT(OUT) :: raw_plist !Identifier of the raw file + !access property list + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_split_c + hdferr = h5pget_split_c(prp_id, meta_ext_size, meta_ext, meta_plist, & + raw_ext_size, raw_ext, raw_plist ) + END SUBROUTINE h5pget_split_f + + + SUBROUTINE h5pset_gc_references_f (prp_id, gc_reference, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: gc_reference !the flag for garbage collecting + ! references for the file + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_gc_references_c + hdferr = h5pset_gc_references_c(prp_id, gc_reference) + END SUBROUTINE h5pset_gc_references_f + + SUBROUTINE h5pget_gc_references_f (prp_id, gc_reference, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: gc_reference !the flag for garbage collecting + ! references for the file + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_gc_references_c + hdferr = h5pget_gc_references_c(prp_id, gc_reference) + END SUBROUTINE h5pget_gc_references_f + + SUBROUTINE h5pset_layout_f (prp_id, layout, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: layout !Type of storage layout for raw data + !possible values are: + !H5D_COMPACT_F(0) + !H5D_CONTIGUOUS_F(1) + !H5D_CHUNKED_F(2) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pset_layout_c + hdferr = h5pset_layout_c(prp_id, layout) + END SUBROUTINE h5pset_layout_f + + SUBROUTINE h5pget_layout_f (prp_id, layout, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: layout !Type of storage layout for raw data + !possible values are: + !H5D_COMPACT_F(0) + !H5D_CONTIGUOUS_F(1) + !H5D_CHUNKED_F(2) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_layout_c + hdferr = h5pget_layout_c(prp_id, layout) + END SUBROUTINE h5pget_layout_f + + SUBROUTINE h5pset_filter_f(prp_id, filter, flags, cd_nelmts, cd_values, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: filter !Filter to be added to the pipeline. + INTEGER, INTENT(IN) :: flags !Bit vector specifying certain general + !properties of the filter. + INTEGER(SIZE_T), INTENT(IN) :: cd_nelmts !Number of elements in cd_values. + INTEGER, DIMENSION(*), INTENT(IN) :: cd_values !Auxiliary data for the filter. + + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pset_filter_c + hdferr = h5pset_filter_c(prp_id, filter, flags, cd_nelmts, cd_values ) + END SUBROUTINE h5pset_filter_f + + SUBROUTINE h5pget_nfilters_f (prp_id, nfilters, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: nfilters !the number of filters in the pipeline + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_nfilters_c + hdferr = h5pget_nfilters_c(prp_id, nfilters) + END SUBROUTINE h5pget_nfilters_f + + SUBROUTINE h5pget_filter_f(prp_id, filter_number, flags, cd_nelmts, cd_values, namelen, name, filter_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: filter_number !Sequence number within the filter + !pipeline of the filter for which + !information is sought + INTEGER, DIMENSION(*), INTENT(OUT) :: cd_values !Auxiliary data for the filter. + INTEGER, INTENT(OUT) :: flags !Bit vector specifying certain general + !properties of the filter. + INTEGER(SIZE_T), INTENT(INOUT) :: cd_nelmts !Number of elements in cd_values. + INTEGER(SIZE_T), INTENT(IN) :: namelen !Anticipated number of characters in name. + CHARACTER(LEN=*), INTENT(OUT) :: name !Name of the filter + INTEGER, INTENT(OUT) :: filter_id ! filter identification number + + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_filter_c + hdferr = h5pget_filter_c(prp_id, filter_number, flags, cd_nelmts, & + cd_values, namelen, name, filter_id ) + END SUBROUTINE h5pget_filter_f + + SUBROUTINE h5pset_external_f(prp_id, name, offset,bytes, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + CHARACTER(LEN=*), INTENT(IN) :: name !Name of an external file + INTEGER, INTENT(IN) :: offset !Offset, in bytes, from the beginning + !of the file to the location in the file + !where the data starts. + INTEGER(HSIZE_T), INTENT(IN) :: bytes ! Number of bytes reserved in the + !file for the data + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pset_external_c + INTEGER :: namelen + namelen = LEN(name) + + hdferr = h5pset_external_c(prp_id, name,namelen, offset, bytes) + END SUBROUTINE h5pset_external_f + + SUBROUTINE h5pget_external_count_f (prp_id, count, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: count !number of external files for the + !specified dataset + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5pget_external_count_c + hdferr = h5pget_external_count_c(prp_id, count) + END SUBROUTINE h5pget_external_count_f + + + SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset,bytes, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: idx !External file index. + INTEGER(SIZE_T), INTENT(IN) :: name_size !Maximum length of name array + CHARACTER(LEN=*), INTENT(OUT) :: name !Name of an external file + INTEGER, INTENT(OUT) :: offset !Offset, in bytes, from the beginning + !of the file to the location in the file + !where the data starts. + INTEGER(HSIZE_T), INTENT(OUT) :: bytes ! Number of bytes reserved in the + !file for the data + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_external_c + + hdferr = h5pget_external_c(prp_id, idx, name_size, name, offset, bytes) + END SUBROUTINE h5pget_external_f + + SUBROUTINE h5pset_hyper_cache_f(prp_id, cache, limit, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: cache ! + INTEGER, INTENT(IN) :: limit ! Maximum size of the hyperslab block to + !cache. 0 (zero) indicates no limit. + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pset_hyper_cache_c + hdferr = h5pset_hyper_cache_c(prp_id, cache, limit) + END SUBROUTINE h5pset_hyper_cache_f + + SUBROUTINE h5pget_hyper_cache_f(prp_id, cache, limit, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: cache ! + INTEGER, INTENT(OUT) :: limit ! Maximum size of the hyperslab block to + !cache. 0 (zero) indicates no limit. + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_hyper_cache_c + hdferr = h5pget_hyper_cache_c(prp_id, cache, limit) + END SUBROUTINE h5pget_hyper_cache_f + + SUBROUTINE h5pset_btree_ratios_f(prp_id, left, middle, right, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + REAL, INTENT(IN) :: left !The B-tree split ratio for left-most nodes. + REAL, INTENT(IN) :: middle !The B-tree split ratio for all other nodes + REAL, INTENT(IN) :: right !The B-tree split ratio for right-most + !nodes and lone nodes. + + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pset_btree_ratios_c + hdferr = h5pset_btree_ratios_c(prp_id, left, middle, right) + END SUBROUTINE h5pset_btree_ratios_f + + SUBROUTINE h5pget_btree_ratios_f(prp_id, left, middle, right, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + REAL, INTENT(OUT) :: left !The B-tree split ratio for left-most nodes. + REAL, INTENT(OUT) :: middle !The B-tree split ratio for all other nodes + REAL, INTENT(OUT) :: right !The B-tree split ratio for right-most + !nodes and lone nodes. + + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_btree_ratios_c + hdferr = h5pget_btree_ratios_c(prp_id, left, middle, right) + END SUBROUTINE h5pget_btree_ratios_f + + END MODULE H5P diff --git a/fortran/src/H5Pff_parallel.f90 b/fortran/src/H5Pff_parallel.f90 new file mode 100644 index 0000000..488b7a0 --- /dev/null +++ b/fortran/src/H5Pff_parallel.f90 @@ -0,0 +1,59 @@ +! +! This file contains Fortran90 interfaces for H5P functions needed by || MPI programs. +! + MODULE H5P_parallel + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + CONTAINS + SUBROUTINE h5pset_mpi_f(prp_id, comm, info, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: comm ! MPI communicator to be used for file open + ! as defined in MPI_FILE_OPEN of MPI-2 + INTEGER, INTENT(IN) :: info ! MPI info object to be used for file open + ! as defined in MPI_FILE_OPEN of MPI-2 + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pset_mpi_c + hdferr = h5pset_mpi_c(prp_id, comm, info) + END SUBROUTINE h5pset_mpi_f + + SUBROUTINE h5pget_mpi_f(prp_id, comm, info, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: comm ! buffer to return communicator + INTEGER, INTENT(IN) :: info ! buffer to return info object + ! as defined in MPI_FILE_OPEN of MPI-2 + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_mpi_c + hdferr = h5pget_mpi_c(prp_id, comm, info) + END SUBROUTINE h5pget_mpi_f + + SUBROUTINE h5pset_xfer_f(prp_id, data_xfer_mode, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: data_xfer_mode ! Data transfer mode. Possible values are: + ! H5D_XFER_INDEPENDENT_F (0) + ! H5D_XFER_COLLECTIVE_F (1) + ! H5D_XFER_DFLT_F (2) + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pset_xfer_c + hdferr = h5pset_xfer_c(prp_id, data_xfer_mode) + END SUBROUTINE h5pset_xfer_f + + SUBROUTINE h5pget_xfer_f(prp_id, data_xfer_mode, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(OUT) :: data_xfer_mode ! Data transfer mode. Possible values are: + ! H5D_XFER_INDEPENDENT_F (0) + ! H5D_XFER_COLLECTIVE_F (1) + ! H5D_XFER_DFLT_F (2) + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5pget_xfer_c + hdferr = h5pget_xfer_c(prp_id, data_xfer_mode) + END SUBROUTINE h5pget_xfer_f + + END MODULE H5P_parallel diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c new file mode 100644 index 0000000..16e0f4a --- /dev/null +++ b/fortran/src/H5Rf.c @@ -0,0 +1,267 @@ +#include "H5f90.h" + +/*---------------------------------------------------------------------------- + * Name: h5rcreate_object_c + * Purpose: Call H5Rcreate to create a reference to an object + * Inputs: loc_id - file or group identifier + * name - name of the dataset + * namelen - name length + * Outputs: ref - reference to the object + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, December 1, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen) +{ + int ret_value = -1; + hid_t c_loc_id; + int ret_value_c; + char *c_name; + int c_namelen; + hobj_ref_t ref_c; + int i; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Rcreate function. + */ + c_loc_id = *loc_id; + ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_OBJECT, -1); + HDfree(c_name); + if (ret_value_c >= 0) { + for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) + { +#if defined(_UNICOS) + ref.c_pointer[i]=ref_c.oid[i]; +#else + ref[i]=ref_c.oid[i]; +#endif + } + ret_value = 0; + } + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5rcreate_region_c + * Purpose: Call H5Rcreate to create a reference to dataset region + * region + * Inputs: loc_id - file or group identifier + * name - name of the dataset + * namelen - name length + * space_id - dataset space identifier + * Outputs: ref - reference to the dataset region + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, December 1, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id) +{ + int ret_value = -1; + hid_t c_loc_id; + hid_t c_space_id; + int ret_value_c; + char *c_name; + int c_namelen; + hdset_reg_ref_t ref_c; + int i; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Rcreate function. + */ + c_loc_id = *loc_id; + c_space_id = *space_id; + ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_DATASET_REGION, c_space_id); + HDfree(c_name); + if (ret_value_c >= 0) { + for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) + { +#if defined(_UNICOS) + ref.c_pointer[i]=ref_c.heapid[i]; +#else + ref[i]=ref_c.heapid[i]; +#endif + } + ret_value = 0; + } + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5rdereference_region_c + * Purpose: Call H5Rdereference to dereference to dataset region + * Inputs: dset_id - dataset identifier + * ref - reference to the dataset region + * Outputs: obj_id - dereferenced dataset identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, December 1, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) +{ + int ret_value = -1; + hid_t c_dset_id; + hdset_reg_ref_t ref_c; + hid_t c_obj_id; + int i; + + for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) { + +#if defined(_UNICOS) + ref_c.heapid[i]=ref.c_pointer[i]; +#else + ref_c.heapid[i]=ref[i]; +#endif + } + + /* + * Call H5Rdereference function. + */ + c_dset_id = *dset_id; + c_obj_id = H5Rdereference(c_dset_id, H5R_DATASET_REGION, &ref_c); + if(c_obj_id < 0) return ret_value; + *obj_id = (hid_t_f)c_obj_id; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5rdereference_object_c + * Purpose: Call H5Rdereference to dereference an object + * Inputs: dset_id - dataset identifier + * ref - reference to an object + * Outputs: obj_id - dereferenced object identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, December 1, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) +{ + int ret_value = -1; + hid_t c_dset_id; + hid_t c_obj_id; + hobj_ref_t ref_c; + int i; + + for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) { + +#if defined(_UNICOS) + ref_c.oid[i]=ref.c_pointer[i]; +#else + ref_c.oid[i]=ref[i]; +#endif + } + + /* + * Call H5Rdereference function. + */ + c_dset_id = *dset_id; + c_obj_id = H5Rdereference(c_dset_id, H5R_OBJECT, &ref_c); + if(c_obj_id < 0) return ret_value; + *obj_id = (hid_t_f)c_obj_id; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5rget_region_region_object_c + * Purpose: Call H5Rget_region to dereference dataspace region + * Inputs: dset_id - dataset identifier + * ref - reference to the dataset region + * Outputs: space_id - dereferenced dataset dataspace identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, December 1, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id) +{ + int ret_value = -1; + hid_t c_dset_id; + hid_t c_space_id; + hdset_reg_ref_t ref_c; + int i; + + for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) { + +#if defined(_UNICOS) + ref_c.heapid[i]=ref.c_pointer[i]; +#else + ref_c.heapid[i]=ref[i]; +#endif + } + + /* + * Call H5Rget_region function. + */ + c_dset_id = *dset_id; + c_space_id = H5Rget_region(c_dset_id, H5R_DATASET_REGION, &ref_c); + if(c_space_id < 0) return ret_value; + *space_id = (hid_t_f)c_space_id; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5rget_object_type_obj_c + * Purpose: Call H5Rget_object_type to retrieve the type of the object reference points + * to + * Inputs: dset_id - dataset identifier + * ref - reference to the dataset region + * Outputs: obj_type - type of dereferenced object + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, December 1, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5rget_object_type_obj_c (hid_t_f *dset_id, _fcd ref, int_f *obj_type) +{ + int ret_value = -1; + hid_t c_dset_id; + int c_obj_type; + hobj_ref_t ref_c; + int i; + + for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) { + +#if defined(_UNICOS) + ref_c.oid[i]=ref.c_pointer[i]; +#else + ref_c.oid[i]=ref[i]; +#endif + } + + /* + * Call H5Rget_object_type function. + */ + c_dset_id = *dset_id; + c_obj_type = H5Rget_object_type(c_dset_id, &ref_c); + if(c_obj_type < 0) return ret_value; + *obj_type = (int_f)c_obj_type; + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5Rff.f90 b/fortran/src/H5Rff.f90 new file mode 100644 index 0000000..3fd9142 --- /dev/null +++ b/fortran/src/H5Rff.f90 @@ -0,0 +1,138 @@ +! +! This file contains Fortran90 interfaces for H5R functions. +! + MODULE H5R + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + TYPE hobj_ref_t_f + !INTEGER(KIND=4) ref(2) could cause trouble on Crays + CHARACTER ref(8) + END TYPE + + TYPE hdset_reg_ref_t_f + !INTEGER(KIND=4) reg_ref(3) could cause troubles on Crays + CHARACTER ref(12) + END TYPE + + INTERFACE h5rcreate_f + + MODULE PROCEDURE h5rcreate_object_f + MODULE PROCEDURE h5rcreate_region_f + + END INTERFACE + + INTERFACE h5rdereference_f + + MODULE PROCEDURE h5rdereference_object_f + MODULE PROCEDURE h5rdereference_region_f + + END INTERFACE + + INTERFACE h5rget_region_f + + MODULE PROCEDURE h5rget_region_region_f + + END INTERFACE + + INTERFACE h5rget_object_type_f + + MODULE PROCEDURE h5rget_object_type_obj_f + + END INTERFACE + + + CONTAINS + + + SUBROUTINE h5rcreate_object_f(loc_id, name, ref, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! Location identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the object at location specified + ! by loc_id identifier + TYPE(hobj_ref_t_f), INTENT(OUT) :: ref ! Object reference + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Name length + INTEGER, EXTERNAL :: h5rcreate_object_c + namelen = LEN(name) + hdferr = h5rcreate_object_c(ref, loc_id, name, namelen ) + + END SUBROUTINE h5rcreate_object_f + + SUBROUTINE h5rcreate_region_f(loc_id, name, space_id, ref, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! Location identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the dataset at location specified + ! by loc_id identifier + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataset's dataspace identifier + TYPE(hdset_reg_ref_t_f), INTENT(OUT) :: ref ! Dataset region reference + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: namelen ! Name length + INTEGER, EXTERNAL :: h5rcreate_region_c + namelen = LEN(name) + hdferr = h5rcreate_region_c(ref, loc_id, name, namelen, space_id ) + + END SUBROUTINE h5rcreate_region_f + + SUBROUTINE h5rdereference_object_f(dset_id, ref, obj_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hobj_ref_t_f), INTENT(IN) :: ref ! Object reference + INTEGER(HID_T), INTENT(OUT) :: obj_id ! Object identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: ref_type ! Reference type + INTEGER, EXTERNAL :: h5rdereference_object_c + ref_type = H5R_OBJECT_F + hdferr = h5rdereference_object_c(dset_id, ref, obj_id ) + + END SUBROUTINE h5rdereference_object_f + + SUBROUTINE h5rdereference_region_f(dset_id, ref, obj_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Object reference + INTEGER(HID_T), INTENT(OUT) :: obj_id ! Object identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER :: ref_type ! Reference type + INTEGER, EXTERNAL :: h5rdereference_region_c + ref_type = H5R_DATASET_REGION_F + hdferr = h5rdereference_region_c(dset_id, ref, obj_id ) + + END SUBROUTINE h5rdereference_region_f + + + SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference + INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5rget_region_region_c + hdferr = h5rget_region_region_c(dset_id, ref, space_id ) + + END SUBROUTINE h5rget_region_region_f + + SUBROUTINE h5rget_object_type_obj_f(dset_id, ref, obj_type, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hobj_ref_t_f), INTENT(IN) :: ref ! Object reference + INTEGER, INTENT(OUT) :: obj_type ! Object type + ! H5G_UNKNOWN_F (-1) + ! H5G_LINK_F 0 + ! H5G_GROUP_F 1 + ! H5G_DATASET_F 2 + ! H5G_TYPE_F 3 + + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5rget_object_type_obj_c + hdferr = h5rget_object_type_obj_c(dset_id, ref, obj_type ) + + END SUBROUTINE h5rget_object_type_obj_f + + END MODULE H5R diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c new file mode 100644 index 0000000..af9c4a5 --- /dev/null +++ b/fortran/src/H5Sf.c @@ -0,0 +1,874 @@ +#include "H5f90.h" + +/*---------------------------------------------------------------------------- + * Name: h5screate_simple_c + * Purpose: Call H5Screate_simple to create a dataspace + * Inputs: rank - number of dimensions of dataspace + * dims - array of the size of each dimension + maxdims - an array of the maximum size of each dimension + * Outputs: space_id - identifier of the created dataspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 4, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5screate_simple_c ( int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id ) +{ + int ret_value = -1; + hsize_t *c_dims; + hsize_t *c_maxdims; + hid_t c_space_id; + int i; + + c_dims = malloc(sizeof(hsize_t) * (*rank )); + if (!c_dims) return ret_value; + c_maxdims = malloc(sizeof(hsize_t) * (*rank )); + if (!c_maxdims) return ret_value; + + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + for (i = 0; i < *rank ; i++) { + c_dims[i] = dims[*rank - i - 1]; + c_maxdims[i] = maxdims[*rank - i - 1]; + } + + c_space_id = H5Screate_simple(*rank, c_dims, c_maxdims); + if (c_space_id < 0) return ret_value; + + *space_id = (hid_t_f)c_space_id; + ret_value = 0; + HDfree (c_dims); + HDfree (c_maxdims); + return ret_value; +} + + + +/*---------------------------------------------------------------------------- + * Name: h5sclose_c + * Purpose: Call H5Sclose to close the dataspace + * Inputs: space_id - identifier of the dataspace to be closed + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 4, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sclose_c ( hid_t_f *space_id ) +{ + int ret_value = 0; + hid_t c_space_id; + + c_space_id = *space_id; + if ( H5Sclose(c_space_id) < 0 ) ret_value = -1; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5screate_c + * Purpose: Call H5Screate to create a dataspace + * Inputs: classtype - type of the dataspace class + * Outputs: space_id - identifier of the created dataspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 10, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5screate_c ( int_f *classtype, hid_t_f *space_id ) +{ + H5S_class_t c_classtype; + int CASE; + int ret_value = 0; + hid_t c_space_id; + CASE = (int)*classtype; + + switch (CASE) { + + case (H5S_SCALAR_F): + c_classtype = H5S_SCALAR; + break; + + case(H5S_SIMPLE_F): + c_classtype = H5S_SIMPLE; + break; + + default: + ret_value = -1; + return ret_value; + } + c_space_id = H5Screate(c_classtype); + + if ( c_space_id < 0 ) ret_value = -1; + *space_id = (hid_t_f) c_space_id; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5scopy_c + * Purpose: Call H5Scopy to copy dataspace + * Inputs: space_id - identifier of the dataspace to be copied + * Outputs: new_space_id - identifier of the new datspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 10, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5scopy_c( hid_t_f *space_id , hid_t_f *new_space_id) +{ + int ret_value = 0; + hid_t c_new_space_id; + hid_t c_space_id; + + c_space_id = *space_id; + c_new_space_id = H5Scopy(c_space_id); + if ( c_new_space_id < 0 ) ret_value = -1; + + *new_space_id = (hid_t_f)c_new_space_id; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_select_hyper_nblocks_c + * Purpose: Call H5SH5Sget_select_hyper_nblocks to + * get the the number of hyperslab blocks in + * the current dataspace selection if successful + * Inputs: space_id - identifier of the dataspace + * Outputs: num_blocks - number of hyperslab blocks in + * the current dataspace selection + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, November 12, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_select_hyper_nblocks_c( hid_t_f *space_id , hssize_t_f * num_blocks) +{ + int ret_value = 0; + hid_t c_space_id; + hssize_t c_num_blocks; + hsize_t* buf; + int i, j; + + c_space_id = *space_id; + c_num_blocks = H5Sget_select_hyper_nblocks(c_space_id); + if ( c_num_blocks < 0 ) ret_value = -1; + + *num_blocks = (hssize_t_f)c_num_blocks; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_select_elem_npoints_c + * Purpose: Call H5Sget_select_elem_npoints to + * get the the number of element points in + * the current dataspace selection if successful + * Inputs: space_id - identifier of the dataspace + * Outputs: num_points - number of element points in + * the current dataspace selection + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Monday, November 15, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points) +{ + int ret_value = 0; + hid_t c_space_id; + hssize_t c_num_points; + + c_space_id = *space_id; + c_num_points = H5Sget_select_elem_npoints(c_space_id); + if ( c_num_points < 0 ) ret_value = -1; + + *num_points = (hssize_t_f)c_num_points; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_select_hyper_blocklist_c + * Purpose: Call H5Sget_select_hyper_blocklist to + * get a list of the hyperslab blocks currently selected + * Starting with the startblock-th block in the + * list of blocks, num_blocks blocks are put into the user's + * buffer. If the user's buffer fills up before numblocks + * blocks are inserted, the buffer + * will contain only as many blocks as fit. + * Inputs: space_id - identifier of the dataspace + * startblock - Hyperslab block to start with + * num_blocks - number of hyperslab blocks in + * the current dataspace selection + * Outputs: buf - List of hyperslab blocks selected + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Monday, November 15, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, + hsize_t_f * num_blocks, hsize_t_f * buf) +{ + int ret_value = -1; + hid_t c_space_id; + hsize_t c_num_blocks; + + int i, rank; + hsize_t* c_startblock,* c_buf; + + c_space_id = *space_id; + c_num_blocks = * num_blocks; + + rank = H5Sget_simple_extent_ndims(c_space_id); + if (rank < 0 ) return ret_value; + + c_startblock = (hsize_t*)malloc(sizeof(hsize_t)*rank); + if (!c_startblock) return ret_value; + for (i = 0; i < rank; i++) + { + c_startblock[i] = (hsize_t)startblock[i]; + } + + c_buf = (hsize_t*)malloc(sizeof(hsize_t)*c_num_blocks*2*rank); + if (!c_buf) return ret_value; + + ret_value = H5Sget_select_hyper_blocklist(c_space_id, *c_startblock, + c_num_blocks, c_buf); + for(i = 0; i < c_num_blocks*2*rank; i++) + { + buf[i] = (hsize_t_f)c_buf[i] +1; + } + HDfree(c_buf); + HDfree(c_startblock); + if (ret_value >= 0 ) ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_select_bounds_c + * Purpose: Call H5Sget_select_bounds to retrieve the coordinates + * of the bounding box containing the current selection + * and places them into user-supplied buffers + * Inputs: space_id - identifier of the dataspace + * Outputs: start - Starting coordinates of the bounding box + * end - Ending coordinates of the bounding box, + * i.e., the coordinates of the diagonally opposite corne + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, November 17, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end) +{ + int ret_value = -1; + hid_t c_space_id; + hsize_t* c_start, *c_end; + int i, rank; + + c_space_id = *space_id; + rank = H5Sget_simple_extent_ndims(c_space_id); + if (rank < 0 ) return ret_value; + + c_start =(hsize_t*) malloc(sizeof(hsize_t)*rank); + if (!c_start) return ret_value; + + c_end = (hsize_t*)malloc(sizeof(hsize_t)*rank); + if(!c_end) return ret_value; + + ret_value = H5Sget_select_bounds(c_space_id, c_start, c_end); + for(i = 0; i < rank; i++) + { + start[i] = (hsize_t_f)(c_start[i]+1); + end[i] = (hsize_t_f)(c_end[i]+1); + } + if (ret_value >= 0 ) ret_value = 0; + + HDfree(c_start); + HDfree(c_end); + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_select_elem_pointlist_c + * Purpose: Call H5Sget_select_elem_pointlist + * get a list of element points in the + * current dataspace selectin. + * Starting with the startpoint-th point in the + * list of points, numpoints points are put into the user's + * buffer. If the user's buffer fills up before numpoints + * points are inserted, the buffer + * will contain only as many points as fit. + * Inputs: space_id - identifier of the dataspace + * startpoint - Element point to start with + * numpoints - Number of element points to get + * Outputs: buf - List of element points selected + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Wednesday, November 17, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint, + hsize_t_f * numpoints, hsize_t_f * buf) +{ + int ret_value = -1; + hid_t c_space_id; + hsize_t c_num_points; + hsize_t* c_startpoint,* c_buf; + int i,j, rank; + + c_space_id = *space_id; + c_num_points = (hsize_t)* numpoints; + + rank = H5Sget_simple_extent_ndims(c_space_id); + if (rank < 0 ) return ret_value; + + c_startpoint = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + if (!c_startpoint) return ret_value; + for (i =0; i < rank; i++) + c_startpoint[i] = (hsize_t)startpoint[i]; + + c_buf = (hsize_t*)malloc(sizeof(hsize_t)*c_num_points*rank); + if (!c_buf) return ret_value; + ret_value = H5Sget_select_elem_pointlist(c_space_id, *startpoint, + c_num_points, c_buf); + for (i = c_num_points*rank-1; i >= 0; i--) { + buf[i] = (hsize_t_f)(c_buf[i]+1); + } + + if (ret_value >= 0 ) ret_value = 0; + + HDfree(c_startpoint); + HDfree(c_buf); + + return ret_value; +} + + + +/*---------------------------------------------------------------------------- + * Name: h5sselect_all_c + * Purpose: Call H5Sselect_all to select entire dataspace + * Inputs: space_id - identifier of the dataspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 10, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sselect_all_c ( hid_t_f *space_id ) +{ + int ret_value = 0; + hid_t c_space_id; + + c_space_id = *space_id; + if ( H5Sselect_all(c_space_id) < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sselect_none_c + * Purpose: Call H5Sselect_none to reset the selection region + * Inputs: space_id - identifier of the dataspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 10, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sselect_none_c ( hid_t_f *space_id ) +{ + int ret_value = 0; + hid_t c_space_id; + + c_space_id = *space_id; + if ( H5Sselect_none(c_space_id) < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sselect_valid_c + * Purpose: Call H5Sselect_valid to verify that selection + * is within dataspace extent. + * Inputs: space_id - identifier of the dataspace + * Outputs: flag - 0 if not valid selection, 1 if is valid selection, + * and negative on failure. + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 10, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sselect_valid_c ( hid_t_f *space_id , int_f *flag ) +{ + int ret_value = 0; + hid_t c_space_id; + htri_t status; + + c_space_id = *space_id; + status = H5Sselect_valid(c_space_id); + *flag = (int_f)status; + if ( status < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_simple_extent_npoints_c + * Purpose: Call H5Sget_simple_extent_npoints to determine the number + * of elements in a dataspace + * Inputs: space_id - identifier of the dataspace + * Outputs: npoints - number of points in a dataspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_simple_extent_npoints_c ( hid_t_f *space_id , hsize_t_f *npoints ) +{ + int ret_value = 0; + hid_t c_space_id; + hsize_t c_npoints; + + c_space_id = *space_id; + c_npoints = H5Sget_simple_extent_npoints(c_space_id); + if ( c_npoints == 0 ) ret_value = -1; + *npoints = (hsize_t_f)c_npoints; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_select_npoints_c + * Purpose: Call H5Sget_select_npoints to determine the number + * of elements in a dataspace selection + * Inputs: space_id - identifier of the dataspace + * Outputs: npoints - number of points in a dataspace selection + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_select_npoints_c ( hid_t_f *space_id , hssize_t_f *npoints ) +{ + int ret_value = 0; + hssize_t c_npoints; + hid_t c_space_id; + + c_space_id = *space_id; + c_npoints = H5Sget_select_npoints(c_space_id); + if ( c_npoints == 0 ) ret_value = -1; + *npoints = (hssize_t_f)c_npoints; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_simple_extent_ndims_c + * Purpose: Call H5Sget_simple_extent_ndims to determine the number + * dimensions + * Inputs: space_id - identifier of the dataspace + * Outputs: rank - number of dataspace dimensions + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_simple_extent_ndims_c ( hid_t_f *space_id , int_f *ndims ) +{ + int ret_value = 0; + hid_t c_space_id; + int c_ndims; + + c_space_id = *space_id; + c_ndims = H5Sget_simple_extent_ndims(c_space_id); + if ( c_ndims < 0 ) ret_value = -1; + *ndims = (int_f)c_ndims; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_simple_extent_type_c + * Purpose: Call H5Sget_simple_extent_type to determine the class type + * of a dataspace + * Inputs: space_id - identifier of the dataspace + * Outputs: classtype - class type; possible values are: + * H5S_SCALAR_F (0), H5S_SIMPLE_F (1) + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_simple_extent_type_c ( hid_t_f *space_id , int_f *classtype) +{ + int ret_value = 0; + hid_t c_space_id; + H5S_class_t c_classtype; + + c_space_id = *space_id; + c_classtype = H5Sget_simple_extent_type(c_space_id); + if ( c_classtype < 0 ) ret_value = -1; + if (c_classtype == H5S_SCALAR) *classtype = H5S_SCALAR_F; + if (c_classtype == H5S_SIMPLE) *classtype = H5S_SIMPLE_F; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5soffset_simple_c + * Purpose: Call H5Soffset_simple to set the offset of a simple + * dataspace + * Inputs: space_id - identifier of the dataspace + * offset - offset array + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5soffset_simple_c ( hid_t_f *space_id , hssize_t_f *offset) +{ + int ret_value = -1; + hid_t c_space_id; + int rank; + hssize_t *c_offset; + herr_t status; + int i; + + c_space_id = *space_id; + rank = H5Sget_simple_extent_ndims(c_space_id); + if (rank < 0) return ret_value; + + c_offset = malloc(sizeof(hssize_t)*rank); + if (!c_offset) return ret_value; + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for (i=0; i < rank; i++) c_offset[i] = offset[rank - i - 1]; + + status = H5Soffset_simple(c_space_id, c_offset); + if ( status >= 0 ) ret_value = 0; + HDfree(c_offset); + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sset_extent_simple_c + * Purpose: Call H5Sset_extent_simple to set or reset size of + * existing dataspace + * Inputs: space_id - identifier of the dataspace + * rank - dataspace rank + * current_size - array with the new dimension sizes + * maximum_size - aray with maximum sizes of dimensions + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sset_extent_simple_c ( hid_t_f *space_id , int_f *rank, hsize_t_f *current_size, hsize_t_f *maximum_size) +{ + int ret_value = -1; + hid_t c_space_id; + int c_rank; + hsize_t *c_current_size; + hsize_t *c_maximum_size; + herr_t status; + int i; + + c_current_size = malloc(sizeof(hsize_t)*(*rank)); + if (!c_current_size) return ret_value; + + c_maximum_size = malloc(sizeof(hsize_t)*(*rank)); + if (!c_maximum_size) return ret_value; + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for (i=0; i < *rank; i++) { + c_current_size[i] = (hsize_t)current_size[*rank - i - 1]; + c_maximum_size[i] = (hsize_t)maximum_size[*rank - i - 1]; + } + + c_space_id = *space_id; + c_rank = *rank; + status = H5Sset_extent_simple(c_space_id, c_rank, c_current_size, c_maximum_size); + if ( status >= 0 ) ret_value = 0; + HDfree(c_current_size); + HDfree(c_maximum_size); + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sget_simple_extent_dims_c + * Purpose: Call H5Sget_simple_extent_dims to retrieve sizes of an + * existing dataspace + * Inputs: space_id - identifier of the dataspace + * Outputs: dims - array with the dimension sizes + * maxdims - aray with maximum sizes of dimensions + * Returns: number of dataspace dimensions (rank) on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sget_simple_extent_dims_c ( hid_t_f *space_id , hsize_t_f *dims, hsize_t_f *maxdims) +{ + int ret_value = -1; + hid_t c_space_id; + hsize_t *c_dims; + hsize_t *c_maxdims; + int status; + int rank; + int i; + + c_space_id = *space_id; + rank = H5Sget_simple_extent_ndims(c_space_id); + if (rank < 0) return ret_value; + + c_dims = malloc(sizeof(hsize_t)*rank); + if (!c_dims) return ret_value; + + c_maxdims = malloc(sizeof(hsize_t)*rank); + if (!c_maxdims) return ret_value; + + status = H5Sget_simple_extent_dims(c_space_id, c_dims, c_maxdims); + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + for (i=0; i < rank; i++) { + dims[rank - i - 1] = (hsize_t_f)c_dims[i]; + maxdims[rank - i - 1] = (hsize_t_f)c_maxdims[i]; + } + + if ( status >= 0 ) ret_value = rank; + HDfree(c_dims); + HDfree(c_maxdims); + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sis_simple_c + * Purpose: Call H5Sis_simple to detrmine if the dataspace + * is simple. + * Inputs: space_id - identifier of the dataspace + * Outputs: flag - 0 if not simple, 1 if is simple, + * and negative on failure. + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sis_simple_c ( hid_t_f *space_id , int_f *flag ) +{ + int ret_value = 0; + hid_t c_space_id; + htri_t status; + + c_space_id = *space_id; + status = H5Sis_simple(c_space_id); + *flag = (int_f)status; + if ( status < 0 ) ret_value = -1; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5sextent_copy_c + * Purpose: Call H5Sextent_copy to copy an extent of dataspace + * Inputs: dest_space_id - identifier of the destination dataspace + * source_space_id - identifier of the source dataspace + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sextent_copy_c ( hid_t_f *dest_space_id , hid_t_f *source_space_id) +{ + int ret_value = 0; + hid_t c_dest_space_id, c_source_space_id; + herr_t status; + + c_dest_space_id = *dest_space_id; + c_source_space_id = *source_space_id; + status = H5Sextent_copy(c_dest_space_id, c_source_space_id); + if ( status < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sset_extent_none_c + * Purpose: Call H5Sset_extent_none to remove extent from a dataspace + * Inputs: space_id - dataspace identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sset_extent_none_c ( hid_t_f *space_id ) +{ + int ret_value = 0; + hid_t c_space_id; + herr_t status; + + c_space_id = *space_id; + status = H5Sset_extent_none(c_space_id); + if ( status < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5sselect_hyperslab_c + * Purpose: Call H5Sselect_hyperslab to select a hyperslab + * Inputs: space_id - identifier of the dataspace + * operator - defines how the new selection is combined + * with the previous one; current values are + * H5S_SELECT_SET_F (0) and H5S_SELECT_OR_F (1) + * start - offset of start of hyperslab + * count - number of blocks included in the hyperslab + * stride - hyperslab stride (interval between blocks) + * block - size of block in the hyperslab + * maximum_size - aray with maximum sizes of dimensions + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block) +{ + int ret_value = -1; + hid_t c_space_id; + hssize_t *c_start; + hsize_t *c_count; + hsize_t *c_stride; + hsize_t *c_block; + + H5S_seloper_t c_op; + herr_t status; + int rank; + int i; + + rank = H5Sget_simple_extent_ndims(*space_id); + if (rank < 0 ) return ret_value; + c_start = (hssize_t *)HDmalloc(sizeof(hssize_t)*rank); + if (!c_start) return ret_value; + + c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + if (!c_count) return ret_value; + + c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + if (!c_stride) return ret_value; + + c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + if (!c_block) return ret_value; + + + /* + * Reverse dimensions due to C-FORTRAN storage order. + */ + + for (i=0; i < rank; i++) { + int t= (rank - i) - 1; + c_start[i] = (hssize_t)start[t]; + c_count[i] = (hsize_t)count[t]; + c_stride[i] = (hsize_t)stride[t]; + c_block[i] = (hsize_t)block[t]; + } + + if (*op == H5S_SELECT_SET_F) c_op = H5S_SELECT_SET; + if (*op == H5S_SELECT_OR_F) c_op = H5S_SELECT_OR; + + + c_space_id = *space_id; + status = H5Sselect_hyperslab(c_space_id, c_op, c_start, c_stride, c_count, c_block); + if ( status >= 0 ) ret_value = 0; + HDfree(c_start); + HDfree(c_count); + HDfree(c_stride); + HDfree(c_block); + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5sselect_elements_c + * Purpose: Call H5Sselect_elements to select elements of a dataspace + * Inputs: space_id - identifier of the dataspace + * operator - defines how the new selection is combined + * with the previous one; current values are + * H5S_SELECT_SET_F (0) + * nelements - number of elements in the selection + * coord - arrays with the elements coordinates + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Wednesday, August 11, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hssize_t_f *coord) +{ + int ret_value = -1; + hid_t c_space_id; + H5S_seloper_t c_op; + herr_t status; + int rank; + int i, j; + hssize_t *c_coord; + size_t c_nelements; + + if (*op != H5S_SELECT_SET_F) return ret_value; + c_op = H5S_SELECT_SET; + + c_space_id = *space_id; + rank = H5Sget_simple_extent_ndims(c_space_id); + + c_coord = malloc(sizeof(hssize_t)*rank*(*nelements)); + if(!c_coord) return ret_value; + for (i=0; i< *nelements; i++) { + for (j = 0; j < rank; j++) { + c_coord[j+i*rank] = (hssize_t)coord[j + i*rank]; + } + } + + c_nelements = *nelements; + status = H5Sselect_elements(c_space_id, c_op, c_nelements, (const hssize_t **)c_coord); + if ( status >= 0 ) ret_value = 0; + HDfree(c_coord); + return ret_value; +} + diff --git a/fortran/src/H5Sff.f90 b/fortran/src/H5Sff.f90 new file mode 100644 index 0000000..d4b6b2f --- /dev/null +++ b/fortran/src/H5Sff.f90 @@ -0,0 +1,460 @@ +! +! This file contains Fortran90 interfaces for H5S functions. +! + MODULE H5S + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + CONTAINS + + + SUBROUTINE h5screate_simple_f(rank, dims, space_id, hdferr, maxdims) + + IMPLICIT NONE + INTEGER, INTENT(IN) :: rank ! Number of dataspace dimensions + INTEGER(HSIZE_T), INTENT(IN) :: dims(rank) + ! Array with the dimension + ! sizes + INTEGER(HID_T), INTENT(OUT) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HSIZE_T), OPTIONAL, INTENT(IN) :: maxdims(rank) + ! Array with the maximum + ! dimension sizes + INTEGER(HSIZE_T), ALLOCATABLE, DIMENSION(:) :: f_maxdims + INTEGER, EXTERNAL :: h5screate_simple_c + + allocate (f_maxdims(rank), stat=hdferr) + if (hdferr .NE. 0) then + hdferr = -1 + return + endif + if (present(maxdims)) then + f_maxdims = maxdims + else + f_maxdims = dims + endif + hdferr = h5screate_simple_c(rank, dims, f_maxdims, space_id) + deallocate(f_maxdims) + + END SUBROUTINE h5screate_simple_f + + SUBROUTINE h5sclose_f(space_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sclose_c + + hdferr = h5sclose_c(space_id) + + END SUBROUTINE h5sclose_f + + SUBROUTINE h5screate_f(classtype, space_id, hdferr) + + IMPLICIT NONE + INTEGER, INTENT(IN) :: classtype ! The type of the dataspace + ! to be created. + ! Possible values are: + ! H5S_SCALAR_F (0) + ! H5S_SIMPLE_F(1) + INTEGER(HID_T), INTENT(OUT) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5screate_c + hdferr = h5screate_c(classtype, space_id) + + END SUBROUTINE h5screate_f + + + SUBROUTINE h5scopy_f(space_id, new_space_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HID_T), INTENT(OUT) :: new_space_id + ! Identifier of dataspace's copy + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5scopy_c + hdferr = h5scopy_c(space_id, new_space_id) + + END SUBROUTINE h5scopy_f + + SUBROUTINE h5sget_select_hyper_nblocks_f(space_id, num_blocks, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSSIZE_T), INTENT(OUT) :: num_blocks + !number of hyperslab blocks + !in the current dataspace + !selection + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_select_hyper_nblocks_c + hdferr = h5sget_select_hyper_nblocks_c (space_id, num_blocks) + + END SUBROUTINE h5sget_select_hyper_nblocks_f + + SUBROUTINE h5sget_select_hyper_blocklist_f(space_id, startblock, & + num_blocks, buf, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: startblock + !Hyperslab block to start with. + INTEGER(HSIZE_T), INTENT(IN) :: num_blocks + !number of hyperslab blocks + !to get in the current dataspace + !selection + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: buf + !List of hyperslab blocks selected + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5sget_select_hyper_blocklist_c + + hdferr = h5sget_select_hyper_blocklist_c(space_id, startblock, & + num_blocks, buf ) + + END SUBROUTINE h5sget_select_hyper_blocklist_f + + SUBROUTINE h5sget_select_bounds_f(space_id, start, end, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start + !Starting coordinates of the bounding box. + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: end + !Ending coordinates of the bounding box, + !i.e., the coordinates of the diagonally + !opposite corner + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_select_bounds_c + hdferr = h5sget_select_bounds_c(space_id, start, end) + + END SUBROUTINE h5sget_select_bounds_f + + SUBROUTINE h5sget_select_elem_npoints_f(space_id, num_points, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSSIZE_T), INTENT(OUT) :: num_points + !number of element points + !in the current dataspace + !selection + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_select_elem_npoints_c + hdferr = h5sget_select_elem_npoints_c (space_id, num_points) + + END SUBROUTINE h5sget_select_elem_npoints_f + + SUBROUTINE h5sget_select_elem_pointlist_f(space_id, startpoint, & + num_points, buf, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSIZE_T),DIMENSION(*), INTENT(IN) :: startpoint + !Element point to start with. + INTEGER(HSIZE_T), INTENT(IN) :: num_points + !Number of element points to get + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: buf + !List of element points selected + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_select_elem_pointlist_c + hdferr = h5sget_select_elem_pointlist_c(space_id, startpoint, & + num_points, buf ) + END SUBROUTINE h5sget_select_elem_pointlist_f + + SUBROUTINE h5sselect_elements_f(space_id, operator, rank, & + num_elements, coord, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(IN) :: operator ! Flag, valid values are: + ! H5S_SELECT_SET_F (0) + ! H5S_SELECT_OR_F (1) + INTEGER, INTENT(IN) :: rank ! Number of dataspace dimensions + INTEGER(SIZE_T), INTENT(IN) :: num_elements ! Number of elements to be + ! selected + INTEGER(HSSIZE_T), & + DIMENSION(rank,num_elements), INTENT(IN) :: coord + ! Array with the coordinates + ! of the selected elements + ! coord(rank, num_elements) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sselect_elements_c + INTEGER(HSSIZE_T), ALLOCATABLE, DIMENSION(:,:) :: c_coord + INTEGER :: error, i,j + allocate(c_coord(rank, num_elements), stat = error) + if (error.NE. 0) then + hdferr = -1 + return + endif + do i = 1, rank + c_coord(i,:) = coord(rank-i+1, :) - 1 + enddo + hdferr = h5sselect_elements_c(space_id, operator, num_elements, & + c_coord) + deallocate(c_coord) + + END SUBROUTINE h5sselect_elements_f + + + SUBROUTINE h5sselect_all_f(space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sselect_all_c + hdferr = h5sselect_all_c(space_id) + + END SUBROUTINE h5sselect_all_f + + + SUBROUTINE h5sselect_none_f(space_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sselect_none_c + hdferr = h5sselect_none_c(space_id) + + END SUBROUTINE h5sselect_none_f + + + + SUBROUTINE h5sselect_valid_f(space_id, status, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + LOGICAL, INTENT(OUT) :: status ! TRUE if the selection is + ! contained within the extent, + ! FALSE otherwise. + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: flag ! "TRUE/FALSE/ERROR" flag from C routine + INTEGER, EXTERNAL :: h5sselect_valid_c + hdferr = h5sselect_valid_c(space_id, flag) + status = .TRUE. + if (flag .EQ. 0) status = .FALSE. + + END SUBROUTINE h5sselect_valid_f + + + SUBROUTINE h5sget_simple_extent_npoints_f(space_id, npoints, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSIZE_T), INTENT(OUT) :: npoints ! Number of elements in + ! dataspace + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_simple_extent_npoints_c + hdferr = h5sget_simple_extent_npoints_c( space_id, npoints) + + END SUBROUTINE h5sget_simple_extent_npoints_f + + + SUBROUTINE h5sget_select_npoints_f(space_id, npoints, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSSIZE_T), INTENT(OUT) :: npoints ! Number of elements in the + ! selection + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_select_npoints_c + hdferr = h5sget_select_npoints_c(space_id, npoints) + + END SUBROUTINE h5sget_select_npoints_f + + + SUBROUTINE h5sget_simple_extent_ndims_f(space_id, rank, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: rank ! Number of dimensions + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_simple_extent_ndims_c + hdferr = h5sget_simple_extent_ndims_c(space_id, rank) + + END SUBROUTINE h5sget_simple_extent_ndims_f + + + SUBROUTINE h5sget_simple_extent_dims_f(space_id, dims, maxdims, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: dims + ! Array to store dimension sizes + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: maxdims + ! Array to store max dimension + ! sizes + INTEGER, INTENT(OUT) :: hdferr ! Error code: -1 on failure, + ! number of dimensions on + ! on success + INTEGER, EXTERNAL :: h5sget_simple_extent_dims_c + hdferr = h5sget_simple_extent_dims_c(space_id, dims, maxdims) + + END SUBROUTINE h5sget_simple_extent_dims_f + + + SUBROUTINE h5sget_simple_extent_type_f(space_id, classtype, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: classtype ! Class type , possible values + ! are: + ! H5S_NO_CLASS_F (-1) + ! H5S_SCALAR_F (0) + ! H5S_SIMPLE_F (1) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sget_simple_extent_type_c + hdferr = h5sget_simple_extent_type_c(space_id, classtype) + + END SUBROUTINE h5sget_simple_extent_type_f + + + SUBROUTINE h5sset_extent_simple_f(space_id, rank, current_size, & + maximum_size, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(IN) :: rank ! Dataspace rank + INTEGER(HSIZE_T), DIMENSION(rank), INTENT(IN) :: current_size + ! Array with the new sizes + ! of dimensions + INTEGER(HSIZE_T), DIMENSION(rank), INTENT(IN) :: maximum_size + ! Array with the new maximum + ! sizes of dimensions + ! sizes + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sset_extent_simple_c + hdferr = h5sset_extent_simple_c(space_id, rank, current_size, & + maximum_size) + + END SUBROUTINE h5sset_extent_simple_f + + + SUBROUTINE h5sis_simple_f(space_id, status, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + LOGICAL, INTENT(OUT) :: status ! Flag, idicates if dataspace + ! is simple or not ( TRUE or + ! FALSE) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: flag ! "TRUE/FALSE/ERROR from C" + INTEGER, EXTERNAL :: h5sis_simple_c + hdferr = h5sis_simple_c(space_id, flag) + status = .TRUE. + if (flag .EQ. 0) status = .FALSE. + + END SUBROUTINE h5sis_simple_f + + SUBROUTINE h5soffset_simple_f(space_id, offset, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) :: offset + ! The offset at which to position + ! the selection + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5soffset_simple_c + hdferr = h5soffset_simple_c(space_id, offset) + + END SUBROUTINE h5soffset_simple_f + + + SUBROUTINE h5sextent_copy_f(dest_space_id, source_space_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dest_space_id ! Identifier of destination + ! dataspace + INTEGER(HID_T), INTENT(IN) :: source_space_id ! Identifier of source + ! dataspace + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sextent_copy_c + hdferr = h5sextent_copy_c(dest_space_id, source_space_id) + + END SUBROUTINE h5sextent_copy_f + + + SUBROUTINE h5sset_extent_none_f(space_id, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5sset_extent_none_c + hdferr = h5sset_extent_none_c(space_id) + + END SUBROUTINE h5sset_extent_none_f + + + SUBROUTINE h5sselect_hyperslab_f(space_id, operator, start, count, & + hdferr, stride, block) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier + INTEGER, INTENT(IN) :: operator ! Flag, valid values are: + ! H5S_SELECT_SET_F (0) + ! H5S_SELECT_OR_F (1) + ! + INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) :: start + ! Starting coordinates of the hyperslab + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count + ! Number of blocks to select + ! from dataspace + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HSIZE_T), DIMENSION(:), OPTIONAL, INTENT(IN) :: stride + ! Array of how many elements to move + ! in each direction + INTEGER(HSIZE_T), DIMENSION(:), OPTIONAL, INTENT(IN) :: block + ! Sizes of element block + INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE :: def_block + INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE :: def_stride + INTEGER, EXTERNAL :: h5sselect_hyperslab_c + INTEGER :: rank + INTEGER :: error1, error2 + if (present(stride).and. present(block)) then + hdferr = h5sselect_hyperslab_c(space_id, operator, start, count, & + stride, block) + return + endif + ! Case of optional parameters. + ! + ! Find the rank of the dataspace to allocate memery for + ! default stride and block arrays. + ! + CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr) + if( hdferr .EQ. -1) return + ! + if (present(stride).and. .not.present(block)) then + allocate(def_block(rank), stat=error1) + if (error1.NE.0) then + hdferr = -1 + return + endif + def_block = 1 + hdferr = h5sselect_hyperslab_c(space_id, operator, start, count, & + stride, def_block) + deallocate(def_block) + return + endif + + if (.not.present(stride).and. present(block)) then + allocate(def_stride(rank), stat=error2) + if (error2.NE.0) then + hdferr = -1 + return + endif + def_stride = 1 + hdferr = h5sselect_hyperslab_c(space_id, operator, start, count, & + def_stride, block) + deallocate(def_stride) + return + endif + allocate(def_block(rank), stat=error1) + allocate(def_stride(rank), stat=error2) + if ((error1.NE.0) .OR. (error2.NE.0)) then + hdferr = -1 + return + endif + def_block = 1 + def_stride = 1 + hdferr = h5sselect_hyperslab_c(space_id, operator, start, count, & + def_stride, def_block) + deallocate(def_block) + deallocate(def_stride) + + END SUBROUTINE h5sselect_hyperslab_f + + END MODULE H5S diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c new file mode 100644 index 0000000..d097936 --- /dev/null +++ b/fortran/src/H5Tf.c @@ -0,0 +1,1543 @@ +#include "H5f90.h" + + +/*---------------------------------------------------------------------------- + * Name: h5topen_c + * Purpose: Call H5Topen to open a datatype + * Inputs: loc_id - file or group identifier + * name - name of the datatype within file or group + * namelen - name length + * Outputs: type_id - dataset identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_type_id; + hid_t c_loc_id; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Topen function. + */ + c_loc_id = *loc_id; + c_type_id = H5Topen(c_loc_id, c_name); + + if (c_type_id < 0) return ret_value; + *type_id = (hid_t_f)c_type_id; + HDfree(c_name); + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tcommit_c + * Purpose: Call H5Tcommit to commit a datatype + * Inputs: loc_id - file or group identifier + * name - name of the datatype within file or group + * namelen - name length + * type_id - dataset identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5tcommit_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id) +{ + int ret_value = -1; + char *c_name; + int c_namelen; + hid_t c_type_id; + hid_t c_loc_id; + herr_t status; + + /* + * Convert FORTRAN name to C name + */ + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + /* + * Call H5Tcommit function. + */ + c_loc_id = *loc_id; + c_type_id = *type_id; + status = H5Tcommit(c_loc_id, c_name, c_type_id); + HDfree(c_name); + if (status < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tclose_c + * Purpose: Call H5Tclose to close the datatype + * Inputs: type_id - identifier of the datatype to be closed + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tclose_c ( hid_t_f *type_id ) +{ + int ret_value = 0; + hid_t c_type_id; + + c_type_id = *type_id; + if ( H5Tclose(c_type_id) < 0 ) ret_value = -1; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tcopy_c + * Purpose: Call H5Tcopy to copy a datatype + * Inputs: type_id - identifier of the datatype to be copied + * Outputs: new_type_id - identifier of the new datatype + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tcopy_c ( hid_t_f *type_id , hid_t_f *new_type_id) +{ + int ret_value = 0; + hid_t c_type_id; + hid_t c_new_type_id; + + c_type_id = *type_id; + c_new_type_id = H5Tcopy(c_type_id); + if ( c_new_type_id < 0 ) ret_value = -1; + *new_type_id = (hid_t_f)c_new_type_id; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tequal_c + * Purpose: Call H5Tequal to copy a datatype + * Inputs: type1_id - datatype identifier + * type2_id - datatype identifier + * Outputs: c_flag - flag; indicates if two datatypes are equal or not. + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, February 22, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tequal_c ( hid_t_f *type1_id , hid_t_f *type2_id, int_f *c_flag) +{ + int ret_value = -1; + hid_t c_type1_id, c_type2_id; + htri_t status; + + c_type1_id = *type1_id; + c_type2_id = *type2_id; + status = H5Tequal(c_type1_id, c_type2_id); + if ( status < 0 ) return ret_value; + *c_flag = (int_f)status; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tget_class_c + * Purpose: Call H5Tget_class to determine the datatype class + * Inputs: type_id - identifier of the dataspace + * Outputs: classtype - class type; possible values are: + * H5T_NO_CLASS_F (-1) + * H5T_INTEGER_F (0) + * H5T_FLOAT_F (1) + * H5T_TIME_F (2) + * H5T_STRING_F (3) + * H5T_BITFIELD_F (4) + * H5T_OPAQUE_F (5) + * H5T_COMPOUNDF (6) + * H5T_REFERENCE_F (7) + * H5T_ENUMF (8) + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_class_c ( hid_t_f *type_id , int_f *classtype) +{ + int ret_value = 0; + hid_t c_type_id; + H5T_class_t c_classtype; + + c_type_id = *type_id; + c_classtype = H5Tget_class(c_type_id); + if (c_classtype == H5T_NO_CLASS ) { + *classtype = H5T_NO_CLASS_F; + ret_value = -1; + return ret_value; + } + if (c_classtype == H5T_INTEGER) *classtype = H5T_INTEGER_F; + if (c_classtype == H5T_FLOAT) *classtype = H5T_FLOAT_F; + if (c_classtype == H5T_TIME) *classtype = H5T_TIME_F; + if (c_classtype == H5T_STRING) *classtype = H5T_STRING_F; + if (c_classtype == H5T_BITFIELD) *classtype = H5T_BITFIELD_F; + if (c_classtype == H5T_OPAQUE) *classtype = H5T_OPAQUE_F; + if (c_classtype == H5T_COMPOUND) *classtype = H5T_COMPOUND_F; + if (c_classtype == H5T_REFERENCE) *classtype = H5T_REFERENCE_F; + if (c_classtype == H5T_ENUM) *classtype = H5T_ENUM_F; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_order_c + * Purpose: Call H5Tget_order to determine byte order + * Inputs: type_id - identifier of the dataspace + * Outputs: order; possible values are: + * H5T_ORDER_LE_F (0) + * H5T_ORDER_BE_F (1) + * H5T_ORDER_VAX_F (2) + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_order_c ( hid_t_f *type_id , int_f *order) +{ + int ret_value = -1; + hid_t c_type_id; + H5T_order_t c_order; + + c_type_id = *type_id; + c_order = H5Tget_order(c_type_id); + if ( c_order < 0 ) return ret_value; + if ( c_order == H5T_ORDER_LE) *order = H5T_ORDER_LE_F; + if ( c_order == H5T_ORDER_BE) *order = H5T_ORDER_BE_F; + if ( c_order == H5T_ORDER_VAX) *order = H5T_ORDER_VAX_F; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tset_order_c + * Purpose: Call H5Tset_order to set byte order + * Inputs: type_id - identifier of the dataspace + * order; possible values are: + * H5T_ORDER_LE_F (0) + * H5T_ORDER_BE_F (1) + * H5T_ORDER_VAX_F (2) + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_order_c ( hid_t_f *type_id , int_f *order) +{ + int ret_value = 0; + hid_t c_type_id; + H5T_order_t c_order; + herr_t status; + + if ( *order == H5T_ORDER_LE_F) c_order = H5T_ORDER_LE; + if ( *order == H5T_ORDER_BE_F) c_order = H5T_ORDER_BE; + if ( *order == H5T_ORDER_VAX_F) c_order = H5T_ORDER_VAX; + c_type_id = *type_id; + status = H5Tset_order(c_type_id, c_order); + if ( status < 0 ) ret_value = -1; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_size_c + * Purpose: Call H5Tget_size to get size of the datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: size (in bytes) + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_size_c ( hid_t_f *type_id , size_t_f *size) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_size; + + c_type_id = *type_id; + c_size = H5Tget_size(c_type_id); + if ( c_size == 0 ) return ret_value; + *size = (size_t_f)c_size ; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_size_c + * Purpose: Call H5Tget_size to get size of the datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: size (in bytes) + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Saturday, August 14, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_size_c ( hid_t_f *type_id , size_t_f *size) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_size; + herr_t status; + + c_size = (size_t)*size; + c_type_id = *type_id; + status = H5Tset_size(c_type_id, c_size); + if ( status < 0 ) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_precision_c + * Purpose: Call H5Tget_precision to get precision of the datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: precision - number of significant bits + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Tuesday, January 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_precision_c ( hid_t_f *type_id , size_t_f *precision) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_precision; + + c_type_id = *type_id; + c_precision = H5Tget_precision(c_type_id); + if ( c_precision == 0 ) return ret_value; + *precision = (size_t_f)c_precision ; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_precision_c + * Purpose: Call H5Tset_precision to set precision of the datatype + * Inputs: type_id - identifier of the dataspace + * precision - number of significant bits + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Tuesday, January 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_precision_c ( hid_t_f *type_id , size_t_f *precision) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_precision; + herr_t status; + + c_type_id = *type_id; + c_precision = (size_t)*precision; + status = H5Tset_precision(c_type_id, c_precision); + if ( status < 0 ) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_offset_c + * Purpose: Call H5Tget_offset to get bit offset of the first + * significant bit of the datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: offset - bit offset of the first significant bit + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Tuesday, January 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_offset_c ( hid_t_f *type_id , size_t_f *offset) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_offset; + + c_type_id = *type_id; + c_offset = H5Tget_offset(c_type_id); + if ( c_offset == 0 ) return ret_value; + + *offset = (size_t_f)c_offset ; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_offset_c + * Purpose: Call H5Tset_offset to set bit offset of the first + * significant bit of the datatype + * Inputs: type_id - identifier of the dataspace + * offset - bit offset of the first significant bit + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Tuesday, January 25, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_offset_c ( hid_t_f *type_id , size_t_f *offset) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_offset; + herr_t status; + + c_offset = (size_t)*offset; + c_type_id = *type_id; + status = H5Tset_offset(c_type_id, c_offset); + if ( status < 0 ) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_pad_c + * Purpose: Call H5Tget_pad to get the padding type of the least and + * most-significant bit padding + * + * Inputs: type_id - identifier of the dataspace + * Outputs: lsbpad - padding type of the least significant bit + * msbpad - padding type of the least significant bit + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_pad_c ( hid_t_f *type_id , int_f * lsbpad, int_f * msbpad) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_pad_t c_lsb, c_msb; + + c_type_id = *type_id; + status = H5Tget_pad(c_type_id, &c_lsb, &c_msb); + if ( status < 0 ) return ret_value; + + *lsbpad = (int_f) c_lsb; + *msbpad = (int_f) c_msb; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_pad_c + * Inputs: type_id - identifier of the dataspace + * Purpose: Call H5Tset_pad to set the padding type of the least and + * most-significant bit padding + * + * Inputs: type_id - identifier of the dataspace + * lsbpad - padding type of the least significant bit + * msbpad - padding type of the least significant bit + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_pad_c ( hid_t_f *type_id, int_f * lsbpad, int_f* msbpad ) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_pad_t c_lsb, c_msb; + + c_type_id = *type_id; + c_lsb = (H5T_pad_t)*lsbpad; + c_msb = (H5T_pad_t)*msbpad; + status = H5Tset_pad(c_type_id, c_lsb, c_msb); + if ( status < 0 ) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_sign_c + * Purpose: Call H5Tget_sign to get sign type for an integer type + * Inputs: type_id - identifier of the dataspace + * Outputs: sign - sign type for an integer type + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_sign_c ( hid_t_f *type_id , int_f *sign) +{ + int ret_value = -1; + hid_t c_type_id; + H5T_sign_t c_sign; + + c_type_id = *type_id; + c_sign = H5Tget_sign(c_type_id); + if ( c_sign == -1 ) return ret_value; + *sign = (int_f)c_sign ; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_sign_c + * Purpose: Call H5Tset_sign to set sign type for an integer type + * Inputs: type_id - identifier of the dataspace + * sign - sign type for an integer typ + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_sign_c ( hid_t_f *type_id , int_f* sign) +{ + int ret_value = -1; + hid_t c_type_id; + H5T_sign_t c_sign; + herr_t status; + + c_type_id = *type_id; + c_sign = (H5T_sign_t)*sign; + status = H5Tset_sign(c_type_id, c_sign); + if ( status < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_fields_c + * Purpose: Call H5Tget_fields to get floating point datatype + * bit field information + * Inputs: type_id - identifier of the dataspace + * Outputs: epos - exponent bit-position + * esize - size of exponent in bits + * mpos - mantissa bit-position + * msize - size of mantissa in bits + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, January 27, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_fields_c ( hid_t_f *type_id , size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + size_t c_spos, c_epos, c_esize, c_mpos, c_msize; + + c_type_id = *type_id; + status = H5Tget_fields(c_type_id, &c_spos, &c_epos, &c_esize, &c_mpos, &c_msize); + if ( status < 0 ) return ret_value; + *spos = (size_t_f) c_spos; + *epos = (size_t_f) c_epos; + *esize = (size_t_f) c_esize; + *mpos = (size_t_f) c_mpos; + *msize = (size_t_f) c_msize; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_fields_c + * Purpose: Call H5Tset_fields to set floating point datatype + * bit field information + * Inputs: type_id - identifier of the dataspace + * epos - exponent bit-position + * esize - size of exponent in bits + * mpos - mantissa bit-position + * msize - size of mantissa in bits + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_fields_c ( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + size_t c_spos, c_epos, c_esize, c_mpos, c_msize; + + c_spos = (size_t)*spos; + c_epos = (size_t)*epos; + c_esize = (size_t)*esize; + c_mpos = (size_t)*mpos; + c_msize = (size_t)*msize; + c_type_id = *type_id; + status = H5Tset_fields(c_type_id, c_spos, c_epos, c_esize, c_mpos, c_msize); + if ( status < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_ebias_c + * Purpose: Call H5Tget_ebias to get exponent bias of a + * floating-point type of the datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: ebias - exponent bias of a floating-point type of the datatype + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, January 27, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_ebias_c ( hid_t_f *type_id , size_t_f *ebias) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_ebias; + + c_type_id = *type_id; + c_ebias = H5Tget_ebias(c_type_id); + if ( c_ebias == 0 ) return ret_value; + + *ebias = (size_t_f)c_ebias; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_ebias_c + * Purpose: Call H5Tset_ebias to set exponent bias of a + * floating-point type of the datatype + * Inputs: type_id - identifier of the dataspace + * ebias - exponent bias of a floating-point type of the datatyp + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, January 27, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_ebias_c ( hid_t_f *type_id , size_t_f *ebias) +{ + int ret_value = -1; + hid_t c_type_id; + size_t c_ebias; + herr_t status; + + c_type_id = *type_id; + c_ebias = (size_t)*ebias; + status = H5Tset_ebias(c_type_id, c_ebias); + if ( status < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_norm_c + * Purpose: Call H5Tget_norm to get mantissa normalization + * of a floating-point datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: norm - mantissa normalization of a floating-point type + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, January 27, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_norm_c ( hid_t_f *type_id , int_f *norm) +{ + int ret_value = -1; + hid_t c_type_id; + H5T_norm_t c_norm; + + c_type_id = *type_id; + c_norm = H5Tget_norm(c_type_id); + if ( c_norm == 0 ) return ret_value; + + *norm = (size_t_f)c_norm; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_norm_c + * Purpose: Call H5Tset_norm to set mantissa normalization of + * floating-point type of the datatype + * Inputs: type_id - identifier of the dataspace + * norm - mantissa normalization of a floating-point type + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Friday, January 27, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_norm_c ( hid_t_f *type_id , int_f *norm) +{ + int ret_value = -1; + hid_t c_type_id; + H5T_norm_t c_norm; + herr_t status; + + c_type_id = *type_id; + c_norm = (H5T_norm_t)*norm; + status = H5Tset_norm(c_type_id, c_norm); + if ( status < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_inpad_c + * Purpose: Call H5Tget_inpad to get the padding type for + * unused bits in floating-point datatypes + * + * Inputs: type_id - identifier of the dataspace + * Outputs: padtype - padding type for + * unused bits in floating-point datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_inpad_c ( hid_t_f *type_id , int_f * padtype) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_pad_t c_padtype; + + c_type_id = *type_id; + c_padtype = H5Tget_inpad(c_type_id); + if ( c_padtype == H5T_PAD_ERROR ) return ret_value; + + *padtype = (int_f) c_padtype; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_inpad_c + * Inputs: type_id - identifier of the dataspace + * Purpose: Call H5Tset_inpad to set the padding type + * unused bits in floating-point datatype + * + * Inputs: type_id - identifier of the dataspace + * padtype - padding type for unused bits + * in floating-point datatypes + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_inpad_c ( hid_t_f *type_id, int_f * padtype) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_pad_t c_padtype; + + c_type_id = *type_id; + c_padtype = (H5T_pad_t)*padtype; + status = H5Tset_inpad(c_type_id, c_padtype); + if ( status < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_cset_c + * Purpose: Call H5Tget_cset to get character set + * type of a string datatype + * + * Inputs: type_id - identifier of the dataspace + * Outputs: cset - character set type of a string datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_cset_c ( hid_t_f *type_id , int_f * cset) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_cset_t c_cset; + + c_type_id = *type_id; + c_cset = H5Tget_cset(c_type_id); + if ( c_cset == H5T_CSET_ERROR ) return ret_value; + + *cset = (int_f) c_cset; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_cset_c + * Inputs: type_id - identifier of the dataspace + * Purpose: Call H5Tset_cset to set character set + * type of a string datatype + * + * Inputs: type_id - identifier of the dataspace + * cset - character set type of a string datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_cset_c ( hid_t_f *type_id, int_f * cset) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_cset_t c_cset; + + c_type_id = *type_id; + c_cset = (H5T_cset_t)*cset; + status = H5Tset_cset(c_type_id, c_cset); + + if ( status < 0 ) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_strpad_c + * Purpose: Call H5Tget_strpad to get string padding method + * for a string datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: strpad - string padding method for a string datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_strpad_c ( hid_t_f *type_id , int_f * strpad) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_str_t c_strpad; + + c_type_id = *type_id; + c_strpad = H5Tget_strpad(c_type_id); + if ( c_strpad == H5T_STR_ERROR ) return ret_value; + + *strpad = (int_f) c_strpad; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_strpad_c + * Inputs: type_id - identifier of the dataspace + * Purpose: Call H5Tset_strpad to set string padding method + * for a string datatype + * + * Inputs: type_id - identifier of the dataspace + * strpad - string padding method for a string datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tset_strpad_c ( hid_t_f *type_id, int_f * strpad) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + H5T_str_t c_strpad; + + c_type_id = *type_id; + c_strpad = (H5T_str_t)*strpad; + status = H5Tset_strpad(c_type_id, c_strpad); + if ( status < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_nmembers_c + * Purpose: Call H5Tget_nmembers to get number of fields + * in a compound datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: num_members - number of fields in a compound datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_nmembers_c ( hid_t_f *type_id , int_f * num_members) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + + c_type_id = *type_id; + *num_members = (int_f)H5Tget_nmembers(c_type_id); + if (*num_members < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_member_name_c + * Purpose: Call H5Tget_member_name to get name + * of a compound datatype + * Inputs: type_id - identifier of the dataspace + * Outputs: member_name - name of a field of a compound datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: Elena Pourmal + * Added namelen parameter to return length of the name to Fortran user + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_member_name_c ( hid_t_f *type_id ,int_f* index, _fcd member_name, int_f *namelen) +{ + int ret_value = -1; + hid_t c_type_id; + int c_index; + char *c_name; + + c_type_id = *type_id; + c_index = *index; + c_name = H5Tget_member_name(c_type_id, c_index); + if (c_name == NULL ) return ret_value; + + HDpackFstring(c_name, _fcdtocp(member_name), strlen(c_name)); + *namelen = (int_f)strlen(c_name); + HDfree(c_name); + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_member_offset_c + * Purpose: Call H5Tget_member_offset to get byte offset of the + * beginning of a field within a compound datatype with + * respect to the beginning of the compound data type datum + * Inputs: type_id - identifier of the dataspace + * member_no - Number of the field whose offset is requested + * Outputs: offset - byte offset of the the beginning of the field of + * a compound datatype + * Returns: always 0 + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f * offset) +{ + int ret_value = -1; + size_t c_offset; + hid_t c_type_id; + int c_member_no; + + c_type_id = *type_id; + c_member_no = *member_no; + c_offset = H5Tget_member_offset(c_type_id, c_member_no); + *offset = (size_t_f)c_offset; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_member_dims_c + * Purpose: Call H5Tget_member_dims to get number + * of dimensions of the field + * Inputs: type_id - identifier of the dataspace + * field_idx - Field index (0-based) of the field + * dims to retrieve + * Outputs: dims - number of dimensions of the field + * field_dims - buffer to store the dimensions of the field + * perm - buffer to store the permutation vector of the field + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_member_dims_c ( hid_t_f *type_id ,int_f* field_idx, int_f * dims, size_t_f * field_dims, int_f * perm ) +{ + int ret_value = -1; + hid_t c_type_id; + int c_dims, i; + int* c_perm; + size_t * c_field_dims; + int c_field_idx; + + c_field_dims = (size_t*)malloc(sizeof(size_t)*4); + if(!c_field_dims) return ret_value; + + c_perm = (int*)malloc(sizeof(int)*4); + if(!c_perm) return ret_value; + + c_type_id = *type_id; + c_field_idx = *field_idx; + c_dims = H5Tget_member_dims(c_type_id, c_field_idx, c_field_dims, c_perm); + if (c_dims < 0) return ret_value; + + *dims = (int_f)c_dims; + for(i =0; i < c_dims; i++) + { + field_dims[c_dims-i-1] = (size_t_f)c_field_dims[i]; + perm[c_dims-i-1] = (int_f)c_perm[i]; + } + + ret_value = 0; + HDfree(c_field_dims); + HDfree(c_perm); + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_member_type_c + * Purpose: Call H5Tget_member_type to get the identifier of a copy of + * the datatype of the field + * Inputs: type_id - identifier of the datatype + * field_idx - Field index (0-based) of the field type to retrieve + * Outputs: datatype - identifier of a copy of the datatype of the field + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype) +{ + int ret_value = -1; + hid_t c_type_id; + int c_field_idx; + + c_type_id = *type_id; + c_field_idx = *field_idx; + *datatype = (hid_t_f)H5Tget_member_type(c_type_id, c_field_idx); + if(*datatype < 0) return ret_value; + + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tcreate_c + * Purpose: Call H5Tcreate to create a datatype + * Inputs: class - class type + * size - size of the class memeber + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Thursday, February 17, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id) +{ + int ret_value = -1; + H5T_class_t c_class; + size_t c_size; + + c_size =(size_t) *size; + c_class = (H5T_class_t) *class; + + *type_id = (hid_t_f)H5Tcreate(c_class, c_size); + if(*type_id < 0) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tinsert_c + * Purpose: Call H5Tinsert to adds another member to the compound datatype + * Inputs: type_id - identifier of the datatype + * name - Name of the field to insert + * namelen - length of the name + * offset - Offset in memory structure of the field to insert + * field_id - datatype identifier of the new member + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tinsert_c(hid_t_f *type_id, _fcd name, int_f* namelen, size_t_f *offset, hid_t_f * field_id) +{ + int ret_value = -1; + hid_t c_type_id; + hid_t c_field_id; + char* c_name; + int c_namelen; + size_t c_offset; + herr_t error; + + c_offset =(size_t) *offset; + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + c_type_id = *type_id; + c_field_id = *field_id; + error = H5Tinsert(c_type_id, c_name, c_offset, c_field_id); + HDfree(c_name); + if(error < 0) return ret_value; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tpack_c + * Purpose: Call H5Tpack tor ecursively remove padding from + * within a compound datatype to make it more efficient + * (space-wise) to store that data + * Inputs: type_id - identifier of the datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tpack_c(hid_t_f * type_id) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + + c_type_id = *type_id; + status = H5Tpack(c_type_id); + if (status < 0) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tinsert_array_c + * Purpose: Call H5Tinsert_array to add a new member to the + * compound datatype parent_id. + * Inputs: parent_id - identifier of the parent compound datatype + * name - name of the new member + * namelen - length of the name + * offset - Offset to start of new member within compound datatype + * ndims - Dimensionality of new member. Valid values + * are 0 (zero) through 4 (four). + * dims - Size of new member array + * member_id - identifier of the datatype of the new member + * perm - Pointer to buffer to store the permutation + * vector of the field + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5tinsert_array_c(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id, int_f* perm ) +{ + int ret_value = -1; + hid_t c_parent_id; + hid_t c_member_id; + int c_ndims; + herr_t status; + size_t c_offset; + size_t * c_dims; + char* c_name; + int c_namelen; + int * c_perm, i; + + c_offset = *offset; + c_dims = (size_t*)malloc(sizeof(size_t)*(*ndims)); + if(!c_dims) return ret_value; + + c_perm = (int*)malloc(sizeof(int)*(*ndims)); + if(!c_perm) return ret_value; + + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + for (i = 0; i < *ndims ; i++) { + c_dims[i] = (size_t)dims[*ndims - i - 1]; + c_perm[i] = (int)perm[*ndims - i - 1]; + } + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + c_parent_id = *parent_id; + c_member_id = *member_id; + c_ndims = *ndims; + status = H5Tinsert_array(c_parent_id, c_name, c_offset,c_ndims, c_dims, c_perm, c_member_id); + + if(status < 0) return ret_value; + ret_value = 0; + + return ret_value; + +} + + +/*---------------------------------------------------------------------------- + * Name: h5tinsert_array_c2 + * Purpose: Call H5Tinsert_array to add a new member to the + * compound datatype parent_id. + * the difference between this function and h5tinsert_array_c + * is that this one doesn't take perm array as input + * Inputs: parent_id - identifier of the parent compound datatype + * name - name of the new member + * namelen - length of the name + * offset - Offset to start of new member within compound datatype + * ndims - Dimensionality of new member. Valid values + * are 0 (zero) through 4 (four). + * dims - Size of new member array + * member_id - identifier of the datatype of the new member + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5tinsert_array_c2(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id ) +{ + int ret_value = -1; + hid_t c_parent_id; + hid_t c_member_id; + int c_ndims; + herr_t status; + size_t c_offset; + size_t * c_dims; + char* c_name; + int c_namelen; + int i; + + c_offset = *offset; + c_dims = (size_t*)malloc(sizeof(size_t)*(*ndims)); + if(!c_dims) return ret_value; + + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + for (i = 0; i < *ndims ; i++) { + c_dims[i] = (size_t)dims[*ndims - i - 1]; + } + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + c_parent_id = *parent_id; + c_member_id = *member_id; + c_ndims = *ndims; + status = H5Tinsert_array(c_parent_id, c_name, c_offset, c_ndims, c_dims, NULL, c_member_id); + + if(status < 0) return ret_value; + ret_value = 0; + + return ret_value; + +} + +/*---------------------------------------------------------------------------- + * Name: h5tenum_create_c + * Purpose: Call H5Tenum_create to create a new enumeration datatype + * Inputs: parent_id - Datatype identifier for the base datatype + * Outputs: new_type_id - datatype identifier for the new + * enumeration datatype + * Returns: 0 on success, -1 on failure + * Programmer: Xiangyang Su + * Tuesday, February 15, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id) +{ + int ret_value = 0; + hid_t c_parent_id; + hid_t c_new_type_id; + + c_parent_id = *parent_id; + c_new_type_id = H5Tenum_create(c_parent_id); + if ( c_new_type_id < 0 ) ret_value = -1; + + *new_type_id = (hid_t_f)c_new_type_id; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tenum_insert_c + * Purpose: Call H5Tenum_insert to insert a new enumeration datatype member. + * Inputs: type_id - identifier of the datatype + * name - Name of the new member + * namelen - length of the name + * value - value of the new member + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value) +{ + int ret_value = -1; + hid_t c_type_id; + char* c_name; + int c_namelen; + int c_value; + herr_t error; + + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + c_type_id = *type_id; + c_value = *value; + error = H5Tenum_insert(c_type_id, c_name, (void*)c_value); + HDfree(c_name); + if(error < 0) return ret_value; + + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tenum_nameof_c + * Purpose: Call H5Tenum_nameof to find the symbol name that corresponds to + * the specified value of the enumeration datatype type + * Inputs: type_id - identifier of the datatype + * namelen - length of the name + * value - value of the enumeration datatype + * Output: name - Name of the enumeration datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen) +{ + int ret_value = -1; + hid_t c_type_id; + char* c_name; + size_t c_namelen; + herr_t error; + int c_value; + c_value = *value; + c_namelen = (size_t)*namelen; + c_name = (char *)malloc(sizeof(char)*c_namelen); + c_type_id = *type_id; + error = H5Tenum_nameof(c_type_id, &c_value, c_name, c_namelen); + HDpackFstring(c_name, _fcdtocp(name), strlen(c_name)); + HDfree(c_name); + + if(error < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tenum_valueof_c + * Purpose: Call H5Tenum_valueof to find the value of that corresponds to + * the specified name of the enumeration datatype type + * Inputs: type_id - identifier of the datatype + * name - Name of the enumeration datatype + * namelen - length of name + * Output: value - value of the enumeration datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value) +{ + int ret_value = -1; + hid_t c_type_id; + char* c_name; + int c_namelen; + int c_value; + herr_t error; + c_namelen = *namelen; + c_name = (char *)HD5f2cstring(name, c_namelen); + if (c_name == NULL) return ret_value; + + c_type_id = *type_id; + error = H5Tenum_valueof(c_type_id, c_name, &c_value); + HDfree(c_name); + if(error < 0) return ret_value; + *value = (int_f)c_value; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- + * Name: h5tget_member_value_c + * Purpose: Call H5Tget_member_value to get the value of an + * enumeration datatype member + * Inputs: type_id - identifier of the datatype + * member_no - Number of the enumeration datatype member. + * Output: value - value of the enumeration datatype + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Thursday, February 3, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ + +int_f +nh5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value) +{ + int ret_value = -1; + hid_t c_type_id; + int c_member_no; + int c_value; + herr_t error; + + c_type_id = *type_id; + c_member_no = *member_no; + error = H5Tget_member_value(c_type_id, c_member_no, &c_value); + if(error < 0) return ret_value; + + *value = (int_f)c_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tset_tag_c + * Inputs: type_id - identifier of the dataspace + * Purpose: Call H5Tset_tag to set an opaque datatype tag + * Inputs: type_id - identifier of the dataspace + * tag - Unique ASCII string with which the opaque + * datatype is to be tagged + * namelen - length of tag + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5tset_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen) +{ + int ret_value = -1; + hid_t c_type_id; + herr_t status; + char* c_tag; + int c_namelen; + + c_namelen = *namelen; + c_tag = (char *)HD5f2cstring(tag, c_namelen); + + c_type_id = *type_id; + status = H5Tset_tag(c_type_id, c_tag); + HDfree(c_tag); + if ( status < 0 ) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5tget_tag_c + * Inputs: type_id - identifier of the dataspace + * Purpose: Call H5Tset_tag to set an opaque datatype tag + * Inputs: type_id - identifier of the dataspace + * Outputs: tag - Unique ASCII string with which the opaque + * datatype is to be tagged + * taglen - length of tag + * Returns: 0 on success, -1 on failure + * Programmer: XIANGYANG SU + * Wednesday, January 26, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5tget_tag_c(hid_t_f* type_id, _fcd tag, int_f* taglen) +{ + int ret_value = -1; + hid_t c_type_id; + char *c_tag; + + c_type_id = *type_id; + c_tag = H5Tget_tag(c_type_id); + if (c_tag == NULL ) return ret_value; + + HDpackFstring(c_tag, _fcdtocp(tag), strlen(c_tag)); + *taglen = strlen(c_tag); + HDfree(c_tag); + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90 new file mode 100644 index 0000000..5560dc8 --- /dev/null +++ b/fortran/src/H5Tff.f90 @@ -0,0 +1,599 @@ +! +! This file contains FORTRAN90 interfaces for H5T functions +! + MODULE H5T + + USE H5FORTRAN_TYPES + USE H5FORTRAN_FLAGS + + CONTAINS + + SUBROUTINE h5topen_f(loc_id, name, type_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name + ! Datatype name within file or group + INTEGER(HID_T), INTENT(OUT) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen ! Name length + INTEGER, EXTERNAL :: h5topen_c + namelen = LEN(name) + hdferr = h5topen_c(loc_id, name, namelen, type_id) + END SUBROUTINE h5topen_f + + SUBROUTINE h5tcommit_f(loc_id, name, type_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier + CHARACTER(LEN=*), INTENT(IN) :: name + ! Datatype name within file or group + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen ! Name length + INTEGER, EXTERNAL :: h5tcommit_c + namelen = LEN(name) + hdferr = h5tcommit_c(loc_id, name, namelen, type_id) + END SUBROUTINE h5tcommit_f + + + SUBROUTINE h5tcopy_f(type_id, new_type_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(HID_T), INTENT(OUT) :: new_type_id + ! Identifier of datatype's copy + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tcopy_c + hdferr = h5tcopy_c(type_id, new_type_id) + END SUBROUTINE h5tcopy_f + + SUBROUTINE h5tequal_f(type1_id, type2_id, flag, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type1_id ! Datatype identifier + INTEGER(HID_T), INTENT(IN) :: type2_id ! Datatype identifier + LOGICAL, INTENT(OUT) :: flag ! TRUE/FALSE flag to indicate if two + ! datatypes are equal + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: c_flag + INTEGER, EXTERNAL :: h5tequal_c + flag = .FALSE. + hdferr = h5tequal_c(type1_id, type2_id, c_flag) + if(c_flag .gt. 0) flag = .TRUE. + END SUBROUTINE h5tequal_f + + + SUBROUTINE h5tclose_f(type_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tclose_c + hdferr = h5tclose_c(type_id) + END SUBROUTINE h5tclose_f + + + SUBROUTINE h5tget_class_f(type_id, class, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: class + ! Datatype class, possible values are: + ! H5T_NO_CLASS_F (-1) + ! H5T_INTEGER_F (0) + ! H5T_FLOAT_F (1) + ! H5T_TIME_F (2) + ! H5T_STRING_F (3) + ! H5T_BITFIELD_F (4) + ! H5T_OPAQUE_F (5) + ! H5T_COMPOUND_F (6) + ! H5T_REFERENCE_F (7) + ! H5T_ENUM_F (8) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_class_c + hdferr = h5tget_class_c(type_id, class) + END SUBROUTINE h5tget_class_f + + + SUBROUTINE h5tget_size_f(type_id, size, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(OUT) :: size ! Datatype size + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_size_c + hdferr = h5tget_size_c(type_id, size) + END SUBROUTINE h5tget_size_f + + + SUBROUTINE h5tset_size_f(type_id, size, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(IN) :: size ! Datatype size + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_size_c + hdferr = h5tset_size_c(type_id, size) + END SUBROUTINE h5tset_size_f + + + SUBROUTINE h5tget_order_f(type_id, order, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: order + ! Datatype byte order, bossible values are: + ! H5T_ORDER_LE (0) + ! H5T_ORDER_BE (1) + ! H5T_ORDER_VAX (2) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_order_c + hdferr = h5tget_order_c(type_id, order) + END SUBROUTINE h5tget_order_f + + + SUBROUTINE h5tset_order_f(type_id, order, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: order ! Datatype byte order, bossible values + ! are: + ! H5T_ORDER_LE (0) + ! H5T_ORDER_BE (1) + ! H5T_ORDER_VAX (2) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_order_c + hdferr = h5tset_order_c(type_id, order) + END SUBROUTINE h5tset_order_f + + + SUBROUTINE h5tget_precision_f(type_id, precision, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(OUT) :: precision ! Datatype precision + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_precision_c + hdferr = h5tget_precision_c(type_id, precision) + END SUBROUTINE h5tget_precision_f + + SUBROUTINE h5tset_precision_f(type_id, precision, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(IN) :: precision ! Datatype precision + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_precision_c + hdferr = h5tset_precision_c(type_id, precision) + END SUBROUTINE h5tset_precision_f + + SUBROUTINE h5tget_offset_f(type_id, offset, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(OUT) :: offset ! Datatype bit offset of the + ! first significant bit + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_offset_c + hdferr = h5tget_offset_c(type_id, offset) + END SUBROUTINE h5tget_offset_f + + SUBROUTINE h5tset_offset_f(type_id, offset, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(IN) :: offset ! Datatype bit offset of the + ! first significant bit + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_offset_c + hdferr = h5tset_offset_c(type_id, offset) + END SUBROUTINE h5tset_offset_f + + SUBROUTINE h5tget_pad_f(type_id, lsbpad, msbpad, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: lsbpad ! padding type of the + ! least significant bit + INTEGER, INTENT(OUT) :: msbpad ! padding type of the + ! most significant bit + ! Possible values of padding type are: + ! H5T__PAD_ZERO_F = 0 + ! H5T__PAD_ONE_F = 1 + ! H5T__PAD_BACKGROUND_F = 2 + ! H5T_PAD_ERROR_F = -1 + ! H5T_PAD_NPAD_F = 3 + + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_pad_c + hdferr = h5tget_pad_c(type_id, lsbpad, msbpad) + END SUBROUTINE h5tget_pad_f + + SUBROUTINE h5tset_pad_f(type_id, lsbpad, msbpad, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: lsbpad ! padding type of the + ! least significant bit + INTEGER, INTENT(IN) :: msbpad ! padding type of the + ! most significant bit + ! Possible values of padding type are: + ! H5T_PAD_ZERO_F = 0 + ! H5T_PAD_ONE_F = 1 + ! H5T_PAD_BACKGROUND_F = 2 + ! H5T_PAD_ERROR_F = -1 + ! H5T_PAD_NPAD_F = 3 + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_pad_c + hdferr = h5tset_pad_c(type_id, lsbpad, msbpad) + END SUBROUTINE h5tset_pad_f + + SUBROUTINE h5tget_sign_f(type_id, sign, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: sign ! sign type for an integer type + !possible values are: + !Unsigned integer type H5T_SGN_NONE_F = 0 + !Two's complement signed integer type + !H5T_SGN_2_F = 1 + !or error value: H5T_SGN_ERROR_F=-1 + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_sign_c + hdferr = h5tget_sign_c(type_id, sign) + END SUBROUTINE h5tget_sign_f + + SUBROUTINE h5tset_sign_f(type_id, sign, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: sign !sign type for an integer type + !possible values are: + !Unsigned integer type H5T_SGN_NONE_F = 0 + !Two's complement signed integer type + !H5T_SGN_2_F = 1 + !or error value: H5T_SGN_ERROR_F=-1 + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_sign_c + hdferr = h5tset_sign_c(type_id, sign) + END SUBROUTINE h5tset_sign_f + + SUBROUTINE h5tget_fields_f(type_id, epos, esize, mpos, msize, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: epos ! exponent bit-position + INTEGER, INTENT(OUT) :: esize ! size of exponent in bits + INTEGER, INTENT(OUT) :: mpos ! mantissa bit-position + INTEGER, INTENT(OUT) :: msize ! size of mantissa in bits + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5tget_fields_c + hdferr = h5tget_fields_c(type_id, epos, esize, mpos, msize, hdferr) + END SUBROUTINE h5tget_fields_f + + SUBROUTINE h5tset_fields_f(type_id, epos, esize, mpos, msize, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: epos ! exponent bit-position + INTEGER, INTENT(IN) :: esize ! size of exponent in bits + INTEGER, INTENT(IN) :: mpos ! mantissa bit-position + INTEGER, INTENT(IN) :: msize ! size of mantissa in bits + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, EXTERNAL :: h5tset_fields_c + hdferr = h5tset_fields_c(type_id, epos, esize, mpos, msize) + END SUBROUTINE h5tset_fields_f + + SUBROUTINE h5tget_ebias_f(type_id, ebias, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(OUT) :: ebias ! Datatype exponent bias of a floating-point type + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_ebias_c + hdferr = h5tget_ebias_c(type_id, ebias) + END SUBROUTINE h5tget_ebias_f + + + SUBROUTINE h5tset_ebias_f(type_id, ebias, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER(SIZE_T), INTENT(IN) :: ebias !Datatype exponent bias of a floating-point type + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_ebias_c + hdferr = h5tset_ebias_c(type_id, ebias) + END SUBROUTINE h5tset_ebias_f + + SUBROUTINE h5tget_norm_f(type_id, norm, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: norm !mantissa normalization of a floating-point datatype + !Valid normalization types are: + !H5T_NORM_IMPLIED_F(0),MSB of mantissa is not + !stored, always 1, H5T_NORM_MSBSET_F(1), MSB of + !mantissa is always 1, H5T_NORM_NONE_F(2) + !Mantissa is not normalize + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_norm_c + hdferr = h5tget_norm_c(type_id, norm) + END SUBROUTINE h5tget_norm_f + + + SUBROUTINE h5tset_norm_f(type_id, norm, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: norm !mantissa normalization of a floating-point datatype + !Valid normalization types are: + !H5T_NORM_IMPLIED_F(0),MSB of mantissa is not + !stored, always 1, H5T_NORM_MSBSET_F(1), MSB of + !mantissa is always 1, H5T_NORM_NONE_F(2) + !Mantissa is not normalize + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_norm_c + hdferr = h5tset_norm_c(type_id, norm) + END SUBROUTINE h5tset_norm_f + + SUBROUTINE h5tget_inpad_f(type_id, padtype, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: padtype ! padding type for unused bits + ! in floating-point datatypes. + ! Possible values of padding type are: + ! H5T__PAD_ZERO_F = 0 + ! H5T__PAD_ONE_F = 1 + ! H5T__PAD_BACKGROUND_F = 2 + + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_inpad_c + hdferr = h5tget_inpad_c(type_id, padtype) + END SUBROUTINE h5tget_inpad_f + + SUBROUTINE h5tset_inpad_f(type_id, padtype, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: padtype ! padding type for unused bits + ! in floating-point datatypes. + ! Possible values of padding type are: + ! H5T__PAD_ZERO_F = 0 + ! H5T__PAD_ONE_F = 1 + ! H5T__PAD_BACKGROUND_F = 2 + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_inpad_c + hdferr = h5tset_inpad_c(type_id, padtype) + END SUBROUTINE h5tset_inpad_f + + SUBROUTINE h5tget_cset_f(type_id, cset, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: cset ! character set type of a string datatype + ! Possible values of padding type are: + !H5T_CSET_ASCII_F = 0 + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_cset_c + hdferr = h5tget_cset_c(type_id, cset) + END SUBROUTINE h5tget_cset_f + + SUBROUTINE h5tset_cset_f(type_id, cset, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: cset !character set type of a string datatype + !Possible values of padding type are: + !H5T_CSET_ASCII_F = 0 + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_cset_c + hdferr = h5tset_cset_c(type_id, cset) + END SUBROUTINE h5tset_cset_f + + SUBROUTINE h5tget_strpad_f(type_id, strpad, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: strpad ! string padding method for a string datatype + ! Possible values of padding type are: + !Pad with zeros (as C does): H5T_STR_NULL_F(0), + !Pad with spaces (as FORTRAN does): + !H5T_STR_SPACE_F(1) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_strpad_c + hdferr = h5tget_strpad_c(type_id, strpad) + END SUBROUTINE h5tget_strpad_f + + SUBROUTINE h5tset_strpad_f(type_id, strpad, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: strpad ! string padding method for a string datatype + ! Possible values of padding type are: + !Pad with zeros (as C does): H5T_STR_NULL_F(0), + !Pad with spaces (as FORTRAN does): + !H5T_STR_SPACE_F(1) + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tset_strpad_c + hdferr = h5tset_strpad_c(type_id, strpad) + END SUBROUTINE h5tset_strpad_f + + + SUBROUTINE h5tget_nmembers_f(type_id, num_members, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: num_members !number of fields in a compound datatype + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_nmembers_c + hdferr = h5tget_nmembers_c(type_id, num_members) + END SUBROUTINE h5tget_nmembers_f + + SUBROUTINE h5tget_member_name_f(type_id,index, member_name, namelen, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: index !Field index (0-based) of the field name to retrieve + CHARACTER(LEN=*), INTENT(OUT) :: member_name !name of a field of + !a compound datatype + INTEGER, INTENT(OUT) :: namelen ! Length the name + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_member_name_c + hdferr = h5tget_member_name_c(type_id, index, member_name, namelen) + END SUBROUTINE h5tget_member_name_f + + SUBROUTINE h5tget_member_offset_f(type_id, member_no, offset, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: member_no !Number of the field + !whose offset is requested + INTEGER(SIZE_T), INTENT(OUT) :: offset !byte offset of the the beginning of the field + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_member_offset_c + hdferr = h5tget_member_offset_c(type_id, member_no, offset ) + END SUBROUTINE h5tget_member_offset_f + + SUBROUTINE h5tget_member_dims_f(type_id, field_idx,dims, field_dims, perm, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: field_idx !Field index (0-based) of + !field_dims, perm) + INTEGER, INTENT(OUT) :: dims !number of dimensions of the field + + INTEGER(SIZE_T),DIMENSION(*), INTENT(OUT) :: field_dims !buffer to store the + !dimensions of the field + INTEGER, DIMENSION(*), INTENT(OUT) :: perm !buffer to store the + !permutation vector of the field + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_member_dims_c + hdferr = h5tget_member_dims_c(type_id, field_idx, dims, field_dims, perm) + + END SUBROUTINE h5tget_member_dims_f + + SUBROUTINE h5tget_member_type_f(type_id, field_idx, datatype, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: field_idx !Field index (0-based) of the field type to retrieve + INTEGER(HID_T), INTENT(OUT) :: datatype !identifier of a copy of + !the datatype of the field + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_member_type_c + hdferr = h5tget_member_type_c(type_id, field_idx , datatype) + END SUBROUTINE h5tget_member_type_f + + + SUBROUTINE h5tcreate_f(class, size, type_id, hdferr) + IMPLICIT NONE + INTEGER, INTENT(IN) :: class ! Datatype class cna be one of + ! H5T_COMPOUND_F (6) + ! H5T_ENUM_F (8) + ! H5T_OPAQUE_F (9) + INTEGER(SIZE_T), INTENT(IN) :: size ! Size of the datatype + INTEGER(HID_T), INTENT(OUT) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tcreate_c + + hdferr = h5tcreate_c(class, size, type_id) + END SUBROUTINE h5tcreate_f + + SUBROUTINE h5tinsert_f(type_id, name, offset, field_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + CHARACTER(LEN=*), INTENT(IN) :: name !Name of the field to insert + INTEGER(SIZE_T), INTENT(IN) :: offset !Offset in memory structure of the field to insert + INTEGER(HID_T), INTENT(IN) :: field_id !datatype identifier of the new member + + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen + INTEGER, EXTERNAL :: h5tinsert_c + namelen = LEN(name) + hdferr = h5tinsert_c(type_id, name, namelen, offset, field_id ) + END SUBROUTINE h5tinsert_f + + SUBROUTINE h5tpack_f(type_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tpack_c + hdferr = h5tpack_c(type_id) + END SUBROUTINE h5tpack_f + + SUBROUTINE h5tinsert_array_f(parent_id,name,offset, ndims, dims, member_id, hdferr, perm) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: parent_id ! identifier of the parent compound datatype + CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member + INTEGER(SIZE_T), INTENT(IN) :: offset !Offset to start of new member + !within compound datatype + INTEGER, INTENT(IN) :: ndims !Dimensionality of new member. + !Valid values are 0 (zero) through 4 (four) + INTEGER(SIZE_T), DIMENSION(*), INTENT(IN) :: dims !Size of new member array + INTEGER(HID_T), INTENT(IN) :: member_id ! identifier of the datatype of the new member + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTEGER, DIMENSION(*), OPTIONAL, INTENT(IN) :: perm + !Pointer to buffer to store + !the permutation vector of the field + INTEGER :: namelen, sizeofperm + INTEGER, EXTERNAL :: h5tinsert_array_c, h5tinsert_array_c2 + namelen = LEN(name) + if (present(perm)) then + hdferr = h5tinsert_array_c(parent_id, name, namelen, offset, ndims,dims, member_id, perm) + else + hdferr = h5tinsert_array_c2(parent_id, name, namelen, offset, ndims,dims, member_id) + end if + + END SUBROUTINE h5tinsert_array_f + + SUBROUTINE h5tenum_create_f(parent_id, new_type_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: parent_id ! Datatype identifier for + ! the base datatype + INTEGER(HID_T), INTENT(OUT) :: new_type_id + !datatype identifier for the + ! new enumeration datatype + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tenum_create_c + hdferr = h5tenum_create_c(parent_id, new_type_id) + END SUBROUTINE h5tenum_create_f + + SUBROUTINE h5tenum_insert_f(type_id, name, value, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member + INTEGER, INTENT(IN) :: value !value of the new member + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen + INTEGER, EXTERNAL :: h5tenum_insert_c + namelen = LEN(name) + hdferr = h5tenum_insert_c(type_id, name, namelen, value) + END SUBROUTINE h5tenum_insert_f + + SUBROUTINE h5tenum_nameof_f(type_id, name, namelen, value, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + CHARACTER(LEN=*), INTENT(OUT) :: name !Name of the enumeration datatype. + INTEGER(SIZE_T), INTENT(IN) :: namelen !length of the name + INTEGER, INTENT(IN) :: value !value of the enumeration datatype. + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tenum_nameof_c + hdferr = h5tenum_nameof_c(type_id, value, name, namelen) + END SUBROUTINE h5tenum_nameof_f + + SUBROUTINE h5tenum_valueof_f(type_id, name, value, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + CHARACTER(LEN=*), INTENT(IN) :: name !Name of the enumeration datatype. + INTEGER, INTENT(OUT) :: value !value of the enumeration datatype. + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen + INTEGER, EXTERNAL :: h5tenum_valueof_c + namelen = LEN(name) + hdferr = h5tenum_valueof_c(type_id, name, namelen, value) + END SUBROUTINE h5tenum_valueof_f + + SUBROUTINE h5tget_member_value_f(type_id, member_no, value, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + INTEGER, INTENT(IN) :: member_no !Number of the enumeration datatype member + INTEGER, INTENT(OUT) :: value !value of the enumeration datatype. + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_member_value_c + hdferr = h5tget_member_value_c(type_id, member_no, value) + END SUBROUTINE h5tget_member_value_f + + SUBROUTINE h5tset_tag_f(type_id, tag, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + CHARACTER(LEN=*), INTENT(IN) :: tag !Unique ASCII string with which + !the opaque datatype is to be tagged + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: namelen + INTEGER, EXTERNAL :: h5tset_tag_c + namelen = LEN(tag) + hdferr = h5tset_tag_c(type_id, tag, namelen) + END SUBROUTINE h5tset_tag_f + + SUBROUTINE h5tget_tag_f(type_id, tag,taglen, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier + CHARACTER(LEN=*), INTENT(OUT) :: tag !Unique ASCII string with which + !the opaque datatype is to be tagged + INTEGER, INTENT(OUT) :: taglen !length of tag + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, EXTERNAL :: h5tget_tag_c + hdferr = h5tget_tag_c(type_id, tag, taglen) + END SUBROUTINE h5tget_tag_f + + END MODULE H5T diff --git a/fortran/src/H5f90.h b/fortran/src/H5f90.h new file mode 100644 index 0000000..c01cd1f --- /dev/null +++ b/fortran/src/H5f90.h @@ -0,0 +1,77 @@ +#ifndef _H5f90_H +#define _H5f90_H + +#include +#include "H5f90i.h" +#include "H5f90proto.h" + + +/* Constants from the H5Ff.c and H5Fff.f90 files */ + + +#define H5F_ACC_RDWR_F 1 +#define H5F_ACC_RDONLY_F 2 +#define H5F_ACC_TRUNC_F 3 +#define H5F_ACC_EXCL_F 4 +#define H5F_ACC_DEBUG_F 5 +#define H5P_DEFAULT_F 6 /* Can Fortran program use combination + of those flags? */ +#define H5F_SCOPE_LOCAL_F 0 +#define H5F_SCOPE_GLOBAL_F 1 + +/* Constants used in the H5Gf.c and H5Gff.f90 files */ + +#define OBJECT_NAMELEN_DEFAULT_F -1 +#define H5G_LINK_F 0 +#define H5G_GROUP_F 1 +#define H5G_DATASET_F 2 +#define H5G_TYPE_F 3 + + +/* Constants used in H5Df.c and H5Dff.f90 files */ + +#define H5S_ALL_F -2 + +/* Constants used in H5Sf.c and H5Sff.f90 files */ + +#define H5S_NO_CLASS_F -1 +#define H5S_SCALAR_F 0 +#define H5S_SIMPLE_F 1 +#define H5S_SELECT_SET_F 0 +#define H5S_SELECT_OR_F 1 + +/* Constants ised in H5Tf.c and H5Tff.f90 files */ + + +#define H5T_NO_CLASS_F -1 +#define H5T_INTEGER_F 0 +#define H5T_FLOAT_F 1 +#define H5T_TIME_F 2 +#define H5T_STRING_F 3 +#define H5T_BITFIELD_F 4 +#define H5T_OPAQUE_F 5 +#define H5T_COMPOUND_F 6 +#define H5T_REFERENCE_F 7 +#define H5T_ENUM_F 8 + +#define H5T_ORDER_LE_F 0 +#define H5T_ORDER_BE_F 1 +#define H5T_ORDER_VAX_F 2 + + +/* Constants used in H5Pf.c and H5Pff.f90 files */ + + +#define H5P_NO_CLASS_F -1 +#define H5P_FILE_CREATE_F 0 +#define H5P_FILE_ACCESS_F 1 +#define H5P_DATASET_CREATE_F 2 +#define H5P_DATASET_XFER_F 3 +#define H5P_MOUNT_F 4 + +/* Constants used in H5Pf_parallel.c and H5Pff_parallel.f90 files */ +#define H5D_XFER_INDEPENDENT_F 0 +#define H5D_XFER_COLLECTIVE_F 1 +#define H5D_XFER_DFLT_F 2 + +#endif /* _H5f90_H */ diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90 new file mode 100644 index 0000000..078870b --- /dev/null +++ b/fortran/src/H5f90global.f90 @@ -0,0 +1,105 @@ + MODULE H5GLOBAL + USE H5FORTRAN_TYPES + INTEGER, PARAMETER :: PREDEF_TYPES_LEN = 6 ! Do not forget to change this + ! value when new predefined + ! datatypes are added + ! Do not forget to change the following line when new predefined + ! floating data types are added + INTEGER, PARAMETER :: FLOATING_TYPES_LEN = 4 + + ! Do not forget to change the following line when new predefined + ! integer data types are added + INTEGER, PARAMETER :: INTEGER_TYPES_LEN = 16 + + INTEGER(HID_T) H5T_NATIVE_INTEGER, & + H5T_NATIVE_REAL, & + H5T_NATIVE_DOUBLE, & + H5T_NATIVE_CHARACTER , & + H5T_STD_REF_OBJ, & + H5T_STD_REF_DSETREG, & + H5T_IEEE_F32BE, & + H5T_IEEE_F32LE, & + H5T_IEEE_F64BE, & + H5T_IEEE_F64LE, & + H5T_STD_I8BE, & + H5T_STD_I8LE, & + H5T_STD_I16BE, & + H5T_STD_I16LE, & + H5T_STD_I32BE, & + H5T_STD_I32LE, & + H5T_STD_I64BE, & + H5T_STD_I64LE, & + H5T_STD_U8BE, & + H5T_STD_U8LE, & + H5T_STD_U16BE, & + H5T_STD_U16LE, & + H5T_STD_U32BE, & + H5T_STD_U32LE, & + H5T_STD_U64BE, & + H5T_STD_U64LE + + + INTEGER(HID_T), DIMENSION(PREDEF_TYPES_LEN) :: predef_types + EQUIVALENCE (predef_types(1), H5T_NATIVE_INTEGER) + EQUIVALENCE (predef_types(2), H5T_NATIVE_REAL) + EQUIVALENCE (predef_types(3), H5T_NATIVE_DOUBLE) + EQUIVALENCE (predef_types(4), H5T_NATIVE_CHARACTER) + EQUIVALENCE (predef_types(5), H5T_STD_REF_OBJ) + EQUIVALENCE (predef_types(6), H5T_STD_REF_DSETREG) + + INTEGER(HID_T), DIMENSION(FLOATING_TYPES_LEN) :: floating_types + EQUIVALENCE (floating_types(1), H5T_IEEE_F32BE ) + EQUIVALENCE (floating_types(2), H5T_IEEE_F32LE) + EQUIVALENCE (floating_types(3), H5T_IEEE_F64BE) + EQUIVALENCE (floating_types(4), H5T_IEEE_F64LE) + + INTEGER(HID_T), DIMENSION(INTEGER_TYPES_LEN) :: integer_types + EQUIVALENCE (integer_types(1), H5T_STD_I8BE ) + EQUIVALENCE (integer_types(2), H5T_STD_I8LE) + EQUIVALENCE (integer_types(3), H5T_STD_I16BE) + EQUIVALENCE (integer_types(4), H5T_STD_I16LE) + EQUIVALENCE (integer_types(5), H5T_STD_I32BE) + EQUIVALENCE (integer_types(6), H5T_STD_I32LE) + EQUIVALENCE (integer_types(7), H5T_STD_I64BE) + EQUIVALENCE (integer_types(8), H5T_STD_I64LE) + EQUIVALENCE (integer_types(9), H5T_STD_U8BE) + EQUIVALENCE (integer_types(10), H5T_STD_U8LE) + EQUIVALENCE (integer_types(11), H5T_STD_U16BE) + EQUIVALENCE (integer_types(12), H5T_STD_U16LE) + EQUIVALENCE (integer_types(13), H5T_STD_U32BE) + EQUIVALENCE (integer_types(14), H5T_STD_U32LE) + EQUIVALENCE (integer_types(15), H5T_STD_U64BE) + EQUIVALENCE (integer_types(16), H5T_STD_U64LE) + + + COMMON /PREDEFINED_TYPES/ H5T_NATIVE_INTEGER, & + H5T_NATIVE_REAL, & + H5T_NATIVE_DOUBLE, & + H5T_NATIVE_CHARACTER, & + H5T_STD_REF_OBJ, & + H5T_STD_REF_DSETREG + + COMMON /FLOATING_TYPES/ H5T_IEEE_F32BE, & + H5T_IEEE_F32LE, & + H5T_IEEE_F64BE, & + H5T_IEEE_F64LE + + COMMON /INTEGER_TYPES/ H5T_STD_I8BE, & + H5T_STD_I8LE, & + H5T_STD_I16BE, & + H5T_STD_I16LE, & + H5T_STD_I32BE, & + H5T_STD_I32LE, & + H5T_STD_I64BE, & + H5T_STD_I64LE, & + H5T_STD_U8BE, & + H5T_STD_U8LE, & + H5T_STD_U16BE, & + H5T_STD_U16LE, & + H5T_STD_U32BE, & + H5T_STD_U32LE, & + H5T_STD_U64BE, & + H5T_STD_U64LE + + END MODULE H5GLOBAL + diff --git a/fortran/src/H5f90i.h b/fortran/src/H5f90i.h new file mode 100644 index 0000000..9d19ef4 --- /dev/null +++ b/fortran/src/H5f90i.h @@ -0,0 +1,286 @@ +#ifndef _H5f90i_H +#define _H5f90i_H + +#ifdef GOT_MACHINE +#undef GOT_MACHINE +#endif + +#define DFMT_IRIX 0x1111 + +/* + * Standard header files needed all the time + */ + +#include +#include +#include +#include + +#if (defined (UNICOS) || (defined (_UNICOS))) + +#ifndef UNICOS +#define UNICOS +#endif + +#include +#include +#ifndef O_RDONLY +#include /* for unbuffered i/o stuff */ +#define L_INCR 1 +#include +#endif /*O_RDONLY*/ + +#ifdef _CRAYIEEE +#define DF_MT DFMT_UNICOSIEEE +#else +#define DF_MT DFMT_UNICOS +#endif +/*typedef char* _fcd;*/ +typedef long hsize_t_f; +typedef long hssize_t_f; +typedef long size_t_f; +typedef long int_f; +typedef long hid_t_f; +typedef double real_f; +#define DF_CAPFNAMES +/*#define _fcdtocp(desc) (desc)*/ + +#endif /* UNICOS */ + + +/* LINUX definitions */ +#if defined(i386) && defined(linux) +#define DF_MT DFMT_LINIX +typedef char *_fcd; +typedef long long hsize_t_f; +typedef long long hssize_t_f; +typedef int size_t_f; +typedef int int_f; +typedef int hid_t_f; +typedef float real_f; +#define FNAME_POST_UNDERSCORE +#define _fcdtocp(desc) (desc) + +#endif /*LINUX*/ + +#if defined(IRIX) || defined(IRIS4) || defined(sgi) || defined(__sgi__) || defined(__sgi) + +#ifndef IRIX +#define IRIX +#endif + +#if (_MIPS_SZLONG == 64) +/* IRIX 64 bits objects. It is nearly the same as the conventional + * 32 bits objects. Let them share IRIX definitions for now. + */ +#define IRIX64 +#endif + + +#ifdef GOT_MACHINE +If you get an error on this line more than one machine type has been defined. +Please check your Makefile. +#endif +#define GOT_MACHINE 1 + +# define BSD +#ifndef __GNUC__ +#include +#endif /* __GNUC__ */ +#include /* for unbuffered i/o stuff */ +#include +#define DF_MT DFMT_IRIX +typedef char *_fcd; + +typedef long hsize_t_f; +typedef long hssize_t_f; +typedef long size_t_f; +typedef int int_f; +typedef int hid_t_f; +typedef float real_f; +#define FNAME_POST_UNDERSCORE +#define _fcdtocp(desc) (desc) +#ifdef IRIX64 +#define BIG_LONGS +#endif + + +#define HAVE_STDC +#define INCLUDES_ARE_ANSI + +#endif /* IRIX */ + +#if (defined(SUN) || defined(sun) || defined(__sun__) || defined(__SUNPRO_C)) & !defined(__i386) +#ifdef __STDC__ +#define ANSISUN +#else /* __STDC__ */ +#define KNRSUN +#endif /* __STDC__ */ +#endif /* SUN || sun */ + +#if defined(ANSISUN) + +#if !defined(SUN) +#define SUN +#endif + +#ifdef GOT_MACHINE +If you get an error on this line more than one machine type has been defined. +Please check your Makefile. +#endif +#define GOT_MACHINE + +#include /* for some file I/O stuff */ +#include +#include /* for unbuffered i/o stuff */ +#include +#define DF_MT DFMT_SUN +typedef char *_fcd; +typedef int hsize_t_f; +typedef int hssize_t_f; +typedef int size_t_f; +typedef int int_f; +typedef int hid_t_f; +typedef float real_f; +#define FNAME_POST_UNDERSCORE +#define _fcdtocp(desc) (desc) + +#endif /*SUN*/ + + +#if defined DEC_ALPHA || (defined __alpha && defined __unix__) + +#ifndef DEC_ALPHA +#define DEC_ALPHA +#endif + +#ifdef GOT_MACHINE +If you get an error on this line more than one machine type has been defined. +Please check your Makefile. +#endif +#define GOT_MACHINE + +#include /* for unbuffered i/o stuff */ +#include +#define DF_MT DFMT_ALPHA +typedef char *_fcd; +typedef long hsize_t_f; +typedef long hssize_t_f; +typedef long size_t_f; +typedef int int_f; +typedef int hid_t_f; +typedef float real_f; +#define FNAME_POST_UNDERSCORE +#define _fcdtocp(desc) (desc) + +#endif /* DEC_ALPHA */ + + +#if defined(HP9000) || (!defined(__convexc__) && (defined(hpux) || defined(__hpux))) + +#ifndef HP9000 +#define HP9000 +#endif + +#ifdef GOT_MACHINE +If you get an error on this line more than one machine type has been defined. +Please check your Makefile. +#endif +#define GOT_MACHINE + +#ifndef HAVE_UNISTD_H +#define HAVE_UNISTD_H /* unistd.h - close, fork,..etc */ +#endif + +# define BSD +#ifndef __GNUC__ +#include +#endif /* __GNUC__ */ +#include /* for unbuffered i/o stuff */ +#include +#define DF_MT DFMT_HP9000 +typedef char *_fcd; +typedef long hsize_t_f; +typedef long hssize_t_f; +typedef long size_t_f; +typedef int int_f; +typedef int hid_t_f; +typedef float real_f; +#define _fcdtocp(desc) (desc) +#ifdef HAVE_FMPOOL +#define FILELIB PAGEBUFIO /* enable page buffering */ +#else +#define FILELIB UNIXBUFIO +#endif + +#endif /* HP9000 */ + + +#if defined _WINDOWS || defined WIN32 +#define GOT_MACHINE 1 + +#pragma comment( lib, "oldnames" ) +#include +#include +#include +#include +#include +#include +#include /* for character macros */ +#ifdef __WATCOMC__ +#include /* for the 'fortran' pragma */ +#endif + +#define DF_MT DFMT_PC + +typedef char *_fcd; +typedef int hsize_t_f; +typedef int hssize_t_f; +typedef int size_t_f; +typedef int int_f; +typedef int hid_t_f; +typedef float real_f; + +#if defined _M_ALPHA +#define FNAME_PRE_UNDERSCORE +#endif + +#define DF_CAPFNAMES +#define _fcdtocp(desc) (desc) + +#ifdef HAVE_FMPOOL +#define FILELIB PAGEBUFIO /* enable page buffering */ +#else +#define FILELIB UNIXBUFIO +#endif + +#endif /*WINDOWS */ + +/*---------------------------------------------------------------- +** MACRO FNAME for any fortran callable routine name. +** +** This macro prepends, appends, or does not modify a name +** passed as a macro parameter to it based on the FNAME_PRE_UNDERSCORE, +** FNAME_POST_UNDERSCORE macros set for a specific system. +** +**---------------------------------------------------------------*/ +#if defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE) +# define FNAME(x) _##x##_ +#endif +#if defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE) +# define FNAME(x) _##x +#endif +#if !defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE) +# define FNAME(x) x##_ +#endif +#if !defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE) +# define FNAME(x) x +#endif + +# define HDfree(p) (free((void*)p)) +# define HDmalloc(s) (malloc((size_t)s)) +# define HDstrlen(s) (strlen((const char *)(s))) +# define HDmemcpy(dst,src,n) (memcpy((void *)(dst),(const void *)(src),(size_t)(n))) + + +#endif /* _H5f90i_H */ diff --git a/fortran/src/H5f90kit.c b/fortran/src/H5f90kit.c new file mode 100644 index 0000000..a0a6962 --- /dev/null +++ b/fortran/src/H5f90kit.c @@ -0,0 +1,105 @@ +#include +#include +#include "H5f90.h" + + +/* + * Routines from HDF4 to deal with C-FORTRAN issues. + * + * HD5c2fstr -- convert a C string into a Fortran string IN PLACE + * HD5f2cstring -- convert a Fortran string to a C string + */ + +/* ------------------------------- HDc2fstr ------------------------------- +NAME + HD5c2fstr -- convert a C string into a Fortran string IN PLACE +USAGE + int HD5c2fstr(str, len) + char * str; IN: string to convert + int len; IN: length of Fortran string +RETURNS + SUCCEED +DESCRIPTION + Change a C string (NULL terminated) into a Fortran string. + Basically, all that is done is that the NULL is ripped out + and the string is padded with spaces + +---------------------------------------------------------------------------*/ +int +HD5c2fstr(char *str, int len) +{ + int i; + + i=(int)HDstrlen(str); + for (; i < len; i++) + str[i] = ' '; + return 0; +} /* HD5c2fstr */ + +/* ----------------------------- HDf2cstring ------------------------------ */ +/* +NAME + HD5f2cstring -- convert a Fortran string to a C string +USAGE + char * HDf2cstring(fdesc, len) + _fcd fdesc; IN: Fortran string descriptor + int len; IN: length of Fortran string +RETURNS + Pointer to the C string if success, else NULL +DESCRIPTION + Chop off trailing blanks off of a Fortran string and + move it into a newly allocated C string. It is up + to the user to free this string. + +---------------------------------------------------------------------------*/ +char * +HD5f2cstring(_fcd fdesc, int len) +{ + char *cstr, *str; + int i; + + str = _fcdtocp(fdesc); + /* This should be equivalent to the above test -QAK */ + for(i=len-1; i>=0 && !isgraph((int)str[i]); i--) + /*EMPTY*/; + cstr = (char *) HDmalloc( (i + 2)); + if (!cstr) return NULL; + cstr[i + 1] = '\0'; + HDmemcpy(cstr,str,i+1); + return cstr; +} /* HD5f2cstring */ + +/* ---------------------------- HDpackFstring ----------------------------- */ +/* +NAME + HDpackFstring -- convert a C string into a Fortran string +USAGE + intn HDpackFstring(src, dest, len) + char * src; IN: source string + char * dest; OUT: destination + intn len; IN: length of string +RETURNS + SUCCEED / FAIL +DESCRIPTION + given a NULL terminated C string 'src' convert it to + a space padded Fortran string 'dest' of length 'len' + + This is very similar to HDc2fstr except that function does + it in place and this one copies. We should probably only + support one of these. + +---------------------------------------------------------------------------*/ +int +HDpackFstring(char *src, char *dest, int len) +{ + int sofar; + + for (sofar = 0; (sofar < len) && (*src != '\0'); sofar++) + *dest++ = *src++; + + while (sofar++ < len) + *dest++ = ' '; + + return 0; +} /* HDpackFstring */ + diff --git a/fortran/src/H5f90misc.c b/fortran/src/H5f90misc.c new file mode 100644 index 0000000..728b50a --- /dev/null +++ b/fortran/src/H5f90misc.c @@ -0,0 +1,139 @@ +#include "H5f90.h" + +/*--------------------------------------------------------------------------- + * Name: h5init_types_c + * Purpose: Initialize predefined datatypes in Fortran + * Inputs: types - array with the predefined Native Fortran + * type, its element and length must be the + * same as the types array defined in the + * H5f90global.f90 + * floatingtypes - array with the predefined Floating Fortran + * type, its element and length must be the + * same as the floatingtypes array defined in the + * H5f90global.f90 + * integertypes - array with the predefined Integer Fortran + * type, its element and length must be the + * same as the integertypes array defined in the + * H5f90global.f90 + * Outputs: None + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 3, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes ) +{ + + int ret_value = -1; + hid_t c_type_id; + if ((types[0] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; +#if defined(_UNICOS) + if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; +#else + if ((types[1] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; +#endif + if ((types[2] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; +/* + if ((types[3] = H5Tcopy(H5T_NATIVE_UINT8)) < 0) return ret_value; +*/ + if ((c_type_id = H5Tcopy(H5T_FORTRAN_S1)) < 0) return ret_value; + if(H5Tset_size(c_type_id, 1) < 0) return ret_value; + if(H5Tset_strpad(c_type_id, H5T_STR_SPACEPAD) < 0) return ret_value; + types[3] = (hid_t_f)c_type_id; + + + +/* + if ((types[3] = H5Tcopy(H5T_C_S1)) < 0) return ret_value; + if(H5Tset_strpad(types[3],H5T_STR_NULLTERM) < 0) return ret_value; + if(H5Tset_size(types[3],1) < 0) return ret_value; +*/ + + +/* if ((types[3] = H5Tcopy(H5T_STD_I8BE)) < 0) return ret_value; +*/ + if ((types[4] = (hid_t_f)H5Tcopy(H5T_STD_REF_OBJ)) < 0) return ret_value; + if ((types[5] = (hid_t_f)H5Tcopy(H5T_STD_REF_DSETREG)) < 0) return ret_value; + + if ((floatingtypes[0] = (hid_t_f)H5Tcopy(H5T_IEEE_F32BE)) < 0) return ret_value; + if ((floatingtypes[1] = (hid_t_f)H5Tcopy(H5T_IEEE_F32LE)) < 0) return ret_value; + if ((floatingtypes[2] = (hid_t_f)H5Tcopy(H5T_IEEE_F64BE)) < 0) return ret_value; + if ((floatingtypes[3] = (hid_t_f)H5Tcopy(H5T_IEEE_F64LE)) < 0) return ret_value; + + if ((integertypes[0] = (hid_t_f)H5Tcopy(H5T_STD_I8BE)) < 0) return ret_value; + if ((integertypes[1] = (hid_t_f)H5Tcopy(H5T_STD_I8LE)) < 0) return ret_value; + if ((integertypes[2] = (hid_t_f)H5Tcopy(H5T_STD_I16BE)) < 0) return ret_value; + if ((integertypes[3] = (hid_t_f)H5Tcopy(H5T_STD_I16LE)) < 0) return ret_value; + if ((integertypes[4] = (hid_t_f)H5Tcopy(H5T_STD_I32BE)) < 0) return ret_value; + if ((integertypes[5] = (hid_t_f)H5Tcopy(H5T_STD_I32LE)) < 0) return ret_value; + if ((integertypes[6] = (hid_t_f)H5Tcopy(H5T_STD_I64BE)) < 0) return ret_value; + if ((integertypes[7] = (hid_t_f)H5Tcopy(H5T_STD_I64LE)) < 0) return ret_value; + if ((integertypes[8] = (hid_t_f)H5Tcopy(H5T_STD_U8BE)) < 0) return ret_value; + if ((integertypes[9] = (hid_t_f)H5Tcopy(H5T_STD_U8LE)) < 0) return ret_value; + if ((integertypes[10] = (hid_t_f)H5Tcopy(H5T_STD_U16BE)) < 0) return ret_value; + if ((integertypes[11] = (hid_t_f)H5Tcopy(H5T_STD_U16LE)) < 0) return ret_value; + if ((integertypes[12] = (hid_t_f)H5Tcopy(H5T_STD_U32BE)) < 0) return ret_value; + if ((integertypes[13] = (hid_t_f)H5Tcopy(H5T_STD_U32LE)) < 0) return ret_value; + if ((integertypes[14] = (hid_t_f)H5Tcopy(H5T_STD_U64BE)) < 0) return ret_value; + if ((integertypes[15] = (hid_t_f)H5Tcopy(H5T_STD_U64LE)) < 0) return ret_value; + + ret_value = 0; + return ret_value; +} + +/*--------------------------------------------------------------------------- + * Name: h5close_types_c + * Purpose: Closes predefined datatype in Fortran + * Inputs: types - array with the predefined Native Fortran + * type, its element and length must be the + * same as the types array defined in the + * H5f90global.f90 + * lentypes - length of the types array, which must be the + * same as the length of types array defined + * in the H5f90global.f90 + * floatingtypes - array with the predefined Floating Fortran + * type, its element and length must be the + * same as the floatingtypes array defined in the + * H5f90global.f90 + * floatinglen - length of the floatingtypes array, which must be the + * same as the length of floatingtypes array defined + * in the H5f90global.f90 + * integertypes - array with the predefined Integer Fortran + * type, its element and length must be the + * same as the integertypes array defined in the + * H5f90global.f90 + * integerlen - length of the floatingtypes array, which must be the + * same as the length of floatingtypes array defined + * in the H5f90global.f90 + * Outputs: None + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 3, 1999 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5close_types_c( hid_t_f * types, int_f *lentypes, + hid_t_f * floatingtypes, int_f* floatinglen, + hid_t_f * integertypes, int_f * integerlen ) +{ + + int ret_value = -1; + hid_t c_type_id; + herr_t err; + int i; + for (i = 0; i < *lentypes; i++) { + c_type_id = types[i]; + if ( (err = H5Tclose(c_type_id)) < 0) return ret_value; + } + for (i = 0; i < *floatinglen; i++) { + c_type_id = floatingtypes[i]; + if ( (err = H5Tclose(c_type_id)) < 0) return ret_value; + } + for (i = 0; i < *integerlen; i++) { + c_type_id = integertypes[i]; + if ( (err = H5Tclose(c_type_id)) < 0) return ret_value; + } + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5f90miscf.f90 b/fortran/src/H5f90miscf.f90 new file mode 100644 index 0000000..a345019 --- /dev/null +++ b/fortran/src/H5f90miscf.f90 @@ -0,0 +1,22 @@ + SUBROUTINE h5init_types_f(error) + USE H5GLOBAL + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: error + INTEGER, EXTERNAL :: h5init_types_c + error = h5init_types_c(predef_types, floating_types, integer_types) + + END SUBROUTINE h5init_types_f + + SUBROUTINE h5close_types_f(error) + USE H5GLOBAL + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: error + INTEGER, EXTERNAL :: h5close_types_c + error = h5close_types_c(predef_types, PREDEF_TYPES_LEN, & + floating_types, FLOATING_TYPES_LEN, & + integer_types, INTEGER_TYPES_LEN ) + + END SUBROUTINE h5close_types_f + diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h new file mode 100644 index 0000000..f759038 --- /dev/null +++ b/fortran/src/H5f90proto.h @@ -0,0 +1,872 @@ +#ifndef _H5f90proto_H +#define _H5f90proto_H + +#include "H5Git.h" +extern int HD5c2fstr(char *str, int len); +extern char * HD5fcstring (_fcd fdesc, int len); +extern int HDpackFstring(char *src, char *dest, int len); + +/* + * Functions from H5Ff.c + */ +#ifndef H5Ff90_FNAMES +# define H5Ff90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5fcreate_c FNAME(H5FCREATE_C) +# define nh5fflush_c FNAME(H5FFLUSH_C) +# define nh5fclose_c FNAME(H5FCLOSE_C) +# define nh5fopen_c FNAME(H5FOPEN_C) +# define nh5fis_hdf5_c FNAME(H5FIS_HDF5_C) +# define nh5fmount_c FNAME(H5FMOUNT_C) +# define nh5funmount_c FNAME(H5FUNMOUNT_C) +# define nh5freopen_c FNAME(H5FREOPEN_C) +# define nh5fget_create_plist_c FNAME(H5FGET_CREATE_PLIST_C) +# define nh5fget_access_plist_c FNAME(H5FGET_ACCESS_PLIST_C) +#else /* !DF_CAPFNAMES */ +# define nh5fcreate_c FNAME(h5fcreate_c) +# define nh5fflush_c FNAME(h5fflush_c) +# define nh5fclose_c FNAME(h5fclose_c) +# define nh5fopen_c FNAME(h5fopen_c) +# define nh5fis_hdf5_c FNAME(h5fis_hdf5_c) +# define nh5fmount_c FNAME(h5fmount_c) +# define nh5funmount_c FNAME(h5funmount_c) +# define nh5freopen_c FNAME(h5freopen_c) +# define nh5fget_create_plist_c FNAME(h5fget_create_plist_c) +# define nh5fget_access_plist_c FNAME(h5fget_access_plist_c) +#endif /* DF_CAPFNAMES */ +#endif /* H5Ff90_FNAMES */ + +extern int_f nh5fcreate_c +(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp, hid_t_f *file_id); + +extern int_f nh5fopen_c +(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id); + +extern int_f nh5fis_hdf5_c +(_fcd name, int_f *namelen, int_f *flag); + +extern int_f nh5fclose_c (hid_t_f *file_id); +extern int_f nh5fmount_c +(hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp); +extern int_f nh5funmount_c +(hid_t_f *loc_id, _fcd dsetname, int_f *namelen); +extern int_f nh5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2); +extern int_f nh5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id); +extern int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id); +/* + * Functions from H5Sf.c + */ +#ifndef H5Sf90_FNAMES +# define H5Sf90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5screate_simple_c FNAME(H5SCREATE_SIMPLE_C) +# define nh5sclose_c FNAME(H5SCLOSE_C) +# define nh5screate_c FNAME(H5SCREATE_C) +# define nh5scopy_c FNAME(H5SCOPY_C) +# define nh5sget_select_hyper_nblocks_c FNAME(H5SGET_SELECT_HYPER_NBLOCKS_C) +# define nh5sget_select_hyper_blocklist_c FNAME(H5SGET_SELECT_HYPER_BLOCKLIST_C) +# define nh5sget_select_elem_npoints_c FNAME(H5SGET_SELECT_ELEM_NPOINTS_C) +# define nh5sget_select_elem_pointlist_c FNAME(H5SGET_SELECT_ELEM_POINTLIST_C) +# define nh5sget_select_bounds_c FNAME(H5SGET_SELECT_BOUNDS_C) +# define nh5sselect_all_c FNAME(H5SSELECT_ALL_C) +# define nh5sselect_none_c FNAME(H5SSELECT_NONE_C) +# define nh5sselect_valid_c FNAME(H5SSELECT_VALID_C) +# define nh5sget_simple_extent_npoints_c FNAME(H5SGET_SIMPLE_EXTENT_NPOINTS_C) +# define nh5sget_select_npoints_c FNAME(H5SGET_SELECT_NPOINTS_C) +# define nh5sget_simple_extent_ndims_c FNAME(H5SGET_SIMPLE_EXTENT_NDIMS_C) +# define nh5sget_simple_extent_type_c FNAME(H5SGET_SIMPLE_EXTENT_TYPE_C) +# define nh5soffset_simple_c FNAME(H5SOFFSET_SIMPLE_C) +# define nh5sset_extent_simple_c FNAME(H5SSET_EXTENT_SIMPLE_C) +# define nh5sis_simple_c FNAME(H5SIS_SIMPLE_C) +# define nh5sextent_class_c FNAME(H5SEXTENT_CLASS_C) +# define nh5sget_simple_extent_dims_c FNAME(H5SGET_SIMPLE_EXTENT_DIMS_C) +# define nh5sextent_copy_c FNAME(H5SEXTENT_COPY_C) +# define nh5sset_extent_none_c FNAME(H5SSET_EXTENT_NONE_C) +# define nh5sselect_hyperslab_c FNAME(H5SSELECT_HYPERSLAB_C) +# define nh5sselect_elements_c FNAME(H5SSELECT_ELEMENTS_C) +#else /* !DF_CAPFNAMES */ +# define nh5screate_simple_c FNAME(h5screate_simple_c) +# define nh5sclose_c FNAME(h5sclose_c) +# define nh5screate_c FNAME(h5screate_c) +# define nh5scopy_c FNAME(h5scopy_c) +# define nh5sget_select_hyper_nblocks_c FNAME(h5sget_select_hyper_nblocks_c) +# define nh5sget_select_hyper_blocklist_c FNAME(h5sget_select_hyper_blocklist_c) +# define nh5sget_select_elem_npoints_c FNAME(h5sget_select_elem_npoints_c) +# define nh5sget_select_bounds_c FNAME(h5sget_select_bounds_c) +# define nh5sget_select_elem_pointlist_c FNAME(h5sget_select_elem_pointlist_c) +# define nh5sselect_all_c FNAME(h5sselect_all_c) +# define nh5sselect_none_c FNAME(h5sselect_none_c) +# define nh5sselect_valid_c FNAME(h5sselect_valid_c) +# define nh5sget_simple_extent_npoints_c FNAME(h5sget_simple_extent_npoints_c) +# define nh5sget_select_npoints_c FNAME(h5sget_select_npoints_c) +# define nh5sget_simple_extent_ndims_c FNAME(h5sget_simple_extent_ndims_c) +# define nh5sget_simple_extent_type_c FNAME(h5sget_simple_extent_type_c) +# define nh5soffset_simple_c FNAME(h5soffset_simple_c) +# define nh5sset_extent_simple_c FNAME(h5sset_extent_simple_c) +# define nh5sis_simple_c FNAME(h5sis_simple_c) +# define nh5sextent_class_c FNAME(h5sextent_class_c) +# define nh5sget_simple_extent_dims_c FNAME(h5sget_simple_extent_dims_c) +# define nh5sextent_copy_c FNAME(h5sextent_copy_c) +# define nh5sset_extent_none_c FNAME(h5sset_extent_none_c) +# define nh5sselect_hyperslab_c FNAME(h5sselect_hyperslab_c) +# define nh5sselect_elements_c FNAME(h5sselect_elements_c) +#endif /* DF_CAPFNAMES */ +#endif + +extern int_f nh5screate_simple_c +( int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id ); + +extern int_f nh5sclose_c ( hid_t_f *space_id ); + +extern int_f nh5screate_c ( int_f *classtype, hid_t_f *space_id ); + +extern int_f nh5scopy_c ( hid_t_f *space_id , hid_t_f *new_space_id); +extern int_f nh5sget_select_hyper_nblocks_c( hid_t_f *space_id , hssize_t_f * num_blocks); +extern int_f nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, hsize_t_f * num_blocks, hsize_t_f * buf); + +extern int_f nh5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end); + +extern int_f nh5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points); + +extern int_f nh5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint, hsize_t_f * numpoints, hsize_t_f * buf); +extern int_f nh5sselect_all_c ( hid_t_f *space_id ); + +extern int_f nh5sselect_none_c ( hid_t_f *space_id ); + +extern int_f nh5sselect_valid_c ( hid_t_f *space_id , int_f *flag ); + +extern int_f nh5sget_simple_extent_npoints_c ( hid_t_f *space_id , hsize_t_f *npoints ); + +extern int_f nh5sget_select_npoints_c ( hid_t_f *space_id , hssize_t_f *npoints ); + +extern int_f nh5sget_simple_extent_ndims_c ( hid_t_f *space_id , int_f *ndims ); + +extern int_f nh5sget_simple_extent_type_c ( hid_t_f *space_id , int_f *classtype); + +extern int_f nh5soffset_simple_c ( hid_t_f *space_id , hssize_t_f *offset); + +extern int_f nh5sset_extent_simple_c ( hid_t_f *space_id , int_f *rank, hsize_t_f * current_size, hsize_t_f *maximum_size); + +extern int_f nh5sis_simple_c ( hid_t_f *space_id , int_f *flag ); + +extern int_f nh5sextent_class_c ( hid_t_f *space_id , int_f *classtype); + +extern int_f nh5sget_simple_extent_dims_c ( hid_t_f *space_id , hsize_t_f *dims, hsize_t_f *maxdims); + +extern int_f nh5sextent_copy_c ( hid_t_f *dest_space_id , hid_t_f *source_space_id); + +extern int_f nh5sset_extent_none_c ( hid_t_f *space_id ); + +extern int_f nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block); + +extern int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hssize_t_f *coord); + + +/* + * Functions from H5Df.c + */ + +#ifndef H5Df90_FNAMES +# define H5Df90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5dcreate_c FNAME(H5DCREATE_C) +# define nh5dclose_c FNAME(H5DCLOSE_C) +# define nh5dopen_c FNAME(H5DOPEN_C) +# define nh5dwrite_c FNAME(H5DWRITE_C) +# define nh5dwritec_c FNAME(H5DWRITEC_C) +# define nh5dread_c FNAME(H5DREAD_C) +# define nh5dreadc_c FNAME(H5DREADC_C) +# define nh5dget_space_c FNAME(H5DGET_SPACE_C) +# define nh5dget_type_c FNAME(H5DGET_TYPE_C) +# define nh5dget_create_plist_c FNAME(H5DGET_CREATE_PLIST_C) +# define nh5dextend_c FNAME(H5DEXTEND_C) +#else /* !DF_CAPFNAMES */ +# define nh5dcreate_c FNAME(h5dcreate_c) +# define nh5dclose_c FNAME(h5dclose_c) +# define nh5dopen_c FNAME(h5dopen_c) +# define nh5dwrite_c FNAME(h5dwrite_c) +# define nh5dwritec_c FNAME(h5dwritec_c) +# define nh5dread_c FNAME(h5dread_c) +# define nh5dreadc_c FNAME(h5dreadc_c) +# define nh5dget_space_c FNAME(h5dget_space_c) +# define nh5dget_type_c FNAME(h5dget_type_c) +# define nh5dget_create_plist_c FNAME(h5dget_create_plist_c) +# define nh5dextend_c FNAME(h5dextend_c) +#endif /* DF_CAPFNAMES */ +#endif + +extern int_f nh5dcreate_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *dset_id); + +extern int_f nh5dopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dset_id); + +extern int_f nh5dclose_c ( hid_t_f *dset_id ); + +extern int_f nh5dwrite_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf); + + +extern int_f nh5dwritec_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf); + +extern int_f nh5dread_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf); + + +extern int_f nh5dreadc_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf); + +extern int_f nh5dget_space_c ( hid_t_f *dset_id , hid_t_f *space_id); + +extern int_f nh5dget_type_c ( hid_t_f *dset_id , hid_t_f *type_id); + +extern int_f nh5dget_create_plist_c ( hid_t_f *dset_id , hid_t_f *plist_id); + +extern int_f nh5dextend_c ( hid_t_f *dset_id , hsize_t_f *dims); +/* + * Functions from H5Gf.c + */ + +#ifndef H5Gf90_FNAMES +# define H5Gf90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5gcreate_c FNAME(H5GCREATE_C) +# define nh5gclose_c FNAME(H5GCLOSE_C) +# define nh5gopen_c FNAME(H5GOPEN_C) +# define nh5gget_obj_info_idx_c FNAME(H5GGET_OBJ_INFO_IDX_C) +# define nh5gn_members_c FNAME(H5GN_MEMBERS_C) +# define nh5glink_c FNAME(H5GLINK_C) +# define nh5gunlink_c FNAME(H5GUNLINK_C) +# define nh5gmove_c FNAME(H5GMOVE_C) +# define nh5gget_linkval_c FNAME(H5GGET_LINKVAL_C) +# define nh5gset_comment_c FNAME(H5GSET_COMMENT_C) +# define nh5gget_comment_c FNAME(H5GGET_COMMENT_C) +#else /* !DF_CAPFNAMES */ +# define nh5gcreate_c FNAME(h5gcreate_c) +# define nh5gclose_c FNAME(h5gclose_c) +# define nh5gopen_c FNAME(h5gopen_c) +# define nh5gget_obj_info_idx_c FNAME(h5gget_obj_info_idx_c) +# define nh5gn_members_c FNAME(h5gn_members_c) +# define nh5glink_c FNAME(h5glink_c) +# define nh5gunlink_c FNAME(h5gunlink_c) +# define nh5gmove_c FNAME(h5gmove_c) +# define nh5gget_linkval_c FNAME(h5gget_linkval_c) +# define nh5gset_comment_c FNAME(h5gset_comment_c) +# define nh5gget_comment_c FNAME(h5gget_comment_c) +#endif /* DF_CAPFNAMES */ +#endif + +extern int_f nh5gcreate_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id); + +extern int_f nh5gopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *grp_id); + +extern int_f nh5gclose_c ( hid_t_f *grp_id ); + +extern int_f nh5gget_obj_info_idx_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type); + +extern int_f nh5gn_members_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers); + +extern int_f nh5glink_c +(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name, int_f *new_namelen); + +extern int_f nh5gunlink_c +(hid_t_f *loc_id, _fcd name, int_f *namelen); + +extern int_f nh5gmove_c +(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f *dst_namelen); + +extern int_f nh5gget_linkval_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value ); + +extern int_f nh5gset_comment_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f *commentlen); + +extern int_f nh5gget_comment_c +(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment); + + +/* + * Functions from H5Af.c + */ + +#ifndef H5Af90_FNAMES +# define H5Af90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5acreate_c FNAME(H5ACREATE_C) +# define nh5aclose_c FNAME(H5ACLOSE_C) +# define nh5aopen_name_c FNAME(H5AOPEN_NAME_C) +# define nh5awrite_c FNAME(H5AWRITE_C) +# define nh5awritec_c FNAME(H5AWRITEC_C) +# define nh5aread_c FNAME(H5AREAD_C) +# define nh5areadc_c FNAME(H5AREADC_C) +# define nh5aget_name_c FNAME(H5AGET_NAME_C) +# define nh5aopen_idx_c FNAME(H5AOPEN_IDX_C) +# define nh5aget_space_c FNAME(H5AGET_SPACE_C) +# define nh5aget_type_c FNAME(H5AGET_TYPE_C) +# define nh5aget_num_attrs_c FNAME(H5AGET_NUM_ATTRS_C) +# define nh5adelete_c FNAME(H5ADELETE_C) +#else /* !DF_CAPFNAMES */ +# define nh5acreate_c FNAME(h5acreate_c) +# define nh5aclose_c FNAME(h5aclose_c) +# define nh5aopen_name_c FNAME(h5aopen_name_c) +# define nh5awrite_c FNAME(h5awrite_c) +# define nh5awritec_c FNAME(h5awritec_c) +# define nh5aread_c FNAME(h5aread_c) +# define nh5areadc_c FNAME(h5areadc_c) +# define nh5aget_name_c FNAME(h5aget_name_c) +# define nh5aopen_idx_c FNAME(h5aopen_idx_c) +# define nh5aget_space_c FNAME(h5aget_space_c) +# define nh5aget_type_c FNAME(h5aget_type_c) +# define nh5aget_num_attrs_c FNAME(h5aget_num_attrs_c) +# define nh5adelete_c FNAME(h5adelete_c) +#endif /* DF_CAPFNAMES */ +#endif + + +extern int_f nh5acreate_c (hid_t_f *obj_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *attr_id); + +extern int_f +nh5aopen_name_c (hid_t_f *obj_id, _fcd name, int_f *namelen, hid_t_f *attr_id); + +extern int_f nh5awritec_c (hid_t_f *attr_id, hid_t_f *mem_type_id, _fcd buf); + +extern int_f nh5awrite_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf); + +extern int_f nh5areadc_c (hid_t_f *attr_id, hid_t_f *mem_type_id, _fcd buf); + +extern int_f nh5aread_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf); + +extern int_f nh5aclose_c ( hid_t_f *attr_id ); + +extern int_f nh5adelete_c (hid_t_f *obj_id, _fcd name, int_f *namelen); + +extern int_f nh5aopen_idx_c (hid_t_f *obj_id, int_f *idx, hid_t_f *attr_id); + +extern int_f nh5aget_space_c (hid_t_f *attr_id, hid_t_f *space_id); + +extern int_f nh5aget_type_c (hid_t_f *attr_id, hid_t_f *type_id); + +extern int_f nh5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num); + +extern int_f nh5aget_name_c(hid_t_f *attr_id, size_t_f *size, _fcd buf); + +/* + * Functions form H5Tf.c file + */ +#ifndef H5Tf90_FNAMES +# define H5Tf90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5topen_c FNAME(H5TOPEN_C) +# define nh5tcommit_c FNAME(H5TCOMMIT_C) +# define nh5tcommitted_c FNAME(H5TCOMMITTED_C) +# define nh5tclose_c FNAME(H5TCLOSE_C) +# define nh5tcopy_c FNAME(H5TCOPY_C) +# define nh5tequal_c FNAME(H5TEQUAL_C) +# define nh5tget_class_c FNAME(H5TGET_CLASS_C) +# define nh5tget_order_c FNAME(H5TGET_ORDER_C) +# define nh5tset_order_c FNAME(H5TSET_ORDER_C) +# define nh5tget_size_c FNAME(H5TGET_SIZE_C) +# define nh5tset_size_c FNAME(H5TSET_SIZE_C) +# define nh5tget_precision_c FNAME(H5TGET_PRECISION_C) +# define nh5tset_precision_c FNAME(H5TSET_PRECISION_C) +# define nh5tget_offset_c FNAME(H5TGET_OFFSET_C) +# define nh5tset_offset_c FNAME(H5TSET_OFFSET_C) +# define nh5tget_pad_c FNAME(H5TGET_PAD_C) +# define nh5tset_pad_c FNAME(H5TSET_PAD_C) +# define nh5tget_sign_c FNAME(H5TGET_SIGN_C) +# define nh5tset_sign_c FNAME(H5TSET_SIGN_C) +# define nh5tget_fields_c FNAME(H5TGET_FIELDS_C) +# define nh5tset_fields_c FNAME(H5TSET_FIELDS_C) +# define nh5tget_ebias_c FNAME(H5TGET_EBIAS_C) +# define nh5tset_ebias_c FNAME(H5TSET_EBIAS_C) +# define nh5tget_norm_c FNAME(H5TGET_NORM_C) +# define nh5tset_norm_c FNAME(H5TSET_NORM_C) +# define nh5tget_inpad_c FNAME(H5TGET_INPAD_C) +# define nh5tset_inpad_c FNAME(H5TSET_INPAD_C) +# define nh5tget_cset_c FNAME(H5TGET_CSET_C) +# define nh5tset_cset_c FNAME(H5TSET_CSET_C) +# define nh5tget_strpad_c FNAME(H5TGET_STRPAD_C) +# define nh5tset_strpad_c FNAME(H5TSET_STRPAD_C) +# define nh5tget_nmembers_c FNAME(H5TGET_NMEMBERS_C) +# define nh5tget_member_name_c FNAME(H5TGET_MEMBER_NAME_C) +# define nh5tget_member_offset_c FNAME(H5TGET_MEMBER_OFFSET_C) +# define nh5tget_member_dims_c FNAME(H5TGET_MEMBER_DIMS_C) +# define nh5tget_member_type_c FNAME(H5TGET_MEMBER_TYPE_C) +# define nh5tinsert_c FNAME(H5TINSERT_C) +# define nh5tcreate_c FNAME(H5TCREATE_C) +# define nh5tpack_c FNAME(H5TPACK_C) +# define nh5tinsert_array_c FNAME(H5TINSERT_ARRAY_C) +# define nh5tinsert_array_c2 FNAME(H5TINSERT_ARRAY_C2) +# define nh5tenum_create_c FNAME(H5TENUM_CREATE_C) +# define nh5tenum_insert_c FNAME(H5TENUM_INSERT_C) +# define nh5tenum_nameof_c FNAME(H5TENUM_NAMEOF_C) +# define nh5tenum_valueof_c FNAME(H5TENUM_VALUEOF_C) +# define nh5tget_member_value_c FNAME(H5TGET_MEMBER_VALUE_C) +# define nh5set_tag_c FNAME(H5TSET_TAG_C) +# define nh5get_tag_c FNAME(H5TGET_TAG_C) +#else +# define nh5topen_c FNAME(h5topen_c) +# define nh5tcommit_c FNAME(h5tcommit_c) +# define nh5tcommitted_c FNAME(h5tcommitted_c) +# define nh5tclose_c FNAME(h5tclose_c) +# define nh5tcopy_c FNAME(h5tcopy_c) +# define nh5tequal_c FNAME(h5tequal_c) +# define nh5tget_class_c FNAME(h5tget_class_c) +# define nh5tget_order_c FNAME(h5tget_order_c) +# define nh5tset_order_c FNAME(h5tset_order_c) +# define nh5tget_size_c FNAME(h5tget_size_c) +# define nh5tset_size_c FNAME(h5tset_size_c) +# define nh5tget_precision_c FNAME(h5tget_precision_c) +# define nh5tset_precision_c FNAME(h5tset_precision_c) +# define nh5tget_offset_c FNAME(h5tget_offset_c) +# define nh5tset_offset_c FNAME(h5tset_offset_c) +# define nh5tget_pad_c FNAME(h5tget_pad_c) +# define nh5tset_pad_c FNAME(h5tset_pad_c) +# define nh5tget_sign_c FNAME(h5tget_sign_c) +# define nh5tset_sign_c FNAME(h5tset_sign_c) +# define nh5tget_fields_c FNAME(h5tget_fields_c) +# define nh5tset_fields_c FNAME(h5tset_fields_c) +# define nh5tget_ebias_c FNAME(h5tget_ebias_c) +# define nh5tset_ebias_c FNAME(h5tset_ebias_c) +# define nh5tget_norm_c FNAME(h5tget_norm_c) +# define nh5tset_norm_c FNAME(h5tset_norm_c) +# define nh5tget_inpad_c FNAME(h5tget_inpad_c) +# define nh5tset_inpad_c FNAME(h5tset_inpad_c) +# define nh5tget_cset_c FNAME(h5tget_cset_c) +# define nh5tset_cset_c FNAME(h5tset_cset_c) +# define nh5tget_strpad_c FNAME(h5tget_strpad_c) +# define nh5tset_strpad_c FNAME(h5tset_strpad_c) +# define nh5tget_nmembers_c FNAME(h5tget_nmembers_c) +# define nh5tget_member_name_c FNAME(h5tget_member_name_c) +# define nh5tget_member_offset_c FNAME(h5tget_member_offset_c) +# define nh5tget_member_dims_c FNAME(h5tget_member_dims_c) +# define nh5tget_member_type_c FNAME(h5tget_member_type_c) +# define nh5tinsert_c FNAME(h5tinsert_c) +# define nh5tcreate_c FNAME(h5tcreate_c) +# define nh5tpack_c FNAME(h5tpack_c) +# define nh5tinsert_array_c FNAME(h5tinsert_array_c) +# define nh5tinsert_array_c2 FNAME(h5tinsert_array_c2) +# define nh5tenum_create_c FNAME(h5tenum_create_c) +# define nh5tenum_insert_c FNAME(h5tenum_insert_c) +# define nh5tenum_nameof_c FNAME(h5tenum_nameof_c) +# define nh5tenum_valueof_c FNAME(h5tenum_valueof_c) +# define nh5tget_member_value_c FNAME(h5tget_member_value_c) +# define nh5tset_tag_c FNAME(h5tset_tag_c) +# define nh5tget_tag_c FNAME(h5tget_tag_c) +#endif +#endif + +extern int_f nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id); + +extern int_f nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id); + +extern int_f +nh5tcommit_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id); + +extern int_f nh5tclose_c ( hid_t_f *type_id ); + +extern int_f nh5tequal_c ( hid_t_f *type1_id , hid_t_f *type2_id, int_f *c_flag); + +extern int_f nh5tcopy_c ( hid_t_f *type_id , hid_t_f *new_type_id); + +extern int_f nh5tget_class_c ( hid_t_f *type_id , int_f *classtype); + +extern int_f nh5tget_order_c ( hid_t_f *type_id , int_f *order); + +extern int_f nh5tset_order_c ( hid_t_f *type_id , int_f *order); + +extern int_f nh5tget_size_c ( hid_t_f *type_id , size_t_f *size); + +extern int_f nh5tset_size_c ( hid_t_f *type_id , size_t_f *size); +extern int_f nh5tcommitted_c (hid_t_f *type_id); +extern int_f nh5tget_precision_c ( hid_t_f *type_id , size_t_f *precision); +extern int_f nh5tset_precision_c ( hid_t_f *type_id , size_t_f *precision); +extern int_f nh5tget_offset_c ( hid_t_f *type_id , size_t_f *offset); +extern int_f nh5tset_offset_c ( hid_t_f *type_id , size_t_f *offset); +extern int_f nh5tget_pad_c ( hid_t_f *type_id , int_f * lsbpad, int_f * msbpad); +extern int_f nh5tset_pad_c ( hid_t_f *type_id, int_f * lsbpad, int_f * msbpad ); +extern int_f nh5tget_sign_c ( hid_t_f *type_id , int_f* sign); +extern int_f nh5tset_sign_c ( hid_t_f *type_id , int_f *sign); +extern int_f nh5tget_fields_c ( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize); +extern int_f nh5tset_fields_c ( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize); +extern int_f nh5tget_ebias_c ( hid_t_f *type_id , size_t_f *ebias); + +extern int_f nh5tset_ebias_c ( hid_t_f *type_id , size_t_f *ebias); +extern int_f nh5tget_norm_c ( hid_t_f *type_id , int_f *norm); + +extern int_f nh5tset_norm_c ( hid_t_f *type_id , int_f *norm); +extern int_f nh5tget_inpad_c ( hid_t_f *type_id, int_f * padtype); +extern int_f nh5tset_inpad_c ( hid_t_f *type_id, int_f * padtype); +extern int_f nh5tget_cset_c ( hid_t_f *type_id, int_f * cset); +extern int_f nh5tset_cset_c ( hid_t_f *type_id, int_f * cset); +extern int_f nh5tget_strpad_c ( hid_t_f *type_id, int_f * strpad); +extern int_f nh5tset_strpad_c ( hid_t_f *type_id, int_f * strpad); +extern int_f nh5tget_nmembers_c ( hid_t_f *type_id , int_f * num_members); +extern int_f nh5tget_member_name_c ( hid_t_f *type_id ,int_f* index, _fcd member_name, int_f *namelen); +extern int_f nh5tget_member_dims_c ( hid_t_f *type_id ,int_f* field_idx, int_f * dims, size_t_f * field_dims, int_f * perm ); +extern int_f nh5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f* offset); +extern int_f nh5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype); +extern int_f nh5tinsert_c(hid_t_f *type_id, _fcd name, int_f* namelen, size_t_f *offset, hid_t_f * field_id); +extern int_f nh5tpack_c(hid_t_f * type_id); + +extern int_f nh5tinsert_array_c(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id, int_f* perm ); + +extern int_f nh5tinsert_array_c2(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id); + +extern int_f nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id); + +extern int_f nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value); +extern int_f +nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen); +extern int_f +nh5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value); +extern int_f +nh5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value); +extern int_f +nh5tset_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen); +extern int_f +nh5tget_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen); + + +/* + * Functions from H5Pf.c + */ + +#ifndef H5Pf90_FNAMES +# define H5Pf90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5pcreate_c FNAME(H5PCREATE_C) +# define nh5pclose_c FNAME(H5PCLOSE_C) +# define nh5pcopy_c FNAME(H5PCOPY_C) +# define nh5pget_class_c FNAME(H5PGET_CLASS_C) +# define nh5pset_deflate_c FNAME(H5PSET_DEFLATE_C) +# define nh5pset_preserve_c FNAME(H5PSET_PRESERVE_C) +# define nh5pget_preserve_c FNAME(H5PGET_PRESERVE_C) +# define nh5pset_chunk_c FNAME(H5PSET_CHUNK_C) +# define nh5pget_chunk_c FNAME(H5PGET_CHUNK_C) +# define nh5pset_fill_valuec_c FNAME(H5PSET_FILL_VALUEC_C) +# define nh5pset_fill_value_c FNAME(H5PSET_FILL_VALUE_C) +# define nh5pget_fill_valuec_c FNAME(H5PGET_FILL_VALUEC_C) +# define nh5pget_fill_value_c FNAME(H5PGET_FILL_VALUE_C) +# define nh5pget_version_c FNAME(H5PGET_VERSION_C) +# define nh5pget_userblock_c FNAME(H5PGET_USERBLOCK_C) +# define nh5pset_userblock_c FNAME(H5PSET_USERBLOCK_C) +# define nh5pset_sizes_c FNAME(H5PSET_SIZES_C) +# define nh5pget_sizes_c FNAME(H5PGET_SIZES_C) +# define nh5pget_sym_k_c FNAME(H5PGET_SYM_K_C) +# define nh5pset_sym_k_c FNAME(H5PSET_SYM_K_C) +# define nh5pget_istore_k_c FNAME(H5PGET_ISTORE_K_C) +# define nh5pset_istore_k_c FNAME(H5PSET_ISTORE_K_C) +# define nh5pget_driver_c FNAME(H5PGET_DRIVER_C) +# define nh5pset_stdio_c FNAME(H5PSET_STDIO_C) +# define nh5pget_stdio_c FNAME(H5PGET_STDIO_C) +# define nh5pset_sec2_c FNAME(H5PSET_SEC2_C) +# define nh5pget_sec2_c FNAME(H5PGET_SEC2_C) +# define nh5pset_alignment_c FNAME(H5PSET_ALIGNMENT_C) +# define nh5pget_alignment_c FNAME(H5PGET_ALIGNMENT_C) +# define nh5pset_core_c FNAME(H5PSET_CORE_C) +# define nh5pget_core_c FNAME(H5PGET_CORE_C) +# define nh5pset_family_c FNAME(H5PSET_FAMILY_C) +# define nh5pget_family_c FNAME(H5PGET_FAMILY_C) +# define nh5pset_cache_c FNAME(H5PSET_CACHE_C) +# define nh5pget_cache_c FNAME(H5PGET_CACHE_C) +# define nh5pset_split_c FNAME(H5PSET_SPLIT_C) +# define nh5pget_split_c FNAME(H5PGET_SPLIT_C) +# define nh5pset_gc_refernces_c FNAME(H5PSET_GC_REFERENCES_C) +# define nh5pget_gc_refernces_c FNAME(H5PGET_GC_REFERENCES_C) +# define nh5pset_layout_c FNAME(H5PSET_LAYOUT_C) +# define nh5pget_layout_c FNAME(H5PGET_LAYOUT_C) +# define nh5pset_filter_c FNAME(H5PSET_FILTER_C) +# define nh5pget_nfilters_c FNAME(H5PGET_NFILTERS_C) +# define nh5pget_filter_c FNAME(H5PGET_FILTER_C) +# define nh5pset_external_c FNAME(H5PSET_EXTERNAL_C) +# define nh5pget_external_count_c FNAME(H5PGET_EXTERNAL_COUNT_C) +# define nh5pget_external_c FNAME(H5PGET_EXTERNAL_C) +# define nh5pset_hyper_cache_c FNAME(H5PSET_HYPER_CACHE_C) +# define nh5pget_hyper_cache_c FNAME(H5PGET_HYPER_CACHE_C) +# define nh5pget_btree_ratios_c FNAME(H5PGET_BTREE_RATIOS_C) +# define nh5pset_btree_ratios_c FNAME(H5PSET_BTREE_RATIOS_C) +# define nh5pset_mpi_c FNAME(H5PSET_MPI_C) +# define nh5pget_mpi_c FNAME(H5PGET_MPI_C) +# define nh5pset_xfer_c FNAME(H5PSET_XFER_C) +# define nh5pget_xfer_c FNAME(H5PGET_XFER_C) + +#else +# define nh5pcreate_c FNAME(h5pcreate_c) +# define nh5pclose_c FNAME(h5pclose_c) +# define nh5pcopy_c FNAME(h5pcopy_c) +# define nh5pget_class_c FNAME(h5pget_class_c) +# define nh5pset_deflate_c FNAME(h5pset_deflate_c) +# define nh5pset_preserve_c FNAME(h5pset_preserve_c) +# define nh5pget_preserve_c FNAME(h5pget_preserve_c) +# define nh5pset_chunk_c FNAME(h5pset_chunk_c) +# define nh5pget_chunk_c FNAME(h5pget_chunk_c) +# define nh5pset_fill_valuec_c FNAME(h5pset_fill_valuec_c) +# define nh5pset_fill_value_c FNAME(h5pset_fill_value_c) +# define nh5pget_fill_valuec_c FNAME(h5pget_fill_valuec_c) +# define nh5pget_fill_value_c FNAME(h5pget_fill_value_c) +# define nh5pget_version_c FNAME(h5pget_version_c) +# define nh5pget_userblock_c FNAME(h5pget_userblock_c) +# define nh5pset_userblock_c FNAME(h5pset_userblock_c) +# define nh5pset_sizes_c FNAME(h5pset_sizes_c) +# define nh5pget_sizes_c FNAME(h5pget_sizes_c) +# define nh5pget_sym_k_c FNAME(h5pget_sym_k_c) +# define nh5pset_sym_k_c FNAME(h5pset_sym_k_c) +# define nh5pget_istore_k_c FNAME(h5pget_istore_k_c) +# define nh5pset_istore_k_c FNAME(h5pset_istore_k_c) +# define nh5pget_driver_c FNAME(h5pget_driver_c) +# define nh5pset_stdio_c FNAME(h5pset_stdio_c) +# define nh5pget_stdio_c FNAME(h5pget_stdio_c) +# define nh5pset_sec2_c FNAME(h5pset_sec2_c) +# define nh5pget_sec2_c FNAME(h5pget_sec2_c) +# define nh5pset_alignment_c FNAME(h5pset_alignment_c) +# define nh5pget_alignment_c FNAME(h5pget_alignment_c) +# define nh5pset_core_c FNAME(h5pset_core_c) +# define nh5pget_core_c FNAME(h5pget_core_c) +# define nh5pset_family_c FNAME(h5pset_family_c) +# define nh5pget_family_c FNAME(h5pget_family_c) +# define nh5pset_cache_c FNAME(h5pset_cache_c) +# define nh5pget_cache_c FNAME(h5pget_cache_c) +# define nh5pset_split_c FNAME(h5pset_split_c) +# define nh5pget_split_c FNAME(h5pget_split_c) +# define nh5pset_gc_references_c FNAME(h5pset_gc_references_c) +# define nh5pget_gc_references_c FNAME(h5pget_gc_references_c) +# define nh5pset_layout_c FNAME(h5pset_layout_c) +# define nh5pget_layout_c FNAME(h5pget_layout_c) +# define nh5pset_filter_c FNAME(h5pset_filter_c) +# define nh5pget_nfilters_c FNAME(h5pget_nfilters_c) +# define nh5pget_filter_c FNAME(h5pget_filter_c) +# define nh5pset_external_c FNAME(h5pset_external_c) +# define nh5pget_external_count_c FNAME(h5pget_external_count_c) +# define nh5pget_external_c FNAME(h5pget_external_c) +# define nh5pset_hyper_cache_c FNAME(h5pset_hyper_cache_c) +# define nh5pget_hyper_cache_c FNAME(h5pget_hyper_cache_c) +# define nh5pget_btree_ratios_c FNAME(h5pget_btree_ratios_c) +# define nh5pset_btree_ratios_c FNAME(h5pset_btree_ratios_c) +# define nh5pset_mpi_c FNAME(h5pset_mpi_c) +# define nh5pget_mpi_c FNAME(h5pget_mpi_c) +# define nh5pset_xfer_c FNAME(h5pset_xfer_c) +# define nh5pget_xfer_c FNAME(h5pget_xfer_c) + +#endif +#endif + +extern int_f nh5pcreate_c ( int_f *classtype, hid_t_f *prp_id ); + +extern int_f nh5pclose_c ( hid_t_f *prp_id ); + +extern int_f nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id); + +extern int_f nh5pget_class_c ( hid_t_f *prp_id , int_f *classtype); + +extern int_f nh5pset_deflate_c ( hid_t_f *prp_id , int_f *level); + +extern int_f nh5pset_chunk_c ( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims ); + +extern int_f nh5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims ); + +extern int_f +nh5pset_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); + +extern int_f +nh5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); + +extern int_f +nh5pget_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); + +extern int_f +nh5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); + +extern int_f +nh5pset_preserve_c ( hid_t_f *prp_id , int_f *flag); + +extern int_f +nh5pget_preserve_c ( hid_t_f *prp_id , int_f *flag); +extern int_f +nh5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr); +extern int_f +nh5pset_userblock_c (hid_t_f *prp_id, hsize_t_f * size); +extern int_f +nh5pget_userblock_c (hid_t_f *prp_id, hsize_t_f * size); +extern int_f +nh5pget_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size); +extern int_f +nh5pset_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size); +extern int_f +nh5pset_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk); +extern int_f +nh5pget_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk); +extern int_f +nh5pset_istore_k_c (hid_t_f *prp_id, int_f* ik); +extern int_f +nh5pget_istore_k_c (hid_t_f *prp_id, int_f* ik); +extern int_f +nh5pget_driver_c (hid_t_f *prp_id, int_f*driver); +extern int_f +nh5pset_stdio_c (hid_t_f *prp_id); +extern int_f +nh5pget_stdio_c (hid_t_f *prp_id, int_f* io); +extern int_f +nh5pset_sec2_c (hid_t_f *prp_id); +extern int_f +nh5pget_sec2_c (hid_t_f *prp_id, int_f* sec2); +extern int_f +nh5pset_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment); +extern int_f +nh5pget_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment); +extern int_f +nh5pget_core_c (hid_t_f *prp_id, size_t_f* increment); +extern int_f +nh5pset_core_c (hid_t_f *prp_id, size_t_f* increment); +extern int_f +nh5pset_family_c (hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ); +extern int_f +nh5pget_family_c (hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ); +extern int_f +nh5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0); +extern int_f +nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, int_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0); +extern int_f +nh5pget_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_f* meta_plist, size_t_f* raw_ext_size, _fcd raw_ext, hid_t_f * raw_plist); +extern int_f +nh5pset_split_c(hid_t_f *prp_id, int_f* meta_len, _fcd meta_ext, hid_t_f* meta_plist, int_f* raw_len, _fcd raw_ext, hid_t_f * raw_plist); +extern int_f +nh5pset_gc_references_c(hid_t_f *prp_id, int_f* gc_references); +extern int_f +nh5pget_gc_references_c(hid_t_f *prp_id, int_f* gc_references); +extern int_f +nh5pset_layout_c (hid_t_f *prp_id, int_f* layout); +extern int_f +nh5pget_layout_c (hid_t_f *prp_id, int_f* layout); +extern int_f +nh5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ); +extern int_f +nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters); +extern int_f +nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id); +extern int_f +nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes); +extern int_f +nh5pget_external_count_c (hid_t_f *prp_id, int_f* count); +extern int_f +nh5pget_external_c(hid_t_f *prp_id,int*idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes); +extern int_f +nh5pset_hyper_cache_c(hid_t_f *prp_id, int_f* cache, int_f* limit); +extern int_f +nh5pget_hyper_cache_c(hid_t_f *prp_id, int_f* cache, int_f* limit); +extern int_f +nh5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); +extern int_f +nh5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); +extern int_f +nh5pget_mpi_c(hid_t_f *prp_id, int_f* comm, int_f* info); +extern int_f +nh5pset_mpi_c(hid_t_f *prp_id, int_f* comm, int_f* info); +extern int_f +nh5pget_xfer_c(hid_t_f *prp_id, int_f* data_xfer_mode); +extern int_f +nh5pset_xfer_c(hid_t_f *prp_id, int_f* data_xfer_mode); + +/* + * Functions frome H5Rf.c + */ +#ifndef H5Rf90_FNAMES +# define H5Rf90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5rcreate_object_c FNAME(H5RCREATE_OBJECT_C) +# define nh5rcreate_region_c FNAME(H5RCREATE_REGION_C) +# define nh5rdereference_region_c FNAME(H5RDEREFERENCE_REGION_C) +# define nh5rdereference_object_c FNAME(H5RDEREFERENCE_OBJECT_C) +# define nh5rget_region_region_c FNAME(H5RGET_REGION_REGION_C) +# define nh5rget_object_type_obj_c FNAME(H5RGET_OBJECT_TYPE_OBJ_C) +#else /* !DF_CAPFNAMES */ +# define nh5rcreate_object_c FNAME(h5rcreate_object_c) +# define nh5rcreate_region_c FNAME(h5rcreate_region_c) +# define nh5rdereference_region_c FNAME(h5rdereference_region_c) +# define nh5rdereference_object_c FNAME(h5rdereference_object_c) +# define nh5rget_region_region_c FNAME(h5rget_region_region_c) +# define nh5rget_object_type_obj_c FNAME(h5rget_object_type_obj_c) +#endif /* DF_CAPFNAMES */ +#endif /* H5Rf90_FNAMES */ + +extern int_f +nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen); + + +extern int_f +nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id); + +extern int_f +nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id); + +extern int_f +nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id); + +extern int_f +nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id); + +extern int_f +nh5rget_object_type_obj_c (hid_t_f *dset_id, _fcd ref, int_f *obj_type); + +/* + * Functions from H5If.c + */ +#ifndef H5If90_FNAMES +# define H5If90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5iget_type_c FNAME(H5IGET_TYPE_C) +#else +# define nh5iget_type_c FNAME(h5iget_type_c) +#endif +#endif + +extern int_f nh5iget_type_c(hid_t_f *obj_id, int_f *type); + + +#ifndef H5Ef90_FNAMES +# define H5Ef90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5eclear_c FNAME(H5ECLEAR_C) +# define nh5eprint_c1 FNAME(H5EPRINT_C1) +# define nh5eprint_c2 FNAME(H5EPRINT_C2) +# define nh5eget_major_c FNAME(H5EGET_MAJOR_C) +# define nh5eget_minor_c FNAME(H5EGET_MINOR_C) +# define nh5eset_auto_c FNAME(H5ESET_AUTO_C) +#else +# define nh5eclear_c FNAME(h5eclear_c) +# define nh5eprint_c1 FNAME(h5eprint_c1) +# define nh5eprint_c2 FNAME(h5eprint_c2) +# define nh5eget_major_c FNAME(h5eget_major_c) +# define nh5eget_minor_c FNAME(h5eget_minor_c) +# define nh5eset_auto_c FNAME(h5eset_auto_c) +#endif +#endif + +extern int_f nh5eclear_c(); +extern int_f nh5eprint_c1(_fcd name, int_f* namelen); +extern int_f nh5eprint_c2(); +extern int_f nh5eget_major_c(int_f* error_no, _fcd name); +extern int_f nh5eget_minor_c(int_f* error_no, _fcd name); +extern int_f nh5eset_auto_c(int_f* printflag); + +/* + * Functions from H5f90misc.c + */ +#ifndef H5MISCf90_FNAMES +# define H5MISCf90_FNAMES +#ifdef DF_CAPFNAMES +# define nh5init_types_c FNAME(H5INIT_TYPES_C) +# define nh5close_types_c FNAME(H5CLOSE_TYPES_C) +#else +# define nh5init_types_c FNAME(h5init_types_c) +# define nh5close_types_c FNAME(h5close_types_c) +#endif +#endif + +extern int_f nh5init_types_c(hid_t_f *types, hid_t_f * floatingtypes, hid_t_f * integertypes); +extern int_f nh5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f * floatingtypes, int_f * floatinglen, hid_t_f * integertypes, int_f * integerlen); + +#endif /* _H5f90proto_H */ diff --git a/fortran/src/H5fortran_flags.f90 b/fortran/src/H5fortran_flags.f90 new file mode 100644 index 0000000..d3bb5c0 --- /dev/null +++ b/fortran/src/H5fortran_flags.f90 @@ -0,0 +1,141 @@ + MODULE H5FORTRAN_FLAGS + +!H5F file interface related flags + INTEGER, PARAMETER :: H5F_ACC_RDWR_F = 1 , & + H5F_ACC_RDONLY_F = 2, & + H5F_ACC_TRUNC_F = 3, & + H5F_ACC_EXCL_F = 4, & + H5F_ACC_DEBUG_F = 5, & + H5F_SCOPE_LOCAL_F = 0, & + H5F_SCOPE_GLOBAL_F = 1 + +!H5G group interface related flags + INTEGER, PARAMETER :: H5G_UNKNOWN_F = -1 + INTEGER, PARAMETER :: H5G_LINK_F = 0 + INTEGER, PARAMETER :: H5G_GROUP_F =1 + INTEGER, PARAMETER :: H5G_DATASET_F =2 + INTEGER, PARAMETER :: H5G_TYPE_F =3 + +!H5P Property interface related flags + + INTEGER, PARAMETER :: H5P_FILE_CREATE_F = 0 + INTEGER, PARAMETER :: H5P_FILE_ACCESS_F = 1 + INTEGER, PARAMETER :: H5P_DATASET_CREATE_F = 2 + INTEGER, PARAMETER :: H5P_DATASET_XFER_F = 3 + INTEGER, PARAMETER :: H5P_MOUNT_F = 4 + INTEGER, PARAMETER :: H5P_DEFAULT_F = 6 + +!H5R Reference interface related flags + INTEGER, PARAMETER :: H5R_OBJECT_F = 0 + INTEGER, PARAMETER :: H5R_DATASET_REGION_F = -2 + +!H5S Dataspace interface related flags + INTEGER, PARAMETER :: H5S_SCALAR_F = 0 + INTEGER, PARAMETER :: H5S_SIMPLE_F = 1 + INTEGER, PARAMETER :: H5S_SELECT_SET_F = 0 + INTEGER, PARAMETER :: H5S_SELECT_OR_F =1 + INTEGER, PARAMETER :: H5S_UNLIMITED_F = -1 + INTEGER, PARAMETER :: H5S_ALL_F = -2 +!USED IN PROERTY INTERFACE + INTEGER, PARAMETER :: H5D_COMPACT_F = 0 + + INTEGER, PARAMETER :: H5D_CONTIGUOUS_F = 1 + INTEGER, PARAMETER :: H5D_CHUNKED_F = 2 + INTEGER, PARAMETER :: H5D_XFER_INDEPENDENT_F = 0 + INTEGER, PARAMETER :: H5D_XFER_COLLECTIVE_F = 1 + INTEGER, PARAMETER :: H5D_XFER_DFLT_F = 2 + +!H5T Data type interface related flags + INTEGER, PARAMETER :: H5T_NO_CLASS_F = -1 + INTEGER, PARAMETER :: H5T_INTEGER_F = 0 + INTEGER, PARAMETER :: H5T_FLOAT_F = 1 + INTEGER, PARAMETER :: H5T_TIME_F = 2 + INTEGER, PARAMETER :: H5T_STRING_F = 3 + INTEGER, PARAMETER :: H5T_BITFIELD_F = 4 + INTEGER, PARAMETER :: H5T_OPAQUE_F = 5 + INTEGER, PARAMETER :: H5T_COMPOUND_F = 6 + INTEGER, PARAMETER :: H5T_REFERENCE_F = 7 + INTEGER, PARAMETER :: H5T_ENUM_F = 8 + INTEGER, PARAMETER :: H5T_ORDER_LE_F = 0 + INTEGER, PARAMETER :: H5T_ORDER_BE_F = 1 + INTEGER, PARAMETER :: H5T_ORDER_VAX_F = 2 + + INTEGER, PARAMETER :: H5T_PAD_ZERO_F = 0 + INTEGER, PARAMETER :: H5T_PAD_ONE_F = 1 + INTEGER, PARAMETER :: H5T_PAD_BACKGROUND_F = 2 + INTEGER, PARAMETER :: H5T_PAD_ERROR_F = -1 + INTEGER, PARAMETER :: H5T_PAD_NPAD_F = 3 + + !Unsigned integer type + INTEGER, PARAMETER :: H5T_SGN_NONE_F = 0 + !Two's complement signed integer type + INTEGER, PARAMETER :: H5T_SGN_2_F = 1 + + INTEGER, PARAMETER :: H5T_SGN_ERROR_F = -1 + !MSB of mantissa is not stored, always 1 + INTEGER, PARAMETER :: H5T_NORM_IMPLIED_F = 0 + !MSB of mantissa is always 1 + INTEGER, PARAMETER :: H5T_NORM_MSBSET_F = 1 + !Mantissa is not normalized + INTEGER, PARAMETER :: H5T_NORM_NONE_F = 2 + !Character set is US ASCII + INTEGER, PARAMETER :: H5T_CSET_ASCII_F = 0 + !Pad with zeros (as C does) + INTEGER, PARAMETER :: H5T_STR_NULL_F = 0 + !Pad with spaces (as FORTRAN does) + INTEGER, PARAMETER :: H5T_STR_SPACE_F = 1 + +!H5P interface related fortran flags: + !identifier of the low-level file driver. + INTEGER, PARAMETER :: H5F_LOW_STDIO_F = 0 + INTEGER, PARAMETER :: H5F_LOW_SEC2_F = 1 + INTEGER, PARAMETER :: H5F_LOW_MPIO_F = 2 + INTEGER, PARAMETER :: H5F_LOW_CORE_F = 3 + INTEGER, PARAMETER :: H5F_LOW_SPLIT_F = 4 + INTEGER, PARAMETER :: H5F_LOW_FAMILY_F = 5 + +!H5I interface related fortran flags: + INTEGER, PARAMETER :: H5I_FILE_F = 1 + INTEGER, PARAMETER :: H5I_GROUP_F = 2 + INTEGER, PARAMETER :: H5I_DATATYPE_F = 3 + INTEGER, PARAMETER :: H5I_DATASPACE_F = 4 + INTEGER, PARAMETER :: H5I_DATASET_F = 5 + INTEGER, PARAMETER :: H5I_ATTR_F = 6 + INTEGER, PARAMETER :: H5I_BADID_F = -1 + +!H5E interface related fortran flags: + !Turn on automatic printing of errors + INTEGER, PARAMETER :: PRINTON = 1 + + !Turn off automatic printing of errors + INTEGER, PARAMETER :: PRINTOFF = 0 + + !Error flags same as H5E_major_t + + INTEGER, PARAMETER :: H5E_NONE_MAJOR_F = 0 !special zero, no error + INTEGER, PARAMETER :: H5E_ARGS_F = 1 !invalid arguments to routine + INTEGER, PARAMETER :: H5E_RESOURCE_F = 2 !resource unavailable + INTEGER, PARAMETER :: H5E_INTERNAL_F = 3 !Internal error (too specific to + !document in detail) + INTEGER, PARAMETER :: H5E_FILE_F = 4 !file Accessability + INTEGER, PARAMETER :: H5E_IO_F = 5 !Low-level I/O + INTEGER, PARAMETER :: H5E_FUNC_F = 6 !function Entry/Exit + INTEGER, PARAMETER :: H5E_ATOM_F = 7 !object Atom + INTEGER, PARAMETER :: H5E_CACHE_F = 8 !object Cache + INTEGER, PARAMETER :: H5E_BTREE_F = 9 !B-Tree Node + INTEGER, PARAMETER :: H5E_SYM_F = 10 !symbol Table + INTEGER, PARAMETER :: H5E_HEAP_F = 11 !Heap + INTEGER, PARAMETER :: H5E_OHDR_F = 12 !object Header + INTEGER, PARAMETER :: H5E_DATATYPE_F = 13 !Datatype + INTEGER, PARAMETER :: H5E_DATASPACE_F = 14 ! Dataspace + INTEGER, PARAMETER :: H5E_DATASET_F = 15 !Dataset + INTEGER, PARAMETER :: H5E_STORAGE_F = 16 !data storage + INTEGER, PARAMETER :: H5E_PLIST_F = 17 !Property lists + INTEGER, PARAMETER :: H5E_ATTR_F = 18 !Attribute + INTEGER, PARAMETER :: H5E_PLINE_F = 19 !Data filters + INTEGER, PARAMETER :: H5E_EFL_F = 20 !External file list + INTEGER, PARAMETER :: H5E_RAGGED_F = 21 !Ragged arrays + INTEGER, PARAMETER :: H5E_REFERENCE_F = 22 !References + + + END MODULE H5FORTRAN_FLAGS diff --git a/fortran/src/H5fortran_types.f90.in b/fortran/src/H5fortran_types.f90.in new file mode 100644 index 0000000..9010d7f --- /dev/null +++ b/fortran/src/H5fortran_types.f90.in @@ -0,0 +1,29 @@ +! +! This file contains HDF5 Fortran90 type definitions +! + MODULE H5FORTRAN_TYPES + ! + ! HDF5 integers + ! + ! Each of the arguments of SELECTED_INT_KIND function should be + ! determined by configure. + ! R_LARGE is the number of digits for the biggest integer supported. + ! R_INTEGER is the number of digits in INTEGER + ! For example: + ! On 64 bit machine ( DEC ALPHA) R_LARGE = 18 and R_INTEGER = 9 + ! On 32 bit machines ( Sparc Solaris ) R_LARGE = 9 and R_INTEGER = 9 + ! + INTEGER, PARAMETER :: R_LARGE = @R_LARGE@ + INTEGER, PARAMETER :: R_INTEGER = @R_INTEGER@ + INTEGER, PARAMETER :: HSIZE_T = @HSIZE_T@ + INTEGER, PARAMETER :: HSSIZE_T = @HSSIZE_T@ + INTEGER, PARAMETER :: HID_T = @HID_T@ + INTEGER, PARAMETER :: SIZE_T = @SIZE_T@ + + ! + ! Some HDF5 FORTARN90 default values ( here for now 8/5/99 EIP ) + ! + + INTEGER(SIZE_T), PARAMETER :: OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@ + + END MODULE H5FORTRAN_TYPES diff --git a/fortran/src/HDF5.f90 b/fortran/src/HDF5.f90 new file mode 100644 index 0000000..264eb13 --- /dev/null +++ b/fortran/src/HDF5.f90 @@ -0,0 +1,14 @@ + + MODULE HDF5 + USE H5GLOBAL + USE H5F + USE H5G + USE H5E + USE H5I + USE H5S + USE H5D + USE H5A + USE H5T + USE H5P + USE H5R + END MODULE HDF5 diff --git a/fortran/src/HDF5_parallel.f90 b/fortran/src/HDF5_parallel.f90 new file mode 100644 index 0000000..d44ba17 --- /dev/null +++ b/fortran/src/HDF5_parallel.f90 @@ -0,0 +1,15 @@ + + MODULE HDF5 + USE H5GLOBAL + USE H5F + USE H5E + USE H5G + USE H5I + USE H5S + USE H5D + USE H5A + USE H5T + USE H5P + USE H5P_parallel + USE H5R + END MODULE HDF5 diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in new file mode 100644 index 0000000..c3f2ff1 --- /dev/null +++ b/fortran/src/Makefile.in @@ -0,0 +1,38 @@ +## +## HDF5 Forgran Library Makefile(.in) +## +## Copyright (C) 2000 National Center for Supercomputing Applications. +## All rights reserved. +## +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +@COMMENCE@ + +hdf5_dir=$(top_srcdir)/../src + +TRACE=perl $(top_srcdir)/bin/trace + +## Add `-I.' to the C preprocessor flags. +CPPFLAGS=-I. -I$(hdf5_dir) @CPPFLAGS@ + +## This is our main target +LIB=libhdf5_fortran.la +CLEAN=H5fortran_types.f90 + +## Source and object files for the library +CPARALLEL=${PARALLEL:yes="H5Pf_parallel.c"} +CLIB_SRC=H5f90kit.c H5f90misc.c H5Git.c H5Rf.c H5Ff.c H5Sf.c H5Df.c H5Gf.c \ + H5Af.c H5Tf.c H5Pf.c H5If.c H5Ef.c ${CPARALLEL:no=} + +FPARALLEL=${PARALLEL:yes="H5Pff_parallel.f90 HDF5_parallel.f90"} +FLIB_SRC=H5fortran_types.f90 H5fortran_flags.f90 H5f90global.f90 H5f90miscf.f90 \ + H5Rff.f90 H5Fff.f90 H5Sff.f90 H5Dff.f90 H5Gff.f90 H5Aff.f90 H5Tff.f90 \ + H5Pff.f90 H5Iff.f90 H5Eff.f90 HDF5.f90 ${FPARALLEL:no=} + +LIB_SRC=$(CLIB_SRC) $(FLIB_SRC) +LIB_OBJ=$(CLIB_SRC:.c=.lo) $(FLIB_SRC:.f90=.lo) + +ARFLAGS=rc + +@CONCLUDE@ diff --git a/fortran/src/README b/fortran/src/README new file mode 100644 index 0000000..6dcc0e0 --- /dev/null +++ b/fortran/src/README @@ -0,0 +1,240 @@ + + README for the FORTRAN90 Prototype APIs to HDF5 + + +This distribution contains the HDF5 FORTRAN90 APIs source code (prototype) +based on the HDF5 1.2.2 release (ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/current), +tests and examples. + +This prototype supports a selected subset of the HDF5 Library functionality. +A complete list of the Fortran subroutines can be found in the HDF5 +Reference Manual provided with this release. +Check the online documentation at http://hdf.ncsa.uiuc.edu/HDF5/doc (select +the "HDF5 Fortran90 Docs" link at the bottom of the left-hand column) or +H5_F90.R1.2.2.RefMan.tar at ftp://hdf.ncsa.uiuc.edu/HDF5/fortran . + +Changes since last release (October 1999) +========================================= +* Support for Linux +* Support for parallel features (tested on O2K platform only) +* Most of the functions from the H5R, H5P, H5T, H5E and H5I interfaces were + implemented. See Reference Manual for complete list. The new functions + include support for object and dataset region references, and for + compound datatypes. +* This prototype supports more predefined types. See list below in + the "About the Fortran APIs" section. +* This prototype supports T3E and T3E with mpt 1.3. One has to modify + H5Dff.f90, H5Aff.f90, H5Pff.f90 to comment lines with the module procedures for + double precision datatypes. See source code. + +Supported platforms +=================== +The FORTRAN90 APIs provided here are known to work with the +following platforms and compilers: + + * SunOS 5.6 with WorkshopCompilers 4.2 Fortran 90 1.2 + * SunOS 5.7 with WorkshopCompilers 5.0 Fortran 90 2.0 + * OSF1 V4.0 with Digital Fortran 90 4.1 + * IRIX64 6.5 (64 option only) with MIPSpro Compilers: Version 7.3.1m + mpt.1.4 + * Linux RedHat 6.1, Kernel 2.2.12 with PGF90 + * T3E with Cray Fortran: Version 3.4.0.0 + with mpt 1.3 + +Compilation +=========== + +1. Install HDF5 Release 1.2.2 on your system + (ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/current). If you are using a + binary distribution provided by the HDF group, make sure that a GZIP + library is installed on your system. If you do not have a GZIP library, + you may copy it from the HDF FTP server. + +2. In the src directory copy H5fortran_types.f90_ to + H5fortran_types.f90, where is one of the following: + + solaris + digunix + irix + linux + + Example: On Digital Unix systems use the following command + cp H5fortran_types.f90_digunix H5fortran_types.f90 + +3. Edit Makefile_in the src/, test/ and examples/ directories + to specify the locations of the HDF5 C Library, the GZIP Library, and the + corresponding include files on your system. + +4. In the src directory, run make to create the HDF5 FORTRAN90 library + hdf5_fortran.a + make -f Makefile_ + + Example: On Solaris run + make -f Makefile_solaris + + The Fortran library hdf5_fortran.a will be created. + +5. In the test directory, build tests by running + make -f Makefile_ + This command will build fortranlib_test, fflush1 and fflush2 executables. + Run those executables to make sure that the library works on your system. + +6. In the examples directory, run + make -f Makefile_ + to build the following examples: + + fileexample - creates an HDF5 file + dsetexample - creates an empty dataset of integers + rwdsetexample - writes and reads to the dataset created by dsetexample + groupexample - creates a group in the file + grpsexample - creates groups using absolute and relative names + grpdsetexample - creates datasets in the groups + hyperslabexample - writes and reads a hyperslab + selectele - writes element selections + grpit - iterates through the members of the group + attrexample - creates and writes a dataset attribute + compound - creates, writes and reads one dim array of structures + mountexample - shows how to use mounting files to access a dataset + refobjexample - creates and stores references to the objects + refregexample - creates and stores references to the dataset regions + + The script run_example.sh runs the examples in the appropriate order. + + Use the HDF5 utility, h5dump, to see the content of the created HDF5 files. + +7. Install the HDF5 Reference Manual (in HTML format). The manual + can be found in the Unix tar file H5_F90.R1.2.2.RefMan.tar + on the ftp server and is served over the Web from + http://hdf.ncsa.uiuc.edu/HDF5/doc/ (select the "HDF5 Fortran90 Docs" + link at the bottom of the left-hand column). + + +8. Send bug reports and comments to hdfhelp@ncsa.uiuc.edu + +User's Guide Notes ++++++++++++++++++++ + +About the source code organization +================================== + +The Fortran APIs are organized in modules parallel to the HDF5 Interfaces. +Each module is in a separate file with the name H5*ff.f. Corresponding C +stubs are in the H5*f.c files. For example, the Fortran File APIs are in +the file H5Fff.f and the corresponding C stubs are in the file H5Ff.c. + +Each module contains Fortran definitions of the constants, interfaces to +the subroutines if needed, and the subroutines themselves. + +Users must use constant names in their programs instead of the numerical +values, as the numerical values are subject to change without notice. + +About the Fortran APIs +======================= + +* The Fortran APIs come in the form of Fortran subroutines. + +* Each Fortran subroutine name is derived from the corresponding C function + name by adding "_f" to the name. For example, the name of the C function + to create an HDF5 file is H5Fcreate; the corresponding Fortran subroutine + is h5fcreate_f. + +* A description of each Fortran subroutine and its parameters can be found + following the description of the corresponding C function in the + Reference Manual provided with this release. The manual can be found in + the Unix tar file H5_F90.R1.2.2.tar in this directory and + is served over the Web from http://hdf.ncsa.uiuc.edu/HDF5/doc/ (select + the "HDF5 Fortran90 Docs" link at the bottom of the left-hand column). + +* The parameter list for each Fortran subroutine has two more parameters + than the corresponding C function. These additional parameters hold + the return value and an error code. The order of the Fortran subroutine + parameters may differ from the order of the C function parameters. + The Fortran subroutine parameters are listed in the following order: + -- required input parameters, + -- output parameters, including return value and error code, and + -- optional input parameters. + For example, the C function to create a dataset has the following + prototype: + + hid_t H5Dcreate(hid_it loc_id, char *name, hid_t type_id, + hid_t space_id, hid_t creation_prp); + + The corresponding Fortran subroutine has the following form: + + SUBROUTINE h5dcreate_f(loc_id, name, type_id, space_id, dset_id, + hdferr, creation_prp) + + The first four parameters of the Fortran subroutine correspond to the + C function parameters. The fifth parameter dset_id is an output + parameter and contains a valid dataset identifier if the value of the + sixth output parameter hdferr indicates successful completion. + (Error code descriptions are provided with the subroutine descriptions + in the Reference Manual.) The seventh input parameter creation_prp + is optional, and may be omitted when the default creation property + list is used. + +* Parameters to the Fortran subroutines have one of the following + predefined datatypes (see the file H5fortran_types.f90 for KIND + definitions): + + INTEGER(HID_T) compares with hid_t type in HDF5 C APIs + INTEGER(HSIZE_T) compares with hsize_t in HDF5 C APIs + INTEGER(HSSIZE_T) compares with hssize_t in HDF5 C APIs + INTEGER(SIZE_T) compares with the C size_t type + These integer types usually correspond to 4 or 8 byte integers, + depending on the FORTRAN90 compiler and corresponding HDF5 + C library definitions. + + The H5R module defines two types: + TYPE(HOBJ_REF_T_F) compares to the hobj_ref_t in HDF5 C API + TYPE(HDSET_REG_REF_T_F) compares to hdset_reg_ref_t in HDF5 C API + These types are represented by character arrays now. + The internal representation can be changed in the future. + +* Each Fortran application must call the h5init_types subroutine to + initialize the Fortran predefined datatypes before calling the HDF5 Fortran + subroutines. The application must call the h5close_types subroutine + after all calls to the HDF5 Fortran Library. + +* The following predefined types are implemented in this prototype: + + H5T_NATIVE_INTEGER + H5T_NATIVE_REAL + H5T_NATIVE_DOUBLE + H5T_NATIVE_CHARACTER + H5T_STD_REF_OBJ + H5T_STD_REF_DSETREG + H5T_IEEE_F32BE + H5T_IEEE_F32LE + H5T_IEEE_F64BE + H5T_IEEE_F64LE + H5T_STD_I8BE + H5T_STD_I8LE + H5T_STD_I16BE + H5T_STD_I16LE + H5T_STD_I32BE + H5T_STD_I32LE + H5T_STD_I64BE + H5T_STD_I64LE + H5T_STD_U8BE + H5T_STD_U8LE + H5T_STD_U16BE + H5T_STD_U16LE + H5T_STD_U32BE + H5T_STD_U32LE + H5T_STD_U64BE + H5T_STD_U64LE + + +* When a C application reads data stored from a Fortran program, the data + will appear to be transposed due to the difference in the C - Fortran + storage order. For example, if Fortran writes a 4x6 two-dimensional dataset + to the file, a C program will read it as a 6x4 two-dimensional dataset into + memory. The HDF5 C utilities h5dump and h5ls display transposed data, if + data is written from a Fortran program. + +* Fortran indices are 1 based. + +* Compound datatype datasets can be written or read by atomic fields only. + +Not all of the APIs provided with this prototype have been fully tested. diff --git a/fortran/test/Dependencies b/fortran/test/Dependencies new file mode 100644 index 0000000..e69de29 diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in new file mode 100644 index 0000000..59a56e6 --- /dev/null +++ b/fortran/test/Makefile.in @@ -0,0 +1,40 @@ +## HDF5-Fortran test/Makefile(.in) +## +## Copyright (C) 2000 National Center for Supercomputing Applications. +## All rights reserved. +## +## +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +@COMMENCE@ + +hdf5_dir=$(top_srcdir)/../src + +## Add include directory to the C preprocessor flags and the h5test and hdf5 +## libraries to the library list. +LT_LINK_LIB=$(LT) --mode=link $(F9X) -static -rpath $(libdir) +MFLAG=@F9XMODFLAG@ +FFLAGS=$(MFLAG). $(MFLAG)../src +FLIB=../src/libhdf5_fortran.la +HDF5LIB=$(hdf5_dir)/libhdf5.la + +TEST_PROGS_SRC=fortranlib_test.f90 fflush1.f90 fflush2.f90 +TEST_PROGS=$(TEST_PROGS_SRC:.f90=) + +TEST_SRC=hdf5test.f90 tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 \ + tH5Sselect.f90 tH5P.f90 +TEST_OBJ=$(TEST_SRC:.f90=.lo) + +$(TEST_PROGS): $(FLIB) + +fortranlib_test: $(TEST_OBJ) + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fortranlib_test.f90 $(TEST_OBJ) $(FLIB) $(LIBS) $(HDF5LIB) + +fflush1: fflush1.f90 hdf5test.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fflush1.f90 hdf5test.o $(FLIB) $(LIBS) $(HDF5LIB) + +fflush2: fflush2.f90 hdf5test.f90 + @$(LT_LINK_FEXE) $(FFLAGS) -o $@ fflush2.f90 hdf5test.o $(FLIB) $(LIBS) $(HDF5LIB) + +@CONCLUDE@ diff --git a/fortran/test/fflush1.f90 b/fortran/test/fflush1.f90 new file mode 100644 index 0000000..8aee1b6 --- /dev/null +++ b/fortran/test/fflush1.f90 @@ -0,0 +1,128 @@ + ! + ! Purpose: This is the first half of a two-part test that makes sure + ! that a file can be read after an application crashes as long + ! as the file was flushed first. We simulate by exit the + ! the program using stop statement + ! + + PROGRAM FFLUSH1EXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + ! + !the respective filename is "fflush1.h5" + ! + CHARACTER(LEN=10), PARAMETER :: filename = "fflush1.h5" + + ! + !data space rank and dimensions + ! + INTEGER, PARAMETER :: RANK = 2 + INTEGER, PARAMETER :: NX = 4 + INTEGER, PARAMETER :: NY = 5 + + ! + ! File identifiers + ! + INTEGER(HID_T) :: file_id + + ! + ! Group identifier + ! + INTEGER(HID_T) :: gid + + ! + ! dataset identifier + ! + INTEGER(HID_T) :: dset_id + + ! + ! data space identifier + ! + INTEGER(HID_T) :: dataspace + + ! + ! data type identifier + ! + INTEGER(HID_T) :: dtype_id + + ! + !The dimensions for the dataset. + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/) + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !general purpose integer + ! + INTEGER :: i, j, total_error = 0 + + ! + !data buffers + ! + INTEGER, DIMENSION(NX,NY) :: data_in, data_out + + ! + !Initialize FORTRAN predifined datatypes + ! + CALL h5init_types_f(error) + CALL check("h5init_types_f",error,total_error) + + ! + !Initialize data_in buffer + ! + do i = 1, NX + do j = 1, NY + data_in(i,j) = (i-1) + (j-1) + end do + end do + + ! + !Create file "fflush1.h5" using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + ! + !Create group "/G" inside file "fflush1.h5". + ! + CALL h5gcreate_f(file_id, "/G", gid, error) + CALL check("h5gcreate_f",error,total_error) + + ! + !Create data space for the dataset. + ! + CALL h5screate_simple_f(RANK, dims, dataspace, error) + CALL check("h5screate_simple_f",error,total_error) + + ! + !Create dataset "/D" inside file "fflush1.h5". + ! + CALL h5dcreate_f(file_id, "/D", H5T_NATIVE_INTEGER, dataspace, & + dset_id, error) + CALL check("h5dcreate_f",error,total_error) + + ! + ! Write data_in to the dataset + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data_in, error) + CALL check("h5dwrite_f",error,total_error) + + ! + !flush and exit without closing the library + ! + CALL H5fflush_f(file_id, H5F_SCOPE_GLOBAL_F, error) + CALL check("h5fflush_f",error,total_error) + + + 001 STOP + + + END PROGRAM FFLUSH1EXAMPLE + diff --git a/fortran/test/fflush2.f90 b/fortran/test/fflush2.f90 new file mode 100644 index 0000000..a0a076f --- /dev/null +++ b/fortran/test/fflush2.f90 @@ -0,0 +1,158 @@ + ! + ! Purpose: This is the second half of a two-part test that makes sure + ! that a file can be read after an application crashes as long + ! as the file was flushed first. This half tries to read the + ! file created by the first half. + ! + + PROGRAM FFLUSH2EXAMPLE + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + ! + !the respective filename is "fflush1.h5" + ! + CHARACTER(LEN=10), PARAMETER :: filename = "fflush1.h5" + + ! + !data space rank and dimensions + ! + INTEGER, PARAMETER :: RANK = 2 + INTEGER, PARAMETER :: NX = 4 + INTEGER, PARAMETER :: NY = 5 + + ! + ! File identifiers + ! + INTEGER(HID_T) :: file_id + + ! + ! Group identifier + ! + INTEGER(HID_T) :: gid + + ! + ! dataset identifier + ! + INTEGER(HID_T) :: dset_id + + ! + ! data space identifier + ! + INTEGER(HID_T) :: dataspace + + ! + ! data type identifier + ! + INTEGER(HID_T) :: dtype_id + + ! + !The dimensions for the dataset. + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/) + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !general purpose integer + ! + INTEGER :: i, j, total_error = 0 + + ! + !data buffers + ! + INTEGER, DIMENSION(NX,NY) :: data_out + + ! + !Initialize FORTRAN predifined datatypes + ! + CALL h5init_types_f(error) + CALL check("h5init_types_f",error,total_error) + + ! + !Open the file. + ! + CALL h5fopen_f(filename, H5F_ACC_RDONLY_F, file_id, error) + CALL check("h5fopen_f",error,total_error) + + ! + !Open the dataset + ! + CALL h5dopen_f(file_id, "/D", dset_id, error) + CALL check("h5dopen_f",error,total_error) + + ! + !Get dataset's data type. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + CALL check("h5dget_type_f",error,total_error) + + ! + !Read the dataset. + ! + CALL h5dread_f(dset_id, dtype_id, data_out, error) + CALL check("h5dread_f",error,total_error) + + ! + !Print the dataset. + ! + do i = 1, NX + write(*,*) (data_out(i,j), j = 1, NY) + end do +! +!result of the print statement +! +! 0, 1, 2, 3, 4 +! 1, 2, 3, 4, 5 +! 2, 3, 4, 5, 6 +! 3, 4, 5, 6, 7 + + ! + !Open the group. + ! + CALL h5gopen_f(file_id, "G", gid, error) + CALL check("h5gopen_f",error,total_error) + + ! + !In case error happens, jump to stop. + ! + IF (error == -1) THEN + 001 STOP + END IF + + ! + !Close the datatype + ! + CALL h5tclose_f(dtype_id, error) + CALL check("h5tclose_f",error,total_error) + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + + ! + !Close the group. + ! + CALL h5gclose_f(gid, error) + CALL check("h5gclose_f",error,total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !Close FORTRAN predifined datatypes + ! + CALL h5close_types_f(error) + CALL check("h5close_types_f",error,total_error) + + END PROGRAM FFLUSH2EXAMPLE diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 new file mode 100644 index 0000000..40c323b --- /dev/null +++ b/fortran/test/fortranlib_test.f90 @@ -0,0 +1,169 @@ +! +! +! Testing Fortran functionality. +! + PROGRAM fortranlibtest + + !USE H5FTEST + !USE H5DTEST + !USE H5RTEST + !USE H5STEST + USE HDF5 + + IMPLICIT NONE + INTEGER :: total_error = 0 + INTEGER :: error + INTEGER :: mounting_total_error = 0 + INTEGER :: reopen_total_error = 0 + INTEGER :: dataset_total_error = 0 + INTEGER :: extend_dataset_total_error = 0 + INTEGER :: refobj_total_error = 0 + INTEGER :: refreg_total_error = 0 + INTEGER :: dataspace_total_error = 0 + INTEGER :: hyperslab_total_error = 0 + INTEGER :: element_total_error = 0 + INTEGER :: basic_select_total_error = 0 + INTEGER :: total_error_compoundtest = 0 + INTEGER :: basic_datatype_total_error = 0 + INTEGER :: external_total_error = 0 + + CALL h5init_types_f(error) + write(*,*) + write(*,*) "Testing File Interface" + + CALL mountingtest(mounting_total_error) + IF (mounting_total_error == 0) THEN + write(*,*) "mounting test OK" + ELSE + write(*,*) "mounting test FAILED" + END IF + total_error = total_error + mounting_total_error + + CALL reopentest(reopen_total_error) + IF (reopen_total_error == 0) THEN + write(*,*) "Reopen test OK" + ELSE + write(*,*) "Reopen test FAILED" + END IF + total_error = total_error + reopen_total_error + + + + write(*,*) + write(*,*) "Testing Dataset Interface" + + CALL datasettest(dataset_total_error) + IF (dataset_total_error == 0) THEN + write(*,*) "dataset test OK" + ELSE + write(*,*) "dataset test FAILED" + END IF + total_error = total_error + dataset_total_error + + CALL extenddsettest(extend_dataset_total_error) + IF (extend_dataset_total_error == 0) THEN + write(*,*) "extend dataset test OK" + ELSE + write(*,*) "extend dataset test FAILED" + END IF + total_error = total_error + extend_dataset_total_error + + write(*,*) + write(*,*) "Testing DATASPACE Interface" + + CALL dataspace_basic_test(dataspace_total_error) + IF (dataspace_total_error == 0) THEN + write(*,*) "dataspce basic test OK" + ELSE + write(*,*) "dataspace basic test FAILED" + END IF + total_error = total_error + dataspace_total_error + + + write(*,*) + write(*,*) "Testing Reference Interface" + + CALL refobjtest(refobj_total_error) + IF (refobj_total_error == 0) THEN + write(*,*) "Reference to object test OK" + ELSE + write(*,*) "Reference to object test FAILED" + END IF + total_error = total_error + refobj_total_error + + CALL refregtest(refreg_total_error) + IF (refreg_total_error == 0) THEN + write(*,*) "Refernce to Region test OK" + ELSE + write(*,*) "Refernce to Region test FAILED" + END IF + total_error = total_error + refreg_total_error + + write(*,*) + write(*,*) "Testing selection functionalities" + + CALL test_select_hyperslab( hyperslab_total_error) + IF ( hyperslab_total_error == 0) THEN + write(*,*) "hyperslab selection test OK" + ELSE + write(*,*) "hyperslab selection test FAILED" + END IF + total_error = total_error + hyperslab_total_error + + CALL test_select_element(element_total_error) + IF (element_total_error == 0) THEN + write(*,*) "element selection test OK" + ELSE + write(*,*) "element selection test FAILED" + END IF + total_error = total_error + element_total_error + + CALL test_basic_select(basic_select_total_error) + IF (basic_select_total_error == 0) THEN + write(*,*) "basic selection test OK" + ELSE + write(*,*) "basic selection test FAILED" + END IF + total_error = total_error + basic_select_total_error + write(*,*) + + write(*,*) "Testing Compound Datatypes" + CALL compoundtest(total_error_compoundtest) + IF (total_error_compoundtest == 0) THEN + write(*,*) "Compound Datatype test OK" + ELSE + write(*,*) "Compound Datatype test FAILED" + END IF + total_error = total_error + total_error_compoundtest + + write(*,*) + write(*,*) "Testing basic datatype functionalities" + CALL basic_data_type_test(basic_datatype_total_error) + IF (basic_datatype_total_error == 0) THEN + write(*,*) "Basic Datatype test OK" + ELSE + write(*,*) "Basic Datatype test FAILED" + END IF + total_error = total_error + basic_datatype_total_error + + write(*,*) + write(*,*) "Testing external functionalities" + CALL external_test(external_total_error) + IF (external_total_error == 0) THEN + write(*,*) "External test OK" + ELSE + write(*,*) "External test FAILED" + END IF + total_error = total_error + external_total_error + + write(*,*) + + if (total_error .eq. 0) write(*,*) "Fortran_lib test passed!" + if (total_error.gt. 0) write(*,*) "Fortran_lib test failed with ",& + total_error, " error(s)" + + CALL h5close_types_f(error) + + END PROGRAM fortranlibtest + + diff --git a/fortran/test/hdf5test.f90 b/fortran/test/hdf5test.f90 new file mode 100644 index 0000000..978c832 --- /dev/null +++ b/fortran/test/hdf5test.f90 @@ -0,0 +1,16 @@ +! +! +! This module contains check subroutine which is used in +! all the fortran h5 test files +! + + SUBROUTINE check(string,error,total_error) + CHARACTER(LEN=*) :: string + INTEGER :: error, total_error + if (error .lt. 0) then + total_error=total_error+1 + write(*,*) string, " failed" + endif + RETURN + END SUBROUTINE check + diff --git a/fortran/test/tH5D.f90 b/fortran/test/tH5D.f90 new file mode 100644 index 0000000..04ed534 --- /dev/null +++ b/fortran/test/tH5D.f90 @@ -0,0 +1,452 @@ +! +! +! Testing Dataset Interface functionality. +! +! MODULE H5DTEST + +! USE HDF5 ! This module contains all necessary modules + +! CONTAINS + +! +!The following subroutine tests the following functionalities: +!h5dcreate_f, h5dopen_f, h5dclose_f, h5dget_space_f, h5dget_type_f, +!h5dread_f, and h5dwrite_f +! + SUBROUTINE datasettest(total_error) + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dspace_id ! Dataspace identifier + INTEGER(HID_T) :: dtype_id ! Datatype identifier + + + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions + INTEGER :: rank = 2 ! Dataset rank + + INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers + INTEGER :: error ! Error flag + + INTEGER :: i, j !general purpose integers + + ! + ! Initialize the dset_data array. + ! + do i = 1, 4 + do j = 1, 6 + dset_data(i,j) = (i-1)*6 + j; + end do + end do + + ! + ! Initialize FORTRAN predefined datatypes. + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f", error, total_error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f", error, total_error) + + + ! + ! Create the dataspace. + ! + CALL h5screate_simple_f(rank, dims, dspace_id, error) + CALL check("h5screate_simple_f", error, total_error) + + + ! + ! Create the dataset with default properties. + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & + dset_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! + ! Write the dataset. + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, error) + CALL check("h5dwrite_f", error, total_error) + + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + CALL check("h5sclose_f", error, total_error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + ! Open the existing file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + CALL check("h5fopen_f", error, total_error) + + ! + ! Open the existing dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + CALL check("h5dopen_f", error, total_error) + + ! + ! Get the dataset type. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + CALL check("h5dget_type_f", error, total_error) + + ! + ! Get the data space. + ! + CALL h5dget_space_f(dset_id, dspace_id, error) + CALL check("h5dget_space_f", error, total_error) + + ! + ! Read the dataset. + ! + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, error) + CALL check("h5dread_f", error, total_error) + + ! + !Compare the data. + ! + do i = 1, 4 + do j = 1, 6 + IF (data_out(i,j) .NE. dset_data(i, j)) THEN + write(*, *) "dataset test error occured" + write(*,*) "data read is not the same as the data writen" + END IF + end do + end do + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + CALL check("h5sclose_f", error, total_error) + + ! + ! Terminate access to the data type. + ! + CALL h5tclose_f(dtype_id, error) + CALL check("h5tclose_f", error, total_error) + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + !Close FORTRAN predifined datatypes + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + + RETURN + END SUBROUTINE datasettest + +! +!the following subroutine tests h5dextend_f functionality +! + + SUBROUTINE extenddsettest(total_error) + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + ! + !the dataset is stored in file "extf.h5" + ! + CHARACTER(LEN=7), PARAMETER :: filename = "extf.h5" + + ! + !dataset name is "ExtendibleArray" + ! + CHARACTER(LEN=15), PARAMETER :: dsetname = "ExtendibleArray" + + ! + !dataset rank is 2 + ! + INTEGER :: RANK = 2 + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memory Dataspace identifier + INTEGER(HID_T) :: crp_list ! dataset creatation property identifier + + ! + !dataset dimensions at creation time + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/3,3/) + + ! + !data dimensions + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/10,3/) + + ! + !Maximum dimensions + ! + INTEGER(HSIZE_T), DIMENSION(2) :: maxdims + + ! + !data arrays for reading and writing + ! + INTEGER, DIMENSION(10,3) :: data_in, data_out + + ! + !Size of data in the file + ! + INTEGER(HSIZE_T), DIMENSION(2) :: size + + ! + !general purpose integer + ! + INTEGER :: i, j + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !Variables used in reading data back + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dimsr, maxdimsr + INTEGER :: rankr + + ! + !data initialization + ! + do i = 1, 10 + do j = 1, 3 + data_in(i,j) = 2 + end do + end do + + ! + !Initialize FORTRAN predifined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f",error,total_error) + + ! + !Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + + ! + !Create the data space with unlimited dimensions. + ! + maxdims = (/H5S_UNLIMITED_F, H5S_UNLIMITED_F/) + + CALL h5screate_simple_f(RANK, dims, dataspace, error, maxdims) + CALL check("h5screate_simple_f",error,total_error) + + ! + !Modify dataset creation properties, i.e. enable chunking + ! + CALL h5pcreate_f(H5P_DATASET_CREATE_F, crp_list, error) + CALL check("h5pcreat_f",error,total_error) + + CALL h5pset_chunk_f(crp_list, RANK, dims1, error) + CALL check("h5pset_chunk_f",error,total_error) + + ! + !Create a dataset with 3X3 dimensions using cparms creation propertie . + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, & + dset_id, error, crp_list ) + CALL check("h5dcreate_f",error,total_error) + + ! + !Extend the dataset. This call assures that dataset is 3 x 3. + ! + size(1) = 3 + size(2) = 3 + CALL h5dextend_f(dset_id, size, error) + CALL check("h5dextend_f",error,total_error) + + + ! + !Extend the dataset. Dataset becomes 10 x 3. + ! + size(1) = 10; + size(2) = 3; + CALL h5dextend_f(dset_id, size, error) + CALL check("h5dextend_f",error,total_error) + + ! + !Write the data of size 10X3 to the extended dataset. + ! + CALL H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER, data_in, error) + CALL check("h5dwrite_f",error,total_error) + + ! + !Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f",error,total_error) + + ! + !Close the property list. + ! + CALL h5pclose_f(crp_list, error) + CALL check("h5pclose_f",error,total_error) + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !read the data back + ! + !Open the file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + CALL check("hfopen_f",error,total_error) + + ! + !Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + CALL check("h5dopen_f",error,total_error) + + ! + !Get dataset's dataspace handle. + ! + CALL h5dget_space_f(dset_id, dataspace, error) + CALL check("h5dget_space_f",error,total_error) + + ! + !Get dataspace's rank. + ! + CALL h5sget_simple_extent_ndims_f(dataspace, rankr, error) + CALL check("h5sget_simple_extent_ndims_f",error,total_error) + IF (rankr .NE. RANK) then + write(*,*) "dataset rank error occured" + stop + END IF + + ! + !Get dataspace's dimensinons. + ! + CALL h5sget_simple_extent_dims_f(dataspace, dimsr, maxdimsr, error) + CALL check("h5sget_simple_extent_dims_f",error,total_error) + IF ((dimsr(1) .NE. dims1(1)) .OR. (dimsr(2) .NE. dims1(2))) THEN + write(*,*) "dataset dimensions error occured" + stop + END IF + + ! + !Get creation property list. + ! + CALL h5dget_create_plist_f(dset_id, crp_list, error) + CALL check("h5dget_create_plist_f",error,total_error) + + + ! + !create memory dataspace. + ! + CALL h5screate_simple_f(rankr, dimsr, memspace, error) + CALL check("h5screate_simple_f",error,total_error) + + ! + !Read data + ! + CALL H5Dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, error, & + memspace, dataspace) + CALL check("h5dread_f",error,total_error) + + + ! + !Compare the data. + ! + do i = 1, dims1(1) + do j = 1, dims1(2) + IF (data_out(i,j) .NE. data_in(i, j)) THEN + write(*, *) "extend dataset test error occured" + write(*, *) "read value is not the same as the written values" + END IF + end do + end do + + ! + !Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f",error,total_error) + + ! + !Close the memspace for the dataset. + ! + CALL h5sclose_f(memspace, error) + CALL check("h5sclose_f",error,total_error) + + ! + !Close the property list. + ! + CALL h5pclose_f(crp_list, error) + CALL check("h5pclose_f",error,total_error) + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + + RETURN + END SUBROUTINE extenddsettest + + + +! END MODULE H5DTEST diff --git a/fortran/test/tH5F.f90 b/fortran/test/tH5F.f90 new file mode 100644 index 0000000..9c8a9f9 --- /dev/null +++ b/fortran/test/tH5F.f90 @@ -0,0 +1,516 @@ +! +! +! Testing File Interface functionality. +! +! MODULE H5FTEST + +! USE HDF5 ! This module contains all necessary modules + +! CONTAINS + +!In the mountingtest subroutine we create one file with a group in it, +!and another file with a dataset. Mounting is used to +!access the dataset from the second file as a member of a group +!in the first file. +! + SUBROUTINE mountingtest(total_error) + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + ! + !the respective filename is "mount1.h5" and "mount2.h5" + ! + CHARACTER(LEN=9), PARAMETER :: filename1 = "mount1.h5" + CHARACTER(LEN=9), PARAMETER :: filename2 = "mount2.h5" + + ! + !data space rank and dimensions + ! + INTEGER, PARAMETER :: RANK = 2 + INTEGER, PARAMETER :: NX = 4 + INTEGER, PARAMETER :: NY = 5 + + ! + ! File identifiers + ! + INTEGER(HID_T) :: file1_id, file2_id + + ! + ! Group identifier + ! + INTEGER(HID_T) :: gid + + ! + ! dataset identifier + ! + INTEGER(HID_T) :: dset_id + + ! + ! data space identifier + ! + INTEGER(HID_T) :: dataspace + + ! + ! data type identifier + ! + INTEGER(HID_T) :: dtype_id + + ! + !The dimensions for the dataset. + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/) + + ! + !return value for testing whether a file is in hdf5 format + ! + LOGICAL :: status + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !general purpose integer + ! + INTEGER :: i, j + + ! + !data buffers + ! + INTEGER, DIMENSION(NX,NY) :: data_in, data_out + + ! + !Initialize FORTRAN predifined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f",error,total_error) + + ! + !Initialize data_in buffer + ! + do i = 1, NX + do j = 1, NY + data_in(i,j) = (i-1) + (j-1) + end do + end do + + ! + !Create first file "mount1.h5" using default properties. + ! + CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL check("h5fcreate_f",error,total_error) + + + ! + !Create group "/G" inside file "mount1.h5". + ! + CALL h5gcreate_f(file1_id, "/G", gid, error) + CALL check("h5gcreate_f",error,total_error) + + ! + !close file and group identifiers. + ! + CALL h5gclose_f(gid, error) + CALL check("h5gclose_f",error,total_error) + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !Create second file "mount2.h5" using default properties. + ! + CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + CALL check("h5fcreate_f",error,total_error) + + ! + !Create data space for the dataset. + ! + CALL h5screate_simple_f(RANK, dims, dataspace, error) + CALL check("h5screate_simple_f",error,total_error) + + ! + !Create dataset "/D" inside file "mount2.h5". + ! + CALL h5dcreate_f(file2_id, "/D", H5T_NATIVE_INTEGER, dataspace, & + dset_id, error) + CALL check("h5dcreate_f",error,total_error) + + ! + ! Write data_in to the dataset + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data_in, error) + CALL check("h5dwrite_f",error,total_error) + + ! + !close file, dataset and dataspace identifiers. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f",error,total_error) + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + CALL h5fclose_f(file2_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !test whether files are in hdf5 format + ! + CALL h5fis_hdf5_f(filename1, status, error) + CALL check("h5fis_hdf5_f",error,total_error) + IF ( .NOT. status ) THEN + write(*,*) "File ", filename1, " is not in hdf5 format" + stop + END IF + + CALL h5fis_hdf5_f(filename2, status, error) + CALL check("h5fis_hdf5_f",error,total_error) + IF ( .NOT. status ) THEN + write(*,*) "File ", filename2, " is not in hdf5 format" + stop + END IF + + ! + !reopen both files. + ! + CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL check("hfopen_f",error,total_error) + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + CALL check("h5fopen_f",error,total_error) + + ! + !mount the second file under the first file's "/G" group. + ! + CALL h5fmount_f (file1_id, "/G", file2_id, error) + CALL check("h5fmount_f",error,total_error) + + + ! + !Access dataset D in the first file under /G/D name. + ! + CALL h5dopen_f(file1_id, "/G/D", dset_id, error) + CALL check("h5dopen_f",error,total_error) + + ! + !Get dataset's data type. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + CALL check("h5dget_type_f",error,total_error) + + ! + !Read the dataset. + ! + CALL h5dread_f(dset_id, dtype_id, data_out, error) + CALL check("h5dread_f",error,total_error) + + ! + !Compare the data. + ! + do i = 1, NX + do j = 1, NY + IF (data_out(i,j) .NE. data_in(i, j)) THEN + write(*, *) "mounting test error occured" + END IF + end do + end do + + + ! + !Close dset_id and dtype_id. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + CALL h5tclose_f(dtype_id, error) + CALL check("h5tclose_f",error,total_error) + + ! + !unmount the second file. + ! + CALL h5funmount_f(file1_id, "/G", error); + CALL check("h5funmount_f",error,total_error) + + ! + !Close both files. + ! + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f",error,total_error) + CALL h5fclose_f(file2_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + RETURN + END SUBROUTINE mountingtest + +! +!The following subroutine tests h5freopen_f. +!It creates the file which has name "reopen.h5" and +!the "/dset" dataset inside the file. +!writes the data to the file, close the dataset. +!Reopen the file based upon the file_id, open the +!dataset use the reopen_id then reads the +!dataset back to memory to test whether the data +!read is identical to the data written +! + + SUBROUTINE reopentest(total_error) + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + ! + !the dataset is stored in file "dsetf.h5" + ! + CHARACTER(LEN=9), PARAMETER :: filename = "reopen.h5" + + INTEGER(HID_T) :: file_id, reopen_id ! File identifiers + INTEGER(HID_T) :: dset_id ! Dataset identifier + + ! + !dataset name is "dset" + ! + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" + + ! + !data space rank and dimensions + ! + INTEGER, PARAMETER :: RANK = 2 + INTEGER, PARAMETER :: NX = 4 + INTEGER, PARAMETER :: NY = 6 + + ! + ! data space identifier + ! + INTEGER(HID_T) :: dataspace + + ! + !The dimensions for the dataset. + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/) + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !general purpose integer + ! + INTEGER :: i, j + + ! + !array to store data + ! + INTEGER, DIMENSION(4,6) :: dset_data, data_out + + ! + !initialize the dset_data array which will be written to the "/dset" + ! + do i = 1, NX + do j = 1, NY + dset_data(i,j) = (i-1)*6 + j; + end do + end do + + ! + !Initialize FORTRAN predifined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f",error,total_error) + + + ! + !Create file "reopen.h5" using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + ! + !Create data space for the dataset. + ! + CALL h5screate_simple_f(RANK, dims, dataspace, error) + CALL check("h5screate_simple_f",error,total_error) + + ! + !Create dataset "/dset" inside the file . + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, & + dset_id, error) + CALL check("h5dcreate_f",error,total_error) + + ! + !Write the dataset. + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, error) + CALL check("h5dwrite_f",error,total_error) + + ! + !close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + + ! + !close the dataspace. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f",error,total_error) + + ! + !Reopen file dsetf.h5. + ! + CALL h5freopen_f(file_id, reopen_id, error) + CALL check("h5freopen_f",error,total_error) + + ! + !Open the dataset based on the reopen_id. + ! + CALL h5dopen_f(reopen_id, dsetname, dset_id, error) + CALL check("h5dopen_f",error,total_error) + + ! + !Read the dataset. + ! + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, error) + CALL check("h5dread_f",error,total_error) + + ! + !Compare the data. + ! + do i = 1, NX + do j = 1, NY + IF (data_out(i,j) .NE. dset_data(i, j)) THEN + write(*, *) "reopen test error occured" + END IF + end do + end do + + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + + ! + !Close the file identifiers. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + CALL h5fclose_f(reopen_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !Close FORTRAN predifined datatypes + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + + + RETURN + + END SUBROUTINE reopentest + +! +!The following example demonstrates how to get creation property list, +!and access property list. +!We first create a file using the default creation and access property +!list. Then, the file was closed and reopened. We then get the +!creation and access property lists of the first file. The second file is +!created using the got property lists + + SUBROUTINE plisttest(total_error) + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + ! + !file names are "plist1.h5" and "plist2.h5" + ! + CHARACTER(LEN=9), PARAMETER :: filename1 = "plist1.h5" + CHARACTER(LEN=9), PARAMETER :: filename2 = "plist2.h5" + + INTEGER(HID_T) :: file1_id, file2_id ! File identifiers + INTEGER(HID_T) :: prop_id ! File creation property list identifier + INTEGER(HID_T) :: access_id ! File Access property list identifier + + !flag to check operation success + INTEGER :: error + + ! + !Initialize FORTRAN predifined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f",error,total_error) + + ! + !Create a file1 using default properties. + ! + CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL check("h5fcreate_f",error,total_error) + + ! + !Terminate access to the file. + ! + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !Open an existing file. + ! + CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL check("h5fopen_f",error,total_error) + + ! + !get the creation property list. + ! + CALL h5fget_create_plist_f(file1_id, prop_id, error) + CALL check("h5fget_create_plist_f",error,total_error) + + ! + !get the access property list. + ! + CALL h5fget_access_plist_f(file1_id, access_id, error) + CALL check("h5fget_access_plist_f",error,total_error) + + ! + !based on the creation property list id and access property list id + !create a new file + ! + CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error, & + prop_id, access_id) + CALL check("h5create_f",error,total_error) + + ! + !Close all the property lists. + ! + CALL h5pclose_f(prop_id, error) + CALL check("h5pclose_f",error,total_error) + CALL h5pclose_f(access_id, error) + CALL check("h5pclose_f",error,total_error) + + ! + !Terminate access to the files. + ! + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f",error,total_error) + + CALL h5fclose_f(file2_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !Close FORTRAN predifined datatypes + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + RETURN + + END SUBROUTINE plisttest + + + +! END MODULE H5FTEST + + diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90 new file mode 100644 index 0000000..ed7ca60 --- /dev/null +++ b/fortran/test/tH5P.f90 @@ -0,0 +1,101 @@ + + SUBROUTINE external_test(total_error) +!THis subroutine tests following functionalities: +!h5pset_external_f, h5pget_external_count_f, +!h5pget_external_f + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=11), PARAMETER :: filename = "external.h5" + INTEGER(HID_T) :: file_id + INTEGER(HID_T) :: plist_id + INTEGER(HID_T) :: space_id + INTEGER(HID_T) :: dataset_id + INTEGER(HSIZE_T), DIMENSION(1) :: cur_size !data space current size + INTEGER(HSIZE_T), DIMENSION(1) :: max_size !data space maximum size + CHARACTER*256 :: name !external file name + INTEGER :: file_offset !external file offset + INTEGER(HSIZE_T) :: file_size !sizeof external file segment + INTEGER :: error !error code + INTEGER(SIZE_T) :: int_size !size of integer + INTEGER(HSIZE_T) :: file_bytes !Number of bytes reserved + !in the file for the data + INTEGER :: RANK = 1 !dataset rank + INTEGER :: count !number of external files for the + !specified dataset + INTEGER(SIZE_T) :: namesize + + ! + ! Initialize FORTRAN predefined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f",error,total_error) + + ! + !Create file "external.h5" using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) + CALL check("h5pcreate_f",error,total_error) + cur_size(1) =100 + max_size(1) = 100; + call h5tget_size_f(H5T_NATIVE_INTEGER, int_size, error) + CALL check("h5tget_size_f",error,total_error) + file_size = int_size * max_size(1); + CALL h5pset_external_f(plist_id, "ext1.data", 0, file_size, error) + CALL check("h5pset_external_f",error,total_error) + CALL h5screate_simple_f(RANK, cur_size, space_id, error, max_size) + CALL check("h5screate_simple_f", error, total_error) + CALL h5dcreate_f(file_id, "dset1", H5T_NATIVE_INTEGER, space_id, & + dataset_id, error, plist_id) + CALL check("h5dcreate_f", error, total_error) + + CALL h5dclose_f(dataset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + ! Read dataset creation information + CALL h5dopen_f(file_id, "dset1", dataset_id, error) + CALL check("h5dopen_f",error,total_error) + + CALL h5dget_create_plist_f(dataset_id, plist_id, error) + CALL check("h5dget_create_plist_f",error,total_error) + CALL h5pget_external_count_f(plist_id, count, error) + CALL check("h5pget_external_count_f",error,total_error) + if(count .ne. 1 ) then + write (*,*) "got external_count is not correct" + total_error = total_error + 1 + end if + namesize = 10 + CALL h5pget_external_f(plist_id, 0, namesize, name, file_offset, & + file_bytes, error) + CALL check("h5pget_external_f",error,total_error) + if(file_offset .ne. 0 ) then + write (*,*) "got external file offset is not correct" + total_error = total_error + 1 + end if + if(file_bytes .ne. file_size ) then + write (*,*) "got external file size is not correct" + total_error = total_error + 1 + end if + + CALL h5dclose_f(dataset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + +! CALL h5close_types_f(error) +! CALL check("h5close_types_f", error, total_error) + + RETURN + END SUBROUTINE external_test + diff --git a/fortran/test/tH5R.f90 b/fortran/test/tH5R.f90 new file mode 100644 index 0000000..56b7a21 --- /dev/null +++ b/fortran/test/tH5R.f90 @@ -0,0 +1,367 @@ +! +! +! Testing Reference Interface functionality. +! +! MODULE H5RTEST + +! USE HDF5 ! This module contains all necessary modules + +! CONTAINS +! +!The following subroutine tests h5rcreate_f, h5rdereference_f +!and H5Rget_object_type functions +! + SUBROUTINE refobjtest(total_error) + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=12), PARAMETER :: filename = "reference.h5" + CHARACTER(LEN=8), PARAMETER :: dsetnamei = "INTEGERS" + CHARACTER(LEN=17), PARAMETER :: dsetnamer = "OBJECT_REFERENCES" + CHARACTER(LEN=6), PARAMETER :: groupname1 = "GROUP1" + CHARACTER(LEN=6), PARAMETER :: groupname2 = "GROUP2" + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: grp1_id ! Group identifier + INTEGER(HID_T) :: grp2_id ! Group identifier + INTEGER(HID_T) :: dset1_id ! Dataset identifier + INTEGER(HID_T) :: dsetr_id ! Dataset identifier + INTEGER(HID_T) :: type_id ! Type identifier + INTEGER(HID_T) :: space_id ! Dataspace identifier + INTEGER(HID_T) :: spacer_id ! Dataspace identifier + INTEGER :: error, obj_type + INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/5/) + INTEGER(HSIZE_T), DIMENSION(1) :: dimsr= (/4/) + INTEGER(HSIZE_T), DIMENSION(1) :: my_maxdims = (/5/) + INTEGER :: rank = 1 + INTEGER :: rankr = 1 + TYPE(hobj_ref_t_f), DIMENSION(4) :: ref + TYPE(hobj_ref_t_f), DIMENSION(4) :: ref_out + INTEGER, DIMENSION(5) :: data = (/1, 2, 3, 4, 5/) + + ! + ! Initialize FORTRAN predefined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f",error,total_error) + + ! + !Create a new file with Default file access and + !file creation properties . + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + + ! + ! Create a group inside the file + ! + CALL h5gcreate_f(file_id, groupname1, grp1_id, error) + CALL check("h5gcreate_f",error,total_error) + + ! + ! Create a group inside the group GROUP1 + ! + CALL h5gcreate_f(grp1_id, groupname2, grp2_id, error) + CALL check("h5gcreate_f",error,total_error) + + ! + ! Create dataspaces for datasets + ! + CALL h5screate_simple_f(rank, dims, space_id, error, maxdims=my_maxdims) + CALL check("h5screate_simple_f",error,total_error) + CALL h5screate_simple_f(rankr, dimsr, spacer_id, error) + CALL check("h5screate_simple_f",error,total_error) + + ! + ! Create integer dataset + ! + CALL h5dcreate_f(file_id, dsetnamei, H5T_NATIVE_INTEGER, space_id, & + dset1_id, error) + CALL check("h5dcreate_f",error,total_error) + ! + ! Create dataset to store references to the objects + ! + CALL h5dcreate_f(file_id, dsetnamer, H5T_STD_REF_OBJ, spacer_id, & + dsetr_id, error) + CALL check("h5dcreate_f",error,total_error) + ! + ! Create a datatype and store in the file + ! + CALL h5tcopy_f(H5T_NATIVE_REAL, type_id, error) + CALL check("h5tcopy_f",error,total_error) + CALL h5tcommit_f(file_id, "MyType", type_id, error) + CALL check("h5tcommit_f",error,total_error) + + ! + ! Close dataspaces, groups and integer dataset + ! + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f",error,total_error) + CALL h5sclose_f(spacer_id, error) + CALL check("h5sclose_f",error,total_error) + CALL h5dclose_f(dset1_id, error) + CALL check("h5dclose_f",error,total_error) + CALL h5tclose_f(type_id, error) + CALL check("h5tclose_f",error,total_error) + CALL h5gclose_f(grp1_id, error) + CALL check("h5gclose_f",error,total_error) + CALL h5gclose_f(grp2_id, error) + CALL check("h5gclose_f",error,total_error) + + + ! + ! Craete references to two groups, integer dataset and shared datatype + ! and write it to the dataset in the file + ! + CALL h5rcreate_f(file_id, groupname1, ref(1), error) + CALL check("h5rcreate_f",error,total_error) + CALL h5rcreate_f(file_id, "/GROUP1/GROUP2", ref(2), error) + CALL check("h5rcreate_f",error,total_error) + CALL h5rcreate_f(file_id, dsetnamei, ref(3), error) + CALL check("h5rcreate_f",error,total_error) + CALL h5rcreate_f(file_id, "MyType", ref(4), error) + CALL check("h5rcreate_f",error,total_error) + + CALL h5dwrite_f(dsetr_id, H5T_STD_REF_OBJ, ref, error) + CALL check("h5dwrite_f",error,total_error) + + ! + !Close the dataset + ! + CALL h5dclose_f(dsetr_id, error) + CALL check("h5dclose_f",error,total_error) + + ! + ! Reopen the dataset with object references + ! + CALL h5dopen_f(file_id, dsetnamer,dsetr_id,error) + CALL check("h5dopen_f",error,total_error) + CALL h5dread_f(dsetr_id, H5T_STD_REF_OBJ, ref_out, error) + CALL check("h5dread_f",error,total_error) + + ! + !get the third reference's type and Dereference it + ! + CALL h5rget_object_type_obj_f(dsetr_id, ref(3), obj_type, error) + CALL check("h5rget_object_type_obj_f",error,total_error) + if (obj_type == 2) then + CALL h5rdereference_f(dsetr_id, ref(3), dset1_id, error) + CALL check("h5rdereference_f",error,total_error) + + CALL h5dwrite_f(dset1_id, H5T_NATIVE_INTEGER, data, error) + CALL check("h5dwrite_f",error,total_error) + end if + + ! + !get the fourth reference's type and Dereference it + ! + CALL h5rget_object_type_obj_f(dsetr_id, ref(4), obj_type, error) + CALL check("h5rget_object_type_obj_f",error,total_error) + if (obj_type == 3) then + CALL h5rdereference_f(dsetr_id, ref(4), type_id, error) + CALL check("h5rdereference_f",error,total_error) + end if + + ! + ! Close all objects. + ! + CALL h5dclose_f(dset1_id, error) + CALL check("h5dclose_f",error,total_error) + CALL h5tclose_f(type_id, error) + CALL check("h5tclose_f",error,total_error) + + CALL h5dclose_f(dsetr_id, error) + CALL check("h5dclose_f",error,total_error) + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + RETURN + + END SUBROUTINE refobjtest +! +!The following subroutine tests h5rget_region_f, h5rcreate_f +!and h5rdereference_f functionalities +! + SUBROUTINE refregtest(total_error) + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=9), PARAMETER :: filename = "Refreg.h5" + CHARACTER(LEN=6), PARAMETER :: dsetnamev = "MATRIX" + CHARACTER(LEN=17), PARAMETER :: dsetnamer = "REGION_REFERENCES" + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: space_id ! Dataspace identifier + INTEGER(HID_T) :: spacer_id ! Dataspace identifier + INTEGER(HID_T) :: dsetv_id ! Dataset identifier + INTEGER(HID_T) :: dsetr_id ! Dataset identifier + INTEGER :: error + TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref ! Buffers to store references + TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref_out ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/2,9/) ! Datasets dimensions + INTEGER(HSIZE_T), DIMENSION(1) :: dimsr = (/2/) ! + INTEGER(HSSIZE_T), DIMENSION(2) :: start + INTEGER(HSIZE_T), DIMENSION(2) :: count + INTEGER :: rankr = 1 + INTEGER :: rank = 2 + INTEGER , DIMENSION(2,9) :: data + INTEGER , DIMENSION(2,9) :: data_out = 0 + INTEGER(HSSIZE_T) , DIMENSION(2,3) :: coord + INTEGER(SIZE_T) ::num_points = 3 ! Number of selected points + INTEGER :: i, j + coord = reshape((/1,1,2,7,1,9/), (/2,3/)) ! Coordinates of selected points + data = reshape ((/1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6/), (/2,9/)) + + ! + ! Initialize FORTRAN predefined datatypes. + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f", error, total_error) + ! + ! Create a new file. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + ! Default file access and file creation + ! properties are used. + CALL check("h5fcreate_f", error, total_error) + ! + ! Create dataspaces: + ! + ! for dataset with references to dataset regions + ! + CALL h5screate_simple_f(rankr, dimsr, spacer_id, error) + CALL check("h5screate_simple_f", error, total_error) + ! + ! for integer dataset + ! + CALL h5screate_simple_f(rank, dims, space_id, error) + CALL check("h5screate_simple_f", error, total_error) + ! + ! Create and write datasets: + ! + ! Integer dataset + ! + CALL h5dcreate_f(file_id, dsetnamev, H5T_NATIVE_INTEGER, space_id, & + dsetv_id, error) + CALL check("h5dcreate_f", error, total_error) + CALL h5dwrite_f(dsetv_id, H5T_NATIVE_INTEGER, data, error) + CALL check("h5dwrite_f", error, total_error) + + CALL h5dclose_f(dsetv_id, error) + CALL check("h5dclose_f", error, total_error) + ! + ! Dataset with references + ! + CALL h5dcreate_f(file_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, & + dsetr_id, error) + CALL check("h5dcreate_f", error, total_error) + ! + ! Create a reference to the hyperslab selection. + ! + start(1) = 0 + start(2) = 3 + count(1) = 2 + count(2) = 3 + CALL h5sselect_hyperslab_f(space_id, H5S_SELECT_SET_F, & + start, count, error) + CALL check("h5sselect_hyperslab_f", error, total_error) + CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(1), error) + CALL check("h5rcreate_f", error, total_error) + ! + ! Create a reference to elements selection. + ! + CALL h5sselect_none_f(space_id, error) + CALL check("h5sselect_none_f", error, total_error) + CALL h5sselect_elements_f(space_id, H5S_SELECT_SET_F, rank, num_points,& + coord, error) + CALL check("h5sselect_elements_f", error, total_error) + CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(2), error) + CALL check("h5rcreate_f", error, total_error) + ! + ! Write dataset with the references. + ! + CALL h5dwrite_f(dsetr_id, H5T_STD_REF_DSETREG, ref, error) + CALL check("h5dwrite_f", error, total_error) + ! + ! Close all objects. + ! + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + CALL h5sclose_f(spacer_id, error) + CALL check("h5sclose_f", error, total_error) + CALL h5dclose_f(dsetr_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + ! + ! Reopen the file to test selections. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + CALL check("h5fopen_f", error, total_error) + CALL h5dopen_f(file_id, dsetnamer, dsetr_id, error) + CALL check("h5dopen_f", error, total_error) + ! + ! Read references to the dataset regions. + ! + CALL h5dread_f(dsetr_id, H5T_STD_REF_DSETREG, ref_out, error) + CALL check("h5dread_f", error, total_error) + ! + ! Dereference the first reference. + ! + CALL H5rdereference_f(dsetr_id, ref_out(1), dsetv_id, error) + CALL check("h5rdereference_f", error, total_error) + CALL H5rget_region_f(dsetr_id, ref_out(1), space_id, error) + CALL check("h5rget_region_f", error, total_error) + ! + ! Read selected data from the dataset. + ! + CALL h5dread_f(dsetv_id, H5T_NATIVE_INTEGER, data_out, error, & + mem_space_id = space_id, file_space_id = space_id) + CALL check("h5dread_f", error, total_error) + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + CALL h5dclose_f(dsetv_id, error) + CALL check("h5dclose_f", error, total_error) + data_out = 0 + ! + ! Dereference the second reference. + ! + CALL H5rdereference_f(dsetr_id, ref_out(2), dsetv_id, error) + CALL check("h5rdereference_f", error, total_error) + CALL H5rget_region_f(dsetr_id, ref_out(2), space_id, error) + CALL check("h5rget_region_f", error, total_error) + ! + ! Read selected data from the dataset. + ! + CALL h5dread_f(dsetv_id, H5T_NATIVE_INTEGER, data_out, error, & + mem_space_id = space_id, file_space_id = space_id) + CALL check("h5dread_f", error, total_error) + ! + ! Close all objects + ! + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + CALL h5dclose_f(dsetv_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5dclose_f(dsetr_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + RETURN + + END SUBROUTINE refregtest + + +! END MODULE H5RTEST diff --git a/fortran/test/tH5S.f90 b/fortran/test/tH5S.f90 new file mode 100644 index 0000000..7d64ada --- /dev/null +++ b/fortran/test/tH5S.f90 @@ -0,0 +1,247 @@ +! +! +! Testing Dataspace Interface functionality. +! +! MODULE H5STEST + +! USE HDF5 ! This module contains all necessary modules + +! CONTAINS + +! +!The following subroutine tests the following functionalities: +!h5screate_f, h5scopy_f, h5screate_simple_f, h5sis_simple_f, +!h5sget_simple_extent_dims_f,h5sget_simple_extent_ndims_f +!h5sget_simple_extent_npoints_f, h5sget_simple_extent_type_f, +!h5sextent_copy_f, h5sset_extent_simple_f, h5sset_extent_none_f +! + SUBROUTINE dataspace_basic_test(total_error) + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=13), PARAMETER :: filename1 = "basicspace.h5" ! File1 name + CHARACTER(LEN=12), PARAMETER :: filename2 = "copyspace.h5" ! File2 name + CHARACTER(LEN=9), PARAMETER :: dsetname = "basicdset" ! Dataset name + + INTEGER(HID_T) :: file1_id, file2_id ! File identifiers + INTEGER(HID_T) :: dset1_id, dset2_id ! Dataset identifiers + INTEGER(HID_T) :: space1_id, space2_id ! Dataspace identifiers + + INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/4,6/) ! Dataset dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: maxdims1 = (/4,6/) ! maximum dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: dims2 = (/6,6/) ! Dataset dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: maxdims2 = (/6,6/) ! maximum dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: dimsout, maxdimsout ! dimensions + INTEGER(HSIZE_T) :: npoints !number of elements in the dataspace + + INTEGER :: rank1 = 2 ! Dataspace1 rank + INTEGER :: rank2 = 2 ! Dataspace2 rank + INTEGER :: classtype ! Dataspace class type + + INTEGER, DIMENSION(4,6) :: data1_in, data1_out ! Data input buffers + INTEGER, DIMENSION(6,6) :: data2_in, data2_out ! Data output buffers + INTEGER :: error ! Error flag + + LOGICAL :: flag !flag to test datyspace is simple or not + INTEGER :: i, j !general purpose integers + + ! + ! Initialize the dset_data array. + ! + do i = 1, 4 + do j = 1, 6 + data1_in(i,j) = (i-1)*6 + j; + end do + end do + + do i = 1, 6 + do j = 1, 6 + data2_in(i,j) = i*6 + j; + end do + end do + + ! + ! Initialize FORTRAN predefined datatypes. + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f", error, total_error) + + ! + ! Create new files using default properties. + ! + CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL check("h5fcreate_f", error, total_error) + + CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + CALL check("h5fcreate_f", error, total_error) + + ! + ! Create dataspace for file1. + ! + CALL h5screate_simple_f(rank1, dims1, space1_id, error, maxdims1) + CALL check("h5screate_simple_f", error, total_error) + ! + ! Copy space1_id to space2_id. + ! + CALL h5scopy_f(space1_id, space2_id, error) + CALL check("h5scopy_f", error, total_error) + + ! + !Check whether copied space is simple. + ! + CALL h5sis_simple_f(space2_id, flag, error) + CALL check("h5sissimple_f", error, total_error) + IF (.NOT. flag) write(*,*) "dataspace is not simple type" + + ! + !set the copied space to none. + ! + CALL h5sset_extent_none_f(space2_id, error) + CALL check("h5sset_extent_none_f", error, total_error) + + ! + !copy the extent of space1_id to space2_id. + ! + CALL h5sextent_copy_f(space2_id, space1_id, error) + CALL check("h5sextent_copy_f", error, total_error) + + ! + !get the copied space's dimensions. + ! + CALL h5sget_simple_extent_dims_f(space2_id, dimsout, maxdimsout, error) + CALL check("h5sget_simple_extent_dims_f", error, total_error) + IF ((dimsout(1) .NE. dims1(1)) .OR. (dimsout(2) .NE. dims1(2)) ) THEN + write(*,*)"error occured, copied dims not same" + END IF + + ! + !get the copied space's rank. + ! + CALL h5sget_simple_extent_ndims_f(space2_id, rank2, error) + CALL check("h5sget_simple_extent_ndims_f", error, total_error) + IF (rank2 .NE. rank1) write(*,*)"error occured, copied ranks not same" + + ! + !get the copied space's number of elements. + ! + CALL h5sget_simple_extent_npoints_f(space2_id, npoints, error) + CALL check("h5sget_simple_extent_npoints_f", error, total_error) + IF (npoints .NE. 24) write(*,*)"error occured, number of elements not correct" + + + ! + !get the copied space's class type. + ! + CALL h5sget_simple_extent_type_f(space2_id, classtype, error) + CALL check("h5sget_simple_extent_type_f", error, total_error) + IF (classtype .NE. 1) write(*,*)"class type not H5S_SIMPLE_f" + + ! + !set the copied space to dim2 size. + ! + CALL h5sset_extent_simple_f(space2_id, rank2, dims2, maxdims2, error) + CALL check("h5sset_extent_simple_f", error, total_error) + + ! + !get the copied space's dimensions. + ! + CALL h5sget_simple_extent_dims_f(space2_id, dimsout, maxdimsout, error) + CALL check("h5sget_simple_extent_dims_f", error, total_error) + IF ((dimsout(1) .NE. dims2(1)) .OR. (dimsout(2) .NE. dims2(2)) ) THEN + write(*,*)"error occured, copied dims not same" + END IF + + ! + ! Create the datasets with default properties in two files. + ! + CALL h5dcreate_f(file1_id, dsetname, H5T_NATIVE_INTEGER, space1_id, & + dset1_id, error) + CALL check("h5dcreate_f", error, total_error) + + CALL h5dcreate_f(file2_id, dsetname, H5T_NATIVE_INTEGER, space2_id, & + dset2_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! + ! Write the datasets. + ! + CALL h5dwrite_f(dset1_id, H5T_NATIVE_INTEGER, data1_in, error) + CALL check("h5dwrite_f", error, total_error) + + CALL h5dwrite_f(dset2_id, H5T_NATIVE_INTEGER, data2_in, error) + CALL check("h5dwrite_f", error, total_error) + + ! + ! Read the first dataset. + ! + CALL h5dread_f(dset1_id, H5T_NATIVE_INTEGER, data1_out, error) + CALL check("h5dread_f", error, total_error) + + ! + !Compare the data. + ! + do i = 1, 4 + do j = 1, 6 + IF (data1_out(i,j) .NE. data1_in(i, j)) THEN + write(*, *) "dataset test error occured" + write(*,*) "data read is not the same as the data writen" + END IF + end do + end do + + + ! + ! Read the second dataset. + ! + CALL h5dread_f(dset2_id, H5T_NATIVE_INTEGER, data2_out, error) + CALL check("h5dread_f", error, total_error) + + ! + !Compare the data. + ! + do i = 1, 6 + do j = 1, 6 + IF (data2_out(i,j) .NE. data2_in(i, j)) THEN + write(*, *) "dataset test error occured" + write(*,*) "data read is not the same as the data writen" + END IF + end do + end do + + ! + !Close the datasets. + ! + CALL h5dclose_f(dset1_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5dclose_f(dset2_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data spaces. + ! + CALL h5sclose_f(space1_id, error) + CALL check("h5sclose_f", error, total_error) + CALL h5sclose_f(space2_id, error) + CALL check("h5sclose_f", error, total_error) + ! + ! Close the files. + ! + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f", error, total_error) + CALL h5fclose_f(file2_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + !Close FORTRAN predifined datatypes + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f",error,total_error) + + RETURN + END SUBROUTINE dataspace_basic_test + + +! END MODULE H5STEST diff --git a/fortran/test/tH5Sselect.f90 b/fortran/test/tH5Sselect.f90 new file mode 100644 index 0000000..c7cd398 --- /dev/null +++ b/fortran/test/tH5Sselect.f90 @@ -0,0 +1,991 @@ +! +! Testing Selection-related Dataspace Interface functionality. +! + +! +!The following subroutines tests the following functionalities: +!h5sget_select_npoints_f, h5sselect_elements_f, h5sselect_all_f, +!h5sselect_none_f, h5sselect_valid_f, h5sselect_hyperslab_f, +!h5sget_select_bounds_f, h5sget_select_elem_pointlist_f, +!h5sget_select_elem_npoints_f, h5sget_select_hyper_blocklist_f, +!h5sget_select_hyper_nblocks_f, h5sget_select_npoints_f +! + + SUBROUTINE test_select_hyperslab(total_error) + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + ! + !the dataset is stored in file "sdsf.h5" + ! + CHARACTER(LEN=7), PARAMETER :: filename = "sdsf.h5" + + ! + !dataset name is "IntArray" + ! + CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier + + ! + !Memory space dimensions + ! + INTEGER(HSIZE_T), DIMENSION(3) :: dimsm = (/7,7,3/) + + ! + !to get Dataset dimensions + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dims_out + + ! + !Dataset dimensions + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/5,6/) + + ! + !Size of the hyperslab in the file + ! + INTEGER(HSIZE_T), DIMENSION(2) :: count = (/3,4/) + + ! + !hyperslab offset in the file + ! + INTEGER(HSIZE_T), DIMENSION(2) :: offset = (/1,2/) + + ! + !Size of the hyperslab in memory + ! + INTEGER(HSIZE_T), DIMENSION(3) :: count_out = (/3,4,1/) + + ! + !hyperslab offset in memory + ! + INTEGER(HSIZE_T), DIMENSION(3) :: offset_out = (/3,0,0/) + + ! + !data to write + ! + INTEGER, DIMENSION(5,6) :: data + + ! + !output buffer + ! + INTEGER, DIMENSION(7,7,3) :: data_out + + + ! + !dataset space rank + ! + INTEGER :: dsetrank = 2 + + ! + !memspace rank + ! + INTEGER :: memrank = 3 + + ! + !integer to get the dataspace rank from dataset + ! + INTEGER :: rank + + + ! + !general purpose integer + ! + INTEGER :: i, j, k + + ! + !flag to check operation success + ! + INTEGER :: error, error_n + + + ! + !This writes data to the HDF5 file. + ! + + ! + !data initialization + ! + do i = 1, 5 + do j = 1, 6 + data(i,j) = (i-1) + (j-1); + end do + end do + ! + ! 0, 1, 2, 3, 4, 5 + ! 1, 2, 3, 4, 5, 6 + ! 2, 3, 4, 5, 6, 7 + ! 3, 4, 5, 6, 7, 8 + ! 4, 5, 6, 7, 8, 9 + ! + + ! + !Initialize FORTRAN predifined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f", error, total_error) + + ! + !Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f", error, total_error) + + ! + !Create the data space for the dataset. + ! + CALL h5screate_simple_f(dsetrank, dimsf, dataspace, error) + CALL check("h5screate_simple_f", error, total_error) + + ! + ! Create the dataset with default properties + ! + CALL h5dcreate_f(file_id, dsetname, H5T_STD_I32BE, dataspace, & + dset_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! + ! Write the dataset + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, error) + CALL check("h5dwrite_f", error, total_error) + + ! + !Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + !This reads the hyperslab from the sds.h5 file just + !created, into a 2-dimensional plane of the 3-dimensional array. + ! + + ! + !initialize data_out array + ! + ! do i = 1, 7 + ! do j = 1, 7 + ! do k = 1,3 + ! data_out(i,j,k) = 0; + ! end do + ! end do + ! end do + + ! + !Open the file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + CALL check("h5fopen_f", error, total_error) + + ! + !Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + CALL check("h5dopen_f", error, total_error) + + ! + !Get dataset's dataspace handle. + ! + CALL h5dget_space_f(dset_id, dataspace, error) + CALL check("h5dget_space_f", error, total_error) + + ! + !Select hyperslab in the dataset. + ! + CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & + offset, count, error) + CALL check("h5sselect_hyperslab_f", error, total_error) + ! + !create memory dataspace. + ! + CALL h5screate_simple_f(memrank, dimsm, memspace, error) + CALL check("h5screate_simple_f", error, total_error) + + ! + !Select hyperslab in memory. + ! + CALL h5sselect_hyperslab_f(memspace, H5S_SELECT_SET_F, & + offset_out, count_out, error) + CALL check("h5sselect_hyperslab_f", error, total_error) + + ! + !Read data from hyperslab in the file into the hyperslab in + !memory and display. + ! + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, error, & + memspace, dataspace) + CALL check("h5dread_f", error, total_error) + + ! + !Display data_out array + ! + !do i = 1, 7 + ! print *, (data_out(i,j,1), j = 1,7) + !end do + + ! 0 0 0 0 0 0 0 + ! 0 0 0 0 0 0 0 + ! 0 0 0 0 0 0 0 + ! 3 4 5 6 0 0 0 + ! 4 5 6 7 0 0 0 + ! 5 6 7 8 0 0 0 + ! 0 0 0 0 0 0 0 + ! + + ! + !Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the memoryspace. + ! + CALL h5sclose_f(memspace, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f", error, total_error) + RETURN + + END SUBROUTINE test_select_hyperslab + + ! + !Subroutine to test element selection + ! + + SUBROUTINE test_select_element(total_error) + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + ! + !the dataset1 is stored in file "copy1.h5" + ! + CHARACTER(LEN=8), PARAMETER :: filename1 = "copy1.h5" + + ! + !the dataset2 is stored in file "copy2.h5" + ! + CHARACTER(LEN=8), PARAMETER :: filename2 = "copy2.h5" + ! + !dataset1 name is "Copy1" + ! + CHARACTER(LEN=8), PARAMETER :: dsetname1 = "Copy1" + + ! + !dataset2 name is "Copy2" + ! + CHARACTER(LEN=8), PARAMETER :: dsetname2 = "Copy2" + + ! + !dataset rank + ! + INTEGER, PARAMETER :: RANK = 2 + + ! + !number of points selected + ! + INTEGER(SIZE_T), PARAMETER :: NUMP = 2 + + INTEGER(HID_T) :: file1_id ! File1 identifier + INTEGER(HID_T) :: file2_id ! File2 identifier + INTEGER(HID_T) :: dset1_id ! Dataset1 identifier + INTEGER(HID_T) :: dset2_id ! Dataset2 identifier + INTEGER(HID_T) :: dataspace1 ! Dataspace identifier + INTEGER(HID_T) :: dataspace2 ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier + + ! + !Memory space dimensions + ! + INTEGER(HSIZE_T), DIMENSION(1) :: dimsm = (/2/) + + ! + !Dataset dimensions + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/3,4/) + + ! + !Points positions in the file + ! + INTEGER(HSSIZE_T), DIMENSION(RANK,NUMP) :: coord + + ! + !data buffers + ! + INTEGER, DIMENSION(3,4) :: buf1, buf2, bufnew + + ! + !value to write + ! + INTEGER, DIMENSION(2) :: val = (/53, 59/) + + ! + !memory rank + ! + INTEGER :: memrank = 1 + + ! + !general purpose integer + ! + INTEGER :: i, j + + ! + !flag to check operation success + ! + INTEGER :: error + LOGICAL :: status + + + ! + !Create two files containing identical datasets. Write 0's to one + !and 1's to the other. + ! + + ! + !data initialization + ! + do i = 1, 3 + do j = 1, 4 + buf1(i,j) = 0; + end do + end do + + do i = 1, 3 + do j = 1, 4 + buf2(i,j) = 1; + end do + end do + + ! + !Initialize FORTRAN predifined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f", error, total_error) + + ! + !Create file1, file2 using default properties. + ! + CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) + CALL check("h5fcreate_f", error, total_error) + + CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) + CALL check("h5fcreate_f", error, total_error) + + ! + !Create the data space for the datasets. + ! + CALL h5screate_simple_f(RANK, dimsf, dataspace1, error) + CALL check("h5screate_simple_f", error, total_error) + + CALL h5screate_simple_f(RANK, dimsf, dataspace2, error) + CALL check("h5screate_simple_f", error, total_error) + + ! + ! Create the datasets with default properties + ! + CALL h5dcreate_f(file1_id, dsetname1, H5T_NATIVE_INTEGER, dataspace1, & + dset1_id, error) + CALL check("h5dcreate_f", error, total_error) + + CALL h5dcreate_f(file2_id, dsetname2, H5T_NATIVE_INTEGER, dataspace2, & + dset2_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! + ! Write the datasets + ! + CALL h5dwrite_f(dset1_id, H5T_NATIVE_INTEGER, buf1, error) + CALL check("h5dwrite_f", error, total_error) + + CALL h5dwrite_f(dset2_id, H5T_NATIVE_INTEGER, buf2, error) + CALL check("h5dwrite_f", error, total_error) + + ! + !Close the dataspace for the datasets. + ! + CALL h5sclose_f(dataspace1, error) + CALL check("h5sclose_f", error, total_error) + + CALL h5sclose_f(dataspace2, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the datasets. + ! + CALL h5dclose_f(dset1_id, error) + CALL check("h5dclose_f", error, total_error) + + CALL h5dclose_f(dset2_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + !Close the files. + ! + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f", error, total_error) + + CALL h5fclose_f(file2_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + !Open the two files. Select two points in one file, write values to + !those point locations, then do H5Scopy and write the values to the + !other file. Close files. + ! + + ! + !Open the files. + ! + CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL check("h5fopen_f", error, total_error) + + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + CALL check("h5fopen_f", error, total_error) + + ! + !Open the datasets. + ! + CALL h5dopen_f(file1_id, dsetname1, dset1_id, error) + CALL check("h5dopen_f", error, total_error) + + CALL h5dopen_f(file2_id, dsetname2, dset2_id, error) + CALL check("h5dopen_f", error, total_error) + + ! + !Get dataset1's dataspace handle. + ! + CALL h5dget_space_f(dset1_id, dataspace1, error) + CALL check("h5dget_space_f", error, total_error) + + ! + !create memory dataspace. + ! + CALL h5screate_simple_f(memrank, dimsm, memspace, error) + CALL check("h5screate_simple_f", error, total_error) + + ! + !Set the selected point positions.Because Fortran array index starts + ! from 1, so add one to the actual select points in C + ! + coord(1,1) = 1 + coord(2,1) = 2 + coord(1,2) = 1 + coord(2,2) = 4 + + ! + !Select the elements in file space + ! + CALL h5sselect_elements_f(dataspace1, H5S_SELECT_SET_F, RANK, NUMP,& + coord, error) + CALL check("h5sselect_elements_f", error, total_error) + + ! + !Write value into the selected points in dataset1 + ! + CALL H5dwrite_f(dset1_id, H5T_NATIVE_INTEGER, val, error, & + mem_space_id=memspace, file_space_id=dataspace1) + CALL check("h5dwrite_f", error, total_error) + + ! + !Copy the daspace1 into dataspace2 + ! + CALL h5scopy_f(dataspace1, dataspace2, error) + CALL check("h5scopy_f", error, total_error) + + ! + !Write value into the selected points in dataset2 + ! + CALL H5dwrite_f(dset2_id, H5T_NATIVE_INTEGER, val, error, & + mem_space_id=memspace, file_space_id=dataspace2) + CALL check("h5dwrite_f", error, total_error) + + ! + !Close the dataspace for the datasets. + ! + CALL h5sclose_f(dataspace1, error) + CALL check("h5sclose_f", error, total_error) + + CALL h5sclose_f(dataspace2, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the memoryspace. + ! + CALL h5sclose_f(memspace, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the datasets. + ! + CALL h5dclose_f(dset1_id, error) + CALL check("h5dclose_f", error, total_error) + + CALL h5dclose_f(dset2_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + !Close the files. + ! + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f", error, total_error) + + CALL h5fclose_f(file2_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + !Open both files and print the contents of the datasets. + ! + + ! + !Open the files. + ! + CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) + CALL check("h5fopen_f", error, total_error) + + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) + CALL check("h5fopen_f", error, total_error) + + ! + !Open the datasets. + ! + CALL h5dopen_f(file1_id, dsetname1, dset1_id, error) + CALL check("h5dopen_f", error, total_error) + + CALL h5dopen_f(file2_id, dsetname2, dset2_id, error) + CALL check("h5dopen_f", error, total_error) + + ! + !Read dataset1. + ! + CALL h5dread_f(dset1_id, H5T_NATIVE_INTEGER, bufnew, error) + CALL check("h5dread_f", error, total_error) + + ! + !Display the data read from dataset "Copy1" + ! + !write(*,*) "The data in dataset Copy1 is: " + !do i = 1, 3 + ! print *, (bufnew(i,j), j = 1,4) + !end do + + ! + !Read dataset2. + ! + CALL h5dread_f(dset2_id, H5T_NATIVE_INTEGER, bufnew, error) + CALL check("h5dread_f", error, total_error) + + ! + !Display the data read from dataset "Copy2" + ! + !write(*,*) "The data in dataset Copy2 is: " + !do i = 1, 3 + ! print *, (bufnew(i,j), j = 1,4) + !end do + + ! + !Close the datasets. + ! + CALL h5dclose_f(dset1_id, error) + CALL check("h5dclose_f", error, total_error) + + CALL h5dclose_f(dset2_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + !Close the files. + ! + CALL h5fclose_f(file1_id, error) + CALL check("h5fclose_f", error, total_error) + + CALL h5fclose_f(file2_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f", error, total_error) + + END SUBROUTINE test_select_element + + + SUBROUTINE test_basic_select(total_error) + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + ! + !the dataset is stored in file "testselect.h5" + ! + CHARACTER(LEN=13), PARAMETER :: filename = "testselect.h5" + + ! + !dataspace rank + ! + INTEGER, PARAMETER :: RANK = 2 + + ! + !select NUMP_POINTS points from the file + ! + INTEGER(SIZE_T), PARAMETER :: NUMPS = 10 + + ! + !dataset name is "testselect" + ! + CHARACTER(LEN=10), PARAMETER :: dsetname = "testselect" + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier + + ! + !Dataset dimensions + ! + INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/5,6/) + + ! + !Size of the hyperslab in the file + ! + INTEGER(HSIZE_T), DIMENSION(2) :: count = (/2,2/) + + ! + !hyperslab offset in the file + ! + INTEGER(HSIZE_T), DIMENSION(2) :: offset = (/0,0/) + + ! + !start block for getting the selected hyperslab + ! + INTEGER(HSIZE_T), DIMENSION(2) :: startblock = (/0,0/) + + ! + !start point for getting the selected elements + ! + INTEGER(HSIZE_T), DIMENSION(2) :: startpoint = (/0,0/) +! INTEGER(HSIZE_T), DIMENSION(2) :: startpoint = (/1,1/) + + ! + !Stride of the hyperslab in the file + ! + INTEGER(HSIZE_T), DIMENSION(2) :: stride = (/3,3/) + + ! + !BLock size of the hyperslab in the file + ! + INTEGER(HSIZE_T), DIMENSION(2) :: block = (/2,2/) + + ! + !array to give selected points' coordinations + ! + INTEGER(HSSIZE_T), DIMENSION(RANK, NUMPS) :: coord + + ! + !Size of the hyperslab in memory + ! + INTEGER(HSIZE_T), DIMENSION(3) :: count_out = (/3,4,1/) + + ! + !Number of hyperslabs selected in the current dataspace + ! + INTEGER(HSSIZE_T) :: num_blocks + + ! + !allocatable array for putting a list of hyperslabs + !selected in the current file dataspace + ! + INTEGER(HSIZE_T), ALLOCATABLE, DIMENSION(:) :: blocklist + + ! + !Number of points selected in the current dataspace + ! + INTEGER(HSSIZE_T) :: num_points + INTEGER(HSIZE_T) :: num1_points + + ! + !allocatable array for putting a list of points + !selected in the current file dataspace + ! + INTEGER(HSIZE_T), ALLOCATABLE, DIMENSION(:) :: pointlist + + ! + !start and end bounds in the current dataspac selection + ! + INTEGER(HSIZE_T), DIMENSION(RANK) :: startout, endout + + ! + !data to write + ! + INTEGER, DIMENSION(5,6) :: data + + ! + !output buffer + ! + INTEGER, DIMENSION(7,7,3) :: data_out + + ! + !general purpose integer + ! + INTEGER :: i, j, k + + ! + !flag to check operation success + ! + INTEGER :: error, error_n + + ! + !initialize the coord array to give the selected points' position + ! + coord(1,1) = 1 + coord(2,1) = 1 + coord(1,2) = 1 + coord(2,2) = 3 + coord(1,3) = 1 + coord(2,3) = 5 + coord(1,4) = 3 + coord(2,4) = 1 + coord(1,5) = 3 + coord(2,5) = 3 + coord(1,6) = 3 + coord(2,6) = 5 + coord(1,7) = 4 + coord(2,7) = 3 + coord(1,8) = 4 + coord(2,8) = 1 + coord(1,9) = 5 + coord(2,9) = 3 + coord(1,10) = 5 + coord(2,10) = 5 + ! + !Initialize FORTRAN predifined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f", error, total_error) + + ! + !Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f", error, total_error) + + ! + !Create the data space for the dataset. + ! + CALL h5screate_simple_f(RANK, dimsf, dataspace, error) + CALL check("h5screate_simple_f", error, total_error) + + ! + ! Create the dataset with default properties + ! + CALL h5dcreate_f(file_id, dsetname, H5T_STD_I32BE, dataspace, & + dset_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! + ! Write the dataset + ! + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, error) + CALL check("h5dwrite_f", error, total_error) + + ! + !Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + !Open the file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + CALL check("h5fopen_f", error, total_error) + + ! + !Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + CALL check("h5dopen_f", error, total_error) + + ! + !Get dataset's dataspace handle. + ! + CALL h5dget_space_f(dset_id, dataspace, error) + CALL check("h5dget_space_f", error, total_error) + + ! + !Select hyperslab in the dataset. + ! + CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & + offset, count, error, stride, block) + CALL check("h5sselect_hyperslab_f", error, total_error) + + ! + !get the number of hyperslab blocks in the current dataspac selection + ! + CALL h5sget_select_hyper_nblocks_f(dataspace, num_blocks, error) + CALL check("h5sget_select_hyper_nblocks_f", error, total_error) + IF (num_blocks .NE. 4) write (*,*) "error occured with num_blocks" + !write(*,*) num_blocks + !result of num_blocks is 4 + + ! + !allocate the blocklist array + ! + ALLOCATE(blocklist(num_blocks*RANK*2), STAT= error) + if(error .NE. 0) then + STOP + endif + + ! + !get the list of hyperslabs selected in the current dataspac selection + ! + CALL h5sget_select_hyper_blocklist_f(dataspace, startblock, & + num_blocks, blocklist, error) + CALL check("h5sget_select_hyper_blocklist_f", error, total_error) + !write(*,*) (blocklist(i), i =1, num_blocks*RANK*2) + !result of blocklist selected is: + !1, 1, 2, 2, 4, 1, 5, 2, 1, 4, 2, 5, 4, 4, 5, 5 + + ! + !deallocate the blocklist array + ! + DEALLOCATE(blocklist) + + ! + !get the selection bounds in the current dataspac selection + ! + CALL h5sget_select_bounds_f(dataspace, startout, endout, error) + CALL check("h5sget_select_bounds_f", error, total_error) + IF ( (startout(1) .ne. 1) .or. (startout(2) .ne. 1) ) THEN + write(*,*) "error occured to select_bounds's start position" + END IF + + IF ( (endout(1) .ne. 5) .or. (endout(2) .ne. 5) ) THEN + write(*,*) "error occured to select_bounds's end position" + END IF + !write(*,*) (startout(i), i = 1, RANK) + !result of startout is 0, 0 + + !write(*,*) (endout(i), i = 1, RANK) + !result of endout is 5, 5 + + ! + !allocate the pointlist array + ! +! ALLOCATE(pointlist(num_blocks*RANK), STAT= error) + ALLOCATE(pointlist(20), STAT= error) + if(error .NE. 0) then + STOP + endif + + ! + !Select the elements in file space + ! + CALL h5sselect_elements_f(dataspace, H5S_SELECT_SET_F, RANK, NUMPS,& + coord, error) + CALL check("h5sselect_elements_f", error, total_error) + + ! + !Get the number of selected elements + ! + CALL h5sget_select_elem_npoints_f(dataspace, num_points, error) + CALL check("h5sget_select_elem_npoints_f", error, total_error) + IF (num_points .NE. 10) write(*,*) "error occured with num_points" + !write(*,*) num_points + ! result of num_points is 10 + + ! + !Get the list of selected elements + ! + num1_points = num_points + CALL h5sget_select_elem_pointlist_f(dataspace, startpoint, & + num1_points, pointlist, error) + CALL check("h5sget_select_elem_pointlist_f", error, total_error) + !write(*,*) (pointlist(i), i =1, num1_points*RANK) + !result of pintlist is: + !1, 1, 3, 1, 5, 1, 1, 3, 3, 3, 5, 3, 3, + !4, 1, 4, 3, 5, 5, 5 + + ! + !deallocate the pointlist array + ! + DEALLOCATE(pointlist) + + ! + !Close the dataspace for the dataset. + ! + CALL h5sclose_f(dataspace, error) + CALL check("h5sclose_f", error, total_error) + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f", error, total_error) + + END SUBROUTINE test_basic_select + + diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90 new file mode 100644 index 0000000..2b6301b --- /dev/null +++ b/fortran/test/tH5T.f90 @@ -0,0 +1,691 @@ + SUBROUTINE compoundtest(total_error) +! +! This program creates a dataset that is one dimensional array of +! structures { +! character*2 +! integer +! double precision +! real +! } +! Data is written and read back by fields. +! +! The following H5T interface functions are tested: +! h5tcopy_f, h5tset(get)_size_f, h5tcreate_f, h5tinsert_f, h5tclose_f, +! h5tget_class_f, h5tget_member_name_f, h5tget_member_offset_f, h5tget_member_type_f, +! h5tequal_f, h5tinsert_array_f, h5tcommit_f + + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=11), PARAMETER :: filename = "compound.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: dsetname = "Compound" ! Dataset name + INTEGER, PARAMETER :: dimsize = 6 ! Size of the dataset + INTEGER, PARAMETER :: COMP_NUM_MEMBERS = 4 ! Number of members in the compound datatype + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dspace_id ! Dataspace identifier + INTEGER(HID_T) :: dtype_id ! Compound datatype identifier + INTEGER(HID_T) :: dtarray_id ! Compound datatype identifier + INTEGER(HID_T) :: dt1_id ! Memory datatype identifier (for character field) + INTEGER(HID_T) :: dt2_id ! Memory datatype identifier (for integer field) + INTEGER(HID_T) :: dt3_id ! Memory datatype identifier (for double precision field) + INTEGER(HID_T) :: dt4_id ! Memory datatype identifier (for real field) + INTEGER(HID_T) :: dt5_id ! Memory datatype identifier + INTEGER(HID_T) :: membtype_id ! Datatype identifier + INTEGER(HID_T) :: plist_id ! Dataset trasfer property + + + INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/dimsize/) ! Dataset dimensions + INTEGER :: rank = 1 ! Dataset rank + + INTEGER :: error ! Error flag + INTEGER(SIZE_T) :: type_size ! Size of the datatype + INTEGER(SIZE_T) :: type_sizec ! Size of the character datatype + INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype + INTEGER(SIZE_T) :: type_sized ! Size of the double precision datatype + INTEGER(SIZE_T) :: type_sizer ! Size of the real datatype + INTEGER(SIZE_T) :: offset ! Member's offset + INTEGER(SIZE_T) :: offset_out ! Member's offset + CHARACTER*2, DIMENSION(dimsize) :: char_member + CHARACTER*2, DIMENSION(dimsize) :: char_member_out ! Buffer to read data out + INTEGER, DIMENSION(dimsize) :: int_member + INTEGER, DIMENSION(dimsize) :: int_member_out + DOUBLE PRECISION, DIMENSION(dimsize) :: double_member + DOUBLE PRECISION, DIMENSION(dimsize) :: double_member_out + REAL, DIMENSION(dimsize) :: real_member + REAL, DIMENSION(dimsize) :: real_member_out + INTEGER :: i + INTEGER :: class ! Datatype class + INTEGER :: num_members ! Number of members in the compound datatype + CHARACTER*256 :: member_name + INTEGER :: len ! Lenght of the name of the compound datatype member + LOGICAL :: flag + INTEGER(SIZE_T), DIMENSION(3) :: array_dims=(/2,3,4/) + INTEGER :: elements = 24 ! number of elements in the array_dims array. + INTEGER(SIZE_T) :: sizechar + ! + ! Initialize data buffer. + ! + do i = 1, dimsize + char_member(i)(1:1) = char(65+i) + char_member(i)(2:2) = char(65+i) + char_member_out(i)(1:1) = char(65) + char_member_out(i)(2:2) = char(65) + int_member(i) = i + int_member_out(i) = 0 + double_member(i) = 2.* i + double_member_out(i) = 0. + real_member(i) = 3. * i + real_member_out(i) = 0. + enddo + + ! + ! Initialize FORTRAN predefined datatypes. + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f", error, total_error) + ! + ! Set dataset transfer property to preserve partially initialized fields + ! during write/read to/from dataset with compound datatype. + ! + CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_preserve_f(plist_id, 1, error) + CALL check("h5pset_preserve_f", error, total_error) + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f", error, total_error) + + ! + ! Create the dataspace. + ! + CALL h5screate_simple_f(rank, dims, dspace_id, error) + CALL check("h5screate_simple_f", error, total_error) + ! + ! Create compound datatype. + ! + ! First calculate total size by calculating sizes of each member + ! + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, dt5_id, error) + CALL check("h5tcopy_f", error, total_error) + sizechar = 2 + CALL h5tset_size_f(dt5_id, sizechar, error) + CALL check("h5tset_size_f", error, total_error) + CALL h5tget_size_f(dt5_id, type_sizec, error) + CALL check("h5tget_size_f", error, total_error) + CALL h5tget_size_f(H5T_NATIVE_INTEGER, type_sizei, error) + CALL check("h5tget_size_f", error, total_error) + CALL h5tget_size_f(H5T_NATIVE_DOUBLE, type_sized, error) + CALL check("h5tget_size_f", error, total_error) + CALL h5tget_size_f(H5T_NATIVE_REAL, type_sizer, error) + CALL check("h5tget_size_f", error, total_error) + !write(*,*) "get sizes", type_sizec, type_sizei, type_sizer, type_sized + type_size = type_sizec + type_sizei + type_sized + type_sizer + CALL h5tcreate_f(H5T_COMPOUND_F, type_size, dtype_id, error) + CALL check("h5tcreate_f", error, total_error) + ! + ! Insert memebers + ! + ! CHARACTER*2 memeber + ! + offset = 0 + CALL h5tinsert_f(dtype_id, "char_field", offset, dt5_id, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! INTEGER member + ! + offset = offset + type_sizec ! Offset of the second memeber is 2 + CALL h5tinsert_f(dtype_id, "integer_field", offset, H5T_NATIVE_INTEGER, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! DOUBLE PRECISION member + ! + offset = offset + type_sizei ! Offset of the third memeber is 6 + CALL h5tinsert_f(dtype_id, "double_field", offset, H5T_NATIVE_DOUBLE, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! REAL member + ! + offset = offset + type_sized ! Offset of the last member is 14 + CALL h5tinsert_f(dtype_id, "real_field", offset, H5T_NATIVE_REAL, error) + CALL check("h5tinsert_f", error, total_error) + + ! + ! Create the dataset with compound datatype. + ! + CALL h5dcreate_f(file_id, dsetname, dtype_id, dspace_id, & + dset_id, error) + CALL check("h5dcreate_f", error, total_error) + ! + ! Create memory types. We have to create a compound datatype + ! for each member we want to write. + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizec, dt1_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt1_id, "char_field", offset, dt5_id, error) + CALL check("h5tinsert_f", error, total_error) + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizei, dt2_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt2_id, "integer_field", offset, H5T_NATIVE_INTEGER, error) + CALL check("h5tinsert_f", error, total_error) + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sized, dt3_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt3_id, "double_field", offset, H5T_NATIVE_DOUBLE, error) + CALL check("h5tinsert_f", error, total_error) + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizer, dt4_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt4_id, "real_field", offset, H5T_NATIVE_REAL, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! Write data by fields in the datatype. Fields order is not important. + ! + CALL h5dwrite_f(dset_id, dt4_id, real_member, error, xfer_prp = plist_id) + CALL check("h5dwrite_f", error, total_error) + CALL h5dwrite_f(dset_id, dt1_id, char_member, error, xfer_prp = plist_id) + CALL check("h5dwrite_f", error, total_error) + CALL h5dwrite_f(dset_id, dt3_id, double_member, error, xfer_prp = plist_id) + CALL check("h5dwrite_f", error, total_error) + CALL h5dwrite_f(dset_id, dt2_id, int_member, error, xfer_prp = plist_id) + CALL check("h5dwrite_f", error, total_error) + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + CALL check("h5sclose_f", error, total_error) + ! + ! Terminate access to the datatype + ! + CALL h5tclose_f(dtype_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt1_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt2_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt3_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt4_id, error) + CALL check("h5tclose_f", error, total_error) +! We will keep this type open +! CALL h5tclose_f(dt5_id, error) +! CALL check("h5tclose_f", error, total_error) + + ! + ! Create and store compound datatype with the character and + ! array members. + ! + type_size = type_sizec + elements*type_sizer ! Size of compound datatype + CALL h5tcreate_f(H5T_COMPOUND_F, type_size, dtarray_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dtarray_id, "char_field", offset, H5T_NATIVE_CHARACTER, error) + offset = type_sizec + CALL h5tinsert_array_f(dtarray_id, "array_filed", offset, size(array_dims), & + array_dims, H5T_NATIVE_REAL, error) + CALL check("h5tinsert_array_f", error, total_error) + CALL h5tcommit_f(file_id, "Compound_with_array_member", dtarray_id, error) + CALL check("h5tcommit_f", error, total_error) + CALL h5tclose_f(dtarray_id, error) + CALL check("h5tclose_f", error, total_error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + ! + ! Open the file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + CALL check("h5fopen_f", error, total_error) + ! + ! Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + CALL check("h5dopen_f", error, total_error) + ! + ! Get datatype of the open dataset. + ! Check it class, number of members, and member's names. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + CALL check("h5dget_type_f", error, total_error) + CALL h5tget_class_f(dtype_id, class, error) + CALL check("h5dget_class_f", error, total_error) + if (class .ne. H5T_COMPOUND_F) then + write(*,*) " Wrong class type returned" + total_error = total_error + 1 + endif + CALL h5tget_nmembers_f(dtype_id, num_members, error) + CALL check("h5dget_nmembers_f", error, total_error) + if (num_members .ne. COMP_NUM_MEMBERS ) then + write(*,*) " Wrong number of members returned" + total_error = total_error + 1 + endif + ! + ! Go through the members and find out their names and offsets. + ! + do i = 1, num_members + CALL h5tget_member_name_f(dtype_id, i-1, member_name, len, error) + CALL check("h5tget_member_name_f", error, total_error) + CALL h5tget_member_offset_f(dtype_id, i-1, offset_out, error) + CALL check("h5tget_member_offset_f", error, total_error) + CHECK_NAME: SELECT CASE (member_name(1:len)) + CASE("char_field") + if(offset_out .ne. 0) then + write(*,*) "Offset of the char member is incorrect" + total_error = total_error + 1 + endif + CALL h5tget_member_type_f(dtype_id, i-1, membtype_id, error) + CALL check("h5tget_member_type_f", error, total_error) + CALL h5tequal_f(membtype_id, dt5_id, flag, error) + CALL check("h5tequal_f", error, total_error) + if(.not. flag) then + write(*,*) "Wrong member type returned for character member" + total_error = total_error + 1 + endif + CASE("integer_field") + if(offset_out .ne. type_sizec) then + write(*,*) "Offset of the integer member is incorrect" + total_error = total_error + 1 + endif + CALL h5tget_member_type_f(dtype_id, i-1, membtype_id, error) + CALL check("h5tget_member_type_f", error, total_error) + CALL h5tequal_f(membtype_id, H5T_NATIVE_INTEGER, flag, error) + CALL check("h5tequal_f", error, total_error) + if(.not. flag) then + write(*,*) "Wrong member type returned for integer memebr" + total_error = total_error + 1 + endif + CASE("double_field") + if(offset_out .ne. (type_sizec+type_sizei)) then + write(*,*) "Offset of the double precision member is incorrect" + total_error = total_error + 1 + endif + CALL h5tget_member_type_f(dtype_id, i-1, membtype_id, error) + CALL check("h5tget_member_type_f", error, total_error) + CALL h5tequal_f(membtype_id, H5T_NATIVE_DOUBLE, flag, error) + CALL check("h5tequal_f", error, total_error) + if(.not. flag) then + write(*,*) "Wrong member type returned for double precision memebr" + total_error = total_error + 1 + endif + CASE("real_field") + if(offset_out .ne. (type_sizec+type_sizei+type_sized)) then + write(*,*) "Offset of the real member is incorrect" + total_error = total_error + 1 + endif + CALL h5tget_member_type_f(dtype_id, i-1, membtype_id, error) + CALL check("h5tget_member_type_f", error, total_error) + CALL h5tequal_f(membtype_id, H5T_NATIVE_REAL, flag, error) + CALL check("h5tequal_f", error, total_error) + if(.not. flag) then + write(*,*) "Wrong member type returned for real memebr" + total_error = total_error + 1 + endif + CASE DEFAULT + write(*,*) "Wrong member's name" + total_error = total_error + 1 + + END SELECT CHECK_NAME + + enddo + ! + ! Create memory datatype to read character member of the compound datatype. + ! + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, dt2_id, error) + CALL check("h5tcopy_f", error, total_error) + sizechar = 2 + CALL h5tset_size_f(dt2_id, sizechar, error) + CALL check("h5tset_size_f", error, total_error) + CALL h5tget_size_f(dt2_id, type_size, error) + CALL check("h5tget_size_f", error, total_error) + CALL h5tcreate_f(H5T_COMPOUND_F, type_size, dt1_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt1_id, "char_field", offset, dt2_id, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! Read part of the dataset + ! + CALL h5dread_f(dset_id, dt1_id, char_member_out, error) + CALL check("h5dread_f", error, total_error) + do i = 1, dimsize + if (char_member_out(i) .ne. char_member(i)) then + write(*,*) " Wrong character data is read back " + total_error = total_error + 1 + endif + enddo + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizei, dt5_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt5_id, "integer_field", offset, H5T_NATIVE_INTEGER, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! Read part of the dataset + ! + CALL h5dread_f(dset_id, dt5_id, int_member_out, error) + CALL check("h5dread_f", error, total_error) + do i = 1, dimsize + if (int_member_out(i) .ne. int_member(i)) then + write(*,*) " Wrong integer data is read back " + total_error = total_error + 1 + endif + enddo + ! + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sized, dt3_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt3_id, "double_field", offset, H5T_NATIVE_DOUBLE, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! Read part of the dataset + ! + CALL h5dread_f(dset_id, dt3_id, double_member_out, error) + CALL check("h5dread_f", error, total_error) + do i = 1, dimsize + if (double_member_out(i) .ne. double_member(i)) then + write(*,*) " Wrong double precision data is read back " + total_error = total_error + 1 + endif + enddo + ! + ! + CALL h5tcreate_f(H5T_COMPOUND_F, type_sizer, dt4_id, error) + CALL check("h5tcreate_f", error, total_error) + offset = 0 + CALL h5tinsert_f(dt4_id, "real_field", offset, H5T_NATIVE_REAL, error) + CALL check("h5tinsert_f", error, total_error) + ! + ! Read part of the dataset + ! + CALL h5dread_f(dset_id, dt4_id, real_member_out, error) + CALL check("h5dread_f", error, total_error) + do i = 1, dimsize + if (real_member_out(i) .ne. real_member(i)) then + write(*,*) " Wrong double precision data is read back " + total_error = total_error + 1 + endif + enddo + ! + + ! + ! Close all open objects. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5tclose_f(dt1_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt2_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt3_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt4_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dt5_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + ! + ! Close FORTRAN predefined datatypes. + ! +! CALL h5close_types_f(error) +! CALL check("h5close_types_f", error, total_error) + + RETURN + END SUBROUTINE compoundtest + + + + + SUBROUTINE basic_data_type_test(total_error) +!THis subroutine tests following functionalities: +!H5tget_precision_f, H5tset_precision_f, H5tget_offset_f +!H5tset_offset_f, H5tget_pad_f, H5tset_pad_f, H5tget_sign_f, +!H5tset_sign_f, H5tget_ebias_f,H5tset_ebias_f, H5tget_norm_f, +!H5tset_norm_f, H5tget_inpad_f, H5tset_inpad_f, H5tget_cset_f, +!H5tset_cset_f, H5tget_strpad_f, H5tset_strpad_f + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=13), PARAMETER :: filename = "basic_type.h5" ! File name + + INTEGER(HID_T) :: dtype1_id, dtype2_id, dtype3_id, dtype4_id, dtype5_id + ! datatype identifiers + INTEGER(SIZE_T) :: precision ! Datatype precision + INTEGER(SIZE_T) :: setprecision ! Datatype precision + INTEGER(SIZE_T) :: offset ! Datatype offset + INTEGER(SIZE_T) :: setoffset ! Datatype offset + INTEGER :: lsbpad !padding type of the least significant bit + INTEGER :: msbpad !padding type of the most significant bit + INTEGER :: sign !sign type for an integer type + INTEGER(SIZE_T) :: ebias1 !Datatype exponent bias of a floating-point type + INTEGER(SIZE_T) :: ebias2 !Datatype exponent bias of a floating-point type + INTEGER(SIZE_T) :: setebias + INTEGER :: norm !mantissa normalization of a floating-point datatype + INTEGER :: inpad !padding type for unused bits in floating-point datatypes. + INTEGER :: cset !character set type of a string datatype + INTEGER :: strpad !string padding method for a string datatype + INTEGER :: error !error flag + ! + ! Initialize FORTRAN predefined datatypes + ! +! CALL h5init_types_f(error) +! CALL check("h5init_types_f",error,total_error) + + + ! + ! Create a datatype + ! + CALL h5tcopy_f(H5T_STD_U16BE, dtype1_id, error) + CALL check("h5tcopy_f",error,total_error) + ! + !datatype type_id should be modifiable after h5tcopy_f + ! + setprecision = 12 + CALL h5tset_precision_f(dtype1_id, setprecision, error) + CALL check("h5set_precision_f",error,total_error) + CALL h5tget_precision_f(dtype1_id,precision, error) + CALL check("h5get_precision_f",error,total_error) + if(precision .ne. 12) then + write (*,*) "got precision is not correct" + total_error = total_error + 1 + end if + + CALL h5tcopy_f(H5T_STD_I32LE, dtype2_id, error) + CALL check("h5tcopy_f",error,total_error) + setprecision = 12 + CALL h5tset_precision_f(dtype2_id, setprecision, error) + CALL check("h5set_precision_f",error,total_error) + + setoffset = 2 + CALL h5tset_offset_f(dtype1_id, setoffset, error) + CALL check("h5set_offset_f",error,total_error) + setoffset = 10 + CALL h5tset_offset_f(dtype2_id, setoffset, error) + CALL check("h5set_offset_f",error,total_error) + CALL h5tget_offset_f(dtype2_id,offset, error) + CALL check("h5get_offset_f",error,total_error) + if(offset .ne. 10) then + write (*,*) "got offset is not correct" + total_error = total_error + 1 + end if + + CALL h5tset_pad_f(dtype2_id,H5T_PAD_ONE_F, H5T_PAD_ONE_F, error) + CALL check("h5set_pad_f",error,total_error) + CALL h5tget_pad_f(dtype2_id,lsbpad,msbpad, error) + CALL check("h5get_pad_f",error,total_error) + if((lsbpad .ne. H5T_PAD_ONE_F) .and. (msbpad .ne. H5T_PAD_ONE_F)) then + write (*,*) "got pad is not correct" + total_error = total_error + 1 + end if + +! CALL h5tset_sign_f(dtype2_id,H5T_SGN_2_F, error) +! CALL check("h5set_sign_f",error,total_error) +! CALL h5tget_sign_f(dtype2_id,sign, error) + CALL h5tget_sign_f(H5T_NATIVE_INTEGER, sign, error) + CALL check("h5tget_sign_f",error,total_error) + if(sign .ne. H5T_SGN_2_F ) then + write (*,*) "got sign is not correct" + total_error = total_error + 1 + end if + + CALL h5tcopy_f(H5T_IEEE_F64BE, dtype3_id, error) + CALL check("h5tcopy_f",error,total_error) + CALL h5tcopy_f(H5T_IEEE_F32LE, dtype4_id, error) + CALL check("h5tcopy_f",error,total_error) + + setebias = 257 + CALL h5tset_ebias_f(dtype3_id, setebias, error) + CALL check("h5tset_ebias_f",error,total_error) + setebias = 1 + CALL h5tset_ebias_f(dtype4_id, setebias, error) + CALL check("h5tset_ebias_f",error,total_error) + CALL h5tget_ebias_f(dtype3_id, ebias1, error) + CALL check("h5tget_ebias_f",error,total_error) + if(ebias1 .ne. 257 ) then + write (*,*) "got ebias is not correct" + total_error = total_error + 1 + end if + CALL h5tget_ebias_f(dtype4_id, ebias2, error) + CALL check("h5tget_ebias_f",error,total_error) + if(ebias2 .ne. 1 ) then + write (*,*) "got ebias is not correct" + total_error = total_error + 1 + end if + + !attention: + !It seems that I can't use H5T_NORM_IMPLIED_F to set the norm value + !because I got error for the get_norm function +! CALL h5tset_norm_f(dtype3_id,H5T_NORM_IMPLIED_F , error) +! CALL check("h5tset_norm_f",error,total_error) +! CALL h5tget_norm_f(dtype3_id, norm, error) +! CALL check("h5tget_norm_f",error,total_error) +! if(norm .ne. H5T_NORM_IMPLIED_F ) then +! write (*,*) "got norm is not correct" +! total_error = total_error + 1 +! end if + CALL h5tset_norm_f(dtype3_id, H5T_NORM_MSBSET_F , error) + CALL check("h5tset_norm_f",error,total_error) + CALL h5tget_norm_f(dtype3_id, norm, error) + CALL check("h5tget_norm_f",error,total_error) + if(norm .ne. H5T_NORM_MSBSET_F ) then + write (*,*) "got norm is not correct" + total_error = total_error + 1 + end if + + CALL h5tset_norm_f(dtype3_id, H5T_NORM_NONE_F , error) + CALL check("h5tset_norm_f",error,total_error) + CALL h5tget_norm_f(dtype3_id, norm, error) + CALL check("h5tget_norm_f",error,total_error) + if(norm .ne. H5T_NORM_NONE_F ) then + write (*,*) "got norm is not correct" + total_error = total_error + 1 + end if + + CALL h5tset_inpad_f(dtype3_id, H5T_PAD_ZERO_F , error) + CALL check("h5tset_inpad_f",error,total_error) + CALL h5tget_inpad_f(dtype3_id, inpad , error) + CALL check("h5tget_inpad_f",error,total_error) + if(inpad .ne. H5T_PAD_ZERO_F ) then + write (*,*) "got inpad is not correct" + total_error = total_error + 1 + end if + + CALL h5tset_inpad_f(dtype3_id,H5T_PAD_ONE_F , error) + CALL check("h5tset_inpad_f",error,total_error) + CALL h5tget_inpad_f(dtype3_id, inpad , error) + CALL check("h5tget_inpad_f",error,total_error) + if(inpad .ne. H5T_PAD_ONE_F ) then + write (*,*) "got inpad is not correct" + total_error = total_error + 1 + end if + + CALL h5tset_inpad_f(dtype3_id,H5T_PAD_BACKGROUND_F , error) + CALL check("h5tset_inpad_f",error,total_error) + CALL h5tget_inpad_f(dtype3_id, inpad , error) + CALL check("h5tget_inpad_f",error,total_error) + if(inpad .ne. H5T_PAD_BACKGROUND_F ) then + write (*,*) "got inpad is not correct" + total_error = total_error + 1 + end if + +! we should not apply h5tset_cset_f to non_character data typemake + +! CALL h5tset_cset_f(dtype4_id, H5T_CSET_ASCII_F, error) +! CALL check("h5tset_cset_f",error,total_error) +! CALL h5tget_cset_f(dtype4_id, cset, error) +! CALL check("h5tget_cset_f",error,total_error) +! if(cset .ne. H5T_CSET_ASCII_F ) then +! write (*,*) "got cset is not correct" +! total_error = total_error + 1 +! end if + + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, dtype5_id, error) + CALL check("h5tcopy_f",error,total_error) + CALL h5tset_cset_f(dtype5_id, H5T_CSET_ASCII_F, error) + CALL check("h5tset_cset_f",error,total_error) + CALL h5tget_cset_f(dtype5_id, cset, error) + CALL check("h5tget_cset_f",error,total_error) + if(cset .ne. H5T_CSET_ASCII_F ) then + write (*,*) "got cset is not correct" + total_error = total_error + 1 + end if + CALL h5tset_strpad_f(dtype5_id, H5T_STR_NULL_F, error) + CALL check("h5tset_strpad_f",error,total_error) + CALL h5tget_strpad_f(dtype5_id, strpad, error) + CALL check("h5tget_strpad_f",error,total_error) + if(strpad .ne. H5T_STR_NULL_F ) then + write (*,*) "got strpad is not correct" + total_error = total_error + 1 + end if + + CALL h5tset_strpad_f(dtype5_id, H5T_STR_SPACE_F, error) + CALL check("h5tset_strpad_f",error,total_error) + CALL h5tget_strpad_f(dtype5_id, strpad, error) + CALL check("h5tget_strpad_f",error,total_error) + if(strpad .ne. H5T_STR_SPACE_F ) then + write (*,*) "got strpad is not correct" + total_error = total_error + 1 + end if + + CALL h5tclose_f(dtype1_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dtype2_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dtype3_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dtype4_id, error) + CALL check("h5tclose_f", error, total_error) + CALL h5tclose_f(dtype5_id, error) + CALL check("h5tclose_f", error, total_error) + +! CALL h5close_types_f(error) +! CALL check("h5close_types_f", error, total_error) + + RETURN + END SUBROUTINE basic_data_type_test -- cgit v0.12