diff options
92 files changed, 2289 insertions, 6905 deletions
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 1a74460..f52b99b 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -17,7 +17,9 @@ HDF5_SETUP_FILTERS (NBIT) HDF5_SETUP_FILTERS (SCALEOFFSET) include (ExternalProject) -option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO SVN TGZ)" "NO") +#option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO SVN TGZ)" "NO") +set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)") +set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1) option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1) @@ -110,7 +112,7 @@ if (HDF5_ENABLE_SZIP_SUPPORT) endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") endif (SZIP_FOUND) set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES}) - INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIR}) + INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) message (STATUS "Filter SZIP is ON") if (H5_HAVE_FILTER_SZIP) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index bac7581..4b132ca 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -26,7 +26,7 @@ endif (NOT HDF5_EXTERNALLY_CONFIGURED) # Export all exported targets to the build tree for use by parent project #----------------------------------------------------------------------------- if (NOT HDF5_EXTERNALLY_CONFIGURED) - EXPORT ( + export ( TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake ) @@ -39,12 +39,12 @@ set (HDF5_INCLUDES_BUILD_TIME ${HDF5_SRC_DIR} ${HDF5_CPP_SRC_DIR} ${HDF5_HL_SRC_DIR} ${HDF5_TOOLS_SRC_DIR} ${HDF5_BINARY_DIR} ) -set (HDF5_VERSION_STRING @HDF5_PACKAGE_VERSION@) -set (HDF5_VERSION_MAJOR @HDF5_PACKAGE_VERSION_MAJOR@) -set (HDF5_VERSION_MINOR @HDF5_PACKAGE_VERSION_MINOR@) +set (HDF5_VERSION_STRING ${HDF5_PACKAGE_VERSION}) +set (HDF5_VERSION_MAJOR ${HDF5_PACKAGE_VERSION_MAJOR}) +set (HDF5_VERSION_MINOR ${HDF5_PACKAGE_VERSION_MINOR}) configure_file ( - ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.build.in + ${HDF_RESOURCES_DIR}/hdf5-config.cmake.build.in ${HDF5_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY ) @@ -53,7 +53,7 @@ configure_file ( #----------------------------------------------------------------------------- if (NOT HDF5_EXTERNALLY_CONFIGURED) configure_file ( - ${HDF5_RESOURCES_DIR}/FindHDF5.cmake.in + ${HDF_RESOURCES_DIR}/FindHDF5.cmake.in ${HDF5_BINARY_DIR}/CMakeFiles/FindHDF5${HDF_PACKAGE_EXT}.cmake @ONLY ) install ( @@ -68,7 +68,7 @@ endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- if (NOT HDF5_EXTERNALLY_CONFIGURED) configure_file ( - ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.install.in + ${HDF_RESOURCES_DIR}/hdf5-config.cmake.install.in ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY ) install ( @@ -83,7 +83,7 @@ endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- if (NOT HDF5_EXTERNALLY_CONFIGURED) configure_file ( - ${HDF5_RESOURCES_DIR}/hdf5-config-version.cmake.in + ${HDF_RESOURCES_DIR}/hdf5-config-version.cmake.in ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY ) install ( @@ -102,7 +102,7 @@ else (H5_WORDS_BIGENDIAN) set (BYTESEX little-endian) endif (H5_WORDS_BIGENDIAN) configure_file ( - ${HDF5_RESOURCES_DIR}/libhdf5.settings.cmake.in + ${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in ${HDF5_BINARY_DIR}/libhdf5.settings @ONLY ) install ( @@ -121,7 +121,7 @@ install ( # set (HDF5LIBS "${HDF5LIBS} -l${libs}") #endforeach (libs ${HDF5_LIBRARIES_TO_EXPORT}) #configure_file ( -# ${HDF5_RESOURCES_DIR}/libhdf5.pc.in +# ${HDF_RESOURCES_DIR}/libhdf5.pc.in # ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc @ONLY #) #install ( @@ -135,7 +135,7 @@ install ( option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) if (HDF5_PACK_EXAMPLES) configure_file ( - ${HDF5_RESOURCES_DIR}/HDF518_Examples.cmake.in + ${HDF_RESOURCES_DIR}/HDF518_Examples.cmake.in ${HDF5_BINARY_DIR}/HDF518_Examples.cmake @ONLY ) install ( @@ -157,50 +157,7 @@ endif (HDF5_PACK_EXAMPLES) #----------------------------------------------------------------------------- # Configure the README.txt file for the binary package #----------------------------------------------------------------------------- -set (BINARY_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) -set (BINARY_PLATFORM "${CMAKE_SYSTEM_NAME}") -if (WIN32) - set (BINARY_EXAMPLE_ENDING "zip") - set (BINARY_INSTALL_ENDING "exe") - if (CMAKE_CL_64) - set (BINARY_SYSTEM_NAME "win64") - else (CMAKE_CL_64) - set (BINARY_SYSTEM_NAME "win32") - endif (CMAKE_CL_64) - if (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") - set (BINARY_PLATFORM "${BINARY_PLATFORM} 7") - elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.2") - set (BINARY_PLATFORM "${BINARY_PLATFORM} 8") - endif (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") - set (BINARY_PLATFORM "${BINARY_PLATFORM} ${MSVC_C_ARCHITECTURE_ID}") - if (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2010") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "15.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2008") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "17.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2012") - else (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") - endif (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*") -elseif (APPLE) - set (BINARY_EXAMPLE_ENDING "tar.gz") - set (BINARY_INSTALL_ENDING "dmg") - set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") -else (WIN32) - set (BINARY_EXAMPLE_ENDING "tar.gz") - set (BINARY_INSTALL_ENDING "sh") - set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") -endif (WIN32) -if (HDF4_BUILD_FORTRAN) - set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") -endif (HDF4_BUILD_FORTRAN) - -configure_file ( - ${HDF5_RESOURCES_DIR}/README.txt.cmake.in - ${HDF5_BINARY_DIR}/README.txt @ONLY -) +HDF_README_PROPERTIES(HDF5_BUILD_FORTRAN) #----------------------------------------------------------------------------- # Add Document File(s) to CMake Install @@ -292,11 +249,11 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) endif (EXISTS "${HDF5_SOURCE_DIR}/release_docs") set (CPACK_PACKAGE_RELOCATABLE TRUE) set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") - set (CPACK_PACKAGE_ICON "${HDF5_RESOURCES_DIR}/hdf.bmp") + set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp") set (CPACK_GENERATOR "TGZ") if (WIN32) - LIST (APPEND CPACK_GENERATOR "NSIS") + list (APPEND CPACK_GENERATOR "NSIS") # Installers for 32- vs. 64-bit CMake: # - Root install directory (displayed to end user at installer-run time) # - "NSIS package/display name" (text used in the installer GUI) @@ -311,28 +268,27 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) endif (CMAKE_CL_64) # set the install/unistall icon used for the installer itself # There is a bug in NSI that does not handle full unix paths properly. - set (CPACK_NSIS_MUI_ICON "${HDF5_RESOURCES_DIR}\\\\hdf.ico") - set (CPACK_NSIS_MUI_UNIICON "${HDF5_RESOURCES_DIR}\\\\hdf.ico") + set (CPACK_NSIS_MUI_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico") + set (CPACK_NSIS_MUI_UNIICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico") # set the package header icon for MUI - set (CPACK_PACKAGE_ICON "${HDF5_RESOURCES_DIR}\\\\hdf.bmp") - #set (CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@, is a data model, library, and file format for storing and managing data") - set (CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@") + set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.bmp") + set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}") set (CPACK_MONOLITHIC_INSTALL ON) set (CPACK_NSIS_CONTACT "${HDF5_PACKAGE_BUGREPORT}") set (CPACK_NSIS_MODIFY_PATH ON) elseif (APPLE) - LIST (APPEND CPACK_GENERATOR "DragNDrop") + list (APPEND CPACK_GENERATOR "DragNDrop") set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") - set (CPACK_PACKAGE_ICON "${HDF5_RESOURCES_DIR}/hdf.icns") - + set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns") + if (HDF5_PACK_MACOSX_BUNDLE) - LIST (APPEND CPACK_GENERATOR "Bundle") + list (APPEND CPACK_GENERATOR "Bundle") set (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}") set (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / set (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") - set (CPACK_BUNDLE_ICON "${HDF5_RESOURCES_DIR}/hdf.icns") + set (CPACK_BUNDLE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns") set (CPACK_BUNDLE_PLIST "${HDF5_BINARY_DIR}/CMakeFiles/Info.plist") set (CPACK_APPLE_GUI_INFO_STRING "HDF5 (Hierarchical Data Format 5) Software Library and Utilities") set (CPACK_APPLE_GUI_COPYRIGHT "Copyright © 2006-2014 by The HDF Group. All rights reserved.") @@ -344,15 +300,15 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) # Configure the Info.plist file for the install bundle #----------------------------------------------------------------------------- configure_file ( - ${HDF5_RESOURCES_DIR}/CPack.Info.plist.in + ${HDF_RESOURCES_EXT_DIR}/CPack.Info.plist.in ${HDF5_BINARY_DIR}/CMakeFiles/Info.plist @ONLY ) configure_file ( - ${HDF5_RESOURCES_DIR}/PkgInfo.in + ${HDF_RESOURCES_DIR}/PkgInfo.in ${HDF5_BINARY_DIR}/CMakeFiles/PkgInfo @ONLY ) configure_file ( - ${HDF5_RESOURCES_DIR}/version.plist.in + ${HDF_RESOURCES_EXT_DIR}/version.plist.in ${HDF5_BINARY_DIR}/CMakeFiles/version.plist @ONLY ) install ( @@ -360,16 +316,16 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) ${HDF5_BINARY_DIR}/CMakeFiles/version.plist DESTINATION .. ) - ENDIF(HDF5_PACK_MACOSX_BUNDLE) + endif (HDF5_PACK_MACOSX_BUNDLE) else (WIN32) - LIST (APPEND CPACK_GENERATOR "STGZ") + list (APPEND CPACK_GENERATOR "STGZ") set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) set (CPACK_DEBIAN_PACKAGE_SECTION "Libraries") set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${HDF5_PACKAGE_BUGREPORT}") -# LIST (APPEND CPACK_GENERATOR "RPM") +# list (APPEND CPACK_GENERATOR "RPM") set (CPACK_RPM_PACKAGE_RELEASE "1") set (CPACK_RPM_COMPONENT_INSTALL ON) set (CPACK_RPM_PACKAGE_RELOCATABLE ON) @@ -404,8 +360,8 @@ The HDF5 data model, file format, API, library, and tools are open and distribut # By default, do not warn when built on machines using only VS Express: if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) - ENDIF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) - INCLUDE(InstallRequiredSystemLibraries) + endif (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) + include (InstallRequiredSystemLibraries) set (CPACK_INSTALL_CMAKE_PROJECTS "${HDF5_BINARY_DIR};HDF5;ALL;/") diff --git a/CMakeLists.txt b/CMakeLists.txt index ea6f945..dd0ae5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,8 @@ set (HDF5_HL_F90_C_LIB_TARGET ${HDF5_HL_F90_C_LIB_CORENAME}) #----------------------------------------------------------------------------- # Define some CMake variables for use later in the project #----------------------------------------------------------------------------- -set (HDF5_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake) +set (HDF_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake) +set (HDF_RESOURCES_EXT_DIR ${HDF5_SOURCE_DIR}/config/cmake_ext_mod) set (HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/src) set (HDF5_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/test) set (HDF5_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/c++) @@ -215,9 +216,9 @@ set (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") #----------------------------------------------------------------------------- # Include some macros for reusable code #----------------------------------------------------------------------------- -include (${HDF5_RESOURCES_DIR}/HDFMacros.cmake) -include (${HDF5_RESOURCES_DIR}/HDFLibMacros.cmake) -include (${HDF5_RESOURCES_DIR}/HDF5Macros.cmake) +include (${HDF_RESOURCES_EXT_DIR}/HDFMacros.cmake) +include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake) +include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake) #----------------------------------------------------------------------------- # Setup output Directories @@ -264,7 +265,7 @@ set (EXTERNAL_LIBRARYDLL_LIST "") #----------------------------------------------------------------------------- # Run all the CMake configuration tests for our build environment #----------------------------------------------------------------------------- -include (${HDF5_RESOURCES_DIR}/ConfigureChecks.cmake) +include (${HDF_RESOURCES_DIR}/ConfigureChecks.cmake) set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) @@ -632,7 +633,7 @@ INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR} ${CMAKE_RUNTIME_OUTPUT_D #----------------------------------------------------------------------------- # Option to Enable MPI Parallel #----------------------------------------------------------------------------- -set (CMAKE_MODULE_PATH ${HDF5_RESOURCES_DIR} ${CMAKE_MODULE_PATH}) +set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH}) option (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF) if (HDF5_ENABLE_PARALLEL) include (FindMPI) @@ -793,7 +794,7 @@ if (BUILD_TESTING) endif (HDF5_TEST_VFD) include (${HDF5_SOURCE_DIR}/CTestConfig.cmake) - configure_file (${HDF5_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY) + configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY) endif (BUILD_TESTING) #----------------------------------------------------------------------------- @@ -811,7 +812,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for message (FATAL_ERROR " **** Shared FORTRAN libraries are unsupported **** ") endif (BUILD_SHARED_LIBS AND APPLE) option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" OFF) - include (${HDF5_RESOURCES_DIR}/HDF5UseFortran.cmake) + include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) if (HDF5_ENABLE_F2003) if (NOT FORTRAN_HAVE_ISO_C_BINDING) set (HDF5_ENABLE_F2003 OFF) @@ -884,6 +885,6 @@ endif (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") #----------------------------------------------------------------------------- # Generate the H5pubconf.h file containing user settings needed by compilation #----------------------------------------------------------------------------- -configure_file (${HDF5_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY) +configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY) include (CMakeInstallation.cmake) @@ -2548,42 +2548,45 @@ ./vms/tools/testfiles/tperror.ddl # CMake-specific Files -./config/cmake/FindSZIP.cmake +./config/cmake/cacheinit.cmake ./config/cmake/ConversionTests.c -./config/cmake/GetTimeOfDayTest.cpp -./config/cmake/HDF5CXXTests.cpp -./config/cmake/HDF5Tests.c -./config/cmake/CheckTypeSize.cmake +./config/cmake/ConfigureChecks.cmake +./config/cmake/CTestCustom.cmake +./config/cmake/FindHDF5.cmake.in ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in -./config/cmake/FindHDF5.cmake.in -./config/cmake/FindMPI.cmake ./config/cmake/hdf5-config.cmake.build.in ./config/cmake/hdf5-config.cmake.install.in ./config/cmake/hdf5-config-version.cmake.in -./config/cmake/HDFMacros.cmake -./config/cmake/HDFLibMacros.cmake ./config/cmake/HDF5Macros.cmake -./config/cmake/HDF5UseFortran.cmake ./config/cmake/libhdf5.settings.cmake.in -./config/cmake/cacheinit.cmake ./config/cmake/mccacheinit.cmake -./config/cmake/grepTest.cmake -./config/cmake/prunTest.cmake -./config/cmake/runTest.cmake -./config/cmake/userblockTest.cmake -./config/cmake/vfdTest.cmake -./config/cmake/CTestCustom.cmake -./config/cmake/ConfigureChecks.cmake -./config/cmake/CPack.Info.plist.in -./config/cmake/hdf.bmp -./config/cmake/hdf.icns -./config/cmake/hdf.ico ./config/cmake/PkgInfo.in -./config/cmake/version.plist.in -./config/cmake/NSIS.template.in -./config/cmake/NSIS.InstallOptions.ini.in ./config/cmake/README.txt.cmake.in +./config/cmake/userblockTest.cmake +./config/cmake/vfdTest.cmake + +./config/cmake_ext_mod/CheckTypeSize.cmake +./config/cmake_ext_mod/ConfigureChecks.cmake +./config/cmake_ext_mod/CPack.Info.plist.in +./config/cmake_ext_mod/CTestCustom.cmake +./config/cmake_ext_mod/FindMPI.cmake +./config/cmake_ext_mod/FindSZIP.cmake +./config/cmake_ext_mod/GetTimeOfDayTest.cpp +./config/cmake_ext_mod/grepTest.cmake +./config/cmake_ext_mod/hdf.bmp +./config/cmake_ext_mod/hdf.icns +./config/cmake_ext_mod/hdf.ico +./config/cmake_ext_mod/HDFCXXTests.cpp +./config/cmake_ext_mod/HDFLibMacros.cmake +./config/cmake_ext_mod/HDFMacros.cmake +./config/cmake_ext_mod/HDFTests.c +./config/cmake_ext_mod/HDFUseFortran.cmake +./config/cmake_ext_mod/NSIS.InstallOptions.ini.in +./config/cmake_ext_mod/NSIS.template.in +./config/cmake_ext_mod/prunTest.cmake +./config/cmake_ext_mod/runTest.cmake +./config/cmake_ext_mod/version.plist.in # CMake-specific User Files ./config/cmake/UserMacros/Windows_MT.cmake @@ -1,4 +1,4 @@ -HDF5 version 1.9.178-swmr0 currently under development +HDF5 version 1.9.184-swmr0 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/bin/reconfigure b/bin/reconfigure index 570f06e..f2f1f23 100755 --- a/bin/reconfigure +++ b/bin/reconfigure @@ -33,7 +33,7 @@ AUTOMAKE_VERSION="automake (GNU automake) 1.14.1" AUTOHEADER_VERSION="autoheader (GNU Autoconf) 2.69" ACLOCAL_VERSION="aclocal (GNU automake) 1.14.1" LIBTOOL_VERSION="(GNU libtool) 2.4.2" -M4_VERSION="m4 (GNU M4) 1.4.16" +M4_VERSION="m4 (GNU M4) 1.4.17" # # When upgrading automake's version, don't forget to also update its @@ -61,7 +61,7 @@ if test -z ${LIBTOOL}; then LIBTOOL=/mnt/hdf/packages/libtool/libtool-2.4.2/bin/libtool fi if test -z ${M4}; then - M4=/mnt/hdf/packages/m4/m4-1.4.16/bin/m4 + M4=/mnt/hdf/packages/m4/m4-1.4.17/bin/m4 fi # Check version numbers of all autotools against the "correct" versions diff --git a/bin/release b/bin/release index fd04279..68745ec 100755 --- a/bin/release +++ b/bin/release @@ -42,12 +42,13 @@ USAGE() cat << EOF Usage: $0 [--nocheck] [-d <dir>] [-h] <methods> ... -d DIR The name of the directory where the releas(es) should be - placed. By default, the directory is ./releases + placed. --nocheck Ignore errors in MANIFEST file. --private Make a private release with today's date in version information. +This must be run at the top level of the source directory. The other command-line options are the names of the programs to use for compressing the resulting tar archive (if none are given then "tar md5" is assumed): @@ -61,19 +62,21 @@ for compressing the resulting tar archive (if none are given then Examples: - $ release - releases/hdf5-1.0.38.tar - releases/hdf5-1.0.38.tar.md5 + $ bin/release -d /tmp + /tmp/hdf5-1.8.13-RELEASE.txt + /tmp/hdf5-1.8.13.tar + /tmp/hdf5-1.8.13.tar.md5 - $ release gzip - releases/hdf5-1.0.38.tar.gz + $ bin/release -d /tmp gzip + /tmp/hdf5-1.8.13-RELEASE.txt + /tmp/hdf5-1.8.13.tar.gz - $ release -d /tmp tar gzip zip md5 - /tmp/hdf5-1.0.38.tar - /tmp/hdf5-1.0.38.tar.Z - /tmp/hdf5-1.0.38.tar.gz - /tmp/hdf5-1.0.38.tar.bz2 - /tmp/hdf5-1.0.38.tar.md5 + $ bin/release -d /tmp tar gzip zip md5 + /tmp/hdf5-1.8.13-RELEASE.txt + /tmp/hdf5-1.8.13.tar + /tmp/hdf5-1.8.13.tar.gz + /tmp/hdf5-1.8.13.tar.md5 + /tmp/hdf5-1.8.13.tar.zip EOF @@ -107,19 +110,19 @@ tar2zip() echo "usage: tar2zip <tarfilename> <zipfilename>" return 1 fi - tmpdir=/tmp/tmpdir$$ - mkdir -p $tmpdir + ztmpdir=/tmp/tmpdir$$ + mkdir -p $ztmpdir version=$1 tarfile=$2 zipfile=$3 - # step 1: untar tarball in tmpdir - (cd $tmpdir; tar xf -) < $tarfile + # step 1: untar tarball in ztmpdir + (cd $ztmpdir; tar xf -) < $tarfile # sanity check - if [ ! -d $tmpdir/$version ]; then - echo "untar did not create $tmp/$version source dir" + if [ ! -d $ztmpdir/$version ]; then + echo "untar did not create $ztmpdir/$version source dir" # cleanup - rm -rf $tmpdir + rm -rf $ztmpdir return 1 fi # step 2: convert text files @@ -128,7 +131,7 @@ tar2zip() # -k Keep the date stamp # -q quiet mode # grep redirect output to /dev/null because -q or -s are not portable. - find $tmpdir/$version | \ + find $ztmpdir/$version | \ while read inf; do \ if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ unix2dos -q -k $inf; \ @@ -139,11 +142,11 @@ tar2zip() # -y Store symbolic links as such in the zip archive # -r recursive # -q quiet - (cd $tmpdir; zip -9 -y -r -q $version.zip $version) - mv $tmpdir/$version.zip $zipfile + (cd $ztmpdir; zip -9 -y -r -q $version.zip $version) + mv $ztmpdir/$version.zip $zipfile # cleanup - rm -rf $tmpdir + rm -rf $ztmpdir } # This command must be run at the top level of the hdf5 source directory. diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 89426c5..63fc083 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_CPP) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Shared/Static Libs @@ -18,7 +18,7 @@ endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Generate configure file #----------------------------------------------------------------------------- -configure_file (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in +configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in ${HDF5_BINARY_DIR}/H5cxx_pubconf.h ) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 7a48260..b07ab2b 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -11,7 +11,7 @@ endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Generate configure file #----------------------------------------------------------------------------- -configure_file (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in +configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in ${HDF5_BINARY_DIR}/H5cxx_pubconf.h ) diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index ce35fde..639b633 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -74,7 +74,7 @@ class H5_DLLCPP Exception { // Prints the error stack in a default manner. static void printErrorStack(FILE* stream = stderr, hid_t err_stack = H5E_DEFAULT); // Static - void printError(FILE* stream = NULL) const; + virtual void printError(FILE* stream = NULL) const; // Default constructor Exception(); diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 6ee76e5..ab95efe 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -682,7 +682,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 168 +LT_VERS_REVISION = 174 LT_VERS_AGE = 0 # This is our main target diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index ea10b04..f2caed2 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -58,7 +58,7 @@ PROJECT_LOGO = ./header_files/hdf_logo.jpg # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = HTML +OUTPUT_DIRECTORY = cpplus_RM # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -1069,7 +1069,7 @@ GENERATE_HTML = YES # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_OUTPUT = HTML +HTML_OUTPUT = . # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index 147972f..1048ee7 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -57,7 +57,7 @@ if (HDF5_TEST_VFD) -D "TEST_EXPECT=${resultcode}" -D "TEST_OUTPUT=cpp_testhdf5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) diff --git a/config/cmake/CPack.Info.plist.in b/config/cmake/CPack.Info.plist.in deleted file mode 100644 index 6cf2a94..0000000 --- a/config/cmake/CPack.Info.plist.in +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>@CPACK_PACKAGE_FILE_NAME@</string> - <key>CFBundleIconFile</key> - <string>@CPACK_BUNDLE_ICON@</string> - <key>CFBundleIdentifier</key> - <string>org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundlePackageType</key> - <string>FMWK</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>@CPACK_PACKAGE_VERSIO@</string> - <key>CFBundleShortVersionString</key> - <string>@CPACK_SHORT_VERSION_STRING@</string> - <key>CSResourcesFileMapped</key> - <true/> - <key>CFBundleName</key> - <string>@CPACK_BUNDLE_NAME@</string> - <key>CFBundleGetInfoString</key> - <string>@CPACK_APPLE_GUI_INFO_STRING@</string> - <key>NSHumanReadableCopyright</key> - <string>@CPACK_APPLE_GUI_COPYRIGHT@</string> -</dict> -</plist> diff --git a/config/cmake/CheckTypeSize.cmake b/config/cmake/CheckTypeSize.cmake deleted file mode 100644 index 4af5741..0000000 --- a/config/cmake/CheckTypeSize.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# -# Check if the type exists and determine size of type. if the type -# exists, the size will be stored to the variable. -# -# CHECK_TYPE_SIZE - macro which checks the size of type -# VARIABLE - variable to store size if the type exists. -# HAVE_${VARIABLE} - does the variable exists or not -# - -MACRO (HDF_CHECK_TYPE_SIZE TYPE VARIABLE) - set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) - if ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") - set (MACRO_CHECK_TYPE_SIZE_FLAGS - "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}" - ) - foreach (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H) - if ("${def}") - set (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") - ENDIF("${def}") - endforeach (def) - - message (STATUS "Check size of ${TYPE}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_TYPE_SIZE_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" - ) - endif (CMAKE_REQUIRED_LIBRARIES) - TRY_RUN (${VARIABLE} HAVE_${VARIABLE} - ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/CheckTypeSize.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} - "${CHECK_TYPE_SIZE_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if (HAVE_${VARIABLE}) - message (STATUS "Check size of ${TYPE} - done") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log - "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n" - ) - else (HAVE_${VARIABLE}) - message (STATUS "Check size of ${TYPE} - failed") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n" - ) - endif (HAVE_${VARIABLE}) - endif ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") - set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS) -ENDMACRO (HDF_CHECK_TYPE_SIZE) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 9816755..360d5b0 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -1,44 +1,11 @@ #----------------------------------------------------------------------------- # Include all the necessary files for macros #----------------------------------------------------------------------------- -include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) -include (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake) -include (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake) -include (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) -include (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake) -include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) -include (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake) -include (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) -include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) +set (HDF_PREFIX "H5") +include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) #----------------------------------------------------------------------------- -# APPLE/Darwin setup -#----------------------------------------------------------------------------- -if (APPLE) - list (LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH) - if (ARCH_LENGTH GREATER 1) - set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE) - message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" - "due to technical reasons. The best approach would be build each architecture in separate directories" - "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'" - "variable has been set to a blank value which will build the default architecture for this system.") - endif () - set (H5_AC_APPLE_UNIVERSAL_BUILD 0) -endif (APPLE) - -# Check for Darwin (not just Apple - we also want to catch OpenDarwin) -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set (H5_HAVE_DARWIN 1) -endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - -# Check for Solaris -if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (H5_HAVE_SOLARIS 1) -endif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - -#----------------------------------------------------------------------------- # Option to Clear File Buffers before write --enable-clear-file-buffers #----------------------------------------------------------------------------- option (HDF5_Enable_Clear_File_Buffers "Securely clear file buffers before writing to file" ON) @@ -98,7 +65,13 @@ if (HDF5_ENABLE_CODESTACK) endif (HDF5_ENABLE_CODESTACK) MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK) +#----------------------------------------------------------------------------- +# Are we going to use HSIZE_T +#----------------------------------------------------------------------------- option (HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON) +if (HDF5_ENABLE_HSIZET) + set (${HDF_PREFIX}_HAVE_LARGE_HSIZET 1) +endif (HDF5_ENABLE_HSIZET) # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can handle converting @@ -110,40 +83,6 @@ option (HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON) # so far we have no check for this set (H5_HAVE_TMPFILE 1) -#----------------------------------------------------------------------------- -# This MACRO checks IF the symbol exists in the library and IF it -# does, it appends library to the list. -#----------------------------------------------------------------------------- -set (LINK_LIBS "") -MACRO (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) - CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE}) - if (${VARIABLE}) - set (LINK_LIBS ${LINK_LIBS} ${LIBRARY}) - endif (${VARIABLE}) -ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT) - -# ---------------------------------------------------------------------- -# WINDOWS Hard code Values -# ---------------------------------------------------------------------- - -set (WINDOWS) -if (WIN32) - if (MINGW) - set (H5_HAVE_MINGW 1) - set (WINDOWS 1) # MinGW tries to imitate Windows - set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") - endif (MINGW) - set (H5_HAVE_WIN32_API 1) - set (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") - if (NOT UNIX AND NOT CYGWIN AND NOT MINGW) - set (WINDOWS 1) - set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") - if (MSVC) - set (H5_HAVE_VISUAL_STUDIO 1) - endif (MSVC) - endif (NOT UNIX AND NOT CYGWIN AND NOT MINGW) -endif (WIN32) - # TODO -------------------------------------------------------------------------- # Should the Default Virtual File Driver be compiled? # This is hard-coded now but option should added to match configure @@ -168,30 +107,6 @@ if (WINDOWS) endif (WINDOWS) if (WINDOWS) - set (H5_HAVE_STDDEF_H 1) - set (H5_HAVE_SYS_STAT_H 1) - set (H5_HAVE_SYS_TYPES_H 1) - set (H5_HAVE_LIBM 1) - set (H5_HAVE_STRDUP 1) - set (H5_HAVE_SYSTEM 1) - set (H5_HAVE_LONGJMP 1) - if (NOT MINGW) - set (H5_HAVE_GETHOSTNAME 1) - endif (NOT MINGW) - if (NOT UNIX AND NOT CYGWIN AND NOT MINGW) - set (H5_HAVE_GETCONSOLESCREENBUFFERINFO 1) - endif (NOT UNIX AND NOT CYGWIN AND NOT MINGW) - set (H5_HAVE_FUNCTION 1) - set (H5_GETTIMEOFDAY_GIVES_TZ 1) - set (H5_HAVE_TIMEZONE 1) - set (H5_HAVE_GETTIMEOFDAY 1) - set (H5_LONE_COLON 0) - if (MINGW) - set (H5_HAVE_WINSOCK2_H 1) - endif (MINGW) - set (H5_HAVE_LIBWS2_32 1) - set (H5_HAVE_LIBWSOCK32 1) - #----------------------------------------------------------------------------- # These tests need to be manually SET for windows since there is currently # something not quite correct with the actual test implementation. This affects @@ -204,97 +119,6 @@ endif (WINDOWS) # END of WINDOWS Hard code Values # ---------------------------------------------------------------------- -if (CYGWIN) - set (H5_HAVE_LSEEK64 0) -endif (CYGWIN) - -#----------------------------------------------------------------------------- -# Check for the math library "m" -#----------------------------------------------------------------------------- -if (NOT WINDOWS) - CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil H5_HAVE_LIBM) - CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen H5_HAVE_LIBDL) - CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup H5_HAVE_LIBWS2_32) - CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname H5_HAVE_LIBWSOCK32) -endif (NOT WINDOWS) - -CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname H5_HAVE_LIBUCB) -CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect H5_HAVE_LIBSOCKET) -CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL) - -if (NOT NOT_NEED_LIBNSL) - CHECK_LIBRARY_EXISTS_CONCAT ("nsl" gethostbyname H5_HAVE_LIBNSL) -endif (NOT NOT_NEED_LIBNSL) - -# For other tests to use the same libraries -set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS}) - -set (USE_INCLUDES "") -if (WINDOWS) - set (USE_INCLUDES ${USE_INCLUDES} "windows.h") -endif (WINDOWS) - -if (NOT WINDOWS) - TEST_BIG_ENDIAN (H5_WORDS_BIGENDIAN) -endif (NOT WINDOWS) - -# For other specific tests, use this MACRO. -MACRO (HDF5_FUNCTION_TEST OTHER_TEST) - if ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (CMAKE_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif (CMAKE_REQUIRED_LIBRARIES) - - foreach (def ${HDF5_EXTRA_TEST_DEFINITIONS}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}") - endforeach (def) - - foreach (def - HAVE_SYS_TIME_H - HAVE_UNISTD_H - HAVE_SYS_TYPES_H - HAVE_SYS_SOCKET_H - ) - if ("${H5_${def}}") - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif ("${H5_${def}}") - endforeach (def) - - if (LARGEFILE) - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif (LARGEFILE) - - #message (STATUS "Performing ${OTHER_TEST}") - TRY_COMPILE (${OTHER_TEST} - ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/HDF5Tests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if (${OTHER_TEST}) - set (H5_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") - message (STATUS "Performing Other Test ${OTHER_TEST} - Success") - else (${OTHER_TEST}) - message (STATUS "Performing Other Test ${OTHER_TEST} - Failed") - set (H5_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Performing Other Test ${OTHER_TEST} failed with the following output:\n" - "${OUTPUT}\n" - ) - endif (${OTHER_TEST}) - endif ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") -ENDMACRO (HDF5_FUNCTION_TEST) - -#----------------------------------------------------------------------------- -# Check for these functions before the time headers are checked -#----------------------------------------------------------------------------- -HDF5_FUNCTION_TEST (STDC_HEADERS) - CHECK_FUNCTION_EXISTS (difftime H5_HAVE_DIFFTIME) #CHECK_FUNCTION_EXISTS (gettimeofday H5_HAVE_GETTIMEOFDAY) # Since gettimeofday is not defined any where standard, lets look in all the @@ -303,7 +127,7 @@ if (NOT MSVC) if ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") TRY_COMPILE (HAVE_TIME_GETTIMEOFDAY ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp + ${HDF_RESOURCES_EXT_DIR}/GetTimeOfDayTest.cpp COMPILE_DEFINITIONS -DTRY_TIME_H OUTPUT_VARIABLE OUTPUT ) @@ -316,7 +140,7 @@ if (NOT MSVC) if ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") TRY_COMPILE (HAVE_SYS_TIME_GETTIMEOFDAY ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp + ${HDF_RESOURCES_EXT_DIR}/GetTimeOfDayTest.cpp COMPILE_DEFINITIONS -DTRY_SYS_TIME_H OUTPUT_VARIABLE OUTPUT ) @@ -354,426 +178,6 @@ endif (NOT WINDOWS) #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- -# Check IF header file exists and add it to the list. -#----------------------------------------------------------------------------- -MACRO (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) - CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) - if (${VARIABLE}) - set (USE_INCLUDES ${USE_INCLUDES} ${FILE}) - endif (${VARIABLE}) -ENDMACRO (CHECK_INCLUDE_FILE_CONCAT) - -#----------------------------------------------------------------------------- -# Check for the existence of certain header files -#----------------------------------------------------------------------------- -CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" H5_HAVE_SYS_RESOURCE_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" H5_HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("unistd.h" H5_HAVE_UNISTD_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" H5_HAVE_SYS_IOCTL_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" H5_HAVE_SYS_STAT_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" H5_HAVE_SYS_SOCKET_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" H5_HAVE_SYS_TYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("stddef.h" H5_HAVE_STDDEF_H) -CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" H5_HAVE_SETJMP_H) -CHECK_INCLUDE_FILE_CONCAT ("features.h" H5_HAVE_FEATURES_H) -CHECK_INCLUDE_FILE_CONCAT ("dirent.h" H5_HAVE_DIRENT_H) -CHECK_INCLUDE_FILE_CONCAT ("stdint.h" H5_HAVE_STDINT_H) - -# IF the c compiler found stdint, check the C++ as well. On some systems this -# file will be found by C but not C++, only do this test IF the C++ compiler -# has been initialized (e.g. the project also includes some c++) -if (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) - CHECK_INCLUDE_FILE_CXX ("stdint.h" H5_HAVE_STDINT_H_CXX) - if (NOT H5_HAVE_STDINT_H_CXX) - set (H5_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") - set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") - endif (NOT H5_HAVE_STDINT_H_CXX) -endif (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) - -# Darwin -CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" H5_HAVE_MACH_MACH_TIME_H) - -# Windows -CHECK_INCLUDE_FILE_CONCAT ("io.h" H5_HAVE_IO_H) -if (NOT CYGWIN) - CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" H5_HAVE_WINSOCK2_H) -endif (NOT CYGWIN) -CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" H5_HAVE_SYS_TIMEB_H) - -if (CMAKE_SYSTEM_NAME MATCHES "OSF") - CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" H5_HAVE_SYS_SYSINFO_H) - CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" H5_HAVE_SYS_PROC_H) -else (CMAKE_SYSTEM_NAME MATCHES "OSF") - set (H5_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) - set (H5_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) -endif (CMAKE_SYSTEM_NAME MATCHES "OSF") - -CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" H5_HAVE_GLOBUS_COMMON_H) -CHECK_INCLUDE_FILE_CONCAT ("pdb.h" H5_HAVE_PDB_H) -CHECK_INCLUDE_FILE_CONCAT ("pthread.h" H5_HAVE_PTHREAD_H) -CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" H5_HAVE_SRBCLIENT_H) -CHECK_INCLUDE_FILE_CONCAT ("string.h" H5_HAVE_STRING_H) -CHECK_INCLUDE_FILE_CONCAT ("strings.h" H5_HAVE_STRINGS_H) -CHECK_INCLUDE_FILE_CONCAT ("time.h" H5_HAVE_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" H5_HAVE_STDLIB_H) -CHECK_INCLUDE_FILE_CONCAT ("memory.h" H5_HAVE_MEMORY_H) -CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" H5_HAVE_DLFCN_H) -CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" H5_HAVE_INTTYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" H5_HAVE_NETINET_IN_H) - -#----------------------------------------------------------------------------- -# Check for large file support -#----------------------------------------------------------------------------- - -# The linux-lfs option is deprecated. -set (LINUX_LFS 0) - -set (HDF5_EXTRA_C_FLAGS) -set (HDF5_EXTRA_FLAGS) -if (NOT WINDOWS) - if (NOT H5_HAVE_SOLARIS) - # Linux Specific flags - # This was originally defined as _POSIX_SOURCE which was updated to - # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX - # functionality so clock_gettime and CLOCK_MONOTONIC are defined - # correctly. - # POSIX feature information can be found in the gcc manual at: - # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - set (HDF5_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=199506L) - set (HDF5_EXTRA_FLAGS -D_BSD_SOURCE) - - option (HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) - if (HDF5_ENABLE_LARGE_FILE) - set (msg "Performing TEST_LFS_WORKS") - TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE - ${HDF5_BINARY_DIR}/CMake - ${HDF5_RESOURCES_DIR}/HDF5Tests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS - OUTPUT_VARIABLE OUTPUT - ) - if (TEST_LFS_WORKS_COMPILE) - if (TEST_LFS_WORKS_RUN MATCHES 0) - set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) - set (LARGEFILE 1) - set (HDF5_EXTRA_FLAGS ${HDF5_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) - message (STATUS "${msg}... yes") - else (TEST_LFS_WORKS_RUN MATCHES 0) - set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) - message (STATUS "${msg}... no") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" - ) - endif (TEST_LFS_WORKS_RUN MATCHES 0) - else (TEST_LFS_WORKS_COMPILE ) - set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) - message (STATUS "${msg}... no") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n" - ) - endif (TEST_LFS_WORKS_COMPILE) - endif (HDF5_ENABLE_LARGE_FILE) - set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF5_EXTRA_FLAGS}) - endif (NOT H5_HAVE_SOLARIS) -endif (NOT WINDOWS) - -add_definitions (${HDF5_EXTRA_FLAGS}) - -#----------------------------------------------------------------------------- -# Check for HAVE_OFF64_T functionality -#----------------------------------------------------------------------------- -if (NOT WINDOWS OR MINGW) - HDF5_FUNCTION_TEST (HAVE_OFF64_T) - if (H5_HAVE_OFF64_T) - CHECK_FUNCTION_EXISTS (lseek64 H5_HAVE_LSEEK64) - CHECK_FUNCTION_EXISTS (fseeko64 H5_HAVE_FSEEKO64) - CHECK_FUNCTION_EXISTS (ftello64 H5_HAVE_FTELLO64) - CHECK_FUNCTION_EXISTS (ftruncate64 H5_HAVE_FTRUNCATE64) - endif (H5_HAVE_OFF64_T) - - CHECK_FUNCTION_EXISTS (fseeko H5_HAVE_FSEEKO) - CHECK_FUNCTION_EXISTS (ftello H5_HAVE_FTELLO) - - HDF5_FUNCTION_TEST (HAVE_STAT64_STRUCT) - if (HAVE_STAT64_STRUCT) - CHECK_FUNCTION_EXISTS (fstat64 H5_HAVE_FSTAT64) - CHECK_FUNCTION_EXISTS (stat64 H5_HAVE_STAT64) - endif (HAVE_STAT64_STRUCT) -endif (NOT WINDOWS OR MINGW) - -#----------------------------------------------------------------------------- -# Check the size in bytes of all the int and float types -#----------------------------------------------------------------------------- -MACRO (H5_CHECK_TYPE_SIZE type var) - set (aType ${type}) - set (aVar ${var}) -# message (STATUS "Checking size of ${aType} and storing into ${aVar}") - CHECK_TYPE_SIZE (${aType} ${aVar}) - if (NOT ${aVar}) - set (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}") -# message (STATUS "Size of ${aType} was NOT Found") - endif (NOT ${aVar}) -ENDMACRO (H5_CHECK_TYPE_SIZE) - -H5_CHECK_TYPE_SIZE (char H5_SIZEOF_CHAR) -H5_CHECK_TYPE_SIZE (short H5_SIZEOF_SHORT) -H5_CHECK_TYPE_SIZE (int H5_SIZEOF_INT) -H5_CHECK_TYPE_SIZE (unsigned H5_SIZEOF_UNSIGNED) -if (NOT APPLE) - H5_CHECK_TYPE_SIZE (long H5_SIZEOF_LONG) -endif (NOT APPLE) -H5_CHECK_TYPE_SIZE ("long long" H5_SIZEOF_LONG_LONG) -H5_CHECK_TYPE_SIZE (__int64 H5_SIZEOF___INT64) -if (NOT H5_SIZEOF___INT64) - set (H5_SIZEOF___INT64 0) -endif (NOT H5_SIZEOF___INT64) - -H5_CHECK_TYPE_SIZE (float H5_SIZEOF_FLOAT) -H5_CHECK_TYPE_SIZE (double H5_SIZEOF_DOUBLE) -H5_CHECK_TYPE_SIZE ("long double" H5_SIZEOF_LONG_DOUBLE) - -H5_CHECK_TYPE_SIZE (int8_t H5_SIZEOF_INT8_T) -H5_CHECK_TYPE_SIZE (uint8_t H5_SIZEOF_UINT8_T) -H5_CHECK_TYPE_SIZE (int_least8_t H5_SIZEOF_INT_LEAST8_T) -H5_CHECK_TYPE_SIZE (uint_least8_t H5_SIZEOF_UINT_LEAST8_T) -H5_CHECK_TYPE_SIZE (int_fast8_t H5_SIZEOF_INT_FAST8_T) -H5_CHECK_TYPE_SIZE (uint_fast8_t H5_SIZEOF_UINT_FAST8_T) - -H5_CHECK_TYPE_SIZE (int16_t H5_SIZEOF_INT16_T) -H5_CHECK_TYPE_SIZE (uint16_t H5_SIZEOF_UINT16_T) -H5_CHECK_TYPE_SIZE (int_least16_t H5_SIZEOF_INT_LEAST16_T) -H5_CHECK_TYPE_SIZE (uint_least16_t H5_SIZEOF_UINT_LEAST16_T) -H5_CHECK_TYPE_SIZE (int_fast16_t H5_SIZEOF_INT_FAST16_T) -H5_CHECK_TYPE_SIZE (uint_fast16_t H5_SIZEOF_UINT_FAST16_T) - -H5_CHECK_TYPE_SIZE (int32_t H5_SIZEOF_INT32_T) -H5_CHECK_TYPE_SIZE (uint32_t H5_SIZEOF_UINT32_T) -H5_CHECK_TYPE_SIZE (int_least32_t H5_SIZEOF_INT_LEAST32_T) -H5_CHECK_TYPE_SIZE (uint_least32_t H5_SIZEOF_UINT_LEAST32_T) -H5_CHECK_TYPE_SIZE (int_fast32_t H5_SIZEOF_INT_FAST32_T) -H5_CHECK_TYPE_SIZE (uint_fast32_t H5_SIZEOF_UINT_FAST32_T) - -H5_CHECK_TYPE_SIZE (int64_t H5_SIZEOF_INT64_T) -H5_CHECK_TYPE_SIZE (uint64_t H5_SIZEOF_UINT64_T) -H5_CHECK_TYPE_SIZE (int_least64_t H5_SIZEOF_INT_LEAST64_T) -H5_CHECK_TYPE_SIZE (uint_least64_t H5_SIZEOF_UINT_LEAST64_T) -H5_CHECK_TYPE_SIZE (int_fast64_t H5_SIZEOF_INT_FAST64_T) -H5_CHECK_TYPE_SIZE (uint_fast64_t H5_SIZEOF_UINT_FAST64_T) - -if (NOT APPLE) - H5_CHECK_TYPE_SIZE (size_t H5_SIZEOF_SIZE_T) - H5_CHECK_TYPE_SIZE (ssize_t H5_SIZEOF_SSIZE_T) - if (NOT H5_SIZEOF_SSIZE_T) - set (H5_SIZEOF_SSIZE_T 0) - endif (NOT H5_SIZEOF_SSIZE_T) - if (NOT WINDOWS) - H5_CHECK_TYPE_SIZE (ptrdiff_t H5_SIZEOF_PTRDIFF_T) - endif (NOT WINDOWS) -endif (NOT APPLE) - -H5_CHECK_TYPE_SIZE (off_t H5_SIZEOF_OFF_T) -H5_CHECK_TYPE_SIZE (off64_t H5_SIZEOF_OFF64_T) -if (NOT H5_SIZEOF_OFF64_T) - set (H5_SIZEOF_OFF64_T 0) -endif (NOT H5_SIZEOF_OFF64_T) - -if (NOT WINDOWS) - #----------------------------------------------------------------------------- - # Check if the dev_t type is a scalar type - #----------------------------------------------------------------------------- - HDF5_FUNCTION_TEST (DEV_T_IS_SCALAR) - - # ---------------------------------------------------------------------- - # Check for MONOTONIC_TIMER support (used in clock_gettime). This has - # to be done after any POSIX/BSD defines to ensure that the test gets - # the correct POSIX level on linux. - CHECK_VARIABLE_EXISTS (CLOCK_MONOTONIC HAVE_CLOCK_MONOTONIC) - - #----------------------------------------------------------------------------- - # Check a bunch of time functions - #----------------------------------------------------------------------------- - foreach (test - HAVE_TM_GMTOFF - HAVE___TM_GMTOFF -# HAVE_TIMEZONE - HAVE_STRUCT_TIMEZONE - GETTIMEOFDAY_GIVES_TZ - TIME_WITH_SYS_TIME - HAVE_TM_ZONE - HAVE_STRUCT_TM_TM_ZONE - ) - HDF5_FUNCTION_TEST (${test}) - endforeach (test) - if (NOT CYGWIN AND NOT MINGW) - HDF5_FUNCTION_TEST (HAVE_TIMEZONE) -# HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) - endif (NOT CYGWIN AND NOT MINGW) - - # ---------------------------------------------------------------------- - # Does the struct stat have the st_blocks field? This field is not Posix. - # - HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) - - # ---------------------------------------------------------------------- - # How do we figure out the width of a tty in characters? - # - CHECK_FUNCTION_EXISTS (ioctl H5_HAVE_IOCTL) - HDF5_FUNCTION_TEST (HAVE_STRUCT_VIDEOCONFIG) - HDF5_FUNCTION_TEST (HAVE_STRUCT_TEXT_INFO) - CHECK_FUNCTION_EXISTS (_getvideoconfig H5_HAVE__GETVIDEOCONFIG) - CHECK_FUNCTION_EXISTS (gettextinfo H5_HAVE_GETTEXTINFO) - CHECK_FUNCTION_EXISTS (_scrsize H5_HAVE__SCRSIZE) - if (NOT CYGWIN AND NOT MINGW) - CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo H5_HAVE_GETCONSOLESCREENBUFFERINFO) - endif (NOT CYGWIN AND NOT MINGW) - CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" H5_HAVE_TIOCGWINSZ) - CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" H5_HAVE_TIOCGETD) -endif (NOT WINDOWS) - -#----------------------------------------------------------------------------- -# Check for some functions that are used -# -CHECK_FUNCTION_EXISTS (alarm H5_HAVE_ALARM) -#CHECK_FUNCTION_EXISTS (BSDgettimeofday H5_HAVE_BSDGETTIMEOFDAY) -CHECK_FUNCTION_EXISTS (fork H5_HAVE_FORK) -CHECK_FUNCTION_EXISTS (frexpf H5_HAVE_FREXPF) -CHECK_FUNCTION_EXISTS (frexpl H5_HAVE_FREXPL) - -CHECK_FUNCTION_EXISTS (gethostname H5_HAVE_GETHOSTNAME) -CHECK_FUNCTION_EXISTS (getpwuid H5_HAVE_GETPWUID) -CHECK_FUNCTION_EXISTS (getrusage H5_HAVE_GETRUSAGE) -CHECK_FUNCTION_EXISTS (lstat H5_HAVE_LSTAT) - -CHECK_FUNCTION_EXISTS (rand_r H5_HAVE_RAND_R) -CHECK_FUNCTION_EXISTS (random H5_HAVE_RANDOM) -CHECK_FUNCTION_EXISTS (setsysinfo H5_HAVE_SETSYSINFO) - -CHECK_FUNCTION_EXISTS (signal H5_HAVE_SIGNAL) -CHECK_FUNCTION_EXISTS (longjmp H5_HAVE_LONGJMP) -CHECK_FUNCTION_EXISTS (setjmp H5_HAVE_SETJMP) -CHECK_FUNCTION_EXISTS (siglongjmp H5_HAVE_SIGLONGJMP) -CHECK_FUNCTION_EXISTS (sigsetjmp H5_HAVE_SIGSETJMP) -CHECK_FUNCTION_EXISTS (sigaction H5_HAVE_SIGACTION) -CHECK_FUNCTION_EXISTS (sigprocmask H5_HAVE_SIGPROCMASK) - -CHECK_FUNCTION_EXISTS (snprintf H5_HAVE_SNPRINTF) -CHECK_FUNCTION_EXISTS (srandom H5_HAVE_SRANDOM) -CHECK_FUNCTION_EXISTS (strdup H5_HAVE_STRDUP) -CHECK_FUNCTION_EXISTS (symlink H5_HAVE_SYMLINK) -CHECK_FUNCTION_EXISTS (system H5_HAVE_SYSTEM) - -CHECK_FUNCTION_EXISTS (tmpfile H5_HAVE_TMPFILE) -CHECK_FUNCTION_EXISTS (vasprintf H5_HAVE_VASPRINTF) -CHECK_FUNCTION_EXISTS (waitpid H5_HAVE_WAITPID) - -CHECK_FUNCTION_EXISTS (vsnprintf H5_HAVE_VSNPRINTF) -if (NOT WINDOWS) - if (H5_HAVE_VSNPRINTF) - HDF5_FUNCTION_TEST (VSNPRINTF_WORKS) - endif (H5_HAVE_VSNPRINTF) -endif (NOT WINDOWS) - -#----------------------------------------------------------------------------- -# sigsetjmp is special; may actually be a macro -#----------------------------------------------------------------------------- -if (NOT H5_HAVE_SIGSETJMP) - if (H5_HAVE_SETJMP_H) - CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" H5_HAVE_MACRO_SIGSETJMP) - if (H5_HAVE_MACRO_SIGSETJMP) - set (H5_HAVE_SIGSETJMP 1) - endif (H5_HAVE_MACRO_SIGSETJMP) - endif (H5_HAVE_SETJMP_H) -endif (NOT H5_HAVE_SIGSETJMP) - -#----------------------------------------------------------------------------- -# Check for Symbols -CHECK_SYMBOL_EXISTS (tzname "time.h" H5_HAVE_DECL_TZNAME) - -#----------------------------------------------------------------------------- -# Check a bunch of other functions -#----------------------------------------------------------------------------- -if (NOT WINDOWS) - foreach (test - LONE_COLON - HAVE_ATTRIBUTE - HAVE_C99_FUNC - HAVE_FUNCTION - HAVE_C99_DESIGNATED_INITIALIZER - SYSTEM_SCOPE_THREADS - HAVE_SOCKLEN_T - CXX_HAVE_OFFSETOF - ) - HDF5_FUNCTION_TEST (${test}) - endforeach (test) -endif (NOT WINDOWS) - -# For other CXX specific tests, use this MACRO. -MACRO (HDF5_CXX_FUNCTION_TEST OTHER_TEST) - if ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (CMAKE_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif (CMAKE_REQUIRED_LIBRARIES) - - foreach (def ${HDF5_EXTRA_TEST_DEFINITIONS}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}") - endforeach (def) - - foreach (def - HAVE_SYS_TIME_H - HAVE_UNISTD_H - HAVE_SYS_TYPES_H - HAVE_SYS_SOCKET_H - ) - if ("${H5_${def}}") - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif ("${H5_${def}}") - endforeach (def) - - if (LARGEFILE) - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif (LARGEFILE) - - #message (STATUS "Performing ${OTHER_TEST}") - TRY_COMPILE (${OTHER_TEST} - ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/HDF5CXXTests.cpp - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if ("${OTHER_TEST}" EQUAL 0) - set (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") - message (STATUS "Performing CXX Test ${OTHER_TEST} - Success") - else ("${OTHER_TEST}" EQUAL 0) - message (STATUS "Performing CXX Test ${OTHER_TEST} - Failed") - set (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" - "${OUTPUT}\n" - ) - endif ("${OTHER_TEST}" EQUAL 0) - endif ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") -ENDMACRO (HDF5_CXX_FUNCTION_TEST) - -#----------------------------------------------------------------------------- -# Check a bunch of cxx functions -#----------------------------------------------------------------------------- -if (CMAKE_CXX_COMPILER_LOADED) - foreach (test - OLD_HEADER_FILENAME - H5_NO_NAMESPACE - H5_NO_STD - BOOL_NOTDEFINED - NO_STATIC_CAST - ) - HDF5_CXX_FUNCTION_TEST (${test}) - endforeach (test) -endif (CMAKE_CXX_COMPILER_LOADED) - -#----------------------------------------------------------------------------- # Check if Direct I/O driver works #----------------------------------------------------------------------------- if (NOT WINDOWS) @@ -782,14 +186,14 @@ if (NOT WINDOWS) set (msg "Performing TEST_DIRECT_VFD_WORKS") set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DTEST_DIRECT_VFD_WORKS -D_GNU_SOURCE ${CMAKE_REQUIRED_FLAGS}") TRY_RUN (TEST_DIRECT_VFD_WORKS_RUN TEST_DIRECT_VFD_WORKS_COMPILE - ${HDF5_BINARY_DIR}/CMake - ${HDF5_RESOURCES_DIR}/HDF5Tests.c + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} OUTPUT_VARIABLE OUTPUT ) if (TEST_DIRECT_VFD_WORKS_COMPILE) if (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) - HDF5_FUNCTION_TEST (HAVE_DIRECT) + HDF_FUNCTION_TEST (HAVE_DIRECT) set (CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") add_definitions ("-D_GNU_SOURCE") else (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) @@ -809,148 +213,6 @@ if (NOT WINDOWS) endif (HDF5_ENABLE_DIRECT_VFD) endif (NOT WINDOWS) -#----------------------------------------------------------------------------- -# Check if InitOnceExecuteOnce is available -#----------------------------------------------------------------------------- -if (WINDOWS) - if (NOT HDF5_NO_IOEO_TEST) - message (STATUS "Checking for InitOnceExecuteOnce:") - if ("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$") - if (LARGEFILE) - set (CMAKE_REQUIRED_DEFINITIONS - "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif (LARGEFILE) - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) - if (CMAKE_REQUIRED_INCLUDES) - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else (CMAKE_REQUIRED_INCLUDES) - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif (CMAKE_REQUIRED_INCLUDES) - - TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED - ${CMAKE_BINARY_DIR} - ${HDF5_RESOURCES_DIR}/HDF5Tests.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) - # if it did not compile make the return value fail code of 1 - if (NOT HAVE_IOEO_COMPILED) - set (HAVE_IOEO_EXITCODE 1) - endif (NOT HAVE_IOEO_COMPILED) - # if the return value was 0 then it worked - if ("${HAVE_IOEO_EXITCODE}" EQUAL 0) - set (H5_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") - message (STATUS "Performing Test InitOnceExecuteOnce - Success") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test InitOnceExecuteOnce succeded with the following output:\n" - "${OUTPUT}\n" - "Return value: ${HAVE_IOEO}\n") - else ("${HAVE_IOEO_EXITCODE}" EQUAL 0) - if (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") - set (H5_HAVE_IOEO "${HAVE_IOEO_EXITCODE}") - else (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") - set (H5_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce") - endif (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") - - message (STATUS "Performing Test InitOnceExecuteOnce - Failed") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing InitOnceExecuteOnce Test failed with the following output:\n" - "${OUTPUT}\n" - "Return value: ${HAVE_IOEO_EXITCODE}\n") - endif ("${HAVE_IOEO_EXITCODE}" EQUAL 0) - endif ("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$") - endif (NOT HDF5_NO_IOEO_TEST) -endif (WINDOWS) - -#----------------------------------------------------------------------------- -# Determine how 'inline' is used -#----------------------------------------------------------------------------- -set (HDF5_EXTRA_TEST_DEFINITIONS INLINE_TEST_INLINE) -foreach (inline_test inline __inline__ __inline) - set (INLINE_TEST_INLINE ${inline_test}) - HDF5_FUNCTION_TEST (INLINE_TEST_${inline_test}) -endforeach (inline_test) - -set (HDF5_EXTRA_TEST_DEFINITIONS) -if (INLINE_TEST___inline__) - set (H5_inline __inline__) -else (INLINE_TEST___inline__) - if (INLINE_TEST___inline) - set (H5_inline __inline) - else (INLINE_TEST___inline) - if (INLINE_TEST_inline) - set (H5_inline inline) - endif (INLINE_TEST_inline) - endif (INLINE_TEST___inline) -endif (INLINE_TEST___inline__) - -#----------------------------------------------------------------------------- -# Check how to print a Long Long integer -#----------------------------------------------------------------------------- -if (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown") - set (PRINT_LL_FOUND 0) - message (STATUS "Checking for appropriate format for 64 bit long:") - foreach (HDF5_PRINTF_LL l64 l L q I64 ll) - set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}") - if (H5_SIZEOF_LONG_LONG) - set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif (H5_SIZEOF_LONG_LONG) - TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE - ${HDF5_BINARY_DIR}/CMake - ${HDF5_RESOURCES_DIR}/HDF5Tests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} - OUTPUT_VARIABLE OUTPUT - ) - if (HDF5_PRINTF_LL_TEST_COMPILE) - if (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - set (H5_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - set (PRINT_LL_FOUND 1) - else (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - message ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}") - endif (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) - else (HDF5_PRINTF_LL_TEST_COMPILE) - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test H5_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n" - ) - endif (HDF5_PRINTF_LL_TEST_COMPILE) - endforeach (HDF5_PRINTF_LL) - - if (PRINT_LL_FOUND) - message (STATUS "Checking for apropriate format for 64 bit long: found ${H5_PRINTF_LL_WIDTH}") - else (PRINT_LL_FOUND) - message (STATUS "Checking for apropriate format for 64 bit long: not found") - set (H5_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL - "Width for printf for type `long long' or `__int64', us. `ll" - ) - endif (PRINT_LL_FOUND) -endif (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown") - -# ---------------------------------------------------------------------- -# Set the flag to indicate that the machine can handle converting -# denormalized floating-point values. -# (This flag should be set for all machines, except for the Crays, where -# the cache value is set in it's config file) -# -set (H5_CONVERT_DENORMAL_FLOAT 1) - -#----------------------------------------------------------------------------- -# Are we going to use HSIZE_T -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_HSIZET) - set (H5_HAVE_LARGE_HSIZET 1) -endif (HDF5_ENABLE_HSIZET) #----------------------------------------------------------------------------- # Macro to determine the various conversion capabilities @@ -959,8 +221,8 @@ MACRO (H5ConversionTests TEST msg) if ("${TEST}" MATCHES "^${TEST}$") # message (STATUS "===> ${TEST}") TRY_RUN (${TEST}_RUN ${TEST}_COMPILE - ${HDF5_BINARY_DIR}/CMake - ${HDF5_RESOURCES_DIR}/ConversionTests.c + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_DIR}/ConversionTests.c CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST OUTPUT_VARIABLE OUTPUT ) diff --git a/config/cmake/FindMPI.cmake b/config/cmake/FindMPI.cmake deleted file mode 100644 index 1b67a30..0000000 --- a/config/cmake/FindMPI.cmake +++ /dev/null @@ -1,647 +0,0 @@ -# - Find a Message Passing Interface (MPI) implementation -# The Message Passing Interface (MPI) is a library used to write -# high-performance distributed-memory parallel applications, and -# is typically deployed on a cluster. MPI is a standard interface -# (defined by the MPI forum) for which many implementations are -# available. All of them have somewhat different include paths, -# libraries to link against, etc., and this module tries to smooth -# out those differences. -# -# === Variables === -# -# This module will set the following variables per language in your project, -# where <lang> is one of C, CXX, or Fortran: -# MPI_<lang>_FOUND TRUE if FindMPI found MPI flags for <lang> -# MPI_<lang>_COMPILER MPI Compiler wrapper for <lang> -# MPI_<lang>_COMPILE_FLAGS Compilation flags for MPI programs -# MPI_<lang>_INCLUDE_PATH Include path(s) for MPI header -# MPI_<lang>_LINK_FLAGS Linking flags for MPI programs -# MPI_<lang>_LIBRARIES All libraries to link MPI programs against -# Additionally, FindMPI sets the following variables for running MPI -# programs from the command line: -# MPIEXEC Executable for running MPI programs -# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving -# it the number of processors to run on -# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly -# before the executable to run. -# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags -# === Usage === -# -# To use this module, simply call FindMPI from a CMakeLists.txt file, or -# run find_package(MPI), then run CMake. If you are happy with the auto- -# detected configuration for your language, then you're done. If not, you -# have two options: -# 1. Set MPI_<lang>_COMPILER to the MPI wrapper (mpicc, etc.) of your -# choice and reconfigure. FindMPI will attempt to determine all the -# necessary variables using THAT compiler's compile and link flags. -# 2. If this fails, or if your MPI implementation does not come with -# a compiler wrapper, then set both MPI_<lang>_LIBRARIES and -# MPI_<lang>_INCLUDE_PATH. You may also set any other variables -# listed above, but these two are required. This will circumvent -# autodetection entirely. -# When configuration is successful, MPI_<lang>_COMPILER will be set to the -# compiler wrapper for <lang>, if it was found. MPI_<lang>_FOUND and other -# variables above will be set if any MPI implementation was found for <lang>, -# regardless of whether a compiler was found. -# -# When using MPIEXEC to execute MPI applications, you should typically use -# all of the MPIEXEC flags as follows: -# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS -# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS -# where PROCS is the number of processors on which to execute the program, -# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the -# MPI program. -# -# === Backward Compatibility === -# -# For backward compatibility with older versions of FindMPI, these -# variables are set, but deprecated: -# MPI_FOUND MPI_COMPILER MPI_LIBRARY -# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_EXTRA_LIBRARY -# MPI_LINK_FLAGS MPI_LIBRARIES -# In new projects, please use the MPI_<lang>_XXX equivalents. - -#============================================================================= -# Copyright 2001-2011 Kitware, Inc. -# Copyright 2010-2011 Todd Gamblin tgamblin@llnl.gov -# Copyright 2001-2009 Dave Partyka -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# include this to handle the QUIETLY and REQUIRED arguments -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -include(GetPrerequisites) - -# -# This part detects MPI compilers, attempting to wade through the mess of compiler names in -# a sensible way. -# -# The compilers are detected in this order: -# -# 1. Try to find the most generic available MPI compiler, as this is usually set up by -# cluster admins. e.g., if plain old mpicc is available, we'll use it and assume it's -# the right compiler. -# -# 2. If a generic mpicc is NOT found, then we attempt to find one that matches -# CMAKE_<lang>_COMPILER_ID. e.g. if you are using XL compilers, we'll try to find mpixlc -# and company, but not mpiicc. This hopefully prevents toolchain mismatches. -# -# If you want to force a particular MPI compiler other than what we autodetect (e.g. if you -# want to compile regular stuff with GNU and parallel stuff with Intel), you can always set -# your favorite MPI_<lang>_COMPILER explicitly and this stuff will be ignored. -# - -# Start out with the generic MPI compiler names, as these are most commonly used. -set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) -set(_MPI_CXX_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ - mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) -set(_MPI_Fortran_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r - mpif90 mpif90_r mpf90 mpf90_r - mpif77 mpif77_r mpf77 mpf77_r) - -# GNU compiler names -set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r) -set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r) -set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r - mpig77 mpig77_r mpg77 mpg77_r) - -# Intel MPI compiler names -set(_MPI_Intel_C_COMPILER_NAMES mpiicc) -set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC) -set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) - -# PGI compiler names -set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) -set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC) -set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) - -# XLC MPI Compiler names -set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r) -set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC - mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r) -set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r - mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r - mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r - mpixlf mpixlf_r mpxlf mpxlf_r) - -# append vendor-specific compilers to the list if we either don't know the compiler id, -# or if we know it matches the regular compiler. -foreach (lang C CXX Fortran) - foreach (id GNU Intel PGI XL) - if (NOT CMAKE_${lang}_COMPILER_ID OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "${id}") - list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES}) - endif() - unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here - endforeach() -endforeach() - - -# Names to try for MPI exec -set(_MPI_EXEC_NAMES mpiexec mpirun lamexec srun) - -# Grab the path to MPI from the registry if we're on windows. -set(_MPI_PREFIX_PATH) -if(WIN32) - list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..") - list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]") - list(APPEND _MPI_PREFIX_PATH "$ENV{ProgramW6432}/MPICH2/") -endif() - -# Build a list of prefixes to search for MPI. -foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH}) - foreach(MpiPackageDir ${_MPI_PREFIX_PATH}) - if(EXISTS ${SystemPrefixDir}/${MpiPackageDir}) - list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}") - endif() - endforeach() -endforeach() - - -# -# interrogate_mpi_compiler(lang try_libs) -# -# Attempts to extract compiler and linker args from an MPI compiler. The arguments set -# by this function are: -# -# MPI_<lang>_INCLUDE_PATH MPI_<lang>_LINK_FLAGS MPI_<lang>_FOUND -# MPI_<lang>_COMPILE_FLAGS MPI_<lang>_LIBRARIES -# -# MPI_<lang>_COMPILER must be set beforehand to the absolute path to an MPI compiler for -# <lang>. Additionally, MPI_<lang>_INCLUDE_PATH and MPI_<lang>_LIBRARIES may be set -# to skip autodetection. -# -# If try_libs is TRUE, this will also attempt to find plain MPI libraries in the usual -# way. In general, this is not as effective as interrogating the compilers, as it -# ignores language-specific flags and libraries. However, some MPI implementations -# (Windows implementations) do not have compiler wrappers, so this approach must be used. -# -function (interrogate_mpi_compiler lang try_libs) - # MPI_${lang}_NO_INTERROGATE will be set to a compiler name when the *regular* compiler was - # discovered to be the MPI compiler. This happens on machines like the Cray XE6 that use - # modules to set cc, CC, and ftn to the MPI compilers. If the user force-sets another MPI - # compiler, MPI_${lang}_COMPILER won't be equal to MPI_${lang}_NO_INTERROGATE, and we'll - # inspect that compiler anew. This allows users to set new compilers w/o rm'ing cache. - string(COMPARE NOTEQUAL "${MPI_${lang}_NO_INTERROGATE}" "${MPI_${lang}_COMPILER}" interrogate) - - # If MPI is set already in the cache, don't bother with interrogating the compiler. - if (interrogate AND ((NOT MPI_${lang}_INCLUDE_PATH) OR (NOT MPI_${lang}_LIBRARIES))) - if (MPI_${lang}_COMPILER) - # Check whether the -showme:compile option works. This indicates that we have either OpenMPI - # or a newer version of LAM-MPI, and implies that -showme:link will also work. - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -showme:compile - OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE MPI_COMPILER_RETURN) - - if (MPI_COMPILER_RETURN EQUAL 0) - # If we appear to have -showme:compile, then we should - # also have -showme:link. Try it. - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -showme:link - OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE MPI_COMPILER_RETURN) - - if (MPI_COMPILER_RETURN EQUAL 0) - # We probably have -showme:incdirs and -showme:libdirs as well, - # so grab that while we're at it. - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -showme:incdirs - OUTPUT_VARIABLE MPI_INCDIRS OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_INCDIRS ERROR_STRIP_TRAILING_WHITESPACE) - - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -showme:libdirs - OUTPUT_VARIABLE MPI_LIBDIRS OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_LIBDIRS ERROR_STRIP_TRAILING_WHITESPACE) - - else() - # reset things here if something went wrong. - set(MPI_COMPILE_CMDLINE) - set(MPI_LINK_CMDLINE) - endif() - endif () - - # Older versions of LAM-MPI have "-showme". Try to find that. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -showme - OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE MPI_COMPILER_RETURN) - endif() - - # MVAPICH uses -compile-info and -link-info. Try them. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -compile-info - OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE MPI_COMPILER_RETURN) - - # If we have compile-info, also have link-info. - if (MPI_COMPILER_RETURN EQUAL 0) - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -link-info - OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE MPI_COMPILER_RETURN) - endif() - - # make sure we got compile and link. Reset vars if something's wrong. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - set(MPI_COMPILE_CMDLINE) - set(MPI_LINK_CMDLINE) - endif() - endif() - - # MPICH just uses "-show". Try it. - if (NOT MPI_COMPILER_RETURN EQUAL 0) - execute_process( - COMMAND ${MPI_${lang}_COMPILER} -show - OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE MPI_COMPILER_RETURN) - endif() - - if (MPI_COMPILER_RETURN EQUAL 0) - # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE - # into MPI_LINK_CMDLINE, if we didn't find the link line. - if (NOT MPI_LINK_CMDLINE) - set(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE}) - endif() - else() - message(STATUS "Unable to determine MPI from MPI driver ${MPI_${lang}_COMPILER}") - set(MPI_COMPILE_CMDLINE) - set(MPI_LINK_CMDLINE) - endif() - - # Here, we're done with the interrogation part, and we'll try to extract args we care - # about from what we learned from the compiler wrapper scripts. - - # If interrogation came back with something, extract our variable from the MPI command line - if (MPI_COMPILE_CMDLINE OR MPI_LINK_CMDLINE) - # Extract compile flags from the compile command line. - string(REGEX MATCHALL "(^| )-[Df]([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}") - set(MPI_COMPILE_FLAGS_WORK) - - foreach(FLAG ${MPI_ALL_COMPILE_FLAGS}) - if (MPI_COMPILE_FLAGS_WORK) - set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}") - else() - set(MPI_COMPILE_FLAGS_WORK ${FLAG}) - endif() - endforeach() - - # Extract include paths from compile command line - string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") - foreach(IPATH ${MPI_ALL_INCLUDE_PATHS}) - string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH}) - string(REGEX REPLACE "//" "/" IPATH ${IPATH}) - list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH}) - endforeach() - - # try using showme:incdirs if extracting didn't work. - if (NOT MPI_INCLUDE_PATH_WORK) - set(MPI_INCLUDE_PATH_WORK ${MPI_INCDIRS}) - separate_arguments(MPI_INCLUDE_PATH_WORK) - endif() - - # If all else fails, just search for mpi.h in the normal include paths. - if (NOT MPI_INCLUDE_PATH_WORK) - set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - find_path(MPI_HEADER_PATH mpi.h - HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES include) - set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH}) - endif() - - # Extract linker paths from the link command line - string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") - set(MPI_LINK_PATH) - foreach(LPATH ${MPI_ALL_LINK_PATHS}) - string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH}) - string(REGEX REPLACE "//" "/" LPATH ${LPATH}) - list(APPEND MPI_LINK_PATH ${LPATH}) - endforeach() - - # try using showme:libdirs if extracting didn't work. - if (NOT MPI_LINK_PATH) - set(MPI_LINK_PATH ${MPI_LIBDIRS}) - separate_arguments(MPI_LINK_PATH) - endif() - - # Extract linker flags from the link command line - string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") - set(MPI_LINK_FLAGS_WORK) - foreach(FLAG ${MPI_ALL_LINK_FLAGS}) - if (MPI_LINK_FLAGS_WORK) - set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}") - else() - set(MPI_LINK_FLAGS_WORK ${FLAG}) - endif() - endforeach() - - # Extract the set of libraries to link against from the link command - # line - string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") - # add the compiler implicit directories because some compilers - # such as the intel compiler have libraries that show up - # in the showme list that can only be found in the implicit - # link directories of the compiler. Do this for C++ and C - # compilers if the implicit link directories are defined. - if (DEFINED CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES) - set(MPI_LINK_PATH - "${MPI_LINK_PATH};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}") - endif () - - if (DEFINED CMAKE_C_IMPLICIT_LINK_DIRECTORIES) - set(MPI_LINK_PATH - "${MPI_LINK_PATH};${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif () - - # Determine full path names for all of the libraries that one needs - # to link against in an MPI program - foreach(LIB ${MPI_LIBNAMES}) - string(REGEX REPLACE "^ ?-l" "" LIB ${LIB}) - # MPI_LIB is cached by find_library, but we don't want that. Clear it first. - set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH}) - - if (MPI_LIB) - list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB}) - elseif (NOT MPI_FIND_QUIETLY) - message(WARNING "Unable to find MPI library ${LIB}") - endif() - endforeach() - - # Sanity check MPI_LIBRARIES to make sure there are enough libraries - list(LENGTH MPI_LIBRARIES_WORK MPI_NUMLIBS) - list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED) - if (NOT MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED) - set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND") - endif() - endif() - - elseif(try_libs) - # If we didn't have an MPI compiler script to interrogate, attempt to find everything - # with plain old find functions. This is nasty because MPI implementations have LOTS of - # different library names, so this section isn't going to be very generic. We need to - # make sure it works for MS MPI, though, since there are no compiler wrappers for that. - find_path(MPI_HEADER_PATH mpi.h - HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES include Inc) - set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH}) - - # Decide between 32-bit and 64-bit libraries for Microsoft's MPI - if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - set(MS_MPI_ARCH_DIR amd64) - else() - set(MS_MPI_ARCH_DIR i386) - endif() - - set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - find_library(MPI_LIB - NAMES mpi mpich mpich2 msmpi - HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}) - set(MPI_LIBRARIES_WORK ${MPI_LIB}) - - # Right now, we only know about the extra libs for C++. - # We could add Fortran here (as there is usually libfmpich, etc.), but - # this really only has to work with MS MPI on Windows. - # Assume that other MPI's are covered by the compiler wrappers. - if (${lang} STREQUAL CXX) - set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - find_library(MPI_LIB - NAMES mpi++ mpicxx cxx mpi_cxx - HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES lib) - if (MPI_LIBRARIES_WORK AND MPI_LIB) - list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB}) - endif() - endif() - - if (${lang} STREQUAL Fortran) - set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - find_library(MPI_LIB - NAMES fmpi fmpich fmpich2 fmpich2g msmpifec msmpifmc - HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} - PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}) - if (MPI_LIBRARIES_WORK AND MPI_LIB) - list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB}) - endif() - endif() - - if (NOT MPI_LIBRARIES_WORK) - set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND") - endif() - endif() - - # If we found MPI, set up all of the appropriate cache entries - set(MPI_${lang}_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI ${lang} compilation flags" FORCE) - set(MPI_${lang}_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI ${lang} include path" FORCE) - set(MPI_${lang}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${lang} linking flags" FORCE) - set(MPI_${lang}_LIBRARIES ${MPI_LIBRARIES_WORK} CACHE STRING "MPI ${lang} libraries to link against" FORCE) - mark_as_advanced(MPI_${lang}_COMPILE_FLAGS MPI_${lang}_INCLUDE_PATH MPI_${lang}_LINK_FLAGS MPI_${lang}_LIBRARIES) - - # clear out our temporary lib/header detectionv variable here. - set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI lib detection" FORCE) - set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI header detection" FORCE) - endif() - - # finally set a found variable for each MPI language - if (MPI_${lang}_INCLUDE_PATH AND MPI_${lang}_LIBRARIES) - set(MPI_${lang}_FOUND TRUE PARENT_SCOPE) - else() - set(MPI_${lang}_FOUND FALSE PARENT_SCOPE) - endif() -endfunction() - - -# This function attempts to compile with the regular compiler, to see if MPI programs -# work with it. This is a last ditch attempt after we've tried interrogating mpicc and -# friends, and after we've tried to find generic libraries. Works on machines like -# Cray XE6, where the modules environment changes what MPI version cc, CC, and ftn use. -function(try_regular_compiler lang success) - set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) - if (${lang} STREQUAL Fortran) - set(test_file ${scratch_directory}/cmake_mpi_test.f90) - file(WRITE ${test_file} - "program hello\n" - "include 'mpif.h'\n" - "integer ierror\n" - "call MPI_INIT(ierror)\n" - "call MPI_FINALIZE(ierror)\n" - "end\n") - else() - if (${lang} STREQUAL CXX) - set(test_file ${scratch_directory}/cmake_mpi_test.cpp) - else() - set(test_file ${scratch_directory}/cmake_mpi_test.c) - endif() - file(WRITE ${test_file} - "#include <mpi.h>\n" - "int main(int argc, char **argv) {\n" - " MPI_Init(&argc, &argv);\n" - " MPI_Finalize();\n" - "}\n") - endif() - try_compile(compiler_has_mpi ${scratch_directory} ${test_file}) - if (compiler_has_mpi) - set(MPI_${lang}_NO_INTERROGATE ${CMAKE_${lang}_COMPILER} CACHE STRING "Whether to interrogate MPI ${lang} compiler" FORCE) - set(MPI_${lang}_COMPILER ${CMAKE_${lang}_COMPILER} CACHE STRING "MPI ${lang} compiler" FORCE) - set(MPI_${lang}_COMPILE_FLAGS "" CACHE STRING "MPI ${lang} compilation flags" FORCE) - set(MPI_${lang}_INCLUDE_PATH "" CACHE STRING "MPI ${lang} include path" FORCE) - set(MPI_${lang}_LINK_FLAGS "" CACHE STRING "MPI ${lang} linking flags" FORCE) - set(MPI_${lang}_LIBRARIES "" CACHE STRING "MPI ${lang} libraries to link against" FORCE) - endif() - set(${success} ${compiler_has_mpi} PARENT_SCOPE) - unset(compiler_has_mpi CACHE) -endfunction() - -# End definitions, commence real work here. - -# Most mpi distros have some form of mpiexec which gives us something we can reliably look for. -find_program(MPIEXEC - NAMES ${_MPI_EXEC_NAMES} - PATHS ${_MPI_PREFIX_PATH} - PATH_SUFFIXES bin - DOC "Executable for running MPI programs.") - -# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). -# This gives us a fairly reliable base directory to search for /bin /lib and /include from. -get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH) -get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) - -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.") -set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.") -set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.") -set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.") -mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) - - -#============================================================================= -# Backward compatibility input hacks. Propagate the FindMPI hints to C and -# CXX if the respective new versions are not defined. Translate the old -# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${lang}_LIBRARIES. -# -# Once we find the new variables, we translate them back into their old -# equivalents below. -foreach (lang C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${lang}_${var} AND MPI_${var}) - set(MPI_${lang}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Special handling for MPI_LIBRARY and MPI_EXTRA_LIBRARY, which we nixed in the - # new FindMPI. These need to be merged into MPI_<lang>_LIBRARIES - if (NOT MPI_${lang}_LIBRARIES AND (MPI_LIBRARY OR MPI_EXTRA_LIBRARY)) - set(MPI_${lang}_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY}) - endif() -endforeach() -#============================================================================= - - -# This loop finds the compilers and sends them off for interrogation. -foreach (lang C CXX Fortran) - if (CMAKE_${lang}_COMPILER_WORKS) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (MPI_${lang}_COMPILER) - is_file_executable(MPI_${lang}_COMPILER MPI_COMPILER_IS_EXECUTABLE) - if (NOT MPI_COMPILER_IS_EXECUTABLE) - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER}) - set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - # If the user specifies a compiler, we don't want to try to search libraries either. - set(try_libs FALSE) - endif() - else() - set(try_libs TRUE) - endif() - - find_program(MPI_${lang}_COMPILER - NAMES ${_MPI_${lang}_COMPILER_NAMES} - PATHS "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH}) - interrogate_mpi_compiler(${lang} ${try_libs}) - mark_as_advanced(MPI_${lang}_COMPILER) - - # last ditch try -- if nothing works so far, just try running the regular compiler and - # see if we can create an MPI executable. - set(regular_compiler_worked 0) - if (NOT MPI_${lang}_LIBRARIES OR NOT MPI_${lang}_INCLUDE_PATH) - try_regular_compiler(${lang} regular_compiler_worked) - endif() - - set(MPI_${lang}_FIND_QUIETLY ${MPI_FIND_QUIETLY}) - set(MPI_${lang}_FIND_REQUIRED ${MPI_FIND_REQUIRED}) - set(MPI_${lang}_FIND_VERSION ${MPI_FIND_VERSION}) - set(MPI_${lang}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) - - if (regular_compiler_worked) - find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_COMPILER) - else() - find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_LIBRARIES MPI_${lang}_INCLUDE_PATH) - endif() - endif() -endforeach() - - -#============================================================================= -# More backward compatibility stuff -# -# Bare MPI sans ${lang} vars are set to CXX then C, depending on what was found. -# This mimics the behavior of the old language-oblivious FindMPI. -set(_MPI_OLD_VARS FOUND COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES) -if (MPI_CXX_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_CXX_${var}}) - endforeach() -elseif (MPI_C_FOUND) - foreach (var ${_MPI_OLD_VARS}) - set(MPI_${var} ${MPI_C_${var}}) - endforeach() -else() - # Note that we might still have found Fortran, but you'll need to use MPI_Fortran_FOUND - set(MPI_FOUND FALSE) -endif() - -# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache. -if (MPI_LIBRARIES) - list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) - set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE) -else() - set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE) -endif() - -list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) -if (MPI_NUMLIBS GREATER 1) - set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES}) - list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) - set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE) -else() - set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE) -endif() -#============================================================================= - -# unset these vars to cleanup namespace -unset(_MPI_OLD_VARS) -unset(_MPI_PREFIX_PATH) -unset(_MPI_BASE_DIR) -foreach (lang C CXX Fortran) - unset(_MPI_${lang}_COMPILER_NAMES) -endforeach() diff --git a/config/cmake/FindSZIP.cmake b/config/cmake/FindSZIP.cmake deleted file mode 100644 index f657cfa..0000000 --- a/config/cmake/FindSZIP.cmake +++ /dev/null @@ -1,179 +0,0 @@ - -# - Find SZIP library -# - Derived from the FindTiff.cmake that is included with cmake -# Find the native SZIP includes and library -# This module defines -# SZIP_INCLUDE_DIRS, where to find tiff.h, etc. -# SZIP_LIBRARIES, libraries to link against to use SZIP. -# SZIP_FOUND, If false, do not try to use SZIP. -# also defined, but not for general use are -# SZIP_LIBRARY, where to find the SZIP library. -# SZIP_LIBRARY_DEBUG - Debug version of SZIP library -# SZIP_LIBRARY_RELEASE - Release Version of SZIP library - -# message (STATUS "Finding SZIP library and headers..." ) - -############################################ -# -# Check the existence of the libraries. -# -############################################ -# This macro was taken directly from the FindQt4.cmake file that is included -# with the CMake distribution. This is NOT my work. All work was done by the -# original authors of the FindQt4.cmake file. Only minor modifications were -# made to remove references to Qt and make this file more generally applicable -######################################################################### - -MACRO (SZIP_ADJUST_LIB_VARS basename) - if (${basename}_INCLUDE_DIR) - - # if only the release version was found, set the debug variable also to the release version - if (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG) - set (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE}) - set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE}) - set (${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE}) - endif (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG) - - # if only the debug version was found, set the release variable also to the debug version - if (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) - set (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG}) - set (${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG}) - set (${basename}_LIBRARIES ${${basename}_LIBRARY_DEBUG}) - endif (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) - if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - set (${basename}_LIBRARY optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries - set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - endif (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - set (${basename}_LIBRARIES optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - endif (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) - - set (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library") - - if (${basename}_LIBRARY) - set (${basename}_FOUND 1) - endif (${basename}_LIBRARY) - - endif (${basename}_INCLUDE_DIR ) - - # Make variables changeble to the advanced user - MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR ) -ENDMACRO (SZIP_ADJUST_LIB_VARS) - - -# Look for the header file. -set (SZIP_INCLUDE_SEARCH_DIRS - $ENV{SZIP_INSTALL}/include - $ENV{SZIP_INSTALL}/include/szip - /usr/include - /usr/include/szip -) - -set (SZIP_LIB_SEARCH_DIRS - $ENV{SZIP_INSTALL}/lib - /usr/lib -) - -set (SZIP_BIN_SEARCH_DIRS - $ENV{SZIP_INSTALL}/bin - /usr/bin -) - -FIND_PATH (SZIP_INCLUDE_DIR - NAMES szlib.h - PATHS ${SZIP_INCLUDE_SEARCH_DIRS} - NO_DEFAULT_PATH -) - -if (WIN32) - set (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d") - set (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip") -else (WIN32) - set (SZIP_SEARCH_DEBUG_NAMES "sz_d") - set (SZIP_SEARCH_RELEASE_NAMES "sz;szip") -endif (WIN32) - -# Look for the library. -FIND_LIBRARY (SZIP_LIBRARY_DEBUG - NAMES ${SZIP_SEARCH_DEBUG_NAMES} - PATHS ${SZIP_LIB_SEARCH_DIRS} - NO_DEFAULT_PATH -) - -FIND_LIBRARY (SZIP_LIBRARY_RELEASE - NAMES ${SZIP_SEARCH_RELEASE_NAMES} - PATHS ${SZIP_LIB_SEARCH_DIRS} - NO_DEFAULT_PATH -) - -SZIP_ADJUST_LIB_VARS (SZIP) - -if (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) - set (SZIP_FOUND 1) - set (SZIP_LIBRARIES ${SZIP_LIBRARY}) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR}) - if (SZIP_LIBRARY_DEBUG) - GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH) - set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - elseif (SZIP_LIBRARY_RELEASE) - GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH) - set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - endif (SZIP_LIBRARY_DEBUG) - -else (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) - set (SZIP_FOUND 0) - set (SZIP_LIBRARIES) - set (SZIP_INCLUDE_DIRS) -endif (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) - -# Report the results. -if (NOT SZIP_FOUND) - set (SZIP_DIR_MESSAGE - "SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable." - ) - if (NOT SZIP_FIND_QUIETLY) - message (STATUS "${SZIP_DIR_MESSAGE}") - else (NOT SZIP_FIND_QUIETLY) - if (SZIP_FIND_REQUIRED) - message (FATAL_ERROR "SZip was NOT found and is Required by this project") - endif (SZIP_FIND_REQUIRED) - endif (NOT SZIP_FIND_QUIETLY) -endif (NOT SZIP_FOUND) - -if (SZIP_FOUND) - include (CheckSymbolExists) - ############################################# - # Find out if SZIP was build using dll's - ############################################# - # Save required variable - set (CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - set (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) - # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES - set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}") - - CHECK_SYMBOL_EXISTS (SZIP_BUILT_AS_DYNAMIC_LIB "SZconfig.h" HAVE_SZIP_DLL) - - if (HAVE_SZIP_DLL STREQUAL "TRUE") - set (HAVE_SZIP_DLL "1") - endif (HAVE_SZIP_DLL STREQUAL "TRUE") - - # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables - set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) - # - ############################################# -endif (SZIP_FOUND) - -if (FIND_SZIP_DEBUG) - message (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}") - message (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}") - message (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}") - message (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}") - message (STATUS "HAVE_SZIP_DLL: ${HAVE_SZIP_DLL}") - message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") -endif (FIND_SZIP_DEBUG) diff --git a/config/cmake/GetTimeOfDayTest.cpp b/config/cmake/GetTimeOfDayTest.cpp deleted file mode 100644 index 3b5bf60..0000000 --- a/config/cmake/GetTimeOfDayTest.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#if defined (TRY_SYS_TIME_H) -#include <sys/time.h> -/* #include <time.h> */ -#endif - - -#if defined (TRY_TIME_H) -#include <time.h> -#endif - -int main(int argc, char **argv) { - struct timeval t1; - gettimeofday(&t1, 0x00); - return 0; -} diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 25a0e37..6be0903 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -457,6 +457,9 @@ /* Define to 1 if you have the <unistd.h> header file. */ #cmakedefine H5_HAVE_UNISTD_H @H5_HAVE_UNISTD_H@ +/* Define to 1 if you have the `asprintf' function. */ +#cmakedefine H5_HAVE_ASPRINTF @H5_HAVE_ASPRINTF@ + /* Define to 1 if you have the `vasprintf' function. */ #cmakedefine H5_HAVE_VASPRINTF @H5_HAVE_VASPRINTF@ diff --git a/config/cmake/HDF5CXXTests.cpp b/config/cmake/HDF5CXXTests.cpp deleted file mode 100644 index 7003cc8..0000000 --- a/config/cmake/HDF5CXXTests.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -#ifdef OLD_HEADER_FILENAME - -#include <iostream> - -int main(void) { return 0; } - -#endif - - -#ifdef H5_NO_NAMESPACE - -namespace H5 { -int fnord; -} - -int main(void) { - using namespace H5; - fnord = 37; - return 0; -} - -#endif - -#ifdef H5_NO_STD - -#include <string> - -using namespace std; - -int main(void) { - string myString("testing namespace std"); - return 0; -} - -#endif - -#ifdef BOOL_NOTDEFINED -int main(void) { - bool flag; - return 0; -} - -#endif - -#ifdef NO_STATIC_CAST - -int main(void) { - float test_float; - int test_int; - test_float = 37.0; - test_int = static_cast <int> (test_float); - return 0; -} - -#endif diff --git a/config/cmake/HDF5Tests.c b/config/cmake/HDF5Tests.c deleted file mode 100644 index 355c06f..0000000 --- a/config/cmake/HDF5Tests.c +++ /dev/null @@ -1,479 +0,0 @@ -#define SIMPLE_TEST(x) int main(){ x; return 0; } - -#ifdef HAVE_C99_DESIGNATED_INITIALIZER - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - typedef struct - { - int x; - union - { - int i; - double d; - }u; - }di_struct_t; - di_struct_t x = - { 0, - { .d = 0.0}}; - ; - return 0; -} - -#endif - -#ifdef HAVE_C99_FUNC - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ - const char *fname = __func__; - ; - return 0; -} - -#endif - -#ifdef VSNPRINTF_WORKS -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> - -int test_vsnprintf(const char *fmt,...) -{ - va_list ap; - char *s = malloc(16); - int ret; - - va_start(ap, fmt); - ret=vsnprintf(s,16,"%s",ap); - va_end(ap); - - return(ret!=42 ? 1 : 0); -} - -int main(void) -{ - return(test_vsnprintf("%s","A string that is longer than 16 characters")); -} -#endif - - -#ifdef TIME_WITH_SYS_TIME -/* Time with sys/time test */ - -#include <sys/types.h> -#include <sys/time.h> -#include <time.h> - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} - -#endif - -#ifdef STDC_HEADERS -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> -int main() { return 0; } -#endif /* STDC_HEADERS */ - -#ifdef HAVE_TM_ZONE - -#include <sys/types.h> -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct tm tm; tm.tm_zone); - -#endif /* HAVE_TM_ZONE */ - -#ifdef HAVE_STRUCT_TM_TM_ZONE - -#include <sys/types.h> -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct tm tm; tm.tm_zone); - -#endif /* HAVE_STRUCT_TM_TM_ZONE */ - -#ifdef HAVE_ATTRIBUTE - -#if 0 -static void test int __attribute((unused)) var) -{ - int __attribute__((unused)) x = var; -} - -int main(void) -{ - test(19); -} - -#else -int -main () -{ -int __attribute__((unused)) x - ; - return 0; -} -#endif - - -#endif /* HAVE_ATTRIBUTE */ - -#ifdef HAVE_FUNCTION - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -(void)__FUNCTION__ - ; - return 0; -} - -#endif /* HAVE_FUNCTION */ - -#ifdef HAVE_TM_GMTOFF - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0); - -#endif /* HAVE_TM_GMTOFF */ - -#ifdef HAVE___TM_GMTOFF - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0); - -#endif /* HAVE_TM_GMTOFF */ - -#ifdef HAVE_TIMEZONE - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(timezone=0); - -#endif /* HAVE_TIMEZONE */ - -#ifdef HAVE_STRUCT_TIMEZONE - -#include <sys/types.h> -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct timezone tz; tz.tz_minuteswest=0); - -#endif /* HAVE_STRUCT_TIMEZONE */ - -#ifdef HAVE_STAT_ST_BLOCKS - -#include <sys/stat.h> -SIMPLE_TEST(struct stat sb; sb.st_blocks=0); - -#endif /* HAVE_STAT_ST_BLOCKS */ - -#ifdef PRINTF_LL_WIDTH - -#ifdef HAVE_LONG_LONG -# define LL_TYPE long long -#else /* HAVE_LONG_LONG */ -# define LL_TYPE __int64 -#endif /* HAVE_LONG_LONG */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -int main(void) -{ - char *llwidthArgs[] = { "l64", "l", "L", "q", "ll", NULL }; - char *s = malloc(128); - char **currentArg = NULL; - LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; - for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++) - { - char formatString[64]; - sprintf(formatString, "%%%sd", *currentArg); - sprintf(s, formatString, x); - if (strcmp(s, "1099511627776") == 0) - { - printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg); - return 0; - } - } - return 1; -} - -#endif /* PRINTF_LL_WIDTH */ - -#ifdef SYSTEM_SCOPE_THREADS -#include <stdlib.h> -#include <pthread.h> - -int main(void) -{ - pthread_attr_t attribute; - int ret; - - pthread_attr_init(&attribute); - ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); - if (ret==0) - return 0; - return 1; -} - -#endif /* SYSTEM_SCOPE_THREADS */ - -#ifdef HAVE_SOCKLEN_T - -#include <stdio.h> -#include <stdlib.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif - -SIMPLE_TEST(socklen_t foo); - -#endif /* HAVE_SOCKLEN_T */ - -#ifdef DEV_T_IS_SCALAR - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -int main () -{ - dev_t d1, d2; - if(d1==d2) - return 0; - return 1; -} - -#endif /* DEV_T_IS_SCALAR */ - -#ifdef HAVE_OFF64_T -#include <sys/types.h> -int main() -{ - off64_t n = 0; - return (int)n; -} -#endif - -#ifdef HAVE_STAT64_STRUCT -#include <sys/types.h> -#include <sys/stat.h>], -struct stat64 sb; -int main() -{ - return 0; -} -#endif - -#ifdef TEST_DIRECT_VFD_WORKS -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -int main(void) -{ - int fid; - if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0) - return 1; - close(fid); - remove("tst_file"); - return 0; -} -#endif - -#ifdef HAVE_DIRECT - SIMPLE_TEST(posix_memalign()); -#endif - -#ifdef TEST_LFS_WORKS -/* Return 0 when LFS is available and 1 otherwise. */ -#define _LARGEFILE_SOURCE -#define _LARGEFILE64_SOURCE -#define _LARGE_FILES -#define _FILE_OFFSET_BITS 64 -#include <sys/types.h> -#include <sys/stat.h> -#include <assert.h> -#include <stdio.h> - -int main(int argc, char **argv) -{ - /* check that off_t can hold 2^63 - 1 and perform basic operations... */ -#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - if (OFF_T_64 % 2147483647 != 1) - return 1; - - /* stat breaks on SCO OpenServer */ - struct stat buf; - stat( argv[0], &buf ); - if (!S_ISREG(buf.st_mode)) - return 2; - - FILE *file = fopen( argv[0], "r" ); - off_t offset = ftello( file ); - fseek( file, offset, SEEK_CUR ); - fclose( file ); - return 0; -} -#endif - -#ifdef GETTIMEOFDAY_GIVES_TZ -#include <time.h> -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -int main(void) -{ - struct timeval tv; - struct timezone tz; - tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ - tz.tz_dsttime = 7; - gettimeofday(&tv, &tz); - /* Check whether the function returned any value at all */ - if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - return 1; - else return 0; -} -#endif - -#ifdef LONE_COLON -int main(int argc, char * argv) -{ - return 0; -} -#endif - -#ifdef CXX_HAVE_OFFSETOF - -#include <stdio.h> -#include <stddef.h> - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - struct index_st - { - unsigned char type; - unsigned char num; - unsigned int len; - }; - typedef struct index_st index_t; - int x,y; - x = offsetof(struct index_st, len); - y = offsetof(index_t, num) - - ; - return 0; -} - -#endif - -#ifdef HAVE_IOEO - -#include <windows.h> -typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); -int main () -{ - PGNSI pGNSI; - pGNSI = (PGNSI) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), - "InitOnceExecuteOnce"); - if(NULL == pGNSI) - return 1; - else - return 0; -} - -#endif /* HAVE_IOEO */ - -#ifdef HAVE_STRUCT_VIDEOCONFIG - -SIMPLE_TEST(struct videoconfig w; w.numtextcols=0); - -#endif /* HAVE_TM_GMTOFF */ - -#ifdef HAVE_STRUCT_TEXT_INFO - -SIMPLE_TEST(struct text_info w; w.screenwidth=0); - -#endif /* HAVE_TM_GMTOFF */ - - -#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline ) -#ifndef __cplusplus -typedef int foo_t; -static INLINE_TEST_INLINE foo_t static_foo () { return 0; } -INLINE_TEST_INLINE foo_t foo () {return 0; } -int main() { return 0; } -#endif - -#endif /* INLINE_TEST */ diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake deleted file mode 100644 index e65ea21..0000000 --- a/config/cmake/HDF5UseFortran.cmake +++ /dev/null @@ -1,139 +0,0 @@ -# -# This file provides functions for Fortran support. -# -#------------------------------------------------------------------------------- -ENABLE_LANGUAGE (Fortran) - -#----------------------------------------------------------------------------- -# Detect name mangling convention used between Fortran and C -#----------------------------------------------------------------------------- -include (FortranCInterface) -FortranCInterface_HEADER ( - ${CMAKE_BINARY_DIR}/FCMangle.h - MACRO_NAMESPACE "H5_FC_" - SYMBOL_NAMESPACE "H5_FC_" - SYMBOLS mysub mymod:my_sub -) - -file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)") -string (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) -set (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}") - -file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)") -string (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) -set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}") - -#----------------------------------------------------------------------------- -# The provided CMake Fortran macros don't provide a general check function -# so this one is used for a sizeof test. -#----------------------------------------------------------------------------- -MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) - if (NOT DEFINED ${VARIABLE}) - message (STATUS "Testing Fortran ${FUNCTION}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif (CMAKE_REQUIRED_LIBRARIES) - file (WRITE - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f - "${CODE}" - ) - TRY_COMPILE (${VARIABLE} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - -# message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") -# message ( "Test result ${OUTPUT}") -# message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - - if (${VARIABLE}) - set (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") - message (STATUS "Testing Fortran ${FUNCTION} - OK") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" - ) - else (${VARIABLE}) - message (STATUS "Testing Fortran ${FUNCTION} - Fail") - set (${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") - endif (${VARIABLE}) - endif (NOT DEFINED ${VARIABLE}) -ENDMACRO (CHECK_FORTRAN_FEATURE) - -#----------------------------------------------------------------------------- -# Configure Checks which require Fortran compilation must go in here -# not in the main ConfigureChecks.cmake files, because if the user has -# no Fortran compiler, problems arise. -# -# Be careful with leading spaces here, do not remove them. -#----------------------------------------------------------------------------- -CHECK_FORTRAN_FEATURE(sizeof - " - PROGRAM main - i = sizeof(x) - END PROGRAM - " - FORTRAN_HAVE_SIZEOF -) - -CHECK_FORTRAN_FEATURE(RealIsNotDouble - " - MODULE type_mod - INTERFACE h5t - MODULE PROCEDURE h5t_real - MODULE PROCEDURE h5t_dble - END INTERFACE - CONTAINS - SUBROUTINE h5t_real(r) - REAL :: r - END SUBROUTINE h5t_real - SUBROUTINE h5t_dble(d) - DOUBLE PRECISION :: d - END SUBROUTINE h5t_dble - END MODULE type_mod - PROGRAM main - USE type_mod - REAL :: r - DOUBLE PRECISION :: d - CALL h5t(r) - CALL h5t(d) - END PROGRAM main - " - FORTRAN_DEFAULT_REAL_NOT_DOUBLE -) - -#----------------------------------------------------------------------------- -# Checks if the ISO_C_BINDING module meets all the requirements -#----------------------------------------------------------------------------- -CHECK_FORTRAN_FEATURE(iso_c_binding - " - PROGRAM main - USE iso_c_binding - IMPLICIT NONE - TYPE(C_PTR) :: ptr - TYPE(C_FUNPTR) :: funptr - INTEGER(C_INT64_T) :: c_int64_type - CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr - ptr = C_LOC(ichr(1:1)) - END PROGRAM - " - FORTRAN_HAVE_ISO_C_BINDING -) - -#----------------------------------------------------------------------------- -# Add debug information (intel Fortran : JB) -#----------------------------------------------------------------------------- -if (CMAKE_Fortran_COMPILER MATCHES ifort) - if (WIN32) - set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE) - set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE) - endif (WIN32) -endif (CMAKE_Fortran_COMPILER MATCHES ifort) diff --git a/config/cmake/HDFLibMacros.cmake b/config/cmake/HDFLibMacros.cmake deleted file mode 100644 index 505a9d5..0000000 --- a/config/cmake/HDFLibMacros.cmake +++ /dev/null @@ -1,350 +0,0 @@ -#------------------------------------------------------------------------------- -MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic) - # May need to build JPEG with PIC on x64 machines with gcc - # Need to use CMAKE_ANSI_CFLAGS define so that compiler test works - - if (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_ADD (JPEG - SVN_REPOSITORY ${JPEG_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - ) - elseif (${compress_type} MATCHES "TGZ") - EXTERNALPROJECT_ADD (JPEG - URL ${JPEG_URL} - URL_MD5 "" - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - ) - endif (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_GET_PROPERTY (JPEG BINARY_DIR SOURCE_DIR) - - if (${CMAKE_BUILD_TYPE} MATCHES "Debug") - if (WIN32) - set (JPEG_LIB_NAME "jpeg_D") - else (WIN32) - set (JPEG_LIB_NAME "jpeg_debug") - endif (WIN32) - else (${CMAKE_BUILD_TYPE} MATCHES "Debug") - set (JPEG_LIB_NAME "jpeg") - endif (${CMAKE_BUILD_TYPE} MATCHES "Debug") - - # Create imported target szip - ADD_LIBRARY(jpeg ${libtype} IMPORTED) - ADD_DEPENDENCIES (jpeg JPEG) - - if (${libtype} MATCHES "SHARED") - if (WIN32) - if (MINGW) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${JPEG_LIB_NAME}.lib" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else (MINGW) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - endif (MINGW) - else (WIN32) - if (CYGWIN) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else (CYGWIN) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${JPEG_VERSION_STRING}" - SOVERSION "${JPEG_VERSION_STRING}" - ) - endif (CYGWIN) - endif (WIN32) - else (${libtype} MATCHES "SHARED") - if (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/lib${JPEG_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - else (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${JPEG_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif (WIN32 AND NOT MINGW) - endif (${libtype} MATCHES "SHARED") - -# include (${BINARY_DIR}/JPEG-targets.cmake) - set (JPEG_LIBRARY "jpeg") - - set (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}") - set (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src") - set (JPEG_FOUND 1) - set (JPEG_LIBRARIES ${JPEG_LIBRARY}) - set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR}) -ENDMACRO (EXTERNAL_JPEG_LIBRARY) - -#------------------------------------------------------------------------------- -MACRO (PACKAGE_JPEG_LIBRARY compress_type) - ADD_CUSTOM_TARGET (JPEG-GenHeader-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JPEG_INCLUDE_DIR_GEN}/jconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ - COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h) - if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") - ADD_DEPENDENCIES (JPEG-GenHeader-Copy JPEG) - endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -ENDMACRO (PACKAGE_JPEG_LIBRARY) - -#------------------------------------------------------------------------------- -MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) - if (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_ADD (SZIP - SVN_REPOSITORY ${SZIP_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - ) - elseif (${compress_type} MATCHES "TGZ") - EXTERNALPROJECT_ADD (SZIP - URL ${SZIP_URL} - URL_MD5 "" - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - ) - endif (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_GET_PROPERTY (SZIP BINARY_DIR SOURCE_DIR) - - if (${CMAKE_BUILD_TYPE} MATCHES "Debug") - if (WIN32) - set (SZIP_LIB_NAME "szip_D") - else (WIN32) - set (SZIP_LIB_NAME "szip_debug") - endif (WIN32) - else (${CMAKE_BUILD_TYPE} MATCHES "Debug") - set (SZIP_LIB_NAME "szip") - endif (${CMAKE_BUILD_TYPE} MATCHES "Debug") - - # Create imported target szip - ADD_LIBRARY(szip ${libtype} IMPORTED) - ADD_DEPENDENCIES (szip SZIP) - - if (${libtype} MATCHES "SHARED") - if (WIN32) - if (MINGW) - SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${SZIP_LIB_NAME}.lib" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else (MINGW) - SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - endif (MINGW) - else (WIN32) - if (CYGWIN) - SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else (CYGWIN) - SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${SZIP_VERSION_STRING}" - SOVERSION "${SZIP_VERSION_STRING}" - ) - endif (CYGWIN) - endif (WIN32) - else (${libtype} MATCHES "SHARED") - if (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/lib${SZIP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - else (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${SZIP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif (WIN32 AND NOT MINGW) - endif (${libtype} MATCHES "SHARED") - -# include (${BINARY_DIR}/SZIP-targets.cmake) - set (SZIP_LIBRARY "szip") - - set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}") - set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") - set (SZIP_FOUND 1) - set (SZIP_LIBRARIES ${SZIP_LIBRARY}) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) -ENDMACRO (EXTERNAL_SZIP_LIBRARY) - -#------------------------------------------------------------------------------- -MACRO (PACKAGE_SZIP_LIBRARY compress_type) - ADD_CUSTOM_TARGET (SZIP-GenHeader-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ - COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h) - if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") - ADD_DEPENDENCIES (SZIP-GenHeader-Copy SZIP) - endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -ENDMACRO (PACKAGE_SZIP_LIBRARY) - -#------------------------------------------------------------------------------- -MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) - if (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_ADD (ZLIB - SVN_REPOSITORY ${ZLIB_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - ) - elseif (${compress_type} MATCHES "TGZ") - EXTERNALPROJECT_ADD (ZLIB - URL ${ZLIB_URL} - URL_MD5 "" - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - ) - endif (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_GET_PROPERTY (ZLIB BINARY_DIR SOURCE_DIR) - - if (${CMAKE_BUILD_TYPE} MATCHES "Debug") - if (WIN32) - set (ZLIB_LIB_NAME "zlib_D") - else (WIN32) - set (ZLIB_LIB_NAME "z_debug") - endif (WIN32) - else (${CMAKE_BUILD_TYPE} MATCHES "Debug") - if (WIN32) - set (ZLIB_LIB_NAME "zlib") - else (WIN32) - set (ZLIB_LIB_NAME "z") - endif (WIN32) - endif (${CMAKE_BUILD_TYPE} MATCHES "Debug") - - # Create imported target szip - ADD_LIBRARY(zlib ${libtype} IMPORTED) - ADD_DEPENDENCIES (zlib ZLIB) - - if (${libtype} MATCHES "SHARED") - if (WIN32) - if (MINGW) - SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${ZLIB_LIB_NAME}.lib" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else (MINGW) - SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - endif (MINGW) - else (WIN32) - if (CYGWIN) - SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else (CYGWIN) - SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${ZLIB_VERSION_STRING}" - SOVERSION "${ZLIB_VERSION_STRING}" - ) - endif (CYGWIN) - endif (WIN32) - else (${libtype} MATCHES "SHARED") - if (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/lib${ZLIB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - else (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${ZLIB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif (WIN32 AND NOT MINGW) - endif (${libtype} MATCHES "SHARED") - -# include (${BINARY_DIR}/ZLIB-targets.cmake) - set (ZLIB_LIBRARY "zlib") - - set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}") - set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}") - set (ZLIB_FOUND 1) - set (ZLIB_LIBRARIES ${ZLIB_LIBRARY}) - set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) -ENDMACRO (EXTERNAL_ZLIB_LIBRARY) - -#------------------------------------------------------------------------------- -MACRO (PACKAGE_ZLIB_LIBRARY compress_type) - ADD_CUSTOM_TARGET (ZLIB-GenHeader-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ - COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) - if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") - ADD_DEPENDENCIES (ZLIB-GenHeader-Copy ZLIB) - endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") -ENDMACRO (PACKAGE_ZLIB_LIBRARY) diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake deleted file mode 100644 index 56fdf83..0000000 --- a/config/cmake/HDFMacros.cmake +++ /dev/null @@ -1,187 +0,0 @@ -#------------------------------------------------------------------------------- -MACRO (SET_GLOBAL_VARIABLE name value) - set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE) -ENDMACRO (SET_GLOBAL_VARIABLE) - -#------------------------------------------------------------------------------- -MACRO (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES) - #set(source_group_path "Source/AIM/${NAME}") - string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}) - source_group (${source_group_path} FILES ${HEADERS} ${SOURCES}) - - #-- The following is needed if we ever start to use OS X Frameworks but only - #-- works on CMake 2.6 and greater - #set_property (SOURCE ${HEADERS} - # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} - #) -ENDMACRO (IDE_GENERATED_PROPERTIES) - -#------------------------------------------------------------------------------- -MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) - # install (FILES ${HEADERS} - # DESTINATION include/R3D/${NAME} - # COMPONENT Headers - # ) - - string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH} ) - source_group (${source_group_path} FILES ${HEADERS} ${SOURCES}) - - #-- The following is needed if we ever start to use OS X Frameworks but only - #-- works on CMake 2.6 and greater - #set_property (SOURCE ${HEADERS} - # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} - #) -ENDMACRO (IDE_SOURCE_PROPERTIES) - -#------------------------------------------------------------------------------- -MACRO (TARGET_NAMING libtarget libtype) - if (WIN32) - if (${libtype} MATCHES "SHARED") - set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}dll") - endif (${libtype} MATCHES "SHARED") - endif (WIN32) -ENDMACRO (TARGET_NAMING) - -#------------------------------------------------------------------------------- -MACRO (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) - if (WIN32 AND MSVC) - get_target_property (target_name ${libtarget} RELWITHDEBINFO_OUTPUT_NAME) - install ( - FILES - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${target_name}.pdb - DESTINATION - ${targetdestination} - CONFIGURATIONS RelWithDebInfo - COMPONENT ${targetcomponent} - ) - endif (WIN32 AND MSVC) -ENDMACRO (INSTALL_TARGET_PDB) - -#------------------------------------------------------------------------------- -MACRO (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) - if (WIN32 AND MSVC) - get_target_property (target_name ${progtarget} RELWITHDEBINFO_OUTPUT_NAME) - get_target_property (target_prefix ${progtarget} PREFIX) - install ( - FILES - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${target_prefix}${target_name}.pdb - DESTINATION - ${targetdestination} - CONFIGURATIONS RelWithDebInfo - COMPONENT ${targetcomponent} - ) - endif (WIN32 AND MSVC) -ENDMACRO (INSTALL_PROGRAM_PDB) - -#------------------------------------------------------------------------------- -MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype) - # message (STATUS "${libname} libtype: ${libtype}") - if (${libtype} MATCHES "SHARED") - if (WIN32) - set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}_D") - else (WIN32) - set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}_debug") - endif (WIN32) - else (${libtype} MATCHES "SHARED") - if (WIN32) - set (LIB_RELEASE_NAME "lib${libname}") - set (LIB_DEBUG_NAME "lib${libname}_D") - else (WIN32) - # if the generator supports configuration types or if the CMAKE_BUILD_TYPE has a value - if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}_debug") - else (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - set (LIB_RELEASE_NAME "lib${libname}") - set (LIB_DEBUG_NAME "lib${libname}_debug") - endif (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - endif (WIN32) - endif (${libtype} MATCHES "SHARED") - - set_target_properties (${libtarget} - PROPERTIES - DEBUG_OUTPUT_NAME ${LIB_DEBUG_NAME} - RELEASE_OUTPUT_NAME ${LIB_RELEASE_NAME} - MINSIZEREL_OUTPUT_NAME ${LIB_RELEASE_NAME} - RELWITHDEBINFO_OUTPUT_NAME ${LIB_RELEASE_NAME} - ) - - #----- Use MSVC Naming conventions for Shared Libraries - if (MINGW AND ${libtype} MATCHES "SHARED") - set_target_properties (${libtarget} - PROPERTIES - IMPORT_SUFFIX ".lib" - IMPORT_PREFIX "" - PREFIX "" - ) - endif (MINGW AND ${libtype} MATCHES "SHARED") - -ENDMACRO (HDF_SET_LIB_OPTIONS) - -#------------------------------------------------------------------------------- -MACRO (TARGET_C_PROPERTIES wintarget addcompileflags addlinkflags) - if (MSVC) - TARGET_MSVC_PROPERTIES (${wintarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - else (MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (${wintarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "${addlinkflags}" - ) - else (BUILD_SHARED_LIBS) - set_target_properties (${wintarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "${addlinkflags}" - ) - endif (BUILD_SHARED_LIBS) - endif (MSVC) -ENDMACRO (TARGET_C_PROPERTIES) - -#------------------------------------------------------------------------------- -MACRO (TARGET_MSVC_PROPERTIES wintarget addcompileflags addlinkflags) - if (MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (${wintarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "${addlinkflags}" - ) - else (BUILD_SHARED_LIBS) - set_target_properties (${wintarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "${addlinkflags}" - ) - endif (BUILD_SHARED_LIBS) - endif (MSVC) -ENDMACRO (TARGET_MSVC_PROPERTIES) - -#------------------------------------------------------------------------------- -MACRO (TARGET_FORTRAN_PROPERTIES forttarget addcompileflags addlinkflags) - if (WIN32) - TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - endif (WIN32) -ENDMACRO (TARGET_FORTRAN_PROPERTIES) - -#------------------------------------------------------------------------------- -MACRO (TARGET_FORTRAN_WIN_PROPERTIES forttarget addcompileflags addlinkflags) - if (MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (${forttarget} - PROPERTIES - COMPILE_FLAGS "/dll ${addcompileflags}" - LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" - ) - else (BUILD_SHARED_LIBS) - set_target_properties (${forttarget} - PROPERTIES - COMPILE_FLAGS "${addcompileflags}" - LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}" - ) - endif (BUILD_SHARED_LIBS) - endif (MSVC) -ENDMACRO (TARGET_FORTRAN_WIN_PROPERTIES) diff --git a/config/cmake/NSIS.InstallOptions.ini.in b/config/cmake/NSIS.InstallOptions.ini.in deleted file mode 100644 index 83ca053..0000000 --- a/config/cmake/NSIS.InstallOptions.ini.in +++ /dev/null @@ -1,37 +0,0 @@ -[Settings] -NumFields=5 - -[Field 1] -Type=label -Text=By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does add its directory to the system PATH. -Left=0 -Right=-1 -Top=0 -Bottom=20 - -[Field 2] -Type=radiobutton -Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH -Left=0 -Right=-1 -Top=30 -Bottom=40 -State=0 - -[Field 3] -Type=radiobutton -Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users -Left=0 -Right=-1 -Top=40 -Bottom=50 -State=1 - -[Field 4] -Type=radiobutton -Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user -Left=0 -Right=-1 -Top=50 -Bottom=60 -State=0 diff --git a/config/cmake/NSIS.template.in b/config/cmake/NSIS.template.in deleted file mode 100644 index ecced05..0000000 --- a/config/cmake/NSIS.template.in +++ /dev/null @@ -1,974 +0,0 @@ -; CPack install script designed for a nmake build - -;-------------------------------- -; You must define these values - - !define VERSION "@CPACK_PACKAGE_VERSION@" - !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@" - !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@" - -;-------------------------------- -;Variables - - Var MUI_TEMP - Var STARTMENU_FOLDER - Var SV_ALLUSERS - Var START_MENU - Var DO_NOT_ADD_TO_PATH - Var ADD_TO_PATH_ALL_USERS - Var ADD_TO_PATH_CURRENT_USER - Var INSTALL_DESKTOP - Var IS_DEFAULT_INSTALLDIR -;-------------------------------- -;Include Modern UI - - !include "MUI.nsh" - - ;Default installation folder - InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - -;-------------------------------- -;General - - ;Name and file - Name "@CPACK_NSIS_PACKAGE_NAME@" - OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" - - ;Set compression - SetCompressor @CPACK_NSIS_COMPRESSOR@ - -@CPACK_NSIS_DEFINES@ - - !include Sections.nsh - -;--- Component support macros: --- -; The code for the add/remove functionality is from: -; http://nsis.sourceforge.net/Add/Remove_Functionality -; It has been modified slightly and extended to provide -; inter-component dependencies. -Var AR_SecFlags -Var AR_RegFlags -@CPACK_NSIS_SECTION_SELECTED_VARS@ - -; Loads the "selected" flag for the section named SecName into the -; variable VarName. -!macro LoadSectionSelectedIntoVar SecName VarName - SectionGetFlags ${${SecName}} $${VarName} - IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits -!macroend - -; Loads the value of a variable... can we get around this? -!macro LoadVar VarName - IntOp $R0 0 + $${VarName} -!macroend - -; Sets the value of a variable -!macro StoreVar VarName IntValue - IntOp $${VarName} 0 + ${IntValue} -!macroend - -!macro InitSection SecName - ; This macro reads component installed flag from the registry and - ;changes checked state of the section on the components page. - ;Input: section index constant name specified in Section command. - - ClearErrors - ;Reading component status from registry - ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed" - IfErrors "default_${SecName}" - ;Status will stay default if registry value not found - ;(component was never installed) - IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags - IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off - IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit - - ; Note whether this component was installed before - !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags - IntOp $R0 $AR_RegFlags & $AR_RegFlags - - ;Writing modified flags - SectionSetFlags ${${SecName}} $AR_SecFlags - - "default_${SecName}:" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected -!macroend - -!macro FinishSection SecName - ; This macro reads section flag set by user and removes the section - ;if it is not selected. - ;Then it writes component installed flag to registry - ;Input: section index constant name specified in Section command. - - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags - ;Checking lowest bit: - IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} - IntCmp $AR_SecFlags 1 "leave_${SecName}" - ;Section is not selected: - ;Calling Section uninstall macro and writing zero installed flag - !insertmacro "Remove_${${SecName}}" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ - "Installed" 0 - Goto "exit_${SecName}" - - "leave_${SecName}:" - ;Section is selected: - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ - "Installed" 1 - - "exit_${SecName}:" -!macroend - -!macro RemoveSection_CPack SecName - ; This macro is used to call section's Remove_... macro - ;from the uninstaller. - ;Input: section index constant name specified in Section command. - - !insertmacro "Remove_${${SecName}}" -!macroend - -; Determine whether the selection of SecName changed -!macro MaybeSelectionChanged SecName - !insertmacro LoadVar ${SecName}_selected - SectionGetFlags ${${SecName}} $R1 - IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits - - ; See if the status has changed: - IntCmp $R0 $R1 "${SecName}_unchanged" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected - - IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" - !insertmacro "Deselect_required_by_${SecName}" - goto "${SecName}_unchanged" - - "${SecName}_was_selected:" - !insertmacro "Select_${SecName}_depends" - - "${SecName}_unchanged:" -!macroend -;--- End of Add/Remove macros --- - -;-------------------------------- -;Interface Settings - - !define MUI_HEADERIMAGE - !define MUI_ABORTWARNING - -;-------------------------------- -; path functions - -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 - -;---------------------------------------- -; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" -;---------------------------------------- -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 -;==================================================== -; get_NT_environment -; Returns: the selected environment -; Output : head of the stack -;==================================================== -!macro select_NT_profile UN -Function ${UN}select_NT_profile - StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single - DetailPrint "Selected environment for all users" - Push "all" - Return - environment_single: - DetailPrint "Selected environment for current user only." - Push "current" - Return -FunctionEnd -!macroend -!insertmacro select_NT_profile "" -!insertmacro select_NT_profile "un." -;---------------------------------------------------- -!define NT_current_env 'HKCU "Environment"' -!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - -!ifndef WriteEnvStr_RegKey - !ifdef ALL_USERS - !define WriteEnvStr_RegKey \ - 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - !else - !define WriteEnvStr_RegKey 'HKCU "Environment"' - !endif -!endif - -; AddToPath - Adds the given dir to the search path. -; Input - head of the stack -; Note - Win9x systems requires reboot - -Function AddToPath - Exch $0 - Push $1 - Push $2 - Push $3 - - # don't add if the path doesn't exist - IfFileExists "$0\*.*" "" AddToPath_done - - ReadEnvStr $1 PATH - ; if the path is too long for a NSIS variable NSIS will return a 0 - ; length string. If we find that, then warn and skip any path - ; modification as it will trash the existing path. - StrLen $2 $1 - IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done - CheckPathLength_ShowPathWarning: - Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" - Goto AddToPath_done - CheckPathLength_Done: - Push "$1;" - Push "$0;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$0\;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - GetFullPathName /SHORT $3 $0 - Push "$1;" - Push "$3;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$3\;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - - Call IsNT - Pop $1 - StrCmp $1 1 AddToPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" a - FileSeek $1 -1 END - FileReadByte $1 $2 - IntCmp $2 26 0 +2 +2 # DOS EOF - FileSeek $1 -1 END # write over EOF - FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" - FileClose $1 - SetRebootFlag true - Goto AddToPath_done - - AddToPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto DoTrim - ReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - DoTrim: - StrCmp $1 "" AddToPath_NTdoIt - Push $1 - Call Trim - Pop $1 - StrCpy $0 "$1;$0" - AddToPath_NTdoIt: - StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $0 - Goto DoSend - WriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $0 - DoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - AddToPath_done: - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - - -; RemoveFromPath - Remove a given dir from the path -; Input: head of the stack - -Function un.RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - - IntFmt $6 "%c" 26 # DOS EOF - - Call un.IsNT - Pop $1 - StrCmp $1 1 unRemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=%PATH%;$0" - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoop: - FileRead $1 $3 - StrCpy $5 $3 1 -1 # read last char - StrCmp $5 $6 0 +2 # if DOS EOF - StrCpy $3 $3 -1 # remove DOS EOF so we can compare - StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "" unRemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto unRemoveFromPath_dosLoop - unRemoveFromPath_dosLoopRemoveLine: - SetRebootFlag true - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto unRemoveFromPath_done - - unRemoveFromPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto unDoTrim - unReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - unDoTrim: - StrCpy $5 $1 1 -1 # copy last char - StrCmp $5 ";" +2 # if last char != ; - StrCpy $1 "$1;" # append ; - Push $1 - Push "$0;" - Call un.StrStr ; Find `$0;` in $1 - Pop $2 ; pos of our dir - StrCmp $2 "" unRemoveFromPath_done - ; else, it is in path - # $0 - path to add - # $1 - path var - StrLen $3 "$0;" - StrLen $4 $2 - StrCpy $5 $1 -$4 # $5 is now the part before the path to remove - StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove - StrCpy $3 $5$6 - - StrCpy $5 $3 1 -1 # copy last char - StrCmp $5 ";" 0 +2 # if last char == ; - StrCpy $3 $3 -1 # remove last char - - StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $3 - Goto unDoSend - unWriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $3 - unDoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - unRemoveFromPath_done: - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Uninstall sutff -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -########################################### -# Utility Functions # -########################################### - -;==================================================== -; IsNT - Returns 1 if the current system is NT, 0 -; otherwise. -; Output: head of the stack -;==================================================== -; IsNT -; no input -; output, top of the stack = 1 if NT or 0 if not -; -; Usage: -; Call IsNT -; Pop $R0 -; ($R0 at this point is 1 or 0) - -!macro IsNT un -Function ${un}IsNT - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." - -; StrStr -; input, top of stack = string to search for -; top of stack-1 = string to search in -; output, top of stack (replaces with the portion of the string remaining) -; modifies no other variables. -; -; Usage: -; Push "this is a long ass string" -; Push "ass" -; Call StrStr -; Pop $R0 -; ($R0 at this point is "ass string") - -!macro StrStr un -Function ${un}StrStr -Exch $R1 ; st=haystack,old$R1, $R1=needle - Exch ; st=old$R1,haystack - Exch $R2 ; st=old$R1,old$R2, $R2=haystack - Push $R3 - Push $R4 - Push $R5 - StrLen $R3 $R1 - StrCpy $R4 0 - ; $R1=needle - ; $R2=haystack - ; $R3=len(needle) - ; $R4=cnt - ; $R5=tmp - loop: - StrCpy $R5 $R2 $R3 $R4 - StrCmp $R5 $R1 done - StrCmp $R5 "" done - IntOp $R4 $R4 + 1 - Goto loop -done: - StrCpy $R1 $R2 "" $R4 - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Exch $R1 -FunctionEnd -!macroend -!insertmacro StrStr "" -!insertmacro StrStr "un." - -Function Trim ; Added by Pelaca - Exch $R1 - Push $R2 -Loop: - StrCpy $R2 "$R1" 1 -1 - StrCmp "$R2" " " RTrim - StrCmp "$R2" "$\n" RTrim - StrCmp "$R2" "$\r" RTrim - StrCmp "$R2" ";" RTrim - GoTo Done -RTrim: - StrCpy $R1 "$R1" -1 - Goto Loop -Done: - Pop $R2 - Exch $R1 -FunctionEnd - -Function ConditionalAddToRegisty - Pop $0 - Pop $1 - StrCmp "$0" "" ConditionalAddToRegisty_EmptyString - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ - "$1" "$0" - ;MessageBox MB_OK "Set Registry: '$1' to '$0'" - DetailPrint "Set install registry entry: '$1' to '$0'" - ConditionalAddToRegisty_EmptyString: -FunctionEnd - -;-------------------------------- - -!ifdef CPACK_USES_DOWNLOAD -Function DownloadFile - IfFileExists $INSTDIR\* +2 - CreateDirectory $INSTDIR - Pop $0 - - ; Skip if already downloaded - IfFileExists $INSTDIR\$0 0 +2 - Return - - StrCpy $1 "@CPACK_DOWNLOAD_SITE@" - - try_again: - NSISdl::download "$1/$0" "$INSTDIR\$0" - - Pop $1 - StrCmp $1 "success" success - StrCmp $1 "Cancelled" cancel - MessageBox MB_OK "Download failed: $1" - cancel: - Return - success: -FunctionEnd -!endif - -;-------------------------------- -; Installation types -@CPACK_NSIS_INSTALLATION_TYPES@ - -;-------------------------------- -; Component sections -@CPACK_NSIS_COMPONENT_SECTIONS@ - -;-------------------------------- -; Define some macro setting for the gui -@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ -@CPACK_NSIS_INSTALLER_ICON_CODE@ -@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ -@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ - -;-------------------------------- -;Pages - !insertmacro MUI_PAGE_WELCOME - - !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@" - Page custom InstallOptionsPage - !insertmacro MUI_PAGE_DIRECTORY - - ;Start Menu Folder Page Configuration - !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER - - @CPACK_NSIS_PAGE_COMPONENTS@ - - !insertmacro MUI_PAGE_INSTFILES - !insertmacro MUI_PAGE_FINISH - - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - -;-------------------------------- -;Languages - - !insertmacro MUI_LANGUAGE "English" ;first language is the default language - !insertmacro MUI_LANGUAGE "Albanian" - !insertmacro MUI_LANGUAGE "Arabic" - !insertmacro MUI_LANGUAGE "Basque" - !insertmacro MUI_LANGUAGE "Belarusian" - !insertmacro MUI_LANGUAGE "Bosnian" - !insertmacro MUI_LANGUAGE "Breton" - !insertmacro MUI_LANGUAGE "Bulgarian" - !insertmacro MUI_LANGUAGE "Croatian" - !insertmacro MUI_LANGUAGE "Czech" - !insertmacro MUI_LANGUAGE "Danish" - !insertmacro MUI_LANGUAGE "Dutch" - !insertmacro MUI_LANGUAGE "Estonian" - !insertmacro MUI_LANGUAGE "Farsi" - !insertmacro MUI_LANGUAGE "Finnish" - !insertmacro MUI_LANGUAGE "French" - !insertmacro MUI_LANGUAGE "German" - !insertmacro MUI_LANGUAGE "Greek" - !insertmacro MUI_LANGUAGE "Hebrew" - !insertmacro MUI_LANGUAGE "Hungarian" - !insertmacro MUI_LANGUAGE "Icelandic" - !insertmacro MUI_LANGUAGE "Indonesian" - !insertmacro MUI_LANGUAGE "Irish" - !insertmacro MUI_LANGUAGE "Italian" - !insertmacro MUI_LANGUAGE "Japanese" - !insertmacro MUI_LANGUAGE "Korean" - !insertmacro MUI_LANGUAGE "Kurdish" - !insertmacro MUI_LANGUAGE "Latvian" - !insertmacro MUI_LANGUAGE "Lithuanian" - !insertmacro MUI_LANGUAGE "Luxembourgish" - !insertmacro MUI_LANGUAGE "Macedonian" - !insertmacro MUI_LANGUAGE "Malay" - !insertmacro MUI_LANGUAGE "Mongolian" - !insertmacro MUI_LANGUAGE "Norwegian" - !insertmacro MUI_LANGUAGE "Polish" - !insertmacro MUI_LANGUAGE "Portuguese" - !insertmacro MUI_LANGUAGE "PortugueseBR" - !insertmacro MUI_LANGUAGE "Romanian" - !insertmacro MUI_LANGUAGE "Russian" - !insertmacro MUI_LANGUAGE "Serbian" - !insertmacro MUI_LANGUAGE "SerbianLatin" - !insertmacro MUI_LANGUAGE "SimpChinese" - !insertmacro MUI_LANGUAGE "Slovak" - !insertmacro MUI_LANGUAGE "Slovenian" - !insertmacro MUI_LANGUAGE "Spanish" - !insertmacro MUI_LANGUAGE "Swedish" - !insertmacro MUI_LANGUAGE "Thai" - !insertmacro MUI_LANGUAGE "TradChinese" - !insertmacro MUI_LANGUAGE "Turkish" - !insertmacro MUI_LANGUAGE "Ukrainian" - !insertmacro MUI_LANGUAGE "Welsh" - - -;-------------------------------- -;Reserve Files - - ;These files should be inserted before other files in the data block - ;Keep these lines before any File command - ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) - - ReserveFile "NSIS.InstallOptions.ini" - !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - -;-------------------------------- -;Installer Sections - -Section "-Core installation" - ;Use the entire tree produced by the INSTALL target. Keep the - ;list of directories here in sync with the RMDir commands below. - SetOutPath "$INSTDIR" - @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@ - @CPACK_NSIS_FULL_INSTALL@ - - ;Store installation folder - WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR - - ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" - Push "DisplayName" - Push "@CPACK_NSIS_DISPLAY_NAME@" - Call ConditionalAddToRegisty - Push "DisplayVersion" - Push "@CPACK_PACKAGE_VERSION@" - Call ConditionalAddToRegisty - Push "Publisher" - Push "@CPACK_PACKAGE_VENDOR@" - Call ConditionalAddToRegisty - Push "UninstallString" - Push "$INSTDIR\Uninstall.exe" - Call ConditionalAddToRegisty - Push "NoRepair" - Push "1" - Call ConditionalAddToRegisty - - !ifdef CPACK_NSIS_ADD_REMOVE - ;Create add/remove functionality - Push "ModifyPath" - Push "$INSTDIR\AddRemove.exe" - Call ConditionalAddToRegisty - !else - Push "NoModify" - Push "1" - Call ConditionalAddToRegisty - !endif - - ; Optional registration - Push "DisplayIcon" - Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" - Call ConditionalAddToRegisty - Push "HelpLink" - Push "@CPACK_NSIS_HELP_LINK@" - Call ConditionalAddToRegisty - Push "URLInfoAbout" - Push "@CPACK_NSIS_URL_INFO_ABOUT@" - Call ConditionalAddToRegisty - Push "Contact" - Push "@CPACK_NSIS_CONTACT@" - Call ConditionalAddToRegisty - !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - - ;Create shortcuts - CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" -@CPACK_NSIS_CREATE_ICONS@ -@CPACK_NSIS_CREATE_ICONS_EXTRA@ - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" - - ;Read a value from an InstallOptions INI file - !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" - !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" - !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" - - ; Write special uninstall registry entries - Push "StartMenu" - Push "$STARTMENU_FOLDER" - Call ConditionalAddToRegisty - Push "DoNotAddToPath" - Push "$DO_NOT_ADD_TO_PATH" - Call ConditionalAddToRegisty - Push "AddToPathAllUsers" - Push "$ADD_TO_PATH_ALL_USERS" - Call ConditionalAddToRegisty - Push "AddToPathCurrentUser" - Push "$ADD_TO_PATH_CURRENT_USER" - Call ConditionalAddToRegisty - Push "InstallToDesktop" - Push "$INSTALL_DESKTOP" - Call ConditionalAddToRegisty - - !insertmacro MUI_STARTMENU_WRITE_END - -@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ - -SectionEnd - -Section "-Add to path" - Push $INSTDIR\bin - StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath - StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 - Call AddToPath - doNotAddToPath: -SectionEnd - -;-------------------------------- -; Create custom pages -Function InstallOptionsPage - !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" - -FunctionEnd - -;-------------------------------- -; determine admin versus local install -Function un.onInit - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - Goto done - StrCmp $1 "Power" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - Goto done - - noLM: - ;Get installation folder from registry if available - - done: - -FunctionEnd - -;--- Add/Remove callback functions: --- -!macro SectionList MacroName - ;This macro used to perform operation on multiple sections. - ;List all of your components in following manner here. -@CPACK_NSIS_COMPONENT_SECTION_LIST@ -!macroend - -Section -FinishComponents - ;Removes unselected components and writes component status to registry - !insertmacro SectionList "FinishSection" - -!ifdef CPACK_NSIS_ADD_REMOVE - ; Get the name of the installer executable - System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' - StrCpy $R3 $R0 - - ; Strip off the last 13 characters, to see if we have AddRemove.exe - StrLen $R1 $R0 - IntOp $R1 $R0 - 13 - StrCpy $R2 $R0 13 $R1 - StrCmp $R2 "AddRemove.exe" addremove_installed - - ; We're not running AddRemove.exe, so install it - CopyFiles $R3 $INSTDIR\AddRemove.exe - - addremove_installed: -!endif -SectionEnd -;--- End of Add/Remove callback functions --- - -;-------------------------------- -; Component dependencies -Function .onSelChange - !insertmacro SectionList MaybeSelectionChanged -FunctionEnd - -;-------------------------------- -;Uninstaller Section - -Section "Uninstall" - ReadRegStr $START_MENU SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu" - ;MessageBox MB_OK "Start menu is in: $START_MENU" - ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath" - ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers" - ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser" - ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" - ReadRegStr $INSTALL_DESKTOP SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop" - ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " - -@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ - - ;Remove files we installed. - ;Keep the list of directories here in sync with the File commands above. -@CPACK_NSIS_DELETE_FILES@ -@CPACK_NSIS_DELETE_DIRECTORIES@ - -!ifdef CPACK_NSIS_ADD_REMOVE - ;Remove the add/remove program - Delete "$INSTDIR\AddRemove.exe" -!endif - - ;Remove the uninstaller itself. - Delete "$INSTDIR\Uninstall.exe" - DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - ;Remove the installation directory if it is empty. - RMDir "$INSTDIR" - - ; Remove the registry entries. - DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - ; Removes all optional components - !insertmacro SectionList "RemoveSection_CPack" - - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" -@CPACK_NSIS_DELETE_ICONS@ -@CPACK_NSIS_DELETE_ICONS_EXTRA@ - - ;Delete empty start menu parent diretories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - startMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors startMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop - startMenuDeleteLoopDone: - - ; If the user changed the shortcut, then untinstall may not work. This should - ; try to fix it. - StrCpy $MUI_TEMP "$START_MENU" - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" -@CPACK_NSIS_DELETE_ICONS_EXTRA@ - - ;Delete empty start menu parent diretories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - secondStartMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors secondStartMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop - secondStartMenuDeleteLoopDone: - - DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - Push $INSTDIR\bin - StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 - Call un.RemoveFromPath - doNotRemoveFromPath: -SectionEnd - -;-------------------------------- -; determine admin versus local install -; Is install for "AllUsers" or "JustMe"? -; Default to "JustMe" - set to "AllUsers" if admin or on Win9x -; This function is used for the very first "custom page" of the installer. -; This custom page does not show up visibly, but it executes prior to the -; first visible page and sets up $INSTDIR properly... -; Choose different default installation folder based on SV_ALLUSERS... -; "Program Files" for AllUsers, "My Documents" for JustMe... - -Function .onInit - StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst - - ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString" - StrCmp $0 "" inst - - MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ - "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \ - IDYES uninst IDNO inst - Abort - -;Run the uninstaller -uninst: - ClearErrors - StrLen $2 "\Uninstall.exe" - StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path - ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file - - IfErrors uninst_failed inst -uninst_failed: - MessageBox MB_OK|MB_ICONSTOP "Uninstall failed." - Abort - - -inst: - ; Reads components status for registry - !insertmacro SectionList "InitSection" - - ; check to see if /D has been used to change - ; the install directory by comparing it to the - ; install directory that is expected to be the - ; default - StrCpy $IS_DEFAULT_INSTALLDIR 0 - StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 - StrCpy $IS_DEFAULT_INSTALLDIR 1 - - StrCpy $SV_ALLUSERS "JustMe" - ; if default install dir then change the default - ; if it is installed for JustMe - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +4 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - StrCmp $1 "Power" 0 +4 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - - noLM: - StrCpy $SV_ALLUSERS "AllUsers" - ;Get installation folder from registry if available - - done: - StrCmp $SV_ALLUSERS "AllUsers" 0 +3 - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - - StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" - - noOptionsPage: -FunctionEnd diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 85015a3..e8a5029 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -63,7 +63,7 @@ set (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libr set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE) -SET_PROPERTY(CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) +set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE) diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake deleted file mode 100644 index 579d855..0000000 --- a/config/cmake/grepTest.cmake +++ /dev/null @@ -1,64 +0,0 @@ -# grepTest.cmake executes a command and captures the output in a file. File is then compared -# against a reference file. Exit status of command can also be compared. - -# arguments checking -if (NOT TEST_PROGRAM) - message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) -if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) -if (NOT TEST_OUTPUT) - message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) -#if (NOT TEST_EXPECT) -# message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) -if (NOT TEST_FILTER) - message (STATUS "Require TEST_FILTER to be defined") -endif (NOT TEST_FILTER) -if (NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_REFERENCE) - -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") - -# run the test program, capture the stdout/stderr and the result var -EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_ERROR - ERROR_VARIABLE TEST_ERROR -) - -message (STATUS "COMMAND Result: ${TEST_RESULT}") -message (STATUS "COMMAND Error: ${TEST_ERROR}") - -# now grep the output with the reference -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - -# TEST_REFERENCE should always be matched -STRING(REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) -STRING(COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) -if (${TEST_RESULT} STREQUAL "0") - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") -endif (${TEST_RESULT} STREQUAL "0") - -STRING(REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) -if (${TEST_EXPECT} STREQUAL "1") - # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match - STRING(LENGTH "${TEST_MATCH}" TEST_RESULT) - if (NOT ${TEST_RESULT} STREQUAL "0") - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") - endif (NOT ${TEST_RESULT} STREQUAL "0") -endif (${TEST_EXPECT} STREQUAL "1") - -# everything went fine... -message ("Passed: The output of ${TEST_PROGRAM} matched") - diff --git a/config/cmake/hdf.bmp b/config/cmake/hdf.bmp Binary files differdeleted file mode 100644 index 9e9e4aa..0000000 --- a/config/cmake/hdf.bmp +++ /dev/null diff --git a/config/cmake/hdf.icns b/config/cmake/hdf.icns Binary files differdeleted file mode 100644 index 22afa2e..0000000 --- a/config/cmake/hdf.icns +++ /dev/null diff --git a/config/cmake/hdf.ico b/config/cmake/hdf.ico Binary files differdeleted file mode 100644 index 26abc96..0000000 --- a/config/cmake/hdf.ico +++ /dev/null diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 1beef2b..2913f32 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -62,7 +62,8 @@ set (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libr set (HDF5_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE) -set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE) +set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE) +set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE) diff --git a/config/cmake/prunTest.cmake b/config/cmake/prunTest.cmake deleted file mode 100644 index 3d5ec31..0000000 --- a/config/cmake/prunTest.cmake +++ /dev/null @@ -1,145 +0,0 @@ -# runTest.cmake executes a command and captures the output in a file. File is then compared -# against a reference file. Exit status of command can also be compared. -cmake_policy(SET CMP0007 NEW) - -# arguments checking -if (NOT TEST_PROGRAM) - message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) -if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) -if (NOT TEST_OUTPUT) - message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) -#if (NOT TEST_EXPECT) -# message (STATUS "Require TEST_EXPECT to be defined") -#endif (NOT TEST_EXPECT) -#if (NOT TEST_FILTER) -# message (STATUS "Require TEST_FILTER to be defined") -#endif (NOT TEST_FILTER) -if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - -set (ERROR_APPEND 1) - -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") - -if (TEST_ENV_VAR) - set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") -endif (TEST_ENV_VAR) - -# run the test program, capture the stdout/stderr and the result var -EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_ERROR - ERROR_VARIABLE TEST_ERROR -) - -message (STATUS "COMMAND Result: ${TEST_RESULT}") - -file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) -file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") - -if (ERROR_APPEND) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND) - -if (TEST_APPEND) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_ERROR}\n") -endif (TEST_APPEND) - -message (STATUS "COMMAND Error: ${TEST_ERROR}") - -if (TEST_MASK) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage: <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK) - -if (TEST_MASK_MOD) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK_MOD) - -if (TEST_MASK_ERROR) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK_ERROR) - -if (TEST_FILTER) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_FILTER) - -#if (TEST_REF_FILTER) -# message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") -# file (READ ${TEST_FOLDER}/P_${TEST_REFERENCE} TEST_STREAM) -# STRING(REGEX REPLACE "${TEST_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") -# file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") -#endif (TEST_REF_FILTER) - -if (NOT TEST_SKIP_COMPARE) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/P_${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) - - # now compare the output with the reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/P_${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - LIST (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/P_${TEST_REFERENCE} test_ref) - LIST (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - LIST (GET test_act ${line} str_act) - LIST (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) - - message (STATUS "COMPARE Result: ${TEST_RESULT}") - - # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match P_${TEST_REFERENCE}") - endif (NOT ${TEST_RESULT} STREQUAL 0) -endif (NOT TEST_SKIP_COMPARE) - -# everything went fine... -message ("Passed: The output of ${TEST_PROGRAM} matches P_${TEST_REFERENCE}") - diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake deleted file mode 100644 index 879426c..0000000 --- a/config/cmake/runTest.cmake +++ /dev/null @@ -1,193 +0,0 @@ -# runTest.cmake executes a command and captures the output in a file. File is then compared -# against a reference file. Exit status of command can also be compared. -cmake_policy(SET CMP0007 NEW) - -# arguments checking -if (NOT TEST_PROGRAM) - message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif (NOT TEST_PROGRAM) -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif (NOT TEST_ARGS) -if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") -endif (NOT TEST_FOLDER) -if (NOT TEST_OUTPUT) - message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif (NOT TEST_OUTPUT) -if (NOT TEST_EXPECT) - message (STATUS "Require TEST_EXPECT to be defined") -endif (NOT TEST_EXPECT) -#if (NOT TEST_FILTER) -# message (STATUS "Require TEST_FILTER to be defined") -#endif (NOT TEST_FILTER) -if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - -if (NOT TEST_ERRREF) - set (ERROR_APPEND 1) -endif (NOT TEST_ERRREF) - -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") - -if (TEST_ENV_VAR) - set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") -endif (TEST_ENV_VAR) - -# run the test program, capture the stdout/stderr and the result var -EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_ERROR - ERROR_VARIABLE TEST_ERROR -) - -message (STATUS "COMMAND Result: ${TEST_RESULT}") - -if (ERROR_APPEND) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND) - -if (TEST_APPEND) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") -endif (TEST_APPEND) - -# if the return value is !=${TEST_EXPECT} bail out -if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) - message ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") -endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) - -message (STATUS "COMMAND Error: ${TEST_ERROR}") - -if (TEST_MASK) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage: <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK) - -if (TEST_MASK_MOD) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_MASK_MOD) - -if (TEST_MASK_ERROR) - if (NOT TEST_ERRREF) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - else (NOT TEST_ERRREF) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - endif (NOT TEST_ERRREF) - STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - if (NOT TEST_ERRREF) - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else (NOT TEST_ERRREF) - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif (NOT TEST_ERRREF) -endif (TEST_MASK_ERROR) - -if (TEST_FILTER) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (TEST_FILTER) - -if (NOT TEST_SKIP_COMPARE) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) - - # now compare the output with the reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - LIST (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - LIST (LENGTH test_ref len_ref) - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - LIST (GET test_act ${line} str_act) - LIST (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) - - message (STATUS "COMPARE Result: ${TEST_RESULT}") - - # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") - endif (NOT ${TEST_RESULT} STREQUAL 0) - - if (TEST_ERRREF) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") - endif (WIN32 AND NOT MINGW) - - # now compare the error output with the error reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} - RESULT_VARIABLE TEST_RESULT - ) - if (NOT ${TEST_RESULT} STREQUAL 0) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) - LIST (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) - LIST (LENGTH test_ref len_ref) - MATH (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0") - MATH (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - LIST (GET test_act ${line} str_act) - LIST (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif (NOT "${str_act}" STREQUAL "") - endif (NOT "${str_act}" STREQUAL "${str_ref}") - endforeach (line RANGE 0 ${_FP_LEN}) - endif (NOT ${len_act} STREQUAL "0") - if (NOT ${len_act} STREQUAL ${len_ref}) - set (TEST_RESULT 1) - endif (NOT ${len_act} STREQUAL ${len_ref}) - endif (NOT ${TEST_RESULT} STREQUAL 0) - - message (STATUS "COMPARE Result: ${TEST_RESULT}") - - # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) - message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") - endif (NOT ${TEST_RESULT} STREQUAL 0) - endif (TEST_ERRREF) -endif (NOT TEST_SKIP_COMPARE) - -# everything went fine... -message ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}") diff --git a/config/cmake/version.plist.in b/config/cmake/version.plist.in deleted file mode 100644 index 817d89e..0000000 --- a/config/cmake/version.plist.in +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> - -<plist version="1.0"> -<dict> - <key>BuildVersion</key> - <string>@CPACK_PACKAGE_VERSION_MAJOR@</string> - <key>CFBundleShortVersionString</key> - <string>@CPACK_APPLE_GUI_SHORT_VERSION_STRING@</string> - <key>CFBundleVersion</key> - <string>@CPACK_APPLE_GUI_SHORT_VERSION_STRING@</string> - <key>ProjectName</key> - <string>@CPACK_APPLE_GUI_BUNDLE_NAME@</string> - <key>SourceVersion</key> - <string>@CPACK_PACKAGE_VERSION_MINOR@</string> -</dict> -</plist> diff --git a/config/gnu-flags b/config/gnu-flags index b965bf0..5f36eaa 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -186,10 +186,86 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# Closer to the gcc 4.9 release, we should check for additional flags to +# Closer to the gcc 4.10 release, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-4.[89]*) + gcc-4.9*) + # Replace -ansi flag with -std=c99 flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" + + # Append warning flags + # Don't use the '-Wtraditional' flag, we're way past having K&R C code + # H5_CFLAGS="$H5_CFLAGS -Wtraditional" + # Don't use the '-Wtraditional-conversion' flag, there's too many warnings + # from GCC's assert macro + # H5_CFLAGS="$H5_CFLAGS -Wtraditional-conversion" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CFLAGS="$H5_CFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CFLAGS="$H5_CFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc4.0+ know about + H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CFLAGS="$H5_CFLAGS -Wsuggest-attribute=format" + + # Append more extra warning flags that only gcc 4.9+ know about + H5_CFLAGS="$H5_CFLAGS -Wdate-time -Wopenmp-simd" + + # Try out the new "stack protector" feature in gcc 4.1 + # (Strictly speaking this isn't really a "warning" flag, so it's added to + # the debugging flags) + #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + ;; + + gcc-4.8*) # Replace -ansi flag with -std=c99 flag H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" @@ -617,7 +693,7 @@ case "$cc_vendor-$cc_version" in #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" ;; - gcc-4.1*) + gcc-4.1.*) # Replace -ansi flag with -std=c99 flag H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" diff --git a/config/lt_vers.am b/config/lt_vers.am index 80dca85..5537f6f 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 168 +LT_VERS_REVISION = 174 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.178-swmr0. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.184-swmr0. # # Report bugs to <help@hdfgroup.org>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.178-swmr0' -PACKAGE_STRING='HDF5 1.9.178-swmr0' +PACKAGE_VERSION='1.9.184-swmr0' +PACKAGE_STRING='HDF5 1.9.184-swmr0' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1487,7 +1487,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.178-swmr0 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.184-swmr0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1557,7 +1557,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.178-swmr0:";; + short | recursive ) echo "Configuration of HDF5 1.9.184-swmr0:";; esac cat <<\_ACEOF @@ -1755,7 +1755,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.178-swmr0 +HDF5 configure 1.9.184-swmr0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2849,7 +2849,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.178-swmr0, which was +It was created by HDF5 $as_me 1.9.184-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3720,7 +3720,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.178-swmr0' + VERSION='1.9.184-swmr0' cat >>confdefs.h <<_ACEOF @@ -27284,7 +27284,7 @@ _ACEOF fi done -for ac_func in tmpfile vasprintf waitpid +for ac_func in tmpfile asprintf vasprintf waitpid do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -31702,7 +31702,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -HDF5 config.lt 1.9.178-swmr0 +HDF5 config.lt 1.9.184-swmr0 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33836,7 +33836,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.178-swmr0, which was +This file was extended by HDF5 $as_me 1.9.184-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33902,7 +33902,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.178-swmr0 +HDF5 config.status 1.9.184-swmr0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 10d19bb..407a0ce6 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.178-swmr0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.184-swmr0], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -2197,7 +2197,7 @@ AC_CHECK_FUNCS([gethostname getpwuid getrusage lstat]) AC_CHECK_FUNCS([rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) -AC_CHECK_FUNCS([tmpfile vasprintf waitpid]) +AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) ## Check for vsnprintf() separately, so we can detect situations where it ## doesn't return the correct size for formatted strings that are too large diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index fe8216d..4cd72a0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_EXAMPLES) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Define Sources diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 98e5ff6..cd354c7 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -418,18 +418,18 @@ nh5pset_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue) /****if* H5Pf/h5pset_fill_value_c * NAME - * h5pset_fill_value_c + * h5pset_fill_value_c * PURPOSE - * Call H5Pset_fill_value to set a fillvalue for a dataset + * 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 + * 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 + * 0 on success, -1 on failure * AUTHOR * Elena Pourmal - * Saturday, August 14, 1999 + * Saturday, August 14, 1999 * SOURCE */ int_f @@ -445,7 +445,7 @@ nh5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue) * Call H5Pset_fill_value function. */ c_prp_id = (hid_t)*prp_id; - c_type_id = (int)*type_id; + c_type_id = (hid_t)*type_id; ret = H5Pset_fill_value(c_prp_id, c_type_id, fillvalue); if (ret < 0) return ret_value; diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index dcfcfc4..05e525d 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -460,13 +460,13 @@ nh5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, /* * H5FD flags of type hid_t */ - h5fd_hid_flags[0] = (int_f)H5FD_CORE; - h5fd_hid_flags[1] = (int_f)H5FD_FAMILY; - h5fd_hid_flags[2] = (int_f)H5FD_LOG; - h5fd_hid_flags[3] = (int_f)H5FD_MPIO; - h5fd_hid_flags[4] = (int_f)H5FD_MULTI; - h5fd_hid_flags[5] = (int_f)H5FD_SEC2; - h5fd_hid_flags[6] = (int_f)H5FD_STDIO; + h5fd_hid_flags[0] = (hid_t_f)H5FD_CORE; + h5fd_hid_flags[1] = (hid_t_f)H5FD_FAMILY; + h5fd_hid_flags[2] = (hid_t_f)H5FD_LOG; + h5fd_hid_flags[3] = (hid_t_f)H5FD_MPIO; + h5fd_hid_flags[4] = (hid_t_f)H5FD_MULTI; + h5fd_hid_flags[5] = (hid_t_f)H5FD_SEC2; + h5fd_hid_flags[6] = (hid_t_f)H5FD_STDIO; /* * H5G flags diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 6e4772d..7fa1861 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -733,7 +733,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 168 +LT_VERS_REVISION = 174 LT_VERS_AGE = 0 AM_FCLIBS = $(LIBHDF5) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 17c55a5..28b2ae1 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -83,7 +83,6 @@ set_target_properties (testhdf5_fortran PROPERTIES FOLDER test/fortran) #-- Adding test for testhdf5_fortran_1_8 add_executable (testhdf5_fortran_1_8 fortranlib_test_1_8.f90 - tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 @@ -107,7 +106,6 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES FOLDER test/fortran) if (HDF5_ENABLE_F2003) add_executable (fortranlib_test_F03 fortranlib_test_F03.f90 - tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 9c6b906..c0b5395 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -63,11 +63,11 @@ fortranlib_test_CFLAGS=$(AM_CFLAGS) fortranlib_test_SOURCES = tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 tH5VL.f90 tH5Z.f90 \ tH5Sselect.f90 tH5P.f90 tH5A.f90 tH5I.f90 tH5G.f90 tH5E.f90 tHDF5.f90 fortranlib_test.f90 -fortranlib_test_1_8_SOURCES = tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 tH5MISC_1_8.f90 tHDF5_1_8.f90\ +fortranlib_test_1_8_SOURCES = tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 tH5MISC_1_8.f90 tHDF5_1_8.f90\ fortranlib_test_1_8.f90 if FORTRAN_2003_CONDITIONAL_F - fortranlib_test_F03_SOURCES = tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 \ + fortranlib_test_F03_SOURCES = tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 \ tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 tHDF5_F03.f90 fortranlib_test_F03.f90 endif diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index bd1d01d..89db8f4 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -138,18 +138,17 @@ fortranlib_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(FCLD) \ $(fortranlib_test_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ -am_fortranlib_test_1_8_OBJECTS = tH5F.$(OBJEXT) tH5O.$(OBJEXT) \ - tH5A_1_8.$(OBJEXT) tH5G_1_8.$(OBJEXT) tH5MISC_1_8.$(OBJEXT) \ - tHDF5_1_8.$(OBJEXT) fortranlib_test_1_8.$(OBJEXT) +am_fortranlib_test_1_8_OBJECTS = tH5O.$(OBJEXT) tH5A_1_8.$(OBJEXT) \ + tH5G_1_8.$(OBJEXT) tH5MISC_1_8.$(OBJEXT) tHDF5_1_8.$(OBJEXT) \ + fortranlib_test_1_8.$(OBJEXT) fortranlib_test_1_8_OBJECTS = $(am_fortranlib_test_1_8_OBJECTS) fortranlib_test_1_8_LDADD = $(LDADD) fortranlib_test_1_8_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \ $(LIBH5F) $(LIBHDF5) -am__fortranlib_test_F03_SOURCES_DIST = tH5F.f90 tH5E_F03.f90 \ - tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 \ - tH5T_F03.f90 tHDF5_F03.f90 fortranlib_test_F03.f90 +am__fortranlib_test_F03_SOURCES_DIST = tH5E_F03.f90 tH5F_F03.f90 \ + tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 \ + tHDF5_F03.f90 fortranlib_test_F03.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@am_fortranlib_test_F03_OBJECTS = \ -@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5E_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5L_F03.$(OBJEXT) \ @@ -749,10 +748,10 @@ fortranlib_test_CFLAGS = $(AM_CFLAGS) fortranlib_test_SOURCES = tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 tH5VL.f90 tH5Z.f90 \ tH5Sselect.f90 tH5P.f90 tH5A.f90 tH5I.f90 tH5G.f90 tH5E.f90 tHDF5.f90 fortranlib_test.f90 -fortranlib_test_1_8_SOURCES = tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 tH5MISC_1_8.f90 tHDF5_1_8.f90\ +fortranlib_test_1_8_SOURCES = tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 tH5MISC_1_8.f90 tHDF5_1_8.f90\ fortranlib_test_1_8.f90 -@FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 tHDF5_F03.f90 fortranlib_test_F03.f90 fflush1_SOURCES = fflush1.f90 diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90 index 66f799b..039dc6c 100644 --- a/fortran/test/fortranlib_test_1_8.f90 +++ b/fortran/test/fortranlib_test_1_8.f90 @@ -58,10 +58,10 @@ PROGRAM fortranlibtest ENDIF WRITE(*,*) - ret_total_error = 0 - CALL file_space("file_space_1_8",cleanup, ret_total_error) - CALL write_test_status(ret_total_error, & - ' Testing file free space', & + CALL h5eset_auto_f(0, ret_total_error) + IF(ret_total_error.NE.0) & + CALL write_test_status(ret_total_error, & + ' h5eset_auto_f', & total_error) ret_total_error = 0 diff --git a/fortran/test/tH5MISC_1_8.f90 b/fortran/test/tH5MISC_1_8.f90 index bb7d50a..efc350e 100644 --- a/fortran/test/tH5MISC_1_8.f90 +++ b/fortran/test/tH5MISC_1_8.f90 @@ -257,7 +257,7 @@ SUBROUTINE test_h5s_encode(cleanup, total_error) ! /* Verify the decoded dataspace */ CALL h5sget_simple_extent_npoints_f(decoded_sid1, n, error) CALL check("h5sget_simple_extent_npoints_f", error, total_error) - CALL VERIFY("h5sget_simple_extent_npoints_f", INT(n), SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, & + CALL VERIFY("h5sget_simple_extent_npoints_f", INT(n), INT(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3), & total_error) ! diff --git a/fortran/test/tHDF5_1_8.f90 b/fortran/test/tHDF5_1_8.f90 index 47eec16..9d1c3ec 100644 --- a/fortran/test/tHDF5_1_8.f90 +++ b/fortran/test/tHDF5_1_8.f90 @@ -33,6 +33,5 @@ MODULE THDF5_1_8 USE TH5MISC_1_8 USE TH5A_1_8 USE TH5G_1_8 - USE TH5F USE TH5O END MODULE THDF5_1_8 diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 22c0770..e693dd7 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_HL C CXX) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Shared Libs diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index bb1a659..a0b19aa 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -674,7 +674,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 168 +LT_VERS_REVISION = 174 LT_VERS_AGE = 0 # This is our main target diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index b1c6334..0431cef 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -689,7 +689,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 168 +LT_VERS_REVISION = 174 LT_VERS_AGE = 0 # Our main target, the high-level fortran library diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 99860b8..2ed379a 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -27,14 +27,14 @@ *------------------------------------------------------------------------- */ -static int H5TB_find_field(const char *field, +static hbool_t H5TB_find_field(const char *field, const char *field_list); static herr_t H5TB_attach_attributes(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields, - hid_t tid ); + hid_t tid); static hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, @@ -64,13 +64,9 @@ static hid_t H5TB_create_type(hid_t loc_id, * * Comments: * -* Modifications: -* *------------------------------------------------------------------------- */ - - -herr_t H5TBmake_table( const char *table_title, +herr_t H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields, @@ -82,86 +78,80 @@ herr_t H5TBmake_table( const char *table_title, hsize_t chunk_size, void *fill_data, int compress, - const void *buf ) + const void *buf) { - - hid_t did; - hid_t sid; - hid_t mem_type_id; - hid_t plist_id; + hid_t did = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t mem_type_id = H5I_BADID; + hid_t plist_id = H5I_BADID; + hid_t attr_id = H5I_BADID; hsize_t dims[1]; hsize_t dims_chunk[1]; - hsize_t maxdims[1] = { H5S_UNLIMITED }; + hsize_t maxdims[1] = {H5S_UNLIMITED}; char attr_name[255]; - char *member_name; - hid_t attr_id; - char aux[255]; + char *member_name = NULL; + unsigned char *tmp_buf = NULL; hsize_t i; - unsigned char *tmp_buf; + herr_t ret_val = -1; dims[0] = nrecords; dims_chunk[0] = chunk_size; /* create the memory data type. */ - if ((mem_type_id = H5Tcreate (H5T_COMPOUND, type_size )) < 0) - return -1; + if((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) + goto out; /* insert fields. */ - for ( i = 0; i < nfields; i++) - { + for(i = 0; i < nfields; i++) if(H5Tinsert(mem_type_id, field_names[i], field_offset[i], field_types[i] ) < 0) - return -1; - } + goto out; /* create a simple data space with unlimited size */ - if ((sid = H5Screate_simple( 1, dims, maxdims )) < 0) - return -1; + if((sid = H5Screate_simple(1, dims, maxdims)) < 0) + goto out; /* modify dataset creation properties, i.e. enable chunking */ - plist_id = H5Pcreate(H5P_DATASET_CREATE); - if (H5Pset_chunk(plist_id, 1, dims_chunk) < 0) - return -1; + if((plist_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if(H5Pset_chunk(plist_id, 1, dims_chunk) < 0) + goto out; /* set the fill value using a struct as the data type. */ - if (fill_data) - { + if(fill_data) if(H5Pset_fill_value(plist_id, mem_type_id, fill_data) < 0) - return -1; - } + goto out; /* dataset creation property list is modified to use GZIP compression with the compression effort set to 6. */ - if (compress) - { + if(compress) if(H5Pset_deflate(plist_id, 6) < 0) - return -1; - } + goto out; /* create the dataset. */ - if ((did = H5Dcreate2(loc_id, dset_name, mem_type_id, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(loc_id, dset_name, mem_type_id, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0) goto out; /* only write if there is something to write */ - if (buf) - { - /* Write data to the dataset. */ - if (H5Dwrite( did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0) + if(buf) + if(H5Dwrite(did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; - } /* terminate access to the data space. */ - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; + sid = H5I_BADID; /* end access to the dataset */ - if (H5Dclose(did) < 0) + if(H5Dclose(did) < 0) goto out; + did = H5I_BADID; /* end access to the property list */ - if (H5Pclose(plist_id) < 0) + if(H5Pclose(plist_id) < 0) goto out; + plist_id = H5I_BADID; /*------------------------------------------------------------------------- * set the conforming table attributes @@ -169,100 +159,97 @@ herr_t H5TBmake_table( const char *table_title, */ /* attach the CLASS attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, "CLASS", TABLE_CLASS ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", TABLE_CLASS) < 0) goto out; /* attach the VERSION attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, "VERSION", TABLE_VERSION ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, "VERSION", TABLE_VERSION) < 0) goto out; /* attach the TITLE attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, "TITLE", table_title ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, "TITLE", table_title) < 0) goto out; /* attach the FIELD_ name attribute */ - for ( i = 0; i < nfields; i++) - { + for(i = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name( mem_type_id,(unsigned) i ); + if(NULL == (member_name = H5Tget_member_name(mem_type_id, (unsigned)i))) + goto out; - strcpy( attr_name, "FIELD_" ); - sprintf( aux, "%d", (int)i ); - strcat( attr_name, aux ); - sprintf( aux, "%s", "_NAME" ); - strcat( attr_name, aux ); + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i); /* attach the attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0) goto out; - H5free_memory( member_name ); - - } + H5free_memory(member_name); + member_name = NULL; + } /* end for */ /* attach the FIELD_ fill value attribute */ - if (fill_data ) - { - - tmp_buf = (unsigned char *) fill_data; + if(fill_data) { + tmp_buf = (unsigned char *)fill_data; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; - - if (( sid = H5Screate(H5S_SCALAR)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; - for ( i = 0; i < nfields; i++) - { - - /* get the member name */ - member_name = H5Tget_member_name(mem_type_id, (unsigned)i); + if((sid = H5Screate(H5S_SCALAR)) < 0) + goto out; - strcpy(attr_name, "FIELD_"); - sprintf(aux, "%d", (int)i); - strcat(attr_name, aux); - sprintf(aux, "%s", "_FILL"); - strcat(attr_name, aux); + for(i = 0; i < nfields; i++) { + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i); - if ((attr_id = H5Acreate2(did, attr_name, field_types[i], sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((attr_id = H5Acreate2(did, attr_name, field_types[i], sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if (H5Awrite(attr_id, field_types[i], tmp_buf+field_offset[i]) < 0) + if(H5Awrite(attr_id, field_types[i], tmp_buf + field_offset[i]) < 0) goto out; - if (H5Aclose(attr_id) < 0) + if(H5Aclose(attr_id) < 0) goto out; - - H5free_memory(member_name); - } + attr_id = H5I_BADID; + } /* end for */ /* terminate access to the data space. */ - if (H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; + sid = H5I_BADID; /* end access to the dataset */ - if (H5Dclose(did) < 0) + if(H5Dclose(did) < 0) goto out; - } + did = H5I_BADID; + } /* end if */ /* release the datatype. */ - if (H5Tclose( mem_type_id ) < 0) - return -1; + if(H5Tclose(mem_type_id) < 0) + goto out; + mem_type_id = H5I_BADID; - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY { - H5Dclose(did); - H5Sclose(sid); - H5Pclose(plist_id); - H5Tclose(mem_type_id); - } H5E_END_TRY; - return -1; + if(member_name) + H5free_memory(member_name); + if(attr_id > 0) + if(H5Aclose(attr_id) < 0) + ret_val = -1; + if(plist_id > 0) + if(H5Pclose(plist_id) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; -} + return ret_val; +} /* end H5TBmake_table() */ /*------------------------------------------------------------------------- * @@ -286,70 +273,57 @@ out: * * Comments: Uses memory offsets * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define the memory type ID -* returned by H5TB_create_type -* *------------------------------------------------------------------------- */ - -herr_t H5TBappend_records( hid_t loc_id, +herr_t H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - const void *buf ) + const void *buf) { - hid_t did; - hid_t tid=-1; - hid_t mem_type_id=-1; - hid_t sid=-1; - hid_t m_sid=-1; + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t mem_type_id = H5I_BADID; hsize_t nrecords_orig; hsize_t nfields; + herr_t ret_val = -1; /* get the original number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords_orig ) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0) + goto out; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatypes */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid)) < 0) + if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0) goto out; /* append the records */ - if ((H5TB_common_append_records(did, mem_type_id, (size_t)nrecords, nrecords_orig, buf)) < 0) - goto out; - - /* close */ - if (H5Tclose( tid ) < 0) - return -1; - if (H5Tclose( mem_type_id ) < 0) - goto out; - if (H5Dclose( did ) < 0) + if((H5TB_common_append_records(did, mem_type_id, (size_t)nrecords, nrecords_orig, buf)) < 0) goto out; - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Tclose(mem_type_id); - H5Tclose(tid); - H5Sclose(m_sid); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBappend_records() */ /*------------------------------------------------------------------------- * Function: H5TBwrite_records @@ -364,96 +338,85 @@ out: * * Comments: Uses memory offsets * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define the memory type ID -* returned by H5TB_create_type -* *------------------------------------------------------------------------- */ - - -herr_t H5TBwrite_records( hid_t loc_id, +herr_t H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - const void *buf ) + const void *buf) { - - hid_t did; - hid_t tid; + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t m_sid = H5I_BADID; + hid_t mem_type_id = H5I_BADID; hsize_t count[1]; hsize_t offset[1]; - hid_t sid=-1; - hid_t m_sid=-1; hsize_t mem_size[1]; hsize_t dims[1]; - hid_t mem_type_id=-1; + herr_t ret_val = -1; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get the datatype */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid)) < 0) + if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0) goto out; /* get the dataspace handle */ - if ((sid = H5Dget_space( did )) < 0) + if((sid = H5Dget_space(did)) < 0) goto out; /* get records */ - if (H5Sget_simple_extent_dims( sid, dims, NULL) < 0) + if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) goto out; - if (start + nrecords > dims[0] ) + if(start + nrecords > dims[0]) goto out; /* define a hyperslab in the dataset of the size of the records */ offset[0] = start; count[0] = nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* create a memory dataspace handle */ mem_size[0] = count[0]; - if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0) - goto out; - - if (H5Dwrite( did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf ) < 0) + if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; - /* close */ - if (H5Sclose( m_sid ) < 0) - goto out; - if (H5Sclose( sid ) < 0) + if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0) goto out; - if (H5Tclose( tid ) < 0) - goto out; - if (H5Tclose( mem_type_id ) < 0) - return -1; - if (H5Dclose( did ) < 0) - return -1; - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Tclose(mem_type_id); - H5Tclose(tid); - H5Sclose(m_sid); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBwrite_records() */ /*------------------------------------------------------------------------- * Function: H5TBwrite_fields_name @@ -468,12 +431,9 @@ out: * * Comments: * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define a memory type ID -* *------------------------------------------------------------------------- */ -herr_t H5TBwrite_fields_name( hid_t loc_id, +herr_t H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -481,147 +441,139 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - const void *buf ) + const void *buf) { - hid_t did; - hid_t tid=-1; - hid_t write_type_id=-1; - hid_t member_type_id; - hid_t nmtype_id; - hsize_t count[1]; - hsize_t offset[1]; - hid_t m_sid=-1; - hid_t file_space_id=-1; - char *member_name; + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t write_type_id = H5I_BADID; + hid_t member_type_id = H5I_BADID; + hid_t nmtype_id = H5I_BADID; + hid_t m_sid = H5I_BADID; + hid_t file_space_id = H5I_BADID; + hid_t preserve_id = H5I_BADID; hssize_t nfields; hssize_t i, j; - hid_t preserve_id; + hsize_t count[1]; + hsize_t offset[1]; + char *member_name = NULL; size_t size_native; + herr_t ret_val = -1; /* create xfer properties to preserve initialized data */ - if ((preserve_id = H5Pcreate (H5P_DATASET_XFER)) < 0) - return -1; - if (H5Pset_preserve (preserve_id, 1) < 0) - return -1; + if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto out; + if(H5Pset_preserve(preserve_id, 1) < 0) + goto out; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; /* get the number of fields */ - if (( nfields = H5Tget_nmembers( tid )) < 0) + if((nfields = H5Tget_nmembers(tid)) < 0) goto out; /* create a write id */ - if (( write_type_id = H5Tcreate( H5T_COMPOUND, type_size )) < 0) + if((write_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) goto out; j = 0; - /* iterate tru the members */ - for ( i = 0; i < nfields; i++) - { + /* iterate though the members */ + for(i = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name( tid, (unsigned)i ); - - if(H5TB_find_field( member_name, field_names ) > 0 ) - { + if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)i))) + goto out; + if(H5TB_find_field(member_name, field_names)) { /* get the member type */ - if(( member_type_id = H5Tget_member_type( tid,(unsigned) i )) < 0) + if((member_type_id = H5Tget_member_type(tid, (unsigned)i)) < 0) goto out; /* convert to native type */ - if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) + if((nmtype_id = H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT)) < 0) goto out; - size_native=H5Tget_size(nmtype_id); + if(0 == (size_native = H5Tget_size(nmtype_id))) + goto out; /* adjust, if necessary */ - if (field_sizes[j]!=size_native) - { - if (H5Tset_size(nmtype_id, field_sizes[j]) < 0) + if(field_sizes[j] != size_native) + if(H5Tset_size(nmtype_id, field_sizes[j]) < 0) goto out; - } /* the field in the file is found by its name */ - if (field_offset ) - { - if (H5Tinsert( write_type_id, member_name, field_offset[j], nmtype_id ) < 0) + if(field_offset) { + if(H5Tinsert(write_type_id, member_name, field_offset[j], nmtype_id) < 0) goto out; - } + } /* end if */ /* only one field */ - else - { - if (H5Tinsert( write_type_id, member_name, (size_t)0, nmtype_id ) < 0) + else { + if(H5Tinsert(write_type_id, member_name, (size_t)0, nmtype_id) < 0) goto out; - } + } /* end else */ j++; /* close */ - if(H5Tclose( member_type_id ) < 0) + if(H5Tclose(member_type_id) < 0) goto out; - if(H5Tclose( nmtype_id ) < 0) + member_type_id = H5I_BADID; + if(H5Tclose(nmtype_id) < 0) goto out; - } - - H5free_memory( member_name ); + nmtype_id = H5I_BADID; + } /* end if */ - } + H5free_memory(member_name); + member_name = NULL; + } /* end for */ /* get the dataspace handle */ - if ((file_space_id = H5Dget_space( did )) < 0) + if((file_space_id = H5Dget_space(did)) < 0) goto out; - if ((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0) + if((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0) goto out; /* define a hyperslab in the dataset */ offset[0] = start; count[0] = nrecords; - if (H5Sselect_hyperslab( file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* write */ - if (H5Dwrite( did, write_type_id, m_sid, file_space_id, preserve_id, buf ) < 0) + if(H5Dwrite(did, write_type_id, m_sid, file_space_id, preserve_id, buf) < 0) goto out; - /* close */ - if(H5Tclose( write_type_id ) ) - goto out; - if(H5Tclose( tid ) < 0) - return -1; - if(H5Dclose( did ) < 0) - return -1; - if(H5Pclose( preserve_id ) < 0) - return -1; - if(H5Sclose( file_space_id ) < 0) - return -1; - if(H5Sclose( m_sid ) < 0) - return -1; - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Pclose(preserve_id); - H5Dclose(did); - H5Sclose(file_space_id); - H5Sclose(m_sid); - H5Tclose(write_type_id); - H5Tclose(tid); - } H5E_END_TRY; - return -1; - -} - + if(member_name) + H5free_memory(member_name); + if(preserve_id > 0) + if(H5Pclose(preserve_id) < 0) + ret_val = -1; + if(write_type_id > 0) + if(H5Tclose(write_type_id) < 0) + ret_val = -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(file_space_id > 0) + if(H5Sclose(file_space_id) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + return ret_val; +} /* end H5TBwrite_fields_name() */ /*------------------------------------------------------------------------- * Function: H5TBwrite_fields_index @@ -636,14 +588,9 @@ out: * * Comments: Uses memory offsets * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define a memory type ID -* *------------------------------------------------------------------------- */ - - -herr_t H5TBwrite_fields_index( hid_t loc_id, +herr_t H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -652,43 +599,43 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - const void *buf ) + const void *buf) { - hid_t did; - hid_t tid=-1; - hid_t write_type_id=-1; - hid_t member_type_id; - hid_t nmtype_id; + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t write_type_id = H5I_BADID; + hid_t member_type_id = H5I_BADID; + hid_t nmtype_id = H5I_BADID; + hid_t m_sid = H5I_BADID; + hid_t file_space_id = H5I_BADID; + hid_t preserve_id = H5I_BADID; hsize_t count[1]; hsize_t offset[1]; - hid_t m_sid=-1; - hid_t file_space_id=-1; - char *member_name; hsize_t i; - hid_t preserve_id; size_t size_native; + char *member_name = NULL; + herr_t ret_val = -1; /* create xfer properties to preserve initialized data */ - if ((preserve_id = H5Pcreate (H5P_DATASET_XFER)) < 0) - return -1; - if (H5Pset_preserve (preserve_id, 1) < 0) - return -1; + if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto out; + if(H5Pset_preserve(preserve_id, 1) < 0) + goto out; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; /* create a write id */ - if (( write_type_id = H5Tcreate( H5T_COMPOUND, type_size )) < 0) + if((write_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) goto out; /* iterate tru the members */ - for ( i = 0; i < nfields; i++) - { + for(i = 0; i < nfields; i++) { unsigned j; /* Range check value */ @@ -698,91 +645,95 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, j = (unsigned)field_index[i]; /* get the member name */ - member_name = H5Tget_member_name( tid, j ); + if(NULL == (member_name = H5Tget_member_name(tid, j))) + goto out; /* get the member type */ - if (( member_type_id = H5Tget_member_type( tid, j )) < 0) + if((member_type_id = H5Tget_member_type(tid, j)) < 0) goto out; /* convert to native type */ - if ((nmtype_id = H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) + if((nmtype_id = H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) goto out; - size_native = H5Tget_size(nmtype_id); + if(0 == (size_native = H5Tget_size(nmtype_id))) + goto out; - if (field_sizes[i]!=size_native) - { - if (H5Tset_size(nmtype_id, field_sizes[i]) < 0) + if(field_sizes[i] != size_native) + if(H5Tset_size(nmtype_id, field_sizes[i]) < 0) goto out; - } /* the field in the file is found by its name */ - if ( field_offset ) - { - if (H5Tinsert( write_type_id, member_name, field_offset[ i ], nmtype_id ) < 0) + if(field_offset) { + if(H5Tinsert(write_type_id, member_name, field_offset[i], nmtype_id) < 0) goto out; - } + } /* end if */ /* only one field */ - else - { - if (H5Tinsert( write_type_id, member_name, (size_t)0, nmtype_id ) < 0) + else { + if(H5Tinsert(write_type_id, member_name, (size_t)0, nmtype_id) < 0) goto out; - } + } /* end else */ + /* close */ - if(H5Tclose( member_type_id ) < 0) + if(H5Tclose(member_type_id) < 0) goto out; - if(H5Tclose( nmtype_id ) < 0) + member_type_id = H5I_BADID; + if(H5Tclose(nmtype_id) < 0) goto out; + nmtype_id = H5I_BADID; - H5free_memory( member_name ); - - } + H5free_memory(member_name); + member_name = NULL; + } /* end for */ /* get the dataspace handles */ - if ((file_space_id = H5Dget_space( did )) < 0) + if((file_space_id = H5Dget_space(did)) < 0) goto out; - if ((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0) + if((m_sid = H5Screate_simple(1, &nrecords, NULL)) < 0) goto out; /* define a hyperslab in the dataset */ offset[0] = start; count[0] = nrecords; - if (H5Sselect_hyperslab( file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* write */ - if (H5Dwrite( did, write_type_id, m_sid, file_space_id, preserve_id, buf ) < 0) + if(H5Dwrite(did, write_type_id, m_sid, file_space_id, preserve_id, buf) < 0) goto out; - /* close */ - if (H5Tclose( write_type_id ) ) - goto out; - if (H5Tclose( tid ) < 0) - return -1; - if (H5Dclose( did ) < 0) - return -1; - if (H5Pclose( preserve_id ) < 0) - return -1; - if (H5Sclose( file_space_id ) < 0) - return -1; - if (H5Sclose( m_sid ) < 0) - return -1; - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Pclose(preserve_id); - H5Dclose(did); - H5Sclose(file_space_id); - H5Sclose(m_sid); - H5Tclose(write_type_id); - H5Tclose(tid); - } H5E_END_TRY; - return -1; -} + if(member_name) + H5free_memory(member_name); + if(preserve_id > 0) + if(H5Pclose(preserve_id) < 0) + ret_val = -1; + if(write_type_id > 0) + if(H5Tclose(write_type_id) < 0) + ret_val = -1; + if(member_type_id > 0) + if(H5Tclose(member_type_id) < 0) + ret_val = -1; + if(nmtype_id > 0) + if(H5Tclose(nmtype_id) < 0) + ret_val = -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(file_space_id > 0) + if(H5Sclose(file_space_id) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBwrite_fields_index() */ /*------------------------------------------------------------------------- @@ -806,71 +757,63 @@ out: * * Comments: * -* Modifications: April 1, 2004 -* used a memory type ID returned by H5TB_create_type -* *------------------------------------------------------------------------- */ - -herr_t H5TBread_table( hid_t loc_id, +herr_t H5TBread_table(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - void *dst_buf ) + void *dst_buf) { - hid_t did; - hid_t ftype_id=-1; - hid_t mem_type_id=-1; - hid_t sid; + hid_t did = H5I_BADID; + hid_t ftype_id = H5I_BADID; + hid_t mem_type_id = H5I_BADID; + hid_t sid = H5I_BADID; hsize_t dims[1]; + herr_t ret_val = -1; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get the dataspace handle */ - if ((sid = H5Dget_space( did )) < 0) + if((sid = H5Dget_space(did)) < 0) goto out; /* get dimensions */ - if (H5Sget_simple_extent_dims( sid, dims, NULL) < 0) + if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) goto out; /* get the datatypes */ - if ((ftype_id=H5Dget_type (did)) < 0) + if((ftype_id = H5Dget_type (did)) < 0) goto out; - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,ftype_id)) < 0) + if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, ftype_id)) < 0) goto out; /* read */ - if (H5Dread( did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, dst_buf) < 0) - goto out; - - /* close */ - if (H5Tclose( ftype_id ) < 0) - goto out; - if (H5Tclose( mem_type_id ) < 0) - goto out; - if (H5Sclose( sid ) < 0) + if(H5Dread(did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, dst_buf) < 0) goto out; - if (H5Dclose( did ) < 0) - return -1; - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Tclose(mem_type_id); - H5Tclose(ftype_id); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; + if(ftype_id > 0) + if(H5Tclose(ftype_id) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBread_table() */ /*------------------------------------------------------------------------- * Function: H5TBread_records @@ -885,74 +828,58 @@ out: * * Comments: * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define the memory type ID -* returned by H5TB_create_type -* *------------------------------------------------------------------------- */ - - -herr_t H5TBread_records( hid_t loc_id, +herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - void *buf ) + void *buf) { - - hid_t did; - hid_t ftype_id; - hid_t mem_type_id=-1; - hid_t sid=-1; - hid_t m_sid=-1; + hid_t did = H5I_BADID; + hid_t ftype_id = H5I_BADID; + hid_t mem_type_id = H5I_BADID; hsize_t nrecords_orig; hsize_t nfields; + herr_t ret_val = -1; /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords_orig ) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0) + goto out; /* open the dataset */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get the datatypes */ - if ((ftype_id = H5Dget_type( did )) < 0) + if((ftype_id = H5Dget_type(did)) < 0) goto out; - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,ftype_id)) < 0) + if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, ftype_id)) < 0) goto out; /* read the records */ - if ((H5TB_common_read_records(did, mem_type_id, start, (size_t)nrecords, nrecords_orig, buf)) < 0) + if((H5TB_common_read_records(did, mem_type_id, start, (size_t)nrecords, nrecords_orig, buf)) < 0) goto out; - /* close */ - if (H5Tclose( ftype_id ) < 0) - return -1; - if (H5Tclose( mem_type_id ) < 0) - return -1; - if (H5Dclose( did ) < 0) - return -1; - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY { - H5Dclose(did); - H5Tclose(mem_type_id); - H5Tclose(ftype_id); - H5Sclose(m_sid); - H5Sclose(sid); - } H5E_END_TRY; - return -1; - -} + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; + if(ftype_id > 0) + if(H5Tclose(ftype_id) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + return ret_val; +} /* end H5TBread_records() */ /*------------------------------------------------------------------------- * Function: H5TBread_fields_name @@ -967,15 +894,9 @@ out: * * Comments: * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define the memory type ID -* returned by H5TB_create_type -* *------------------------------------------------------------------------- */ - - -herr_t H5TBread_fields_name( hid_t loc_id, +herr_t H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -983,132 +904,134 @@ herr_t H5TBread_fields_name( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - void *buf ) + void *buf) { - - hid_t did; - hid_t ftype_id=-1; - hid_t mem_type_id=-1; - hid_t mtype_id; - hid_t nmtype_id; - char *member_name; + hid_t did = H5I_BADID; + hid_t ftype_id = H5I_BADID; + hid_t mem_type_id = H5I_BADID; + hid_t mtype_id = H5I_BADID; + hid_t nmtype_id = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t m_sid = H5I_BADID; hssize_t nfields; hsize_t count[1]; hsize_t offset[1]; - hid_t sid=-1; - hid_t m_sid=-1; hsize_t mem_size[1]; size_t size_native; + char *member_name = NULL; hssize_t i, j; + herr_t ret_val = -1; /* open the dataset */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ - if ((ftype_id = H5Dget_type( did )) < 0) + if((ftype_id = H5Dget_type(did)) < 0) goto out; /* get the number of fields */ - if (( nfields = H5Tget_nmembers( ftype_id )) < 0) + if((nfields = H5Tget_nmembers(ftype_id)) < 0) goto out; /* create a memory read id */ - if (( mem_type_id = H5Tcreate( H5T_COMPOUND, type_size )) < 0) + if((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) goto out; /* iterate tru the members */ - for ( i=0,j=0; i<nfields; i++) - { + for(i = 0, j = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name( ftype_id, (unsigned)i ); + if(NULL == (member_name = H5Tget_member_name(ftype_id, (unsigned)i))) + goto out; - if(H5TB_find_field( member_name, field_names ) > 0 ) - { + if(H5TB_find_field(member_name, field_names)) { /* get the member type */ - if (( mtype_id = H5Tget_member_type( ftype_id, (unsigned) i )) < 0) + if((mtype_id = H5Tget_member_type(ftype_id, (unsigned)i)) < 0) goto out; /* convert to native type */ - if ((nmtype_id=H5Tget_native_type(mtype_id,H5T_DIR_DEFAULT)) < 0) + if((nmtype_id = H5Tget_native_type(mtype_id, H5T_DIR_DEFAULT)) < 0) goto out; - size_native=H5Tget_size(nmtype_id); + if(0 == (size_native = H5Tget_size(nmtype_id))) + goto out; - if (field_sizes[j]!=size_native) - { - if (H5Tset_size(nmtype_id, field_sizes[j]) < 0) + if(field_sizes[j] != size_native) + if(H5Tset_size(nmtype_id, field_sizes[j]) < 0) goto out; - } + /* the field in the file is found by its name */ - if(field_offset ) - { - if(H5Tinsert( mem_type_id, member_name, field_offset[j], nmtype_id ) < 0) + if(field_offset) { + if(H5Tinsert(mem_type_id, member_name, field_offset[j], nmtype_id) < 0) goto out; - } - else - { - if(H5Tinsert( mem_type_id, member_name, (size_t)0, nmtype_id ) < 0) + } /* end if */ + else { + if(H5Tinsert(mem_type_id, member_name, (size_t)0, nmtype_id) < 0) goto out; - } + } /* end else */ /* close */ - if(H5Tclose( mtype_id ) < 0) + if(H5Tclose(mtype_id) < 0) goto out; - if(H5Tclose( nmtype_id ) < 0) + mtype_id = H5I_BADID; + if(H5Tclose(nmtype_id) < 0) goto out; + nmtype_id = H5I_BADID; j++; - } - H5free_memory( member_name ); - } + } /* end if */ + + H5free_memory(member_name); + member_name = NULL; + } /* end for */ /* get the dataspace handle */ - if ((sid = H5Dget_space( did )) < 0) + if((sid = H5Dget_space(did)) < 0) goto out; /* define a hyperslab in the dataset */ offset[0] = start; count[0] = nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* create a memory dataspace handle */ mem_size[0] = count[0]; - if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0) + if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; /* read */ - if (H5Dread( did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf ) < 0) + if(H5Dread(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0) goto out; - /* close */ - if (H5Tclose( mem_type_id ) ) - goto out; - if (H5Tclose( ftype_id ) < 0) - return -1; - if (H5Sclose( sid ) < 0) - goto out; - if (H5Sclose( m_sid ) < 0) - goto out; - if (H5Dclose( did ) < 0) - return -1; - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Tclose(mem_type_id); - H5Tclose(ftype_id); - H5Sclose(m_sid); - H5Sclose(sid); - } H5E_END_TRY; - return -1; - -} + if(member_name) + H5free_memory(member_name); + if(mtype_id > 0) + if(H5Tclose(mtype_id) < 0) + ret_val = -1; + if(nmtype_id > 0) + if(H5Tclose(nmtype_id) < 0) + ret_val = -1; + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; + if(ftype_id > 0) + if(H5Tclose(ftype_id) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + return ret_val; +} /* end H5TBread_fields_name() */ /*------------------------------------------------------------------------- * Function: H5TBread_fields_index @@ -1123,15 +1046,9 @@ out: * * Comments: * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define the memory type ID -* returned by H5TB_create_type -* *------------------------------------------------------------------------- */ - - -herr_t H5TBread_fields_index( hid_t loc_id, +herr_t H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -1140,38 +1057,37 @@ herr_t H5TBread_fields_index( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - void *buf ) + void *buf) { - - hid_t did; - hid_t tid=-1; - hid_t read_type_id=-1; - hid_t member_type_id; - hid_t nmtype_id; - char *member_name; + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t read_type_id = H5I_BADID; + hid_t member_type_id = H5I_BADID; + hid_t nmtype_id = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t m_sid = H5I_BADID; hsize_t count[1]; - hsize_t offset[1]; - hid_t sid=-1; - hid_t m_sid=-1; + hsize_t offset[1]; hsize_t mem_size[1]; - size_t size_native; hsize_t i; + size_t size_native; + char *member_name = NULL; + herr_t ret_val = -1; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; /* create a read id */ - if (( read_type_id = H5Tcreate( H5T_COMPOUND, type_size )) < 0) + if((read_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) goto out; /* iterate tru the members */ - for ( i = 0; i < nfields; i++) - { + for(i = 0; i < nfields; i++) { unsigned j; /* Range check */ @@ -1181,95 +1097,94 @@ herr_t H5TBread_fields_index( hid_t loc_id, j = (unsigned)field_index[i]; /* get the member name */ - member_name = H5Tget_member_name( tid, j ); - - /* get the member type */ - if (( member_type_id = H5Tget_member_type( tid, j )) < 0) + if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)j))) goto out; - /* get the member size */ - if (H5Tget_size( member_type_id ) == 0 ) + /* get the member type */ + if((member_type_id = H5Tget_member_type(tid, (unsigned)j)) < 0) goto out; /* convert to native type */ - if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) + if((nmtype_id = H5Tget_native_type(member_type_id, H5T_DIR_DEFAULT)) < 0) goto out; - size_native=H5Tget_size(nmtype_id); + if(0 == (size_native = H5Tget_size(nmtype_id))) + goto out; - if (field_sizes[i]!=size_native) - { - if (H5Tset_size(nmtype_id, field_sizes[i]) < 0) + if(field_sizes[i] != size_native) + if(H5Tset_size(nmtype_id, field_sizes[i]) < 0) goto out; - } /* the field in the file is found by its name */ - if (field_offset ) - { - if(H5Tinsert( read_type_id, member_name, field_offset[i], nmtype_id ) < 0) + if(field_offset) { + if(H5Tinsert(read_type_id, member_name, field_offset[i], nmtype_id) < 0) goto out; - } - else - { - if(H5Tinsert( read_type_id, member_name, (size_t)0, nmtype_id ) < 0) + } /* end if */ + else { + if(H5Tinsert(read_type_id, member_name, (size_t)0, nmtype_id) < 0) goto out; - } + } /* end else */ /* close the member type */ - if (H5Tclose( member_type_id ) < 0) + if(H5Tclose(member_type_id) < 0) goto out; - if (H5Tclose( nmtype_id ) < 0) + member_type_id = H5I_BADID; + if(H5Tclose(nmtype_id) < 0) goto out; + nmtype_id = H5I_BADID; - H5free_memory( member_name ); - } + H5free_memory(member_name); + member_name = NULL; + } /* end for */ /* get the dataspace handle */ - if ((sid = H5Dget_space( did )) < 0) + if((sid = H5Dget_space(did)) < 0) goto out; /* define a hyperslab in the dataset */ offset[0] = start; count[0] = nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* create a memory dataspace handle */ mem_size[0] = count[0]; - if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0) + if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; /* read */ - if (H5Dread( did, read_type_id, m_sid, sid, H5P_DEFAULT, buf ) < 0) - goto out; - - /* close */ - if (H5Sclose( sid ) < 0) - goto out; - if (H5Sclose( m_sid ) < 0) + if(H5Dread( did, read_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0) goto out; - if (H5Tclose( read_type_id ) ) - goto out; - if (H5Tclose( tid ) < 0) - return -1; - if (H5Dclose( did ) < 0) - return -1; - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Tclose(read_type_id); - H5Tclose(tid); - H5Sclose(m_sid); - H5Sclose(sid); - } H5E_END_TRY; - return -1; + if(member_name) + H5free_memory(member_name); + if(read_type_id > 0) + if(H5Tclose(read_type_id) < 0) + ret_val = -1; + if(member_type_id > 0) + if(H5Tclose(member_type_id) < 0) + ret_val = -1; + if(nmtype_id > 0) + if(H5Tclose(nmtype_id) < 0) + ret_val = -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; -} + return ret_val; +} /* end H5TBread_fields_index() */ /*------------------------------------------------------------------------- @@ -1290,34 +1205,31 @@ out: * * Date: November 26, 2001 * -* Modifications: April 29, 2003 -* -* *------------------------------------------------------------------------- */ - -herr_t H5TBdelete_record( hid_t loc_id, +herr_t H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, - hsize_t nrecords ) + hsize_t nrecords) { + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t m_sid = H5I_BADID; + hid_t mem_type_id = H5I_BADID; hsize_t nfields; hsize_t ntotal_records; hsize_t read_start; hsize_t read_nrecords; - hid_t did=-1; - hid_t tid=-1; - hid_t sid=-1; - hid_t m_sid=-1; - hid_t mem_type_id=-1; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; - unsigned char *tmp_buf=NULL; - size_t src_size; - size_t *src_offset = NULL; - size_t *src_sizes = NULL; hsize_t dims[1]; + size_t src_size; + size_t *src_offset = NULL; + size_t *src_sizes = NULL; + unsigned char *tmp_buf = NULL; + herr_t ret_val = -1; /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk @@ -1325,7 +1237,7 @@ herr_t H5TBdelete_record( hid_t loc_id, */ /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &ntotal_records ) < 0) + if(H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0) goto out; if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) @@ -1334,11 +1246,11 @@ herr_t H5TBdelete_record( hid_t loc_id, goto out; /* get field info */ - if (H5TBget_field_info( loc_id, dset_name, NULL, src_sizes, src_offset, &src_size ) < 0) + if(H5TBget_field_info(loc_id, dset_name, NULL, src_sizes, src_offset, &src_size) < 0) goto out; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /*------------------------------------------------------------------------- @@ -1349,13 +1261,12 @@ herr_t H5TBdelete_record( hid_t loc_id, read_start = start + nrecords; read_nrecords = ntotal_records - read_start; - if ( read_nrecords ) - { - if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, src_size ))) + if(read_nrecords) { + if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)read_nrecords, src_size))) goto out; /* read the records after the deleted one(s) */ - if (H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0) + if(H5TBread_records(loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0) goto out; /*------------------------------------------------------------------------- @@ -1364,66 +1275,56 @@ herr_t H5TBdelete_record( hid_t loc_id, */ /* get the datatype */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; /* get the dataspace handle */ - if ((sid = H5Dget_space( did )) < 0) + if((sid = H5Dget_space(did)) < 0) goto out; /* create the memory data type. */ - if ((mem_type_id=H5TB_create_type( loc_id, dset_name, src_size, src_offset, src_sizes, tid)) < 0) + if((mem_type_id = H5TB_create_type( loc_id, dset_name, src_size, src_offset, src_sizes, tid)) < 0) goto out; /* define a hyperslab in the dataset of the size of the records */ offset[0] = start; count[0] = read_nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* create a memory dataspace handle */ mem_size[0] = count[0]; - if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0) + if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; - if (H5Dwrite( did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf ) < 0) + if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0) goto out; /* close */ - if (H5Sclose( m_sid ) < 0) + if(H5Sclose(m_sid) < 0) goto out; - if (H5Tclose( mem_type_id ) < 0) + m_sid = H5I_BADID; + if(H5Tclose(mem_type_id) < 0) goto out; - if (H5Sclose( sid ) < 0) + mem_type_id = H5I_BADID; + if(H5Sclose(sid) < 0) goto out; - if (H5Tclose( tid ) < 0) + sid = H5I_BADID; + if(H5Tclose(tid) < 0) goto out; - + tid = H5I_BADID; } /* read_nrecords */ - /*------------------------------------------------------------------------- * change the dataset dimension *------------------------------------------------------------------------- */ dims[0] = ntotal_records - nrecords; - if (H5Dset_extent( did, dims ) < 0) - goto out; - - /* close dataset */ - if (H5Dclose( did ) < 0) + if(H5Dset_extent(did, dims) < 0) goto out; - if(tmp_buf) - HDfree(tmp_buf); - if(src_offset) - HDfree(src_offset); - if(src_sizes) - HDfree(src_sizes); - - return 0; + ret_val = 0; - /* error zone */ out: if(tmp_buf) HDfree(tmp_buf); @@ -1431,16 +1332,24 @@ out: HDfree(src_offset); if(src_sizes) HDfree(src_sizes); - H5E_BEGIN_TRY - { - H5Tclose(mem_type_id); - H5Dclose(did); - H5Tclose(tid); - H5Sclose(sid); - H5Sclose(m_sid); - } H5E_END_TRY; - return -1; -} + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBdelete_record() */ /*------------------------------------------------------------------------- * Function: H5TBinsert_record @@ -1455,37 +1364,31 @@ out: * * Comments: Uses memory offsets * -* Modifications: April 1, 2004 -* the FIELD_SIZES parameter is used to define the memory type ID -* returned by H5TB_create_type -* *------------------------------------------------------------------------- */ - - -herr_t H5TBinsert_record( hid_t loc_id, +herr_t H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *field_sizes, - void *buf ) + void *buf) { - + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t mem_type_id = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t m_sid = H5I_BADID; hsize_t nfields; hsize_t ntotal_records; hsize_t read_nrecords; - hid_t did; - hid_t tid=-1; - hid_t mem_type_id=-1; hsize_t count[1]; hsize_t offset[1]; - hid_t sid=-1; - hid_t m_sid=-1; hsize_t dims[1]; hsize_t mem_dims[1]; - unsigned char *tmp_buf; + unsigned char *tmp_buf = NULL; + herr_t ret_val = -1; /*------------------------------------------------------------------------- * read the records after the inserted one(s) @@ -1493,32 +1396,33 @@ herr_t H5TBinsert_record( hid_t loc_id, */ /* get the dimensions */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &ntotal_records ) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0) + goto out; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; /* create the memory data type. */ - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid)) < 0) + if((mem_type_id = H5TB_create_type(loc_id, dset_name, type_size, field_offset, field_sizes, tid)) < 0) goto out; read_nrecords = ntotal_records - start; - tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, type_size); + if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, type_size))) + goto out; /* read the records after the inserted one(s) */ - if (H5TBread_records( loc_id, dset_name, start, read_nrecords, type_size, field_offset, field_sizes, tmp_buf ) < 0) - return -1; + if(H5TBread_records(loc_id, dset_name, start, read_nrecords, type_size, field_offset, field_sizes, tmp_buf) < 0) + goto out; /* extend the dataset */ dims[0] = ntotal_records + nrecords; - if (H5Dset_extent(did, dims) < 0) + if(H5Dset_extent(did, dims) < 0) goto out; /*------------------------------------------------------------------------- @@ -1528,27 +1432,29 @@ herr_t H5TBinsert_record( hid_t loc_id, /* create a simple memory data space */ mem_dims[0] = nrecords; - if ((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0) - return -1; + if((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0) + goto out; /* get the file data space */ - if ((sid = H5Dget_space( did )) < 0) - return -1; + if((sid = H5Dget_space(did)) < 0) + goto out; /* define a hyperslab in the dataset to write the new data */ offset[0] = start; count[0] = nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; - if (H5Dwrite( did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf ) < 0) + if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0) goto out; /* terminate access to the dataspace */ - if (H5Sclose( m_sid ) < 0) + if(H5Sclose(m_sid) < 0) goto out; - if (H5Sclose( sid ) < 0) + m_sid = H5I_BADID; + if(H5Sclose(sid) < 0) goto out; + sid = H5I_BADID; /*------------------------------------------------------------------------- * write the "pushed down" records @@ -1556,51 +1462,46 @@ herr_t H5TBinsert_record( hid_t loc_id, */ /* create a simple memory data space */ - mem_dims[0]=read_nrecords; - if ((m_sid = H5Screate_simple( 1, mem_dims, NULL )) < 0) - return -1; + mem_dims[0] = read_nrecords; + if((m_sid = H5Screate_simple(1, mem_dims, NULL)) < 0) + goto out; /* get the file data space */ - if ((sid = H5Dget_space( did )) < 0) - return -1; + if((sid = H5Dget_space(did)) < 0) + goto out; /* define a hyperslab in the dataset to write the new data */ offset[0] = start + nrecords; count[0] = read_nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; - if (H5Dwrite( did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf ) < 0) + if(H5Dwrite(did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0) goto out; - /* close */ - if (H5Sclose( m_sid ) < 0) - goto out; - if (H5Sclose( sid ) < 0) - goto out; - if (H5Tclose( tid ) < 0) - return -1; - if (H5Tclose( mem_type_id ) < 0) - return -1; - if (H5Dclose( did ) < 0) - return -1; - - HDfree( tmp_buf ); - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Sclose(sid); - H5Sclose(m_sid); - H5Tclose(mem_type_id); - H5Tclose(tid); - } H5E_END_TRY; - return -1; -} + if(tmp_buf) + HDfree(tmp_buf); + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(mem_type_id > 0) + if(H5Tclose(mem_type_id) < 0) + ret_val = -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBinsert_record() */ /*------------------------------------------------------------------------- * Function: H5TBadd_records_from @@ -1615,33 +1516,30 @@ out: * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - -herr_t H5TBadd_records_from( hid_t loc_id, +herr_t H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords, const char *dset_name2, - hsize_t start2 ) + hsize_t start2) { - hid_t did_1; - hid_t tid_1; - hid_t sid_1=-1; - hid_t msid_1=-1; - size_t type_size1; + hid_t did = H5I_BADID; + hid_t tid = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t m_sid = H5I_BADID; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; hsize_t nfields; hsize_t ntotal_records; - unsigned char *tmp_buf = NULL; + size_t type_size1; size_t src_size; - size_t *src_offset = NULL; - size_t *src_sizes = NULL; + size_t *src_offset = NULL; + size_t *src_sizes = NULL; + unsigned char *tmp_buf = NULL; + herr_t ret_val = -1; /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk @@ -1649,7 +1547,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, */ /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name1, &nfields, &ntotal_records ) < 0) + if(H5TBget_table_info(loc_id, dset_name1, &nfields, &ntotal_records) < 0) goto out; if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) @@ -1658,7 +1556,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, goto out; /* get field info */ - if (H5TBget_field_info( loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0) + if(H5TBget_field_info(loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size) < 0) goto out; /*------------------------------------------------------------------------- @@ -1667,69 +1565,47 @@ herr_t H5TBadd_records_from( hid_t loc_id, */ /* open the 1st dataset. */ - if ((did_1 = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ - if ((tid_1 = H5Dget_type( did_1 )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; /* get the dataspace handle */ - if ((sid_1 = H5Dget_space( did_1 )) < 0) + if((sid = H5Dget_space(did)) < 0) goto out; /* get the size of the datatype */ - if (( type_size1 = H5Tget_size( tid_1 )) == 0 ) + if(0 == (type_size1 = H5Tget_size(tid))) goto out; - if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size1 ))) + if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size1))) goto out; /* define a hyperslab in the dataset of the size of the records */ offset[0] = start1; count[0] = nrecords; - if (H5Sselect_hyperslab( sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* create a memory dataspace handle */ mem_size[0] = count[0]; - if ((msid_1 = H5Screate_simple( 1, mem_size, NULL )) < 0) + if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; - if (H5Dread( did_1, tid_1, msid_1, sid_1, H5P_DEFAULT, tmp_buf ) < 0) + if(H5Dread(did, tid, m_sid, sid, H5P_DEFAULT, tmp_buf) < 0) goto out; /*------------------------------------------------------------------------- * add to the second table *------------------------------------------------------------------------- */ - if (H5TBinsert_record(loc_id,dset_name2,start2,nrecords,src_size,src_offset,src_sizes,tmp_buf ) < 0) - goto out; - - /*------------------------------------------------------------------------- - * close resources for table 1 - *------------------------------------------------------------------------- - */ - - if (H5Sclose( msid_1 ) < 0) - goto out; - if (H5Sclose( sid_1 ) < 0) - goto out; - if (H5Tclose( tid_1 ) < 0) - goto out; - if (H5Dclose( did_1 ) < 0) + if(H5TBinsert_record(loc_id, dset_name2, start2, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0) goto out; - if(tmp_buf) - HDfree(tmp_buf); - if(src_offset) - HDfree(src_offset); - if(src_sizes) - HDfree(src_sizes); - - return 0; + ret_val = 0; - /* error zone */ out: if(tmp_buf) HDfree(tmp_buf); @@ -1737,16 +1613,21 @@ out: HDfree(src_offset); if(src_sizes) HDfree(src_sizes); - H5E_BEGIN_TRY - { - H5Dclose(did_1); - H5Sclose(sid_1); - H5Sclose(msid_1); - H5Tclose(tid_1); - } H5E_END_TRY; - return -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; -} + return ret_val; +} /* end H5TBadd_records_from() */ /*------------------------------------------------------------------------- * Function: H5TBcombine_tables @@ -1761,9 +1642,6 @@ out: * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ herr_t H5TBcombine_tables(hid_t loc_id1, @@ -1805,11 +1683,10 @@ herr_t H5TBcombine_tables(hid_t loc_id1, size_t *src_offset = NULL; size_t *src_sizes = NULL; char attr_name[255]; - char aux[255]; unsigned char *tmp_buf = NULL; unsigned char *tmp_fill_buf = NULL; htri_t has_fill; - int ret_val = -1; + herr_t ret_val = -1; /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk @@ -1893,7 +1770,8 @@ herr_t H5TBcombine_tables(hid_t loc_id1, * get attributes *------------------------------------------------------------------------- */ - type_size = H5Tget_size(tid_3); + if(0 == (type_size = H5Tget_size(tid_3))) + goto out; /* alloc fill value attribute buffer */ if(NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(type_size))) @@ -1908,7 +1786,6 @@ herr_t H5TBcombine_tables(hid_t loc_id1, *------------------------------------------------------------------------- */ if(has_fill) { - if((sid = H5Screate(H5S_SCALAR)) < 0) goto out; @@ -1920,11 +1797,7 @@ herr_t H5TBcombine_tables(hid_t loc_id1, /* get the member offset */ member_offset = H5Tget_member_offset(tid_3, (unsigned)i); - HDstrncpy(attr_name, "FIELD_", 6); - HDsnprintf(aux, 12, "%d", (int)i); - HDstrncat(attr_name, aux, 12); - HDsnprintf(aux, 6, "%s", "_FILL"); - HDstrncat(attr_name, aux, 7); + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i); if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; @@ -1939,13 +1812,13 @@ herr_t H5TBcombine_tables(hid_t loc_id1, if(H5Tclose(member_type_id) < 0) goto out; member_type_id = H5I_BADID; - } + } /* end for */ /* close data space. */ if(H5Sclose(sid) < 0) goto out; sid = H5I_BADID; - } + } /* end if */ /*------------------------------------------------------------------------- * read data from 1st table @@ -1978,26 +1851,12 @@ herr_t H5TBcombine_tables(hid_t loc_id1, goto out; /*------------------------------------------------------------------------- - * release resources from 1st table + * release temporary resources *------------------------------------------------------------------------- */ if(H5Sclose(m_sid) < 0) goto out; m_sid = H5I_BADID; - if(H5Sclose(sid_1) < 0) - goto out; - sid_1 = H5I_BADID; - if(H5Tclose(tid_1) < 0) - goto out; - tid_1 = H5I_BADID; - if(H5Pclose(pid_1) < 0) - goto out; - pid_1 = H5I_BADID; - if(H5Dclose(did_1) < 0) - goto out; - did_1 = H5I_BADID; - - /* Release resources. */ HDfree(tmp_buf); tmp_buf = NULL; @@ -2057,45 +1916,6 @@ herr_t H5TBcombine_tables(hid_t loc_id1, if(H5TBappend_records(loc_id1, dset_name3, nrecords, src_size, src_offset, src_sizes, tmp_buf) < 0) goto out; - /*------------------------------------------------------------------------- - * release resources from 2nd table - *------------------------------------------------------------------------- - */ - - if(H5Sclose(m_sid) < 0) - goto out; - m_sid = H5I_BADID; - if(H5Sclose(sid_2) < 0) - goto out; - sid_2 = H5I_BADID; - if(H5Tclose(tid_2) < 0) - goto out; - tid_2 = H5I_BADID; - if(H5Pclose(pid_2) < 0) - goto out; - pid_2 = H5I_BADID; - if(H5Dclose(did_2) < 0) - goto out; - did_2 = H5I_BADID; - - /*------------------------------------------------------------------------- - * release resources from 3rd table - *------------------------------------------------------------------------- - */ - - if(H5Sclose(sid_3) < 0) - goto out; - sid_3 = H5I_BADID; - if(H5Tclose(tid_3) < 0) - goto out; - tid_3 = H5I_BADID; - if(H5Pclose(pid_3) < 0) - goto out; - pid_3 = H5I_BADID; - if(H5Dclose(did_3) < 0) - goto out; - did_3 = H5I_BADID; - ret_val = 0; out: @@ -2107,44 +1927,57 @@ out: HDfree(src_offset); if(src_sizes) HDfree(src_sizes); - - H5E_BEGIN_TRY { - if(member_type_id > 0) - H5Tclose(member_type_id); - if(attr_id > 0) - H5Aclose(attr_id); - if(sid > 0) - H5Sclose(sid); - if(m_sid > 0) - H5Sclose(m_sid); - if(pid_1 > 0) - H5Pclose(pid_1); - if(tid_1 > 0) - H5Tclose(tid_1); - if(sid_1 > 0) - H5Sclose(sid_1); - if(did_1 > 0) - H5Dclose(did_1); - if(pid_2 > 0) - H5Pclose(pid_2); - if(tid_2 > 0) - H5Tclose(tid_2); - if(sid_2 > 0) - H5Sclose(sid_2); - if(did_2 > 0) - H5Dclose(did_2); - if(pid_3 > 0) - H5Pclose(pid_3); - if(tid_3 > 0) - H5Tclose(tid_3); - if(sid_3 > 0) - H5Sclose(sid_3); - if(did_3 > 0) - H5Dclose(did_3); - } H5E_END_TRY; + if(member_type_id > 0) + if(H5Tclose(member_type_id) < 0) + ret_val = -1; + if(attr_id > 0) + if(H5Aclose(attr_id) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(sid_1 > 0) + if(H5Sclose(sid_1) < 0) + ret_val = -1; + if(tid_1 > 0) + if(H5Tclose(tid_1) < 0) + ret_val = -1; + if(pid_1 > 0) + if(H5Pclose(pid_1) < 0) + ret_val = -1; + if(did_1 > 0) + if(H5Dclose(did_1) < 0) + ret_val = -1; + if(sid_2 > 0) + if(H5Sclose(sid_2) < 0) + ret_val = -1; + if(tid_2 > 0) + if(H5Tclose(tid_2) < 0) + ret_val = -1; + if(pid_2 > 0) + if(H5Pclose(pid_2) < 0) + ret_val = -1; + if(did_2 > 0) + if(H5Dclose(did_2) < 0) + ret_val = -1; + if(sid_3 > 0) + if(H5Sclose(sid_3) < 0) + ret_val = -1; + if(tid_3 > 0) + if(H5Tclose(tid_3) < 0) + ret_val = -1; + if(pid_3 > 0) + if(H5Pclose(pid_3) < 0) + ret_val = -1; + if(did_3 > 0) + if(H5Dclose(did_3) < 0) + ret_val = -1; return ret_val; -} +} /* end H5TBcombine_tables() */ /*------------------------------------------------------------------------- * Function: H5TBinsert_field @@ -2159,36 +1992,40 @@ out: * * Comments: * -* Modifications: -* *------------------------------------------------------------------------- */ - -herr_t H5TBinsert_field( hid_t loc_id, +herr_t H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hid_t field_type, hsize_t position, const void *fill_data, - const void *buf ) + const void *buf) { /* identifiers for the 1st, original dataset */ - hid_t did_1; - hid_t tid_1; - hid_t sid_1; - hid_t pid_1; - hid_t msid_1; + hid_t did_1 = H5I_BADID; + hid_t tid_1 = H5I_BADID; + hid_t sid_1 = H5I_BADID; + hid_t pid_1 = H5I_BADID; + hid_t msid_1 = H5I_BADID; /* identifiers for the 2nd, new dataset */ - hid_t did_2; - hid_t tid_2; - hid_t sid_2; - hid_t pid_2; - hid_t msid_2; - hid_t member_type_id; + hid_t did_2 = H5I_BADID; + hid_t tid_2 = H5I_BADID; + hid_t sid_2 = H5I_BADID; + hid_t pid_2 = H5I_BADID; + hid_t msid_2 = H5I_BADID; + /* identifiers for the 3rd, final dataset */ + hid_t did_3 = H5I_BADID; + hid_t tid_3 = H5I_BADID; + hid_t sid_3 = H5I_BADID; + hid_t member_type_id = H5I_BADID; + hid_t write_type_id = H5I_BADID; + hid_t preserve_id = H5I_BADID; + hid_t attr_id = H5I_BADID; size_t member_size; size_t new_member_size = 0; - char *member_name; size_t total_size; + size_t curr_offset; hsize_t nfields; hsize_t nrecords; hsize_t dims_chunk[1]; @@ -2197,388 +2034,366 @@ herr_t H5TBinsert_field( hid_t loc_id, hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; - hid_t write_type_id; - hid_t preserve_id; - size_t curr_offset; - int inserted; - hsize_t idx; + hsize_t i; char table_title[255]; - size_t member_offset; char attr_name[255]; - hid_t attr_id; - char aux[255]; - unsigned char *tmp_buf; - unsigned char *tmp_fill_buf; - hsize_t i; + char *member_name = NULL; + unsigned char *tmp_buf = NULL; + unsigned char *tmp_fill_buf = NULL; + hbool_t inserted; + herr_t ret_val = -1; /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) + goto out; /*------------------------------------------------------------------------- - * get information about the old data type - *------------------------------------------------------------------------- - */ + * get information about the old data type + *------------------------------------------------------------------------- + */ /* open the dataset. */ - if ((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get creation properties list */ - if ((pid_1 = H5Dget_create_plist( did_1 )) < 0) + if((pid_1 = H5Dget_create_plist(did_1)) < 0) goto out; /* get the datatype */ - if ((tid_1 = H5Dget_type( did_1 )) < 0) + if((tid_1 = H5Dget_type(did_1)) < 0) goto out; /* get the size of the datatype */ - if (( total_size = H5Tget_size( tid_1 )) == 0 ) + if(0 == (total_size = H5Tget_size(tid_1))) goto out; /* get the dataspace handle */ - if ((sid_1 = H5Dget_space( did_1 )) < 0) + if((sid_1 = H5Dget_space(did_1)) < 0) goto out; /* get dimension */ - if (H5Sget_simple_extent_dims( sid_1, dims, NULL) < 0) + if(H5Sget_simple_extent_dims(sid_1, dims, NULL) < 0) goto out; /*------------------------------------------------------------------------- - * get attributes - *------------------------------------------------------------------------- - */ + * get attributes + *------------------------------------------------------------------------- + */ /* get the table title */ - if ((H5TBAget_title( did_1, table_title )) < 0) + if((H5TBAget_title(did_1, table_title)) < 0) goto out; /* alloc fill value attribute buffer */ - tmp_fill_buf = (unsigned char *)HDmalloc(total_size ); + if(NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(total_size))) + goto out; /* get the fill value attributes */ - if ((H5TBAget_fill( loc_id, dset_name, did_1, tmp_fill_buf )) < 0) + if((H5TBAget_fill(loc_id, dset_name, did_1, tmp_fill_buf)) < 0) goto out; /*------------------------------------------------------------------------- - * create a new data type - *------------------------------------------------------------------------- - */ + * create a new data type + *------------------------------------------------------------------------- + */ /* get the new member size */ - member_size = H5Tget_size( field_type ); + if(0 == (member_size = H5Tget_size(field_type))) + goto out; /* create the data type. */ - if (( tid_2 = H5Tcreate (H5T_COMPOUND,(size_t)(total_size + member_size) )) < 0) + if((tid_2 = H5Tcreate(H5T_COMPOUND, (size_t)(total_size + member_size))) < 0) goto out; curr_offset = 0; - inserted = 0; + inserted = FALSE; /* insert the old fields, counting with the new one */ - for ( i = 0; i < nfields + 1; i++) - { + for(i = 0; i < nfields + 1; i++) { + hsize_t idx; + idx = i; - if (inserted ) + if(inserted) idx = i - 1; - if (i == position ) - { + if(i == position) { /* get the new member size */ - new_member_size = H5Tget_size( field_type ); + if(0 == (new_member_size = H5Tget_size(field_type))) + goto out; /* insert the new field type */ - if (H5Tinsert( tid_2, field_name, curr_offset, field_type ) < 0) + if(H5Tinsert(tid_2, field_name, curr_offset, field_type) < 0) goto out; curr_offset += new_member_size; - inserted = 1; - - continue; - } - - /* get the member name */ - member_name = H5Tget_member_name( tid_1, (unsigned)idx ); - - /* get the member type */ - if (( member_type_id = H5Tget_member_type( tid_1,(unsigned)idx )) < 0) - goto out; + inserted = TRUE; + } /* end if */ + else { + /* get the member name */ + if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)idx))) + goto out; - /* get the member size */ - member_size = H5Tget_size( member_type_id ); + /* get the member type */ + if((member_type_id = H5Tget_member_type(tid_1, (unsigned)idx)) < 0) + goto out; - /* insert it into the new type */ - if (H5Tinsert( tid_2, member_name, curr_offset, member_type_id ) < 0) - goto out; + /* get the member size */ + if(0 == (member_size = H5Tget_size(member_type_id))) + goto out; - curr_offset += member_size; + /* insert it into the new type */ + if(H5Tinsert(tid_2, member_name, curr_offset, member_type_id) < 0) + goto out; - H5free_memory( member_name ); + curr_offset += member_size; - /* close the member type */ - if(H5Tclose( member_type_id ) < 0) - goto out; + H5free_memory(member_name); + member_name = NULL; - } /* i */ + /* close the member type */ + if(H5Tclose(member_type_id) < 0) + goto out; + member_type_id = H5I_BADID; + } /* end else */ + } /* end for */ /*------------------------------------------------------------------------- - * create a new temporary dataset - *------------------------------------------------------------------------- - */ + * create a new temporary dataset + *------------------------------------------------------------------------- + */ /* retrieve the size of chunk */ - if (H5Pget_chunk(pid_1, 1, dims_chunk) < 0) + if(H5Pget_chunk(pid_1, 1, dims_chunk) < 0) goto out; /* create a new simple data space with unlimited size, using the dimension */ - if ((sid_2 = H5Screate_simple( 1, dims, maxdims)) < 0) - return -1; + if((sid_2 = H5Screate_simple(1, dims, maxdims)) < 0) + goto out; /* modify dataset creation properties, i.e. enable chunking */ - pid_2 = H5Pcreate(H5P_DATASET_CREATE); - if (H5Pset_chunk(pid_2, 1, dims_chunk) < 0) - return -1; + if((pid_2 = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if(H5Pset_chunk(pid_2, 1, dims_chunk) < 0) + goto out; /* create the dataset. */ - if ((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0) + if((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0) goto out; /*------------------------------------------------------------------------- - * read data from 1st table - *------------------------------------------------------------------------- - */ + * read data from 1st table + *------------------------------------------------------------------------- + */ - tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, (size_t)total_size); + if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, (size_t)total_size))) + goto out; /* define a hyperslab in the dataset of the size of the records */ offset[0] = 0; count[0] = nrecords; - if (H5Sselect_hyperslab(sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid_1, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* create a memory dataspace handle */ mem_size[0] = count[0]; - if ((msid_1 = H5Screate_simple(1, mem_size, NULL)) < 0) + if((msid_1 = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; - if (H5Dread(did_1, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0) + if(H5Dread(did_1, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0) goto out; /*------------------------------------------------------------------------- - * save data from 1st table into new table, using the 1st type id - *------------------------------------------------------------------------- - */ + * save data from 1st table into new table, using the 1st type id + *------------------------------------------------------------------------- + */ /* write */ - if (H5Dwrite( did_2, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0) + if(H5Dwrite(did_2, tid_1, msid_1, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0) goto out; /*------------------------------------------------------------------------- - * save the function supplied data of the new field - *------------------------------------------------------------------------- - */ + * save the function supplied data of the new field + *------------------------------------------------------------------------- + */ /* create a write id */ - if (( write_type_id = H5Tcreate( H5T_COMPOUND, (size_t)new_member_size )) < 0) + if((write_type_id = H5Tcreate(H5T_COMPOUND, (size_t)new_member_size)) < 0) goto out; /* the field in the file is found by its name */ - if (H5Tinsert( write_type_id, field_name, (size_t)0, field_type ) < 0) + if(H5Tinsert(write_type_id, field_name, (size_t)0, field_type) < 0) goto out; /* create xfer properties to preserve initialized data */ - if ((preserve_id = H5Pcreate (H5P_DATASET_XFER)) < 0) + if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) goto out; - if (H5Pset_preserve (preserve_id, 1) < 0) + if(H5Pset_preserve(preserve_id, 1) < 0) goto out; /* only write if there is something to write */ - if ( buf ) - { + if(buf) { /* create a memory dataspace handle */ - if ((msid_2 = H5Screate_simple( 1, mem_size, NULL )) < 0) + if((msid_2 = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; /* write */ - if (H5Dwrite( did_2, write_type_id, msid_2, sid_2, preserve_id, buf ) < 0) - goto out; - - /* terminate access to the memory dataspace */ - if (H5Sclose( msid_2 ) < 0) + if(H5Dwrite(did_2, write_type_id, msid_2, sid_2, preserve_id, buf) < 0) goto out; - } - - /* end access to the property list */ - if (H5Pclose( preserve_id ) < 0) - goto out; + } /* end if */ /*------------------------------------------------------------------------- - * release resources from 1st table - *------------------------------------------------------------------------- - */ - - if (H5Sclose( msid_1 ) < 0) - goto out; - if (H5Tclose( tid_1 ) < 0) - goto out; - if (H5Pclose( pid_1 ) < 0) - goto out; - if (H5Sclose( sid_1 ) < 0) + * delete 1st table + *------------------------------------------------------------------------- + */ + if(H5Ldelete(loc_id, dset_name, H5P_DEFAULT) < 0) goto out; - if (H5Dclose( did_1 ) < 0) - goto out; - /*------------------------------------------------------------------------- - * release resources from 2nd table - *------------------------------------------------------------------------- - */ - - if (H5Sclose( sid_2 ) < 0) - goto out; - if (H5Tclose( tid_2 ) < 0) - goto out; - if (H5Pclose( pid_2 ) < 0) + * rename 2nd table + *------------------------------------------------------------------------- + */ + if(H5Lmove(loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT) < 0) goto out; - if (H5Dclose( did_2 ) < 0) - goto out; - - /*------------------------------------------------------------------------- - * delete 1st table - *------------------------------------------------------------------------- - */ - if (H5Ldelete( loc_id, dset_name, H5P_DEFAULT ) < 0) - return -1; /*------------------------------------------------------------------------- - * rename 2nd table - *------------------------------------------------------------------------- - */ - - if (H5Lmove( loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT ) < 0) - return -1; - - /*------------------------------------------------------------------------- - * attach the conforming table attributes - *------------------------------------------------------------------------- - */ + * attach the conforming table attributes + *------------------------------------------------------------------------- + */ /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) + goto out; /* open the dataset. */ - if ((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did_3 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get the datatype */ - if ((tid_1 = H5Dget_type( did_1 )) < 0) + if((tid_3 = H5Dget_type(did_3)) < 0) goto out; /* set the attributes */ - if (H5TB_attach_attributes( table_title, loc_id, dset_name,(hsize_t) nfields, tid_1 ) < 0) - return -1; + if(H5TB_attach_attributes(table_title, loc_id, dset_name, (hsize_t)nfields, tid_3) < 0) + goto out; /*------------------------------------------------------------------------- - * attach the fill attributes from previous table - *------------------------------------------------------------------------- - */ - - if (( sid_1 = H5Screate(H5S_SCALAR)) < 0) + * attach the fill attributes from previous table + *------------------------------------------------------------------------- + */ + if((sid_3 = H5Screate(H5S_SCALAR)) < 0) goto out; - for ( i = 0; i < nfields-1; i++) - { + for(i = 0; i < (nfields - 1); i++) { + size_t member_offset; + /* get the member type */ - if(( member_type_id = H5Tget_member_type( tid_1, (unsigned) i )) < 0) + if((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0) goto out; /* get the member offset */ - member_offset = H5Tget_member_offset(tid_1, (unsigned)i); + member_offset = H5Tget_member_offset(tid_3, (unsigned)i); - strcpy(attr_name, "FIELD_"); - sprintf(aux, "%d", (int)i); - strcat(attr_name, aux); - sprintf(aux, "%s", "_FILL"); - strcat(attr_name, aux); + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i); - if ((attr_id = H5Acreate2(did_1, attr_name, member_type_id, sid_1, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_3, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if (H5Awrite(attr_id, member_type_id, tmp_fill_buf+member_offset) < 0) + if(H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0) goto out; - if (H5Aclose(attr_id) < 0) + if(H5Aclose(attr_id) < 0) goto out; + attr_id = H5I_BADID; /* close the member type */ - if (H5Tclose(member_type_id) < 0) + if(H5Tclose(member_type_id) < 0) goto out; - } + member_type_id = H5I_BADID; + } /* end for */ /*------------------------------------------------------------------------- - * attach the fill attribute from the new field, if present - *------------------------------------------------------------------------- - */ - if (fill_data) - { - - strcpy(attr_name, "FIELD_"); - sprintf(aux, "%d",(int)(nfields - 1)); - strcat(attr_name, aux); - sprintf(aux, "%s", "_FILL"); - strcat(attr_name, aux); + * attach the fill attribute from the new field, if present + *------------------------------------------------------------------------- + */ + if(fill_data) { + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)(nfields - 1)); /* get the member type */ - if ((member_type_id = H5Tget_member_type(tid_1, (unsigned)nfields - 1)) < 0) + if((member_type_id = H5Tget_member_type(tid_3, (unsigned)nfields - 1)) < 0) goto out; - if ((attr_id = H5Acreate2(did_1, attr_name, member_type_id, sid_1, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_3, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if (H5Awrite(attr_id, member_type_id, fill_data) < 0) + if(H5Awrite(attr_id, member_type_id, fill_data) < 0) goto out; - if (H5Aclose(attr_id) < 0) + if(H5Aclose(attr_id) < 0) goto out; + attr_id = H5I_BADID; - if (H5Tclose(member_type_id) < 0) + if(H5Tclose(member_type_id) < 0) goto out; + member_type_id = H5I_BADID; + } /* end fill_data */ - } - - /* close */ - if (H5Sclose( sid_1 ) < 0) - goto out; - if (H5Tclose( tid_1 ) < 0) - goto out; - if (H5Dclose( did_1 ) < 0) - goto out; - - /* release resources. */ - HDfree ( tmp_buf ); - HDfree ( tmp_fill_buf ); - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did_1); - H5Sclose(sid_1); - H5Tclose(tid_1); - H5Pclose(pid_1); - H5Dclose(did_2); - H5Sclose(sid_2); - H5Tclose(tid_2); - H5Pclose(pid_2); - - } H5E_END_TRY; - return -1; + if(member_name) + H5free_memory(member_name); + if(tmp_buf) + HDfree(tmp_buf); + if(tmp_fill_buf) + HDfree(tmp_fill_buf); + if(preserve_id > 0) + if(H5Pclose(preserve_id) < 0) + ret_val = -1; + if(msid_1 > 0) + if(H5Sclose(msid_1) < 0) + ret_val = -1; + if(tid_1 > 0) + if(H5Tclose(tid_1) < 0) + ret_val = -1; + if(pid_1 > 0) + if(H5Pclose(pid_1) < 0) + ret_val = -1; + if(sid_1 > 0) + if(H5Sclose(sid_1) < 0) + ret_val = -1; + if(did_1 > 0) + if(H5Dclose(did_1) < 0) + ret_val = -1; + if(msid_2 > 0) + if(H5Sclose(msid_2) < 0) + ret_val = -1; + if(sid_2 > 0) + if(H5Sclose(sid_2) < 0) + ret_val = -1; + if(tid_2 > 0) + if(H5Tclose(tid_2) < 0) + ret_val = -1; + if(pid_2 > 0) + if(H5Pclose(pid_2) < 0) + ret_val = -1; + if(did_2 > 0) + if(H5Dclose(did_2) < 0) + ret_val = -1; + if(sid_3 > 0) + if(H5Sclose(sid_3) < 0) + ret_val = -1; + if(tid_3 > 0) + if(H5Tclose(tid_3) < 0) + ret_val = -1; + if(did_3 > 0) + if(H5Dclose(did_3) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBinsert_field() */ -} /*------------------------------------------------------------------------- * Function: H5TBdelete_field * @@ -2592,54 +2407,53 @@ out: * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ - -herr_t H5TBdelete_field( hid_t loc_id, +herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, - const char *field_name ) + const char *field_name) { /* identifiers for the 1st original dataset */ - hid_t did_1; - hid_t tid_1; - hid_t sid_1; - hid_t pid_1; + hid_t did_1 = H5I_BADID; + hid_t tid_1 = H5I_BADID; + hid_t sid_1 = H5I_BADID; + hid_t pid_1 = H5I_BADID; /* identifiers for the 2nd new dataset */ - hid_t did_2; - hid_t tid_2; - hid_t sid_2; - hid_t pid_2; - hid_t member_type_id; + hid_t did_2 = H5I_BADID; + hid_t tid_2 = H5I_BADID; + hid_t sid_2 = H5I_BADID; + hid_t pid_2 = H5I_BADID; + /* identifiers for the 3rd final dataset */ + hid_t did_3 = H5I_BADID; + hid_t tid_3 = H5I_BADID; + hid_t member_type_id = H5I_BADID; + hid_t preserve_id = H5I_BADID; + hid_t read_type_id = H5I_BADID; + hid_t write_type_id = H5I_BADID; + hid_t attr_id = H5I_BADID; size_t member_size; - char *member_name; size_t type_size1; size_t type_size2; + size_t curr_offset; + size_t delete_member_size = 0; + size_t member_offset; hsize_t nfields; hsize_t nrecords; hsize_t dims_chunk[1]; hsize_t dims[1]; hsize_t maxdims[1] = { H5S_UNLIMITED }; - hid_t preserve_id; - size_t curr_offset; - size_t delete_member_size = 0; - hid_t read_type_id; - hid_t write_type_id; - unsigned char *tmp_buf; - unsigned char *tmp_fill_buf; + hsize_t i; char attr_name[255]; - char aux[255]; char table_title[255]; - size_t member_offset; - hid_t attr_id; - hsize_t i; - htri_t has_fill = 0; + char *member_name = NULL; + unsigned char *tmp_buf = NULL; + unsigned char *tmp_fill_buf = NULL; + htri_t has_fill = FALSE; + herr_t ret_val = -1; /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) + goto out; /*------------------------------------------------------------------------- * get information about the old data type @@ -2647,26 +2461,27 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* open the dataset. */ - if ((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get creation properties list */ - if ((pid_1 = H5Dget_create_plist( did_1 )) < 0) + if((pid_1 = H5Dget_create_plist(did_1)) < 0) goto out; /* get the datatype */ - if ((tid_1 = H5Dget_type( did_1 )) < 0) + if((tid_1 = H5Dget_type(did_1)) < 0) goto out; /* get the size of the datatype */ - type_size1 = H5Tget_size( tid_1 ); + if(0 == (type_size1 = H5Tget_size(tid_1))) + goto out; /* get the dataspace handle */ - if ((sid_1 = H5Dget_space( did_1 )) < 0) + if((sid_1 = H5Dget_space(did_1)) < 0) goto out; /* get dimension */ - if (H5Sget_simple_extent_dims( sid_1, dims, NULL) < 0) + if(H5Sget_simple_extent_dims(sid_1, dims, NULL) < 0) goto out; /*------------------------------------------------------------------------- @@ -2675,37 +2490,38 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* check out the field */ - for ( i = 0; i < nfields; i++) - { + for(i = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name( tid_1,(unsigned) i ); + if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i))) + goto out; /* we want to find the field to delete */ - if (H5TB_find_field( member_name, field_name ) > 0 ) - { + if(H5TB_find_field(member_name, field_name)) { /* get the member type */ - if (( member_type_id = H5Tget_member_type( tid_1,(unsigned) i )) < 0) + if((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0) goto out; /* get the member size */ - delete_member_size = H5Tget_size( member_type_id ); + if(0 == (delete_member_size = H5Tget_size(member_type_id))) + goto out; /* close the member type */ - if (H5Tclose( member_type_id ) < 0) + if(H5Tclose(member_type_id) < 0) goto out; + member_type_id = H5I_BADID; - H5free_memory( member_name ); + H5free_memory(member_name); + member_name = NULL; break; + } /* end if */ - } - - H5free_memory( member_name ); - - } /* i */ + H5free_memory(member_name); + member_name = NULL; + } /* end for */ /* no field to delete was found */ - if (delete_member_size == 0 ) + if(delete_member_size == 0) goto out; /*------------------------------------------------------------------------- @@ -2716,13 +2532,14 @@ herr_t H5TBdelete_field( hid_t loc_id, type_size2 = type_size1 - delete_member_size; /* create the data type. */ - if (( tid_2 = H5Tcreate (H5T_COMPOUND, type_size2 )) < 0) + if((tid_2 = H5Tcreate (H5T_COMPOUND, type_size2)) < 0) goto out; curr_offset = 0; /* alloc fill value attribute buffer */ - tmp_fill_buf = (unsigned char *)HDmalloc((size_t) type_size2 ); + if(NULL == (tmp_fill_buf = (unsigned char *)HDmalloc((size_t)type_size2))) + goto out; /*------------------------------------------------------------------------- * get attributes from previous table in the process @@ -2730,62 +2547,56 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* get the table title */ - if ((H5TBAget_title( did_1, table_title )) < 0) + if((H5TBAget_title(did_1, table_title)) < 0) goto out; /* insert the old fields except the one to delete */ - for ( i = 0; i < nfields; i++) - { + for(i = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name( tid_1, (unsigned) i ); + if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i))) + goto out; /* we want to skip the field to delete */ - if (H5TB_find_field( member_name, field_name ) > 0 ) - { - H5free_memory( member_name ); - continue; - } + if(!H5TB_find_field(member_name, field_name)) { + /* get the member type */ + if((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0) + goto out; - /* get the member type */ - if (( member_type_id = H5Tget_member_type( tid_1, (unsigned)i )) < 0) - goto out; + /* get the member size */ + if(0 == (member_size = H5Tget_size(member_type_id))) + goto out; - /* get the member size */ - member_size = H5Tget_size( member_type_id ); + /* insert it into the new type */ + if(H5Tinsert(tid_2, member_name, curr_offset, member_type_id) < 0) + goto out; - /* insert it into the new type */ - if (H5Tinsert( tid_2, member_name, curr_offset, member_type_id ) < 0) - goto out; + /*------------------------------------------------------------------------- + * get the fill value information + *------------------------------------------------------------------------- + */ - /*------------------------------------------------------------------------- - * get the fill value information - *------------------------------------------------------------------------- - */ + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i); - strcpy( attr_name, "FIELD_" ); - sprintf( aux, "%d", (int)i ); - strcat( attr_name, aux ); - sprintf( aux, "%s", "_FILL" ); - strcat( attr_name, aux ); + /* check if we have the _FILL attribute */ + if((has_fill = H5LT_find_attribute(did_1, attr_name)) < 0) + goto out; - /* check if we have the _FILL attribute */ - has_fill = H5LT_find_attribute( did_1, attr_name ); + /* get it */ + if(has_fill) + if(H5LT_get_attribute_disk(did_1, attr_name, tmp_fill_buf + curr_offset) < 0) + goto out; - /* get it */ - if (has_fill == 1 ) - { - if(H5LT_get_attribute_disk( did_1, attr_name, tmp_fill_buf+curr_offset ) < 0) - goto out; - } + curr_offset += member_size; - curr_offset += member_size; + /* close the member type */ + if(H5Tclose(member_type_id) < 0) + goto out; + member_type_id = H5I_BADID; + } /* end if */ H5free_memory(member_name); - - /* close the member type */ - if (H5Tclose(member_type_id) < 0) - goto out; - } /* i */ + member_name = NULL; + } /* end for */ /*------------------------------------------------------------------------- * create a new temporary dataset @@ -2793,143 +2604,116 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* retrieve the size of chunk */ - if (H5Pget_chunk(pid_1, 1, dims_chunk) < 0) + if(H5Pget_chunk(pid_1, 1, dims_chunk) < 0) goto out; /* create a new simple data space with unlimited size, using the dimension */ - if ((sid_2 = H5Screate_simple(1, dims, maxdims)) < 0) - return -1; + if((sid_2 = H5Screate_simple(1, dims, maxdims)) < 0) + goto out; /* modify dataset creation properties, i.e. enable chunking */ pid_2 = H5Pcreate(H5P_DATASET_CREATE); - if (H5Pset_chunk(pid_2, 1, dims_chunk) < 0) - return -1; + if(H5Pset_chunk(pid_2, 1, dims_chunk) < 0) + goto out; /* create the dataset. */ - if ((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0) + if((did_2 = H5Dcreate2(loc_id, "new", tid_2, sid_2, H5P_DEFAULT, pid_2, H5P_DEFAULT)) < 0) goto out; /*------------------------------------------------------------------------- * we have to read field by field of the old dataset and save it into the new one *------------------------------------------------------------------------- */ - for ( i = 0; i < nfields; i++) - { + for(i = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name(tid_1, (unsigned)i); + if(NULL == (member_name = H5Tget_member_name(tid_1, (unsigned)i))) + goto out; /* skip the field to delete */ - if (H5TB_find_field(member_name, field_name) > 0) - { - H5free_memory(member_name); - continue; - } + if(!H5TB_find_field(member_name, field_name) > 0) { + /* get the member type */ + if((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0) + goto out; - /* get the member type */ - if ((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0) - goto out; + /* get the member size */ + if(0 == (member_size = H5Tget_size(member_type_id))) + goto out; - /* get the member size */ - member_size = H5Tget_size(member_type_id); + /* create a read id */ + if((read_type_id = H5Tcreate(H5T_COMPOUND, member_size)) < 0) + goto out; - /* create a read id */ - if ((read_type_id = H5Tcreate(H5T_COMPOUND, member_size)) < 0) - goto out; + /* insert it into the new type */ + if(H5Tinsert(read_type_id, member_name, (size_t)0, member_type_id) < 0) + goto out; - /* insert it into the new type */ - if (H5Tinsert( read_type_id, member_name, (size_t)0, member_type_id ) < 0) - goto out; + if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, member_size))) + goto out; - tmp_buf = (unsigned char *)HDcalloc((size_t) nrecords, member_size ); + /* read */ + if(H5Dread(did_1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf) < 0) + goto out; - /* read */ - if (H5Dread( did_1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0) - goto out; + /* create a write id */ + if((write_type_id = H5Tcreate(H5T_COMPOUND, member_size)) < 0) + goto out; - /* create a write id */ - if (( write_type_id = H5Tcreate( H5T_COMPOUND, member_size )) < 0) - goto out; + /* the field in the file is found by its name */ + if(H5Tinsert(write_type_id, member_name, (size_t)0, member_type_id) < 0) + goto out; - /* the field in the file is found by its name */ - if (H5Tinsert( write_type_id, member_name, (size_t)0, member_type_id ) < 0) - goto out; + /* create xfer properties to preserve initialized data */ + if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto out; + if(H5Pset_preserve(preserve_id, 1) < 0) + goto out; - /* create xfer properties to preserve initialized data */ - if ((preserve_id = H5Pcreate (H5P_DATASET_XFER)) < 0) - goto out; - if (H5Pset_preserve (preserve_id, 1) < 0) - goto out; + /* write */ + if(H5Dwrite(did_2, write_type_id, H5S_ALL, H5S_ALL, preserve_id, tmp_buf) < 0) + goto out; - /* write */ - if(H5Dwrite( did_2, write_type_id, H5S_ALL, H5S_ALL, preserve_id, tmp_buf ) < 0) - goto out; + /* end access to the property list */ + if(H5Pclose(preserve_id) < 0) + goto out; + preserve_id = H5I_BADID; - /* end access to the property list */ - if (H5Pclose( preserve_id ) < 0) - goto out; + /* close the member type */ + if(H5Tclose(member_type_id) < 0) + goto out; + member_type_id = H5I_BADID; - /* close the member type */ - if (H5Tclose( member_type_id ) < 0) - goto out; + /* close the read type */ + if(H5Tclose(read_type_id) < 0) + goto out; + read_type_id = H5I_BADID; - /* close the read type */ - if (H5Tclose( read_type_id ) < 0) - goto out; + /* close the write type */ + if(H5Tclose(write_type_id) < 0) + goto out; + write_type_id = H5I_BADID; - /* close the write type */ - if (H5Tclose( write_type_id ) < 0) - goto out; + HDfree(tmp_buf); + tmp_buf = NULL; + } /* end if */ /* release resources. */ - H5free_memory( member_name ); - HDfree ( tmp_buf ); - - } /* i */ - - /*------------------------------------------------------------------------- - * release resources from 1st table - *------------------------------------------------------------------------- - */ - - if (H5Tclose( tid_1 ) < 0) - goto out; - if (H5Pclose( pid_1 ) < 0) - goto out; - if (H5Sclose( sid_1 ) < 0) - goto out; - if (H5Dclose( did_1 ) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * release resources from 2nd table - *------------------------------------------------------------------------- - */ - - if (H5Sclose( sid_2 ) < 0) - goto out; - if (H5Tclose( tid_2 ) < 0) - goto out; - if (H5Pclose( pid_2 ) < 0) - goto out; - if (H5Dclose( did_2 ) < 0) - goto out; + H5free_memory(member_name); + member_name = NULL; + } /* end for */ /*------------------------------------------------------------------------- * delete 1st table *------------------------------------------------------------------------- */ - - if (H5Ldelete( loc_id, dset_name, H5P_DEFAULT ) < 0) - return -1; + if(H5Ldelete(loc_id, dset_name, H5P_DEFAULT) < 0) + goto out; /*------------------------------------------------------------------------- * rename 2nd table *------------------------------------------------------------------------- */ - - if (H5Lmove( loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT ) < 0) - return -1; + if(H5Lmove(loc_id, "new", H5L_SAME_LOC, dset_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto out; /*------------------------------------------------------------------------- * attach the conforming table attributes @@ -2937,97 +2721,119 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) + goto out; /* open the dataset. */ - if ((did_1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did_3 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get the datatype */ - if ((tid_1 = H5Dget_type( did_1 )) < 0) + if((tid_3 = H5Dget_type(did_3)) < 0) goto out; /* set the attributes */ - if (H5TB_attach_attributes( table_title, loc_id, dset_name, nfields, tid_1 ) < 0) - return -1; + if(H5TB_attach_attributes(table_title, loc_id, dset_name, nfields, tid_3) < 0) + goto out; /*------------------------------------------------------------------------- * attach the fill attributes from previous table *------------------------------------------------------------------------- */ - - if (has_fill == 1) - { + if(has_fill) { if((sid_1 = H5Screate(H5S_SCALAR)) < 0) goto out; - for(i = 0; i < nfields; i++) - { - + for(i = 0; i < nfields; i++) { /* get the member type */ - if (( member_type_id = H5Tget_member_type( tid_1, (unsigned)i )) < 0) + if((member_type_id = H5Tget_member_type(tid_3, (unsigned)i)) < 0) goto out; /* get the member offset */ - member_offset = H5Tget_member_offset(tid_1, (unsigned)i); + member_offset = H5Tget_member_offset(tid_3, (unsigned)i); - strcpy(attr_name, "FIELD_"); - sprintf(aux, "%d", (int)i); - strcat(attr_name, aux); - sprintf(aux, "%s", "_FILL"); - strcat(attr_name, aux); + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i); - if ((attr_id = H5Acreate2(did_1, attr_name, member_type_id, sid_1, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if (H5Awrite(attr_id, member_type_id, tmp_fill_buf+member_offset) < 0) + if(H5Awrite(attr_id, member_type_id, tmp_fill_buf + member_offset) < 0) goto out; - if (H5Aclose(attr_id) < 0) + if(H5Aclose(attr_id) < 0) goto out; + attr_id = H5I_BADID; /* close the member type */ - if (H5Tclose(member_type_id) < 0) + if(H5Tclose(member_type_id) < 0) goto out; - } + member_type_id = H5I_BADID; + } /* end for */ /* close data space. */ - if (H5Sclose(sid_1) < 0) + if(H5Sclose(sid_1) < 0) goto out; + sid_1 = H5I_BADID; + } /* end if */ - } /*has_fill*/ - - /* release the datatype. */ - if (H5Tclose( tid_1 ) < 0) - goto out; - - /* end access to the dataset */ - if (H5Dclose( did_1 ) < 0) - goto out; - - /* Release resources. */ - HDfree ( tmp_fill_buf ); - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did_1); - H5Sclose(sid_1); - H5Tclose(tid_1); - H5Pclose(pid_1); - H5Dclose(did_2); - H5Sclose(sid_2); - H5Tclose(tid_2); - H5Pclose(pid_2); - - } H5E_END_TRY; - return -1; + if(member_name) + H5free_memory(member_name); + if(tmp_fill_buf) + HDfree(tmp_fill_buf); + if(tmp_buf) + HDfree(tmp_buf); + if(attr_id > 0) + if(H5Aclose(attr_id) < 0) + ret_val = -1; + if(preserve_id > 0) + if(H5Pclose(preserve_id) < 0) + ret_val = -1; + if(member_type_id > 0) + if(H5Tclose(member_type_id) < 0) + ret_val = -1; + if(read_type_id > 0) + if(H5Tclose(read_type_id) < 0) + ret_val = -1; + if(write_type_id > 0) + if(H5Tclose(write_type_id) < 0) + ret_val = -1; + if(tid_1 > 0) + if(H5Tclose(tid_1) < 0) + ret_val = -1; + if(pid_1 > 0) + if(H5Pclose(pid_1) < 0) + ret_val = -1; + if(sid_1 > 0) + if(H5Sclose(sid_1) < 0) + ret_val = -1; + if(did_1 > 0) + if(H5Dclose(did_1) < 0) + ret_val = -1; + if(sid_2 > 0) + if(H5Sclose(sid_2) < 0) + ret_val = -1; + if(tid_2 > 0) + if(H5Tclose(tid_2) < 0) + ret_val = -1; + if(pid_2 > 0) + if(H5Pclose(pid_2) < 0) + ret_val = -1; + if(did_2 > 0) + if(H5Dclose(did_2) < 0) + ret_val = -1; + if(tid_3 > 0) + if(H5Tclose(tid_3) < 0) + ret_val = -1; + if(did_3 > 0) + if(H5Dclose(did_3) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TBdelete_field() */ -} /*------------------------------------------------------------------------- * * Table attribute functions @@ -3048,22 +2854,16 @@ out: * * Comments: * -* Modifications: -* *------------------------------------------------------------------------- */ - -herr_t H5TBAget_title( hid_t loc_id, - char *table_title ) +herr_t H5TBAget_title(hid_t loc_id, + char *table_title) { - /* Get the TITLE attribute */ - if(H5LT_get_attribute_disk( loc_id, "TITLE", table_title ) < 0) + if(H5LT_get_attribute_disk(loc_id, "TITLE", table_title) < 0) return -1; - return 0; - } /*------------------------------------------------------------------------- @@ -3079,8 +2879,6 @@ herr_t H5TBAget_title( hid_t loc_id, * * Comments: * -* Modifications: -* *------------------------------------------------------------------------- */ htri_t H5TBAget_fill(hid_t loc_id, @@ -3088,57 +2886,46 @@ htri_t H5TBAget_fill(hid_t loc_id, hid_t dset_id, unsigned char *dst_buf) { - - hsize_t nfields; - hsize_t nrecords; - char attr_name[255]; - char aux[255]; - hsize_t i; - size_t *src_offset; - int has_fill=0; + hsize_t nfields; + hsize_t nrecords; + hsize_t i; + size_t *src_offset = NULL; + char attr_name[255]; + htri_t has_fill = FALSE; + htri_t ret_val = -1; /* get the number of records and fields */ - if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0) - return -1; - - src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)); + if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) + goto out; - if (src_offset == NULL ) - return -1; + if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) + goto out; /* get field info */ - if (H5TBget_field_info( loc_id, dset_name, NULL, NULL, src_offset, NULL ) < 0) + if(H5TBget_field_info(loc_id, dset_name, NULL, NULL, src_offset, NULL) < 0) goto out; - for ( i = 0; i < nfields; i++) - { - strcpy( attr_name, "FIELD_" ); - sprintf( aux, "%d", (int)i ); - strcat( attr_name, aux ); - sprintf( aux, "%s", "_FILL" ); - strcat( attr_name, aux ); + for(i = 0; i < nfields; i++) { + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i); /* check if we have the _FILL attribute */ - has_fill = H5LT_find_attribute( dset_id, attr_name ); + if((has_fill = H5LT_find_attribute(dset_id, attr_name)) < 0) + goto out; /* get it */ - if (has_fill == 1 ) - { - if(H5LT_get_attribute_disk( dset_id, attr_name, dst_buf+src_offset[i] ) < 0) + if(has_fill) + if(H5LT_get_attribute_disk(dset_id, attr_name, dst_buf + src_offset[i]) < 0) goto out; - } - - } - - HDfree( src_offset ); + } /* end for */ - return has_fill; + ret_val = has_fill; out: - HDfree( src_offset ); - return -1; - -} + if(src_offset) + HDfree(src_offset); + + return ret_val; +} /* end H5TBAget_fill() */ /*------------------------------------------------------------------------- @@ -3161,90 +2948,75 @@ out: * * Comments: * -* Modifications: -* May 08, 2003 -* In version 2.0 of Table, the number of records is stored as an -* attribute "NROWS" -* November 24, 2008 -* In version 3.0 of Table, "NROWS" was deprecated -* -* *------------------------------------------------------------------------- */ - -herr_t H5TBget_table_info ( hid_t loc_id, +herr_t H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, - hsize_t *nrecords ) + hsize_t *nrecords) { - hid_t tid=-1; - hid_t sid=-1; - hid_t did=-1; - int num_members; + hid_t tid = H5I_BADID; + hid_t sid = H5I_BADID; + hid_t did = H5I_BADID; hsize_t dims[1]; + int num_members; + herr_t ret_val = -1; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + goto out; /* get the datatype */ - if ((tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; /* get the number of members */ - if ((num_members = H5Tget_nmembers( tid )) < 0) + if((num_members = H5Tget_nmembers(tid)) < 0) goto out; /*------------------------------------------------------------------------- * get number of nfields *------------------------------------------------------------------------- */ - - if (nfields) + if(nfields) *nfields = (hsize_t)num_members; - /*------------------------------------------------------------------------- * get number of records *------------------------------------------------------------------------- */ - - if (nrecords) - { + if(nrecords) { /* get the dataspace handle */ - if ((sid = H5Dget_space( did )) < 0) + if((sid = H5Dget_space(did)) < 0) goto out; /* get dimension */ - if (H5Sget_simple_extent_dims( sid, dims, NULL) < 0) + if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) goto out; /* terminate access to the dataspace */ - if (H5Sclose( sid ) < 0) + if(H5Sclose(sid) < 0) goto out; + sid = H5I_BADID; *nrecords = dims[0]; - } - - /* close */ - if (H5Tclose( tid ) < 0) - goto out; - if (H5Dclose( did ) < 0) - return -1; + } /* end if */ - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid); - } H5E_END_TRY; - return -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; -} + return ret_val; +} /* end H5TBget_table_info() */ /*------------------------------------------------------------------------- * Function: H5TBget_field_info @@ -3259,100 +3031,101 @@ out: * * Comments: * -* Modifications: -* -* *------------------------------------------------------------------------- */ -herr_t H5TBget_field_info( hid_t loc_id, +herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes, size_t *field_offsets, - size_t *type_size ) + size_t *type_size) { - hid_t did = -1; /* dataset ID */ - hid_t tid = -1; /* file type ID */ - hid_t n_tid = -1; /* native type ID */ - hid_t m_tid = -1; /* member type ID */ - hid_t nm_tid = -1; /* native member ID */ - hssize_t nfields; - hssize_t i; + hid_t did = H5I_BADID; /* dataset ID */ + hid_t tid = H5I_BADID; /* file type ID */ + hid_t n_tid = H5I_BADID; /* native type ID */ + hid_t m_tid = H5I_BADID; /* member type ID */ + hid_t nm_tid = H5I_BADID; /* native member ID */ + hssize_t nfields; + hssize_t i; + herr_t ret_val = -1; /* open the dataset. */ - if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ - if (( tid = H5Dget_type( did )) < 0) + if((tid = H5Dget_type(did)) < 0) goto out; - if ((n_tid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0) + if((n_tid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0) goto out; /* get the type size */ if(type_size) - *type_size = H5Tget_size(n_tid); + if(0 == (*type_size = H5Tget_size(n_tid))) + goto out; /* get the number of members */ - if (( nfields = H5Tget_nmembers( tid )) < 0) + if((nfields = H5Tget_nmembers(tid)) < 0) goto out; /* iterate tru the members */ - for ( i = 0; i < nfields; i++) { + for(i = 0; i < nfields; i++) { /* get the member name */ if(field_names) { - char *member_name; + char *member_name; - member_name = H5Tget_member_name(tid, (unsigned)i); + if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)i))) + goto out; strcpy(field_names[i], member_name); H5free_memory(member_name); } /* end if */ /* get the member type */ - if(( m_tid = H5Tget_member_type( tid,(unsigned) i )) < 0) + if((m_tid = H5Tget_member_type(tid, (unsigned)i)) < 0) goto out; - if((nm_tid = H5Tget_native_type(m_tid,H5T_DIR_DEFAULT)) < 0) + if((nm_tid = H5Tget_native_type(m_tid, H5T_DIR_DEFAULT)) < 0) goto out; /* get the member size */ if(field_sizes) - field_sizes[i] = H5Tget_size(nm_tid); + if(0 == (field_sizes[i] = H5Tget_size(nm_tid))) + goto out; /* get the member offset */ if(field_offsets) field_offsets[i] = H5Tget_member_offset(n_tid, (unsigned) i); /* close the member types */ - if (H5Tclose( m_tid ) < 0) + if(H5Tclose(m_tid) < 0) goto out; - if (H5Tclose( nm_tid ) < 0) + m_tid = H5I_BADID; + if(H5Tclose(nm_tid) < 0) goto out; - } /* i */ + nm_tid = H5I_BADID; + } /* end for */ - /* close */ - if (H5Tclose( tid ) < 0) - goto out; - if (H5Tclose( n_tid ) < 0) - goto out; - if (H5Dclose( did ) < 0) - return -1; - - return 0; + ret_val = 0; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Tclose(tid); - H5Tclose(n_tid); - H5Tclose(m_tid); - H5Tclose(nm_tid); - } H5E_END_TRY; - return -1; + if(tid > 0) + if(H5Tclose(tid) < 0) + ret_val = -1; + if(n_tid > 0) + if(H5Tclose(n_tid) < 0) + ret_val = -1; + if(m_tid > 0) + if(H5Tclose(m_tid) < 0) + ret_val = -1; + if(nm_tid > 0) + if(H5Tclose(nm_tid) < 0) + ret_val = -1; + if(did > 0) + if(H5Dclose(did) < 0) + ret_val = -1; -} + return ret_val; +} /* end H5TBget_field_info() */ /*------------------------------------------------------------------------- * @@ -3366,7 +3139,7 @@ out: * * Purpose: Find a string field * -* Return: Success: 0, Failure: -1 +* Return: Success: TRUE/FALSE, Failure: N/A * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -3374,28 +3147,25 @@ out: * *------------------------------------------------------------------------- */ - static -int H5TB_find_field( const char *field, const char *field_list ) +hbool_t H5TB_find_field(const char *field, const char *field_list) { const char *start = field_list; const char *end; - while ( (end = HDstrstr( start, "," )) != 0 ) - { + while((end = HDstrstr(start, ",")) != 0) { ptrdiff_t count = end - start; - if(HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field) ) - return 1; + if(HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field)) + return TRUE; start = end + 1; - } - - if(HDstrcmp( start, field ) == 0 ) - return 1; + } /* end while */ - return -1; -} + if(HDstrcmp(start, field) == 0) + return TRUE; + return FALSE; +} /* end H5TB_find_field() */ /*------------------------------------------------------------------------- * Function: H5TB_attach_attributes @@ -3412,63 +3182,56 @@ int H5TB_find_field( const char *field, const char *field_list ) * * Comments: * -* Modifications: -* *------------------------------------------------------------------------- */ - static -herr_t H5TB_attach_attributes( const char *table_title, +herr_t H5TB_attach_attributes(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields, - hid_t tid ) + hid_t tid) { - - char attr_name[255]; - char *member_name; - char aux[255]; - hsize_t i; + char attr_name[255]; + char *member_name = NULL; + hsize_t i; + herr_t ret_val = -1; /* attach the CLASS attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, "CLASS", TABLE_CLASS ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, "CLASS", TABLE_CLASS) < 0) goto out; /* attach the VERSION attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, "VERSION", TABLE_VERSION ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, "VERSION", TABLE_VERSION) < 0) goto out; /* attach the TITLE attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, "TITLE", table_title ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, "TITLE", table_title) < 0) goto out; /* attach the FIELD_ name attribute */ - for ( i = 0; i < nfields; i++) - { - + for(i = 0; i < nfields; i++) { /* get the member name */ - member_name = H5Tget_member_name( tid, (unsigned)i ); + if(NULL == (member_name = H5Tget_member_name(tid, (unsigned)i))) + goto out; - strcpy( attr_name, "FIELD_" ); - sprintf( aux, "%d", (int)i ); - strcat( attr_name, aux ); - sprintf( aux, "%s", "_NAME" ); - strcat( attr_name, aux ); + HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i); /* attach the attribute */ - if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0) + if(H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0) goto out; - H5free_memory( member_name ); - - } + H5free_memory(member_name); + member_name = NULL; + } /* end for */ - return 0; + ret_val = 0; out: - return -1; + if(member_name) + H5free_memory(member_name); -} + return ret_val; +} /* end H5TB_attach_attributes() */ /*------------------------------------------------------------------------- * Function: H5TB_create_type @@ -3483,11 +3246,8 @@ out: * * Comments: * -* Modifications: -* *------------------------------------------------------------------------- */ - static hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, @@ -3496,85 +3256,75 @@ hid_t H5TB_create_type(hid_t loc_id, const size_t *field_sizes, hid_t ftype_id) { - hid_t mem_type_id; - hid_t mtype_id=-1; - hid_t nmtype_id=-1; + hid_t mem_type_id = H5I_BADID; + hid_t mtype_id = H5I_BADID; + hid_t nmtype_id = H5I_BADID; size_t size_native; - hsize_t nfields; - char **fnames; + hsize_t nfields = 0; + char **fnames = NULL; unsigned i; + herr_t ret_val = -1; /* get the number of fields */ - if (H5TBget_table_info(loc_id,dset_name,&nfields,NULL) < 0) - return -1; + if(H5TBget_table_info(loc_id, dset_name, &nfields, NULL) < 0) + goto out; - if ((fnames = (char**) HDmalloc(sizeof(char*)*(size_t)nfields))==NULL) - return -1; + if(NULL == (fnames = (char**)HDcalloc(sizeof(char*), (size_t)nfields))) + goto out; - for ( i = 0; i < nfields; i++) - { - if ((fnames[i] = (char*) HDmalloc(sizeof(char)*HLTB_MAX_FIELD_LEN))==NULL) - { - HDfree(fnames); - return -1; - } - } + for(i = 0; i < nfields; i++) + if(NULL == (fnames[i] = (char*)HDmalloc(HLTB_MAX_FIELD_LEN))) + goto out; /* get field info */ - if (H5TBget_field_info(loc_id,dset_name,fnames,NULL,NULL,NULL) < 0) + if(H5TBget_field_info(loc_id, dset_name, fnames, NULL, NULL, NULL) < 0) goto out; /* create the memory data type */ - if ((mem_type_id=H5Tcreate(H5T_COMPOUND,type_size)) < 0) + if ((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) goto out; /* get each field ID and adjust its size, if necessary */ - for ( i = 0; i < nfields; i++) - { - if ((mtype_id = H5Tget_member_type(ftype_id,i)) < 0) + for(i = 0; i < nfields; i++) { + if((mtype_id = H5Tget_member_type(ftype_id, i)) < 0) goto out; - if ((nmtype_id = H5Tget_native_type(mtype_id,H5T_DIR_DEFAULT)) < 0) + if((nmtype_id = H5Tget_native_type(mtype_id, H5T_DIR_DEFAULT)) < 0) goto out; - size_native = H5Tget_size(nmtype_id); - if (field_sizes[i]!=size_native) - { - if (H5Tset_size(nmtype_id,field_sizes[i]) < 0) + if(0 == (size_native = H5Tget_size(nmtype_id))) + goto out; + if(field_sizes[i] != size_native) + if(H5Tset_size(nmtype_id, field_sizes[i]) < 0) goto out; - } - if (H5Tinsert(mem_type_id,fnames[i],field_offset[i],nmtype_id) < 0) + if(H5Tinsert(mem_type_id, fnames[i], field_offset[i], nmtype_id) < 0) goto out; - if (H5Tclose(mtype_id) < 0) + if(H5Tclose(mtype_id) < 0) goto out; - if (H5Tclose(nmtype_id) < 0) + mtype_id = H5I_BADID; + if(H5Tclose(nmtype_id) < 0) goto out; - } - - for ( i=0; i<nfields; i++) - { - HDfree (fnames[i]); - } - HDfree (fnames); + nmtype_id = H5I_BADID; + } /* end for */ - return mem_type_id; + ret_val = mem_type_id; - /* error zone */ out: - H5E_BEGIN_TRY - { - H5Tclose(mtype_id); - H5Tclose(nmtype_id); - } H5E_END_TRY; - for ( i=0; i<nfields; i++) - { - if (fnames[i]) - HDfree (fnames[i]); - } - if (fnames) - HDfree (fnames); - return -1; - -} + if(fnames) { + for(i = 0; i < nfields; i++) + if(fnames[i]) + HDfree(fnames[i]); + HDfree(fnames); + } /* end if */ + if(mtype_id > 0) + if(H5Tclose(mtype_id) < 0) + ret_val = -1; + if(nmtype_id > 0) + if(H5Tclose(nmtype_id) < 0) + ret_val = -1; + if(ret_val < 0 && mem_type_id > 0) + H5Tclose(mem_type_id); + return ret_val; +} /* end H5TB_create_type() */ /*------------------------------------------------------------------------- * @@ -3597,26 +3347,25 @@ out: * * Comments: Called by H5TBappend_records and H5PTappend_records * -* Modifications: -* *------------------------------------------------------------------------- */ -herr_t H5TB_common_append_records( hid_t dataset_id, +herr_t H5TB_common_append_records(hid_t dataset_id, hid_t mem_type_id, size_t nrecords, hsize_t orig_table_size, - const void * buf) + const void *buf) { - hsize_t count[1]; - hsize_t offset[1]; hid_t sid = H5I_BADID; hid_t m_sid = H5I_BADID; + hsize_t count[1]; + hsize_t offset[1]; hsize_t dims[1]; hsize_t mem_dims[1]; + herr_t ret_val = -1; /* extend the dataset */ dims[0] = nrecords + orig_table_size; - if (H5Dset_extent(dataset_id, dims) < 0) + if(H5Dset_extent(dataset_id, dims) < 0) goto out; /* create a simple memory data space */ @@ -3625,37 +3374,31 @@ herr_t H5TB_common_append_records( hid_t dataset_id, goto out; /* get a copy of the new file data space for writing */ - if ((sid = H5Dget_space(dataset_id)) < 0) + if((sid = H5Dget_space(dataset_id)) < 0) goto out; /* define a hyperslab in the dataset */ offset[0] = orig_table_size; count[0] = nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* write the records */ - if (H5Dwrite( dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf ) < 0) - goto out; - - /* close */ - if (H5Sclose( m_sid ) < 0) - goto out; - if (H5Sclose( sid ) < 0) + if(H5Dwrite(dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf) < 0) goto out; - return 0; + ret_val = 0; out: - H5E_BEGIN_TRY - { - H5Sclose(m_sid); - H5Sclose(sid); - } - H5E_END_TRY; - return -1; -} + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + return ret_val; +} /* end H5TB_common_append_records() */ /*------------------------------------------------------------------------- * Function: H5TB_common_read_records @@ -3671,60 +3414,53 @@ out: * * Comments: Called by H5TBread_records and H5PTread_records * -* Modifications: -* -* *------------------------------------------------------------------------- */ -herr_t H5TB_common_read_records( hid_t dataset_id, +herr_t H5TB_common_read_records(hid_t dataset_id, hid_t mem_type_id, hsize_t start, size_t nrecords, hsize_t table_size, void *buf) { - hsize_t count[1]; - hsize_t offset[1]; hid_t sid = H5I_BADID; hid_t m_sid = H5I_BADID; + hsize_t count[1]; + hsize_t offset[1]; hsize_t mem_size[1]; + herr_t ret_val = -1; /* make sure the read request is in bounds */ - if (start + nrecords > table_size ) + if(start + nrecords > table_size) goto out; /* get the dataspace handle */ - if ((sid = H5Dget_space( dataset_id )) < 0) + if((sid = H5Dget_space(dataset_id)) < 0) goto out; /* define a hyperslab in the dataset of the size of the records */ offset[0] = start; count[0] = nrecords; - if (H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) goto out; /* create a memory dataspace handle */ mem_size[0] = count[0]; - if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0) - goto out; - if ((H5Dread( dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf)) < 0) - goto out; - - /* close */ - if (H5Sclose( m_sid ) < 0) + if((m_sid = H5Screate_simple(1, mem_size, NULL)) < 0) goto out; - if (H5Sclose( sid ) < 0) + if((H5Dread(dataset_id, mem_type_id, m_sid, sid, H5P_DEFAULT, buf)) < 0) goto out; - return 0; + ret_val = 0; out: - H5E_BEGIN_TRY - { - H5Sclose(sid); - H5Sclose(m_sid); - } - H5E_END_TRY; - return -1; -} + if(m_sid > 0) + if(H5Sclose(m_sid) < 0) + ret_val = -1; + if(sid > 0) + if(H5Sclose(sid) < 0) + ret_val = -1; + + return ret_val; +} /* end H5TB_common_read_records() */ diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index be7034d..8481d6f 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -670,7 +670,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 168 +LT_VERS_REVISION = 174 LT_VERS_AGE = 0 # This library is our main target. diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 814b351..5d68eeb 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -771,9 +771,9 @@ out: *------------------------------------------------------------------------- */ -static int read_data( const char* fname, /*IN*/ +static int read_data(const char* fname, /*IN*/ hsize_t *width, /*OUT*/ - hsize_t *height /*OUT*/ ) + hsize_t *height /*OUT*/) { int i, n; int color_planes; diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt index df7526e..6887c60 100644 --- a/perform/CMakeLists.txt +++ b/perform/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_PERFORM ) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Setup include Directories diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h index b407ecb..b2f8220 100644 --- a/perform/sio_standalone.h +++ b/perform/sio_standalone.h @@ -79,6 +79,7 @@ #endif /* H5_HAVE_ALARM */ #define HDasctime(T) asctime(T) #define HDasin(X) asin(X) +#define HDasprintf asprintf /*varargs*/ #define HDassert(X) assert(X) #define HDatan(X) atan(X) #define HDatan2(X,Y) atan2(X,Y) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 372698a..31e3917 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -1,154 +1,244 @@ ************************************************************************ -* Build and Install HDF5 C/C++ Library with CMake * +* Build and Install HDF5 C, C++, Fortran and High-Level Libraries * +* and tools with CMake * ************************************************************************ Table of Contents -Section I: Quick Step Building HDF5 Libraries with CMake Script Mode -Section II: Quick Step Building HDF5 Libraries with CMake Command Mode -Section III: Preconditions -Section IV: Building HDF5 C/C++ Libraries with CMake -Section V: All Options for HDF5 C/C++ Libraries with CMake -Section VI: User Defined Options for HDF5 Libraries with CMake -Section VII: APPENDIX +Section I: Preconditions +Section II: Quick Step Building HDF5 Libraries with CMake Script Mode +Section III: Quick Step Building HDF5 Libraries with CMake Command Mode +Section IV: Further considerations +Section V: Options for building HDF5 Libraries with CMake command line +Section VI: CMake option defaults for HDF5 +Section VII: User Defined Options for HDF5 Libraries with CMake +Section VIII: Options for platform configuration files ************************************************************************ +======================================================================== +I. Preconditions +======================================================================== +Obtaining HDF5 source code + 1. Create a directory for your development; for example, "myhdfstuff". + + 2. Obtain compressed (*.tar or *.zip) HDF5 source from + http://www.hdfgroup.org/ftp/HDF5/current/src/ + and put it in "myhdfstuff". + Do not uncompress. + +CMake version + 1. We suggest you obtain the latest CMake from the Kitware web site. + The HDF5 1.8."X" product requires a minimum CMake version 2.8.12, + where "X" is the current HDF5 release version. + ======================================================================== -I. Quick Step Building HDF5 Libraries with CMake Script Mode +II. Quick Step Building HDF5 Libraries with CMake Script Mode ======================================================================== This short set of instructions is written for users who want to quickly -build the HDF5 Library and tools from the HDF5 source code package -using the CMake tools. HDF Group recommends using a ctest script to build -HDF5. +build the HDF5 C, C++, Fortran, and High-level shared libraries and tools +from the HDF5 source code package using the CMake tools. This procedure +will use the default settings in the config/cmake/cacheinit.cmake file. +HDF Group recommends using the ctest script mode to build HDF5. -To build HDF5 with the SZIP and ZLIB external libraries you will need to: +The following files referenced below are available at the HDF web site: + http://www.hdfgroup.org/HDF5/release/cmakebuild.html + +CMake build script: + CTestScript.cmake - 1. Create a directory for your development; myhdfstuff. +External compression szip and zlib libraries: + SZip.tar.gz + ZLib.tar.gz - 2. Create a directory for the HDF5 source; hdf5-1.8 in myhdfstuff. +Platform configuration files: + HDF518Windows64CMake.cmake + HDF518Windows32CMake.cmake + HDF518LinuxCMake.cmake + HDF518MacCMake.cmake - 3. Download the SZip.tar.gz and ZLib.tar.gz to your development directory, - (See Section VII: APPENDIX for instructions). Both are needed if - building with external libraries; do not uncompress them. +To build HDF5 with the SZIP and ZLIB external libraries you will need to: + + 1. Change to the development directory "myhdfstuff". + + 2. Download the SZip.tar.gz and ZLib.tar.gz to "myhdfstuff". + Do not uncompress the files. - 4. Download or create the CTestScript.cmake file in your development - directory, (See Section VII: APPENDIX for instructions and an example). - - 5. Download or create a platform configuration file in your development - directory, (See Section VII: APPENDIX for instructions and an example). - This file calls CTestScript.cmake; the platform configuration file can - be modified. CTestScript.cmake file should not be modified. + 3. Download the CTestScript.cmake file to "myhdfstuff". + CTestScript.cmake file should not be modified. + + 4. Download a platform configuration file to "myhdfstuff". + Do not modify the file unless you want to change default build + environment. - 6. From your development directory execute the CTest Script with the - following options: + 5. From the "myhdfstuff" directory execute the CTest Script with the + following options: - ctest -S <configuration file>,<hdf5src> -C RelWithDebInfo -VV -O hdf5.log + ctest -S <configuration file> -C Release -VV -O hdf5.log - 7. This will create an install package in the myhdfstuff/hdf5-1.8/build folder. + The command above will configure, build, test, and create an install + package in the myhdfstuff/hdf5-1.8/build folder. - Where: - "configuration file" is the platform configuration file from step6; - HDF518WindowsRWDICMake.cmake, HDF518LinuxRWDICMake.cmake, or - HDF518MacRWDICMake.cmake can be downloaded from the HDF Group website. - "hdf5src" is the uncompressed HDF5 source code directory. No path - should be specified. - - The -S option uses the script version of ctest. + The -S option uses the script version of ctest. - The value for the -C option (as shown above, "-C RelWithDebInfo") must - match the setting for CTEST_BUILD_CONFIGURATION in the platform - configuration file. + The value for the -C option (as shown above, "-C Release") must + match the setting for CTEST_BUILD_CONFIGURATION in the platform + configuration file. - The -VV option is for verbose; Use -V for less verbose. + The -VV option is for verbose; use -V for less verbose. - The "-O hdf5.log" option saves the output to a log file hdf5.log. + The "-O hdf5.log" option saves the output to a log file hdf5.log. + 6. To install, "X" is the current release version + + On Windows, execute: + HDF5-1.8."X"-win32.exe or HDF5-1.8."X"-win64.exe + By default this program will install the hdf5 library into the + "C:\Program Files" directory and will create the following + directory structure: + HDF_Group + --HDF5 + ----1.8."X" + ------bin + ------include + ------lib + ------cmake + + On Linux, change to the install destination directory + (create it if doesn't exist) and execute: + <path-to>/myhdfstuff/hdf5-1.8/build/HDF5-1.8."X"-Linux.sh + After accepting the license, the script will prompt: + By default the HDF5 will be installed in: + "<current directory>/HDF5-1.8."X"-Linux" + Do you want to include the subdirectory HDF5-1.8."X"-Linux? + Saying no will install in: "<current directory>" [Yn]: + Note that the script will create the following directory structure + relative to the install point: + HDF_Group + --HDF5 + ----1.8."X" + ------bin + ------include + ------lib + ------share + + On Mac you will find HDF5-1.8."X"-Darwin.dmg in the build folder. Click + on the dmg file to proceed with installation. After accepting the license, + there will be a folder with the following structure: + HDF_Group + --HDF5 + ----1.8."X" + ------bin + ------include + ------lib + ------share + + By default the installation will create the bin, include, lib and cmake + folders in the <install destination directory>/HDF_Group/HDF5/1.8. ======================================================================== -II. Quick Step Building HDF5 Libraries with CMake +III. Quick Step Building HDF5 C Static Libraries and Tools with CMake ======================================================================== Notes: This short set of instructions is written for users who want to - quickly build the HDF5 Library and tools from the HDF5 source code - package using the CMake command line tools. + quickly build the just the HDF5 C static library and tools from + the HDF5 source code package using the CMake command line tools. - A. Windows Quick Step Building HDF5 Libraries with CMake Using VS2010 + Go through these steps: - Go through these steps: + 1. Change to the development directory "myhdfstuff". - 1. Locate the source files in: - c:\MyHDFstuff\hdf5 - - 2. Create a build folder at: - c:\MyHDFstuff\hdf5\build - - 3. Open a command prompt at: - c:\MyHDFstuff\hdf5\build - - 4. Configure the C library, tools and tests with this command: - cmake -G "Visual Studio 11" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON .. - The two dots on the end of the command is the location of the source. - The CMAKE_BUILD_TYPE must match the configuration type. + 2. Uncompress the HDF5 source file - 5. Build the C library, tools and tests with this command: - cmake --build . --config Release + 3. Create a folder "build" in the "myhdfstuff" directory. - 6. Test the C library and tools with this command: - ctest . -C Release + 4. Change into the "build" folder. - 7. Create an install image with this command: - cpack -C Release CPackConfig.cmake - - 8. Install with this command: - HDF5-1.8.13-win32.exe - - B. Linux Quick Step Building HDF5 Libraries with CMake Using GCC + 5. Configure the C library, tools and tests with one of the following commands: - Go through these steps: + On Windows 32 bit + cmake -G "Visual Studio 11" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.8."X" - 1. Locate the source files in: - ~/MyHDFstuff/hdf5 - - 2. Create a build folder at: - ~/MyHDFstuff/hdf5/build - - 3. Open a command prompt at: - ~/MyHDFstuff/hdf5/build - - 4. Configure the C library, tools and tests with this command: - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON .. - The two dots on the end of the command is the location of the source. - The CMAKE_BUILD_TYPE must match the configuration type. - - 5. Build the C library, tools and tests with this command: - cmake --build . --config Release + On Windows 64 bit + cmake -G "Visual Studio 11 Win64" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.8."X" - 6. Test the C library and tools with this command: - ctest . -C Release + On Linux and Mac + cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ../hdf5-1.8."X" + + where "X" is the current release version. + + 6. Build the C library, tools and tests with this command: + cmake --build . --config Release - 7. Create an install image with this command: - cpack -C Release CPackConfig.cmake + 7. Test the C library and tools with this command: + ctest . -C Release - 8. Install with this command: - HDF5-1.8.13-Linux.sh + 8. Create an install image with this command: + cpack -C Release CPackConfig.cmake - + 9. To install + On Windows, execute: + HDF5-1.8."X"-win32.exe or HDF5-1.8."X"-win64.exe + By default this program will install the hdf5 library into the + "C:\Program Files" directory and will create the following + directory structure: + HDF_Group + --HDF5 + ----1.8."X" + ------bin + ------include + ------lib + ------cmake + + On Linux, change to the install destination directory + (create if doesn't exist) and execute: + <path-to>/myhdfstuff/build/HDF5-1.8."X"-Linux.sh + After accepting the license, the script will prompt: + By default the HDF5 will be installed in: + "<current directory>/HDF5-1.8."X"-Linux" + Do you want to include the subdirectory HDF5-1.8."X"-Linux? + Saying no will install in: "<current directory>" [Yn]: + Note that the script will create the following directory structure + relative to the install point: + HDF_Group + --HDF5 + ----1.8."X" + ------bin + ------include + ------lib + ------share + + On Mac you will find HDF5-1.8."X"-Darwin.dmg in the build folder. Click + on the dmg file to proceed with installation. After accepting the license, + there will be a folder with the following structure: + HDF_Group + --HDF5 + ----1.8."X" + ------bin + ------include + ------lib + ------share ======================================================================== -III. Preconditions +IV. Further considerations ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF5 1.8.x product requires a minimum CMake version 2.8.12. + web site. The HDF5 1.8."X" product requires a minimum CMake version 2.8.12. 2. If you plan to use Zlib or Szip: A. Download the binary packages and install them in a central location. For example on Windows, create a folder extlibs and install the - packages there. + packages there. Add the following CMake options: + -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib + -DZLIB_INCLUDE_DIR:PATH=some_location/include + -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib + -DSZIP_INCLUDE_DIR:PATH=some_location/include + where "some_location" is the full path to the extlibs folder. + B. Use source packages from an SVN server by adding the following CMake options: HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" @@ -156,6 +246,7 @@ III. Preconditions SZIP_SVN_URL:STRING="http://some_location/szip/trunk" where "some_location" is the URL to the SVN repository. Also set CMAKE_BUILD_TYPE to the configuration type. + C. Use source packages from a compressed file by adding the following CMake options: HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" @@ -168,10 +259,10 @@ III. Preconditions 3. If you are building on Apple Darwin platforms, you should add the following options: - Compiler choice - use xcode by setting the ENV variables of CC and CXX - Shared fortran is not supported, build static: + Compiler choice - use xcode by setting the ENV variables of CC and CXX + Shared fortran is not supported, build static: BUILD_SHARED_LIBS:BOOL=OFF - Additional options: + Additional options: CMAKE_ANSI_CFLAGS:STRING=-fPIC CTEST_USE_LAUNCHERS:BOOL=ON CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF @@ -184,7 +275,7 @@ III. Preconditions the settings for the developers' environment. Then the only options needed on the command line are those options that are different. Example using HDF default cache file: - cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 11" \ + cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 11" \ -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=Release .. @@ -213,25 +304,24 @@ Notes: CMake and HDF5 Notes: CMake in General 1. More information about using CMake can be found at the KitWare site at - www.cmake.org. + www.cmake.org. 2. CMake uses the command line; however, the visual CMake tool is available for the configuration step. The steps are similar for all the operating systems supported by CMake. - ======================================================================== -IV. Building HDF5 C/C++ Libraries with CMake +V. Options for Building HDF5 Libraries with the CMake Command Line ======================================================================== -To build the HDF5 C/C++ Libraries with CMake, go through these five steps: +To build the HDF5 Libraries with CMake, go through these five steps: 1. Run CMake 2. Configure the cache settings 3. Build HDF5 4. Test HDF5 - 5. Packaging HDF5 (create install image) + 5. Package HDF5 (create install image) These five steps are described in detail below. @@ -255,7 +345,7 @@ These five steps are described in detail below. RECOMMENDED: Users can perform the configuration step without using the visual cmake-gui program. We use the file cacheinit.cmake in the - config/cmake folder for our testing. This file enables all the + config/cmake source folder for our testing. This file enables all of the basic options and we turn specific options on or off for testing using the following command line within the build directory: @@ -309,11 +399,11 @@ These five steps are described in detail below. set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) set (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE) - set (HDF5_USE_18_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.8.x API by default" FORCE) set (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE) set (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE) set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) - set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE) + set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE) + set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE) set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE) set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) @@ -325,7 +415,7 @@ These five steps are described in detail below. 2.1 Visual CMake users, click the Configure button. If this is the first time you are running cmake-gui in this directory, you will be prompted for the - generator you wish to use (for example on Windows, Visual Studio 9 2008). + generator you wish to use (for example on Windows, Visual Studio 11). CMake will read in the CMakeLists.txt files from the source directory and display options for the HDF5 project. After the first configure you can adjust the cache settings and/or specify the locations of other programs. @@ -432,7 +522,7 @@ These five steps are described in detail below. installation and needs. 7. More information about using CMake can be found at the KitWare site, - www.cmake.org. + www.cmake.org. 8. Nullsoft Scriptable Install System The Nullsoft Scriptable Install System (NSIS) is an open source installation @@ -445,11 +535,12 @@ These five steps are described in detail below. ======================================================================== -V. More Options for HDF5 C/C++ Libraries with CMake +VI. CMake Option Defaults for HDF5 ======================================================================== In the options listed below, there are three columns of information: -Option Name, Option Description, and Option Default. +Option Name, Option Description, and Option Default. +The config/cmake/cacheinit.cmake file overrides the following values. ---------------- General Build Options --------------------- BUILD_SHARED_LIBS "Build Shared Libraries" OFF @@ -485,7 +576,6 @@ HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF HDF5_TEST_VFD "Execute tests with different VFDs" OFF HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF -HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON @@ -518,7 +608,7 @@ endif (WINDOWS) ======================================================================== -VI. User Defined Options for HDF5 Libraries with CMake +VII. User Defined Options for HDF5 Libraries with CMake ======================================================================== Support for User Defined macros and options has been added. The file @@ -531,384 +621,125 @@ UserMacros.cmake file. Then enable the option to the CMake configuration, build and test process. ======================================================================== -VII. APPENDIX +VIII. Options for Platform Configuration Files ======================================================================== -Below are examples of the ctest scripts used by The HDF Group. -See the script, cmakehdf5, in the bin folder for a smaller and limited -function shell script version of the following general scripts. +Below is the HDF518LinuxCmake.cmake ctest script with extra comments. The example is for a linux machine, but the same scripts can be used on a Windows machine by adjusting the CTEST_CMAKE_GENERATOR option in the -product specific script. - -NOTE: these files are available at the HDF web site: - http://www.hdfgroup.org/HDF5/release/cmakebuild.html - - CTestScript.cmake - SZip.tar.gz - ZLib.tar.gz - - HDF518WindowsRWDICMake.cmake - HDF518LinuxRWDICMake.cmake - - -======================================================================== -CTestScript.cmake -======================================================================== - -The CTestScript.cmake script, shown below, is a common ctest script that -is used to build, test, and package HDF5 Library files. - - - -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -######################################################## -# This dashboard is maintained by The HDF Group -# For any comments please contact cdashhelp@hdfgroup.org -# -######################################################## -# ----------------------------------------------------------- -# -- Get environment -# ----------------------------------------------------------- -if(NOT SITE_OS_NAME) - ## machine name not provided - attempt to discover with uname - ## -- set hostname - ## -------------------------- - find_program(HOSTNAME_CMD NAMES hostname) - exec_program(${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) - set(CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") - find_program(UNAME NAMES uname) - macro(getuname name flag) - exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") - endmacro(getuname) - - getuname(osname -s) - getuname(osrel -r) - getuname(cpu -m) - message("Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") - - set(CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") - if(USE_AUTOTOOLS) - set(CTEST_BUILD_NAME "AT-${CTEST_BUILD_NAME}") - endif(USE_AUTOTOOLS) - if(SITE_BUILDNAME_SUFFIX) - set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") - endif(SITE_BUILDNAME_SUFFIX) - set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") -else(NOT SITE_OS_NAME) - ## machine name provided - ## -------------------------- - if(CMAKE_HOST_UNIX) - set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}") - else(CMAKE_HOST_UNIX) - set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") - endif(CMAKE_HOST_UNIX) - if(SITE_BUILDNAME_SUFFIX) - set(CTEST_BUILD_NAME ${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}) - endif(SITE_BUILDNAME_SUFFIX) - set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") -endif(NOT SITE_OS_NAME) - -#----------------------------------------------------------------------------- -# MAC machines need special option -#----------------------------------------------------------------------------- -if(APPLE) - # Compiler choice - execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set(ENV{CC} "${XCODE_CC}") - set(ENV{CXX} "${XCODE_CXX}") - - if(NOT NO_MAC_FORTRAN) - # Shared fortran is not supported, build static - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else(NOT NO_MAC_FORTRAN) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") - endif(NOT NO_MAC_FORTRAN) - - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif(APPLE) - -#----------------------------------------------------------------------------- -## cygwin does not handle the find_package() call -## -------------------------- -if(NOT SITE_CYGWIN}) - find_package (Subversion) - set(CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") -else(NOT SITE_CYGWIN}) - set(CTEST_UPDATE_COMMAND "/usr/bin/svn") -endif(NOT SITE_CYGWIN}) - -#----------------------------------------------------------------------------- -set(NEED_REPOSITORY_CHECKOUT 0) -set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") -if(CTEST_USE_TAR_SOURCE) - ## Uncompress source if tar file provided - ## -------------------------- - if(WIN32) - set(CTEST_7Z_COMMAND "C:/Program Files/7-Zip/7z.exe") - message("extracting... [${CTEST_7Z_COMMAND} x ${CTEST_USE_TAR_SOURCE}.zip]") - execute_process(COMMAND ${CTEST_7Z_COMMAND} x ${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else(WIN32) - message("extracting... [${CTEST_CMAKE_COMMAND} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") - execute_process(COMMAND tar -xvf ${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif(WIN32) - - if(NOT rv EQUAL 0) - message("extracting... [error-(${rv}) clean up]") - file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") - message(FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed") - endif(NOT rv EQUAL 0) - - file(RENAME ${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY}) - set(LOCAL_SKIP_UPDATE "TRUE") -else(CTEST_USE_TAR_SOURCE) - ## use subversion to get source - ## -------------------------- - if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") - set(NEED_REPOSITORY_CHECKOUT 1) - endif(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") - - if(${NEED_REPOSITORY_CHECKOUT}) - set(CTEST_CHECKOUT_COMMAND - "${CTEST_UPDATE_COMMAND} co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r HEAD") - else(${NEED_REPOSITORY_CHECKOUT}) - set(CTEST_CHECKOUT_COMMAND "${CTEST_UPDATE_COMMAND} update") - endif(${NEED_REPOSITORY_CHECKOUT}) -endif(CTEST_USE_TAR_SOURCE) - -#----------------------------------------------------------------------------- -## Clear the build directory -## -------------------------- -set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) -file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -#include(${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake) -ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) - -# Use multiple CPU cores to build -include(ProcessorCount) -ProcessorCount(N) -if(NOT N EQUAL 0) - if(NOT WIN32) - set(CTEST_BUILD_FLAGS -j${N}) - endif(NOT WIN32) - set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif() - -#----------------------------------------------------------------------------- -# Send the main script as a note. -if(USE_AUTOTOOLS) - ## autotools builds need to use make and does not use the cacheinit.cmake file - ## -- make command - ## ----------------- - find_program(MAKE NAMES make) - - list(APPEND CTEST_NOTES_FILES - "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" - "${CMAKE_CURRENT_LIST_FILE}" - ) -else(USE_AUTOTOOLS) - list(APPEND CTEST_NOTES_FILES - "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" - "${CMAKE_CURRENT_LIST_FILE}" - "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" - ) -endif(USE_AUTOTOOLS) - -#----------------------------------------------------------------------------- -# Check for required variables. -# -------------------------- -foreach(req - CTEST_CMAKE_GENERATOR - CTEST_SITE - CTEST_BUILD_NAME - ) - if(NOT DEFINED ${req}) - message(FATAL_ERROR "The containing script must set ${req}") - endif(NOT DEFINED ${req}) -endforeach(req) - -#----------------------------------------------------------------------------- -# Initialize the CTEST commands -#------------------------------ -if(USE_AUTOTOOLS) - set(CTEST_CONFIGURE_COMMAND "${CTEST_SOURCE_DIRECTORY}/configure ${ADD_BUILD_OPTIONS}") - set(CTEST_BUILD_COMMAND "${MAKE} ${CTEST_BUILD_FLAGS}") - ## -- CTest Config - #configure_file($ENV{HOME}/CTestConfiguration/CTestConfig.cmake ${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake) - configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) - ## -- CTest Testfile -# configure_file(${CTEST_SCRIPT_DIRECTORY}/CTestTestfile.cmake ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake) - file(WRITE ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake "ADD_TEST(makecheck \"${MAKE}\" \"${CTEST_BUILD_FLAGS}\" \"-i\" \"check\")") -else(USE_AUTOTOOLS) - if(LOCAL_MEMCHECK_TEST) - find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind) - set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" - ) - else(LOCAL_MEMCHECK_TEST) - find_program(CTEST_COVERAGE_COMMAND NAMES gcov) - set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" - ) - endif(LOCAL_MEMCHECK_TEST) -endif(USE_AUTOTOOLS) - -#----------------------------------------------------------------------------- -## -- set output to english -set($ENV{LC_MESSAGES} "en_EN") - -# Print summary information. -foreach(v - CTEST_SITE - CTEST_BUILD_NAME - CTEST_SOURCE_DIRECTORY - CTEST_BINARY_DIRECTORY - CTEST_CMAKE_GENERATOR - CTEST_BUILD_CONFIGURATION - CTEST_GIT_COMMAND - CTEST_CHECKOUT_COMMAND - CTEST_CONFIGURE_COMMAND - CTEST_SCRIPT_DIRECTORY - CTEST_USE_LAUNCHERS - ) - set(vars "${vars} ${v}=[${${v}}]\n") -endforeach(v) -message("Dashboard script configuration:\n${vars}\n") - -#----------------------------------------------------------------------------- -#----------------------------------------------------------------------------- - ## NORMAL process - ## -- LOCAL_UPDATE updates the source folder from svn - ## -- LOCAL_SUBMIT reports to CDash server - ## -- LOCAL_SKIP_TEST skips the test process (only builds) - ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing - ## -- LOCAL_COVERAGE_TEST executes code coverage process - ## -------------------------- - CTEST_START (${MODEL} TRACK ${MODEL}) - if(LOCAL_UPDATE) - CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}") - endif(LOCAL_UPDATE) - CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}") - CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}") - if(LOCAL_SUBMIT) - CTEST_SUBMIT (PARTS Update Configure Notes) - endif(LOCAL_SUBMIT) - CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) - if(LOCAL_SUBMIT) - CTEST_SUBMIT (PARTS Build) - endif(LOCAL_SUBMIT) - if(NOT LOCAL_SKIP_TEST) - if(NOT LOCAL_MEMCHECK_TEST) - CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) - if(LOCAL_SUBMIT) - CTEST_SUBMIT (PARTS Test) - endif(LOCAL_SUBMIT) - if(res GREATER 0) - message(FATAL_ERROR "Failed tests: ${res}\n") - endif(res GREATER 0) - else(NOT LOCAL_MEMCHECK_TEST) - CTEST_MEMCHECK (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) - if(LOCAL_SUBMIT) - CTEST_SUBMIT (PARTS MemCheck) - endif(LOCAL_SUBMIT) - endif(NOT LOCAL_MEMCHECK_TEST) - if(LOCAL_COVERAGE_TEST) - CTEST_COVERAGE (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) - if(LOCAL_SUBMIT) - CTEST_SUBMIT (PARTS Coverage) - endif(LOCAL_SUBMIT) - endif(LOCAL_COVERAGE_TEST) - endif(NOT LOCAL_SKIP_TEST) - if(NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE) - ##----------------------------------------------- - ## Package the product - ##----------------------------------------------- - execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V - WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} - RESULT_VARIABLE cpackResult - OUTPUT_VARIABLE cpackLog - ERROR_VARIABLE cpackLog.err - ) - file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") - if(cpackResult GREATER 0) - message(FATAL_ERROR "Failed packaging: ${cpackResult}\n") - endif(cpackResult GREATER 0) - endif(NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE) -#----------------------------------------------------------------------------- - -message("DONE:CTestScript") - - -======================================================================== -ctest -======================================================================== - -Below is an example of the ctest script used by The HDF Group. The -CTestScript.cmake file used by this script is shown above. Adjust the values -as necessary. Note that the source folder is entered on the command line -and the build folder is created as a sub-folder. - +platform configuration script. ############################################################################ -# Product specific script, HDF518Static.cmake, that uses the -# CTestScript.cmake file (see above). Usage: -# "ctest -S HDF518Static.cmake,hdf518 -C Release -O hdf518static.log" -# where hdf518 is the source folder relative to the location of these scripts +# Product specific script, HDF518LinuxCmake.cmake, that uses the +# CTestScript.cmake file. Usage: +# "ctest -S HDF518LinuxCmake.cmake -C Release -O hdf518shared.log" ############################################################################ -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) + +# this is the location of the source hardcoded to hdf5-1.8.13 +set(CTEST_SOURCE_NAME hdf5-1.8.13) +# this is the location of the source with ctest parameter hdf5src +# "ctest -S HDF518LinuxCmake.cmake,hdf5src -C Release -O hdf518static.log" set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) + +# this is the location of the build directory set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) + +# this is the directory the script is executed from set(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") + +# this is the full path of the source directory set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + +# this is the full path of the build directory set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -set(MODEL "Experimental") -####### Following Line is one of [Release, RelWithDebInfo, Debug] ############# -set(CTEST_BUILD_CONFIGURATION "RelWithDebInfo") -######### Following describes computer ############ -set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +################################################################### +### Following Line is one of [Release, RelWithDebInfo, Debug] ##### +set(CTEST_BUILD_CONFIGURATION "Release") +################################################################### + +################################################################### +######### Following describes compiler ############ +# this is for linux +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +# this is for windows 32 bit +#set(CTEST_CMAKE_GENERATOR "Visual Studio 11") +# this is for windows 64 bit +#set(CTEST_CMAKE_GENERATOR "Visual Studio 11 Win64") +# Visual Studio 2013 is 12, Visual Studio 2012 is 11, Visual Studio 2010 is 10 +################################################################### + +################################################################### +######### Following is for submission to CDash ############ +################################################################### +set(MODEL "Experimental") +######### Following describes computer ############ ## Set the following to unique id your computer ## set(CTEST_SITE "LINUX.XXXX") -## following is optional to describe build ## -set(SITE_BUILDNAME_SUFFIX "RWDI-SHARED") -#################################################### +## following is optional to describe build ## +set(SITE_BUILDNAME_SUFFIX "SHARED") -##### Following controls CDash submission ##### +######### Following controls CDash submission ########## #set(LOCAL_SUBMIT "TRUE") -##### Following controls test process ##### +######### Following controls test process ########## #set(LOCAL_SKIP_TEST "TRUE") #set(LOCAL_MEMCHECK_TEST "TRUE") #set(LOCAL_COVERAGE_TEST "TRUE") -##### Following controls cpack command ##### -set(LOCAL_NO_PACKAGE "TRUE") -##### Following controls source update ##### +######### Following controls cpack command ########## +#set(LOCAL_NO_PACKAGE "TRUE") +######### Following controls source update ########## #set(LOCAL_UPDATE "TRUE") -set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8") -#uncomment to use a compressed source file *.zip -#set(CTEST_USE_TAR_SOURCE "hdf5-1.8.13") -############################################ +######### Following controls source repository ########## +#set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8") +#comment to use a uncompressed source folder +set(CTEST_USE_TAR_SOURCE "hdf5-1.8.13") +################################################################### +################################################################### #### Change default configuration of options in config/cmake/cacheinit.cmake file ### -### uncomment and change the following line for more configuration options -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:XXX=XXX") +#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") + +### uncomment/comment and change the following lines for configuration options + ### uncomment the following line to build static libraries #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") + +#### ext libraries #### +### ext libs from tgz +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") ### ext libs from svn #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=SVN") -### ext libs from tgz for 1.8.12 and after -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") -### ext libs from tgz for 1.8.11 and before -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS}-DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZ_PATH:PATH=${CTEST_SCRIPT_DIRECTORY}") +### ext libs on system +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") + +#### fortran #### +### enable Fortran 2003 +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") +### disable Fortran +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + ### Create install package with external libraries (szip, zlib) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") + ### disable test program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") + ### disable packaging #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") -############################################ + +### disable building examples +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_EXAMPLES:BOOL=OFF") + +### disable building tests +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") + +### change install prefix +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=install") +################################################################### include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt index d78cd85..a56895a 100644 --- a/release_docs/INSTALL_Cygwin.txt +++ b/release_docs/INSTALL_Cygwin.txt @@ -2,14 +2,20 @@ HDF5 Build and Install Instructions for Cygwin ************************************************************************ +This document is a instruction on how to build, test and install HDF5 libary on +Cygwin. See detailed information in hdf5/INSTALL. + +NOTE: hdf5 can be built with CMake, see the INSTALL_CMake.txt file for more guidance. + Preconditions: -------------- -1. Installed Cygwin 1.7.15 or higher +1. Installed Cygwin 1.7.25 or higher To install the Cygwin net release, go to http://www.cygwin.com and - click on "Install or update now!" icon. This will download a GUI - installer called setup.txt which can be run to download a complete + click on "setup-x86.exe" (32-bit installation) under the heading + "Current Cygwin DLL version". This will download a GUI + installer called setup-x86.exe which can be run to download a complete Cygwin installation via the internet. Then follow the instructions on each screen to install Cygwin. @@ -18,42 +24,46 @@ Preconditions: http://www.cygwin.com/packages/ provides detailed information about Cygwin packages. - To build HDF5 on Cygwin, Devel package (including gcc,gcc-g++, - gcc-gfortran, and gcc-java compiles, and gdb tool) should be installed. + Most required dependencies can be satisfied by installing all packages in + the "Devel" category. However, please verify that you have installed all + packages listed below. -2. Compilers Installed +2. Compilers, Libraries and Utilities Installed - 2.1 C/C++ Compilers HDF5-1.8 Supported - - gcc (4.5.3), which includes: + 2.1 Compilers Supported + + The following compilers are supported by HDF5 and included in the Cygwin + package system: + gcc (4.7.3), which includes: gcc4-core : C compiler gcc4-g++ : C++ compiler gcc4-fortran : fortran compiler + - 2.2 Using Compilers Not Supported - - The compilers in 2.1 are supported and tested by HDF - group. Any other compilers may still work but they are not - guaranteed by HDF group. - - If users want to use other compilers except those in 2.1, - try to set the following variables to override the default - choices. + 2.1.1 Using Compilers Not Supported - CXX : C++ compiler command - FC : Fortran compiler command + By default the current configuration uses vendor compilers; to use + another compiler run the following commands before running + configure: + + setenv CC "foo -flags" + setenv FC "fffoo -flags" For example, if users want to use pgf90 as fortran compiler, then setenv FC pgf90 - -3. HDF5 Dependencies - 3.1 Zlib + See the configure help page (configure --help) for a list of + environment variables that have an affect on building the + library. + + 2.2 HDF5 External Library Dependencies + + 2.2.1 Zlib - zlib-1.2.5 or later is supported and tested on Cygwin. + zlib-1.2.5 or later is supported and tested on Cygwin. - 3.2 Szip + 2.2.2 Szip The HDF5 library has a predefined compression filter that uses the extended-Rice lossless compression algorithm for chunked datatsets. For more information about Szip compression and @@ -64,9 +74,24 @@ Preconditions: ftp://ftp.hdfgroup.org/lib-external/szip/2.1. Binary distribution can be found under ftp://ftp.hdfgroup.org/lib-external/szip/2.1/bin/cygwin - -Install HDF5 on Cygwin ----------------------- + + 2.3 Additional Utilities + + The following standard utilities are also required to build and test HDF5: + + bison : yacc implementation + flex : flex utility + make : make utility + + 2.4 Alternate Build Process + + Download the CMake package and follow the notes in the "INSTALL_CMake.txt" + file to build HDF5 with the CMake utilities. + + + +Build, Test and Install HDF5 on Cygwin +-------------------------------------- 1. Get HDF5 source code package Users can download HDF5 source code package from HDF website @@ -234,7 +259,7 @@ Install HDF5 on Cygwin 8. Known Problems dt_arith tests may fail due to the use of fork. This is a known issue - with cygwin on windows. + with cygwin on Windows. ----------------------------------------------------------------------- diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6a170ce..24c3f11 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.178-swmr0 currently under development +HDF5 version 1.9.184-swmr0 currently under development INTRODUCTION diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 926b297..8d09b22 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -175,8 +175,8 @@ These steps are described in more detail below. III. Minimum C Project Files for CMake ======================================================================== - 6. Create a CMakeLists.txt file at the source root. Include the - following text in the file: +Create a CMakeLists.txt file at the source root. Include the +following text in the file: ########################################################## cmake_minimum_required (VERSION 2.8.12) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2de23d8..a29cfbb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_SRC C CXX) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # List Source Files @@ -781,8 +781,16 @@ set (H5_PRIVATE_HEADERS # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -TARGET_C_PROPERTIES (H5detect " " " ") +#add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) +#TARGET_C_PROPERTIES (H5detect " " " ") +IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + SET (LOCAL_OPT_FLAG "-O0") +ELSE (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + SET (LOCAL_OPT_FLAG " ") +ENDIF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) +ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c) +TARGET_C_PROPERTIES (H5detect ${LOCAL_OPT_FLAG} " ") + if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif (MSVC OR MINGW) @@ -810,26 +818,43 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) -add_custom_command ( - TARGET ${HDF5_BINARY_DIR}/H5Edefin.h - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E perl ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SOURCE_DIR}/src/H5err.txt - COMMENT " Creating err headers" -) - -add_custom_command ( - TARGET ${HDF5_BINARY_DIR}/H5version.h - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E perl ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SOURCE_DIR}/src/H5vers.txt - COMMENT " Creating API version macro" -) - -add_custom_command ( - TARGET ${HDF5_BINARY_DIR}/H5overflow.h - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E perl ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SOURCE_DIR}/src/H5overflow.txt - COMMENT " Creating Assignment overflow macro" -) +if (GENERATE_ERROR_HEADERS) + find_pacakge (Perl) + if (PERL_FOUND) + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5Edefin.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SOURCE_DIR}/src/H5err.txt + DEPENDS ${HDF5_SOURCE_DIR}/src/H5err.txt + COMMENT " Creating err header" + ) + + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5version.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SOURCE_DIR}/src/H5vers.txt + DEPENDS ${HDF5_SOURCE_DIR}/src/H5vers.txt + COMMENT " Creating API version macro" + ) + + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5overflow.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SOURCE_DIR}/src/H5overflow.txt + DEPENDS ${HDF5_SOURCE_DIR}/src/H5overflow.txt + COMMENT " Creating Assignment overflow macro" + ) + + add_custom_target(run_perl_scripts ALL + DEPENDS ${HDF5_BINARY_DIR}/H5Edefin.h ${HDF5_BINARY_DIR}/H5version.h ${HDF5_BINARY_DIR}/H5overflow.h + ) + else (PERL_FOUND) + message (STATUS "Cannot generate headers - perl not found") + endif (PERL_FOUND) +endif (GENERATE_ERROR_HEADERS) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5Detect/CMake at configure time diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index b9cc307..dc1df79 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -391,10 +391,9 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, data_size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") - done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} +} /* end H5D__chunk_direct_write() */ /*------------------------------------------------------------------------- @@ -2945,7 +2944,7 @@ void * H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk) { - const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ + const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_alloc */ const H5O_pline_t *old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index d3be663..2f44d8c 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -108,9 +108,6 @@ typedef struct H5FD_core_fapl_t { /* Allocate memory in multiples of this size by default */ #define H5FD_CORE_INCREMENT 8192 -/* Define the block size for aggregation */ -//#define H5FD_CORE_BLOCK_SIZE 524288 /* 512 K */ - /* These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * @@ -226,9 +223,6 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) fprintf(stderr, "Add region: (%llu, %llu)\n", start, end); #endif -// /* Adjust the dirty region to the nearest block boundaries */ -// if(start % H5FD_CORE_BLOCK_SIZE != 0) { -// start = (start / H5FD_CORE_BLOCK_SIZE) * H5FD_CORE_BLOCK_SIZE; /* Adjust the dirty region to the nearest block boundaries */ if(start % file->bstore_page_size != 0) { start = (start / file->bstore_page_size) * file->bstore_page_size; @@ -236,8 +230,6 @@ fprintf(stderr, "Add region: (%llu, %llu)\n", start, end); was_adjusted = TRUE; #endif } -// if(end % H5FD_CORE_BLOCK_SIZE != (H5FD_CORE_BLOCK_SIZE - 1)) { -// end = (((end / H5FD_CORE_BLOCK_SIZE) + 1) * H5FD_CORE_BLOCK_SIZE) - 1; if(end % file->bstore_page_size != (file->bstore_page_size - 1)) { end = (((end / file->bstore_page_size) + 1) * file->bstore_page_size) - 1; if(end > file->eof){ diff --git a/src/H5config.h.in b/src/H5config.h.in index 76de6c6..82925bf 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -58,6 +58,9 @@ /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM +/* Define to 1 if you have the `asprintf' function. */ +#undef HAVE_ASPRINTF + /* Define if the __attribute__(()) extension is present */ #undef HAVE_ATTRIBUTE diff --git a/src/H5private.h b/src/H5private.h index 7ed354a..af2b29a 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -542,6 +542,9 @@ typedef struct { #ifndef HDasin #define HDasin(X) asin(X) #endif /* HDasin */ +#ifndef HDasprintf + #define HDasprintf asprintf /*varargs*/ +#endif /* HDasprintf */ #ifndef HDassert #define HDassert(X) assert(X) #endif /* HDassert */ diff --git a/src/H5public.h b/src/H5public.h index 694687e..750e7ee 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 178 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 184 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "swmr0" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.178-swmr0" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.184-swmr0" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index 355c7a2..217d417 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -735,7 +735,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 168 +LT_VERS_REVISION = 174 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dcbe9d4..b99447a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TEST) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Generate the H5srcdir_str.h file containing user settings needed by compilation @@ -64,7 +64,7 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) - add_definitions (${HDF5_EXTRA_C_FLAGS}) + add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) @@ -95,7 +95,7 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) - add_definitions (${HDF5_EXTRA_C_FLAGS}) + add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index cf3c54b..9deeb04 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -322,7 +322,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-err_compat PROPERTIES DEPENDS H5TEST-clear-err_compat-objects) endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) @@ -343,7 +343,7 @@ add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-error_test PROPERTIES DEPENDS H5TEST-clear-error_test-objects) set_tests_properties (H5TEST-error_test PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PRELOAD=::") @@ -368,7 +368,7 @@ add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" -D "TEST_OUTPUT=links_env.txt" -D "TEST_REFERENCE=links_env.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-links_env PROPERTIES DEPENDS H5TEST-clear-links_env-objects) @@ -438,7 +438,7 @@ if (HDF5_TEST_VFD) objcopy links unlink - big +# big mtime fillval mount @@ -467,7 +467,10 @@ if (HDF5_TEST_VFD) testmeta links_env unregister -) + ) + if (NOT CYGWIN) + set (H5_VFD_TESTS ${H5_VFD_TESTS} big) + endif (NOT CYGWIN) if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) @@ -484,9 +487,10 @@ if (HDF5_TEST_VFD) -D "TEST_EXPECT=${resultcode}" -D "TEST_OUTPUT=${test}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) endforeach (test ${H5_VFD_TESTS}) + set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) if (HDF5_TEST_FHEAP_VFD) add_test ( NAME VFD-${vfdname}-fheap @@ -497,7 +501,7 @@ if (HDF5_TEST_VFD) -D "TEST_EXPECT=${resultcode}" -D "TEST_OUTPUT=fheap" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) endif (HDF5_TEST_FHEAP_VFD) ENDMACRO (ADD_VFD_TEST) diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 6d4f4d4..7f3fe7f 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TEST_PAR) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib ) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 8165eff..3716ee6 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -11,7 +11,10 @@ foreach (testp ${H5P_TESTS}) add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${testp}>) endforeach (testp ${H5P_TESTS}) -SET_TESTS_PROPERTIES(TEST_PAR_t_pflush2 PROPERTIES DEPENDS TEST_PAR_t_pflush1) +# The following will only be correct on windows shared +#set_tests_properties (TEST_PAR_t_pflush1 PROPERTIES WILL_FAIL "true") +set_property (TEST TEST_PAR_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") +set_tests_properties (TEST_PAR_t_pflush2 PROPERTIES DEPENDS TEST_PAR_t_pflush1) if (HDF5_TEST_VFD) @@ -45,7 +48,7 @@ if (HDF5_TEST_VFD) -D "TEST_EXPECT=${resultcode}" -D "TEST_OUTPUT=${test}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) endforeach (test ${H5P_VFD_TESTS}) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 27820ae..a9a8c49 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Setup include Directories diff --git a/tools/h5copy/CMakeTests.cmake b/tools/h5copy/CMakeTests.cmake index 77399a8..9002e5a 100644 --- a/tools/h5copy/CMakeTests.cmake +++ b/tools/h5copy/CMakeTests.cmake @@ -230,7 +230,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=./testfiles/${testname}.out" -D "TEST_MASK=true" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) endif (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake index 0986d89..686803b 100644 --- a/tools/h5diff/CMakeTests.cmake +++ b/tools/h5diff/CMakeTests.cmake @@ -317,7 +317,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" -D "TEST_APPEND=EXIT CODE:" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS "H5DIFF-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -355,7 +355,7 @@ # -D "TEST_APPEND=EXIT CODE: [0-9]" # -D "TEST_REF_FILTER=EXIT CODE: 0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF5_RESOURCES_DIR}/prunTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/prunTest.cmake" ) set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS "PH5DIFF-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index fb7022c..f9ebc32 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -313,7 +313,7 @@ # copy test files from source dir to test dir # foreach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${tst_h5_file}" NAME) + get_filename_component (fname "${tst_h5_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") #message (STATUS " Copying ${tst_h5_file}") add_custom_command ( @@ -339,7 +339,7 @@ endforeach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) foreach (tst_other_file ${HDF5_REFERENCE_FILES}) - GET_FILENAME_COMPONENT(fname "${tst_other_file}" NAME) + get_filename_component (fname "${tst_other_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") #message (STATUS " Copying ${tst_other_file}") add_custom_command ( @@ -351,7 +351,7 @@ endforeach (tst_other_file ${HDF5_REFERENCE_FILES}) foreach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${tst_error_file}" NAME) + get_filename_component (fname "${tst_error_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") #message (STATUS " Copying ${tst_error_file}") add_custom_command ( @@ -415,7 +415,7 @@ -D "TEST_OUTPUT=h5dump-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=h5dump-${testname}.txt" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-h5dump-${testname} PROPERTIES DEPENDS "H5DUMP-h5dump-${testname}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -461,7 +461,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -494,7 +494,7 @@ -D "TEST_OUTPUT=${resultfile}-N.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS "H5DUMP-N-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -527,7 +527,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") add_test ( @@ -567,7 +567,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") add_test ( @@ -629,7 +629,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" -D "TEST_MASK_ERROR=true" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -654,7 +654,7 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -D "TEST_ERRREF=${resultfile}.err" -D "TEST_MASK_ERROR=true" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -681,7 +681,7 @@ -D "TEST_MASK_ERROR=true" -D "TEST_ENV_VAR:STRING=${envvar}" -D "TEST_ENV_VALUE:STRING=${envval}" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -705,7 +705,7 @@ -D "TEST_OUTPUT=${conffile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${conffile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND h5import ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) diff --git a/tools/h5dump/CMakeTestsPBITS.cmake b/tools/h5dump/CMakeTestsPBITS.cmake index a920198..421e020 100644 --- a/tools/h5dump/CMakeTestsPBITS.cmake +++ b/tools/h5dump/CMakeTestsPBITS.cmake @@ -155,7 +155,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/h5dump/CMakeTestsXML.cmake b/tools/h5dump/CMakeTestsXML.cmake index ffc1cae..0d4e0f4 100644 --- a/tools/h5dump/CMakeTestsXML.cmake +++ b/tools/h5dump/CMakeTestsXML.cmake @@ -196,7 +196,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.xml" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS "H5DUMP-XML-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/h5import/CMakeTests.cmake b/tools/h5import/CMakeTests.cmake index 5c5b4de..6986aee 100644 --- a/tools/h5import/CMakeTests.cmake +++ b/tools/h5import/CMakeTests.cmake @@ -133,7 +133,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES DEPENDS H5IMPORT-${testname}) add_test ( @@ -146,7 +146,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_REFERENCE=${testfile}.new" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP) endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -180,7 +180,7 @@ -D "TEST_OUTPUT=d${testfile}.dmp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) else ("${ARGN}" STREQUAL "BINARY") add_test ( @@ -192,7 +192,7 @@ -D "TEST_OUTPUT=d${testfile}.dmp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif ("${ARGN}" STREQUAL "BINARY") set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects") @@ -206,7 +206,7 @@ -D "TEST_OUTPUT=d${testfile}.imp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP") @@ -214,13 +214,13 @@ NAME H5IMPORT-DUMP-${testname}-H5DFF COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>" - -D "TEST_ARGS:STRING=-v;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" + -D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dff" -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(Warning)[^\n]*)" -D "TEST_REFERENCE=testfiles/d${testfile}.txt" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 74c67b9..96fb6f9 100644 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -874,12 +874,9 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id) *------------------------------------------------------------------------- */ - while (!HDfeof(strm)) { - c = HDfgetc(strm); - + while(EOF != (c = HDfgetc(strm))) if (c == 10) /* eol */ nlines++; - } if (!nlines) return 0; @@ -940,9 +937,7 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id) line = 0; - while (!HDfeof(strm)) { - c = HDfgetc(strm); - + while(EOF != (c = HDfgetc(strm))) { str[i] = (char)c; i++; diff --git a/tools/h5jam/CMakeTests.cmake b/tools/h5jam/CMakeTests.cmake index fb64313..b5dc256 100644 --- a/tools/h5jam/CMakeTests.cmake +++ b/tools/h5jam/CMakeTests.cmake @@ -77,7 +77,7 @@ -D "TEST_OUTPUT=${expectfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=testfiles/${expectfile}.txt" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${expectfile} PROPERTIES DEPENDS H5JAM-${expectfile}-clear-objects) endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -111,7 +111,7 @@ -D "TEST_OUTPUT=${expectfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=testfiles/${expectfile}.txt" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES DEPENDS H5JAM-UNJAM-${expectfile}-clear-objects) endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -140,7 +140,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-clear-objects) add_test ( @@ -153,7 +153,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_REFERENCE=${actual}.new" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP_CMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-H5DMP) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -200,7 +200,7 @@ -D "TEST_OUTPUT=${outfile}.ufile.txt" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test "${outfile}.ufile.txt") @@ -231,7 +231,7 @@ -D "TEST_UFILE=${compare_test}" -D "TEST_EXPECT=0" -D "TEST_OFILE=" - -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" + -P "${HDF_RESOURCES_DIR}/userblockTest.cmake" ) set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects) endif (NOT "${compare_test}" STREQUAL "") @@ -247,7 +247,7 @@ -D "TEST_EXPECT=0" -D "TEST_UFILE=NULL" -D "TEST_OFILE=NULL" - -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" + -P "${HDF_RESOURCES_DIR}/userblockTest.cmake" ) if (NOT "${compare_test}" STREQUAL "") set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1) @@ -295,7 +295,7 @@ -D "TEST_UFILE=testfiles/${jamfile}" -D "TEST_EXPECT=0" -D "TEST_OFILE=${compare_orig}" - -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" + -P "${HDF_RESOURCES_DIR}/userblockTest.cmake" ) set_tests_properties (H5JAM-${testname}-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-CHECK_UB_1-clear-objects) CHECKFILE (${testname} "H5JAM-${testname}-CHECK_UB_1" ${chkfile} ${outfile}) @@ -350,7 +350,7 @@ -D "TEST_UFILE=testfiles/${jamfile}" -D "TEST_EXPECT=0" -D "TEST_OFILE=${compare_orig}" - -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" + -P "${HDF_RESOURCES_DIR}/userblockTest.cmake" ) set_tests_properties (H5JAM-${testname}_NONE-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects) CHECKFILE (${testname} "H5JAM-${testname}_NONE-CHECK_UB_1" ${infile} ${chkfile}) diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index b739130..a42fa17 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -140,7 +140,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS "H5LS-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 3c5ba06..42fb69f 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -817,8 +817,6 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind) * Programmer: Robb Matzke * Thursday, November 5, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static hbool_t @@ -833,8 +831,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) if(H5T_COMPOUND != H5Tget_class(type)) return FALSE; - nmembs = H5Tget_nmembers(type); - if(nmembs <= 0) + if((nmembs = H5Tget_nmembers(type)) < 0) return FALSE; h5tools_str_append(buffer, "struct {"); @@ -856,6 +853,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) size = H5Tget_size(type); h5tools_str_append(buffer, "\n%*s} %lu byte%s", ind, "", (unsigned long)size, 1==size?"":"s"); + return TRUE; } @@ -884,8 +882,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) if(H5T_ENUM != H5Tget_class(type)) return FALSE; - nmembs = H5Tget_nmembers(type); - if(nmembs < 0) + if((nmembs = H5Tget_nmembers(type)) < 0) return FALSE; super = H5Tget_super(type); diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 4275e56..cb8720e 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -51,7 +51,7 @@ if (BUILD_TESTING) set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) - add_definitions (${HDF5_EXTRA_C_FLAGS}) + add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${LIB_TYPE} dynlib_rpk.c) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index 430defc..220c871 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -29,7 +29,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_OUTPUT=h5repacktest" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) @@ -136,7 +136,7 @@ -D "TEST_OUTPUT=h5repack-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=h5repack-${testname}.txt" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS "H5REPACK-h5repack-${testname}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -215,7 +215,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" -D "TEST_REFERENCE=${resultfile}.tst" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") @@ -250,7 +250,7 @@ -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${testname}.${resultfile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -290,7 +290,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" -D "TEST_REFERENCE=${testfilter}" - -P "${HDF5_RESOURCES_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) else (${resultcode} STREQUAL "0") @@ -313,7 +313,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${nottestfilter}" -D "TEST_REFERENCE=${testfilter}" - -P "${HDF5_RESOURCES_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) endif (${resultcode} STREQUAL "0") @@ -365,7 +365,7 @@ -D "TEST_REFERENCE=${testname}.${resultfile}.tst" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clearall-objects) add_test ( @@ -379,7 +379,7 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.ddl" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}") endif (HDF5_BUILD_TOOLS AND NOT HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/h5stat/CMakeTests.cmake b/tools/h5stat/CMakeTests.cmake index b803dff..4175eb2 100644 --- a/tools/h5stat/CMakeTests.cmake +++ b/tools/h5stat/CMakeTests.cmake @@ -101,7 +101,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS "H5STAT-${resultfile}-clear-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index c3b8294..e65673a 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Define Sources @@ -71,21 +71,6 @@ install ( ) #----------------------------------------------------------------------------- -# Because tools are installed into bin/tools we need to make sure the hdf5tools -# library will be installed into the proper location. -#----------------------------------------------------------------------------- -if (APPLE) - option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) - if (HDF5_BUILD_WITH_INSTALL_NAME) - SET_TARGET_PROPERTIES(${HDF5_TOOLS_LIB_TARGET} PROPERTIES - LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" - INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" - BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} - ) - endif (HDF5_BUILD_WITH_INSTALL_NAME) -endif (APPLE) - -#----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 884a85d..13cea23 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -470,75 +470,81 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, switch(linfo->type) { - case H5L_TYPE_SOFT: - ret = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links); - /* error */ - if (ret < 0) - goto done; - /* no dangling link option given and detect dangling link */ - else if (ret == 0) - { - tinfo->symlink_visited.dangle_link = TRUE; - trav_info_visit_lnk(path, linfo, tinfo); - if (opts->no_dangle_links) - opts->err_stat = 1; /* make dgangling link is error */ - goto done; - } + case H5L_TYPE_SOFT: + ret = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links); + /* error */ + if (ret < 0) + goto done; + /* no dangling link option given and detect dangling link */ + else if (ret == 0) + { + tinfo->symlink_visited.dangle_link = TRUE; + trav_info_visit_lnk(path, linfo, tinfo); + if (opts->no_dangle_links) + opts->err_stat = 1; /* make dgangling link is error */ + goto done; + } - /* check if already visit the target object */ - if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path)) - goto done; + /* check if already visit the target object */ + if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path)) + goto done; - /* add this link as visited link */ - if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0) - goto done; - - if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo) < 0) - { - parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - goto done; - } - break; - - case H5L_TYPE_EXTERNAL: - ret = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links); - /* error */ - if (ret < 0) - goto done; - /* no dangling link option given and detect dangling link */ - else if (ret == 0) - { - tinfo->symlink_visited.dangle_link = TRUE; - trav_info_visit_lnk(path, linfo, tinfo); - if (opts->no_dangle_links) - opts->err_stat = 1; /* make dgangling link is error */ - goto done; - } + /* add this link as visited link */ + if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0) + goto done; + + if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, + trav_grp_objs,trav_grp_symlinks, tinfo) < 0) + { + parallel_print("Error: Could not get file contents\n"); + opts->err_stat = 1; + goto done; + } + break; + + case H5L_TYPE_EXTERNAL: + ret = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links); + /* error */ + if (ret < 0) + goto done; + /* no dangling link option given and detect dangling link */ + else if (ret == 0) + { + tinfo->symlink_visited.dangle_link = TRUE; + trav_info_visit_lnk(path, linfo, tinfo); + if (opts->no_dangle_links) + opts->err_stat = 1; /* make dgangling link is error */ + goto done; + } - if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0) - goto done; + if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0) + goto done; - /* check if already visit the target object */ - if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path)) - goto done; + /* check if already visit the target object */ + if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path)) + goto done; - /* add this link as visited link */ - if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0) - goto done; - - if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo) < 0) - { - parallel_print("Error: Could not get file contents\n"); + /* add this link as visited link */ + if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0) + goto done; + + if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, + trav_grp_objs,trav_grp_symlinks, tinfo) < 0) + { + parallel_print("Error: Could not get file contents\n"); + opts->err_stat = 1; + goto done; + } + break; + + case H5L_TYPE_HARD: + case H5L_TYPE_MAX: + case H5L_TYPE_ERROR: + default: + parallel_print("Error: Invalid link type\n"); opts->err_stat = 1; goto done; - } - break; - default: - ; - break; + break; } /* end of switch */ done: @@ -572,7 +578,6 @@ hsize_t h5diff(const char *fname1, hid_t file2_id = (-1); char filenames[2][MAX_FILENAME]; hsize_t nfound = 0; - int i; int l_ret1 = -1; int l_ret2 = -1; char * obj1fullname = NULL; @@ -653,27 +658,37 @@ hsize_t h5diff(const char *fname1, /* if any object is specified */ if (objname1) { - /* malloc 2 more for "/" and end-of-line */ - obj1fullname = (char*)HDcalloc(HDstrlen(objname1) + 2, sizeof(char)); - obj2fullname = (char*)HDcalloc(HDstrlen(objname2) + 2, sizeof(char)); - /* make the given object1 fullpath, start with "/" */ if (HDstrncmp(objname1, "/", 1)) { +#ifdef H5_HAVE_ASPRINTF + /* Use the asprintf() routine, since it does what we're trying to do below */ + HDasprintf(&obj1fullname, "/%s", objname1); +#else /* H5_HAVE_ASPRINTF */ + /* (malloc 2 more for "/" and end-of-line) */ + obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2); HDstrcpy(obj1fullname, "/"); HDstrcat(obj1fullname, objname1); +#endif /* H5_HAVE_ASPRINTF */ } else - HDstrcpy(obj1fullname, objname1); + obj1fullname = HDstrdup(objname1); /* make the given object2 fullpath, start with "/" */ if (HDstrncmp(objname2, "/", 1)) { +#ifdef H5_HAVE_ASPRINTF + /* Use the asprintf() routine, since it does what we're trying to do below */ + HDasprintf(&obj2fullname, "/%s", objname2); +#else /* H5_HAVE_ASPRINTF */ + /* (malloc 2 more for "/" and end-of-line) */ + obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2); HDstrcpy(obj2fullname, "/"); HDstrcat(obj2fullname, objname2); +#endif /* H5_HAVE_ASPRINTF */ } else - HDstrcpy(obj2fullname, objname2); + obj2fullname = HDstrdup(objname2); /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink @@ -706,7 +721,8 @@ hsize_t h5diff(const char *fname1, */ if(src_linfo1.type == H5L_TYPE_HARD) { - int idx = 0; + size_t idx; + /* optional data pass */ info1_obj->opts = (diff_opt_t*)options; @@ -716,7 +732,7 @@ hsize_t h5diff(const char *fname1, options->err_stat = 1; goto out; } - obj1type = oinfo1.type; + obj1type = (h5trav_type_t)oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); idx = info1_obj->nused - 1; info1_obj->paths[idx].objno = oinfo1.addr; @@ -765,7 +781,8 @@ hsize_t h5diff(const char *fname1, */ if(src_linfo2.type == H5L_TYPE_HARD) { - int idx = 0; + size_t idx; + /* optional data pass */ info2_obj->opts = (diff_opt_t*)options; @@ -775,7 +792,7 @@ hsize_t h5diff(const char *fname1, options->err_stat = 1; goto out; } - obj2type = oinfo2.type; + obj2type = (h5trav_type_t)oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); idx = info2_obj->nused - 1; info2_obj->paths[idx].objno = oinfo2.addr; @@ -798,11 +815,9 @@ hsize_t h5diff(const char *fname1, { h5difftrace("h5diff no object specified\n"); /* set root group */ - obj1fullname = (char*)HDcalloc((size_t)2, sizeof(char)); - HDstrcat(obj1fullname, "/"); + obj1fullname = (char*)HDstrdup("/"); obj1type = H5TRAV_TYPE_GROUP; - obj2fullname = (char*)HDcalloc((size_t)2, sizeof(char)); - HDstrcat(obj2fullname, "/"); + obj2fullname = (char*)HDstrdup("/"); obj2type = H5TRAV_TYPE_GROUP; } @@ -856,12 +871,13 @@ hsize_t h5diff(const char *fname1, } else if(l_ret1 != 2) /* symbolic link */ { - obj1type = trg_linfo1.trg_type; + obj1type = (h5trav_type_t)trg_linfo1.trg_type; h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n"); if (info1_lp != NULL) { - int idx = info1_lp->nused - 1; + size_t idx = info1_lp->nused - 1; + h5difftrace("h5diff ... ... ... info1_obj not null\n"); - info1_lp->paths[idx].type = trg_linfo1.trg_type; + info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type; info1_lp->paths[idx].objno = trg_linfo1.objno; info1_lp->paths[idx].fileno = trg_linfo1.fileno; } @@ -904,11 +920,12 @@ hsize_t h5diff(const char *fname1, } else if(l_ret2 != 2) /* symbolic link */ { - obj2type = trg_linfo2.trg_type; + obj2type = (h5trav_type_t)trg_linfo2.trg_type; if (info2_lp != NULL) { - int idx = info2_lp->nused - 1; + size_t idx = info2_lp->nused - 1; + h5difftrace("h5diff ... ... ... info2_obj not null\n"); - info2_lp->paths[idx].type = trg_linfo2.trg_type; + info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type; info2_lp->paths[idx].objno = trg_linfo2.objno; info2_lp->paths[idx].fileno = trg_linfo2.fileno; } @@ -972,6 +989,8 @@ hsize_t h5diff(const char *fname1, #ifdef H5_HAVE_PARALLEL if(g_Parallel) { + int i; + if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) { HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME); @@ -997,6 +1016,8 @@ hsize_t h5diff(const char *fname1, */ if(options->m_verbose) { + unsigned u; + parallel_print("\n"); /* if given objects is group under root */ if (HDstrcmp (obj1fullname,"/") || HDstrcmp (obj2fullname,"/")) @@ -1004,12 +1025,12 @@ hsize_t h5diff(const char *fname1, else parallel_print("file1 file2\n"); parallel_print("---------------------------------------\n"); - for(i = 0; i < match_list->nobjs; i++) + for(u = 0; u < match_list->nobjs; u++) { char c1, c2; - c1 = (match_list->objs[i].flags[0]) ? 'x' : ' '; - c2 = (match_list->objs[i].flags[1]) ? 'x' : ' '; - parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[i].name); + c1 = (match_list->objs[u].flags[0]) ? 'x' : ' '; + c2 = (match_list->objs[u].flags[1]) ? 'x' : ' '; + parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name); } /* end for */ parallel_print ("\n"); } /* end if */ @@ -1092,8 +1113,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hsize_t nfound = 0; unsigned i; - char * grp1_path = ""; - char * grp2_path = ""; + const char * grp1_path = ""; + const char * grp2_path = ""; char * obj1_fullpath = NULL; char * obj2_fullpath = NULL; diff_args_t argdata; @@ -1106,10 +1127,10 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, * if not root, prepare object name to be pre-appended to group path to * make full path */ - if (HDstrcmp (grp1, "/")) - grp1_path = (char *)grp1; - if (HDstrcmp (grp2, "/")) - grp2_path = (char *)grp2; + if(HDstrcmp(grp1, "/")) + grp1_path = grp1; + if(HDstrcmp(grp2, "/")) + grp2_path = grp2; /*------------------------------------------------------------------------- * regarding the return value of h5diff (0, no difference in files, 1 difference ) @@ -1163,22 +1184,32 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, if( table->objs[i].flags[0] && table->objs[i].flags[1]) { /* make full path for obj1 */ - obj1_fullpath = (char*)HDcalloc (HDstrlen(grp1_path) + strlen (table->objs[i].name) + 1, sizeof (char)); +#ifdef H5_HAVE_ASPRINTF + /* Use the asprintf() routine, since it does what we're trying to do below */ + HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name); +#else /* H5_HAVE_ASPRINTF */ + obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1); HDstrcpy(obj1_fullpath, grp1_path); HDstrcat(obj1_fullpath, table->objs[i].name); +#endif /* H5_HAVE_ASPRINTF */ /* make full path for obj2 */ - obj2_fullpath = (char*)HDcalloc (HDstrlen(grp2_path) + strlen (table->objs[i].name) + 1, sizeof (char)); +#ifdef H5_HAVE_ASPRINTF + /* Use the asprintf() routine, since it does what we're trying to do below */ + HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name); +#else /* H5_HAVE_ASPRINTF */ + obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1); HDstrcpy(obj2_fullpath, grp2_path); HDstrcat(obj2_fullpath, table->objs[i].name); +#endif /* H5_HAVE_ASPRINTF */ /* get index to figure out type of the object in file1 */ - while ( info1->paths[idx1].path && - (HDstrcmp (obj1_fullpath, info1->paths[idx1].path) != 0) ) + while(info1->paths[idx1].path && + (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0)) idx1++; /* get index to figure out type of the object in file2 */ - while ( info2->paths[idx2].path && - (HDstrcmp (obj2_fullpath, info2->paths[idx2].path) != 0) ) + while(info2->paths[idx2].path && + (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0)) idx2++; /* Set argdata to pass other args into diff() */ @@ -1363,10 +1394,10 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end if */ } /* end else */ #endif /* H5_HAVE_PARALLEL */ - if (obj1_fullpath) - HDfree (obj1_fullpath); - if (obj2_fullpath) - HDfree (obj2_fullpath); + if(obj1_fullpath) + HDfree(obj1_fullpath); + if(obj2_fullpath) + HDfree(obj2_fullpath); } /* end if */ } /* end for */ h5difftrace("done with for loop\n"); @@ -1586,12 +1617,12 @@ hsize_t diff(hid_t file1_id, if (options->follow_links) { if (linkinfo1.linfo.type == H5L_TYPE_SOFT || - linkinfo1.linfo.type == H5L_TYPE_EXTERNAL) - argdata->type[0] = linkinfo1.trg_type; + linkinfo1.linfo.type == H5L_TYPE_EXTERNAL) + argdata->type[0] = (h5trav_type_t)linkinfo1.trg_type; if (linkinfo2.linfo.type == H5L_TYPE_SOFT || - linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) - argdata->type[1] = linkinfo2.trg_type; + linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) + argdata->type[1] = (h5trav_type_t)linkinfo2.trg_type; } } /* if objects are not the same type */ @@ -1633,29 +1664,30 @@ hsize_t diff(hid_t file1_id, { switch(object_type) { - case H5TRAV_TYPE_DATASET: - do_print_objname("dataset", path1, path2, options); - break; - case H5TRAV_TYPE_NAMED_DATATYPE: - do_print_objname("datatype", path1, path2, options); - break; - case H5TRAV_TYPE_GROUP: - do_print_objname("group", path1, path2, options); - break; - case H5TRAV_TYPE_LINK: - do_print_objname("link", path1, path2, options); - break; - case H5TRAV_TYPE_UDLINK: - if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) - do_print_objname("external link", path1, path2, options); - else - do_print_objname ("user defined link", path1, path2, options); - break; - default: - parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", - path1, path2, get_type(object_type) ); - options->not_cmp = 1; - break; + case H5TRAV_TYPE_DATASET: + do_print_objname("dataset", path1, path2, options); + break; + case H5TRAV_TYPE_NAMED_DATATYPE: + do_print_objname("datatype", path1, path2, options); + break; + case H5TRAV_TYPE_GROUP: + do_print_objname("group", path1, path2, options); + break; + case H5TRAV_TYPE_LINK: + do_print_objname("link", path1, path2, options); + break; + case H5TRAV_TYPE_UDLINK: + if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) + do_print_objname("external link", path1, path2, options); + else + do_print_objname ("user defined link", path1, path2, options); + break; + case H5TRAV_TYPE_UNKNOWN: + default: + parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", + path1, path2, get_type(object_type) ); + options->not_cmp = 1; + break; } /* switch(type)*/ print_found(nfound); @@ -1862,6 +1894,7 @@ hsize_t diff(hid_t file1_id, } break; + case H5TRAV_TYPE_UNKNOWN: default: if(options->m_verbose) parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index f6e6329..d7c5639 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -441,13 +441,13 @@ hsize_t diff_datasetid( hid_t did1, HDassert(sm_nbytes > 0); } /* end for */ - /* malloc return code should be verified. + /* malloc return code should be verified. * If fail, need to handle the error. * This else branch should be recoded as a separate function. * Note that there are many "goto error" within this branch * that fails to address freeing other objects created here. - * E.g., sm_space. - */ + * E.g., sm_space. + */ sm_buf1 = HDmalloc((size_t)sm_nbytes); HDassert(sm_buf1); sm_buf2 = HDmalloc((size_t)sm_nbytes); diff --git a/tools/misc/CMakeTests.cmake b/tools/misc/CMakeTests.cmake index 0887fb6..d28b744 100644 --- a/tools/misc/CMakeTests.cmake +++ b/tools/misc/CMakeTests.cmake @@ -119,7 +119,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_MASK_MOD=true" -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP-${resultfile}-h5ls PROPERTIES DEPENDS H5MKGRP-${resultfile}) endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -147,7 +147,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) endif (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 39d7655..af46751 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -405,6 +405,9 @@ /* Define to 1 if you have the <unistd.h> header file. */ #define H5_HAVE_UNISTD_H 1 +/* Define to 1 if you have the `asprintf' function. */ +/* #undef H5_HAVE_ASPRINTF */ + /* Define to 1 if you have the `vasprintf' function. */ /* #undef H5_HAVE_VASPRINTF */ @@ -505,7 +508,11 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ +<<<<<<< .working #define H5_PACKAGE_STRING "HDF5 1.9.178-swmr0" +======= +#define H5_PACKAGE_STRING "HDF5 1.9.184" +>>>>>>> .merge-right.r25266 /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -514,7 +521,11 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ +<<<<<<< .working #define H5_PACKAGE_VERSION "1.9.178-swmr0" +======= +#define H5_PACKAGE_VERSION "1.9.184" +>>>>>>> .merge-right.r25266 /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -677,7 +688,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.178-swmr0" +#define H5_VERSION "1.9.184-swmr0" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ |