diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-21 15:10:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-21 15:10:17 (GMT) |
commit | eb89d7b53ab95623ab454186a602e1cafc7391f0 (patch) | |
tree | ceafe458b3011e38853e765352d3c7e59bbecce1 /hl | |
parent | 3e468e6ff65d540a439e99ea568a6bff7add7cea (diff) | |
download | hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.zip hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.gz hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.bz2 |
[svn-r22105] Description:
Bring r20557:22085 from trunk to this branch, also fixing some other
issues/failures in the branch simultaneously. The h5repack tests are still
failing, but Neil will be checking into those, so the branch can be fully
functional again.
Tested on:
Mac OSX/64 10.7.3 (amazon) w/debug
Diffstat (limited to 'hl')
58 files changed, 3728 insertions, 1004 deletions
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 0c0ad91..d1db6ca 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL C CXX) #----------------------------------------------------------------------------- diff --git a/hl/Makefile.in b/hl/Makefile.in index 9c3005c..6f7b51c 100755 --- a/hl/Makefile.in +++ b/hl/Makefile.in @@ -182,6 +182,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -202,10 +203,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt index 15ae809..3601a91 100644 --- a/hl/c++/CMakeLists.txt +++ b/hl/c++/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_CPP) #----------------------------------------------------------------------------- diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in index 8631a43..a629463 100644 --- a/hl/c++/Makefile.in +++ b/hl/c++/Makefile.in @@ -178,6 +178,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -198,10 +199,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index f396523..3034a78 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_CPP_EXAMPLES) #----------------------------------------------------------------------------- @@ -18,6 +18,7 @@ TARGET_LINK_LIBRARIES ( ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ) +SET_TARGET_PROPERTIES (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) ADD_EXECUTABLE (ptExampleVL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleVL.cpp) TARGET_NAMING (ptExampleVL ${LIB_TYPE}) @@ -27,6 +28,7 @@ TARGET_LINK_LIBRARIES ( ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ) +SET_TARGET_PROPERTIES (ptExampleVL PROPERTIES FOLDER examples/hl/cpp) IF (BUILD_TESTING) ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>) diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in index 49c6707..acb7c11 100644 --- a/hl/c++/examples/Makefile.in +++ b/hl/c++/examples/Makefile.in @@ -144,6 +144,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -164,10 +165,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in index b800981..7742f99 100755 --- a/hl/c++/examples/run-hlc++-ex.sh.in +++ b/hl/c++/examples/run-hlc++-ex.sh.in @@ -32,8 +32,8 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 # Where the tool is installed. -# Note: no '/' after DESTDIR. Explanation in commence.am -prefix="${prefix:-${DESTDIR}@prefix@}" +# default is relative path to installed location of the tools +prefix="${prefix:-../../../../}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 1e765e9..ad5454d 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_CPP_SRC) #----------------------------------------------------------------------------- @@ -18,6 +18,7 @@ TARGET_LINK_LIBRARIES ( ) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} ${LIB_TYPE}) +SET_TARGET_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) #----------------------------------------------------------------------------- # Add file(s) to CMake Install diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index aa15700..d9db5de 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -201,6 +201,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -221,10 +222,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ @@ -418,7 +421,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 = 71 +LT_VERS_REVISION = 101 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 7fc3418..7d29035 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_CPP_TEST) #----------------------------------------------------------------------------- @@ -26,6 +26,7 @@ IF (BUILD_TESTING) ${HDF5_HL_LIB_TARGET} ${HDF5_HL_CPP_LIB_TARGET} ) + SET_TARGET_PROPERTIES (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) ADD_TEST (NAME hl_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>) ENDIF (BUILD_TESTING) diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in index b542f85..4c84e4c 100644 --- a/hl/c++/test/Makefile.in +++ b/hl/c++/test/Makefile.in @@ -174,6 +174,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -194,10 +195,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 9c48f77..929058d 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -74,6 +74,7 @@ int main(void) return -1; } + int BasicTest() { herr_t err; @@ -182,9 +183,17 @@ int TestCompoundDatatype() goto out; PASSED(); + + H5Tclose(dtypeID); return 0; out: + + H5E_BEGIN_TRY { + H5Tclose(dtypeID); + } H5E_END_TRY; + + H5_FAILED(); return 1; } @@ -514,10 +523,19 @@ int SystemTest() if(ct1[1].b != ct2[2].g.b) goto out; + H5Tclose(dtypeID1); + H5Tclose(dtypeID2); + PASSED(); return 0; out: + + H5E_BEGIN_TRY { + H5Tclose(dtypeID1); + H5Tclose(dtypeID2); + } H5E_END_TRY; + H5_FAILED(); return 1; } diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 28672b6..c95322c 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_EXAMPLES ) SET (HDF5_TEST_FILES @@ -45,6 +45,7 @@ FOREACH (example ${examples}) ADD_EXECUTABLE (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) TARGET_NAMING (hl_ex_${example} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + SET_TARGET_PROPERTIES (hl_ex_${example} PROPERTIES FOLDER examples/hl) IF (BUILD_TESTING) ADD_TEST (NAME hl_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>) @@ -52,6 +53,10 @@ FOREACH (example ${examples}) ENDFOREACH (example ${examples}) IF (BUILD_TESTING) + SET_TESTS_PROPERTIES (hl_ex_ex_lite2 PROPERTIES DEPENDS hl_ex_ex_lite1) +ENDIF (BUILD_TESTING) + +IF (BUILD_TESTING) SET (HDF5_TEST_FILES image24pixel.txt image8.txt diff --git a/hl/examples/Makefile.am b/hl/examples/Makefile.am index d1f67bc..ae65a3b 100644 --- a/hl/examples/Makefile.am +++ b/hl/examples/Makefile.am @@ -91,8 +91,8 @@ ex_table10: $(srcdir)/ex_table10.c ex_table11: $(srcdir)/ex_table11.c ex_table12: $(srcdir)/ex_table12.c -if BUILD_SZIP_CONDITIONAL -export LD_LIBRARY_PATH=$(LL_PATH) +if BUILD_SHARED_SZIP_CONDITIONAL +LD_LIBRARY_PATH=$(LL_PATH) endif include $(top_srcdir)/config/examples.am diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in index 7a3819a..e79583d 100644 --- a/hl/examples/Makefile.in +++ b/hl/examples/Makefile.in @@ -144,6 +144,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -164,10 +165,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ @@ -387,6 +390,7 @@ INSTALL_FILES = ex_lite1.c ex_lite2.c ex_lite3.c ptExampleFL.c ptExampleVL.c \ INSTALL_SCRIPT_FILES = run-hlc-ex.sh INSTALL_TOP_SCRIPT_FILES = run-hl-ex.sh +@BUILD_SHARED_SZIP_CONDITIONAL_TRUE@LD_LIBRARY_PATH = $(LL_PATH) # Assume that all tests in this directory are examples, and tell # conclude.am when to build them. @@ -651,8 +655,6 @@ ex_table10: $(srcdir)/ex_table10.c ex_table11: $(srcdir)/ex_table11.c ex_table12: $(srcdir)/ex_table12.c -@BUILD_SZIP_CONDITIONAL_TRUE@export LD_LIBRARY_PATH=$(LL_PATH) - # How to create EXAMPLEDIR if it doesn't already exist $(EXAMPLEDIR): -$(top_srcdir)/bin/mkdirs $@ diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in index ae3fcdb..a82e591 100755 --- a/hl/examples/run-hlc-ex.sh.in +++ b/hl/examples/run-hlc-ex.sh.in @@ -32,8 +32,8 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 # Where the tool is installed. -# Note: no '/' after DESTDIR. Explanation in commence.am -prefix="${prefix:-${DESTDIR}@prefix@}" +# default is relative path to installed location of the tools +prefix="${prefix:-../../../../}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt index 1fd6de0..ae38588 100644 --- a/hl/fortran/CMakeLists.txt +++ b/hl/fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_F90 C CXX Fortran) #----------------------------------------------------------------------------- diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index 7068a20..19d6b62 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -182,6 +182,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -202,10 +203,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 50fa1ea..7098119 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran) #----------------------------------------------------------------------------- @@ -12,6 +12,7 @@ INCLUDE_DIRECTORIES ( SET (examples exlite + ex_ds1 ) FOREACH (example ${examples}) @@ -24,6 +25,7 @@ FOREACH (example ${examples}) ${HDF5_LIB_TARGET} ) SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) + SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) IF (BUILD_TESTING) ADD_TEST (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) diff --git a/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am index 7c31fa7..4286fe3 100644 --- a/hl/fortran/examples/Makefile.am +++ b/hl/fortran/examples/Makefile.am @@ -31,10 +31,10 @@ endif # be run. # We don't tell automake about these programs so that it doesn't try to # compile them with the regular fortran compiler. -TEST_PROG=exlite +TEST_PROG=exlite ex_ds1 # List files to be installed here -INSTALL_FILES= exlite.f90 +INSTALL_FILES= exlite.f90 ex_ds1.f90 INSTALL_SCRIPT_FILES = run-hlfortran-ex.sh # Mark this directory as part of the Fortran API (this affects output diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 64706bd..22744ae 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -145,6 +145,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -165,10 +166,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ @@ -367,10 +370,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 # be run. # We don't tell automake about these programs so that it doesn't try to # compile them with the regular fortran compiler. -TEST_PROG = exlite +TEST_PROG = exlite ex_ds1 # List files to be installed here -INSTALL_FILES = exlite.f90 +INSTALL_FILES = exlite.f90 ex_ds1.f90 INSTALL_SCRIPT_FILES = run-hlfortran-ex.sh # Mark this directory as part of the Fortran API (this affects output diff --git a/hl/fortran/examples/ex_ds1.f90 b/hl/fortran/examples/ex_ds1.f90 new file mode 100644 index 0000000..377a641 --- /dev/null +++ b/hl/fortran/examples/ex_ds1.f90 @@ -0,0 +1,192 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * Copyright by The HDF Group. * +! * Copyright by the Board of Trustees of the University of Illinois. * +! * All rights reserved. * +! * * +! * This file is part of HDF5. The full HDF5 copyright notice, including * +! * terms governing use, modification, and redistribution, is contained in * +! * the files COPYING and Copyright.html. COPYING can be found at the root * +! * of the source code distribution tree; Copyright.html can be found at the * +! * root level of an installed copy of the electronic HDF5 document set and * +! * is linked from the top-level documents page. It can also be found at * +! * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! * access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +PROGRAM example_ds + + USE HDF5 + USE H5LT + USE H5DS + + IMPLICIT NONE + + INTEGER, PARAMETER :: RANK = 2 ! rank of DATA dataset + INTEGER, PARAMETER :: DIM_DATA = 12 + INTEGER, PARAMETER :: DIM1_SIZE = 3 + INTEGER, PARAMETER :: DIM2_SIZE = 4 + INTEGER, PARAMETER :: DIM1 = 1 + INTEGER, PARAMETER :: DIM2 = 2 + + CHARACTER(LEN=6), PARAMETER :: DSET_NAME = "MYDATA" + CHARACTER(LEN=5), PARAMETER :: DS_1_NAME = "Xaxis" + CHARACTER(LEN=5), PARAMETER :: DS_2_NAME = "Yaxis" + + + INTEGER(hid_t) :: fid ! file ID + INTEGER(hid_t) :: did ! dataset ID + INTEGER(hid_t) :: dsid ! DS dataset ID + INTEGER :: rankds = 1 ! rank of DS dataset + INTEGER(hsize_t), DIMENSION(1:rank) :: dims = (/DIM2_SIZE,DIM1_SIZE/) ! size of data dataset + INTEGER, DIMENSION(1:DIM_DATA) :: buf = (/1,2,3,4,5,6,7,8,9,10,11,12/) ! data of data dataset + INTEGER(hsize_t), DIMENSION(1:1) :: s1_dim = (/DIM1_SIZE/) ! size of DS 1 dataset + INTEGER(hsize_t), DIMENSION(1:1) :: s2_dim = (/DIM2_SIZE/) ! size of DS 2 dataset + REAL, DIMENSION(1:DIM1_SIZE) :: s1_wbuf = (/10,20,30/) ! data of DS 1 dataset + REAL, DIMENSION(1:DIM2_SIZE) :: s2_wbuf = (/10,20,50,100/) ! data of DS 2 dataset + INTEGER :: err + INTEGER :: num_scales + INTEGER(size_t) :: name_len + CHARACTER(LEN=80) :: name + INTEGER(size_t) :: label_len + CHARACTER(LEN=80) :: label + LOGICAL :: is_attached, is_scale + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5open_f(err) + + ! create a file using default properties + CALL H5Fcreate_f("ex_ds1.h5",H5F_ACC_TRUNC_F, fid, err) + + ! make a dataset + CALL H5LTmake_dataset_int_f(fid, DSET_NAME, rank,dims,buf, err) + + ! make a DS dataset for the first dimension + CALL H5LTmake_dataset_float_f(fid,DS_1_NAME,rankds,s1_dim,s1_wbuf,err) + + ! make a DS dataset for the second dimension + CALL H5LTmake_dataset_float_f(fid,DS_2_NAME,rankds,s2_dim,s2_wbuf,err) + + !------------------------------------------------------------------------- + ! attach the DS_1_NAME dimension scale to DSET_NAME at dimension 1 + ! and then detach it. + !------------------------------------------------------------------------- + + ! get the dataset id for DSET_NAME + CALL H5Dopen_f(fid, DSET_NAME, did, err) + + ! get the DS dataset id + CALL H5Dopen_f(fid, DS_1_NAME, dsid, err) + + WRITE(*,'(/,5A,I0)') & + "Attach Dimension Scale """,TRIM(DS_1_NAME),'" to "', TRIM(DSET_NAME), '" at dimension ', DIM1 + + ! attach the DS_1_NAME dimension scale to DSET_NAME at dimension index 1 + CALL H5DSattach_scale_f(did, dsid, DIM1, err) + + ! Test if dimension Scale Attached + CALL H5DSis_attached_f(did, dsid, DIM1, is_attached, err) + WRITE(*,'(/,5X 3(A,1X),I0,A,L1)') 'Is',TRIM(DS_1_NAME),& + 'attached to dimension',DIM1,' ... ',is_attached + + + ! Check to see how many Dimension Scales are attached + + CALL H5DSget_num_scales_f(did, DIM1, num_scales, err) + + WRITE(*,'(5X,A,I0)') 'Total number of Dimension Scales Attached ... ', num_scales + + ! Detach scale + CALL H5DSdetach_scale_f(did, dsid, DIM1, err) + WRITE(*,'(/,5A,I0)') & + "Detach Dimension Scale """,TRIM(DS_1_NAME),'" from "', TRIM(DSET_NAME), '" at dimension ', DIM1 + + ! Check to see if a dimension scale is attached, should be .false. + CALL H5DSis_attached_f(did, dsid, DIM1, is_attached, err) + WRITE(*,'(/,5X,3(A,1X),I0,A,L1)') 'Is',TRIM(DS_1_NAME),& + 'attached to dimension',DIM1,' ... ',is_attached + + !------------------------------------------------------------------------- + ! set the DS_1_NAME dimension scale to DSET_NAME at dimension 1 + !------------------------------------------------------------------------- + + WRITE(*,'(/,5A,I0)') & + 'Set Dimension Scale "', TRIM(DS_1_NAME), '" to "', TRIM(DSET_NAME), '" at dimension ', DIM1 + + CALL H5DSset_scale_f(dsid, err, "Set X") + + ! Test if Dimension Scale + + CALL H5DSis_scale_f(dsid, is_scale, err) + + ! Get scale name + + name_len = 25 + name = '' + CALL H5DSget_scale_name_f(dsid, name, name_len, err) + + WRITE(*,'(/,5X,A,A)') 'The Dimension Scale name is ... ', name(1:name_len) + + ! Setting Dimension Scale Label + + WRITE(*,'(/,A,I0)') "Setting Dimension Scale label ""X"" for dimension ", DIM1 + + CALL H5DSset_label_f(did, DIM1, "X", err) + + label_len = 25 + label = '' + CALL H5DSget_label_f(did, DIM1, label, label_len, err) + + WRITE(*,'(/,5X,A,I0,2A)') 'Dimension Scale Label for dimension ', DIM1, ' is ... ', label(1:label_len) + + ! close DS id + CALL H5Dclose_f(dsid, err) + + !------------------------------------------------------------------------- + ! attach the DS_2_NAME dimension scale to DSET_NAME + !------------------------------------------------------------------------- + + ! get the DS dataset id + CALL H5Dopen_f(fid, DS_2_NAME, dsid, err) + + ! attach the DS_2_NAME dimension scale to DSET_NAME as the 2nd dimension (index 2) + + WRITE(*,'(/,5A,I0)') & + 'Set Dimension Scale "', TRIM(DS_2_NAME), '" to "', TRIM(DSET_NAME), '" at dimension ', DIM2 + + CALL H5DSattach_scale_f(did, dsid, DIM2, err) + + CALL H5DSis_attached_f(did, dsid, DIM2, is_attached, err) + + CALL H5DSset_scale_f(dsid, err, "Set Y") + + ! Get scale name + name_len = 25 + name = '' + CALL H5DSget_scale_name_f(dsid, name(1:name_len), name_len, err) + + WRITE(*,'(/,5X,A,A)') 'The Dimension Scale name is ... ', name(1:name_len) + + + ! Setting Dimension Scale Label + + WRITE(*,'(/,A,I0)') "Setting Dimension Scale label ""Y"" for dimension ", DIM2 + + CALL H5DSset_label_f(did, DIM2, "Y", err) + + ! Get Label + + label_len = 25 + label = '' + CALL H5DSget_label_f(did, DIM2, label, label_len, err) + + WRITE(*,'(/,5X,A,I0,2A,/)') 'Dimension Scale Label for dimension ', DIM2, ' is ... ', label(1:label_len) + + ! close DS id + CALL H5Dclose_f(dsid, err) + + ! close file + CALL H5Fclose_f(fid, err) + +END PROGRAM example_ds + diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in index 919771d..2780bff 100755 --- a/hl/fortran/examples/run-hlfortran-ex.sh.in +++ b/hl/fortran/examples/run-hlfortran-ex.sh.in @@ -33,8 +33,8 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 # Where the tool is installed. -# Note: no '/' after DESTDIR. Explanation in commence.am -prefix="${prefix:-${DESTDIR}@prefix@}" +# default is relative path to installed location of the tools +prefix="${prefix:-../../../../}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index e55fcd4..916e9e1 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT(HDF5_HL_F90_SRC C CXX Fortran) #----------------------------------------------------------------------------- @@ -15,6 +15,7 @@ INCLUDE_DIRECTORIES ( # hl_f90CStub lib #----------------------------------------------------------------------------- SET (HDF5_HL_F90_C_SRCS + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5DSfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMcc.c @@ -29,11 +30,13 @@ ADD_LIBRARY (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_C_SRCS} ${HDF TARGET_LINK_LIBRARIES (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} ${LIB_TYPE}) +SET_TARGET_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran) #----------------------------------------------------------------------------- # Fortran Modules #----------------------------------------------------------------------------- SET (HDF5_HL_F90_F_SRCS + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5DSff.f90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBff.f90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.f90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.f90 @@ -44,9 +47,9 @@ SET (SHARED_LINK_FLAGS " ") IF (BUILD_SHARED_LIBS) IF (WIN32 AND NOT CYGWIN) SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS - BUILD_HDF5_DLL - ) + APPEND PROPERTY COMPILE_DEFINITIONS + BUILD_HDF5_DLL + ) IF (MSVC) SET (SHARED_LINK_FLAGS "/DLL") ENDIF (MSVC) @@ -55,7 +58,7 @@ ENDIF (BUILD_SHARED_LIBS) IF (WIN32 AND NOT CYGWIN) SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS - HDF5F90_WINDOWS + HDF5F90_WINDOWS ) ENDIF (WIN32 AND NOT CYGWIN) TARGET_FORTRAN_WIN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} ${SHARED_LINK_FLAGS}) @@ -63,18 +66,30 @@ SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fort TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} ${LIB_TYPE}) +SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran) #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -INSTALL ( - DIRECTORY - ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/ - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR}/fortran - COMPONENT - fortheaders -) +IF (WIN32 AND NOT CYGWIN) + INSTALL ( + DIRECTORY + ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/ + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/fortran + COMPONENT + fortheaders + ) +ELSE (WIN32 AND NOT CYGWIN) + INSTALL ( + DIRECTORY + ${CMAKE_Fortran_MODULE_DIRECTORY}/ + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/fortran + COMPONENT + fortheaders + ) +ENDIF (WIN32 AND NOT CYGWIN) #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects diff --git a/hl/fortran/src/H5DSfc.c b/hl/fortran/src/H5DSfc.c new file mode 100755 index 0000000..6816347 --- /dev/null +++ b/hl/fortran/src/H5DSfc.c @@ -0,0 +1,377 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* Copyright by The HDF Group. * +* Copyright by the Board of Trustees of the University of Illinois. * +* All rights reserved. * +* * +* This file is part of HDF5. The full HDF5 copyright notice, including * +* terms governing use, modification, and redistribution, is contained in * +* the files COPYING and Copyright.html. COPYING can be found at the root * +* of the source code distribution tree; Copyright.html can be found at the * +* root level of an installed copy of the electronic HDF5 document set and * +* is linked from the top-level documents page. It can also be found at * +* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +* access to either file, you may request a copy from help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* This files contains C stubs for H5D Fortran APIs */ + +#include "H5DSprivate.h" +#include "H5LTf90proto.h" +#include "H5Eprivate.h" + +/*------------------------------------------------------------------------- +* Function: h5dsset_scale_c +* +* Purpose: Calls H5DSset_scale +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 17, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsset_scale_c(hid_t_f *dsid, _fcd dimname, int_f *dimnamelen) +{ + char *c_dimname = NULL; + int_f ret_value = 0; + + /* + * convert FORTRAN name to C name + */ + + if(*dimnamelen != 0) + if(NULL == (c_dimname = (char *)HD5f2cstring(dimname, (size_t)*dimnamelen))) + HGOTO_DONE(FAIL) + + /* + * call H5DSset_scale function. + */ + + if(H5DSset_scale( (hid_t)*dsid, c_dimname) < 0) + HGOTO_DONE(FAIL) + + done: + if(c_dimname) + HDfree(c_dimname); + + return ret_value; + +} /* end nh5dsset_scale_c() */ + + +/*------------------------------------------------------------------------- +* Function: H5DSattach_scale_c +* +* Purpose: Calls H5DSattach_scale +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 17, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx) +{ + int_f ret_value = 0; + + /* + * call H5DSset_scale function. + */ + + if(H5DSattach_scale( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx ) < 0) + HGOTO_DONE(FAIL) + + done: + return ret_value; + +} /* end nh5dsattach_scale_c() */ + + +/*------------------------------------------------------------------------- +* Function: H5DSdetach_scale_c +* +* Purpose: Calls H5DSdetach_scale +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 17, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx) +{ + int_f ret_value = 0; + + /* + * call H5DSset_scale function. + */ + + if(H5DSdetach_scale( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx ) < 0) + HGOTO_DONE(FAIL) + + done: + return ret_value; + +} /* end nh5dsdetach_scale_c() */ + + +/*------------------------------------------------------------------------- +* Function: H5DSis_attached_c +* +* Purpose: Calls H5DSis_attached +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 17, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached) +{ + int_f ret_value = 0; + htri_t c_is_attached; + + /* + * call H5DSis_attached function. + */ + + if((c_is_attached = H5DSis_attached( (hid_t)*did, (hid_t)*dsid, (unsigned)*idx )) < 0) + HGOTO_DONE(FAIL) + + *is_attached = (int_f)c_is_attached; + + done: + return ret_value; + +} /* end nh5dsis_attached_c() */ + +/*------------------------------------------------------------------------- +* Function: H5DSis_scale_c +* +* Purpose: Calls H5DSis_scale +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 18, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsis_scale_c( hid_t_f *did, int_f *is_scale) +{ + int_f ret_value = 0; + htri_t c_is_scale; + + /* + * call H5DSis_scale function. + */ + + if((c_is_scale=H5DSis_scale( (hid_t)*did )) < 0) + HGOTO_DONE(FAIL) + + *is_scale = (int_f)c_is_scale; + + done: + return ret_value; + +} /* end nh5dsis_scale_c() */ + + +/*------------------------------------------------------------------------- +* Function: h5dsset_label_c +* +* Purpose: Calls H5DSset_label +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 18, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, int_f *labellen) +{ + char *c_label = NULL; + int_f ret_value = 0; + + /* + * convert FORTRAN name to C name + */ + + if(NULL == (c_label = (char *)HD5f2cstring(label, (size_t)*labellen))) + HGOTO_DONE(FAIL) + + /* + * call H5DSset_label function. + */ + + if(H5DSset_label( (hid_t)*did, (unsigned)*idx, c_label) < 0) + HGOTO_DONE(FAIL) + + done: + if(c_label) + HDfree(c_label); + + return ret_value; + +} /* end nh5dsset_label_c() */ + +/*------------------------------------------------------------------------- +* Function: h5dsget_label_c +* +* Purpose: Calls H5DSget_label +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 18, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size) +{ + char *c_label = NULL; + ssize_t size_c = -1; + int_f ret_value = 0; + + /* + * Allocate buffer to hold label + */ + if ((c_label = HDmalloc((size_t)*size + 1)) == NULL) + HGOTO_DONE(FAIL); + + /* + * call H5DSget_label function. + */ + + if( (size_c = (size_t_f)H5DSget_label( (hid_t)*did, (unsigned)*idx, c_label, (size_t)*size+1)) < 0) + HGOTO_DONE(FAIL) + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + + HD5packFstring(c_label, _fcdtocp(label), (size_t)*size+1); + +done: + *size = (size_t_f)size_c; /* Don't subtract '1' because H5DSget_label doesn't include the + * trailing NULL in the length calculation, Ref. HDFFV-7596 */ + if(c_label) HDfree(c_label); + return ret_value; + +} /* end nh5dsget_label_c() */ + +/*------------------------------------------------------------------------- +* Function: h5dsget_scale_name_c +* +* Purpose: Calls H5DSget_scale_name +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 18, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size) +{ + char *c_scale_name = NULL; + ssize_t size_c = -1; + int_f ret_value = 0; + + /* + * Allocate buffer to hold name + */ + if ((c_scale_name = HDmalloc((size_t)*size + 1)) == NULL) + HGOTO_DONE(FAIL); + + /* + * call H5DSget_scale_name function. + */ + + if( (size_c = (size_t_f)H5DSget_scale_name( (hid_t)*did, c_scale_name, (size_t)*size+1)) < 0) + HGOTO_DONE(FAIL) + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + if(size_c != 0) { + HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size+1); + *size = (size_t_f)size_c-1; /* (-1) because we don't include the NULL ending in the length*/ + } else { + *size = (size_t_f)size_c; /* if NULL then no name was found */ + } + +done: + if(c_scale_name) HDfree(c_scale_name); + return ret_value; + +} /* end nh5dsget_scale_name_c() */ + +/*------------------------------------------------------------------------- +* Function: H5DSget_num_scales_c +* +* Purpose: Calls H5DSget_num_scales +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: April 18, 2011 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +nh5dsget_num_scales_c( hid_t_f *did, int_f *idx, int_f *num_scales) +{ + int_f ret_value = 0; + + /* + * call H5DSset_scale function. + */ + + if( (*num_scales = (int_f)H5DSget_num_scales( (hid_t)*did, (unsigned)*idx)) < 0) + HGOTO_DONE(FAIL) + + done: + return ret_value; + +} /* end nh5dsget_num_scales_c() */ diff --git a/hl/fortran/src/H5DSff.f90 b/hl/fortran/src/H5DSff.f90 new file mode 100755 index 0000000..c3ec587 --- /dev/null +++ b/hl/fortran/src/H5DSff.f90 @@ -0,0 +1,536 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! This file contains FORTRAN90 interfaces for H5DS functions +! + +MODULE h5ds + + USE h5fortran_types + USE hdf5 + +CONTAINS + + +!------------------------------------------------------------------------- +! Function: H5DSset_scale_f +! +! Purpose: Convert dataset dsid to a dimension scale, with optional name, dimname. +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 17, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSset_scale_f( dsid, errcode, dimname) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsset_scale_f +!DEC$endif +! + + INTEGER(hid_t), INTENT(in) :: dsid ! The dataset to be made a Dimension Scale + CHARACTER(LEN=*), INTENT(in), OPTIONAL :: dimname ! The dimension name + INTEGER :: errcode ! Error code + + INTEGER:: dimname_len ! length of dimname (if present) + + INTERFACE + INTEGER FUNCTION H5DSset_scale_c(dsid, dimname, dimname_len ) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSSET_SCALE_C'::h5dsset_scale_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: dimname + INTEGER(hid_t), INTENT(in) :: dsid ! The dataset to be made a Dimension Scale + CHARACTER(LEN=*), INTENT(in) :: dimname ! The dimension name + INTEGER, INTENT(in) :: dimname_len + END FUNCTION H5DSset_scale_c + END INTERFACE + + IF(PRESENT(dimname))THEN + dimname_len = LEN(dimname) + errcode = H5DSset_scale_c(dsid, dimname, dimname_len ) + ELSE + errcode = H5DSset_scale_c(dsid, " ", 0 ) + ENDIF + + END SUBROUTINE H5DSset_scale_f + +!------------------------------------------------------------------------- +! Function: H5DSattach_scale_f +! +! Purpose: Attach dimension scale dsid to dimension idx of dataset did. +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 17, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSattach_scale_f( did, dsid, idx, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsattach_scale_f +!DEC$endif +! + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be attached + INTEGER , INTENT(in) :: idx ! the dimension of did that dsid is associated with. + INTEGER :: errcode ! error code + INTEGER :: c_idx + + INTERFACE + INTEGER FUNCTION H5DSattach_scale_c(did, dsid, idx ) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSATTACH_SCALE_C':: h5dsattach_scale_c + !DEC$ENDIF + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be attached + INTEGER , INTENT(in) :: idx ! the dimension of did that dsid is associated with. + END FUNCTION H5DSattach_scale_c + END INTERFACE + + c_idx = idx -1 ! account for C-dimensions starting at 0 + + errcode = H5DSattach_scale_c( did, dsid, c_idx) + + END SUBROUTINE H5DSattach_scale_f + +!------------------------------------------------------------------------- +! Function: H5DSdetach_scale_f +! +! Purpose: Detach dimension scale dsid from the dimension idx of Dataset did. +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 17, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSdetach_scale_f( did, dsid, idx, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsdetach_scale_f +!DEC$endif +! + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be detached + INTEGER , INTENT(in) :: idx ! the dimension of did to detach + INTEGER :: errcode ! error code + INTEGER :: c_idx + + INTERFACE + INTEGER FUNCTION H5DSdetach_scale_c(did, dsid, idx ) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSDETACH_SCALE_C':: h5dsdetach_scale_c + !DEC$ENDIF + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be detached + INTEGER , INTENT(in) :: idx ! the dimension of did to detach + END FUNCTION H5DSdetach_scale_c + END INTERFACE + + c_idx = idx - 1 ! account for C-dimensions starting at 0 + + errcode = H5DSdetach_scale_c( did, dsid, c_idx) + + END SUBROUTINE H5DSdetach_scale_f + + +!------------------------------------------------------------------------- +! Function: H5DSis_attached_f +! +! Purpose: Report if dimension scale dsid is currently attached to dimension idx of dataset did. +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 17, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSis_attached_f( did, dsid, idx, is_attached, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsis_attached_f +!DEC$endif +! + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be attached + INTEGER , INTENT(in) :: idx ! the dimension of did that dsid is associated with + LOGICAL , INTENT(out) :: is_attached ! logical: dimension scale dsid is currently attached to + ! dimension idx of dataset did + INTEGER :: errcode ! error code + INTEGER :: c_is_attached + INTEGER :: c_idx + + INTERFACE + INTEGER FUNCTION H5DSis_attached_c(did, dsid, idx, c_is_attached ) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSIS_ATTACHED_C':: h5dsis_attached_c + !DEC$ENDIF + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be detached + INTEGER , INTENT(in) :: idx ! the dimension of did to detach + INTEGER , INTENT(out) :: c_is_attached ! dimension scale dsid is currently attached to + END FUNCTION H5DSis_attached_c + END INTERFACE + + c_idx = idx - 1 ! account for C-dimensions starting at 0 + + errcode = H5DSis_attached_c(did, dsid, c_idx, c_is_attached) + + is_attached = .FALSE. ! default + IF(c_is_attached.GT.0)THEN + is_attached = .TRUE. + ELSE IF(errcode.LT.0)THEN + errcode = -1 + ENDIF + + END SUBROUTINE H5DSis_attached_f + +! +! H5DSiterate_scales: Impliment in F2003 +! + +!------------------------------------------------------------------------- +! Function: H5DSis_scale_f +! +! Purpose: Determines whether dset is a Dimension Scale. +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 18, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSis_scale_f( did, is_scale, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsis_scale_f +!DEC$endif +! + INTEGER(hid_t), INTENT(in) :: did ! the data set to query + LOGICAL , INTENT(out) :: is_scale ! logical: + ! .TRUE. if did is a Dimension Scale + INTEGER :: errcode ! error code + INTEGER :: c_is_scale + + INTERFACE + INTEGER FUNCTION H5DSis_scale_c(did,c_is_scale) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSIS_SCALE_C':: h5dsis_scale_c + !DEC$ENDIF + INTEGER(hid_t), INTENT(in) :: did ! the data set to query + INTEGER, INTENT(out) :: c_is_scale + END FUNCTION H5DSis_scale_c + END INTERFACE + + errcode = H5DSis_scale_c(did, c_is_scale) + + is_scale = .FALSE. ! default + IF(c_is_scale.GT.0)THEN + is_scale = .TRUE. + ELSE IF(errcode.LT.0)THEN + errcode = -1 + ENDIF + + END SUBROUTINE H5DSis_scale_f + +!------------------------------------------------------------------------- +! Function: H5DSset_label_f +! +! Purpose: Set label for the dimension idx of did to the value label +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 18, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSset_label_f( did, idx, label, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsset_label_f +!DEC$endif +! + + INTEGER(hid_t), INTENT(in) :: did ! The dataset + INTEGER , INTENT(in) :: idx ! The dimension + CHARACTER(LEN=*), INTENT(in) :: label ! The label + INTEGER :: errcode ! Error code + + INTEGER :: label_len ! Length of label + INTEGER :: c_idx + + INTERFACE + INTEGER FUNCTION H5DSset_label_c(did, idx, label, label_len) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSSET_LABEL_C'::h5dsset_label_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: label + INTEGER(hid_t), INTENT(in) :: did ! The dataset + INTEGER , INTENT(in) :: idx ! The dimension + CHARACTER(LEN=*), INTENT(in) :: label ! The label + INTEGER, INTENT(in) :: label_len ! Length of label + END FUNCTION H5DSset_label_c + END INTERFACE + + c_idx = idx - 1 + + label_len = LEN(label) + errcode = H5DSset_label_c(did, c_idx, label, label_len) + + END SUBROUTINE H5DSset_label_f + +!------------------------------------------------------------------------- +! Function: H5DSget_label_f +! +! Purpose: Read the label for dimension idx of did into buffer label. +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 18, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSget_label_f( did, idx, label, size, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsget_label_f +!DEC$endif +! + + INTEGER(hid_t), INTENT(in) :: did ! The dataget + INTEGER , INTENT(in) :: idx ! The dimension + CHARACTER(LEN=*), INTENT(in) :: label ! The label + INTEGER(size_t) , INTENT(inout) :: size ! The length of the label buffer + INTEGER :: errcode ! Error code + INTEGER :: c_idx + + INTERFACE + INTEGER FUNCTION H5DSget_label_c(did, idx, label, size) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSGET_LABEL_C'::h5dsget_label_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: label + INTEGER(hid_t), INTENT(in) :: did ! The dataget + INTEGER , INTENT(in) :: idx ! The dimension + CHARACTER(LEN=*), INTENT(in) :: label ! The label + INTEGER(SIZE_T), INTENT(inout) :: size ! Length of label + END FUNCTION H5DSget_label_c + END INTERFACE + + c_idx = idx - 1 + + errcode = H5DSget_label_c(did, c_idx, label, size) + + END SUBROUTINE H5DSget_label_f + + +!------------------------------------------------------------------------- +! Function: H5DSget_scale_name_f +! +! Purpose: Read the name of scale did into buffer name. +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 18, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSget_scale_name_f(did, name, size, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsget_scale_name_f +!DEC$endif +! + + INTEGER(hid_t), INTENT(in) :: did ! The dataget + CHARACTER(LEN=*), INTENT(out) :: name ! The name + INTEGER(size_t) , INTENT(inout) :: size ! The length of the name buffer + INTEGER :: errcode ! Error code + + INTERFACE + INTEGER FUNCTION H5DSget_scale_name_c(did, name, size) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSGET_SCALE_NAME_C'::h5dsget_scale_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + INTEGER(hid_t), INTENT(in) :: did ! The dataget + CHARACTER(LEN=*), INTENT(out) :: name ! The name + INTEGER(SIZE_T), INTENT(inout) :: size ! Length of name + END FUNCTION H5DSget_scale_name_c + END INTERFACE + + errcode = H5DSget_scale_name_c(did, name, size) + + END SUBROUTINE H5DSget_scale_name_f + +!------------------------------------------------------------------------- +! Function: H5DSget_num_scales_f +! +! Purpose: Determines how many Dimension Scales are attached to dimension idx of did +! +! Return: Success: 0, Failure: -1 +! +! Programmer: M. Scot Breitenfeld +! +! Date: April 18, 2011 +! +! Comments: +! +! Modifications: +! +!------------------------------------------------------------------------- + + SUBROUTINE H5DSget_num_scales_f( did, idx, num_scales, errcode) + + IMPLICIT NONE + +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5dsget_num_scales_f +!DEC$endif +! + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER , INTENT(in) :: idx ! the dimension of did to query + INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did + INTEGER :: errcode ! error code + INTEGER :: c_idx + + INTERFACE + INTEGER FUNCTION H5DSget_num_scales_c(did, idx, num_scales) + + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DSGET_NUM_SCALES_C':: h5dsget_num_scales_c + !DEC$ENDIF + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER , INTENT(in) :: idx ! the dimension of did to query + INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did + END FUNCTION H5DSget_num_scales_c + END INTERFACE + + c_idx = idx - 1 + errcode = H5DSget_num_scales_c(did, c_idx, num_scales) + + END SUBROUTINE H5DSget_num_scales_f + +END MODULE h5ds + + + + + + diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index 8f0e29e..22a7a3e 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -511,7 +511,7 @@ herr_t H5IM_get_palette(hid_t loc_id, goto out; /* Get the palette id */ - if((pal_id = H5Rdereference(image_id, H5R_OBJECT, &refbuf[pal_number])) < 0) + if((pal_id = H5Rdereference2(image_id, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0) goto out; /* Read the palette dataset using the memory type TID */ diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 470f174..205871c 100755 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -26,166 +26,223 @@ H5_FCDLL char* HD5f2cstring (_fcd fdesc, int len); H5_FCDLL void HD5packFstring (char *src, char *dest, size_t len); +/* + * Functions from H5DSfc.c + */ + +#define nh5dsset_scale_c H5_FC_FUNC_(h5dsset_scale_c, H5DSSET_SCALE_C) +#define nh5dsattach_scale_c H5_FC_FUNC_(h5dsattach_scale_c, H5DSATTACH_SCALE_C) +#define nh5dsdetach_scale_c H5_FC_FUNC_(h5dsdetach_scale_c, H5DSDETACH_SCALE_C) +#define nh5dsis_attached_c H5_FC_FUNC_(h5dsis_attached_c, H5DSIS_ATTACHED_C) +#define nh5dsis_scale_c H5_FC_FUNC_(h5dsis_scale_c, H5DSIS_SCALE_C) +#define nh5dsset_label_c H5_FC_FUNC_(h5dsset_label_c, H5DSSET_LABEL_C) +#define nh5dsget_label_c H5_FC_FUNC_(h5dsget_label_c, H5DSGET_LABEL_C) +#define nh5dsget_scale_name_c H5_FC_FUNC_(h5dsget_scale_name_c,H5DSGET_SCALE_NAME_C) +#define nh5dsget_num_scales_c H5_FC_FUNC_(h5dsget_num_scales_c,H5DSGET_NUM_SCALES_C) + /* -* Functions from H5LTfc.c -*/ -# define nh5ltmake_dataset_c H5_FC_FUNC_(h5ltmake_dataset_c, H5LTMAKE_DATASET_C) -# define nh5ltmake_dataset_int1_c H5_FC_FUNC_(h5ltmake_dataset_int1_c, H5LTMAKE_DATASET_INT1_C) -# define nh5ltmake_dataset_int2_c H5_FC_FUNC_(h5ltmake_dataset_int2_c, H5LTMAKE_DATASET_INT2_C) -# define nh5ltmake_dataset_int3_c H5_FC_FUNC_(h5ltmake_dataset_int3_c, H5LTMAKE_DATASET_INT3_C) -# define nh5ltmake_dataset_int4_c H5_FC_FUNC_(h5ltmake_dataset_int4_c, H5LTMAKE_DATASET_INT4_C) -# define nh5ltmake_dataset_int5_c H5_FC_FUNC_(h5ltmake_dataset_int5_c, H5LTMAKE_DATASET_INT5_C) -# define nh5ltmake_dataset_int6_c H5_FC_FUNC_(h5ltmake_dataset_int6_c, H5LTMAKE_DATASET_INT6_C) -# define nh5ltmake_dataset_int7_c H5_FC_FUNC_(h5ltmake_dataset_int7_c, H5LTMAKE_DATASET_INT7_C) -# define nh5ltmake_dataset_fl1_c H5_FC_FUNC_(h5ltmake_dataset_fl1_c, H5LTMAKE_DATASET_FL1_C) -# define nh5ltmake_dataset_fl2_c H5_FC_FUNC_(h5ltmake_dataset_fl2_c, H5LTMAKE_DATASET_FL2_C) -# define nh5ltmake_dataset_fl3_c H5_FC_FUNC_(h5ltmake_dataset_fl3_c, H5LTMAKE_DATASET_FL3_C) -# define nh5ltmake_dataset_fl4_c H5_FC_FUNC_(h5ltmake_dataset_fl4_c, H5LTMAKE_DATASET_FL4_C) -# define nh5ltmake_dataset_fl5_c H5_FC_FUNC_(h5ltmake_dataset_fl5_c, H5LTMAKE_DATASET_FL5_C) -# define nh5ltmake_dataset_fl6_c H5_FC_FUNC_(h5ltmake_dataset_fl6_c, H5LTMAKE_DATASET_FL6_C) -# define nh5ltmake_dataset_fl7_c H5_FC_FUNC_(h5ltmake_dataset_fl7_c, H5LTMAKE_DATASET_FL7_C) -# define nh5ltmake_dataset_dl1_c H5_FC_FUNC_(h5ltmake_dataset_dl1_c, H5LTMAKE_DATASET_DL1_C) -# define nh5ltmake_dataset_dl2_c H5_FC_FUNC_(h5ltmake_dataset_dl2_c, H5LTMAKE_DATASET_DL2_C) -# define nh5ltmake_dataset_dl3_c H5_FC_FUNC_(h5ltmake_dataset_dl3_c, H5LTMAKE_DATASET_DL3_C) -# define nh5ltmake_dataset_dl4_c H5_FC_FUNC_(h5ltmake_dataset_dl4_c, H5LTMAKE_DATASET_DL4_C) -# define nh5ltmake_dataset_dl5_c H5_FC_FUNC_(h5ltmake_dataset_dl5_c, H5LTMAKE_DATASET_DL5_C) -# define nh5ltmake_dataset_dl6_c H5_FC_FUNC_(h5ltmake_dataset_dl6_c, H5LTMAKE_DATASET_DL6_C) -# define nh5ltmake_dataset_dl7_c H5_FC_FUNC_(h5ltmake_dataset_dl7_c, H5LTMAKE_DATASET_DL7_C) -# define nh5ltmake_dataset_nint1_c H5_FC_FUNC_(h5ltmake_dataset_nint1_c, H5LTMAKE_DATASET_NINT1_C) -# define nh5ltmake_dataset_nint2_c H5_FC_FUNC_(h5ltmake_dataset_nint2_c, H5LTMAKE_DATASET_NINT2_C) -# define nh5ltmake_dataset_nint3_c H5_FC_FUNC_(h5ltmake_dataset_nint3_c, H5LTMAKE_DATASET_NINT3_C) -# define nh5ltmake_dataset_nint4_c H5_FC_FUNC_(h5ltmake_dataset_nint4_c, H5LTMAKE_DATASET_NINT4_C) -# define nh5ltmake_dataset_nint5_c H5_FC_FUNC_(h5ltmake_dataset_nint5_c, H5LTMAKE_DATASET_NINT5_C) -# define nh5ltmake_dataset_nint6_c H5_FC_FUNC_(h5ltmake_dataset_nint6_c, H5LTMAKE_DATASET_NINT6_C) -# define nh5ltmake_dataset_nint7_c H5_FC_FUNC_(h5ltmake_dataset_nint7_c, H5LTMAKE_DATASET_NINT7_C) -# define nh5ltmake_dataset_nfl1_c H5_FC_FUNC_(h5ltmake_dataset_nfl1_c, H5LTMAKE_DATASET_NFL1_C) -# define nh5ltmake_dataset_nfl2_c H5_FC_FUNC_(h5ltmake_dataset_nfl2_c, H5LTMAKE_DATASET_NFL2_C) -# define nh5ltmake_dataset_nfl3_c H5_FC_FUNC_(h5ltmake_dataset_nfl3_c, H5LTMAKE_DATASET_NFL3_C) -# define nh5ltmake_dataset_nfl4_c H5_FC_FUNC_(h5ltmake_dataset_nfl4_c, H5LTMAKE_DATASET_NFL4_C) -# define nh5ltmake_dataset_nfl5_c H5_FC_FUNC_(h5ltmake_dataset_nfl5_c, H5LTMAKE_DATASET_NFL5_C) -# define nh5ltmake_dataset_nfl6_c H5_FC_FUNC_(h5ltmake_dataset_nfl6_c, H5LTMAKE_DATASET_NFL6_C) -# define nh5ltmake_dataset_nfl7_c H5_FC_FUNC_(h5ltmake_dataset_nfl7_c, H5LTMAKE_DATASET_NFL7_C) -# define nh5ltmake_dataset_ndl1_c H5_FC_FUNC_(h5ltmake_dataset_ndl1_c, H5LTMAKE_DATASET_NDL1_C) -# define nh5ltmake_dataset_ndl2_c H5_FC_FUNC_(h5ltmake_dataset_ndl2_c, H5LTMAKE_DATASET_NDL2_C) -# define nh5ltmake_dataset_ndl3_c H5_FC_FUNC_(h5ltmake_dataset_ndl3_c, H5LTMAKE_DATASET_NDL3_C) -# define nh5ltmake_dataset_ndl4_c H5_FC_FUNC_(h5ltmake_dataset_ndl4_c, H5LTMAKE_DATASET_NDL4_C) -# define nh5ltmake_dataset_ndl5_c H5_FC_FUNC_(h5ltmake_dataset_ndl5_c, H5LTMAKE_DATASET_NDL5_C) -# define nh5ltmake_dataset_ndl6_c H5_FC_FUNC_(h5ltmake_dataset_ndl6_c, H5LTMAKE_DATASET_NDL6_C) -# define nh5ltmake_dataset_ndl7_c H5_FC_FUNC_(h5ltmake_dataset_ndl7_c, H5LTMAKE_DATASET_NDL7_C) -# define nh5ltread_dataset_c H5_FC_FUNC_(h5ltread_dataset_c, H5LTREAD_DATASET_C) -# define nh5ltread_dataset_int1_c H5_FC_FUNC_(h5ltread_dataset_int1_c, H5LTREAD_DATASET_INT1_C) -# define nh5ltread_dataset_int2_c H5_FC_FUNC_(h5ltread_dataset_int2_c, H5LTREAD_DATASET_INT2_C) -# define nh5ltread_dataset_int3_c H5_FC_FUNC_(h5ltread_dataset_int3_c, H5LTREAD_DATASET_INT3_C) -# define nh5ltread_dataset_int4_c H5_FC_FUNC_(h5ltread_dataset_int4_c, H5LTREAD_DATASET_INT4_C) -# define nh5ltread_dataset_int5_c H5_FC_FUNC_(h5ltread_dataset_int5_c, H5LTREAD_DATASET_INT5_C) -# define nh5ltread_dataset_int6_c H5_FC_FUNC_(h5ltread_dataset_int6_c, H5LTREAD_DATASET_INT6_C) -# define nh5ltread_dataset_int7_c H5_FC_FUNC_(h5ltread_dataset_int7_c, H5LTREAD_DATASET_INT7_C) -# define nh5ltread_dataset_fl1_c H5_FC_FUNC_(h5ltread_dataset_fl1_c, H5LTREAD_DATASET_FL1_C) -# define nh5ltread_dataset_fl2_c H5_FC_FUNC_(h5ltread_dataset_fl2_c, H5LTREAD_DATASET_FL2_C) -# define nh5ltread_dataset_fl3_c H5_FC_FUNC_(h5ltread_dataset_fl3_c, H5LTREAD_DATASET_FL3_C) -# define nh5ltread_dataset_fl4_c H5_FC_FUNC_(h5ltread_dataset_fl4_c, H5LTREAD_DATASET_FL4_C) -# define nh5ltread_dataset_fl5_c H5_FC_FUNC_(h5ltread_dataset_fl5_c, H5LTREAD_DATASET_FL5_C) -# define nh5ltread_dataset_fl6_c H5_FC_FUNC_(h5ltread_dataset_fl6_c, H5LTREAD_DATASET_FL6_C) -# define nh5ltread_dataset_fl7_c H5_FC_FUNC_(h5ltread_dataset_fl7_c, H5LTREAD_DATASET_FL7_C) -# define nh5ltread_dataset_dl1_c H5_FC_FUNC_(h5ltread_dataset_dl1_c, H5LTREAD_DATASET_DL1_C) -# define nh5ltread_dataset_dl2_c H5_FC_FUNC_(h5ltread_dataset_dl2_c, H5LTREAD_DATASET_DL2_C) -# define nh5ltread_dataset_dl3_c H5_FC_FUNC_(h5ltread_dataset_dl3_c, H5LTREAD_DATASET_DL3_C) -# define nh5ltread_dataset_dl4_c H5_FC_FUNC_(h5ltread_dataset_dl4_c, H5LTREAD_DATASET_DL4_C) -# define nh5ltread_dataset_dl5_c H5_FC_FUNC_(h5ltread_dataset_dl5_c, H5LTREAD_DATASET_DL5_C) -# define nh5ltread_dataset_dl6_c H5_FC_FUNC_(h5ltread_dataset_dl6_c, H5LTREAD_DATASET_DL6_C) -# define nh5ltread_dataset_dl7_c H5_FC_FUNC_(h5ltread_dataset_dl7_c, H5LTREAD_DATASET_DL7_C) -# define nh5ltread_dataset_nint1_c H5_FC_FUNC_(h5ltread_dataset_nint1_c, H5LTREAD_DATASET_NINT1_C) -# define nh5ltread_dataset_nint2_c H5_FC_FUNC_(h5ltread_dataset_nint2_c, H5LTREAD_DATASET_NINT2_C) -# define nh5ltread_dataset_nint3_c H5_FC_FUNC_(h5ltread_dataset_nint3_c, H5LTREAD_DATASET_NINT3_C) -# define nh5ltread_dataset_nint4_c H5_FC_FUNC_(h5ltread_dataset_nint4_c, H5LTREAD_DATASET_NINT4_C) -# define nh5ltread_dataset_nint5_c H5_FC_FUNC_(h5ltread_dataset_nint5_c, H5LTREAD_DATASET_NINT5_C) -# define nh5ltread_dataset_nint6_c H5_FC_FUNC_(h5ltread_dataset_nint6_c, H5LTREAD_DATASET_NINT6_C) -# define nh5ltread_dataset_nint7_c H5_FC_FUNC_(h5ltread_dataset_nint7_c, H5LTREAD_DATASET_NINT7_C) -# define nh5ltread_dataset_nfl1_c H5_FC_FUNC_(h5ltread_dataset_nfl1_c, H5LTREAD_DATASET_NFL1_C) -# define nh5ltread_dataset_nfl2_c H5_FC_FUNC_(h5ltread_dataset_nfl2_c, H5LTREAD_DATASET_NFL2_C) -# define nh5ltread_dataset_nfl3_c H5_FC_FUNC_(h5ltread_dataset_nfl3_c, H5LTREAD_DATASET_NFL3_C) -# define nh5ltread_dataset_nfl4_c H5_FC_FUNC_(h5ltread_dataset_nfl4_c, H5LTREAD_DATASET_NFL4_C) -# define nh5ltread_dataset_nfl5_c H5_FC_FUNC_(h5ltread_dataset_nfl5_c, H5LTREAD_DATASET_NFL5_C) -# define nh5ltread_dataset_nfl6_c H5_FC_FUNC_(h5ltread_dataset_nfl6_c, H5LTREAD_DATASET_NFL6_C) -# define nh5ltread_dataset_nfl7_c H5_FC_FUNC_(h5ltread_dataset_nfl7_c, H5LTREAD_DATASET_NFL7_C) -# define nh5ltread_dataset_ndl1_c H5_FC_FUNC_(h5ltread_dataset_ndl1_c, H5LTREAD_DATASET_NDL1_C) -# define nh5ltread_dataset_ndl2_c H5_FC_FUNC_(h5ltread_dataset_ndl2_c, H5LTREAD_DATASET_NDL2_C) -# define nh5ltread_dataset_ndl3_c H5_FC_FUNC_(h5ltread_dataset_ndl3_c, H5LTREAD_DATASET_NDL3_C) -# define nh5ltread_dataset_ndl4_c H5_FC_FUNC_(h5ltread_dataset_ndl4_c, H5LTREAD_DATASET_NDL4_C) -# define nh5ltread_dataset_ndl5_c H5_FC_FUNC_(h5ltread_dataset_ndl5_c, H5LTREAD_DATASET_NDL5_C) -# define nh5ltread_dataset_ndl6_c H5_FC_FUNC_(h5ltread_dataset_ndl6_c, H5LTREAD_DATASET_NDL6_C) -# define nh5ltread_dataset_ndl7_c H5_FC_FUNC_(h5ltread_dataset_ndl7_c, H5LTREAD_DATASET_NDL7_C) -# define nh5ltmake_dataset_string_c H5_FC_FUNC_(h5ltmake_dataset_string_c, H5LTMAKE_DATASET_STRING_C) -# define nh5ltread_dataset_string_c H5_FC_FUNC_(h5ltread_dataset_string_c, H5LTREAD_DATASET_STRING_C) - -# define nh5ltset_attribute_int_c H5_FC_FUNC_(h5ltset_attribute_int_c, H5LTSET_ATTRIBUTE_INT_C) -# define nh5ltset_attribute_float_c H5_FC_FUNC_(h5ltset_attribute_float_c, H5LTSET_ATTRIBUTE_FLOAT_C) -# define nh5ltset_attribute_double_c H5_FC_FUNC_(h5ltset_attribute_double_c, H5LTSET_ATTRIBUTE_DOUBLE_C) -# define nh5ltset_attribute_string_c H5_FC_FUNC_(h5ltset_attribute_string_c, H5LTSET_ATTRIBUTE_STRING_C) - -# define nh5ltget_attribute_int_c H5_FC_FUNC_(h5ltget_attribute_int_c, H5LTGET_ATTRIBUTE_INT_C) -# define nh5ltget_attribute_float_c H5_FC_FUNC_(h5ltget_attribute_float_c, H5LTGET_ATTRIBUTE_FLOAT_C) -# define nh5ltget_attribute_double_c H5_FC_FUNC_(h5ltget_attribute_double_c, H5LTGET_ATTRIBUTE_DOUBLE_C) -# define nh5ltget_attribute_string_c H5_FC_FUNC_(h5ltget_attribute_string_c, H5LTGET_ATTRIBUTE_STRING_C) - -# define nh5ltget_dataset_ndims_c H5_FC_FUNC_(h5ltget_dataset_ndims_c, H5LTGET_DATASET_NDIMS_C) -# define nh5ltfind_dataset_c H5_FC_FUNC_(h5ltfind_dataset_c, H5LTFIND_DATASET_C) -# define nh5ltget_dataset_info_c H5_FC_FUNC_(h5ltget_dataset_info_c, H5LTGET_DATASET_INFO_C) - -# define nh5ltget_attribute_ndims_c H5_FC_FUNC_(h5ltget_attribute_ndims_c, H5LTGET_ATTRIBUTE_NDIMS_C) -# define nh5ltget_attribute_info_c H5_FC_FUNC_(h5ltget_attribute_info_c, H5LTGET_ATTRIBUTE_INFO_C) + * Functions from H5LTfc.c + */ +#define nh5ltmake_dataset_c H5_FC_FUNC_(h5ltmake_dataset_c, H5LTMAKE_DATASET_C) +#define nh5ltmake_dataset_int1_c H5_FC_FUNC_(h5ltmake_dataset_int1_c, H5LTMAKE_DATASET_INT1_C) +#define nh5ltmake_dataset_int2_c H5_FC_FUNC_(h5ltmake_dataset_int2_c, H5LTMAKE_DATASET_INT2_C) +#define nh5ltmake_dataset_int3_c H5_FC_FUNC_(h5ltmake_dataset_int3_c, H5LTMAKE_DATASET_INT3_C) +#define nh5ltmake_dataset_int4_c H5_FC_FUNC_(h5ltmake_dataset_int4_c, H5LTMAKE_DATASET_INT4_C) +#define nh5ltmake_dataset_int5_c H5_FC_FUNC_(h5ltmake_dataset_int5_c, H5LTMAKE_DATASET_INT5_C) +#define nh5ltmake_dataset_int6_c H5_FC_FUNC_(h5ltmake_dataset_int6_c, H5LTMAKE_DATASET_INT6_C) +#define nh5ltmake_dataset_int7_c H5_FC_FUNC_(h5ltmake_dataset_int7_c, H5LTMAKE_DATASET_INT7_C) +#define nh5ltmake_dataset_fl1_c H5_FC_FUNC_(h5ltmake_dataset_fl1_c, H5LTMAKE_DATASET_FL1_C) +#define nh5ltmake_dataset_fl2_c H5_FC_FUNC_(h5ltmake_dataset_fl2_c, H5LTMAKE_DATASET_FL2_C) +#define nh5ltmake_dataset_fl3_c H5_FC_FUNC_(h5ltmake_dataset_fl3_c, H5LTMAKE_DATASET_FL3_C) +#define nh5ltmake_dataset_fl4_c H5_FC_FUNC_(h5ltmake_dataset_fl4_c, H5LTMAKE_DATASET_FL4_C) +#define nh5ltmake_dataset_fl5_c H5_FC_FUNC_(h5ltmake_dataset_fl5_c, H5LTMAKE_DATASET_FL5_C) +#define nh5ltmake_dataset_fl6_c H5_FC_FUNC_(h5ltmake_dataset_fl6_c, H5LTMAKE_DATASET_FL6_C) +#define nh5ltmake_dataset_fl7_c H5_FC_FUNC_(h5ltmake_dataset_fl7_c, H5LTMAKE_DATASET_FL7_C) +#define nh5ltmake_dataset_dl1_c H5_FC_FUNC_(h5ltmake_dataset_dl1_c, H5LTMAKE_DATASET_DL1_C) +#define nh5ltmake_dataset_dl2_c H5_FC_FUNC_(h5ltmake_dataset_dl2_c, H5LTMAKE_DATASET_DL2_C) +#define nh5ltmake_dataset_dl3_c H5_FC_FUNC_(h5ltmake_dataset_dl3_c, H5LTMAKE_DATASET_DL3_C) +#define nh5ltmake_dataset_dl4_c H5_FC_FUNC_(h5ltmake_dataset_dl4_c, H5LTMAKE_DATASET_DL4_C) +#define nh5ltmake_dataset_dl5_c H5_FC_FUNC_(h5ltmake_dataset_dl5_c, H5LTMAKE_DATASET_DL5_C) +#define nh5ltmake_dataset_dl6_c H5_FC_FUNC_(h5ltmake_dataset_dl6_c, H5LTMAKE_DATASET_DL6_C) +#define nh5ltmake_dataset_dl7_c H5_FC_FUNC_(h5ltmake_dataset_dl7_c, H5LTMAKE_DATASET_DL7_C) +#define nh5ltmake_dataset_nint1_c H5_FC_FUNC_(h5ltmake_dataset_nint1_c, H5LTMAKE_DATASET_NINT1_C) +#define nh5ltmake_dataset_nint2_c H5_FC_FUNC_(h5ltmake_dataset_nint2_c, H5LTMAKE_DATASET_NINT2_C) +#define nh5ltmake_dataset_nint3_c H5_FC_FUNC_(h5ltmake_dataset_nint3_c, H5LTMAKE_DATASET_NINT3_C) +#define nh5ltmake_dataset_nint4_c H5_FC_FUNC_(h5ltmake_dataset_nint4_c, H5LTMAKE_DATASET_NINT4_C) +#define nh5ltmake_dataset_nint5_c H5_FC_FUNC_(h5ltmake_dataset_nint5_c, H5LTMAKE_DATASET_NINT5_C) +#define nh5ltmake_dataset_nint6_c H5_FC_FUNC_(h5ltmake_dataset_nint6_c, H5LTMAKE_DATASET_NINT6_C) +#define nh5ltmake_dataset_nint7_c H5_FC_FUNC_(h5ltmake_dataset_nint7_c, H5LTMAKE_DATASET_NINT7_C) +#define nh5ltmake_dataset_nfl1_c H5_FC_FUNC_(h5ltmake_dataset_nfl1_c, H5LTMAKE_DATASET_NFL1_C) +#define nh5ltmake_dataset_nfl2_c H5_FC_FUNC_(h5ltmake_dataset_nfl2_c, H5LTMAKE_DATASET_NFL2_C) +#define nh5ltmake_dataset_nfl3_c H5_FC_FUNC_(h5ltmake_dataset_nfl3_c, H5LTMAKE_DATASET_NFL3_C) +#define nh5ltmake_dataset_nfl4_c H5_FC_FUNC_(h5ltmake_dataset_nfl4_c, H5LTMAKE_DATASET_NFL4_C) +#define nh5ltmake_dataset_nfl5_c H5_FC_FUNC_(h5ltmake_dataset_nfl5_c, H5LTMAKE_DATASET_NFL5_C) +#define nh5ltmake_dataset_nfl6_c H5_FC_FUNC_(h5ltmake_dataset_nfl6_c, H5LTMAKE_DATASET_NFL6_C) +#define nh5ltmake_dataset_nfl7_c H5_FC_FUNC_(h5ltmake_dataset_nfl7_c, H5LTMAKE_DATASET_NFL7_C) +#define nh5ltmake_dataset_ndl1_c H5_FC_FUNC_(h5ltmake_dataset_ndl1_c, H5LTMAKE_DATASET_NDL1_C) +#define nh5ltmake_dataset_ndl2_c H5_FC_FUNC_(h5ltmake_dataset_ndl2_c, H5LTMAKE_DATASET_NDL2_C) +#define nh5ltmake_dataset_ndl3_c H5_FC_FUNC_(h5ltmake_dataset_ndl3_c, H5LTMAKE_DATASET_NDL3_C) +#define nh5ltmake_dataset_ndl4_c H5_FC_FUNC_(h5ltmake_dataset_ndl4_c, H5LTMAKE_DATASET_NDL4_C) +#define nh5ltmake_dataset_ndl5_c H5_FC_FUNC_(h5ltmake_dataset_ndl5_c, H5LTMAKE_DATASET_NDL5_C) +#define nh5ltmake_dataset_ndl6_c H5_FC_FUNC_(h5ltmake_dataset_ndl6_c, H5LTMAKE_DATASET_NDL6_C) +#define nh5ltmake_dataset_ndl7_c H5_FC_FUNC_(h5ltmake_dataset_ndl7_c, H5LTMAKE_DATASET_NDL7_C) +#define nh5ltread_dataset_c H5_FC_FUNC_(h5ltread_dataset_c, H5LTREAD_DATASET_C) +#define nh5ltread_dataset_int1_c H5_FC_FUNC_(h5ltread_dataset_int1_c, H5LTREAD_DATASET_INT1_C) +#define nh5ltread_dataset_int2_c H5_FC_FUNC_(h5ltread_dataset_int2_c, H5LTREAD_DATASET_INT2_C) +#define nh5ltread_dataset_int3_c H5_FC_FUNC_(h5ltread_dataset_int3_c, H5LTREAD_DATASET_INT3_C) +#define nh5ltread_dataset_int4_c H5_FC_FUNC_(h5ltread_dataset_int4_c, H5LTREAD_DATASET_INT4_C) +#define nh5ltread_dataset_int5_c H5_FC_FUNC_(h5ltread_dataset_int5_c, H5LTREAD_DATASET_INT5_C) +#define nh5ltread_dataset_int6_c H5_FC_FUNC_(h5ltread_dataset_int6_c, H5LTREAD_DATASET_INT6_C) +#define nh5ltread_dataset_int7_c H5_FC_FUNC_(h5ltread_dataset_int7_c, H5LTREAD_DATASET_INT7_C) +#define nh5ltread_dataset_fl1_c H5_FC_FUNC_(h5ltread_dataset_fl1_c, H5LTREAD_DATASET_FL1_C) +#define nh5ltread_dataset_fl2_c H5_FC_FUNC_(h5ltread_dataset_fl2_c, H5LTREAD_DATASET_FL2_C) +#define nh5ltread_dataset_fl3_c H5_FC_FUNC_(h5ltread_dataset_fl3_c, H5LTREAD_DATASET_FL3_C) +#define nh5ltread_dataset_fl4_c H5_FC_FUNC_(h5ltread_dataset_fl4_c, H5LTREAD_DATASET_FL4_C) +#define nh5ltread_dataset_fl5_c H5_FC_FUNC_(h5ltread_dataset_fl5_c, H5LTREAD_DATASET_FL5_C) +#define nh5ltread_dataset_fl6_c H5_FC_FUNC_(h5ltread_dataset_fl6_c, H5LTREAD_DATASET_FL6_C) +#define nh5ltread_dataset_fl7_c H5_FC_FUNC_(h5ltread_dataset_fl7_c, H5LTREAD_DATASET_FL7_C) +#define nh5ltread_dataset_dl1_c H5_FC_FUNC_(h5ltread_dataset_dl1_c, H5LTREAD_DATASET_DL1_C) +#define nh5ltread_dataset_dl2_c H5_FC_FUNC_(h5ltread_dataset_dl2_c, H5LTREAD_DATASET_DL2_C) +#define nh5ltread_dataset_dl3_c H5_FC_FUNC_(h5ltread_dataset_dl3_c, H5LTREAD_DATASET_DL3_C) +#define nh5ltread_dataset_dl4_c H5_FC_FUNC_(h5ltread_dataset_dl4_c, H5LTREAD_DATASET_DL4_C) +#define nh5ltread_dataset_dl5_c H5_FC_FUNC_(h5ltread_dataset_dl5_c, H5LTREAD_DATASET_DL5_C) +#define nh5ltread_dataset_dl6_c H5_FC_FUNC_(h5ltread_dataset_dl6_c, H5LTREAD_DATASET_DL6_C) +#define nh5ltread_dataset_dl7_c H5_FC_FUNC_(h5ltread_dataset_dl7_c, H5LTREAD_DATASET_DL7_C) +#define nh5ltread_dataset_nint1_c H5_FC_FUNC_(h5ltread_dataset_nint1_c, H5LTREAD_DATASET_NINT1_C) +#define nh5ltread_dataset_nint2_c H5_FC_FUNC_(h5ltread_dataset_nint2_c, H5LTREAD_DATASET_NINT2_C) +#define nh5ltread_dataset_nint3_c H5_FC_FUNC_(h5ltread_dataset_nint3_c, H5LTREAD_DATASET_NINT3_C) +#define nh5ltread_dataset_nint4_c H5_FC_FUNC_(h5ltread_dataset_nint4_c, H5LTREAD_DATASET_NINT4_C) +#define nh5ltread_dataset_nint5_c H5_FC_FUNC_(h5ltread_dataset_nint5_c, H5LTREAD_DATASET_NINT5_C) +#define nh5ltread_dataset_nint6_c H5_FC_FUNC_(h5ltread_dataset_nint6_c, H5LTREAD_DATASET_NINT6_C) +#define nh5ltread_dataset_nint7_c H5_FC_FUNC_(h5ltread_dataset_nint7_c, H5LTREAD_DATASET_NINT7_C) +#define nh5ltread_dataset_nfl1_c H5_FC_FUNC_(h5ltread_dataset_nfl1_c, H5LTREAD_DATASET_NFL1_C) +#define nh5ltread_dataset_nfl2_c H5_FC_FUNC_(h5ltread_dataset_nfl2_c, H5LTREAD_DATASET_NFL2_C) +#define nh5ltread_dataset_nfl3_c H5_FC_FUNC_(h5ltread_dataset_nfl3_c, H5LTREAD_DATASET_NFL3_C) +#define nh5ltread_dataset_nfl4_c H5_FC_FUNC_(h5ltread_dataset_nfl4_c, H5LTREAD_DATASET_NFL4_C) +#define nh5ltread_dataset_nfl5_c H5_FC_FUNC_(h5ltread_dataset_nfl5_c, H5LTREAD_DATASET_NFL5_C) +#define nh5ltread_dataset_nfl6_c H5_FC_FUNC_(h5ltread_dataset_nfl6_c, H5LTREAD_DATASET_NFL6_C) +#define nh5ltread_dataset_nfl7_c H5_FC_FUNC_(h5ltread_dataset_nfl7_c, H5LTREAD_DATASET_NFL7_C) +#define nh5ltread_dataset_ndl1_c H5_FC_FUNC_(h5ltread_dataset_ndl1_c, H5LTREAD_DATASET_NDL1_C) +#define nh5ltread_dataset_ndl2_c H5_FC_FUNC_(h5ltread_dataset_ndl2_c, H5LTREAD_DATASET_NDL2_C) +#define nh5ltread_dataset_ndl3_c H5_FC_FUNC_(h5ltread_dataset_ndl3_c, H5LTREAD_DATASET_NDL3_C) +#define nh5ltread_dataset_ndl4_c H5_FC_FUNC_(h5ltread_dataset_ndl4_c, H5LTREAD_DATASET_NDL4_C) +#define nh5ltread_dataset_ndl5_c H5_FC_FUNC_(h5ltread_dataset_ndl5_c, H5LTREAD_DATASET_NDL5_C) +#define nh5ltread_dataset_ndl6_c H5_FC_FUNC_(h5ltread_dataset_ndl6_c, H5LTREAD_DATASET_NDL6_C) +#define nh5ltread_dataset_ndl7_c H5_FC_FUNC_(h5ltread_dataset_ndl7_c, H5LTREAD_DATASET_NDL7_C) +#define nh5ltmake_dataset_string_c H5_FC_FUNC_(h5ltmake_dataset_string_c, H5LTMAKE_DATASET_STRING_C) +#define nh5ltread_dataset_string_c H5_FC_FUNC_(h5ltread_dataset_string_c, H5LTREAD_DATASET_STRING_C) + +#define nh5ltset_attribute_int_c H5_FC_FUNC_(h5ltset_attribute_int_c, H5LTSET_ATTRIBUTE_INT_C) +#define nh5ltset_attribute_float_c H5_FC_FUNC_(h5ltset_attribute_float_c, H5LTSET_ATTRIBUTE_FLOAT_C) +#define nh5ltset_attribute_double_c H5_FC_FUNC_(h5ltset_attribute_double_c, H5LTSET_ATTRIBUTE_DOUBLE_C) +#define nh5ltset_attribute_string_c H5_FC_FUNC_(h5ltset_attribute_string_c, H5LTSET_ATTRIBUTE_STRING_C) + +#define nh5ltget_attribute_int_c H5_FC_FUNC_(h5ltget_attribute_int_c, H5LTGET_ATTRIBUTE_INT_C) +#define nh5ltget_attribute_float_c H5_FC_FUNC_(h5ltget_attribute_float_c, H5LTGET_ATTRIBUTE_FLOAT_C) +#define nh5ltget_attribute_double_c H5_FC_FUNC_(h5ltget_attribute_double_c, H5LTGET_ATTRIBUTE_DOUBLE_C) +#define nh5ltget_attribute_string_c H5_FC_FUNC_(h5ltget_attribute_string_c, H5LTGET_ATTRIBUTE_STRING_C) + +#define nh5ltget_dataset_ndims_c H5_FC_FUNC_(h5ltget_dataset_ndims_c, H5LTGET_DATASET_NDIMS_C) +#define nh5ltfind_dataset_c H5_FC_FUNC_(h5ltfind_dataset_c, H5LTFIND_DATASET_C) +#define nh5ltget_dataset_info_c H5_FC_FUNC_(h5ltget_dataset_info_c, H5LTGET_DATASET_INFO_C) + +#define nh5ltget_attribute_ndims_c H5_FC_FUNC_(h5ltget_attribute_ndims_c, H5LTGET_ATTRIBUTE_NDIMS_C) +#define nh5ltget_attribute_info_c H5_FC_FUNC_(h5ltget_attribute_info_c, H5LTGET_ATTRIBUTE_INFO_C) +#define nh5ltpath_valid_c H5_FC_FUNC_(h5ltpath_valid_c, H5LTPATH_VALID_C) /*------------------------------------------------------------------------- * Image *------------------------------------------------------------------------- */ -# define nh5immake_image_8bit_c H5_FC_FUNC_(h5immake_image_8bit_c, H5IMMAKE_IMAGE_8BIT_C) -# define nh5immake_image_24bit_c H5_FC_FUNC_(h5immake_image_24bit_c, H5IMMAKE_IMAGE_24BIT_C) -# define nh5imread_image_c H5_FC_FUNC_(h5imread_image_c, H5IMREAD_IMAGE_C) -# define nh5imget_image_info_c H5_FC_FUNC_(h5imget_image_info_c, H5IMGET_IMAGE_INFO_C) -# define nh5imis_image_c H5_FC_FUNC_(h5imis_image_c, H5IMIS_IMAGE_C) -# define nh5immake_palette_c H5_FC_FUNC_(h5immake_palette_c, H5IMMAKE_PALETTE_C) -# define nh5imlink_palette_c H5_FC_FUNC_(h5imlink_palette_c, H5IMLINK_PALETTE_C) -# define nh5imunlink_palette_c H5_FC_FUNC_(h5imunlink_palette_c, H5IMUNLINK_PALETTE_C) -# define nh5imget_npalettes_c H5_FC_FUNC_(h5imget_npalettes_c, H5IMGET_NPALETTES_C) -# define nh5imget_palette_info_c H5_FC_FUNC_(h5imget_palette_info_c, H5IMGET_PALETTE_INFO_C) -# define nh5imget_palette_c H5_FC_FUNC_(h5imget_palette_c, H5IMGET_PALETTE_C) -# define nh5imis_palette_c H5_FC_FUNC_(h5imis_palette_c, H5IMIS_PALETTE_C) +#define nh5immake_image_8bit_c H5_FC_FUNC_(h5immake_image_8bit_c, H5IMMAKE_IMAGE_8BIT_C) +#define nh5immake_image_24bit_c H5_FC_FUNC_(h5immake_image_24bit_c, H5IMMAKE_IMAGE_24BIT_C) +#define nh5imread_image_c H5_FC_FUNC_(h5imread_image_c, H5IMREAD_IMAGE_C) +#define nh5imget_image_info_c H5_FC_FUNC_(h5imget_image_info_c, H5IMGET_IMAGE_INFO_C) +#define nh5imis_image_c H5_FC_FUNC_(h5imis_image_c, H5IMIS_IMAGE_C) +#define nh5immake_palette_c H5_FC_FUNC_(h5immake_palette_c, H5IMMAKE_PALETTE_C) +#define nh5imlink_palette_c H5_FC_FUNC_(h5imlink_palette_c, H5IMLINK_PALETTE_C) +#define nh5imunlink_palette_c H5_FC_FUNC_(h5imunlink_palette_c, H5IMUNLINK_PALETTE_C) +#define nh5imget_npalettes_c H5_FC_FUNC_(h5imget_npalettes_c, H5IMGET_NPALETTES_C) +#define nh5imget_palette_info_c H5_FC_FUNC_(h5imget_palette_info_c, H5IMGET_PALETTE_INFO_C) +#define nh5imget_palette_c H5_FC_FUNC_(h5imget_palette_c, H5IMGET_PALETTE_C) +#define nh5imis_palette_c H5_FC_FUNC_(h5imis_palette_c, H5IMIS_PALETTE_C) /*------------------------------------------------------------------------- * Table *------------------------------------------------------------------------- */ -# define nh5tbmake_table_c H5_FC_FUNC_(h5tbmake_table_c, H5TBMAKE_TABLE_C) -# define nh5tbwrite_field_name_c H5_FC_FUNC_(h5tbwrite_field_name_c, H5TBWRITE_FIELD_NAME_C) -# define nh5tbwrite_field_name_int_c H5_FC_FUNC_(h5tbwrite_field_name_int_c, H5TBWRITE_FIELD_NAME_INT_C) -# define nh5tbwrite_field_name_fl_c H5_FC_FUNC_(h5tbwrite_field_name_fl_c, H5TBWRITE_FIELD_NAME_FL_C) -# define nh5tbwrite_field_name_dl_c H5_FC_FUNC_(h5tbwrite_field_name_dl_c, H5TBWRITE_FIELD_NAME_DL_C) -# define nh5tbwrite_field_name_st_c H5_FC_FUNC_(h5tbwrite_field_name_st_c, H5TBWRITE_FIELD_NAME_ST_C) -# define nh5tbread_field_name_c H5_FC_FUNC_(h5tbread_field_name_c, H5TBREAD_FIELD_NAME_C) -# define nh5tbread_field_name_int_c H5_FC_FUNC_(h5tbread_field_name_int_c, H5TBREAD_FIELD_NAME_INT_C) -# define nh5tbread_field_name_fl_c H5_FC_FUNC_(h5tbread_field_name_fl_c, H5TBREAD_FIELD_NAME_FL_C) -# define nh5tbread_field_name_dl_c H5_FC_FUNC_(h5tbread_field_name_dl_c, H5TBREAD_FIELD_NAME_DL_C) -# define nh5tbread_field_name_st_c H5_FC_FUNC_(h5tbread_field_name_st_c, H5TBREAD_FIELD_NAME_ST_C) -# define nh5tbwrite_field_index_c H5_FC_FUNC_(h5tbwrite_field_index_c, H5TBWRITE_FIELD_INDEX_C) -# define nh5tbwrite_field_index_int_c H5_FC_FUNC_(h5tbwrite_field_index_int_c, H5TBWRITE_FIELD_INDEX_INT_C) -# define nh5tbwrite_field_index_fl_c H5_FC_FUNC_(h5tbwrite_field_index_fl_c, H5TBWRITE_FIELD_INDEX_FL_C) -# define nh5tbwrite_field_index_dl_c H5_FC_FUNC_(h5tbwrite_field_index_dl_c, H5TBWRITE_FIELD_INDEX_DL_C) -# define nh5tbwrite_field_index_st_c H5_FC_FUNC_(h5tbwrite_field_index_st_c, H5TBWRITE_FIELD_INDEX_ST_C) -# define nh5tbread_field_index_c H5_FC_FUNC_(h5tbread_field_index_c, H5TBREAD_FIELD_INDEX_C) -# define nh5tbread_field_index_int_c H5_FC_FUNC_(h5tbread_field_index_int_c, H5TBREAD_FIELD_INDEX_INT_C) -# define nh5tbread_field_index_fl_c H5_FC_FUNC_(h5tbread_field_index_fl_c, H5TBREAD_FIELD_INDEX_FL_C) -# define nh5tbread_field_index_dl_c H5_FC_FUNC_(h5tbread_field_index_dl_c, H5TBREAD_FIELD_INDEX_DL_C) -# define nh5tbread_field_index_st_c H5_FC_FUNC_(h5tbread_field_index_st_c, H5TBREAD_FIELD_INDEX_ST_C) -# define nh5tbinsert_field_c H5_FC_FUNC_(h5tbinsert_field_c, H5TBINSERT_FIELD_C) -# define nh5tbinsert_field_int_c H5_FC_FUNC_(h5tbinsert_field_int_c, H5TBINSERT_FIELD_INT_C) -# define nh5tbinsert_field_fl_c H5_FC_FUNC_(h5tbinsert_field_fl_c, H5TBINSERT_FIELD_FL_C) -# define nh5tbinsert_field_dl_c H5_FC_FUNC_(h5tbinsert_field_dl_c, H5TBINSERT_FIELD_DL_C) -# define nh5tbinsert_field_st_c H5_FC_FUNC_(h5tbinsert_field_st_c, H5TBINSERT_FIELD_ST_C) -# define nh5tbdelete_field_c H5_FC_FUNC_(h5tbdelete_field_c, H5TBDELETE_FIELD_C) -# define nh5tbget_table_info_c H5_FC_FUNC_(h5tbget_table_info_c, H5TBGET_TABLE_INFO_C) -# define nh5tbget_field_info_c H5_FC_FUNC_(h5tbget_field_info_c, H5TBGET_FIELD_INFO_C) +#define nh5tbmake_table_c H5_FC_FUNC_(h5tbmake_table_c, H5TBMAKE_TABLE_C) +#define nh5tbwrite_field_name_c H5_FC_FUNC_(h5tbwrite_field_name_c, H5TBWRITE_FIELD_NAME_C) +#define nh5tbwrite_field_name_int_c H5_FC_FUNC_(h5tbwrite_field_name_int_c, H5TBWRITE_FIELD_NAME_INT_C) +#define nh5tbwrite_field_name_fl_c H5_FC_FUNC_(h5tbwrite_field_name_fl_c, H5TBWRITE_FIELD_NAME_FL_C) +#define nh5tbwrite_field_name_dl_c H5_FC_FUNC_(h5tbwrite_field_name_dl_c, H5TBWRITE_FIELD_NAME_DL_C) +#define nh5tbwrite_field_name_st_c H5_FC_FUNC_(h5tbwrite_field_name_st_c, H5TBWRITE_FIELD_NAME_ST_C) +#define nh5tbread_field_name_c H5_FC_FUNC_(h5tbread_field_name_c, H5TBREAD_FIELD_NAME_C) +#define nh5tbread_field_name_int_c H5_FC_FUNC_(h5tbread_field_name_int_c, H5TBREAD_FIELD_NAME_INT_C) +#define nh5tbread_field_name_fl_c H5_FC_FUNC_(h5tbread_field_name_fl_c, H5TBREAD_FIELD_NAME_FL_C) +#define nh5tbread_field_name_dl_c H5_FC_FUNC_(h5tbread_field_name_dl_c, H5TBREAD_FIELD_NAME_DL_C) +#define nh5tbread_field_name_st_c H5_FC_FUNC_(h5tbread_field_name_st_c, H5TBREAD_FIELD_NAME_ST_C) +#define nh5tbwrite_field_index_c H5_FC_FUNC_(h5tbwrite_field_index_c, H5TBWRITE_FIELD_INDEX_C) +#define nh5tbwrite_field_index_int_c H5_FC_FUNC_(h5tbwrite_field_index_int_c, H5TBWRITE_FIELD_INDEX_INT_C) +#define nh5tbwrite_field_index_fl_c H5_FC_FUNC_(h5tbwrite_field_index_fl_c, H5TBWRITE_FIELD_INDEX_FL_C) +#define nh5tbwrite_field_index_dl_c H5_FC_FUNC_(h5tbwrite_field_index_dl_c, H5TBWRITE_FIELD_INDEX_DL_C) +#define nh5tbwrite_field_index_st_c H5_FC_FUNC_(h5tbwrite_field_index_st_c, H5TBWRITE_FIELD_INDEX_ST_C) +#define nh5tbread_field_index_c H5_FC_FUNC_(h5tbread_field_index_c, H5TBREAD_FIELD_INDEX_C) +#define nh5tbread_field_index_int_c H5_FC_FUNC_(h5tbread_field_index_int_c, H5TBREAD_FIELD_INDEX_INT_C) +#define nh5tbread_field_index_fl_c H5_FC_FUNC_(h5tbread_field_index_fl_c, H5TBREAD_FIELD_INDEX_FL_C) +#define nh5tbread_field_index_dl_c H5_FC_FUNC_(h5tbread_field_index_dl_c, H5TBREAD_FIELD_INDEX_DL_C) +#define nh5tbread_field_index_st_c H5_FC_FUNC_(h5tbread_field_index_st_c, H5TBREAD_FIELD_INDEX_ST_C) +#define nh5tbinsert_field_c H5_FC_FUNC_(h5tbinsert_field_c, H5TBINSERT_FIELD_C) +#define nh5tbinsert_field_int_c H5_FC_FUNC_(h5tbinsert_field_int_c, H5TBINSERT_FIELD_INT_C) +#define nh5tbinsert_field_fl_c H5_FC_FUNC_(h5tbinsert_field_fl_c, H5TBINSERT_FIELD_FL_C) +#define nh5tbinsert_field_dl_c H5_FC_FUNC_(h5tbinsert_field_dl_c, H5TBINSERT_FIELD_DL_C) +#define nh5tbinsert_field_st_c H5_FC_FUNC_(h5tbinsert_field_st_c, H5TBINSERT_FIELD_ST_C) +#define nh5tbdelete_field_c H5_FC_FUNC_(h5tbdelete_field_c, H5TBDELETE_FIELD_C) +#define nh5tbget_table_info_c H5_FC_FUNC_(h5tbget_table_info_c, H5TBGET_TABLE_INFO_C) +#define nh5tbget_field_info_c H5_FC_FUNC_(h5tbget_field_info_c, H5TBGET_FIELD_INFO_C) + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsset_scale_c(hid_t_f *dsid, _fcd dimname, int_f *dimnamelen); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *c_is_attached); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsis_scale_c(hid_t_f *did, int_f *is_scale); + + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, int_f *labellen); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsget_scale_name_c(hid_t_f *did, _fcd label, size_t_f *size); + +HDF5_HL_F90CSTUBDLL +int_f +nh5dsget_num_scales_c( hid_t_f *did, int_f *idx, int_f *num_scales); + HDF5_HL_F90CSTUBDLL int_f @@ -441,36 +498,6 @@ nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, HDF5_HL_F90CSTUBDLL int_f -nh5ltmake_dataset_nint1_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f -nh5ltmake_dataset_nint2_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f -nh5ltmake_dataset_nint3_c (hid_t_f *loc_id, - int_f *namelen, - _fcd name, - int_f *rank, - hsize_t_f *dims, - hid_t_f *type_id, - void *buf); - -HDF5_HL_F90CSTUBDLL -int_f nh5ltmake_dataset_nint4_c (hid_t_f *loc_id, int_f *namelen, _fcd name, @@ -1171,6 +1198,13 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, _fcd name, char *buf); +HDF5_HL_F90CSTUBDLL +int_f +nh5ltpath_valid_c(hid_t_f *loc_id, + _fcd path, + int_f *pathlen, + int_f *check_object_valid_c); + /*------------------------------------------------------------------------- * Image *------------------------------------------------------------------------- diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 484acf1..c0b7695 100755 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -2124,3 +2124,54 @@ done: return ret_value; } + +/*------------------------------------------------------------------------- +* Function: h5ltpath_valid_c +* +* Purpose: Calls h5ltpath_valid +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: February 18, 2012 +* +* Comments: +* +* Modifications: +* +* +*------------------------------------------------------------------------- +*/ + +int_f +nh5ltpath_valid_c(hid_t_f *loc_id, + _fcd path, + int_f *pathlen, + int_f *check_object_valid_c) +{ + htri_t ret = -1; + char *c_path = NULL; + hbool_t check_object_valid; + + /* + * convert FORTRAN name to C name + */ + if( NULL == (c_path = (char *)HD5f2cstring(path, (int)*pathlen))) + goto done; + + check_object_valid = FALSE; + if(*check_object_valid_c == 1) + check_object_valid = TRUE; + + /* + * call H5LTpath_valid function. + */ + ret = H5LTpath_valid( (hid_t)*loc_id, c_path, check_object_valid ); + +done: + if(c_path != NULL) + free(c_path); + + return (int_f)ret; +} diff --git a/hl/fortran/src/H5LTff.f90 b/hl/fortran/src/H5LTff.f90 index cbc9b96..7d53ab7 100755 --- a/hl/fortran/src/H5LTff.f90 +++ b/hl/fortran/src/H5LTff.f90 @@ -6308,6 +6308,73 @@ CONTAINS errcode = h5ltget_attribute_info_c(loc_id,namelen,dset_name,attrlen,attr_name,dims,type_class,type_size) END SUBROUTINE h5ltget_attribute_info_f + + !------------------------------------------------------------------------- + ! Function: h5ltpath_valid_f + ! + ! Purpose: Validates a path + ! + ! Return: Success: 0, Failure: -1 + ! + ! Programmer: M. Scot Breitenfeld + ! + ! Date: February 18, 2012 + ! + ! Comments: + ! + ! Modifications: + ! + !------------------------------------------------------------------------- + + SUBROUTINE h5ltpath_valid_f(loc_id, path, check_object_valid, path_valid, errcode) + + IMPLICIT NONE + ! + !This definition is needed for Windows DLLs + !DEC$if defined(BUILD_HDF5_DLL) + !DEC$attributes dllexport :: h5ltpath_valid_f + !DEC$endif + ! + INTEGER(hid_t) , INTENT(IN) :: loc_id ! File or group identifier. + CHARACTER(LEN=*), INTENT(IN) :: path ! Path to the object to check, relative to loc_id. + LOGICAL , INTENT(IN) :: check_object_valid ! Indicates whether to check if the final component + ! of the path resolves to a valid object + LOGICAL , INTENT(OUT) :: path_valid ! Object status + INTEGER , INTENT(OUT) :: errcode ! Error code: 0 on success and -1 on failure + + INTEGER :: pathlen + INTEGER :: check_object_valid_c + INTEGER :: status + + INTERFACE + INTEGER FUNCTION h5ltpath_valid_c(loc_id, path, pathlen, check_object_valid_c) + USE h5global + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5LTPATH_VALID_C'::h5ltpath_valid_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: path + INTEGER(hid_t), INTENT(in) :: loc_id + CHARACTER(len=*), INTENT(in) :: path + INTEGER :: pathlen + INTEGER :: check_object_valid_c + END FUNCTION h5ltpath_valid_c + END INTERFACE + + check_object_valid_c = 0 + IF(check_object_valid) check_object_valid_c = 1 + + pathlen = LEN(path) + status = h5ltpath_valid_c(loc_id, path, pathlen, check_object_valid_c) + + path_valid = .FALSE. + errcode = 0 + IF(status.EQ.1)THEN + path_valid = .TRUE. + ELSE IF(status.LT.0)THEN + errcode = -1 + ENDIF + + END SUBROUTINE h5ltpath_valid_f ! end ! END MODULE H5LT diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index f872a63..9835196 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -46,8 +46,8 @@ endif #endif # List sources to include in the HDF5 HL Fortran library. -libhdf5hl_fortran_la_SOURCES=H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c H5LTff.f90 \ - H5IMff.f90 H5TBff.f90 +libhdf5hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ + H5DSff.f90 H5LTff.f90 H5IMff.f90 H5TBff.f90 # HDF5 HL Fortran library depends on HDF5 HL Library and HDF5 Fortran Library. libhdf5hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F) @@ -79,6 +79,7 @@ uninstall-local: # determining this automagically (like we do with the C files). So, when # doing a parallel make, some modules could be made way before the # modules they depend upon are actually made. *sigh* +H5DSff.lo: $(srcdir)/H5DSff.f90 H5LTff.lo: $(srcdir)/H5LTff.f90 H5IMff.lo: $(srcdir)/H5IMff.f90 H5TBff.lo: $(srcdir)/H5TBff.f90 diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 0c86820..4056a1b 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -94,8 +94,8 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5hl_fortran_la_DEPENDENCIES = $(LIBH5_HL) $(LIBH5F) -am_libhdf5hl_fortran_la_OBJECTS = H5LTfc.lo H5IMfc.lo H5IMcc.lo \ - H5TBfc.lo H5LTff.lo H5IMff.lo H5TBff.lo +am_libhdf5hl_fortran_la_OBJECTS = H5DSfc.lo H5LTfc.lo H5IMfc.lo \ + H5IMcc.lo H5TBfc.lo H5DSff.lo H5LTff.lo H5IMff.lo H5TBff.lo libhdf5hl_fortran_la_OBJECTS = $(am_libhdf5hl_fortran_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -216,6 +216,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -236,10 +237,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ @@ -433,7 +436,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 = 71 +LT_VERS_REVISION = 101 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src @@ -451,8 +454,8 @@ libhdf5hl_fortran_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVI #endif # List sources to include in the HDF5 HL Fortran library. -libhdf5hl_fortran_la_SOURCES = H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c H5LTff.f90 \ - H5IMff.f90 H5TBff.f90 +libhdf5hl_fortran_la_SOURCES = H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ + H5DSff.f90 H5LTff.f90 H5IMff.f90 H5TBff.f90 # HDF5 HL Fortran library depends on HDF5 HL Library and HDF5 Fortran Library. @@ -547,6 +550,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DSfc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IMcc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IMfc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LTfc.Plo@am__quote@ @@ -851,6 +855,7 @@ uninstall-local: # determining this automagically (like we do with the C files). So, when # doing a parallel make, some modules could be made way before the # modules they depend upon are actually made. *sigh* +H5DSff.lo: $(srcdir)/H5DSff.f90 H5LTff.lo: $(srcdir)/H5LTff.f90 H5IMff.lo: $(srcdir)/H5IMff.f90 H5TBff.lo: $(srcdir)/H5TBff.f90 diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 0a91b85..c9b0533 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- @@ -20,12 +20,23 @@ ADD_TEST ( f1tab.h5 ) +#-- Adding test for hl_f90_tstds +ADD_EXECUTABLE (hl_f90_tstds tstds.f90) +TARGET_NAMING (hl_f90_tstds ${LIB_TYPE}) +TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tstds "") +TARGET_LINK_LIBRARIES (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +SET_TARGET_PROPERTIES (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) +SET_TARGET_PROPERTIES (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) + +ADD_TEST (NAME hl_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) + #-- Adding test for hl_f90_tstlite ADD_EXECUTABLE (hl_f90_tstlite tstlite.f90) TARGET_NAMING (hl_f90_tstlite ${LIB_TYPE}) TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tstlite "") TARGET_LINK_LIBRARIES (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) +SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) @@ -35,6 +46,7 @@ TARGET_NAMING (hl_f90_tstimage ${LIB_TYPE}) TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tstimage "") TARGET_LINK_LIBRARIES (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) +SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) @@ -44,5 +56,6 @@ TARGET_NAMING (hl_f90_tsttable ${LIB_TYPE}) TARGET_FORTRAN_WIN_PROPERTIES (hl_f90_tsttable "") TARGET_LINK_LIBRARIES (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) +SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am index 7f149c8..cd281b7 100644 --- a/hl/fortran/test/Makefile.am +++ b/hl/fortran/test/Makefile.am @@ -33,18 +33,19 @@ else endif # Our main target, the test programs -TEST_PROG=tstlite tstimage tsttable +TEST_PROG=tstds tstlite tstimage tsttable check_PROGRAMS=$(TEST_PROG) LDADD= $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5) # Source files for the programs +tstds_SOURCES=tstds.f90 tstlite_SOURCES=tstlite.f90 tstimage_SOURCES=tstimage.f90 tsttable_SOURCES=tsttable.f90 # Temporary files. -CHECK_CLEANFILES+=dsetf[1-4].h5 f1img.h5 f1tab.h5 +CHECK_CLEANFILES+=dsetf[1-4].h5 f1img.h5 f1tab.h5 tstds.h5 # Mark this directory as part of the Fortran API (this affects output # from tests in conclude.am) diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index 16e8b14..707a32d 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -69,14 +69,19 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__EXEEXT_1 = tstlite$(EXEEXT) tstimage$(EXEEXT) tsttable$(EXEEXT) +am__EXEEXT_1 = tstds$(EXEEXT) tstlite$(EXEEXT) tstimage$(EXEEXT) \ + tsttable$(EXEEXT) +am_tstds_OBJECTS = tstds.$(OBJEXT) +tstds_OBJECTS = $(am_tstds_OBJECTS) +tstds_LDADD = $(LDADD) +tstds_DEPENDENCIES = $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent am_tstimage_OBJECTS = tstimage.$(OBJEXT) tstimage_OBJECTS = $(am_tstimage_OBJECTS) tstimage_LDADD = $(LDADD) tstimage_DEPENDENCIES = $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -am__v_lt_0 = --silent am_tstlite_OBJECTS = tstlite.$(OBJEXT) tstlite_OBJECTS = $(am_tstlite_OBJECTS) tstlite_LDADD = $(LDADD) @@ -105,8 +110,9 @@ am__v_FCLD_0 = @echo " FCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(tstimage_SOURCES) $(tstlite_SOURCES) $(tsttable_SOURCES) -DIST_SOURCES = $(tstimage_SOURCES) $(tstlite_SOURCES) \ +SOURCES = $(tstds_SOURCES) $(tstimage_SOURCES) $(tstlite_SOURCES) \ + $(tsttable_SOURCES) +DIST_SOURCES = $(tstds_SOURCES) $(tstimage_SOURCES) $(tstlite_SOURCES) \ $(tsttable_SOURCES) ETAGS = etags CTAGS = ctags @@ -182,6 +188,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -202,10 +209,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ @@ -397,13 +406,14 @@ TRACE = perl $(top_srcdir)/bin/trace # Temporary files. CHECK_CLEANFILES = *.chkexe *.chklog *.clog dsetf[1-4].h5 f1img.h5 \ - f1tab.h5 + f1tab.h5 tstds.h5 # Our main target, the test programs -TEST_PROG = tstlite tstimage tsttable +TEST_PROG = tstds tstlite tstimage tsttable LDADD = $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5) # Source files for the programs +tstds_SOURCES = tstds.f90 tstlite_SOURCES = tstlite.f90 tstimage_SOURCES = tstimage.f90 tsttable_SOURCES = tsttable.f90 @@ -470,6 +480,9 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list +tstds$(EXEEXT): $(tstds_OBJECTS) $(tstds_DEPENDENCIES) + @rm -f tstds$(EXEEXT) + $(AM_V_FCLD)$(FCLINK) $(tstds_OBJECTS) $(tstds_LDADD) $(LIBS) tstimage$(EXEEXT): $(tstimage_OBJECTS) $(tstimage_DEPENDENCIES) @rm -f tstimage$(EXEEXT) $(AM_V_FCLD)$(FCLINK) $(tstimage_OBJECTS) $(tstimage_LDADD) $(LIBS) diff --git a/hl/fortran/test/tstds.f90 b/hl/fortran/test/tstds.f90 new file mode 100644 index 0000000..8817989 --- /dev/null +++ b/hl/fortran/test/tstds.f90 @@ -0,0 +1,347 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * Copyright by The HDF Group. * +! * Copyright by the Board of Trustees of the University of Illinois. * +! * All rights reserved. * +! * * +! * This file is part of HDF5. The full HDF5 copyright notice, including * +! * terms governing use, modification, and redistribution, is contained in * +! * the files COPYING and Copyright.html. COPYING can be found at the root * +! * of the source code distribution tree; Copyright.html can be found at the * +! * root level of an installed copy of the electronic HDF5 document set and * +! * is linked from the top-level documents page. It can also be found at * +! * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! * access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +PROGRAM test_ds + + IMPLICIT NONE + + INTEGER :: err + + CALL test_testds(err) + + IF(err.LT.0)THEN + WRITE(*,'(5X,A)') "DIMENSION SCALES TEST *FAILED*" + ENDIF + +END PROGRAM test_ds + +SUBROUTINE test_testds(err) + + USE HDF5 + USE H5LT + USE H5DS + + IMPLICIT NONE + + INTEGER, PARAMETER :: RANK = 2 ! rank of DATA dataset + INTEGER, PARAMETER :: DIM_DATA = 12 + INTEGER, PARAMETER :: DIM1_SIZE = 3 + INTEGER, PARAMETER :: DIM2_SIZE = 4 + INTEGER, PARAMETER :: DIM1 = 1 + INTEGER, PARAMETER :: DIM2 = 2 + INTEGER, PARAMETER :: FAILED = -1 + + CHARACTER(LEN=6), PARAMETER :: DSET_NAME = "Mydata" + CHARACTER(LEN=5), PARAMETER :: DS_1_NAME = "Yaxis" + CHARACTER(LEN=5), PARAMETER :: DS_1_NAME_A = "Yaxiz" + CHARACTER(LEN=5), PARAMETER :: DS_2_NAME = "Xaxis" + + + INTEGER(hid_t) :: fid ! file ID + INTEGER(hid_t) :: did ! dataset ID + INTEGER(hid_t) :: dsid ! DS dataset ID + INTEGER :: rankds = 1 ! rank of DS dataset + INTEGER(hsize_t), DIMENSION(1:rank) :: dims = (/DIM2_SIZE,DIM1_SIZE/) ! size of DATA dataset + INTEGER, DIMENSION(1:DIM_DATA) :: buf = (/1,2,3,4,5,6,7,8,9,10,11,12/) ! DATA of DATA dataset + INTEGER(hsize_t), DIMENSION(1:1) :: s1_dim = (/DIM1_SIZE/) ! size of DS 1 dataset + INTEGER(hsize_t), DIMENSION(1:1) :: s2_dim = (/DIM2_SIZE/) ! size of DS 2 dataset + REAL, DIMENSION(1:DIM1_SIZE) :: s1_wbuf = (/10,20,30/) ! DATA of DS 1 dataset + INTEGER, DIMENSION(1:DIM2_SIZE) :: s2_wbuf = (/10,20,50,100/) ! DATA of DS 2 dataset + INTEGER :: err + INTEGER :: num_scales + INTEGER(size_t) :: name_len + CHARACTER(LEN=80) :: name + INTEGER(size_t) :: label_len + CHARACTER(LEN=80) :: label + LOGICAL :: is_attached, is_scale + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5open_f(err) + IF(err.LT.0) RETURN + + ! create a file using default properties + CALL H5Fcreate_f("tstds.h5",H5F_ACC_TRUNC_F, fid, err) + IF(err.LT.0) RETURN + + ! make a dataset + CALL H5LTmake_dataset_int_f(fid,DSET_NAME,rank,dims,buf, err) + IF(err.LT.0) RETURN + + ! make a DS dataset for the first dimension + CALL H5LTmake_dataset_float_f(fid,DS_1_NAME,rankds,s1_dim,s1_wbuf,err) + IF(err.LT.0) RETURN + + ! make a DS dataset for the second dimension + CALL H5LTmake_dataset_int_f(fid,DS_2_NAME,rankds,s2_dim,s2_wbuf,err) + IF(err.LT.0) RETURN + + !------------------------------------------------------------------------- + ! attach the DS_1_NAME dimension scale to DSET_NAME at dimension 1 + !------------------------------------------------------------------------- + + CALL test_begin(' Test Attaching Dimension Scale ') + + ! get the dataset id for DSET_NAME + CALL H5Dopen_f(fid, DSET_NAME, did, err) + IF(err.LT.0) RETURN + + ! get the DS dataset id + CALL H5Dopen_f(fid, DS_1_NAME, dsid, err) + IF(err.LT.0) RETURN + + ! check attaching to a non-existent dimension; should fail + CALL H5DSattach_scale_f(did, dsid, 20, err) + IF(err.NE.-1) THEN + err = FAILED ! should fail, mark as an error + CALL write_test_status(err) + RETURN + ENDIF + + ! attach the DS_1_NAME dimension scale to DSET_NAME at dimension index 1 + CALL H5DSattach_scale_f(did, dsid, DIM1, err) + IF(err.EQ.-1) THEN + CALL write_test_status(err) + RETURN + ENDIF + CALL write_test_status(err) + + CALL test_begin(' Test If Dimension Scale Attached ') + + CALL H5DSis_attached_f(did, dsid, DIM1, is_attached, err) + IF(err.EQ.-1.OR..NOT.is_attached) THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + CALL write_test_status(err) + + ! Check to see how many Dimension Scales are attached + + CALL test_begin(' Test Getting Number Dimension Scales ') + + CALL H5DSget_num_scales_f(did, DIM1, num_scales, err) + IF(err.LT.0.OR.num_scales.NE.1)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + CALL write_test_status(err) + + CALL test_begin(' Test Detaching Dimension Scale ') + + ! Detach scale + CALL H5DSdetach_scale_f(did, dsid, DIM1, err) + IF(err.LT.0) RETURN + + ! Check to see if a dimension scale is attached, should be .false. + CALL H5DSis_attached_f(did, dsid, DIM1, is_attached, err) + IF(err.LT.0.OR.is_attached)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + CALL write_test_status(err) + + !------------------------------------------------------------------------- + ! set the DS_1_NAME dimension scale to DSET_NAME at dimension 0 + !------------------------------------------------------------------------- + + CALL test_begin(' Test Setting Dimension Scale ') + + CALL H5DSset_scale_f(dsid, err, "Dimension Scale Set 1") + IF(err.LT.0.OR.is_attached)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + CALL write_test_status(err) + + CALL test_begin(' Test If Dimension Scale ') + + CALL H5DSis_scale_f(dsid, is_scale, err) + IF(err.LT.0.OR..NOT.is_scale)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + CALL write_test_status(err) + + ! Get scale name; test to large character buffer + + CALL test_begin(' Test Getting Dimension Scale By Name ') + + name_len = 25 + name = '' + CALL H5DSget_scale_name_f(dsid, name, name_len, err) + IF(err.LT.0.OR.name_len.NE.21.OR.TRIM(name).NE."Dimension Scale Set 1")THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + + ! Get scale name; test exact size character buffer + name_len = 21 + name = '' + CALL H5DSget_scale_name_f(dsid, name(1:name_len), name_len, err) + IF(err.LT.0.OR.name_len.NE.21.OR.TRIM(name).NE."Dimension Scale Set 1")THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + + ! Get scale name; test to small character buffer + name_len = 5 + name = '' + CALL H5DSget_scale_name_f(dsid, name(1:name_len), name_len, err) + IF(err.LT.0.OR.name_len.NE.21.OR.TRIM(name).NE."Dimen")THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + + ! close DS id + CALL H5Dclose_f(dsid, err) + IF(err.LT.0) RETURN + + !------------------------------------------------------------------------- + ! attach the DS_2_NAME dimension scale to DSET_NAME + !------------------------------------------------------------------------- + + ! get the DS dataset id + CALL H5Dopen_f(fid, DS_2_NAME, dsid, err) + IF(err.LT.0) RETURN + + ! attach the DS_2_NAME dimension scale to DSET_NAME as the 2nd dimension (index 2) + CALL H5DSattach_scale_f(did, dsid, DIM2, err) + IF(err.LT.0) RETURN + + CALL H5DSis_attached_f(did, dsid, DIM2, is_attached, err) + IF(err.LT.0) RETURN + + ! test sending no Dimension Scale name + + CALL H5DSset_scale_f(dsid, err) + IF(err.LT.0)THEN + CALL write_test_status(err) + RETURN + ENDIF + + CALL H5DSis_scale_f(dsid, is_scale, err) + IF(err.LT.0.OR..NOT.is_scale)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + + ! Get scale name when there is no scale name + name_len = 5 + name = '' + CALL H5DSget_scale_name_f(dsid, name(1:name_len), name_len, err) + IF(err.LT.0.OR.name_len.NE.0)THEN ! name_len is 0 if no name is found + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + + CALL write_test_status(err) + + CALL test_begin(' Test Setting Dimension Scale Label ') + + CALL H5DSset_label_f(did, DIM2, "Label12", err) + IF(err.LT.0)THEN + CALL write_test_status(err) + RETURN + ENDIF + + ! Test label where character length is to small + + label_len = 5 + label = '' + CALL H5DSget_label_f(did, DIM2, label(1:label_len), label_len, err) + IF(err.LT.0.OR.label(1:5).NE."Label".OR.label_len.NE.7)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + + ! Test label where character length is exact + + label_len = 7 + label = '' + CALL H5DSget_label_f(did, DIM2, label(1:label_len), label_len, err) + IF(err.LT.0.OR.label(1:label_len).NE."Label12".OR.label_len.NE.7)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + + ! Test label where character length is to big + + label_len = 25 + label = '' + CALL H5DSget_label_f(did, DIM2, label, label_len, err) + IF(err.LT.0.OR.label(1:label_len).NE."Label12".OR.label_len.NE.7)THEN + err = FAILED + CALL write_test_status(err) + RETURN + ENDIF + CALL write_test_status(err) + + ! close DS id + CALL H5Dclose_f(dsid, err) + IF(err.LT.0) RETURN + + ! close file + CALL H5Fclose_f(fid, err) + IF(err.LT.0) RETURN + +END SUBROUTINE test_testds + +!------------------------------------------------------------------------- +! test_begin +!------------------------------------------------------------------------- + +SUBROUTINE test_begin(string) + CHARACTER(LEN=*), INTENT(IN) :: string + WRITE(*, fmt = '(A)', advance = 'no') ADJUSTL(string) +END SUBROUTINE test_begin + +!------------------------------------------------------------------------- +! passed/failed +!------------------------------------------------------------------------- +SUBROUTINE write_test_status( test_result) + +! Writes the results of the tests + + IMPLICIT NONE + + INTEGER, INTENT(IN) :: test_result ! negative, failed + ! 0 , passed + +! Controls the output style for reporting test results + + CHARACTER(LEN=8) :: error_string + CHARACTER(LEN=8), PARAMETER :: success = ' PASSED ' + CHARACTER(LEN=8), PARAMETER :: failure = '*FAILED*' + + error_string = failure + IF (test_result .EQ. 0) THEN + error_string = success + ENDIF + + WRITE(*, fmt = '(T34, A)') error_string + +END SUBROUTINE write_test_status diff --git a/hl/fortran/test/tstlite.f90 b/hl/fortran/test/tstlite.f90 index b0e28f9..9329dba 100644 --- a/hl/fortran/test/tstlite.f90 +++ b/hl/fortran/test/tstlite.f90 @@ -1067,6 +1067,9 @@ SUBROUTINE test_datasets() INTEGER :: has ! general purpose integer INTEGER :: type_class INTEGER(SIZE_T) :: type_size + LOGICAL :: path_valid ! status of the path + CHARACTER(LEN=6) :: chr_exact + CHARACTER(LEN=8) :: chr_lg ! ! Initialize FORTRAN predefined datatypes. @@ -1118,6 +1121,7 @@ SUBROUTINE test_datasets() CALL passed() + !------------------------------------------------------------------------- ! real !------------------------------------------------------------------------- @@ -1207,9 +1211,60 @@ SUBROUTINE test_datasets() CALL passed() + CALL test_begin(' Test h5ltpath_valid_f ') + ! + ! test function h5ltpath_valid_f + ! + chr_exact = "/"//dsetname2 ! test character buffer the exact size needed + CALL h5ltpath_valid_f(file_id, chr_exact, .TRUE., path_valid, errcode) + IF(errcode.LT.0.OR..NOT.path_valid)THEN + PRINT *, 'error in h5ltpath_valid_f' + STOP + ENDIF + chr_lg = "/"//dsetname2 ! test character buffer larger then needed + CALL h5ltpath_valid_f(file_id, chr_lg, .TRUE., path_valid, errcode) + IF(errcode.LT.0.OR..NOT.path_valid)THEN + PRINT *, 'error in h5ltpath_valid_f' + STOP + ENDIF + CALL h5ltpath_valid_f(file_id, chr_lg, .FALSE., path_valid, errcode) + IF(errcode.LT.0.OR..NOT.path_valid)THEN + PRINT *, 'error in h5ltpath_valid_f' + STOP + ENDIF + ! Should fail, dataset does not exist + CALL h5ltpath_valid_f(file_id, "/"//dsetname2//"junk", .TRUE., path_valid, errcode) + IF(errcode.LT.0.OR.path_valid)THEN + PRINT *, 'error in h5ltpath_valid_f' + STOP + ENDIF + + CALL h5ltpath_valid_f(file_id, "/"//dsetname2//"junk", .FALSE., path_valid, errcode) + IF(errcode.LT.0.OR.path_valid)THEN + PRINT *, 'error in h5ltpath_valid_f' + STOP + ENDIF + + ! Create a dangling soft link + CALL h5lcreate_soft_f("/G2", file_id, "/G3", errcode) + + ! Should pass, does not check for dangled link + CALL h5ltpath_valid_f(file_id, "/G3", .FALSE., path_valid, errcode) + IF(.NOT.path_valid)THEN + PRINT *, 'error in h5ltpath_valid_f' + STOP + ENDIF + + ! Should fail, dangled link + CALL h5ltpath_valid_f(file_id, "/G2", .TRUE., path_valid, errcode) + IF(path_valid)THEN + PRINT *, 'error in h5ltpath_valid_f' + STOP + ENDIF + CALL passed() CALL test_begin(' Get dataset dimensions/info ') @@ -1296,6 +1351,8 @@ SUBROUTINE test_attributes() CHARACTER(LEN=5), PARAMETER :: attrname5 = "attr5" ! Attribute name CHARACTER(LEN=8), PARAMETER :: buf1 = "mystring" ! Data buffer CHARACTER(LEN=8) :: bufr1 ! Data buffer + CHARACTER(LEN=10) :: bufr1_lg ! Data buffer + CHARACTER(LEN=6) :: bufr1_sm ! Data buffer INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer REAL, DIMENSION(DIM1) :: buf3 ! Data buffer @@ -1446,20 +1503,46 @@ SUBROUTINE test_attributes() CALL h5ltset_attribute_string_f(file_id,dsetname1,attrname5,buf1,errcode) ! - ! read attribute. + ! read attribute into a fortran character buf that is the same size as buf1. ! CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1,errcode) ! ! compare read and write buffers. ! - IF ( buf1 .NE. bufr1 ) THEN PRINT *, 'read buffer differs from write buffer' PRINT *, buf1, ' and ', bufr1 STOP ENDIF + ! + ! read attribute into a fortran character buf that is larger then buf1. + ! + CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1_lg,errcode) + + ! + ! compare read and write buffers, make sure C NULL character was removed. + ! + IF ( buf1(1:8) .NE. bufr1_lg(1:8) .AND. bufr1_lg(9:10) .NE. ' ' ) THEN + PRINT *, 'larger read buffer differs from write buffer' + PRINT *, buf1, ' and ', bufr1_lg + STOP + ENDIF + + ! + ! read attribute into a fortran character buf that is smaller then buf1. + ! + CALL h5ltget_attribute_string_f(file_id,dsetname1,attrname5,bufr1_sm,errcode) + + ! + ! compare read and write buffers. + ! + IF ( buf1(1:6) .NE. bufr1_sm(1:6) ) THEN + PRINT *, 'smaller read buffer differs from write buffer' + PRINT *, buf1, ' and ', bufr1_sm + STOP + ENDIF CALL passed() diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 11f6273..f144b94 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_SRC) #----------------------------------------------------------------------------- @@ -34,10 +34,10 @@ SET (HL_HEADERS ) ADD_LIBRARY (${HDF5_HL_LIB_TARGET} ${LIB_TYPE} ${HL_SRCS} ${HL_HEADERS}) -SET_TARGET_PROPERTIES(${HDF5_HL_LIB_TARGET} PROPERTIES DEFINE_SYMBOL ${HDF5_HL_LIB_CORENAME}_EXPORTS) TARGET_LINK_LIBRARIES (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} ${LIB_TYPE}) +SET_TARGET_PROPERTIES (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) #----------------------------------------------------------------------------- # Add file(s) to CMake Install diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 432a725..e9ea9cf 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -318,7 +318,7 @@ herr_t H5DSattach_scale(hid_t did, ref_j = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j)) < 0) + if((dsid_j = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref_j)) < 0) goto out; /* get info for DS in the parameter list */ @@ -690,7 +690,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[j]; /* get the DS id */ - if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for this DS */ @@ -800,7 +800,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = dsbuf[ii].ref; /* get the dataset id */ - if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for this dataset */ @@ -813,10 +813,8 @@ herr_t H5DSdetach_scale(hid_t did, /* same object, reset. we want to detach only for this DIM */ if(did_oi.fileno == tmp_oi.fileno && did_oi.addr == tmp_oi.addr) { - /* if we found not the last one, copy the last one to replace - the one which is found */ - if(i < nelmts-1) - dsbuf[ii] = dsbuf[nelmts-1]; + /* copy the last one to replace the one which is found */ + dsbuf[ii] = dsbuf[nelmts-1]; nelmts--; found_dset=1; break; @@ -1050,7 +1048,7 @@ htri_t H5DSis_attached(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for DS in the parameter list */ @@ -1140,7 +1138,7 @@ htri_t H5DSis_attached(hid_t did, if (ref) { /* get the dataset id */ - if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for dataset in the parameter list */ @@ -1344,7 +1342,7 @@ herr_t H5DSiterate_scales(hid_t did, /* disable error reporting, the ID might refer to a deleted dataset */ H5E_BEGIN_TRY { /* get the DS id */ - if ((scale_id = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) + if ((scale_id = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; } H5E_END_TRY; @@ -1619,6 +1617,8 @@ out: * Comments: * * Modifications: +* JIRA HDFFV-7673: Added a check to see if the label name exists, +* if not then returns zero. July 30, 2011. MSB * *------------------------------------------------------------------------- */ @@ -1631,7 +1631,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) int rank; /* rank of dataset */ char **buf = NULL; /* buffer to store in the attribute */ H5I_type_t it; /* ID type */ - size_t nbytes; + size_t nbytes = 0; size_t copy_len; int i; @@ -1687,6 +1687,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0) goto out; + if ((tid = H5Aget_type(aid)) < 0) goto out; @@ -1700,26 +1701,30 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) if (H5Aread(aid, tid, buf) < 0) goto out; - /* get the real string length */ - nbytes = strlen(buf[idx]); + /* do only if the label name exists for the dimension */ + if (buf[idx] != NULL) + { + /* get the real string length */ + nbytes = strlen(buf[idx]); - /* compute the string length which will fit into the user's buffer */ - copy_len = MIN(size-1, nbytes); + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(size-1, nbytes); - /* copy all/some of the name */ - if (label) - { - memcpy(label, buf[idx], copy_len); + /* copy all/some of the name */ + if (label) + { + memcpy(label, buf[idx], copy_len); + + /* terminate the string */ + label[copy_len] = '\0'; + } - /* terminate the string */ - label[copy_len] = '\0'; } - /* free all the ptr's from the H5Aread() */ for (i = 0; i < rank; i++) { if (buf[i]) - free(buf[i]); + free(buf[i]); } /* close */ diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 11f4014..93d2b3f 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -905,7 +905,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, goto out; /* Get the actual palette */ - if ( (pal_id = H5Rdereference( did, H5R_OBJECT, &refbuf[pal_number] )) < 0) + if ( (pal_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0) goto out; if ( (pal_space_id = H5Dget_space( pal_id )) < 0) @@ -1016,7 +1016,7 @@ herr_t H5IMget_palette( hid_t loc_id, goto out; /* Get the palette id */ - if ( (pal_id = H5Rdereference( did, H5R_OBJECT, &refbuf[pal_number] )) < 0) + if ( (pal_id = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &refbuf[pal_number])) < 0) goto out; /* Read the palette dataset */ diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 22bb97f..eeaceeb 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -18,16 +18,17 @@ #include <assert.h> #include <stdio.h> #include "H5LTprivate.h" - +#include "H5private.h" /* For Lex and Yacc */ #define COL 3 #define LIMIT 512 #define INCREMENT 1024 +#define TMP_LEN 256 #define MAX(a,b) (((a)>(b)) ? (a) : (b)) int input_len; char *myinput; -int indent = 0; +size_t indent = 0; @@ -1572,9 +1573,6 @@ out: } - - - /*------------------------------------------------------------------------- * Function: H5LTtext_to_dtype * @@ -1621,6 +1619,47 @@ out: } /*------------------------------------------------------------------------- +* Function: realloc_and_append +* +* Purpose: Expand the buffer and append a string to it. +* +* Return: void +* +* Programmer: Raymond Lu, songyulu@hdfgroup.org +* +* Date: 29 September 2011 +* +* Modifications: +* +*------------------------------------------------------------------------- +*/ +static char* +realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add) +{ + if(_no_user_buf) { + /* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */ + if(str_to_add && ((ssize_t)(*len - (strlen(buf) + strlen(str_to_add) + 1)) < LIMIT)) { + *len += ((strlen(buf) + strlen(str_to_add) + 1) / INCREMENT + 1) * INCREMENT; + buf = (char*)realloc(buf, *len); + } else if(!str_to_add && ((ssize_t)(*len - strlen(buf) - 1) < LIMIT)) { + *len += INCREMENT; + buf = (char*)realloc(buf, *len); + } + } + + if(!buf) + goto out; + + if(str_to_add) + strcat(buf, str_to_add); + + return buf; + +out: + return NULL; +} + +/*------------------------------------------------------------------------- * Function: indentation * * Purpose: Print spaces for indentation @@ -1635,16 +1674,24 @@ out: * *------------------------------------------------------------------------- */ -static void -indentation(int x, char* str) +static char* +indentation(size_t x, char* str, hbool_t no_u_buf, size_t *s_len) { + char tmp_str[TMP_LEN]; + if (x < 80) { - while (x-- > 0) - strcat(str, " "); - } else { - strcat(str, "error: the indentation exceeds the number of cols."); - exit(1); - } + memset(tmp_str, ' ', x); + tmp_str[x]='\0'; + } else + HDsnprintf(tmp_str, TMP_LEN, "error: the indentation exceeds the number of cols."); + + if(!(str = realloc_and_append(no_u_buf, s_len, str, tmp_str))) + goto out; + + return str; + +out: + return NULL; } /*------------------------------------------------------------------------- @@ -1659,21 +1706,20 @@ indentation(int x, char* str) * Modifications: * *-----------------------------------------------------------------------*/ -static herr_t -print_enum(hid_t type, char* str, int indt) +static char* +print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) { char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ unsigned char *copy = NULL; /*a pointer to value array */ int nmembs; /*number of members */ - char tmp_str[256]; + char tmp_str[TMP_LEN]; int nchars; /*number of output characters */ hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer data type */ size_t super_size; /*enum base type size */ size_t dst_size; /*destination value type size */ int i; - herr_t ret = SUCCEED; if((nmembs = H5Tget_nmembers(type))==0) goto out; @@ -1718,27 +1764,28 @@ print_enum(hid_t type, char* str, int indt) /* Print members */ for (i = 0; i < nmembs; i++) { - indentation(indt + COL, str); - nchars = sprintf(tmp_str, "\"%s\"", name[i]); - strcat(str, tmp_str); - sprintf(tmp_str, "%*s ", MAX(0, 16 - nchars), ""); - strcat(str, tmp_str); - - if (H5T_SGN_NONE == H5Tget_sign(native)) { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value+i*dst_size; - sprintf(tmp_str,"%u", *((unsigned int*)((void *)copy))); - strcat(str, tmp_str); - } else { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value+i*dst_size; - sprintf(tmp_str,"%d", *((int*)((void *)copy))); - strcat(str, tmp_str); - } + if(!(str = indentation(indt + COL, str, no_ubuf, str_len))) + goto out; + nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); + if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "%*s ", MAX(0, 16 - nchars), ""); + if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; + + /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" + *strangely, unless use another pointer "copy".*/ + copy = value+i*dst_size; + if (H5T_SGN_NONE == H5Tget_sign(native)) + HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy))); + else + HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy))); + if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; - strcat(str, ";\n"); + HDsnprintf(tmp_str, TMP_LEN, ";\n"); + if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; } /* Release resources */ @@ -1749,13 +1796,13 @@ print_enum(hid_t type, char* str, int indt) free(value); H5Tclose(super); - return ret; + return str; out: if(0 == nmembs) { - sprintf(tmp_str, "\n%*s <empty>", indt + 4, ""); - strcat(str, tmp_str); + HDsnprintf(tmp_str, TMP_LEN, "\n%*s <empty>", indt + 4, ""); + str = realloc_and_append(no_ubuf, str_len, str, tmp_str); } /* end if */ /* Release resources */ @@ -1772,7 +1819,7 @@ out: if(super >= 0) H5Tclose(super); - return FAIL; + return NULL; } /*------------------------------------------------------------------------- @@ -1796,7 +1843,7 @@ herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t * { size_t str_len = INCREMENT; char *text_str; - herr_t ret = -1; + herr_t ret = SUCCEED; if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) goto out; @@ -1804,12 +1851,14 @@ herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t * if(len && !str) { text_str = (char*)calloc(str_len, sizeof(char)); text_str[0]='\0'; - if((ret = H5LT_dtype_to_text(dtype, &text_str, lang_type, &str_len, 1)) < 0) + if(!(text_str = H5LT_dtype_to_text(dtype, text_str, lang_type, &str_len, 1))) goto out; *len = strlen(text_str) + 1; - free(text_str); + if(text_str) + free(text_str); + text_str = NULL; } else if(len && str) { - if((ret = H5LT_dtype_to_text(dtype, &str, lang_type, len, 0)) < 0) + if(!(H5LT_dtype_to_text(dtype, str, lang_type, len, 0))) goto out; str[*len-1] = '\0'; } @@ -1837,26 +1886,18 @@ out: * *------------------------------------------------------------------------- */ -herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *slen, +char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hbool_t no_user_buf) { H5T_class_t tcls; - char tmp_str[256]; - char *tmp; + char tmp_str[TMP_LEN]; int i; - herr_t ret = SUCCEED; - - if(no_user_buf && ((*slen - strlen(*dt_str)) < LIMIT)) { - *slen += INCREMENT; - tmp = (char*)realloc(*dt_str, *slen); - if(tmp != *dt_str) { - free(*dt_str); - *dt_str = tmp; - } - } + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, NULL))) + goto out; + if(lang != H5LT_DDL) { - sprintf(*dt_str, "only DDL is supported for now"); + HDsnprintf(dt_str, *slen, "only DDL is supported for now"); goto out; } @@ -1866,81 +1907,81 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * switch (tcls) { case H5T_INTEGER: if (H5Tequal(dtype, H5T_STD_I8BE)) { - sprintf(*dt_str, "H5T_STD_I8BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I8BE"); } else if (H5Tequal(dtype, H5T_STD_I8LE)) { - sprintf(*dt_str, "H5T_STD_I8LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I8LE"); } else if (H5Tequal(dtype, H5T_STD_I16BE)) { - sprintf(*dt_str, "H5T_STD_I16BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I16BE"); } else if (H5Tequal(dtype, H5T_STD_I16LE)) { - sprintf(*dt_str, "H5T_STD_I16LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I16LE"); } else if (H5Tequal(dtype, H5T_STD_I32BE)) { - sprintf(*dt_str, "H5T_STD_I32BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I32BE"); } else if (H5Tequal(dtype, H5T_STD_I32LE)) { - sprintf(*dt_str, "H5T_STD_I32LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I32LE"); } else if (H5Tequal(dtype, H5T_STD_I64BE)) { - sprintf(*dt_str, "H5T_STD_I64BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I64BE"); } else if (H5Tequal(dtype, H5T_STD_I64LE)) { - sprintf(*dt_str, "H5T_STD_I64LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_I64LE"); } else if (H5Tequal(dtype, H5T_STD_U8BE)) { - sprintf(*dt_str, "H5T_STD_U8BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U8BE"); } else if (H5Tequal(dtype, H5T_STD_U8LE)) { - sprintf(*dt_str, "H5T_STD_U8LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U8LE"); } else if (H5Tequal(dtype, H5T_STD_U16BE)) { - sprintf(*dt_str, "H5T_STD_U16BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U16BE"); } else if (H5Tequal(dtype, H5T_STD_U16LE)) { - sprintf(*dt_str, "H5T_STD_U16LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U16LE"); } else if (H5Tequal(dtype, H5T_STD_U32BE)) { - sprintf(*dt_str, "H5T_STD_U32BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U32BE"); } else if (H5Tequal(dtype, H5T_STD_U32LE)) { - sprintf(*dt_str, "H5T_STD_U32LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U32LE"); } else if (H5Tequal(dtype, H5T_STD_U64BE)) { - sprintf(*dt_str, "H5T_STD_U64BE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U64BE"); } else if (H5Tequal(dtype, H5T_STD_U64LE)) { - sprintf(*dt_str, "H5T_STD_U64LE"); + HDsnprintf(dt_str, *slen, "H5T_STD_U64LE"); } else if (H5Tequal(dtype, H5T_NATIVE_SCHAR)) { - sprintf(*dt_str, "H5T_NATIVE_SCHAR"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_SCHAR"); } else if (H5Tequal(dtype, H5T_NATIVE_UCHAR)) { - sprintf(*dt_str, "H5T_NATIVE_UCHAR"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_UCHAR"); } else if (H5Tequal(dtype, H5T_NATIVE_SHORT)) { - sprintf(*dt_str, "H5T_NATIVE_SHORT"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_SHORT"); } else if (H5Tequal(dtype, H5T_NATIVE_USHORT)) { - sprintf(*dt_str, "H5T_NATIVE_USHORT"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_USHORT"); } else if (H5Tequal(dtype, H5T_NATIVE_INT)) { - sprintf(*dt_str, "H5T_NATIVE_INT"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_INT"); } else if (H5Tequal(dtype, H5T_NATIVE_UINT)) { - sprintf(*dt_str, "H5T_NATIVE_UINT"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_UINT"); } else if (H5Tequal(dtype, H5T_NATIVE_LONG)) { - sprintf(*dt_str, "H5T_NATIVE_LONG"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_LONG"); } else if (H5Tequal(dtype, H5T_NATIVE_ULONG)) { - sprintf(*dt_str, "H5T_NATIVE_ULONG"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULONG"); } else if (H5Tequal(dtype, H5T_NATIVE_LLONG)) { - sprintf(*dt_str, "H5T_NATIVE_LLONG"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_LLONG"); } else if (H5Tequal(dtype, H5T_NATIVE_ULLONG)) { - sprintf(*dt_str, "H5T_NATIVE_ULLONG"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_ULLONG"); } else { - sprintf(*dt_str, "undefined integer"); + HDsnprintf(dt_str, *slen, "undefined integer"); } break; case H5T_FLOAT: if (H5Tequal(dtype, H5T_IEEE_F32BE)) { - sprintf(*dt_str, "H5T_IEEE_F32BE"); + HDsnprintf(dt_str, *slen, "H5T_IEEE_F32BE"); } else if (H5Tequal(dtype, H5T_IEEE_F32LE)) { - sprintf(*dt_str, "H5T_IEEE_F32LE"); + HDsnprintf(dt_str, *slen, "H5T_IEEE_F32LE"); } else if (H5Tequal(dtype, H5T_IEEE_F64BE)) { - sprintf(*dt_str, "H5T_IEEE_F64BE"); + HDsnprintf(dt_str, *slen, "H5T_IEEE_F64BE"); } else if (H5Tequal(dtype, H5T_IEEE_F64LE)) { - sprintf(*dt_str, "H5T_IEEE_F64LE"); + HDsnprintf(dt_str, *slen, "H5T_IEEE_F64LE"); } else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) { - sprintf(*dt_str, "H5T_NATIVE_FLOAT"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_FLOAT"); } else if (H5Tequal(dtype, H5T_NATIVE_DOUBLE)) { - sprintf(*dt_str, "H5T_NATIVE_DOUBLE"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_DOUBLE"); #if H5_SIZEOF_LONG_DOUBLE !=0 } else if (H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) { - sprintf(*dt_str, "H5T_NATIVE_LDOUBLE"); + HDsnprintf(dt_str, *slen, "H5T_NATIVE_LDOUBLE"); #endif } else { - sprintf(*dt_str, "undefined float"); + HDsnprintf(dt_str, *slen, "undefined float"); } break; @@ -1969,38 +2010,47 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * goto out; /* Print lead-in */ - sprintf(*dt_str, "H5T_STRING {\n"); + HDsnprintf(dt_str, *slen, "H5T_STRING {\n"); indent += COL; - indentation(indent + COL, *dt_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; if(is_vlstr) - strcat(*dt_str, "STRSIZE H5T_VARIABLE;\n"); - else { - sprintf(tmp_str, "STRSIZE %d;\n", (int)size); - strcat(*dt_str, tmp_str); - } + HDsnprintf(tmp_str, TMP_LEN, "STRSIZE H5T_VARIABLE;\n"); + else + HDsnprintf(tmp_str, TMP_LEN, "STRSIZE %d;\n", (int)size); - indentation(indent + COL, *dt_str); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; if (str_pad == H5T_STR_NULLTERM) - strcat(*dt_str, "STRPAD H5T_STR_NULLTERM;\n"); + HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLTERM;\n"); else if (str_pad == H5T_STR_NULLPAD) - strcat(*dt_str, "STRPAD H5T_STR_NULLPAD;\n"); + HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLPAD;\n"); else if (str_pad == H5T_STR_SPACEPAD) - strcat(*dt_str, "STRPAD H5T_STR_SPACEPAD;\n"); + HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_SPACEPAD;\n"); else - strcat(*dt_str, "STRPAD H5T_STR_ERROR;\n"); + HDsnprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_ERROR;\n"); - indentation(indent + COL, *dt_str); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; if (cset == H5T_CSET_ASCII) - strcat(*dt_str, "CSET H5T_CSET_ASCII;\n"); + HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_ASCII;\n"); else if (cset == H5T_CSET_UTF8) - strcat(*dt_str, "CSET H5T_CSET_UTF8;\n"); + HDsnprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_UTF8;\n"); else - strcat(*dt_str, "CSET unknown;\n"); + HDsnprintf(tmp_str, TMP_LEN, "CSET unknown;\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; /* Reproduce a C type string */ if((str_type = H5Tcopy(H5T_C_S1)) < 0) @@ -2017,11 +2067,14 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * if(H5Tset_strpad(str_type, str_pad) < 0) goto out; - indentation(indent + COL, *dt_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; /* Check C variable-length string first. Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { - strcat(*dt_str, "CTYPE H5T_C_S1;\n"); + HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; goto next; } @@ -2037,7 +2090,9 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * } if (H5Tequal(tmp_type, str_type)) { - strcat(*dt_str, "H5T_C_S1;\n"); + HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; goto next; } @@ -2056,7 +2111,9 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * /* Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { - strcat(*dt_str, "CTYPE H5T_FORTRAN_S1;\n"); + HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; goto next; } @@ -2073,12 +2130,16 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t * /* Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { - strcat(*dt_str, "CTYPE H5T_FORTRAN_S1;\n"); + HDsnprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; goto next; } /* Type doesn't match any of above. */ - strcat(*dt_str, "CTYPE unknown_one_character_type;\n "); + HDsnprintf(tmp_str, TMP_LEN, "CTYPE unknown_one_character_type;\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; next: H5Tclose(str_type); @@ -2086,36 +2147,48 @@ next: /* Print closing */ indent -= COL; - indentation(indent + COL, *dt_str); - strcat(*dt_str, "}"); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "}"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; break; } case H5T_OPAQUE: { - char *tag; + char *tag = NULL; /* Print lead-in */ - sprintf(*dt_str, "H5T_OPAQUE {\n"); + HDsnprintf(dt_str, *slen, "H5T_OPAQUE {\n"); indent += COL; - indentation(indent + COL, *dt_str); - sprintf(tmp_str, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype)); - strcat(*dt_str, tmp_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype)); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; - indentation(indent + COL, *dt_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; tag = H5Tget_tag(dtype); if(tag) { - sprintf(tmp_str, "OPQ_TAG \"%s\";\n", tag); - free(tag); + HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"%s\";\n", tag); + if(tag) + free(tag); + tag = NULL; } else - sprintf(tmp_str, "OPQ_TAG \"\";\n"); - strcat(*dt_str, tmp_str); + HDsnprintf(tmp_str, TMP_LEN, "OPQ_TAG \"\";\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; /* Print closing */ indent -= COL; - indentation(indent + COL, *dt_str); - strcat(*dt_str, "}"); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "}"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; break; } @@ -2123,12 +2196,13 @@ next: { hid_t super; size_t super_len; - char* stmp; + char* stmp = NULL; /* Print lead-in */ - sprintf(*dt_str, "H5T_ENUM {\n"); + HDsnprintf(dt_str, *slen, "H5T_ENUM {\n"); indent += COL; - indentation(indent + COL, *dt_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; if((super = H5Tget_super(dtype)) < 0) goto out; @@ -2136,19 +2210,29 @@ next: goto out; stmp = (char*)calloc(super_len, sizeof(char)); if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) + goto out; + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) + goto out; + + if(stmp) + free(stmp); + stmp = NULL; + + HDsnprintf(tmp_str, TMP_LEN, ";\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) goto out; - strcat(*dt_str, stmp); - free(stmp); - strcat(*dt_str, ";\n"); H5Tclose(super); - if(print_enum(dtype, *dt_str, indent) < 0) + if(!(dt_str = print_enum(dtype, dt_str, slen, no_user_buf, indent))) goto out; /* Print closing */ indent -= COL; - indentation(indent + COL, *dt_str); - strcat(*dt_str, "}"); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "}"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; break; } @@ -2156,12 +2240,13 @@ next: { hid_t super; size_t super_len; - char* stmp; + char* stmp = NULL; /* Print lead-in */ - sprintf(*dt_str, "H5T_VLEN {\n"); + HDsnprintf(dt_str, *slen, "H5T_VLEN {\n"); indent += COL; - indentation(indent + COL, *dt_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; if((super = H5Tget_super(dtype)) < 0) goto out; @@ -2170,15 +2255,24 @@ next: stmp = (char*)calloc(super_len, sizeof(char)); if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) goto out; - strcat(*dt_str, stmp); - free(stmp); - strcat(*dt_str, "\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) + goto out; + + if(stmp) + free(stmp); + stmp = NULL; + HDsnprintf(tmp_str, TMP_LEN, "\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; H5Tclose(super); /* Print closing */ indent -= COL; - indentation(indent + COL, *dt_str); - strcat(*dt_str, "}"); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "}"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; break; } @@ -2186,14 +2280,15 @@ next: { hid_t super; size_t super_len; - char* stmp; + char* stmp = NULL; hsize_t dims[H5S_MAX_RANK]; int ndims; /* Print lead-in */ - sprintf(*dt_str, "H5T_ARRAY {\n"); + HDsnprintf(dt_str, *slen, "H5T_ARRAY {\n"); indent += COL; - indentation(indent + COL, *dt_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; /* Get array information */ if((ndims = H5Tget_array_ndims(dtype)) < 0) @@ -2203,10 +2298,13 @@ next: /* Print array dimensions */ for (i = 0; i < ndims; i++) { - sprintf(tmp_str, "[%d]", (int) dims[i]); - strcat(*dt_str, tmp_str); + HDsnprintf(tmp_str, TMP_LEN, "[%d]", (int) dims[i]); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; } - strcat(*dt_str, " "); + HDsnprintf(tmp_str, TMP_LEN, " "); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; if((super = H5Tget_super(dtype)) < 0) goto out; @@ -2215,32 +2313,40 @@ next: stmp = (char*)calloc(super_len, sizeof(char)); if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) goto out; - strcat(*dt_str, stmp); - free(stmp); - strcat(*dt_str, "\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) + goto out; + if(stmp) + free(stmp); + stmp = NULL; + HDsnprintf(tmp_str, TMP_LEN, "\n"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; H5Tclose(super); /* Print closing */ indent -= COL; - indentation(indent + COL, *dt_str); - strcat(*dt_str, "}"); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "}"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; break; } case H5T_COMPOUND: { - char *mname; + char *mname = NULL; hid_t mtype; size_t moffset; H5T_class_t mclass; size_t mlen; - char* mtmp; + char* mtmp = NULL; int nmembs; if((nmembs = H5Tget_nmembers(dtype)) < 0) goto out; - sprintf(*dt_str, "H5T_COMPOUND {\n"); + HDsnprintf(dt_str, *slen, "H5T_COMPOUND {\n"); indent += COL; for (i = 0; i < nmembs; i++) { @@ -2249,7 +2355,8 @@ next: if((mtype = H5Tget_member_type(dtype, (unsigned)i)) < 0) goto out; moffset = H5Tget_member_offset(dtype, (unsigned)i); - indentation(indent + COL, *dt_str); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; if((mclass = H5Tget_class(mtype)) < 0) goto out; @@ -2261,47 +2368,53 @@ next: mtmp = (char*)calloc(mlen, sizeof(char)); if(H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0) goto out; - strcat(*dt_str, mtmp); - free(mtmp); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp))) + goto out; + if(mtmp) + free(mtmp); + mtmp = NULL; if (H5T_COMPOUND == mclass) indent -= COL; - sprintf(tmp_str, " \"%s\"", mname); - strcat(*dt_str, tmp_str); - free(mname); + HDsnprintf(tmp_str, TMP_LEN, " \"%s\"", mname); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + if(mname) + free(mname); + mname = NULL; - sprintf(tmp_str, " : %lu;\n", (unsigned long)moffset); - strcat(*dt_str, tmp_str); + HDsnprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; } /* Print closing */ indent -= COL; - indentation(indent + COL, *dt_str); - strcat(*dt_str, "}"); + if(!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + HDsnprintf(tmp_str, TMP_LEN, "}"); + if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; break; } case H5T_TIME: - sprintf(*dt_str, "H5T_TIME: not yet implemented"); + HDsnprintf(dt_str, *slen, "H5T_TIME: not yet implemented"); break; case H5T_BITFIELD: - sprintf(*dt_str, "H5T_BITFIELD: not yet implemented"); + HDsnprintf(dt_str, *slen, "H5T_BITFIELD: not yet implemented"); break; default: - sprintf(*dt_str, "unknown data type"); + HDsnprintf(dt_str, *slen, "unknown data type"); } - return ret; + return dt_str; out: - return FAIL; + return NULL; } - - - - /*------------------------------------------------------------------------- * * Get attribute functions @@ -2917,4 +3030,110 @@ out: } - +htri_t +H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) + { + char *tmp_path = NULL; /* Temporary copy of the path */ + char *curr_name; /* Pointer to current component of path name */ + char *delimit; /* Pointer to path delimiter during traversal */ + H5I_type_t obj_type; + htri_t link_exists, obj_exists; + size_t path_length; + htri_t ret_value; + + /* Initialize */ + ret_value = FALSE; + + /* Find the type of loc_id */ + if((obj_type = H5Iget_type(loc_id)) == H5I_BADID) { + ret_value = FAIL; + goto done; + } + + /* Find the length of the path */ + path_length = HDstrlen(path); + + /* Check if the identifier is the object itself, i.e. path is '.' */ + if(HDstrncmp(path, ".", path_length) == 0) { + if(check_object_valid) { + obj_exists = H5Oexists_by_name(loc_id, path, H5P_DEFAULT); + ret_value = obj_exists; + goto done; + } else { + ret_value = TRUE; /* Since the object is the identifier itself, + * we can only check if loc_id is a valid type */ + goto done; + } + } + + /* Duplicate the path to use */ + if(NULL == (tmp_path = HDstrdup(path))) { + ret_value = FAIL; + goto done; + } + + curr_name = tmp_path; + + /* check if absolute pathname */ + if(HDstrncmp(path, "/", 1) == 0) curr_name++; + + /* check if relative path name starts with "./" */ + if(HDstrncmp(path, "./", 2) == 0) curr_name += 2; + + while((delimit=HDstrchr(curr_name,'/'))!=NULL) { + /* Change the delimiter to terminate the string */ + *delimit='\0'; + + obj_exists = FALSE; + if((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + goto done; + } + + /* If target link does not exist then no reason to + * continue checking the path */ + if(link_exists != TRUE) { + ret_value = FALSE; + goto done; + } + + /* Determine if link resolves to an actual object */ + if((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + goto done; + } + + if(obj_exists != TRUE) + break; + + /* Change the delimiter back to '/' */ + *delimit='/'; + + /* Advance the pointer in the path to the start of the next component */ + curr_name = delimit + 1; + + } /* end while */ + + /* Should be pointing to the last component in the path name now... */ + + /* Check if link does not exist */ + if((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + } else { + ret_value = link_exists; + /* Determine if link resolves to an actual object for check_object_valid TRUE */ + if(check_object_valid == TRUE && link_exists == TRUE) { + if((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + } else { + ret_value = obj_exists; + } + } + } + +done: + if(tmp_path != NULL) + HDfree(tmp_path); + + return ret_value; + } diff --git a/hl/src/H5LTprivate.h b/hl/src/H5LTprivate.h index c51ee7c..69616b1 100644 --- a/hl/src/H5LTprivate.h +++ b/hl/src/H5LTprivate.h @@ -45,7 +45,7 @@ H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id, H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); -H5_HLDLL herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, +H5_HLDLL char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hbool_t no_user_buf); diff --git a/hl/src/H5LTpublic.h b/hl/src/H5LTpublic.h index 7fb873a..6efae68 100644 --- a/hl/src/H5LTpublic.h +++ b/hl/src/H5LTpublic.h @@ -340,8 +340,9 @@ H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5LTfind_attribute( hid_t loc_id, const char *name ); +H5_HLDLL herr_t H5LTfind_attribute( hid_t loc_id, const char *name ); +H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid); #ifdef __cplusplus } diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index ff55204..cb89235 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -200,6 +200,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -220,10 +221,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ @@ -417,7 +420,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 = 71 +LT_VERS_REVISION = 101 LT_VERS_AGE = 0 # This library is our main target. diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 3104008..89baac4 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed @@ -28,6 +28,7 @@ MACRO (HL_ADD_TEST hl_name files) ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ) + SET_TARGET_PROPERTIES (hl_${hl_name} PROPERTIES FOLDER test/hl) ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) @@ -92,4 +93,5 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ) + SET_TARGET_PROPERTIES (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in index 54e4b12..9a95e16 100644 --- a/hl/test/Makefile.in +++ b/hl/test/Makefile.in @@ -224,6 +224,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -244,10 +245,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 53870f5..e290bbb 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -81,8 +81,9 @@ static int test_types(void); static int test_iterators(void); static int test_data(void); static int read_data( const char* fname, int ndims, hsize_t *dims, float **buf ); +static int test_attach_detach(void); - +#define RANK1 1 #define RANK 2 #define DIM_DATA 12 #define DIM1_SIZE 3 @@ -136,6 +137,7 @@ static int read_data( const char* fname, int ndims, hsize_t *dims, float **buf ) #define FILE5 "test_ds7.h5" #define FILE6 "test_ds8.h5" #define FILE7 "test_ds9.h5" +#define FILE8 "test_ds10.h5" #define DIMENSION_LIST "DIMENSION_LIST" #define REFERENCE_LIST "REFERENCE_LIST" @@ -174,7 +176,7 @@ int main(void) nerrors += test_foreign_scaleattached(FOREIGN_FILE1) < 0 ? 1 : 0; nerrors += test_foreign_scaleattached(FOREIGN_FILE2) < 0 ? 1 : 0; nerrors += test_detachscales() < 0 ? 1 : 0; - + nerrors += test_attach_detach() < 0 ? 1 : 0; /* the following tests have not been rewritten to match those above */ nerrors += test_simple() < 0 ?1:0; nerrors += test_errors() < 0 ?1:0; @@ -217,9 +219,9 @@ static hid_t create_test_file(const char *fileext) { char filename[65]; - strcpy(filename, FILENAME); - strcat(filename, fileext); - strcat(filename, FILEEXT); + HDstrcpy(filename, FILENAME); + HDstrcat(filename, fileext); + HDstrcat(filename, FILEEXT); return H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); } @@ -227,9 +229,9 @@ static hid_t open_test_file(const char *fileext) { char filename[65]; - strcpy(filename, FILENAME); - strcat(filename, fileext); - strcat(filename, FILEEXT); + HDstrcpy(filename, FILENAME); + HDstrcat(filename, fileext); + HDstrcat(filename, FILEEXT); return H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } @@ -258,8 +260,8 @@ herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims) char s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,120,120,120}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_char(fid, name, rank, dims, buf) >= 0) { if(fulldims==0) { @@ -311,8 +313,8 @@ herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims) short s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,140,140,140}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_short(fid, name, rank, dims, buf) >= 0) { @@ -360,8 +362,8 @@ herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims) int s22_wbuf[DIM2_SIZE] = {5,10,50,300}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_int(fid, name, rank, dims, buf) >= 0) { @@ -413,7 +415,7 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int long s44_wbuf[DIM4_SIZE] = {280,280}; char name[32]; - strcpy(name, dsname); + HDstrcpy(name, dsname); /* make a dataset */ if(H5LTmake_dataset_long(fid, name, rank, dims, buf) >= 0) { @@ -468,8 +470,8 @@ herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims) float s22_wbuf[DIM2_SIZE] = {5,10,50,300}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_float(fid, name, rank, dims, buf) >= 0) { @@ -503,15 +505,15 @@ herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -528,23 +530,23 @@ herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -561,31 +563,31 @@ herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -602,15 +604,15 @@ herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -627,24 +629,24 @@ herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -661,32 +663,32 @@ herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -703,16 +705,16 @@ herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -729,24 +731,24 @@ herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -763,32 +765,32 @@ herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -805,16 +807,16 @@ herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -831,24 +833,24 @@ herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -865,32 +867,32 @@ herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -907,40 +909,40 @@ herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_4_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_4_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_41_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_41_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_42_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_42_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_43_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_43_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; } if(s4_wbuf!=NULL) { - strcpy(name, DS_44_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_44_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s4_wbuf) < 0) return FAIL; @@ -957,16 +959,16 @@ herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -983,24 +985,24 @@ herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -1017,32 +1019,32 @@ herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -1125,13 +1127,13 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)malloc(name_len * sizeof (char)); + name_out = (char*)HDmalloc(name_len * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) { - if(strcmp(scalename,name_out)==0) { + if(HDstrcmp(scalename,name_out)==0) { ret_value = SUCCEED; } - free(name_out); + HDfree(name_out); name_out=NULL; } } @@ -1292,8 +1294,8 @@ static int test_char_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "ac"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "ac"); TESTING2("test_char_attachscales"); @@ -1305,18 +1307,18 @@ static int test_char_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "ac"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "ac"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "ac"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "ac"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "ac"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "ac"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; @@ -1348,8 +1350,8 @@ static int test_short_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "as"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "as"); TESTING2("test_short_attachscales"); @@ -1361,48 +1363,48 @@ static int test_short_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_31_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_31_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_32_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_32_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_33_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_33_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; @@ -1434,8 +1436,8 @@ static int test_int_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "a"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "a"); TESTING2("test_int_attachscales"); @@ -1447,28 +1449,28 @@ static int test_int_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; @@ -1500,8 +1502,8 @@ static int test_long_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al"); TESTING2("test_long_attachscales"); @@ -1513,23 +1515,23 @@ static int test_long_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM3) < 0) goto out; @@ -1561,8 +1563,8 @@ static int test_duplicatelong_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al2"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al2"); TESTING2("test_duplicatelong_attachscales"); @@ -1574,23 +1576,23 @@ static int test_duplicatelong_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM3) < 0) goto out; @@ -1622,8 +1624,8 @@ static int test_float_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "af"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "af"); TESTING2("test_float_attachscales"); @@ -1635,28 +1637,28 @@ static int test_float_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; @@ -1689,8 +1691,8 @@ static int test_numberofscales(const char *fileext) int nscales; /* number of scales in DIM */ char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "a"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "a"); TESTING2("test_numberofscales"); @@ -1716,8 +1718,8 @@ static int test_numberofscales(const char *fileext) else goto out; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "b"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "b"); /* make a dataset */ if(create_int_dataset(fid, "b", 1) < 0) @@ -1725,8 +1727,8 @@ static int test_numberofscales(const char *fileext) /* make a DS dataset for the first dimension */ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "b"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "b"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; @@ -1770,38 +1772,38 @@ static int test_char_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "ac"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "ac"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set char scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "ac"); - strcpy(name, SCALE_1_NAME); - strcat(name, "ac"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "ac"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "ac"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "ac"); - strcpy(name, SCALE_2_NAME); - strcat(name, "ac"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "ac"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "ac"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "ac"); - strcpy(name, SCALE_3_NAME); - strcat(name, "ac"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "ac"); + HDstrcpy(name, SCALE_3_NAME); + HDstrcat(name, "ac"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; @@ -1836,98 +1838,98 @@ static int test_short_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "as"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "as"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set short scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_1_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_11_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_11_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_2_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_21_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_21_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_22_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_22_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_3_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_3_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_31_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_31_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_31_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_31_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_32_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_32_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_32_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_32_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_33_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_33_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_33_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_33_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; @@ -1962,58 +1964,58 @@ static int test_int_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "a"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "a"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set int scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_1_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_11_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_11_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_2_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_21_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_21_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_22_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_22_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; @@ -2048,48 +2050,48 @@ static int test_long_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_1_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_2_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_3_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_3_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_4_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_4_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM3) < 0) goto out; @@ -2124,48 +2126,48 @@ static int test_samelong_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al2"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al2"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set same long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); - strcpy(name, DS_1_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); - strcpy(name, DS_2_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); - strcpy(name, DS_3_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); - strcpy(name, DS_4_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_4_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM3) < 0) goto out; @@ -2200,58 +2202,58 @@ static int test_float_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "af"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "af"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set float scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_1_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_11_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_11_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_2_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_21_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_21_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_22_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_22_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; @@ -3044,13 +3046,11 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - for(i=0; i<5; i++) - { + for(i=0; i<5; i++) { sprintf(dname,"dset_%d",i); if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0) goto out; - for(j=0; j<5; j++) - { + for(j=0; j<5; j++) { sprintf(sname,"ds_%d",j); if((dsid = H5Dopen2(gid,sname, H5P_DEFAULT)) < 0) goto out; @@ -3097,15 +3097,12 @@ static int test_simple(void) /* try to detach all dimensions. for dimensions 0 and 2, it is an error */ - for(i=0; i<rank; i++) - { - if( i==1 ) - { + for(i=0; i<rank; i++) { + if( i==1 ) { if(H5DSdetach_scale(did,dsid,(unsigned)i) < 0) goto out; } - else - { + else { if(H5DSdetach_scale(did,dsid,(unsigned)i)!=FAIL) goto out; } @@ -3136,6 +3133,11 @@ static int test_simple(void) if(H5DSset_label(did,DIM0,DIM0_LABEL) < 0) goto out; + + /* check getting a label which does not exist */ + if(H5DSget_label(did,DIM1,dim1_label,sizeof(dim1_label)) != 0) + goto out; + if(H5DSset_label(did,DIM1,DIM1_LABEL) < 0) goto out; @@ -3148,9 +3150,9 @@ static int test_simple(void) goto out; if(H5DSget_label(did,DIM1,dim1_label,sizeof(dim1_label)) < 0) goto out; - if(strcmp(DIM0_LABEL,dim0_label)!=0) + if(HDstrcmp(DIM0_LABEL,dim0_label)!=0) goto out; - if(strcmp(DIM1_LABEL,dim1_label)!=0) + if(HDstrcmp(DIM1_LABEL,dim1_label)!=0) goto out; /*------------------------------------------------------------------------- @@ -3164,26 +3166,24 @@ static int test_simple(void) goto out; /* allocate */ - dim0_labeld = (char*)malloc(dim0_label_size * sizeof (char)); - dim1_labeld = (char*)malloc(dim1_label_size * sizeof (char)); + dim0_labeld = (char*)HDmalloc(dim0_label_size * sizeof (char)); + dim1_labeld = (char*)HDmalloc(dim1_label_size * sizeof (char)); if( dim0_labeld==NULL || dim1_labeld==NULL) goto out; if(H5DSget_label(did,DIM0,dim0_labeld,(size_t)dim0_label_size) < 0) goto out; if(H5DSget_label(did,DIM1,dim1_labeld,(size_t)dim1_label_size) < 0) goto out; - if(strncmp(DIM0_LABEL,dim0_labeld,(size_t)(dim0_label_size-1))!=0) + if(HDstrncmp(DIM0_LABEL,dim0_labeld,(size_t)(dim0_label_size-1))!=0) goto out; - if(strncmp(DIM1_LABEL,dim1_labeld,(size_t)(dim1_label_size-1))!=0) + if(HDstrncmp(DIM1_LABEL,dim1_labeld,(size_t)(dim1_label_size-1))!=0) goto out; - if(dim0_labeld) - { - free(dim0_labeld); + if(dim0_labeld) { + HDfree(dim0_labeld); dim0_labeld=NULL; } - if(dim1_labeld) - { - free(dim1_labeld); + if(dim1_labeld) { + HDfree(dim1_labeld); dim1_labeld=NULL; } @@ -3197,9 +3197,9 @@ static int test_simple(void) goto out; if(H5DSget_label(did,DIM1,dim1_labels,sizeof(dim1_labels)) < 0) goto out; - if(strncmp(DIM0_LABEL,dim0_label,sizeof(dim0_labels)-1)!=0) + if(HDstrncmp(DIM0_LABEL,dim0_label,sizeof(dim0_labels)-1)!=0) goto out; - if(strncmp(DIM1_LABEL,dim1_label,sizeof(dim1_labels)-1)!=0) + if(HDstrncmp(DIM1_LABEL,dim1_label,sizeof(dim1_labels)-1)!=0) goto out; if(H5Dclose(did)) goto out; @@ -3232,7 +3232,7 @@ static int test_simple(void) goto out; /* allocate a buffer */ - name_out = (char*)malloc(name_len * sizeof (char)); + name_out = (char*)HDmalloc(name_len * sizeof (char)); if(name_out == NULL) goto out; @@ -3240,11 +3240,10 @@ static int test_simple(void) if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) < 0) goto out; - if(strcmp("Latitude set 0",name_out)!=0) + if(HDstrcmp("Latitude set 0",name_out)!=0) goto out; - if(name_out) - { - free(name_out); + if(name_out) { + HDfree(name_out); name_out=NULL; } @@ -3257,7 +3256,7 @@ static int test_simple(void) if(H5DSget_scale_name(dsid, sname, sizeof (sname)) < 0) goto out; - if(strcmp("Latitude set 0",sname)!=0) + if(HDstrcmp("Latitude set 0",sname)!=0) goto out; /*------------------------------------------------------------------------- @@ -3269,7 +3268,7 @@ static int test_simple(void) if(H5DSget_scale_name(dsid, snames, sizeof (snames)) < 0) goto out; - if(strncmp("Latitude set 0",snames,sizeof(snames)-1)!=0) + if(HDstrncmp("Latitude set 0",snames,sizeof(snames)-1)!=0) goto out; if(H5Dclose(dsid)) goto out; @@ -3396,8 +3395,7 @@ static int test_simple(void) int idx = 0; /* scale index to start iterating, on return, index where iterator stoped */ /* iterate trough all the dimensions */ - for(dim=0; dim<(unsigned)rank; dim++) - { + for(dim=0; dim<(unsigned)rank; dim++) { if((match_size=H5DSiterate_scales(did,dim,&idx,match_dim_scale,NULL)) < 0) goto out; @@ -3493,8 +3491,7 @@ static int test_simple(void) int idx; /* scale index to start iterating, on return, index where iterator stoped */ /* iterate trough all the dimensions */ - for(dim=0; dim<(unsigned)rank; dim++) - { + for(dim=0; dim<(unsigned)rank; dim++) { /* always start at 1st scale */ idx=0; @@ -3504,8 +3501,7 @@ static int test_simple(void) /* "dset_e" was defined with : dim 0: 2 scales, first is empty dim 1: 1 scale, empty */ - switch(dim) - { + switch(dim) { case 0: /* for DIM 0, we get a valid scale at IDX 1 */ if(match_size!=1 && idx!=1) goto out; @@ -3515,11 +3511,11 @@ static int test_simple(void) goto out; break; default: - assert(0); + HDassert(0); break; }/*switch*/ }/*for*/ - } + } /* close */ if(H5Dclose(did) < 0) @@ -3587,8 +3583,7 @@ static herr_t verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visit */ /* the parameter DS dataset must be a valid DS dataset */ - if((H5DSis_scale(scale_id))==1) - { + if((H5DSis_scale(scale_id))==1) { ret = 1; } @@ -3646,18 +3641,15 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor if((size=H5Tget_size(mtid))==0) goto out; - if(nelmts) - { - buf=(char *) malloc((size_t)(nelmts*size)); - if( buf==NULL) + if(nelmts) { + buf=(char *)HDmalloc((size_t)(nelmts*size)); + if(buf==NULL) goto out; if(H5Dread(scale_id,mtid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) goto out; - for(i=0; i<nelmts; i++) - { - if(buf[i] != data[i]) - { + for(i=0; i<nelmts; i++) { + if(buf[i] != data[i]) { printf("read and write buffers differ\n"); goto out; } @@ -3672,21 +3664,19 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor if(H5Tclose(mtid) < 0) goto out; if(buf) - free(buf); + HDfree(buf); return ret; /* error zone */ out: - H5E_BEGIN_TRY - { + H5E_BEGIN_TRY { H5Sclose(sid); H5Tclose(tid); H5Tclose(mtid); - if(buf) - { - free(buf); + if(buf) { + HDfree(buf); } } H5E_END_TRY; @@ -3769,8 +3759,7 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor return ret; out: - H5E_BEGIN_TRY - { + H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; return FAIL; @@ -3801,8 +3790,7 @@ static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visito dim = dim; scale_id = scale_id; - if ( visitor_data != NULL ) - { + if ( visitor_data != NULL ) { (*(int *)visitor_data)++; } @@ -3834,8 +3822,7 @@ static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_da dim = dim; scale_id = scale_id; - if ( visitor_data != NULL ) - { + if ( visitor_data != NULL ) { (*(int *)visitor_data)++; } @@ -4318,8 +4305,7 @@ static int test_iterators(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<100; i++) - { + for(i=0; i<100; i++) { /* make a DS */ sprintf(dname,"ds_%d",i); if(H5LTmake_dataset_int(fid,dname,rankds,s1_dim,NULL) < 0) @@ -4471,8 +4457,7 @@ static int test_rank(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<3; i++) - { + for(i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; @@ -4500,8 +4485,7 @@ static int test_rank(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<3; i++) - { + for(i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; @@ -4527,8 +4511,7 @@ static int test_rank(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<3; i++) - { + for(i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; @@ -4546,9 +4529,9 @@ static int test_rank(void) goto out; if(H5DSget_label(did,(unsigned)i,namel,sizeof(namel)) < 0) goto out; - if(strcmp(name,names)!=0) + if(HDstrcmp(name,names)!=0) goto out; - if(strcmp(name,namel)!=0) + if(HDstrcmp(name,namel)!=0) goto out; } @@ -4850,7 +4833,7 @@ static int test_data(void) if(H5LTmake_dataset_float(fid, "lat", 1, latdims, latbuf) < 0) goto out; - free( latbuf ); + HDfree( latbuf ); latbuf = NULL; /* read the longitude */ @@ -4861,7 +4844,7 @@ static int test_data(void) if(H5LTmake_dataset_float(fid, "lon", 1, londims, lonbuf) < 0) goto out; - free( lonbuf ); + HDfree( lonbuf ); lonbuf = NULL; /* make a dataset for the data. a fill value is set */ @@ -4881,7 +4864,7 @@ static int test_data(void) if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, vals) < 0) goto out; - free ( vals ); + HDfree ( vals ); vals = NULL; if(H5Dclose(did) < 0) @@ -4957,11 +4940,11 @@ out: H5_FAILED(); if (latbuf) - free( latbuf ); + HDfree( latbuf ); if (lonbuf) - free( lonbuf ); + HDfree( lonbuf ); if (vals) - free( vals ); + HDfree( vals ); return FAIL; } @@ -4994,36 +4977,32 @@ static int read_data( const char* fname, const char *data_file = H5_get_srcdir_filename(fname); /* read first data file */ - f = fopen(data_file, "r"); - if( f == NULL ) - { + f = HDfopen(data_file, "r"); + if( f == NULL ) { printf( "Could not open file %s\n", data_file ); return -1; } - for(i=0, nelms=1; i < ndims; i++) - { + for(i=0, nelms=1; i < ndims; i++) { fscanf( f, "%s %u", str, &j); fscanf( f, "%d",&n ); dims[i] = n; nelms *= n; } - *buf = (float*) malloc (nelms * sizeof( float )); + *buf = (float*) HDmalloc (nelms * sizeof( float )); - if ( *buf == NULL ) - { + if ( *buf == NULL ) { printf( "memory allocation failed\n" ); - fclose(f); + HDfclose(f); return -1; } - for(j = 0; j < nelms; j++) - { + for(j = 0; j < nelms; j++) { fscanf( f, "%f",&val ); (*buf)[j] = val; } - fclose(f); + HDfclose(f); return 1; @@ -5184,8 +5163,7 @@ static int test_errors2(void) if (H5DSiterate_scales(did,0,&scale_idx,op_continue,(void *)&count) < 0) goto out; - if ( scale_idx != 1 && count != nscales ) - { + if ( scale_idx != 1 && count != nscales ) { goto out; } @@ -5195,8 +5173,7 @@ static int test_errors2(void) if (H5DSiterate_scales(did,0,&scale_idx,op_stop,(void *)&count) < 0) goto out; - if ( scale_idx != 0 && count != 1 ) - { + if ( scale_idx != 0 && count != 1 ) { goto out; } @@ -5226,4 +5203,242 @@ out: H5_FAILED(); return FAIL; } +/*------------------------------------------------------------------------- + * Test attaching and detaching in different order + * Checks condition reported in Bug HDFFV-7605 + *------------------------------------------------------------------------- + */ + +static int test_attach_detach(void) +{ + hid_t fid; /* file ID */ + hid_t gid; /* group ID */ + hid_t sid; /* dataspace ID */ + hid_t dcpl_id; /* dataset creation property */ + hid_t dsid = -1; /* DS dataset ID */ + hid_t var1_id, var2_id, var3_id; /* DS component name */ + hsize_t dims[RANK1] = {DIM1}; + + TESTING2("permutations of attaching and detaching"); + + if((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + goto out; + + /* Create dimension scale. */ + + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + + if((sid = H5Screate_simple(1, dims, dims)) < 0) + goto out; + if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid, + H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto out; + + if(H5Sclose(sid) < 0) + goto out; + if(H5Pclose(dcpl_id) < 0) + goto out; + + if(H5DSset_scale(dsid, DS_3_NAME) < 0) + goto out; + + /* Create a variable that uses this dimension scale. */ + + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + goto out; + + if((var1_id = H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + if(H5Sclose(sid) < 0) + goto out; + + if(H5DSattach_scale(var1_id, dsid, 0) < 0) + goto out; + + /* Create another variable that uses this dimension scale. */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + goto out; + + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + goto out; + + if((var2_id = H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid, + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + goto out; + + if(H5Pclose(dcpl_id) < 0) + goto out; + + if(H5Sclose(sid) < 0) + goto out; + + /* Create 3rd variable that uses this dimension scale. */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + goto out; + + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + goto out; + + if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid, + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + goto out; + + if(H5Pclose(dcpl_id) < 0) + goto out; + + if(H5Sclose(sid) < 0) + goto out; + + /* Attached var2 scale */ + if(H5DSattach_scale(var2_id, dsid, 0) < 0) + goto out; + + /* Detach the var2 scale */ + if(H5DSdetach_scale(var2_id, dsid, 0) < 0) + goto out; + + /* Check if in correct state of detached and attached */ + if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ + goto out; + if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ + goto out; + + /* Detach the var1 scale */ + if(H5DSdetach_scale(var1_id, dsid, 0) < 0) + goto out; + + /* Check if in correct state of detached and attached */ + if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ + goto out; + if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ + goto out; + + /* Attach the DS again and remove them in the opposite order */ + + if(H5DSattach_scale(var1_id, dsid, 0) < 0) + goto out; + + if(H5DSattach_scale(var2_id, dsid, 0) < 0) + goto out; + + /* Detach the var1 scale */ + if(H5DSdetach_scale(var1_id, dsid, 0) < 0) + goto out; + + /* Check if in correct state of detached and attached */ + + if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ + goto out; + if(H5DSis_attached(var2_id, dsid, 0) == 0) /* should still be attached */ + goto out; + + /* Detach the var2 scale */ + if(H5DSdetach_scale(var2_id, dsid, 0) < 0) + goto out; + + /* Check if in correct state of detached and attached */ + if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ + goto out; + if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ + goto out; + + /*************************************************** + * Attach Three DS and remove the middle one first + *****************************************************/ + + if(H5DSattach_scale(var1_id, dsid, 0) < 0) + goto out; + + if(H5DSattach_scale(var2_id, dsid, 0) < 0) + goto out; + + if(H5DSattach_scale(var3_id, dsid, 0) < 0) + goto out; + + + /* Detach the var2 scale */ + if(H5DSdetach_scale(var2_id, dsid, 0) < 0) + goto out; + + /* Check if in correct state of detached and attached */ + + if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ + goto out; + if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ + goto out; + if(H5DSis_attached(var3_id, dsid, 0) == 0) /* should still be attached */ + goto out; + + /* Detach the var3 scale */ + if(H5DSdetach_scale(var3_id, dsid, 0) < 0) + goto out; + + /* Check if in correct state of detached and attached */ + if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */ + goto out; + if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ + goto out; + if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */ + goto out; + + /* Detach the var1 scale */ + if(H5DSdetach_scale(var1_id, dsid, 0) < 0) + goto out; + + /* Check if in correct state of detached and attached */ + if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */ + goto out; + if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */ + goto out; + if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */ + goto out; + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + if(H5Dclose(var1_id) < 0) + goto out; + if(H5Dclose(var2_id) < 0) + goto out; + if(H5Dclose(var3_id) < 0) + goto out; + if(H5Dclose(dsid) < 0) + goto out; + if(H5Gclose(gid) < 0) + goto out; + if(H5Fclose(fid) < 0) + goto out; + + PASSED(); + + return 0; + + /* error zone */ +out: + H5E_BEGIN_TRY + { + H5Dclose(var1_id); + H5Dclose(var2_id); + H5Dclose(var3_id); + H5Dclose(dsid); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + H5_FAILED(); + return FAIL; +} diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 1332841..3914a9f 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -525,7 +525,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - f = fopen( data_file, "r" ) ; + f = HDfopen( data_file, "r" ) ; if ( f == NULL ) { printf( "Could not find file %s. Try set $srcdir \n", data_file ); @@ -572,15 +572,15 @@ static int test_generate(void) fscanf( f, "%d %d %d", &imax, &jmax, &kmax ); fscanf( f, "%f %f %f", &valex, &xmin, &xmax ); - data = (float*) malloc ( imax * jmax * kmax * sizeof( float )); - image_data = (unsigned char*) malloc ( imax * jmax * kmax * sizeof( unsigned char )); + data = (float*) HDmalloc ( imax * jmax * kmax * sizeof( float )); + image_data = (unsigned char*) HDmalloc ( imax * jmax * kmax * sizeof( unsigned char )); for ( i = 0; i < imax * jmax * kmax; i++ ) { fscanf( f, "%f ", &value ); data[i] = value; } - fclose( f ); + HDfclose( f ); /*------------------------------------------------------------------------- * transform the data from floating point to unsigned char @@ -719,7 +719,7 @@ static int read_data( const char* fname, /*IN*/ *------------------------------------------------------------------------- */ - f = fopen(data_file, "r"); + f = HDfopen(data_file, "r"); if ( f == NULL ) { printf( "Could not open file %s. Try set $srcdir \n", data_file ); @@ -738,18 +738,18 @@ static int read_data( const char* fname, /*IN*/ if ( image_data ) { - free( image_data ); + HDfree( image_data ); image_data=NULL; } - image_data = (unsigned char*) malloc (w * h * color_planes * sizeof( unsigned char )); + image_data = (unsigned char*) HDmalloc (w * h * color_planes * sizeof( unsigned char )); for (i = 0; i < h * w * color_planes ; i++) { fscanf( f, "%d",&n ); image_data[i] = (unsigned char)n; } - fclose(f); + HDfclose(f); return 1; @@ -794,46 +794,46 @@ static int read_palette(const char* fname, return -1; /* open the input file */ - if (!(file = fopen(data_file, "r"))) + if (!(file = HDfopen(data_file, "r"))) { printf( "Could not open file %s. Try set $srcdir \n", data_file ); return -1; } /* read the file ident string */ - if (fgets(buffer, sizeof(buffer), file) == NULL) + if (HDfgets(buffer, sizeof(buffer), file) == NULL) { - fclose(file); + HDfclose(file); return -1; } /* ensure it matches the palette file ident string */ - if ( strncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 && - strncmp(buffer, STRING_CWPAL, sizeof(STRING_CWPAL) - 1) != 0 ) + if ( HDstrncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 && + HDstrncmp(buffer, STRING_CWPAL, sizeof(STRING_CWPAL) - 1) != 0 ) { - fclose(file); + HDfclose(file); return -1; } /* read the version string */ - if (fgets(buffer, sizeof(buffer), file) == NULL) + if (HDfgets(buffer, sizeof(buffer), file) == NULL) { - fclose(file); + HDfclose(file); return -1; } /* ensure it matches the palette file version string */ - if ( strncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 && - strncmp(buffer, VERSION_CWPAL, sizeof(VERSION_CWPAL) - 1) != 0 ) + if ( HDstrncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 && + HDstrncmp(buffer, VERSION_CWPAL, sizeof(VERSION_CWPAL) - 1) != 0 ) { - fclose(file); + HDfclose(file); return -1; } /* read the number of colors */ - if (fgets(buffer, sizeof(buffer), file) == NULL) + if (HDfgets(buffer, sizeof(buffer), file) == NULL) { - fclose(file); + HDfclose(file); return -1; } @@ -842,22 +842,22 @@ static int read_palette(const char* fname, check for missing version or number of colors in this case it reads the first entry */ - if ( strlen( buffer ) > 4 ) + if ( HDstrlen( buffer ) > 4 ) { - fclose(file); + HDfclose(file); return -1; } if (sscanf(buffer, "%u", &nentries) != 1) { - fclose(file); + HDfclose(file); return -1; } /* ensure there are a sensible number of colors in the palette */ if ((nentries > 256) || (nentries > palette_size)) { - fclose(file); + HDfclose(file); return(-1); } @@ -867,7 +867,7 @@ static int read_palette(const char* fname, /* extract the red, green and blue color components. */ if (fscanf(file, "%u %u %u", &red, &green, &blue) != 3) { - fclose(file); + HDfclose(file); return -1; } /* store this palette entry */ @@ -877,7 +877,7 @@ static int read_palette(const char* fname, } /* close file */ - fclose(file); + HDfclose(file); return nentries; } diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 2b36eb6..59da1f1 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -21,6 +21,8 @@ #define FILE_NAME "test_lite1.h5" #define FILE_NAME2 "test_lite2.h5" +#define FILE_NAME3 "test_lite3.h5" +#define FILE_NAME4 "test_lite4.h5" #define INPUT_FILE "dtype_file.txt" #define DSET0_NAME "2D int array" @@ -367,7 +369,7 @@ static int test_dsets( void ) if ( H5LTread_dataset_string(file_id,DSET7_NAME,data_string_out) < 0 ) goto out; - if ( strcmp(data_string_in,data_string_out) != 0 ) + if ( HDstrcmp(data_string_in,data_string_out) != 0 ) goto out; @@ -536,7 +538,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) if ( H5LTget_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_out ) < 0 ) return -1; - if ( strcmp( attr_str_in, attr_str_out ) != 0 ) + if ( HDstrcmp( attr_str_in, attr_str_out ) != 0 ) { return -1; } @@ -1015,25 +1017,25 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) TESTING("H5LTget_attribute_info"); - dims_out = (hsize_t*) malloc( sizeof(hsize_t) * rank_out ); + if(NULL==(dims_out = (hsize_t*) HDmalloc( sizeof(hsize_t) * rank_out ))) return -1; - if ( H5LTget_attribute_info( loc_id, obj_name, ATTR2_NAME, dims_out, &type_class, - &type_size) < 0 ) + if ( H5LTget_attribute_info( loc_id, obj_name, ATTR2_NAME, dims_out, &type_class, &type_size) < 0 ) { + HDfree( dims_out ); return -1; - - for (i = 0; i < rank_out; i++) - { + } + + for (i = 0; i < rank_out; i++) { if ( dims_out[i] != 5 ) { + HDfree( dims_out ); return -1; } } if ( type_class != H5T_INTEGER ) { + HDfree( dims_out ); return -1; } - - if ( dims_out ) - free( dims_out ); + HDfree( dims_out ); PASSED(); @@ -1066,12 +1068,18 @@ static int test_integers(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); goto out; - if(strcmp(dt_str, "H5T_STD_I8BE")) + } + if(HDstrcmp(dt_str, "H5T_STD_I8BE")) { + HDfree(dt_str); goto out; - free(dt_str); + } + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1117,12 +1125,18 @@ static int test_fps(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_IEEE_F32BE")) + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); goto out; - free(dt_str); + } + if(HDstrcmp(dt_str, "H5T_IEEE_F32BE")) { + HDfree(dt_str); + goto out; + } + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1180,14 +1194,18 @@ static int test_strings(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); goto out; - if(strcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { + } + if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1208,14 +1226,18 @@ static int test_strings(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); goto out; - if(strcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { + } + if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1257,14 +1279,18 @@ static int test_opaques(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1311,7 +1337,7 @@ static int test_enums(void) if(H5Tenum_nameof(dtype, &value1, name1, size)<0) goto out; - if(strcmp(name1, "BLUE")) + if(HDstrcmp(name1, "BLUE")) goto out; if(H5Tenum_valueof(dtype, name2, &value2)<0) @@ -1328,16 +1354,20 @@ static int test_enums(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1373,30 +1403,34 @@ static int test_variables(void) if(H5Tis_variable_str(dtype)) goto out; - + if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0) goto out; - + if(H5Tis_variable_str(dtype)) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); - + HDfree(dt_str); + if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1440,15 +1474,19 @@ static int test_arrays(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) { + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1492,14 +1530,18 @@ static int test_compounds(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); goto out; - if(strcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) { + } + if(HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1509,9 +1551,11 @@ static int test_compounds(void) if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; - if(strcmp(memb_name, "i16_field")) + if(HDstrcmp(memb_name, "i16_field")) { + HDfree(memb_name); goto out; - free(memb_name); + } + HDfree(memb_name); if((memb_class = H5Tget_member_class(dtype, 2))<0) goto out; @@ -1527,6 +1571,121 @@ out: } /*------------------------------------------------------------------------- +* subroutine for test_text_dtype(): test_compound_bug(). Test case for +* issue 7701. +*------------------------------------------------------------------------- +*/ +static int test_compound_bug(void) +{ + hid_t dtype; + H5T_class_t type_class; + int nmembs; + char* memb_name = NULL; + char* dt_str; + size_t str_len; + char text[] = "H5T_COMPOUND { H5T_STD_I32LE \"state_________________________________________________________________________________\"; H5T_STD_I32LE \"desc_________________________________________________________________________________________\"; H5T_VLEN { H5T_COMPOUND { H5T_ENUM { H5T_STD_I16LE; \"ZERO\" 0; \"ONE\" 1; \"TWO\" 2; \"THREE\" 3; } \"type____\"; H5T_STD_I32LE \"sub_______________________________________________________________________________________________________________\"; H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_STR_SPACEPAD; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } \"sub_desc\"; H5T_STD_I32LE \"final___________________________________________________________________________________________________\"; } } \"sub\"; }"; + char text2[] = + "H5T_COMPOUND {\n" + " H5T_STD_I16LE \"state___________________________" + "__________________________________________________" + "____\" : 0;\n" + " H5T_STD_I16LE \"desc____________________________" + "__________________________________________________" + "___________\" : 2;\n" + " H5T_VLEN { H5T_COMPOUND {\n" + " H5T_ENUM { H5T_STD_I16LE; \"ZERO\" 0; \"ONE\" " + "1; \"TWO\" 2; \"THREE\" 3; } \"type____\" : 0;\n" + " H5T_STD_I32LE \"sub___________________________" + "__________________________________________________" + "__________________________________1\" : 4;\n" + " H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_" + "STR_SPACEPAD; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1;" + " } \"sub_desc\" : 8;\n" + " H5T_STD_I32LE \"final_________________________" + "__________________________________________________" + "________________________\" : 16;\n" + " } } \"sub\" : 8;\n" + "}\n"; + + TESTING3(" text for compound type of bug fix"); + + if((dtype = H5LTtext_to_dtype(text, H5LT_DDL))<0) + goto out; + + if((type_class = H5Tget_class(dtype))<0) + goto out; + if(type_class != H5T_COMPOUND) + goto out; + + if((memb_name = H5Tget_member_name(dtype, 2)) == NULL) + goto out; + if(HDstrcmp(memb_name, "sub")) { + HDfree(memb_name); + goto out; + } + HDfree(memb_name); + + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) + goto out; + + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + HDfree(dt_str); + + if(H5Tclose(dtype)<0) + goto out; + + + /* Test similar datatype in another format */ + if((dtype = H5LTtext_to_dtype(text2, H5LT_DDL))<0) + goto out; + + if((type_class = H5Tget_class(dtype))<0) + goto out; + if(type_class != H5T_COMPOUND) + goto out; + + if((nmembs = H5Tget_nmembers(dtype))<0) + goto out; + if(nmembs != 3) + goto out; + + if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) + goto out; + if(HDstrcmp(memb_name, "desc_________________________________________________________________________________________")) { + HDfree(memb_name); + goto out; + } + HDfree(memb_name); + + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) + goto out; + + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + + HDfree(dt_str); + + if(H5Tclose(dtype)<0) + goto out; + + PASSED(); + return 0; + +out: + H5_FAILED(); + return -1; +} + +/*------------------------------------------------------------------------- * subroutine for test_text_dtype(): test_complicated_compound(). *------------------------------------------------------------------------- */ @@ -1543,7 +1702,7 @@ static int test_complicated_compound(void) TESTING3(" text for complicated compound types"); /* Open input file */ - fp = fopen(filename, "r"); + fp = HDfopen(filename, "r"); if(fp == NULL) { printf( "Could not find file %s. Try set $srcdir \n", filename); goto out; @@ -1553,23 +1712,23 @@ static int test_complicated_compound(void) * Library has convenient function getline() but isn't available on * all machines. */ - if((line = (char*)calloc(size, sizeof(char)))==NULL) + if((line = (char*)HDcalloc(size, sizeof(char)))==NULL) goto out; - if(fgets(line, (int)size, fp)==NULL) + if(HDfgets(line, (int)size, fp)==NULL) goto out; - while(strlen(line)==size-1) { + while(HDstrlen(line)==size-1) { size *= 2; if(line) - free(line); - if((line = (char*)calloc(size, sizeof(char)))==NULL) + HDfree(line); + if((line = (char*)HDcalloc(size, sizeof(char)))==NULL) goto out; - if(fseek(fp, 0L, SEEK_SET)!=0) + if(HDfseek(fp, 0L, SEEK_SET)!=0) goto out; - if(fgets(line, (int)size, fp)==NULL) + if(HDfgets(line, (int)size, fp)==NULL) goto out; } - fclose(fp); + HDfclose(fp); fp = NULL; if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0) @@ -1587,7 +1746,7 @@ static int test_complicated_compound(void) goto out; if(line) - free(line); + HDfree(line); PASSED(); return 0; @@ -1595,9 +1754,9 @@ static int test_complicated_compound(void) out: if(line) - free(line); + HDfree(line); if(fp) - fclose(fp); + HDfclose(fp); H5_FAILED(); return -1; @@ -1635,6 +1794,9 @@ static int test_text_dtype(void) if(test_compounds()<0) goto out; + if(test_compound_bug()<0) + goto out; + if(test_complicated_compound()<0) goto out; @@ -1645,6 +1807,314 @@ out: } /*------------------------------------------------------------------------- + * test H5LTpath_valid function + *------------------------------------------------------------------------- + */ +static int test_valid_path(void) +{ + hid_t file_id, group; + herr_t status; + FILE *fp = NULL; + htri_t path_valid; + char path[10]; + const char *data_string_in = "test"; + + TESTING("H5LTpath_valid"); + + /* Create a new file using default properties. */ + + /************************************************************** + * The file structure should look like this: + * + * +----------------------------------+ + * | / | + * +----------------------------------+ + * / | \ \ + * / | \ \ + * / | \ \ + * / | \ G8 (dangled external link) + * / DS \ + * / \ + * G1 G2 + * | --> DS1 | + * / \--> DS3 / \ + * / / \ + * G2 DS4 G7 + * | (hard link (dangled soft link + * | to /G1/DS3) to /G1/G20 ) + * / \ + * / \ + * G5 \ + * (soft link G6 (external link /G1 in FILENAME4) + * to /G2) + * + ****************************************************************/ + + file_id = H5Fcreate(FILE_NAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Create dataset "/DS" + */ + if(H5LTmake_dataset_string(file_id, "DS", data_string_in)<0) + goto out; + + /* + * Create an external dangled link + */ + if(H5Lcreate_external("NonExistant_File.h5", "G8", file_id, "DangledExternalLink", H5P_DEFAULT, H5P_DEFAULT)<0) + goto out; + + /* + * Create a group named "G2" in the file. + */ + if((group = H5Gcreate2(file_id, "G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0) + goto out; + + /* + * Create a dataset named "G2/DS4" in the file. + */ + if(H5LTmake_dataset_string(group, "/G2/DS4", data_string_in)<0) + goto out; + + /* + * Create a soft link + */ + if(H5Lcreate_soft("/G1/G20", file_id, "/G2/G7", H5P_DEFAULT, H5P_DEFAULT) <0) + goto out; + + if(H5Gclose(group)<0) + goto out; + + /* + * Create a group named "G1" in the file. + */ + if((group = H5Gcreate2(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0) + goto out; + + /* + * Create a group named "G1/DS1" in the file. + */ + if(H5LTmake_dataset_string(group, "/G1/DS1", data_string_in)<0) + goto out; + + if(H5Gclose(group)<0) + goto out; + + /* + * Create a group named "/G3/G5" in the file. + */ + if(H5Lcreate_hard(file_id, "/G2/DS4", file_id, "/G1/DS3",H5P_DEFAULT, H5P_DEFAULT)<0) + goto out; + /* + * Create a group named "/G1/G2" in the file. + */ + if((group = H5Gcreate2(file_id, "/G1/G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0) + goto out; + + /* + * Create a soft link + */ + if(H5Lcreate_soft("/G2", file_id, "/G1/G2/G5", H5P_DEFAULT, H5P_DEFAULT)<0) + goto out; + + if(H5Gclose(group)<0) + goto out; + + /* + * Create a group named "/G1/G2/G6" in the file. + */ + if((group = H5Gcreate2(file_id, "/G1/G2/G6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0) + goto out; + + /* + * Create an external link + */ + if(H5Lcreate_external( FILE_NAME4, "G1", group, "ExternalLink", H5P_DEFAULT, H5P_DEFAULT)<0) + goto out; + + if(H5Gclose(group)<0) + goto out; + /* + * Close the file. + */ + status = H5Fclose (file_id); + + /* Create another file for checking external links */ + + /************************************************************** + * The file structure should look like this: + * + * +----+ + * | / | + * +----+ + * | + * | + * | + * G1 + * / \ + * / \ + * DS1 G2 + * (dangled soft link to /G1/G20) + * + ****************************************************************/ + + /* Make external link file */ + file_id = H5Fcreate(FILE_NAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Create a group named "G1" in the file. + */ + if((group = H5Gcreate2(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))<0) + goto out; + /* + * Create a dataset named "G1/DS1" in the file. + */ + if(H5LTmake_dataset_string(group, "/G1/DS1", data_string_in)<0) + goto out; + + /* + * Create a dangling soft link + */ + + if(H5Lcreate_soft("/G1/G2", file_id, "/G1/G20", H5P_DEFAULT, H5P_DEFAULT)<0) + goto out; + + if(H5Gclose(group)<0) + goto out; + + H5Fclose(file_id); + + /* Open input file */ + if((file_id = H5Fopen(FILE_NAME3,H5F_ACC_RDONLY, H5P_DEFAULT))<0) + goto out; + + /************************************** + * CHECK ABSOLUTE PATHS + **************************************/ + if( (path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) { + goto out; + } + + if((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G1/DS3", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE) + goto out; + + /* check soft link points to a valid object*/ + if( (path_valid = H5LTpath_valid(file_id, "/G2/DS4", TRUE)) != TRUE) + goto out; + + /* check if path exist, but not the object */ + if( (path_valid = H5LTpath_valid(file_id, "/G2/G7", FALSE)) != TRUE ) + goto out; + /* check if path exist and if the object exists. It should fail + * since it is a dangling soft link + */ + if( (path_valid = H5LTpath_valid(file_id, "/G2/G7", TRUE)) == TRUE) + goto out; + + /* check soft links */ + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE) + goto out; + + /************************************** + * CHECK RELATIVE PATHS + ***************************************/ + + if( (group = H5Gopen2(file_id, "/G1", H5P_DEFAULT)) < 0) + goto out; + + /* The identifier (file id) is the object itself, i.e. "." */ + + if((path_valid = H5LTpath_valid(file_id, ".", FALSE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, ".", TRUE)) != TRUE) + goto out; + + /* The identifier (group id) is the object itself, i.e. "." */ + + if( (path_valid = H5LTpath_valid(group, ".", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(group, "DS3", FALSE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(group, "DS3", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE) + goto out; + + /* Check the "./" case */ + if( (path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE) + goto out; + + /* Should fail, does not exist */ + if( (path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE) + goto out; + + /* Should fail, does not exist */ + if( (path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE) + goto out; + + if(H5Gclose(group)<0) + goto out; + + /***************************** + * Check external links + *****************************/ + + /* The dangled external link path is valid */ + if( (path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", FALSE)) != TRUE) + goto out; + + /* The file however does not exists, so the link dangles -> should return false */ + if( (path_valid = H5LTpath_valid(file_id, "/DangledExternalLink", TRUE)) == TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", FALSE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/DS1", TRUE)) != TRUE) + goto out; + + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", FALSE)) != TRUE) + goto out; + + /* Should fail, does not exist */ + if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G6/ExternalLink/G20", TRUE)) == TRUE) + goto out; + + if(H5Fclose(file_id)<0) + goto out; + + PASSED(); + return 0; + + out: + H5_FAILED(); + return -1; +} + + +/*------------------------------------------------------------------------- * the main program *------------------------------------------------------------------------- */ @@ -1659,7 +2129,7 @@ int main( void ) nerrors += test_attr(); /* test text-dtype functions */ - nerrors += test_text_dtype(); + nerrors += test_valid_path(); /* check for errors */ if (nerrors) @@ -1672,4 +2142,3 @@ error: } - diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 3c258c1..9d3074d 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -72,7 +72,7 @@ static particle_t testPart[NRECORDS] = { */ static int cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf ) { - if ( ( strcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || + if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || rbuf[i].pressure != wbuf[j].pressure || @@ -127,7 +127,7 @@ static int create_hl_table(hid_t fid) /* Define field information */ const char *field_names[NFIELDS] = - { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; + { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; hsize_t chunk_size = 10; @@ -182,7 +182,7 @@ static int test_create_close(hid_t fid) /* Create a datatype for the particle struct */ part_t = make_particle_type(); - assert(part_t != -1); + HDassert(part_t != -1); /* Create the table */ table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1); @@ -460,7 +460,7 @@ static int test_big_table(hid_t fid) /* Create a datatype for the particle struct */ part_t = make_particle_type(); - assert(part_t != -1); + HDassert(part_t != -1); /* Create a new table */ table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, (hsize_t)33, -1); @@ -712,7 +712,7 @@ static int test_opaque(hid_t fid) if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 ) return -1; - assert(part_t != -1); + HDassert(part_t != -1); /* Tag the opaque datatype */ if ( H5Tset_tag(part_t, "Opaque Particle" ) < 0) @@ -787,7 +787,7 @@ test_compress(void) /* Create a datatype for the particle struct */ part_t = make_particle_type(); - assert(part_t != -1); + HDassert(part_t != -1); /* Create a new table with compression level 8 */ table = H5PTcreate_fl(fid1, "Compressed Test Dataset", part_t, (hsize_t)80, 8); @@ -1059,7 +1059,7 @@ int main(void) /* create a file using default properties */ fid=H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - puts("Testing packet table"); + HDputs("Testing packet table"); /* run tests */ if ( test_packet_table(fid) < 0) diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 0fc4c84..e3e040e 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -129,8 +129,8 @@ static hid_t h5file_open(const char *fname, unsigned flags) /* open */ if ((fid = H5Fopen(data_file,flags,H5P_DEFAULT))<0) { - fprintf(stderr,"Error: Cannot open file <%s>\n",data_file ); - exit(1); + HDfprintf(stderr,"Error: Cannot open file <%s>\n",data_file ); + HDexit(1); } return fid; @@ -142,16 +142,16 @@ static hid_t h5file_open(const char *fname, unsigned flags) */ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ) { - if ( ( strcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || + if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || rbuf[i].pressure != wbuf[j].pressure || rbuf[i].temperature != wbuf[j].temperature ) { - fprintf(stderr,"read and write buffers have differences\n"); - fprintf(stderr,"%s %ld %f %f %d\n", + HDfprintf(stderr,"read and write buffers have differences\n"); + HDfprintf(stderr,"%s %ld %f %f %d\n", rbuf[i].name,rbuf[i].longi,rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati); - fprintf(stderr,"%s %ld %f %f %d\n", + HDfprintf(stderr,"%s %ld %f %f %d\n", wbuf[j].name,wbuf[j].longi,wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati); return -1; } @@ -495,9 +495,9 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ if(do_write) - strcpy(tname,"table2"); + HDstrcpy(tname,"table2"); else - strcpy(tname,"table1"); + HDstrcpy(tname,"table1"); rstart=0; rrecords=8; @@ -645,7 +645,7 @@ static int test_table(hid_t fid, int do_write) wbufd[i].longi = wbuf[i].longi; wbufd[i].pressure = wbuf[i].pressure; wbufd[i].temperature = wbuf[i].temperature; - strcpy(wbufd[i].name, wbuf[i].name ); + HDstrcpy(wbufd[i].name, wbuf[i].name ); } @@ -1027,9 +1027,9 @@ static int test_table(hid_t fid, int do_write) rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] ) { - fprintf(stderr,"%ld %f %d\n", + HDfprintf(stderr,"%ld %f %d\n", rbuf[i].longi,rbuf[i].pressure,rbuf[i].lati); - fprintf(stderr,"%ld %f %d\n", + HDfprintf(stderr,"%ld %f %d\n", position_in[i].longi,pressure_in[i],position_in[i].lati); goto out; } @@ -1144,7 +1144,7 @@ static int test_table(hid_t fid, int do_write) /* Compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[i].pressure ) { goto out; } @@ -1153,7 +1153,7 @@ static int test_table(hid_t fid, int do_write) /* reset buffer */ for( i = 0; i < NRECORDS; i++ ) { - strcpy( namepre_out[i].name, "\0" ); + HDstrcpy( namepre_out[i].name, "\0" ); namepre_out[i].pressure = -1; } @@ -1173,7 +1173,7 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < 3; i++ ) { hsize_t iistart = start; - if ( ( strcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[iistart+i].pressure ) { goto out; } @@ -1351,7 +1351,7 @@ static int test_table(hid_t fid, int do_write) /* compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[i].pressure ) { goto out; } @@ -1360,7 +1360,7 @@ static int test_table(hid_t fid, int do_write) /* reset buffer */ for( i = 0; i < NRECORDS; i++ ) { - strcpy( namepre_out[i].name, "\0" ); + HDstrcpy( namepre_out[i].name, "\0" ); namepre_out[i].pressure = -1; } @@ -1382,7 +1382,7 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < 3; i++ ) { int iistart = (int) start; - if ( ( strcmp( namepre_out[i].name, wbuf[iistart+i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, wbuf[iistart+i].name ) != 0 ) || namepre_out[i].pressure != wbuf[iistart+i].pressure ) { goto out; } @@ -1423,7 +1423,7 @@ static int test_table(hid_t fid, int do_write) /* compare the extracted table with the original array */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || + if ( ( HDstrcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || rbuf2[i].lati != wbuf[i].lati || rbuf2[i].longi != wbuf[i].longi || rbuf2[i].pressure != wbuf[i].pressure || @@ -1464,7 +1464,7 @@ static int test_table(hid_t fid, int do_write) /* compare the extracted table with the original array */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || + if ( ( HDstrcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || rbuf3[i].lati != wbuf[i].lati || rbuf3[i].longi != wbuf[i].longi || rbuf3[i].temperature != wbuf[i].temperature ) { @@ -1509,10 +1509,10 @@ static int test_table(hid_t fid, int do_write) TESTING2("getting field info"); /* alocate */ - names_out = (char**) malloc( sizeof(char*) * (size_t)NFIELDS ); + names_out = (char**) HDmalloc( sizeof(char*) * (size_t)NFIELDS ); for ( i = 0; i < NFIELDS; i++) { - names_out[i] = (char*) malloc( sizeof(char) * 255 ); + names_out[i] = (char*) HDmalloc( sizeof(char) * 255 ); } /* Get field info */ @@ -1521,7 +1521,7 @@ static int test_table(hid_t fid, int do_write) for ( i = 0; i < NFIELDS; i++) { - if ( (strcmp( field_names[i], names_out[i] ) != 0)) { + if ( (HDstrcmp( field_names[i], names_out[i] ) != 0)) { goto out; } } @@ -1529,9 +1529,9 @@ static int test_table(hid_t fid, int do_write) /* release */ for ( i = 0; i < NFIELDS; i++) { - free ( names_out[i] ); + HDfree ( names_out[i] ); } - free ( names_out ); + HDfree ( names_out ); PASSED(); @@ -1564,7 +1564,7 @@ int main(void) /* create a file using default properties */ fid=H5Fcreate("test_table.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); - puts("Testing table with file creation mode (read/write in native architecture):"); + HDputs("Testing table with file creation mode (read/write in native architecture):"); /* test, do write */ if (test_table(fid,1)<0) @@ -1577,7 +1577,7 @@ int main(void) * test2: open a file written in test1 on a big-endian machine *------------------------------------------------------------------------- */ - puts("Testing table with file open mode (read big-endian data):"); + HDputs("Testing table with file open mode (read big-endian data):"); fid=h5file_open(TEST_FILE_BE,flags); @@ -1592,7 +1592,7 @@ int main(void) * test3: open a file written in test1 on a little-endian machine *------------------------------------------------------------------------- */ - puts("Testing table with file open mode (read little-endian data):"); + HDputs("Testing table with file open mode (read little-endian data):"); fid=h5file_open(TEST_FILE_LE,flags); @@ -1607,7 +1607,7 @@ int main(void) * test4: open a file written in test1 on the Cray T3 machine *------------------------------------------------------------------------- */ - puts("Testing table with file open mode (read Cray data):"); + HDputs("Testing table with file open mode (read Cray data):"); fid=h5file_open(TEST_FILE_CRAY,flags); diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index e2b605d..4fc83b7 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_HL_TOOLS) #----------------------------------------------------------------------------- @@ -20,6 +20,7 @@ INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5) ADD_EXECUTABLE (gif2h5 ${GIF2H5_SRCS}) TARGET_NAMING (gif2h5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +SET_TARGET_PROPERTIES (gif2h5 PROPERTIES FOLDER tools/hl) #-- Add h52gif program SET (hdf2gif_SRCS @@ -29,6 +30,7 @@ SET (hdf2gif_SRCS ADD_EXECUTABLE (h52gif ${hdf2gif_SRCS}) TARGET_NAMING (h52gif ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +SET_TARGET_PROPERTIES (h52gif PROPERTIES FOLDER tools/hl) # -------------------------------------------------------------------- # This executable can generate the actual test files - Currently not @@ -39,6 +41,7 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + SET_TARGET_PROPERTIES (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) # ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index db4388b..2cfefcc 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -179,6 +179,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -199,10 +200,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in index ae888c6..c857fed 100644 --- a/hl/tools/gif2h5/Makefile.in +++ b/hl/tools/gif2h5/Makefile.in @@ -189,6 +189,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -209,10 +210,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c index 1225613..810be78 100644 --- a/hl/tools/gif2h5/gif2hdf.c +++ b/hl/tools/gif2h5/gif2hdf.c @@ -17,6 +17,7 @@ #include <stdlib.h> #include "gif.h" +#include "h5tools.h" #include "h5tools_utils.h" @@ -49,6 +50,9 @@ main(int argv , char *argc[]) GifMemoryStruct.GifApplicationExtension = NULL; GifMemoryStruct.GifCommentExtension = NULL; + /* Initialize h5tools lib */ + h5tools_init(); + if ( argc[1] && (strcmp("-V",argc[1])==0) ) { print_version("gif2h5"); diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index 907fb80..7995bb4 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -37,7 +37,7 @@ #include "gif.h" -#define VERSION "1.00" +#define GIF2VERSION "1.00" GIFTOMEM Gif2Mem(BYTE *MemGif) diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index cc8e864..090d657 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -17,6 +17,7 @@ #include <assert.h> #include "gif.h" #include "H5IMpublic.h" +#include "h5tools.h" #include "h5tools_utils.h" @@ -70,6 +71,9 @@ int main(int argc , char **argv) char *image_name = NULL; int idx; + /* Initialize h5tools lib */ + h5tools_init(); + if ( argv[1] && (strcmp("-V",argv[1])==0) ) { print_version("gif2h5"); diff --git a/hl/tools/h5watch/Makefile.in b/hl/tools/h5watch/Makefile.in index 3c67028..745b6a4 100644 --- a/hl/tools/h5watch/Makefile.in +++ b/hl/tools/h5watch/Makefile.in @@ -186,6 +186,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -206,10 +207,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ |