summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
commite767f44e953047297fece364218147c908e8b585 (patch)
treed4b6909f14b78bb732b6947adc46ac3cd3ca54f6 /hl
parent949649a2b6e00297cbdc49437e70a27e455e92d2 (diff)
parenta08ab621febde7b09e4d86eab80cb029c123e9f6 (diff)
downloadhdf5-e767f44e953047297fece364218147c908e8b585.zip
hdf5-e767f44e953047297fece364218147c908e8b585.tar.gz
hdf5-e767f44e953047297fece364218147c908e8b585.tar.bz2
Merge remote-tracking branch 'origin/develop' into monotonic_timer
Diffstat (limited to 'hl')
-rw-r--r--hl/CMakeLists.txt21
-rw-r--r--hl/Makefile.am20
-rw-r--r--hl/c++/CMakeLists.txt10
-rw-r--r--hl/c++/Makefile.am10
-rw-r--r--hl/c++/examples/CMakeLists.txt36
-rw-r--r--hl/c++/examples/CMakeTests.cmake4
-rw-r--r--hl/c++/examples/Makefile.am4
-rw-r--r--hl/c++/examples/run-hlc++-ex.sh.in30
-rw-r--r--hl/c++/src/CMakeLists.txt108
-rw-r--r--hl/c++/test/CMakeLists.txt53
-rw-r--r--hl/c++/test/CMakeTests.cmake9
-rw-r--r--hl/c++/test/ptableTest.cpp134
-rw-r--r--hl/c++/test/ptableTest.h2
-rw-r--r--hl/examples/CMakeLists.txt19
-rw-r--r--hl/examples/CMakeTests.cmake65
-rw-r--r--hl/examples/Makefile.am4
-rw-r--r--hl/examples/run-hlc-ex.sh.in29
-rw-r--r--hl/fortran/CMakeLists.txt10
-rw-r--r--hl/fortran/Makefile.am10
-rw-r--r--hl/fortran/examples/CMakeLists.txt51
-rw-r--r--hl/fortran/examples/CMakeTests.cmake13
-rw-r--r--hl/fortran/examples/Makefile.am4
-rw-r--r--hl/fortran/examples/ex_ds1.f9042
-rw-r--r--hl/fortran/examples/run-hlfortran-ex.sh.in4
-rw-r--r--hl/fortran/src/CMakeLists.txt298
-rw-r--r--hl/fortran/src/H5DSfc.c62
-rw-r--r--hl/fortran/src/H5DSff.F90167
-rw-r--r--hl/fortran/src/H5HL_buildiface.F9066
-rw-r--r--hl/fortran/src/H5IMff.F90106
-rw-r--r--hl/fortran/src/H5LTf90proto.h12
-rw-r--r--hl/fortran/src/H5LTfc.c12
-rw-r--r--hl/fortran/src/H5LTff.F9090
-rw-r--r--hl/fortran/src/H5TBfc.c20
-rw-r--r--hl/fortran/src/H5TBff.F90140
-rw-r--r--hl/fortran/src/Makefile.am16
-rw-r--r--hl/fortran/test/CMakeLists.txt118
-rw-r--r--hl/fortran/test/CMakeTests.cmake165
-rw-r--r--hl/fortran/test/Makefile.am14
-rw-r--r--hl/fortran/test/tstds.F9036
-rw-r--r--hl/fortran/test/tstimage.F902
-rw-r--r--hl/fortran/test/tstlite.F9016
-rw-r--r--hl/fortran/test/tsttable.F9016
-rw-r--r--hl/src/CMakeLists.txt102
-rw-r--r--hl/src/H5DO.c254
-rw-r--r--hl/src/H5DOpublic.h23
-rw-r--r--hl/src/H5DS.c309
-rw-r--r--hl/src/H5IM.c41
-rw-r--r--hl/src/H5LD.c8
-rw-r--r--hl/src/H5LDprivate.h17
-rw-r--r--hl/src/H5LT.c309
-rw-r--r--hl/src/H5LTanalyze.c326
-rw-r--r--hl/src/H5LTanalyze.l4
-rw-r--r--hl/src/H5LTparse.c1388
-rw-r--r--hl/src/H5LTparse.h155
-rw-r--r--hl/src/H5LTpublic.h2
-rw-r--r--hl/src/H5PT.c2
-rw-r--r--hl/src/H5TB.c60
-rw-r--r--hl/test/CMakeLists.txt93
-rw-r--r--hl/test/CMakeTests.cmake90
-rw-r--r--hl/test/Makefile.am8
-rw-r--r--hl/test/dectris_hl_perf.c691
-rw-r--r--hl/test/gen_test_ds.c22
-rw-r--r--hl/test/gen_test_ld.c30
-rw-r--r--hl/test/h5hltest.h4
-rw-r--r--hl/test/test_ds.c258
-rw-r--r--hl/test/test_dset_append.c1088
-rw-r--r--hl/test/test_dset_opt.c2028
-rw-r--r--hl/test/test_file_image.c92
-rw-r--r--hl/test/test_h5do_compat.c286
-rw-r--r--hl/test/test_image.c62
-rw-r--r--hl/test/test_ld.c1134
-rw-r--r--hl/test/test_lite.c176
-rw-r--r--hl/test/test_packet.c30
-rw-r--r--hl/test/test_packet_vlen.c810
-rw-r--r--hl/test/test_table.c146
-rw-r--r--hl/tools/CMakeLists.txt8
-rw-r--r--hl/tools/gif2h5/CMakeLists.txt86
-rw-r--r--hl/tools/gif2h5/CMakeTests.cmake36
-rw-r--r--hl/tools/gif2h5/Makefile.am16
-rw-r--r--hl/tools/gif2h5/decompress.c77
-rw-r--r--hl/tools/gif2h5/gif.h131
-rw-r--r--hl/tools/gif2h5/gif2hdf.c6
-rw-r--r--hl/tools/gif2h5/gif2mem.c49
-rw-r--r--hl/tools/gif2h5/gifread.c92
-rw-r--r--hl/tools/gif2h5/h52giftest.sh.in14
-rw-r--r--hl/tools/gif2h5/hdf2gif.c65
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c98
-rw-r--r--hl/tools/gif2h5/writehdf.c6
-rw-r--r--hl/tools/h5watch/CMakeLists.txt79
-rw-r--r--hl/tools/h5watch/CMakeTests.cmake98
-rw-r--r--hl/tools/h5watch/Makefile.am27
-rw-r--r--hl/tools/h5watch/extend_dset.c8
-rw-r--r--hl/tools/h5watch/h5watch.c132
-rw-r--r--hl/tools/h5watch/h5watchgentest.c30
-rw-r--r--hl/tools/h5watch/swmr_check_compat_vfd.c4
-rw-r--r--hl/tools/h5watch/testh5watch.sh.in121
-rw-r--r--hl/tools/testfiles/w-err-cmpd1.err (renamed from hl/tools/testfiles/w-err-cmpd3.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd2.err (renamed from hl/tools/testfiles/w-err-cmpd4.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd3.err (renamed from hl/tools/testfiles/w-err-cmpd1.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd4.err (renamed from hl/tools/testfiles/w-err-cmpd2.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd5.err1
-rw-r--r--hl/tools/testfiles/w-err-dset-nomax.err (renamed from hl/tools/testfiles/w-err-dset-nomax.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-dset-none.err (renamed from hl/tools/testfiles/w-err-dset-none.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-dset1.err (renamed from hl/tools/testfiles/w-err-dset1.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-dset2.err (renamed from hl/tools/testfiles/w-err-dset2.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-file.err (renamed from hl/tools/testfiles/w-err-file.ddl)0
-rw-r--r--hl/tools/testfiles/w-err-std.ddl (renamed from hl/tools/testfiles/w-err-cmpd5.ddl)0
107 files changed, 5595 insertions, 7693 deletions
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt
index a47e023..70c458d 100644
--- a/hl/CMakeLists.txt
+++ b/hl/CMakeLists.txt
@@ -1,32 +1,25 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL C CXX)
-
-#-----------------------------------------------------------------------------
-# Apply Definitions to compiler in this directory and below
-#-----------------------------------------------------------------------------
-add_definitions (${HDF_EXTRA_C_FLAGS})
-
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL C)
#-----------------------------------------------------------------------------
# List Source files
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src )
-add_subdirectory (${HDF5_HL_SOURCE_DIR}/src ${HDF5_HL_BINARY_DIR}/src)
+add_subdirectory (src)
#-- Build the High level Tools
if (HDF5_BUILD_TOOLS)
- add_subdirectory (${HDF5_HL_SOURCE_DIR}/tools ${HDF5_HL_BINARY_DIR}/tools)
+ add_subdirectory (tools)
endif ()
#-- Add High Level Examples
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_HL_SOURCE_DIR}/examples ${HDF5_HL_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
#-- Build the Unit testing if requested
if (NOT HDF5_EXTERNALLY_CONFIGURED)
- if (BUILD_TESTING)
- add_subdirectory (${HDF5_HL_SOURCE_DIR}/test ${HDF5_HL_BINARY_DIR}/test)
+ if (BUILD_TESTING AND HDF5_TEST_SERIAL)
+ add_subdirectory (test)
endif ()
endif ()
diff --git a/hl/Makefile.am b/hl/Makefile.am
index aee1f86..0bf8dac 100644
--- a/hl/Makefile.am
+++ b/hl/Makefile.am
@@ -10,7 +10,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-#
+#
# This makefile mostly just reinvokes make in the various subdirectories
# but does so in the correct order. You can alternatively invoke make from
# each subdirectory manually.
@@ -31,11 +31,27 @@ endif
if BUILD_CXX_CONDITIONAL
CXX_DIR = c++
endif
+if BUILD_TESTS_CONDITIONAL
+ TEST_DIR = test
+else
+ TEST_DIR =
+endif
+if BUILD_TOOLS_CONDITIONAL
+ TOOLS_DIR = tools
+else
+ TOOLS_DIR =
+endif
## Don't recurse into any subdirectories if HDF5 is not configured to
## use the HL library
if BUILD_HDF5_HL_CONDITIONAL
- SUBDIRS=src test tools $(CXX_DIR) $(FORTRAN_DIR)
+ SUBDIRS=src $(TEST_DIR) $(TOOLS_DIR) $(CXX_DIR) $(FORTRAN_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
+
endif
DIST_SUBDIRS=src test tools c++ fortran examples
diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt
index 91bfa14..4e55078 100644
--- a/hl/c++/CMakeLists.txt
+++ b/hl/c++/CMakeLists.txt
@@ -1,16 +1,16 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_CPP)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_CPP CXX)
#-----------------------------------------------------------------------------
# Main HL lib is in /src
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/src ${HDF5_HL_CPP_BINARY_DIR}/src)
+add_subdirectory (src)
# --------------------------------------------------------------------
# Add in the examples for the Packet Table codes
# --------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/examples ${HDF5_HL_CPP_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
# --------------------------------------------------------------------
@@ -18,5 +18,5 @@ endif ()
# --------------------------------------------------------------------
if (BUILD_TESTING)
- add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/test ${HDF5_HL_CPP_BINARY_DIR}/test)
+ add_subdirectory (test)
endif ()
diff --git a/hl/c++/Makefile.am b/hl/c++/Makefile.am
index 1968bf5..6239a4c 100644
--- a/hl/c++/Makefile.am
+++ b/hl/c++/Makefile.am
@@ -14,11 +14,17 @@
## Run automake to generate a Makefile.in from this file.
#
# High-Level API C++ Makefile(.in)
-#
+#
include $(top_srcdir)/config/commence.am
-SUBDIRS=src test
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+else
+ TESTSERIAL_DIR=
+endif
+
+SUBDIRS=src $(TESTSERIAL_DIR)
DIST_SUBDIRS=src test examples
# Install examples
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt
index 33ad1e5..22c9973 100644
--- a/hl/c++/examples/CMakeLists.txt
+++ b/hl/c++/examples/CMakeLists.txt
@@ -1,26 +1,28 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_CPP_EXAMPLES)
-
-#-----------------------------------------------------------------------------
-# Setup include Directories
-#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
-INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_DIR}/src)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_CPP_EXAMPLES CXX)
# --------------------------------------------------------------------
# Add in the examples for the Packet Table codes
# --------------------------------------------------------------------
add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp)
-TARGET_NAMING (ptExampleFL STATIC)
-TARGET_C_PROPERTIES (ptExampleFL STATIC " " " ")
-target_link_libraries (
- ptExampleFL
- ${HDF5_HL_CPP_LIB_TARGET}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_LIB_TARGET}
-)
+target_include_directories (ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (ptExampleFL STATIC)
+ target_link_libraries (ptExampleFL PRIVATE
+ ${HDF5_HL_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (ptExampleFL SHARED)
+ target_link_libraries (ptExampleFL PRIVATE
+ ${HDF5_HL_CPP_LIBSH_TARGET}
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp)
-if (BUILD_TESTING)
+if (BUILD_TESTING AND HDF5_TEST_CPP AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL)
include (CMakeTests.cmake)
endif ()
diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake
index 103ec2b..7bc614b 100644
--- a/hl/c++/examples/CMakeTests.cmake
+++ b/hl/c++/examples/CMakeTests.cmake
@@ -21,12 +21,14 @@ add_test (
COMMAND ${CMAKE_COMMAND}
-E remove
PTcppexampleFL.h5
+ ptExampleFL.txt
)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_CPP_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>)
+ add_test (NAME HL_CPP_ex_ptExampleFL COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:ptExampleFL>)
else ()
add_test (NAME HL_CPP_ex_ptExampleFL COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:ptExampleFL>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
diff --git a/hl/c++/examples/Makefile.am b/hl/c++/examples/Makefile.am
index ce719f5..7234bfc 100644
--- a/hl/c++/examples/Makefile.am
+++ b/hl/c++/examples/Makefile.am
@@ -33,8 +33,8 @@ CXX_API=yes
# Where to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
-EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c++
-EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
+EXAMPLEDIR=${DESTDIR}$(examplesdir)/hl/c++
+EXAMPLETOPDIR=${DESTDIR}$(examplesdir)/hl
# How to build programs using h5c++
$(EXTRA_PROG): $(H5CPP)
diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in
index 9539724..4aa231f 100644
--- a/hl/c++/examples/run-hlc++-ex.sh.in
+++ b/hl/c++/examples/run-hlc++-ex.sh.in
@@ -18,7 +18,7 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# This script will compile and run the c++ examples from source files #
-# installed in .../share/hdf5_examples/hl/c++ using h5c++. The #
+# installed in @examplesdir@/hl/c++ using h5c++. The #
# order for running programs with RunTest in the MAIN section below is taken #
# from the Makefile. The order is important since some of the test programs #
# use data files created by earlier test programs. Any future additions should #
@@ -29,9 +29,33 @@
# Initializations
EXIT_SUCCESS=0
EXIT_FAILURE=1
+
+#
+# Try to derive the path to the installation $prefix established
+# by ./configure relative to the examples directory established by
+# ./configure. If successful, set `prefix_relto_examplesdir` to the
+# relative path. Otherwise, set `prefix_relto_examplesdir` to the
+# absolute installation $prefix.
+#
+# This script uses the value of `prefix` in the user's environment, if
+# it is set, below. The content of $() is evaluated in a sub-shell, so
+# if `prefix` is set in the user's environment, the shell statements in
+# $() won't clobbered it.
+#
+prefix_relto_examplesdir=$(
+prefix=@prefix@
+examplesdir=@examplesdir@
+if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then
+ echo $(echo ${examplesdir##${prefix}/} | \
+ sed 's,[^/][^/]*,..,g')
+else
+ echo $prefix
+fi
+)
+
# Where the tool is installed.
# default is relative path to installed location of the tools
-prefix="${prefix:-@prefix@}"
+prefix="${prefix:-../../${prefix_relto_examplesdir}}"
AR="@AR@"
RANLIB="@RANLIB@"
H5TOOL="h5c++" # The tool name
@@ -74,5 +98,5 @@ rm *.o
rm *.h5
echo
-exit $EXIT_VALUE
+exit $EXIT_VALUE
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 38604cd..fbabc86 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -1,46 +1,41 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_CPP_SRC)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_CPP_SRC CXX)
#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
-INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR})
set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp)
set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h)
-add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES})
-TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC " " " ")
-target_link_libraries (
- ${HDF5_HL_CPP_LIB_TARGET}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_LIB_TARGET}
-)
-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} STATIC)
-set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES
- FOLDER libraries/hl
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-set (install_targets ${HDF5_HL_CPP_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES})
+ target_include_directories (${HDF5_HL_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_options(${HDF5_HL_CPP_LIB_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}")
+ TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ 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} STATIC 0)
+ set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
+ set (install_targets ${HDF5_HL_CPP_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES})
- TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIBSH_TARGET} SHARED " " " ")
- target_link_libraries (
- ${HDF5_HL_CPP_LIBSH_TARGET}
- ${HDF5_HL_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
+ target_include_directories (${HDF5_HL_CPP_LIBSH_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_HL_CPP_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_CXX_FLAGS}")
+ target_compile_definitions(${HDF5_HL_CPP_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB")
+ TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIBSH_TARGET} SHARED)
+ target_link_libraries (${HDF5_HL_CPP_LIBSH_TARGET} PUBLIC ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIBSH_TARGET}")
- H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED ${HDF5_HL_CXX_PACKAGE_SOVERSION})
- set_target_properties (${HDF5_HL_CPP_LIBSH_TARGET} PROPERTIES
- FOLDER libraries/hl
- COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
- )
+ H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED "HL_CXX")
+ set_target_properties (${HDF5_HL_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl)
set (install_targets ${install_targets} ${HDF5_HL_CPP_LIBSH_TARGET})
endif ()
@@ -63,7 +58,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlcpplibraries)
+ endif ()
install (
TARGETS
@@ -77,3 +74,52 @@ if (HDF5_EXPORTED_TARGETS)
INCLUDES DESTINATION include
)
endif ()
+
+#-----------------------------------------------------------------------------
+# Create pkgconfig files
+#-----------------------------------------------------------------------------
+set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (_PKG_CONFIG_EXEC_PREFIX \${prefix})
+set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib)
+set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include)
+set (_PKG_CONFIG_LIBNAME "${HDF5_HL_CPP_LIB_CORENAME}")
+set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
+
+set (_PKG_CONFIG_LIBS_PRIVATE)
+
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+endif ()
+if (BUILD_SHARED_LIBS)
+ set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+endif ()
+
+set (_PKG_CONFIG_REQUIRES "${HDF5_HL_LIB_CORENAME}")
+set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_HL_LIB_CORENAME}")
+
+configure_file (
+ ${HDF_RESOURCES_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ @ONLY
+)
+install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
+ COMPONENT hlcpplibraries
+)
+
+if (NOT WIN32 AND NOT MINGW)
+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER})
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT hlcpplibraries
+ )
+endif ()
+
diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt
index a2f9429..5c224a8 100644
--- a/hl/c++/test/CMakeLists.txt
+++ b/hl/c++/test/CMakeLists.txt
@@ -1,31 +1,30 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_CPP_TEST)
-
-#-----------------------------------------------------------------------------
-# Setup include Directories
-#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
-INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/c++/src)
-
-# --------------------------------------------------------------------
-# Add in the unit tests for the packet table c++ wrapper
-# --------------------------------------------------------------------
-
-INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
-INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test)
-INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_CPP_TEST CXX)
add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp)
-TARGET_C_PROPERTIES (hl_ptableTest STATIC " " " ")
-TARGET_NAMING (hl_ptableTest STATIC)
-target_link_libraries (
- hl_ptableTest
- ${HDF5_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_CPP_LIB_TARGET}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_HL_CPP_LIB_TARGET}
-)
+target_compile_options(hl_ptableTest PRIVATE "${HDF5_CMAKE_CXX_FLAGS}")
+target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_ptableTest STATIC)
+ target_link_libraries (hl_ptableTest PRIVATE
+ ${HDF5_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_HL_CPP_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (hl_ptableTest SHARED)
+ target_link_libraries (hl_ptableTest PRIVATE
+ ${HDF5_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_CPP_LIBSH_TARGET}
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_HL_CPP_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp)
-include (CMakeTests.cmake)
+if (HDF5_TEST_CPP AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake
index 785abca..3d0f93a 100644
--- a/hl/c++/test/CMakeTests.cmake
+++ b/hl/c++/test/CMakeTests.cmake
@@ -16,10 +16,16 @@
##############################################################################
##############################################################################
+add_test (
+ NAME HL_CPP_ptableTest-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${example}.txt
+)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_CPP_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>)
+ add_test (NAME HL_CPP_ptableTest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_ptableTest>)
else ()
add_test (NAME HL_CPP_ptableTest COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:hl_ptableTest>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
@@ -30,3 +36,4 @@ else ()
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
+set_tests_properties (HL_CPP_ptableTest PROPERTIES DEPENDS HL_CPP_ptableTest-clear-objects)
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp
index 340912e..52f3a6b 100644
--- a/hl/c++/test/ptableTest.cpp
+++ b/hl/c++/test/ptableTest.cpp
@@ -36,22 +36,22 @@ int main(void)
}
else {
- num_errors += BasicTest();
+ num_errors += BasicTest();
- num_errors += TestCompoundDatatype();
+ num_errors += TestCompoundDatatype();
- num_errors += TestGetPacket();
+ num_errors += TestGetPacket();
- num_errors += TestGetNext();
+ num_errors += TestGetNext();
- num_errors += TestCompress();
+ num_errors += TestCompress();
- num_errors += TestErrors();
+ num_errors += TestErrors();
- num_errors += SystemTest();
+ num_errors += SystemTest();
- /* Test data corruption in packed structs */
- num_errors += TestHDFFV_9758();
+ /* Test data corruption in packed structs */
+ num_errors += TestHDFFV_9758();
/* Terminate access to the file. */
err = H5Fclose(fileID);
@@ -81,7 +81,8 @@ int BasicTest()
hsize_t count;
int error;
- TESTING("basic functionality")
+ printf("Testing %-62s", "basic functionality");
+ HDfflush(stdout);
FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1);
if(! wrapper.IsValid())
@@ -137,10 +138,11 @@ int TestCompoundDatatype()
hsize_t count;
int error;
- TESTING("compound datatypes")
+ printf("Testing %-62s", "compound datatypes");
+ HDfflush(stdout);
/* Create compound datatype */
- typedef struct compoundType
+ typedef struct
{
short a, b, c;
int e;
@@ -206,7 +208,8 @@ int TestGetNext()
int records[2];
int i;
- TESTING("GetNextPacket")
+ printf("Testing %-62s", "GetNextPacket");
+ HDfflush(stdout);
/* Create a dataset */
FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500);
@@ -264,24 +267,25 @@ error:
const char* COMPRESS_PT("/compressTest");
int TestCompress()
{
+#ifdef H5_HAVE_FILTER_DEFLATE
unsigned int flags = 0;
unsigned int config = 0;
size_t cd_nelemts = 0;
- TESTING("compression")
-#ifdef H5_HAVE_FILTER_DEFLATE
+ printf("Testing %-62s", "compression");
+ HDfflush(stdout);
try {
- /* Prepare property list to set compression, randomly use deflate */
- DSetCreatPropList dscreatplist;
- dscreatplist.setDeflate(6);
+ /* Prepare property list to set compression, randomly use deflate */
+ DSetCreatPropList dscreatplist;
+ dscreatplist.setDeflate(6);
/* Create packet table with compression. */
FL_PacketTable wrapper(fileID, COMPRESS_PT, H5T_NATIVE_CHAR, 100, dscreatplist.getId());
- /* Close the property list */
- dscreatplist.close();
+ /* Close the property list */
+ dscreatplist.close();
- /* Verify that the deflate filter is set */
+ /* Verify that the deflate filter is set */
/* Create an HDF5 C++ file object */
H5File file;
@@ -293,10 +297,10 @@ int TestCompress()
DSetCreatPropList dcpl = dset.getCreatePlist();
- char filter_name[8];
+ char filter_name[8];
dcpl.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 8, filter_name, config);
- if (HDstrncmp(filter_name, "deflate", 7) != 0)
- H5_FAILED()
+ if (HDstrncmp(filter_name, "deflate", 7) != 0)
+ H5_FAILED()
} catch (Exception e) {
H5_FAILED();
return 1;
@@ -304,7 +308,7 @@ int TestCompress()
PASSED();
#else
SKIPPED();
- puts(" deflate filter not enabled");
+ HDputs(" deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
return 0;
}
@@ -315,7 +319,8 @@ int TestGetPacket()
int record;
int theRecs[3];
int i;
- TESTING("GetPacket")
+ printf("Testing %-62s", "GetPacket");
+ HDfflush(stdout);
/* Create a dataset. Does not need to specify property list because
there is no compression. */
@@ -353,7 +358,8 @@ const char* PT_TESTERROR = "/TestErrors";
int TestErrors()
{
- TESTING("error conditions")
+ printf("Testing %-62s", "error conditions");
+ HDfflush(stdout);
/* Create a dataset */
FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1);
@@ -464,7 +470,8 @@ const char* PT_SYSTEMTST1 = "/SystemTest1";
const char* PT_SYSTEMTST2 = "/SystemTest2";
int SystemTest()
{
- TESTING("multiple datatypes")
+ printf("Testing %-62s", "multiple datatypes");
+ HDfflush(stdout);
hid_t dtypeID1, dtypeID2;
hsize_t count;
@@ -472,7 +479,7 @@ int SystemTest()
/* Creating two inter-related datatypes. Create two datasets and put
* one datatype in each. */
- typedef struct compoundType
+ typedef struct
{
short a, b, c;
int e;
@@ -485,7 +492,7 @@ int SystemTest()
H5Tinsert(dtypeID1, "charlie", HOFFSET( compoundType, c ), H5T_NATIVE_SHORT);
H5Tinsert(dtypeID1, "ebert", HOFFSET( compoundType, e ), H5T_NATIVE_INT);
- typedef struct cType2
+ typedef struct
{
char f;
compoundType g;
@@ -560,16 +567,16 @@ error:
/*-------------------------------------------------------------------------
* TestHDFFV_9758(): Test that a packet table with compound datatype which
- * contains string type can be created and written correctly. (HDFFV-9758)
+ * contains string type can be created and written correctly. (HDFFV-9758)
*
* Notes:
- * Previously, data of the field that follows the string was read back
- * as garbage when #pragma pack(1) is used.
+ * Previously, data of the field that follows the string was read back
+ * as garbage when #pragma pack(1) is used.
* 2016/10/20 -BMR
* Updated:
- * #pragma pack(1) caused failure on Emu because Sparc cannot
- * access misaligned data. Changed it to pack() to do the
- * default alignment.
+ * #pragma pack(1) caused failure on Emu because Sparc cannot
+ * access misaligned data. Changed it to pack() to do the
+ * default alignment.
* 2016/10/25 -BMR
*-------------------------------------------------------------------------
*/
@@ -592,57 +599,58 @@ int TestHDFFV_9758()
};
s1_t s1[NUM_PACKETS];
-
+
for (hsize_t i = 0; i < NUM_PACKETS; i++)
{
s1[i].a = i;
s1[i].b = 1.f * static_cast<float>(i * i);
s1[i].c = 1. / (i + 1);
- sprintf(s1[i].d, "string%d", (int)i);
+ HDsprintf(s1[i].d, "string%d", (int)i);
s1[i].e = 100+i;
}
- TESTING("data corruption in packed structs (HDFFV-9758)")
+ printf("Testing %-62s", "data corruption in packed structs (HDFFV-9758)");
+ HDfflush(stdout);
// Build a compound datatype
compound_type = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
if (compound_type < 0)
- goto error;
-
+ goto error;
+
err = H5Tinsert(compound_type, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT);
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
if (err < 0)
- goto error;
+ goto error;
strtype = H5Tcopy (H5T_C_S1);
if (compound_type < 0)
- goto error;
+ goto error;
err = H5Tset_size (strtype, STRING_LENGTH); /* create string */
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "d_name", HOFFSET(s1_t, d), strtype);
if (err < 0)
- goto error;
+ goto error;
err = H5Tinsert(compound_type, "e_name", HOFFSET(s1_t, e), H5T_NATIVE_INT);
if (err < 0)
- goto error;
+ goto error;
{ // so ptable will go out of scope before PASSED
// Create a packet table
FL_PacketTable ptable(fileID, "/examplePacketTable", compound_type, 1);
if (!ptable.IsValid())
- goto error;
+ goto error;
// Add packets to the table
for (size_t i = 0; i < NUM_PACKETS; i++)
{
- /* Appends one packet at the current position */
+ /* Appends one packet at the current position */
err = ptable.AppendPacket(s1 + i);
if (err < 0) goto error;
}
@@ -650,11 +658,11 @@ int TestHDFFV_9758()
// Check packet count
const hsize_t count = ptable.GetPacketCount(err);
if (err < 0)
- goto error;
-
+ goto error;
+
if (count != NUM_PACKETS)
{
- std::cerr
+ std::cerr
<< "Number of packets in packet table should be " << NUM_PACKETS
<< " but is " << count << endl;
}
@@ -663,16 +671,16 @@ int TestHDFFV_9758()
ptable.ResetIndex();
for (size_t i = 0; i < NUM_PACKETS; i++)
{
- s1_t s2;
- memset(&s2, 0, sizeof(s1_t));
- err = ptable.GetNextPacket(&s2);
- if (err < 0)
- goto error;
-
- if (s2.a != s1[i].a || s2.e != s1[i].e)
- goto error;
- else if (HDstrcmp(s2.d, s1[i].d))
- goto error;
+ s1_t s2;
+ HDmemset(&s2, 0, sizeof(s1_t));
+ err = ptable.GetNextPacket(&s2);
+ if (err < 0)
+ goto error;
+
+ if (s2.a != s1[i].a || s2.e != s1[i].e)
+ goto error;
+ else if (HDstrcmp(s2.d, s1[i].d))
+ goto error;
}
} // end of ptable block
diff --git a/hl/c++/test/ptableTest.h b/hl/c++/test/ptableTest.h
index 8af7bff..e1ba950 100644
--- a/hl/c++/test/ptableTest.h
+++ b/hl/c++/test/ptableTest.h
@@ -21,9 +21,9 @@
#ifndef PTABLETEST
#define PTABLETEST
+#include "h5hltest.h"
#include "H5PacketTable.h"
#include "H5Cpp.h"
-#include "h5hltest.h"
static hid_t fileID;
diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt
index 1144e0f..1707ae9 100644
--- a/hl/examples/CMakeLists.txt
+++ b/hl/examples/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_EXAMPLES )
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_EXAMPLES C)
#-----------------------------------------------------------------------------
# Define Sources
@@ -28,14 +28,17 @@ set (examples
foreach (example ${examples})
add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c)
- TARGET_NAMING (hl_ex_${example} STATIC)
- TARGET_C_PROPERTIES (hl_ex_${example} STATIC " " " ")
- target_link_libraries (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_ex_${example} STATIC)
+ target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (hl_ex_${example} SHARED)
+ target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl)
endforeach ()
-if (BUILD_TESTING)
-
+if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL)
include (CMakeTests.cmake)
-
endif ()
diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake
index 166fa7c..d0f9018 100644
--- a/hl/examples/CMakeTests.cmake
+++ b/hl/examples/CMakeTests.cmake
@@ -26,41 +26,39 @@ foreach (h5_file ${HDF5_TEST_FILES})
endforeach ()
add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list})
- # Remove any output file left over from previous test run
- add_test (
- NAME HL_ex-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ex_lite1.h5
- ex_lite2.h5
- ex_lite3.h5
- packet_table_FLexample.h5
- ex_image1.h5
- ex_image2.h5
- ex_table_01.h5
- ex_table_02.h5
- ex_table_03.h5
- ex_table_04.h5
- ex_table_05.h5
- ex_table_06.h5
- ex_table_07.h5
- ex_table_08.h5
- ex_table_09.h5
- ex_table_10.h5
- ex_table_11.h5
- ex_table_12.h5
- ex_ds1.h5
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "HL_ex-clear-objects")
+# Remove any output file left over from previous test run
+add_test (
+ NAME HL_ex-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ex_lite1.h5
+ ex_lite2.h5
+ ex_lite3.h5
+ packet_table_FLexample.h5
+ ex_image1.h5
+ ex_image2.h5
+ ex_table_01.h5
+ ex_table_02.h5
+ ex_table_03.h5
+ ex_table_04.h5
+ ex_table_05.h5
+ ex_table_06.h5
+ ex_table_07.h5
+ ex_table_08.h5
+ ex_table_09.h5
+ ex_table_10.h5
+ ex_table_11.h5
+ ex_table_12.h5
+ ex_ds1.h5
+)
+set_tests_properties (HL_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_ex)
foreach (example ${examples})
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>)
+ add_test (NAME HL_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_ex_${example}>)
else ()
add_test (NAME HL_ex_${example} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:hl_ex_${example}>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
@@ -71,8 +69,11 @@ foreach (example ${examples})
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test})
+ if (last_test)
+ set_tests_properties (HL_ex_${example} PROPERTIES
+ DEPENDS ${last_test}
+ FIXTURES_REQUIRED clear_HL_ex
+ )
endif ()
set (last_test "HL_ex_${example}")
endforeach ()
diff --git a/hl/examples/Makefile.am b/hl/examples/Makefile.am
index 29e1a48..c9d90dd 100644
--- a/hl/examples/Makefile.am
+++ b/hl/examples/Makefile.am
@@ -25,8 +25,8 @@ endif
# Example directory
# Note: no '/' after DESTDIR. Explanation in commence.am
-EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c
-EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
+EXAMPLEDIR=${DESTDIR}$(examplesdir)/hl/c
+EXAMPLETOPDIR=${DESTDIR}$(examplesdir)/hl
INSTALL_SCRIPT_FILES = run-hlc-ex.sh
INSTALL_TOP_SCRIPT_FILES = run-hl-ex.sh
diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in
index b12955f..f2eec5d 100644
--- a/hl/examples/run-hlc-ex.sh.in
+++ b/hl/examples/run-hlc-ex.sh.in
@@ -18,7 +18,7 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# This script will compile and run the c examples from source files installed #
-# in .../share/hdf5_examples/hl/c using h5cc or h5pc. The order for running #
+# in @examplesdir@/hl/c using h5cc or h5pc. The order for running #
# programs with RunTest in the MAIN section below is taken from the Makefile. #
# The order is important since some of the test programs use data files created #
# by earlier test programs. Any future additions should be placed accordingly. #
@@ -29,9 +29,32 @@
EXIT_SUCCESS=0
EXIT_FAILURE=1
+#
+# Try to derive the path to the installation $prefix established
+# by ./configure relative to the examples directory established by
+# ./configure. If successful, set `prefix_relto_examplesdir` to the
+# relative path. Otherwise, set `prefix_relto_examplesdir` to the
+# absolute installation $prefix.
+#
+# This script uses the value of `prefix` in the user's environment, if
+# it is set, below. The content of $() is evaluated in a sub-shell, so
+# if `prefix` is set in the user's environment, the shell statements in
+# $() won't clobbered it.
+#
+prefix_relto_examplesdir=$(
+prefix=@prefix@
+examplesdir=@examplesdir@
+if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then
+ echo $(echo ${examplesdir##${prefix}/} | \
+ sed 's,[^/][^/]*,..,g')
+else
+ echo $prefix
+fi
+)
+
# Where the tool is installed.
# default is relative path to installed location of the tools
-prefix="${prefix:-@prefix@}"
+prefix="${prefix:-../../${prefix_relto_examplesdir}}"
PARALLEL=@PARALLEL@ # Am I in parallel mode?
AR="@AR@"
RANLIB="@RANLIB@"
@@ -115,5 +138,5 @@ rm *.o
rm *.h5
echo
-exit $EXIT_VALUE
+exit $EXIT_VALUE
diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt
index c651ce9..70da026 100644
--- a/hl/fortran/CMakeLists.txt
+++ b/hl/fortran/CMakeLists.txt
@@ -1,21 +1,21 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_F90 C CXX Fortran)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_F90 C Fortran)
#-----------------------------------------------------------------------------
# List Source files
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src)
+add_subdirectory (src)
#-----------------------------------------------------------------------------
# Build the HL Fortran Examples
#-----------------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if (BUILD_TESTING)
- add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test)
+ add_subdirectory (test)
endif ()
diff --git a/hl/fortran/Makefile.am b/hl/fortran/Makefile.am
index ad18a21..801702c 100644
--- a/hl/fortran/Makefile.am
+++ b/hl/fortran/Makefile.am
@@ -10,7 +10,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-#
+#
# This makefile mostly just reinvokes make in the various subdirectories
# but does so in the correct order. You can alternatively invoke make from
# each subdirectory manually.
@@ -23,7 +23,13 @@
include $(top_srcdir)/config/commence.am
-SUBDIRS=src test
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+else
+ TESTSERIAL_DIR=
+endif
+
+SUBDIRS=src $(TESTSERIAL_DIR)
DIST_SUBDIRS=src test examples
# Install examples
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt
index dfe6102..e6411c1 100644
--- a/hl/fortran/examples/CMakeLists.txt
+++ b/hl/fortran/examples/CMakeLists.txt
@@ -1,13 +1,5 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran)
-
-#-----------------------------------------------------------------------------
-# Setup include Directories
-#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (
- ${HDF5_F90_BINARY_DIR}
- ${HDF5_F90_SRC_DIR}/src
-)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_F90_EXAMPLES C Fortran)
set (examples
exlite
@@ -16,21 +8,34 @@ set (examples
foreach (example ${examples})
add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- TARGET_NAMING (hl_f90_ex_${example} STATIC)
- TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} STATIC " " " ")
- target_link_libraries (hl_f90_ex_${example}
- ${HDF5_HL_F90_LIB_TARGET}
- ${HDF5_F90_LIB_TARGET}
- ${HDF5_LIB_TARGET}
+ target_compile_options(hl_f90_ex_${example}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_include_directories (hl_f90_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
- set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
- set_target_properties (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran)
-
+# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
+# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>)
+ if(MSVC)
+ set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (hl_f90_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src")
+ target_link_libraries (hl_f90_ex_${example} PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (hl_f90_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/hl/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (hl_f90_ex_${example} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src")
+ target_link_libraries (hl_f90_ex_${example} PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (hl_f90_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/hl/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ endif ()
endforeach ()
-if (BUILD_TESTING)
-
+if (BUILD_TESTING AND HDF5_TEST_FORTRAN AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL)
include (CMakeTests.cmake)
-
endif ()
diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake
index 91cb56b..b8f40d0 100644
--- a/hl/fortran/examples/CMakeTests.cmake
+++ b/hl/fortran/examples/CMakeTests.cmake
@@ -21,16 +21,17 @@ add_test (
NAME HL_FORTRAN_f90_ex-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
- ex_ds1.h5
- exlite.h5
+ ex_ds1.h5
+ exlite.h5
)
-
+set_tests_properties (HL_FORTRAN_f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_f90_ex)
foreach (example ${examples})
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>)
+ add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_f90_ex_${example}>)
else ()
add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_ex_${example}>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
@@ -41,5 +42,7 @@ foreach (example ${examples})
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES DEPENDS HL_FORTRAN_f90_ex-clear-objects)
+ set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES
+ FIXTURES_REQUIRED clear_HL_FORTRAN_f90_ex
+ )
endforeach ()
diff --git a/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am
index d383f9a..32f279c 100644
--- a/hl/fortran/examples/Makefile.am
+++ b/hl/fortran/examples/Makefile.am
@@ -51,8 +51,8 @@ endif
# Tell automake how to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
-EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/fortran
-EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
+EXAMPLEDIR=${DESTDIR}$(examplesdir)/hl/fortran
+EXAMPLETOPDIR=${DESTDIR}$(examplesdir)/hl
# List dependencies for each example. Normally, automake would take
# care of this for us, but if we tell automake about the programs it
diff --git a/hl/fortran/examples/ex_ds1.f90 b/hl/fortran/examples/ex_ds1.f90
index 14e2b0c..b31ac8e 100644
--- a/hl/fortran/examples/ex_ds1.f90
+++ b/hl/fortran/examples/ex_ds1.f90
@@ -18,7 +18,7 @@ PROGRAM example_ds
IMPLICIT NONE
- INTEGER, PARAMETER :: RANK = 2 ! rank of DATA dataset
+ INTEGER, PARAMETER :: RANK = 2 ! rank of DATA dataset
INTEGER, PARAMETER :: DIM_DATA = 12
INTEGER, PARAMETER :: DIM1_SIZE = 3
INTEGER, PARAMETER :: DIM2_SIZE = 4
@@ -33,13 +33,13 @@ PROGRAM example_ds
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 :: 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
@@ -56,7 +56,7 @@ PROGRAM example_ds
! create a file using default properties
CALL H5Fcreate_f("ex_ds1.h5",H5F_ACC_TRUNC_F, fid, err)
- ! make a dataset
+ ! make a dataset
CALL H5LTmake_dataset_int_f(fid, DSET_NAME, rank,dims,buf, err)
! make a DS dataset for the first dimension
@@ -69,7 +69,7 @@ PROGRAM example_ds
! 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)
@@ -82,11 +82,11 @@ PROGRAM example_ds
! 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
+ ! 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
@@ -103,11 +103,11 @@ PROGRAM example_ds
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
@@ -123,11 +123,11 @@ PROGRAM example_ds
name = ''
CALL H5DSget_scale_name_f(dsid, name, name_len, err)
- WRITE(*,'(/,5X,A,A)') 'The Dimension Scale name is ... ', name(1:name_len)
+ 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
+ WRITE(*,'(/,A,I0)') "Setting Dimension Scale label ""X"" for dimension ", DIM1
CALL H5DSset_label_f(did, DIM1, "X", err)
@@ -139,11 +139,11 @@ PROGRAM example_ds
! 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)
@@ -163,7 +163,7 @@ PROGRAM example_ds
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)
+ WRITE(*,'(/,5X,A,A)') 'The Dimension Scale name is ... ', name(1:name_len)
! Setting Dimension Scale Label
@@ -177,13 +177,13 @@ PROGRAM example_ds
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
+ ! 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 c8f41f8..86acd27 100644
--- a/hl/fortran/examples/run-hlfortran-ex.sh.in
+++ b/hl/fortran/examples/run-hlfortran-ex.sh.in
@@ -18,7 +18,7 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# This script will compile and run the fortran examples from source files #
-# installed in .../share/hdf5_examples/hl/fortran using h5fc or h5pfc. The #
+# installed in @examplesdir@/hl/fortran using h5fc or h5pfc. The #
# order for running programs with RunTest in the MAIN section below is taken #
# from the Makefile. The order is important since some of the test programs #
# use data files created by earlier test programs. Any future additions should #
@@ -80,5 +80,5 @@ rm *.o
rm *.h5
echo
-exit $EXIT_VALUE
+exit $EXIT_VALUE
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index 345a739..71b9380 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT(HDF5_HL_F90_SRC C CXX Fortran)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_F90_SRC C Fortran)
#-----------------------------------------------------------------------------
# configure def file for shared libs on windows
@@ -15,53 +15,34 @@ endif ()
# Generate the H5LT and H5TB REAL APIs
#-----------------------------------------------------------------------------
-add_executable (H5HL_buildiface
- ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90
- )
-
+add_executable (H5HL_buildiface ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 )
+target_include_directories (H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}")
if (WIN32 AND MSVC)
if (BUILD_SHARED_LIBS)
- set_target_properties (H5HL_buildiface
- PROPERTIES
- COMPILE_FLAGS "/MT"
- )
+ set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT")
endif ()
- set_target_properties (H5HL_buildiface
- PROPERTIES
- LINK_FLAGS "/SUBSYSTEM:CONSOLE"
- )
endif ()
+#set_property(TARGET H5HL_buildiface APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
+#)
+if(MSVC)
+ set_property(TARGET H5HL_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE")
+endif()
set_target_properties (H5HL_buildiface PROPERTIES
LINKER_LANGUAGE Fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
)
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared")
- if (WIN32)
- set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE})
- else ()
- set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- endif ()
+if (BUILD_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/shared")
+ set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE})
endif ()
-if (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${CMAKE_BUILD_TYPE})
-else ()
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+if (NOT ONLY_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/static")
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
endif ()
#-----------------------------------------------------------------------------
-# Setup include Directories
-#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (
- ${HDF5_HL_SRC_DIR}/src
- ${HDF5_F90_SRC_DIR}/src
- ${HDF5_F90_BINARY_DIR}
- ${CMAKE_Fortran_MODULE_DIRECTORY}
- ${MOD_BUILD_DIR}
-)
-
-#-----------------------------------------------------------------------------
# hl_f90CStub lib
#-----------------------------------------------------------------------------
set (HDF5_HL_F90_C_SOURCES
@@ -75,30 +56,38 @@ set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C)
set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h)
-add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS})
-TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC " " " ")
-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} STATIC)
-set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES
- FOLDER libraries/hl/fortran
- LINKER_LANGUAGE C
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-set (install_targets ${HDF5_HL_F90_C_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS})
+ target_include_directories (${HDF5_HL_F90_C_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_options(${HDF5_HL_F90_C_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${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} STATIC 0)
+ set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES
+ FOLDER libraries/hl/fortran
+ LINKER_LANGUAGE C
+ )
+ set (install_targets ${HDF5_HL_F90_C_LIB_TARGET})
+endif ()
+if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS})
- TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ")
- target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET})
+ target_include_directories (${HDF5_HL_F90_C_LIBSH_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_options(${HDF5_HL_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_compile_definitions(${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB")
+ TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED)
+ target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}")
- H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION})
+ H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED "HL_F")
set_target_properties (${HDF5_HL_F90_C_LIBSH_TARGET} PROPERTIES
FOLDER libraries/hl/fortran
LINKER_LANGUAGE C
- COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
)
set (install_targets ${install_targets} ${HDF5_HL_F90_C_LIBSH_TARGET})
endif ()
@@ -113,102 +102,120 @@ set (HDF5_HL_F90_F_BASE_SOURCES
${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90
)
-set (CMD $<TARGET_FILE:H5HL_buildiface>)
-add_custom_command (
- OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90
- COMMAND ${CMD}
- WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}
- DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
- COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files"
-)
-add_custom_target (H5HLgen ALL
- DEPENDS ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90
-)
-set_source_files_properties (
- ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90
- ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90
- PROPERTIES GENERATED TRUE
-)
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- set (CMDSH $<TARGET_FILE:H5HL_buildiface>)
+if (NOT ONLY_SHARED_LIBS)
add_custom_command (
- OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90
- COMMAND ${CMD}
- WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}/shared
+ OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5HL_buildiface>
+ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static
+ DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
+ COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files"
+ )
+ add_custom_target (H5HLgen ALL
+ DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ )
+ set_source_files_properties (
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ PROPERTIES GENERATED TRUE
+ )
+endif ()
+if (BUILD_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5HL_buildiface>
+ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/shared
DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files"
)
add_custom_target (H5HLgenSH ALL
- DEPENDS ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90
+ DEPENDS ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
)
set_source_files_properties (
- ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90
- ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
PROPERTIES GENERATED TRUE
)
endif ()
-set (HDF5_HL_F90_F_SOURCES
- ${HDF5_HL_F90_F_BASE_SOURCES}
-
- # generated files
- ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90
- ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90
-)
-set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran)
+if (NOT ONLY_SHARED_LIBS)
+ set (HDF5_HL_F90_F_SOURCES
+ ${HDF5_HL_F90_F_BASE_SOURCES}
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+ # generated files
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90
+ )
+ set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran)
+endif ()
+if (BUILD_SHARED_LIBS)
set (HDF5_HL_F90_F_SOURCES_SHARED
${HDF5_HL_F90_F_BASE_SOURCES}
# generated files
- ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90
- ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90
+ ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90
)
set_source_files_properties (${HDF5_HL_F90_F_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran)
endif ()
-add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES})
-TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} STATIC " " " ")
-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} STATIC)
-set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES
- FOLDER libraries/hl/fortran
- LINKER_LANGUAGE Fortran
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-if (WIN32)
- set_property (TARGET ${HDF5_HL_F90_LIB_TARGET}
- APPEND PROPERTY COMPILE_DEFINITIONS "HDF5F90_WINDOWS"
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES})
+ target_include_directories (${HDF5_HL_F90_LIB_TARGET}
+ PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/static>"
+ )
+ target_compile_options(${HDF5_HL_F90_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}")
+ target_compile_definitions(${HDF5_HL_F90_LIB_TARGET}
+ PUBLIC $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
+ PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
+# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>)
+ if(MSVC)
+ set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES
+ FOLDER libraries/hl/fortran
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
+ H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0)
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}")
+ set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET})
+ add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen)
endif ()
-set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET})
-add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen)
-
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED})
- set (SHARED_LINK_FLAGS " ")
- if (WIN32 AND MSVC)
- set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def")
- endif ()
- TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS})
- target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET})
- set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}")
- H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION})
+ target_include_directories (${HDF5_HL_F90_LIBSH_TARGET}
+ PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/shared>"
+ )
+ target_compile_options(${HDF5_HL_F90_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}")
+ target_compile_definitions(${HDF5_HL_F90_LIBSH_TARGET}
+ PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS>
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET}
+ PUBLIC ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}
+ PRIVATE ${LINK_Fortran_LIBS}
+ )
+# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
+# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>)
+# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-DLL">)
+# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def">)
+ if(MSVC)
+ set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} -DLL -DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def")
+ endif()
set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES
FOLDER libraries/hl/fortran
LINKER_LANGUAGE Fortran
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- if (WIN32)
- set_property (TARGET ${HDF5_HL_F90_LIBSH_TARGET}
- APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS"
- )
- endif ()
+ H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F")
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}")
set (install_targets ${install_targets} ${HDF5_HL_F90_LIBSH_TARGET})
add_dependencies(${HDF5_HL_F90_LIBSH_TARGET} H5HLgenSH)
endif ()
@@ -218,25 +225,26 @@ endif ()
#-----------------------------------------------------------------------------
-set (mod_files
- ${MOD_BUILD_DIR}/h5ds.mod
- ${MOD_BUILD_DIR}/h5tb.mod
- ${MOD_BUILD_DIR}/h5tb_const.mod
- ${MOD_BUILD_DIR}/h5lt.mod
- ${MOD_BUILD_DIR}/h5lt_const.mod
- ${MOD_BUILD_DIR}/h5im.mod
-)
-
-install (
- FILES
- ${mod_files}
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}/static
- COMPONENT
- fortheaders
-)
+if (NOT ONLY_SHARED_LIBS)
+ set (mod_files
+ ${MOD_BUILD_DIR}/h5ds.mod
+ ${MOD_BUILD_DIR}/h5tb.mod
+ ${MOD_BUILD_DIR}/h5tb_const.mod
+ ${MOD_BUILD_DIR}/h5lt.mod
+ ${MOD_BUILD_DIR}/h5lt_const.mod
+ ${MOD_BUILD_DIR}/h5im.mod
+ )
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+ install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}/static
+ COMPONENT
+ fortheaders
+ )
+endif ()
+if (BUILD_SHARED_LIBS)
set (modsh_files
${MODSH_BUILD_DIR}/h5ds.mod
${MODSH_BUILD_DIR}/h5tb.mod
@@ -259,12 +267,14 @@ endif ()
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
if (HDF5_EXPORTED_TARGETS)
- if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+ if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
#INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
- #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries)
+ #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries)
+ endif ()
install (
TARGETS
diff --git a/hl/fortran/src/H5DSfc.c b/hl/fortran/src/H5DSfc.c
index 0bb594d..f99fa4d 100644
--- a/hl/fortran/src/H5DSfc.c
+++ b/hl/fortran/src/H5DSfc.c
@@ -33,15 +33,15 @@
*-------------------------------------------------------------------------
*/
int_f
-h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen)
+h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_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)
@@ -78,17 +78,17 @@ h5dsset_scale_c(hid_t_f *dsid, _fcd dimname, size_t_f *dimnamelen)
*-------------------------------------------------------------------------
*/
int_f
-h5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx)
+h5dsattach_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;
@@ -111,17 +111,17 @@ h5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx)
*-------------------------------------------------------------------------
*/
int_f
-h5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx)
+h5dsdetach_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;
@@ -144,11 +144,11 @@ h5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx)
*-------------------------------------------------------------------------
*/
int_f
-h5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached)
+h5dsis_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.
*/
@@ -157,7 +157,7 @@ h5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached)
HGOTO_DONE(FAIL)
*is_attached = (int_f)c_is_attached;
-
+
done:
return ret_value;
@@ -179,20 +179,20 @@ h5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *is_attached)
*-------------------------------------------------------------------------
*/
int_f
-h5dsis_scale_c( hid_t_f *did, int_f *is_scale)
+h5dsis_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;
@@ -215,15 +215,15 @@ h5dsis_scale_c( hid_t_f *did, int_f *is_scale)
*-------------------------------------------------------------------------
*/
int_f
-h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen)
+h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_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)
@@ -258,7 +258,7 @@ h5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *labellen)
*-------------------------------------------------------------------------
*/
int_f
-h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size)
+h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size)
{
char *c_label = NULL;
ssize_t size_c = -1;
@@ -273,18 +273,18 @@ h5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size)
/*
* call H5DSget_label function.
*/
-
+
if( (size_c = 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);
done:
- *size = (size_t_f)size_c; /* Don't subtract '1' because H5DSget_label doesn't include the
+ *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;
@@ -307,7 +307,7 @@ done:
*-------------------------------------------------------------------------
*/
int_f
-h5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size)
+h5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size)
{
char *c_scale_name = NULL;
ssize_t size_c = -1;
@@ -322,7 +322,7 @@ h5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size)
/*
* call H5DSget_scale_name function.
*/
-
+
if( (size_c = H5DSget_scale_name( (hid_t)*did, c_scale_name, (size_t)*size+1)) < 0)
HGOTO_DONE(FAIL)
@@ -354,17 +354,17 @@ done:
*-------------------------------------------------------------------------
*/
int_f
-h5dsget_num_scales_c( hid_t_f *did, int_f *idx, int_f *num_scales)
+h5dsget_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;
diff --git a/hl/fortran/src/H5DSff.F90 b/hl/fortran/src/H5DSff.F90
index 4f0d040..6dcb450 100644
--- a/hl/fortran/src/H5DSff.F90
+++ b/hl/fortran/src/H5DSff.F90
@@ -26,7 +26,7 @@ CONTAINS
!-------------------------------------------------------------------------
! Function: H5DSset_scale_f
!
-! Purpose: Convert dataset dsid to a dimension scale, with optional name, dimname.
+! Purpose: Convert dataset dsid to a dimension scale, with optional name, dimname.
!
! Return: Success: 0, Failure: -1
!
@@ -44,13 +44,6 @@ CONTAINS
IMPLICIT NONE
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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
@@ -99,35 +92,29 @@ CONTAINS
IMPLICIT NONE
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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(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) &
- BIND(C,NAME='h5dsattach_scale_c')
+ BIND(C,NAME='h5dsattach_scale_c')
IMPORT :: HID_T
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! the dataset
- INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be attached
+ 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
-
+ 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
!
@@ -146,43 +133,37 @@ CONTAINS
!-------------------------------------------------------------------------
SUBROUTINE H5DSdetach_scale_f( did, dsid, idx, errcode)
-
+
IMPLICIT NONE
-
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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(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) &
BIND(C,NAME='h5dsdetach_scale_c')
IMPORT :: HID_T
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! the dataset
- INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be detached
+ 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
+ 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.
+! Purpose: Report if dimension scale dsid is currently attached to dimension idx of dataset did.
!
! Return: Success: 0, Failure: -1
!
@@ -197,38 +178,32 @@ CONTAINS
!-------------------------------------------------------------------------
SUBROUTINE H5DSis_attached_f( did, dsid, idx, is_attached, errcode)
-
+
IMPLICIT NONE
-
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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
+ 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) &
BIND(C,NAME='h5dsis_attached_c')
IMPORT :: HID_T
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! the dataset
- INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be detached
+ 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
+ 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
-
+ 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
@@ -237,7 +212,7 @@ CONTAINS
ELSE IF(errcode.LT.0)THEN
errcode = -1
ENDIF
-
+
END SUBROUTINE H5DSis_attached_f
!
@@ -247,7 +222,7 @@ CONTAINS
!-------------------------------------------------------------------------
! Function: H5DSis_scale_f
!
-! Purpose: Determines whether dset is a Dimension Scale.
+! Purpose: Determines whether dset is a Dimension Scale.
!
! Return: Success: 0, Failure: -1
!
@@ -262,21 +237,15 @@ CONTAINS
!-------------------------------------------------------------------------
SUBROUTINE H5DSis_scale_f( did, is_scale, errcode)
-
+
IMPLICIT NONE
-
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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:
+ 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) &
BIND(C,NAME='h5dsis_scale_c')
@@ -286,7 +255,7 @@ CONTAINS
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
@@ -295,7 +264,7 @@ CONTAINS
ELSE IF(errcode.LT.0)THEN
errcode = -1
ENDIF
-
+
END SUBROUTINE H5DSis_scale_f
!-------------------------------------------------------------------------
@@ -319,13 +288,6 @@ CONTAINS
IMPLICIT NONE
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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
@@ -342,7 +304,7 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataset
INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
INTEGER(SIZE_T), INTENT(in) :: label_len ! Length of label
END FUNCTION H5DSset_label_c
END INTERFACE
@@ -357,7 +319,7 @@ CONTAINS
!-------------------------------------------------------------------------
! Function: H5DSget_label_f
!
-! Purpose: Read the label for dimension idx of did into buffer label.
+! Purpose: Read the label for dimension idx of did into buffer label.
!
! Return: Success: 0, Failure: -1
!
@@ -375,18 +337,11 @@ CONTAINS
IMPLICIT NONE
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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(hid_t), INTENT(in) :: did ! The dataget
+ INTEGER , INTENT(in) :: idx ! The dimension
+ CHARACTER(LEN=*), INTENT(INOUT) :: label ! The label
+ INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the label buffer
+ INTEGER :: errcode ! Error code
INTEGER :: c_idx
INTERFACE
@@ -397,7 +352,7 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
INTEGER , INTENT(in) :: idx ! The dimension
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: label ! The label
INTEGER(SIZE_T), INTENT(inout) :: size ! Length of label
END FUNCTION H5DSget_label_c
END INTERFACE
@@ -430,16 +385,9 @@ CONTAINS
IMPLICIT NONE
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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
+ CHARACTER(LEN=*), INTENT(INOUT) :: name ! The name
+ INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the name buffer
INTEGER :: errcode ! Error code
INTERFACE
@@ -449,7 +397,7 @@ CONTAINS
IMPORT :: HID_T, SIZE_T
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: did ! The dataget
- CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(out) :: name ! The name
+ CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: name ! The name
INTEGER(SIZE_T), INTENT(inout) :: size ! Length of name
END FUNCTION H5DSget_scale_name_c
END INTERFACE
@@ -478,33 +426,26 @@ CONTAINS
SUBROUTINE H5DSget_num_scales_f( did, idx, num_scales, errcode)
IMPLICIT NONE
-
-!
-!This definition is needed for Windows DLLs
-!DEC$if defined(BUILD_HDF5_HL_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(hid_t), INTENT(in) :: did ! the dataset
+ INTEGER , INTENT(in) :: idx ! the dimension of did to query
+ INTEGER , INTENT(INOUT) :: 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) &
BIND(C,NAME='h5dsget_num_scales_c')
IMPORT :: HID_T
IMPLICIT NONE
- 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(hid_t), INTENT(in) :: did ! the dataset
+ INTEGER , INTENT(in) :: idx ! the dimension of did to query
+ INTEGER , INTENT(INOUT) :: 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/H5HL_buildiface.F90 b/hl/fortran/src/H5HL_buildiface.F90
index dda8d56..7aac9a2 100644
--- a/hl/fortran/src/H5HL_buildiface.F90
+++ b/hl/fortran/src/H5HL_buildiface.F90
@@ -13,8 +13,8 @@
! depending on which of the KIND values are found.
!
! NOTES
-! This program uses the Fortran 2008 intrinsic function STORAGE_SIZE or SIZEOF
-! depending on availablity.It generates code that makes use of
+! This program uses the Fortran 2008 intrinsic function STORAGE_SIZE or SIZEOF
+! depending on availablity.It generates code that makes use of
! STORAGE_SIZE/SIZEOF in H5fortran_detect.f90. STORAGE_SIZE is standard
! compliant and should always be chosen over SIZEOF.
!
@@ -88,7 +88,7 @@ PROGRAM H5HL_buildiface
!
! Developer's notes:
!
-! Only interfaces with arrays of rank 7 and less are provided. Even-though the F2008
+! Only interfaces with arrays of rank 7 and less are provided. Even-though the F2008
! standard extended the maximum rank to 15, it was decided that they should use the
! new APIs to handle those use cases. Handling rank 7 and less is for backward compatibility
! with the Fortran 90/95 APIs codes which could never handle rank 8-15 array sizes.
@@ -266,7 +266,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' errcode = h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,type_id,f_ptr)'
@@ -293,11 +293,11 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr)'
@@ -327,8 +327,8 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
-
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' errcode = h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,H5T_NATIVE_REAL,f_ptr)'
@@ -354,11 +354,11 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
-
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr)'
@@ -387,8 +387,8 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
-
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' errcode = h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,H5T_NATIVE_DOUBLE,f_ptr)'
@@ -414,11 +414,11 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
-
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr)'
@@ -450,7 +450,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' errcode = h5ltmake_dataset_c(loc_id, namelen, dset_name, rank, dims, type_id, f_ptr)'
@@ -482,7 +482,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' INTEGER(hid_t) :: type_id'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' type_id = h5kind_to_type(KIND('//f_ptr_line(j)(19:36)//'), H5_INTEGER_KIND)'
@@ -510,7 +510,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id'
- WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -540,7 +540,7 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id'
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name'
WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
- WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
+ WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
@@ -680,10 +680,10 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' namelen1 = LEN(field_name)'
@@ -712,12 +712,12 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start'
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords'
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' namelen1 = LEN(field_name)'
@@ -748,9 +748,9 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
- WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
+ WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') &
@@ -778,11 +778,11 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start'
WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords'
WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER :: errcode '
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') &
@@ -809,12 +809,12 @@ PROGRAM H5HL_buildiface
WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(in) :: field_name'
WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: field_type'
WRITE(11,'(A)') ' INTEGER, INTENT(in) :: field_index'
- WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(in), DIMENSION(*), TARGET :: buf'
+ WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(IN), DIMENSION(*), TARGET :: buf'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen'
WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1'
WRITE(11,'(A)') ' INTEGER :: errcode'
WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr'
-
+
WRITE(11,'(A)') f_ptr_line(j)
WRITE(11,'(A)') ' namelen = LEN(dset_name)'
WRITE(11,'(A)') ' namelen1 = LEN(field_name)'
diff --git a/hl/fortran/src/H5IMff.F90 b/hl/fortran/src/H5IMff.F90
index 6646828..ffa18aa 100644
--- a/hl/fortran/src/H5IMff.F90
+++ b/hl/fortran/src/H5IMff.F90
@@ -22,7 +22,7 @@
! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | ****
! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | ****
! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_|
-!
+!
! If you add a new function here then you MUST add the function name to the
! Windows dll file 'hdf5_hl_fortrandll.def.in' in the hl/fortran/src directory.
! This is needed for Windows based operating systems.
@@ -82,10 +82,10 @@ CONTAINS
INTEGER , INTENT(in), DIMENSION(*) :: buf ! buffer
END FUNCTION h5immake_image_8bit_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5immake_image_8bit_c(loc_id,namelen,dset_name,width,height,buf)
-
+
END SUBROUTINE h5immake_image_8bit_f
!-------------------------------------------------------------------------
@@ -110,7 +110,7 @@ CONTAINS
errcode )
IMPLICIT NONE
-
+
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(len=*), INTENT(in) :: dset_name ! name of the dataset
INTEGER, INTENT(inout), DIMENSION(*) :: buf ! buffer
@@ -129,10 +129,10 @@ CONTAINS
INTEGER, INTENT(inout), DIMENSION(*) :: buf ! buffer
END FUNCTION h5imread_image_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5imread_image_c(loc_id,namelen,dset_name,buf)
-
+
END SUBROUTINE h5imread_image_f
!-------------------------------------------------------------------------
@@ -159,7 +159,7 @@ CONTAINS
il,&
buf,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
@@ -171,7 +171,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: ILEN ! name length
-
+
INTERFACE
INTEGER FUNCTION h5immake_image_24bit_c(loc_id,namelen,dset_name,ILEN,il,width,height,buf) &
BIND(C,NAME='h5immake_image_24bit_c')
@@ -186,14 +186,14 @@ CONTAINS
INTEGER, INTENT(in), DIMENSION(*) :: buf ! buffer
INTEGER(size_t) :: namelen ! length of name buffer
INTEGER(size_t) :: ILEN ! name length
-
+
END FUNCTION h5immake_image_24bit_c
END INTERFACE
-
+
namelen = LEN(dset_name)
ILEN = LEN(il)
errcode = h5immake_image_24bit_c(loc_id,namelen,dset_name,ILEN,il,width,height,buf)
-
+
END SUBROUTINE h5immake_image_24bit_f
!-------------------------------------------------------------------------
@@ -222,7 +222,7 @@ CONTAINS
interlace,&
npals,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
@@ -235,7 +235,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: ILEN ! name length
-
+
INTERFACE
INTEGER FUNCTION h5imget_image_info_c(loc_id,namelen,dset_name,width,height,planes,npals,ILEN,interlace) &
BIND(C,NAME='h5imget_image_info_c')
@@ -253,11 +253,11 @@ CONTAINS
INTEGER(size_t) :: ILEN ! name length
END FUNCTION h5imget_image_info_c
END INTERFACE
-
+
namelen = LEN(dset_name)
ILEN = LEN(interlace)
errcode = h5imget_image_info_c(loc_id,namelen,dset_name,width,height,planes,npals,ILEN,interlace)
-
+
END SUBROUTINE h5imget_image_info_f
!-------------------------------------------------------------------------
@@ -286,7 +286,7 @@ CONTAINS
CHARACTER(len=*), INTENT(in) :: dset_name ! name of the dataset
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
-
+
INTERFACE
INTEGER FUNCTION h5imis_image_c(loc_id,namelen,dset_name) &
BIND(C,NAME='h5imis_image_c')
@@ -298,13 +298,13 @@ CONTAINS
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset
END FUNCTION h5imis_image_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5imis_image_c(loc_id,namelen,dset_name)
h5imis_image_f = errcode
-
+
END FUNCTION h5imis_image_f
-
+
!-------------------------------------------------------------------------
! Function: h5immake_palette_f
@@ -328,16 +328,16 @@ CONTAINS
pal_dims,&
buf,&
errcode )
-
+
IMPLICIT NONE
-
+
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(len=*), INTENT(in) :: dset_name ! name of the dataset
INTEGER(hsize_t), INTENT(in), DIMENSION(*) :: pal_dims ! dimensions
INTEGER, INTENT(in), DIMENSION(*) :: buf ! buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
-
+
INTERFACE
INTEGER FUNCTION h5immake_palette_c(loc_id,namelen,dset_name,pal_dims,buf) &
BIND(C,NAME='h5immake_palette_c')
@@ -351,12 +351,12 @@ CONTAINS
INTEGER, INTENT(in), DIMENSION(*) :: buf ! buffer
END FUNCTION h5immake_palette_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5immake_palette_c(loc_id,namelen,dset_name,pal_dims,buf)
-
+
END SUBROUTINE h5immake_palette_f
-
+
!-------------------------------------------------------------------------
! Function: h5imlink_palette_f
!
@@ -378,16 +378,16 @@ CONTAINS
dset_name,&
pal_name,&
errcode )
-
+
IMPLICIT NONE
-
+
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(len=*), INTENT(in) :: dset_name ! name of the dataset
CHARACTER(len=*), INTENT(in) :: pal_name ! palette name
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: ILEN ! name length
-
+
INTERFACE
INTEGER FUNCTION h5imlink_palette_c(loc_id,namelen,dset_name,ILEN,pal_name) &
BIND(C,NAME='h5imlink_palette_c')
@@ -401,13 +401,13 @@ CONTAINS
INTEGER(size_t) :: ILEN ! name length
END FUNCTION h5imlink_palette_c
END INTERFACE
-
+
namelen = LEN(dset_name)
ILEN = LEN(pal_name)
errcode = h5imlink_palette_c(loc_id,namelen,dset_name,ILEN,pal_name)
-
+
END SUBROUTINE h5imlink_palette_f
-
+
!-------------------------------------------------------------------------
! Function: h5imunlink_palette_f
@@ -430,7 +430,7 @@ CONTAINS
dset_name,&
pal_name,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
@@ -439,7 +439,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: ILEN ! name length
-
+
INTERFACE
INTEGER FUNCTION h5imunlink_palette_c(loc_id,namelen,dset_name,ILEN,pal_name) &
BIND(C,NAME='h5imunlink_palette_c')
@@ -453,13 +453,13 @@ CONTAINS
INTEGER(size_t) :: ILEN ! name length
END FUNCTION h5imunlink_palette_c
END INTERFACE
-
+
namelen = LEN(dset_name)
ILEN = LEN(pal_name)
errcode = h5imunlink_palette_c(loc_id,namelen,dset_name,ILEN,pal_name)
-
+
END SUBROUTINE h5imunlink_palette_f
-
+
!-------------------------------------------------------------------------
! Function: h5imget_npalettes_f
!
@@ -481,7 +481,7 @@ CONTAINS
dset_name,&
npals,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
@@ -489,7 +489,7 @@ CONTAINS
INTEGER(hsize_t), INTENT(inout) :: npals ! palettes
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
-
+
INTERFACE
INTEGER FUNCTION h5imget_npalettes_c(loc_id,namelen,dset_name,npals) &
BIND(C,NAME='h5imget_npalettes_c')
@@ -502,10 +502,10 @@ CONTAINS
INTEGER(size_t) :: namelen ! name length
END FUNCTION h5imget_npalettes_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5imget_npalettes_c(loc_id,namelen,dset_name,npals)
-
+
END SUBROUTINE h5imget_npalettes_f
@@ -531,7 +531,7 @@ CONTAINS
pal_number,&
dims,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
@@ -539,8 +539,8 @@ CONTAINS
INTEGER, INTENT(in) :: pal_number ! palette number
INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions
INTEGER :: errcode ! error code
- INTEGER(size_t) :: namelen ! name length
-
+ INTEGER(size_t) :: namelen ! name length
+
INTERFACE
INTEGER FUNCTION h5imget_palette_info_c(loc_id,namelen,dset_name,pal_number,dims) &
BIND(C,NAME='h5imget_palette_info_c')
@@ -551,13 +551,13 @@ CONTAINS
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset
INTEGER, INTENT(in) :: pal_number ! palette number
INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions
- INTEGER(size_t) :: namelen ! name length
+ INTEGER(size_t) :: namelen ! name length
END FUNCTION h5imget_palette_info_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5imget_palette_info_c(loc_id,namelen,dset_name,pal_number,dims)
-
+
END SUBROUTINE h5imget_palette_info_f
!-------------------------------------------------------------------------
@@ -582,7 +582,7 @@ CONTAINS
pal_number,&
buf,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
@@ -591,7 +591,7 @@ CONTAINS
INTEGER, INTENT(inout), DIMENSION(*) :: buf ! buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
-
+
INTERFACE
INTEGER FUNCTION h5imget_palette_c(loc_id,namelen,dset_name,pal_number,buf) &
BIND(C,NAME='h5imget_palette_c')
@@ -605,10 +605,10 @@ CONTAINS
INTEGER, INTENT(inout), DIMENSION(*) :: buf ! buffer
END FUNCTION h5imget_palette_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5imget_palette_c(loc_id,namelen,dset_name,pal_number,buf)
-
+
END SUBROUTINE h5imget_palette_f
@@ -638,7 +638,7 @@ CONTAINS
CHARACTER(len=*), INTENT(in) :: dset_name ! name of the dataset
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
-
+
INTERFACE
INTEGER FUNCTION h5imis_palette_c(loc_id,namelen,dset_name) &
BIND(C,NAME='h5imis_palette_c')
@@ -650,11 +650,11 @@ CONTAINS
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset
END FUNCTION h5imis_palette_c
END INTERFACE
-
+
namelen = LEN(dset_name)
errcode = h5imis_palette_c(loc_id,namelen,dset_name)
h5imis_palette_f = errcode
-
+
END FUNCTION h5imis_palette_f
END MODULE H5IM
diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h
index 35b08a1..44a2fee 100644
--- a/hl/fortran/src/H5LTf90proto.h
+++ b/hl/fortran/src/H5LTf90proto.h
@@ -174,9 +174,9 @@ h5ltread_dataset_string_c (hid_t_f *loc_id,
HDF5_HL_F90CSTUBDLL
int_f
-h5ltpath_valid_c(hid_t_f *loc_id,
- _fcd path,
- size_t_f *pathlen,
+h5ltpath_valid_c(hid_t_f *loc_id,
+ _fcd path,
+ size_t_f *pathlen,
int_f *check_object_valid_c);
/*-------------------------------------------------------------------------
@@ -303,7 +303,7 @@ h5tbmake_table_c(size_t_f *namelen1,
hid_t_f *field_types,
hsize_t_f *chunk_size,
int_f *compress,
- size_t_f *char_len_field_names, /* field_names lenghts */
+ size_t_f *char_len_field_names, /* field_names lengths */
size_t_f *max_char_size_field_names, /* char len of fields */
_fcd buf); /* field_names */
@@ -334,7 +334,7 @@ h5tbmake_table_ptr_c(size_t_f *namelen1,
hsize_t_f *chunk_size,
void *fill_data,
int_f *compress,
- size_t_f *char_len_field_names, /* field_names lenghts */
+ size_t_f *char_len_field_names, /* field_names lengths */
size_t_f *max_char_size_field_names, /* char len of fields */
char *field_names, /* field_names */
void *data);
@@ -429,7 +429,7 @@ h5tbget_field_info_c(hid_t_f *loc_id,
size_t_f *namelen2,
size_t_f *lenmax,
_fcd field_names,
- size_t_f *maxlen_out);
+ size_t_f *maxlen_out);
#endif /* _H5LTf90proto_H */
diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c
index 0f8a58f..3597c3a 100644
--- a/hl/fortran/src/H5LTfc.c
+++ b/hl/fortran/src/H5LTfc.c
@@ -438,7 +438,7 @@ h5ltget_attribute_c(hid_t_f *loc_id,
else
goto done;
}
-
+
if (ret < 0)
goto done;
@@ -512,7 +512,7 @@ h5ltget_attribute_string_c(hid_t_f *loc_id,
/*
* Convert C name to FORTRAN and place it in the given buffer
*/
- HD5packFstring(c_buf, _fcdtocp(buf), (size_t)*buf_size);
+ HD5packFstring(c_buf, _fcdtocp(buf), (size_t)*buf_size);
ret_value = 0;
@@ -893,9 +893,9 @@ done:
*/
int_f
-h5ltpath_valid_c(hid_t_f *loc_id,
- _fcd path,
- size_t_f *pathlen,
+h5ltpath_valid_c(hid_t_f *loc_id,
+ _fcd path,
+ size_t_f *pathlen,
int_f *check_object_valid_c)
{
htri_t ret = -1;
@@ -907,7 +907,7 @@ h5ltpath_valid_c(hid_t_f *loc_id,
*/
if( NULL == (c_path = (char *)HD5f2cstring(path, (size_t)*pathlen)))
goto done;
-
+
check_object_valid = FALSE;
if(*check_object_valid_c == 1)
check_object_valid = TRUE;
diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90
index 80f6ac5..bc8734f 100644
--- a/hl/fortran/src/H5LTff.F90
+++ b/hl/fortran/src/H5LTff.F90
@@ -22,7 +22,7 @@
! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | ****
! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | ****
! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_|
-!
+!
! If you add a new function here then you MUST add the function name to the
! Windows dll file 'hdf5_hl_fortrandll.def.in' in the hl/fortran/src directory.
! This is needed for Windows based operating systems.
@@ -130,7 +130,7 @@ CONTAINS
!
! Comments:
!
- ! Modifications:
+ ! Modifications:
!
!-------------------------------------------------------------------------
@@ -321,7 +321,7 @@ CONTAINS
SUBROUTINE h5ltmake_dataset_f_int7(loc_id, dset_name, rank, dims, &
type_id, buf, errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset
@@ -371,7 +371,7 @@ CONTAINS
INTEGER(hid_t), INTENT(in) :: type_id ! datatype identifier
TYPE(C_PTR) :: buf ! data buffer
INTEGER :: errcode ! error code
- INTEGER(size_t) :: namelen
+ INTEGER(size_t) :: namelen
namelen = LEN(dset_name)
errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id, buf)
@@ -409,7 +409,7 @@ CONTAINS
INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims ! size of the buffer buf
INTEGER, INTENT(inout), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
- INTEGER(size_t) :: namelen
+ INTEGER(size_t) :: namelen
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1))
@@ -451,7 +451,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2)), TARGET :: buf
+ DIMENSION(dims(1),dims(2)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1))
@@ -476,7 +476,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1))
@@ -497,7 +497,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1))
@@ -518,7 +518,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1))
@@ -556,7 +556,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1,1))
@@ -577,7 +577,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1,1,1))
@@ -621,7 +621,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1))
namelen = LEN(dset_name)
@@ -644,7 +644,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(in), &
- DIMENSION(dims(1),dims(2)), TARGET :: buf
+ DIMENSION(dims(1),dims(2)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1))
@@ -669,7 +669,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(in), &
- DIMENSION(dims(1),dims(2),dims(3)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1))
@@ -690,7 +690,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(in), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1))
@@ -711,7 +711,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(in), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1))
@@ -732,7 +732,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(in), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1,1))
@@ -753,7 +753,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(in), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1,1,1))
@@ -793,7 +793,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1)), TARGET :: buf
+ DIMENSION(dims(1)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1))
@@ -816,7 +816,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2)), TARGET :: buf
+ DIMENSION(dims(1),dims(2)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1))
@@ -839,7 +839,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1))
@@ -858,7 +858,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1))
@@ -877,7 +877,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1))
@@ -896,7 +896,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1,1))
@@ -915,7 +915,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER, INTENT(inout), &
- DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7)), TARGET :: buf
+ DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7)), TARGET :: buf
TYPE(C_PTR) :: f_ptr
f_ptr = C_LOC(buf(1,1,1,1,1,1,1))
@@ -1059,14 +1059,14 @@ CONTAINS
TYPE(C_PTR) :: buf ! data buffer
CHARACTER(LEN=*), INTENT(in) :: buf_type ! valid data types are:
! CHARACTER, INTEGER or REAL
- ! NOTE: only the first character matters and is case insensitive
+ ! NOTE: only the first character matters and is case insensitive
INTEGER(size_t), INTENT(in) :: size ! size of attribute array
- INTEGER(size_t), INTENT(in) :: SizeOf_buf_type ! size of buf's data type
+ INTEGER(size_t), INTENT(in) :: SizeOf_buf_type ! size of buf's data type
INTEGER, INTENT(out) :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
- INTEGER(size_t) :: attrlen ! name length
- CHARACTER(KIND=C_CHAR) :: buf_type_uppercase
+ INTEGER(size_t) :: attrlen ! name length
+ CHARACTER(KIND=C_CHAR) :: buf_type_uppercase
namelen = LEN(dset_name)
attrlen = LEN(attr_name)
@@ -1117,7 +1117,7 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER, DIMENSION(*), TARGET :: buf ! data buffer
INTEGER(size_t) :: namelen ! name length
- INTEGER(size_t) :: attrlen ! name length
+ INTEGER(size_t) :: attrlen ! name length
TYPE(C_PTR) :: f_ptr
INTEGER(size_t) :: SizeOf_buf_type
@@ -1168,7 +1168,7 @@ CONTAINS
INTEGER :: errcode ! error code
REAL(KIND=C_FLOAT), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER(size_t) :: namelen ! name length
- INTEGER(size_t) :: attrlen ! name length
+ INTEGER(size_t) :: attrlen ! name length
TYPE(C_PTR) :: f_ptr
INTEGER(size_t) :: SizeOf_buf_type
@@ -1222,7 +1222,7 @@ CONTAINS
TYPE(C_PTR) :: f_ptr
INTEGER(size_t) :: SizeOf_buf_type
- f_ptr = C_LOC(buf(1))
+ f_ptr = C_LOC(buf(1))
#if H5_FORTRAN_HAVE_STORAGE_SIZE!=0
SizeOf_buf_type = STORAGE_SIZE(buf(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
@@ -1269,7 +1269,7 @@ CONTAINS
CHARACTER(LEN=*), DIMENSION(*), INTENT(in), TARGET :: buf ! data buffer
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: attrlen ! name length
- INTEGER(size_t) :: buflen ! data buffer length
+ INTEGER(size_t) :: buflen ! data buffer length
TYPE(C_PTR) :: f_ptr
INTEGER(size_t) :: SizeOf_buf_type
@@ -1321,7 +1321,7 @@ CONTAINS
! CHARACTER, INTEGER or REAL
! NOTE: only the first character matters and is case insensitive
INTEGER(size_t), INTENT(in) :: SizeOf_buf_type ! size of buf's data type
- INTEGER, INTENT(out) :: errcode ! error code
+ INTEGER, INTENT(out) :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: attrlen ! attr length
CHARACTER(KIND=C_CHAR) :: buf_type_uppercase
@@ -1373,11 +1373,11 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER, INTENT(inout), DIMENSION(*), TARGET :: buf! data buffer
INTEGER(size_t) :: namelen ! name length
- INTEGER(size_t) :: attrlen ! name length
+ INTEGER(size_t) :: attrlen ! name length
TYPE(C_PTR) :: f_ptr
INTEGER(size_t) :: SizeOf_buf
- f_ptr = C_LOC(buf(1))
+ f_ptr = C_LOC(buf(1))
#if H5_FORTRAN_HAVE_STORAGE_SIZE!=0
SizeOf_buf = STORAGE_SIZE(buf(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
@@ -1420,7 +1420,7 @@ CONTAINS
INTEGER :: errcode ! error code
REAL(KIND=C_FLOAT), INTENT(inout), DIMENSION(*), TARGET :: buf
INTEGER(size_t) :: namelen ! name length
- INTEGER(size_t) :: attrlen ! name length
+ INTEGER(size_t) :: attrlen ! name length
TYPE(C_PTR) :: f_ptr
INTEGER(size_t) :: SizeOf_buf
@@ -1470,7 +1470,7 @@ CONTAINS
TYPE(C_PTR) :: f_ptr
INTEGER(size_t) :: SizeOf_buf
- f_ptr = C_LOC(buf(1))
+ f_ptr = C_LOC(buf(1))
#if H5_FORTRAN_HAVE_STORAGE_SIZE!=0
SizeOf_buf = STORAGE_SIZE(buf(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)
#else
@@ -1514,7 +1514,7 @@ CONTAINS
CHARACTER(LEN=*), INTENT(inout) :: buf
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: attrlen ! name length
- INTEGER(size_t) :: buf_size ! buf size
+ INTEGER(size_t) :: buf_size ! buf size
INTERFACE
INTEGER FUNCTION h5ltget_attribute_string_c(loc_id,namelen,dset_name,attrlen,attr_name,buf,buf_size) &
@@ -1812,7 +1812,7 @@ CONTAINS
!-------------------------------------------------------------------------
! Function: h5ltpath_valid_f
!
- ! Purpose: Validates a path
+ ! Purpose: Validates a path
!
! Return: Success: 0, Failure: -1
!
@@ -1831,8 +1831,8 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t) , INTENT(IN) :: loc_id ! An identifier of an object in the file.
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(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
@@ -1846,7 +1846,7 @@ CONTAINS
IMPORT :: C_CHAR
IMPORT :: HID_T, SIZE_T, HSIZE_T
IMPLICIT NONE
- INTEGER(hid_t), INTENT(in) :: loc_id
+ INTEGER(hid_t), INTENT(in) :: loc_id
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: path
INTEGER(size_t) :: pathlen
INTEGER :: check_object_valid_c
@@ -1856,7 +1856,7 @@ CONTAINS
! Initialize
path_valid = .FALSE.
errcode = 0
-
+
check_object_valid_c = 0
IF(check_object_valid) check_object_valid_c = 1
@@ -1868,7 +1868,7 @@ CONTAINS
ELSE IF(status.LT.0)THEN
errcode = -1
ENDIF
-
+
END SUBROUTINE h5ltpath_valid_f
END MODULE H5LT_CONST
diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c
index c0d053f..285cd84 100644
--- a/hl/fortran/src/H5TBfc.c
+++ b/hl/fortran/src/H5TBfc.c
@@ -38,7 +38,7 @@ int_f
h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name,
hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset,
hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress,
- size_t_f *char_len_field_names, /* field_names lenghts */
+ size_t_f *char_len_field_names, /* field_names lengths */
size_t_f *max_char_size_field_names, /* char len of fields */
char *field_names) /* field_names */
{
@@ -142,8 +142,8 @@ int_f
h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen,
_fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size,
size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size,
- void *fill_data, int_f *compress,
- size_t_f *char_len_field_names, /* field_names lenghts */
+ void *fill_data, int_f *compress,
+ size_t_f *char_len_field_names, /* field_names lengths */
size_t_f *max_char_size_field_names, /* char len of fields */
char *field_names,
void *data) /* field_names */
@@ -233,7 +233,7 @@ done:
/*-------------------------------------------------------------------------
* Function: h5tbread_table_c
*
-* Purpose: Call H5TBread_table using F2003 features
+* Purpose: Call H5TBread_table using F2003 features
*
* Return: Success: 0, Failure: -1
*
@@ -261,7 +261,7 @@ h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfiel
*/
if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
-
+
if(NULL == (c_dst_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
HGOTO_DONE(FAIL)
if(NULL == (c_dst_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields)))
@@ -270,7 +270,7 @@ h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfiel
for(i = 0; i < c_nfields; i++) {
c_dst_offset[i] = (size_t)dst_offset[i];
c_dst_sizes[i] = (size_t)dst_sizes[i];
- } /* end for */
+ } /* end for */
/*
* call H5TBread_table function.
@@ -514,7 +514,7 @@ h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *name
* call H5TBinsert_field function.
*/
- if(H5TBinsert_field((hid_t)*loc_id, c_name, c_name1, (hid_t)*field_type,
+ if(H5TBinsert_field((hid_t)*loc_id, c_name, c_name1, (hid_t)*field_type,
(hsize_t)*position, NULL, buf) < 0)
HGOTO_DONE(FAIL)
@@ -638,7 +638,7 @@ done:
int_f
h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields,
size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size,
- size_t_f *namelen2, /* field_names lenghts */
+ size_t_f *namelen2, /* field_names lengths */
size_t_f *lenmax, /* character len max */
_fcd field_names, /* field_names */
size_t_f *maxlen_out)
@@ -683,7 +683,7 @@ h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *n
if(H5TBget_field_info((hid_t)*loc_id, c_name, c_field_names, c_field_sizes,
c_field_offsets, &c_type_size) < 0)
HGOTO_DONE(FAIL)
-
+
/* return values */
/* names array */
@@ -709,7 +709,7 @@ h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *n
field_offsets[i] = (size_t_f)c_field_offsets[i];
} /* end for */
- *maxlen_out = (size_t_f)length;
+ *maxlen_out = (size_t_f)length;
done:
if(c_name)
diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90
index 2575b24..c3db01e 100644
--- a/hl/fortran/src/H5TBff.F90
+++ b/hl/fortran/src/H5TBff.F90
@@ -23,7 +23,7 @@
! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | ****
! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | ****
! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_|
-!
+!
! If you add a new function here then you MUST add the function name to the
! Windows dll file 'hdf5_hl_fortrandll.def.in' in the hl/fortran/src directory.
! This is needed for Windows based operating systems.
@@ -31,7 +31,7 @@
#include "H5config_f.inc"
MODULE h5tb_CONST
-
+
USE, INTRINSIC :: ISO_C_BINDING
USE h5fortran_types
USE hdf5
@@ -40,22 +40,22 @@ MODULE h5tb_CONST
MODULE PROCEDURE h5tbwrite_field_name_f_int
MODULE PROCEDURE h5tbwrite_field_name_f_string
END INTERFACE
-
+
INTERFACE h5tbread_field_name_f
MODULE PROCEDURE h5tbread_field_name_f_int
MODULE PROCEDURE h5tbread_field_name_f_string
END INTERFACE
-
+
INTERFACE h5tbwrite_field_index_f
MODULE PROCEDURE h5tbwrite_field_index_f_int
MODULE PROCEDURE h5tbwrite_field_index_f_string
END INTERFACE
-
+
INTERFACE h5tbread_field_index_f
MODULE PROCEDURE h5tbread_field_index_f_int
MODULE PROCEDURE h5tbread_field_index_f_string
END INTERFACE
-
+
INTERFACE h5tbinsert_field_f
MODULE PROCEDURE h5tbinsert_field_f_int
MODULE PROCEDURE h5tbinsert_field_f_string
@@ -162,7 +162,7 @@ MODULE h5tb_CONST
INTEGER(size_t) :: namelen1 ! name length length
END FUNCTION h5tbinsert_field_c
END INTERFACE
-
+
CONTAINS
!-------------------------------------------------------------------------
@@ -251,16 +251,16 @@ CONTAINS
INTEGER(size_t) :: max_char_size_field_names ! character len of field names
END FUNCTION h5tbmake_table_c
END INTERFACE
-
+
namelen = LEN(dset_name)
namelen1 = LEN(table_title)
-
+
! Find the size of each character string in the array
DO i = 1, nfields
char_len_field_names(i) = LEN_TRIM(field_names(i))
END DO
-
- max_char_size_field_names = LEN(field_names(1))
+
+ max_char_size_field_names = LEN(field_names(1))
errcode = h5tbmake_table_c(namelen1, table_title, loc_id, namelen, dset_name, nfields, nrecords,&
type_size, field_offset, field_types, chunk_size, compress, char_len_field_names, &
@@ -346,16 +346,16 @@ CONTAINS
TYPE(C_PTR), INTENT(in), VALUE :: data
END FUNCTION h5tbmake_table_ptr_c
END INTERFACE
-
+
namelen = LEN(dset_name)
namelen1 = LEN(table_title)
-
+
! Find the size of each character string in the array
DO i = 1, nfields
char_len_field_names(i) = LEN_TRIM(field_names(i))
END DO
-
- max_char_size_field_names = LEN(field_names(1))
+
+ max_char_size_field_names = LEN(field_names(1))
errcode = h5tbmake_table_ptr_c(namelen1, table_title, loc_id, namelen, dset_name, nfields, nrecords,&
type_size, field_offset, field_types, chunk_size, fill_data, compress, char_len_field_names, &
@@ -395,7 +395,7 @@ CONTAINS
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(LEN=1), INTENT(in) :: table_name ! name of the dataset
- INTEGER(hsize_t), INTENT(in) :: nfields
+ INTEGER(hsize_t), INTENT(in) :: nfields
INTEGER(size_t), INTENT(in) :: dst_size ! type size
INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the sizes of the fields
INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields
@@ -404,7 +404,7 @@ CONTAINS
END FUNCTION h5tbread_table_c
END INTERFACE
-
+
namelen = LEN(table_name)
errcode = h5tbread_table_c(loc_id,&
@@ -442,7 +442,7 @@ CONTAINS
type_size,&
buf,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset
@@ -455,14 +455,14 @@ CONTAINS
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1 ! name length
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1))
namelen = LEN(dset_name)
namelen1 = LEN(field_name)
-
+
errcode = h5tbwrite_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbwrite_field_name_f_int
@@ -488,15 +488,15 @@ CONTAINS
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1)(1:1))
namelen = LEN(dset_name)
namelen1 = LEN(field_name)
-
+
errcode = h5tbwrite_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbwrite_field_name_f_string
@@ -532,20 +532,20 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1)) ! name length
namelen = LEN(dset_name)
namelen1 = LEN(field_name)
-
+
errcode = h5tbread_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbread_field_name_f_int
SUBROUTINE h5tbread_field_name_f_string(loc_id,&
@@ -564,20 +564,20 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: namelen1 ! name length
TYPE(C_PTR) :: f_ptr
-
- f_ptr = C_LOC(buf(1)(1:1))
+
+ f_ptr = C_LOC(buf(1)(1:1))
namelen = LEN(dset_name)
namelen1 = LEN(field_name)
-
+
errcode = h5tbread_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbread_field_name_f_string
@@ -595,7 +595,7 @@ CONTAINS
! Modifications:
!
!-------------------------------------------------------------------------
-
+
SUBROUTINE h5tbwrite_field_index_f_int(loc_id,&
dset_name,&
field_index,&
@@ -604,7 +604,7 @@ CONTAINS
type_size,&
buf,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset
@@ -616,14 +616,14 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1))
namelen = LEN(dset_name)
-
+
errcode = h5tbwrite_field_index_c(loc_id,namelen,dset_name,field_index,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbwrite_field_index_f_int
SUBROUTINE h5tbwrite_field_index_f_string(loc_id,&
@@ -634,7 +634,7 @@ CONTAINS
type_size,&
buf,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset
@@ -646,13 +646,13 @@ CONTAINS
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1)(1:1))
namelen = LEN(dset_name)
-
+
errcode = h5tbwrite_field_index_c(loc_id,namelen,dset_name,field_index,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbwrite_field_index_f_string
@@ -679,7 +679,7 @@ CONTAINS
type_size,&
buf,&
errcode )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset
@@ -687,17 +687,17 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1))
namelen = LEN(dset_name)
-
+
errcode = h5tbread_field_index_c(loc_id,namelen,dset_name,field_index,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbread_field_index_f_int
SUBROUTINE h5tbread_field_index_f_string(loc_id,&
@@ -716,17 +716,17 @@ CONTAINS
INTEGER(hsize_t), INTENT(in) :: start ! start record
INTEGER(hsize_t), INTENT(in) :: nrecords ! records
INTEGER(size_t), INTENT(in) :: type_size ! type size
- CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer
+ CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer
INTEGER :: errcode ! error code
INTEGER(size_t) :: namelen ! name length
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1)(1:1))
namelen = LEN(dset_name)
-
+
errcode = h5tbread_field_index_c(loc_id,namelen,dset_name,field_index,&
start,nrecords,type_size,f_ptr)
-
+
END SUBROUTINE h5tbread_field_index_f_string
!-------------------------------------------------------------------------
@@ -762,12 +762,12 @@ CONTAINS
INTEGER(size_t) :: namelen1 ! name length
INTEGER :: errcode ! error code
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1))
namelen = LEN(dset_name)
namelen1 = LEN(field_name)
-
+
errcode = h5tbinsert_field_c(loc_id,namelen,dset_name,namelen1,field_name,&
field_type,field_index,f_ptr)
@@ -791,15 +791,15 @@ CONTAINS
INTEGER(size_t) :: namelen1 ! name length
INTEGER :: errcode ! error code
TYPE(C_PTR) :: f_ptr
-
+
f_ptr = C_LOC(buf(1)(1:1))
-
+
namelen = LEN(dset_name)
namelen1 = LEN(field_name)
-
+
errcode = h5tbinsert_field_c(loc_id,namelen,dset_name,namelen1,field_name,&
field_type,field_index,f_ptr)
-
+
END SUBROUTINE h5tbinsert_field_f_string
!-------------------------------------------------------------------------
@@ -898,9 +898,9 @@ CONTAINS
namelen = LEN(dset_name)
errcode = h5tbget_table_info_c(loc_id,namelen,dset_name,nfields,nrecords)
-
+
END SUBROUTINE h5tbget_table_info_f
-
+
!-------------------------------------------------------------------------
! Function: h5tbget_field_info_f
@@ -915,9 +915,9 @@ CONTAINS
!
! Comments:
!
-! Modifications:
+! Modifications:
! Added optional parameter for returning the maximum character length
-! in the field name array. March 3, 2011
+! in the field name array. March 3, 2011
!
!-------------------------------------------------------------------------
@@ -929,7 +929,7 @@ CONTAINS
field_offsets,&
type_size,&
errcode, maxlen_out )
-
+
IMPLICIT NONE
INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier
CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset
@@ -939,13 +939,13 @@ CONTAINS
INTEGER(size_t), DIMENSION(nfields), INTENT(inout) :: field_offsets ! field offsets
INTEGER(size_t), INTENT(inout):: type_size ! type size
INTEGER :: errcode ! error code
- INTEGER, OPTIONAL :: maxlen_out ! maximum character len of the field names
+ INTEGER(size_t), OPTIONAL :: maxlen_out ! maximum character len of the field names
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t), DIMENSION(nfields) :: namelen2 ! name lengths
- INTEGER(hsize_t) :: i ! general purpose integer
+ INTEGER(hsize_t) :: i ! general purpose integer
INTEGER(size_t) :: maxlen
INTEGER(size_t) :: c_maxlen_out
-
+
INTERFACE
INTEGER FUNCTION h5tbget_field_info_c(loc_id,namelen,dset_name,nfields,&
field_sizes,field_offsets,type_size,namelen2, maxlen, field_names, c_maxlen_out) &
@@ -963,7 +963,7 @@ CONTAINS
INTEGER(size_t) :: namelen ! name length
INTEGER(size_t) :: maxlen ! maxiumum length of input field names
INTEGER(size_t), DIMENSION(1:nfields) :: namelen2 ! name lengths
- INTEGER(size_t) :: c_maxlen_out ! maximum character length of a field array element
+ INTEGER(size_t) :: c_maxlen_out ! maximum character length of a field array element
END FUNCTION h5tbget_field_info_c
END INTERFACE
@@ -973,14 +973,14 @@ CONTAINS
END DO
maxlen = LEN(field_names(1))
c_maxlen_out = 0
-
+
errcode = h5tbget_field_info_c(loc_id, namelen,dset_name, nfields, &
field_sizes, field_offsets, type_size, namelen2, maxlen, field_names, c_maxlen_out)
-
+
IF(PRESENT(maxlen_out)) maxlen_out = c_maxlen_out
-
+
END SUBROUTINE h5tbget_field_info_f
-
+
END MODULE H5TB_CONST
diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am
index a495e220..37e074c 100644
--- a/hl/fortran/src/Makefile.am
+++ b/hl/fortran/src/Makefile.am
@@ -50,6 +50,21 @@ libhdf5hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \
# HDF5 HL Fortran library depends on HDF5 Library.
libhdf5hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F)
+# The name of the lib file doesn't follow the same pattern as the other hl lib
+# files, namely libhdf5_hl_*. Add a symlink with the compliant name to the
+# actual lib file.
+install-exec-hook:
+ cd $(DESTDIR)$(libdir) && \
+ if test -f libhdf5hl_fortran.a -a \
+ ! -f libhdf5_hl_fortran.a; then \
+ $(LN_S) libhdf5hl_fortran.a libhdf5_hl_fortran.a; \
+ fi; \
+ if test -f libhdf5hl_fortran.so -a \
+ ! -f libhdf5_hl_fortran.so; then \
+ $(LN_S) libhdf5hl_fortran.so libhdf5_hl_fortran.so; \
+ fi;
+
+
# Fortran module files can have different extensions and different names
# (e.g., different capitalizations) on different platforms. Write rules
# for them explicitly rather than trying to teach automake about them.
@@ -72,6 +87,7 @@ uninstall-local:
set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \
fi; \
fi
+ $(RM) $(DESTDIR)$(libdir)/libhdf5_hl_fortran*
# These are the helper programs we need to build.
noinst_PROGRAMS = H5HL_buildiface
diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt
index 3138173..e2872ac 100644
--- a/hl/fortran/test/CMakeLists.txt
+++ b/hl/fortran/test/CMakeLists.txt
@@ -1,93 +1,51 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_FORTRAN_TESTS C Fortran)
#-----------------------------------------------------------------------------
# Add Tests
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
+set (H5_TESTS
+ tstds
+ tstlite
+ tstimage
+ tsttable
+)
-#-- Adding test for hl_f90_tstds
-add_executable (hl_f90_tstds tstds.F90)
-TARGET_NAMING (hl_f90_tstds STATIC)
-TARGET_FORTRAN_PROPERTIES (hl_f90_tstds STATIC " " " ")
-target_link_libraries (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
-target_include_directories (hl_f90_tstds PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran)
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- add_executable (hl_f90_tstds-shared tstds.F90)
- TARGET_NAMING (hl_f90_tstds-shared SHARED)
- TARGET_FORTRAN_PROPERTIES (hl_f90_tstds-shared SHARED " " " ")
- target_link_libraries (hl_f90_tstds-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET})
- target_include_directories (hl_f90_tstds-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_target_properties (hl_f90_tstds-shared PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/hl/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+macro (ADD_H5_FORTRAN_EXE file)
+ add_executable (hl_f90_${file} ${file}.F90)
+ target_compile_options(hl_f90_${file}
+ PRIVATE
+ "${HDF5_CMAKE_Fortran_FLAGS}"
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-endif ()
-
-#-- Adding test for hl_f90_tstlite
-add_executable (hl_f90_tstlite tstlite.F90)
-TARGET_NAMING (hl_f90_tstlite STATIC)
-TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite STATIC " " " ")
-target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET})
-target_include_directories (hl_f90_tstlite PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran)
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- add_executable (hl_f90_tstlite-shared tstlite.F90)
- TARGET_NAMING (hl_f90_tstlite-shared SHARED)
- TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite-shared SHARED " " " ")
- target_link_libraries (hl_f90_tstlite-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET})
- target_include_directories (hl_f90_tstlite-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_target_properties (hl_f90_tstlite-shared PROPERTIES
+# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">)
+# set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>)
+ if(MSVC)
+ set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (hl_f90_${file} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src")
+ target_link_libraries (hl_f90_${file} PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET})
+ set_target_properties (hl_f90_${file} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/hl/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
- )
-endif ()
-
-#-- Adding test for hl_f90_tstimage
-add_executable (hl_f90_tstimage tstimage.F90)
-TARGET_NAMING (hl_f90_tstimage STATIC)
-TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage STATIC " " " ")
-target_link_libraries (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
-target_include_directories (hl_f90_tstimage PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_target_properties (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran)
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- add_executable (hl_f90_tstimage-shared tstimage.F90)
- TARGET_NAMING (hl_f90_tstimage-shared SHARED)
- TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage-shared SHARED " " " ")
- target_link_libraries (hl_f90_tstimage-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET})
- target_include_directories (hl_f90_tstimage-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_target_properties (hl_f90_tstimage-shared PROPERTIES
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (hl_f90_${file} PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src")
+ target_link_libraries (hl_f90_${file} PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET})
+ set_target_properties (hl_f90_${file} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/hl/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
- )
-endif ()
+ )
+ endif ()
+endmacro ()
-#-- Adding test for hl_f90_tsttable
-add_executable (hl_f90_tsttable tsttable.F90)
-TARGET_NAMING (hl_f90_tsttable STATIC)
-TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable STATIC " " " ")
-target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET})
-target_include_directories (hl_f90_tsttable PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran)
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- add_executable (hl_f90_tsttable-shared tsttable.F90)
- TARGET_NAMING (hl_f90_tsttable-shared SHARED)
- TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable-shared SHARED " " " ")
- target_link_libraries (hl_f90_tsttable-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET})
- target_include_directories (hl_f90_tsttable-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_target_properties (hl_f90_tsttable-shared PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/hl/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
- )
-endif ()
+foreach (h5_test ${H5_TESTS})
+ ADD_H5_FORTRAN_EXE(${h5_test})
+endforeach ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_FORTRAN AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake
index 90cc3a3..0760b92 100644
--- a/hl/fortran/test/CMakeTests.cmake
+++ b/hl/fortran/test/CMakeTests.cmake
@@ -16,91 +16,7 @@
##############################################################################
##############################################################################
-# Remove any output file left over from previous test run
-add_test (
- NAME HL_FORTRAN_test-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- dsetf1.h5
- dsetf2.h5
- dsetf3.h5
- dsetf4.h5
- dsetf5.h5
- f1img.h5
- f1tab.h5
- f2tab.h5
- tstds.h5
-)
-
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>)
-else ()
- add_test (NAME HL_FORTRAN_f90_tstds COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstds>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tstds.txt"
- #-D "TEST_REFERENCE=hl_f90_tstds.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
-endif ()
-set_tests_properties (HL_FORTRAN_f90_tstds PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects)
-
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>)
-else ()
- add_test (NAME HL_FORTRAN_f90_tstlite COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstlite>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tstlite.txt"
- #-D "TEST_REFERENCE=hl_f90_tstlite.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
-endif ()
-set_tests_properties (HL_FORTRAN_f90_tstlite PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects)
-
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>)
-else ()
- add_test (NAME HL_FORTRAN_f90_tstimage COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstimage>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tstimage.txt"
- #-D "TEST_REFERENCE=hl_f90_tstimage.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
-endif ()
-set_tests_properties (HL_FORTRAN_f90_tstimage PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects)
-
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>)
-else ()
- add_test (NAME HL_FORTRAN_f90_tsttable COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tsttable>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tsttable.txt"
- #-D "TEST_REFERENCE=hl_f90_tsttable.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
-endif ()
-set_tests_properties (HL_FORTRAN_f90_tsttable PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects)
-
-if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- add_test (
- NAME HL_FORTRAN_test-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
+set (test_hl_fortran_CLEANFILES
dsetf1.h5
dsetf2.h5
dsetf3.h5
@@ -110,72 +26,37 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
f1tab.h5
f2tab.h5
tstds.h5
- )
- set_tests_properties (HL_FORTRAN_test-shared-clear-objects
- PROPERTIES DEPENDS "HL_FORTRAN_f90_tsttable;HL_FORTRAN_f90_tstimage;HL_FORTRAN_f90_tstlite;HL_FORTRAN_f90_tstds"
- )
-
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND $<TARGET_FILE:hl_f90_tstds-shared>)
- else ()
- add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstds-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tstds-shared.txt"
- #-D "TEST_REFERENCE=hl_f90_tstds-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (HL_FORTRAN_f90_tstds-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects)
+)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND $<TARGET_FILE:hl_f90_tstlite-shared>)
- else ()
- add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstlite-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tstlite-shared.txt"
- #-D "TEST_REFERENCE=hl_f90_tstlite-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (HL_FORTRAN_f90_tstlite-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects)
+# Remove any output file left over from previous test run
+add_test (
+ NAME HL_FORTRAN_test-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${test_hl_fortran_CLEANFILES}
+)
+set_tests_properties (HL_FORTRAN_test-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_test)
+macro (ADD_H5_FORTRAN_TEST file)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND $<TARGET_FILE:hl_f90_tstimage-shared>)
+ add_test (NAME HL_FORTRAN_f90_${file} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_f90_${file}>)
else ()
- add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstimage-shared>"
+ add_test (NAME HL_FORTRAN_f90_${file} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_${file}>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tstimage-shared.txt"
- #-D "TEST_REFERENCE=hl_f90_tstimage-shared.out"
+ -D "TEST_OUTPUT=hl_f90_${file}.txt"
+ #-D "TEST_REFERENCE=hl_f90_${file}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- set_tests_properties (HL_FORTRAN_f90_tstimage-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects)
+ set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES
+ FIXTURES_REQUIRED clear_HL_FORTRAN_test
+ )
+endmacro ()
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND $<TARGET_FILE:hl_f90_tsttable-shared>)
- else ()
- add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tsttable-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=hl_f90_tsttable-shared.txt"
- #-D "TEST_REFERENCE=hl_f90_tsttable-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (HL_FORTRAN_f90_tsttable-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects)
-endif ()
+foreach (h5_test ${H5_TESTS})
+ ADD_H5_FORTRAN_TEST(${h5_test})
+endforeach ()
diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am
index ba672aa..5d1ab2e 100644
--- a/hl/fortran/test/Makefile.am
+++ b/hl/fortran/test/Makefile.am
@@ -36,7 +36,7 @@ check_PROGRAMS=$(TEST_PROG)
LIBOBJS=$(top_builddir)/fortran/test/tf_gen.o
-LDADD=$(LIBOBJS) $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5)
+LDADD=$(LIBOBJS) $(LIBH5F_HL) $(LIBH5F) $(LIBH5_HL) $(LIBHDF5)
# Source files for the programs
tstds_SOURCES=tstds.F90
@@ -58,18 +58,6 @@ clean-local:
$(RM) *.$(F9XMODEXT); \
fi
-install-data-local:
- @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \
- $(CP) $(top_builddir)/$(subdir)/*.$(F9XMODEXT) $(DESTDIR)$(includedir)/. ; \
- fi
-
-uninstall-local:
- @if test -n "$(F9XMODEXT)" -a "X$(F9XMODEXT)" != "Xo"; then \
- if test -f "$(includedir)/hdf5.$(F9XMODEXT)" -o -f "$(DESTDIR)$(includedir)/HDF5.$(F9XMODEXT)"; then \
- set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \
- fi; \
- fi
-
# Mark this directory as part of the Fortran API (this affects output
# from tests in conclude.am)
FORTRAN_API=yes
diff --git a/hl/fortran/test/tstds.F90 b/hl/fortran/test/tstds.F90
index 387f524..e0335b6 100644
--- a/hl/fortran/test/tstds.F90
+++ b/hl/fortran/test/tstds.F90
@@ -46,7 +46,7 @@ SUBROUTINE write_test_status( test_result)
IF (test_result .EQ. 0) THEN
error_string = success
ENDIF
-
+
WRITE(*, fmt = '(T34, A)') error_string
END SUBROUTINE write_test_status
@@ -66,7 +66,7 @@ SUBROUTINE test_testds(err)
IMPLICIT NONE
- INTEGER, PARAMETER :: RANK = 2 ! rank of DATA dataset
+ INTEGER, PARAMETER :: RANK = 2 ! rank of DATA dataset
INTEGER, PARAMETER :: DIM_DATA = 12
INTEGER, PARAMETER :: DIM1_SIZE = 3
INTEGER, PARAMETER :: DIM2_SIZE = 4
@@ -82,13 +82,13 @@ SUBROUTINE test_testds(err)
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 :: 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
@@ -107,7 +107,7 @@ SUBROUTINE test_testds(err)
CALL H5Fcreate_f("tstds.h5",H5F_ACC_TRUNC_F, fid, err)
IF(err.LT.0) RETURN
- ! make a dataset
+ ! make a dataset
CALL H5LTmake_dataset_int_f(fid,DSET_NAME,rank,dims,buf, err)
IF(err.LT.0) RETURN
@@ -185,11 +185,11 @@ SUBROUTINE test_testds(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")
@@ -245,15 +245,15 @@ SUBROUTINE test_testds(err)
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
@@ -301,7 +301,7 @@ SUBROUTINE test_testds(err)
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)
@@ -341,7 +341,7 @@ SUBROUTINE test_testds(err)
CALL H5Dclose_f(dsid, err)
IF(err.LT.0) RETURN
- ! close file
+ ! close file
CALL H5Fclose_f(fid, err)
IF(err.LT.0) RETURN
@@ -352,7 +352,7 @@ END MODULE TSTDS_TESTS
PROGRAM test_ds
USE TSTDS_TESTS ! module for testing dataset routines
-
+
IMPLICIT NONE
INTEGER :: err
diff --git a/hl/fortran/test/tstimage.F90 b/hl/fortran/test/tstimage.F90
index d6bd1e2..8586e68 100644
--- a/hl/fortran/test/tstimage.F90
+++ b/hl/fortran/test/tstimage.F90
@@ -62,7 +62,7 @@ character(len=4), parameter :: dsetname2 = "img2" ! dataset name
character(len=15), parameter :: il ="INTERLACE_PIXEL"! dataset name
integer(hid_t) :: file_id ! file identifier
integer(hsize_t), parameter :: width = 500 ! width of image
-integer(hsize_t), parameter :: height = 200 ! height of image
+integer(hsize_t), parameter :: height = 270 ! height of image
integer, parameter :: pal_entries = 9 ! palette number of entries
integer, dimension(width*height) :: buf1 ! data buffer
integer, dimension(width*height) :: bufr1 ! data buffer
diff --git a/hl/fortran/test/tstlite.F90 b/hl/fortran/test/tstlite.F90
index 673807b..071bd3f 100644
--- a/hl/fortran/test/tstlite.F90
+++ b/hl/fortran/test/tstlite.F90
@@ -635,7 +635,7 @@ CONTAINS
DO k = 1, dims(3)
IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
PRINT *, 'read buffer differs from write buffer'
- PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
+ PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
STOP
ENDIF
END DO
@@ -660,7 +660,7 @@ CONTAINS
DO k = 1, dims(3)
IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
PRINT *, 'read buffer differs from write buffer'
- PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
+ PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
STOP
ENDIF
END DO
@@ -685,7 +685,7 @@ CONTAINS
DO k = 1, dims(3)
IF ( dset_data_i32(i,j,k) .NE. data_out_i32(i,j,k) ) THEN
PRINT *, 'read buffer differs from write buffer'
- PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
+ PRINT *, dset_data_i32(i,j,k), ' and ', data_out_i32(i,j,k)
STOP
ENDIF
END DO
@@ -1356,7 +1356,7 @@ CONTAINS
TYPE(hvl_t), DIMENSION(1:2), TARGET :: rdata ! Pointer to vlen structures
INTEGER(hsize_t), DIMENSION(1:1) :: dims_vl = (/2/)
INTEGER, DIMENSION(:), POINTER :: ptr_r
- INTEGER(HID_T) :: type_id
+ INTEGER(HID_T) :: type_id
!
! Initialize FORTRAN predefined datatypes.
@@ -1911,7 +1911,7 @@ CONTAINS
STOP
ENDIF
- !
+ !
! ** Test reading a string that was created with a C program **
!
@@ -1923,7 +1923,7 @@ CONTAINS
!!$ !
!!$ IF ( bufr_c .NE. buf_c ) THEN
!!$ PRINT *, 'read buffer differs from write buffer'
-!!$ PRINT *, bufr1, ' and ', buf_c
+!!$ PRINT *, bufr1, ' and ', buf_c
!!$ STOP
!!$ ENDIF
!!$ !
@@ -1936,9 +1936,9 @@ CONTAINS
!!$ !
!!$ IF ( buf_c(1:16) .NE. bufr_c_lg(1:16) .AND. bufr_c_lg(17:18) .NE. ' ' ) THEN
!!$ PRINT *, 'larger read buffer differs from write buffer'
-!!$ PRINT *, buf_c, ' and ', bufr_c_lg
+!!$ PRINT *, buf_c, ' and ', bufr_c_lg
!!$ STOP
-!!$ ENDIF
+!!$ ENDIF
!!$ CALL h5fclose_f(file_id1, errcode)
diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90
index 38cfa86..55cdbf0 100644
--- a/hl/fortran/test/tsttable.F90
+++ b/hl/fortran/test/tsttable.F90
@@ -58,7 +58,7 @@ SUBROUTINE test_table1()
USE TSTTABLE ! module for testing table support routines
IMPLICIT NONE
-
+
CHARACTER(len=8), PARAMETER :: filename = "f1tab.h5" ! File name
CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
INTEGER(HID_T) :: file_id ! File identifier
@@ -93,7 +93,7 @@ SUBROUTINE test_table1()
INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_offsetr ! field offset
INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_sizesr ! field sizes
INTEGER(SIZE_T) :: type_sizeout = 0 ! size of the datatype
- INTEGER :: maxlen = 0 ! max chararter length of a field name
+ INTEGER(SIZE_T) :: maxlen = 0 ! max character length of a field name
INTEGER :: Cs_sizeof_double = H5_SIZEOF_DOUBLE ! C's sizeof double
INTEGER :: SIZEOF_X
LOGICAL :: Exclude_double
@@ -106,7 +106,7 @@ SUBROUTINE test_table1()
SIZEOF_X = SIZEOF(bufd(1))
#endif
- ! If Fortran DOUBLE PRECISION and C DOUBLE sizeofs don't match then disable
+ ! If Fortran DOUBLE PRECISION and C DOUBLE sizeofs don't match then disable
! creating a DOUBLE RECISION field, and instead create a REAL field. This
! is needed to handle when DOUBLE PRECISION is promoted via a compiler flag.
Exclude_double = .FALSE.
@@ -511,7 +511,7 @@ SUBROUTINE test_table1()
IF ( maxlen .NE. 8 ) THEN
WRITE(*,'(/,5X,"H5TBGET_FIELD_INFO_F: INCORRECT MAXIMUM CHARACTER LENGTH OF THE FIELD NAMES")')
- WRITE(*,'(5X,"RETURNED VALUE = ", I0, ", CORRECT VALUE = ", I0)') maxlen, 8
+ WRITE(*,'(5X,"RETURNED VALUE = ", I0, ", CORRECT VALUE = ", I0)') maxlen, 8
STOP
ENDIF
@@ -552,7 +552,7 @@ SUBROUTINE test_table2()
USE TSTTABLE ! module for testing table support routines
IMPLICIT NONE
-
+
INTEGER, PARAMETER :: i8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors
INTEGER, PARAMETER :: i16 = SELECTED_INT_KIND(9) ! (18) !should map to INTEGER*8 on most modern processors
INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(5) ! This should map to REAL*4 on most modern processors
@@ -605,7 +605,7 @@ SUBROUTINE test_table2()
test_txt = "Testing H5TBread_table_f and H5TBmake_table_f (F2003)"
CALL test_begin(test_txt)
-
+
! Define an array of Particles
p_data(1:nrecords) = (/ &
particle_t("zero ",0_i8,0_i16,0.0_sp,0.0_dp), &
@@ -641,7 +641,7 @@ SUBROUTINE test_table2()
/)
#endif
- dst_offset(1:nfields) = (/ &
+ dst_offset(1:nfields) = (/ &
H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%name(1:1))), &
H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%lati)), &
H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%long)), &
@@ -693,7 +693,7 @@ SUBROUTINE test_table2()
f_ptr1 = C_LOC(p_data(1)%name(1:1))
f_ptr2 = C_NULL_PTR
-
+
CALL h5tbmake_table_f("Table Title",file_id, table_name, nfields, nrecords, &
dst_size, field_names, dst_offset, field_type, &
chunk_size, f_ptr2, compress, f_ptr1, errcode )
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index 86472fb..c4ddf19 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_SRC)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_SRC C)
#-----------------------------------------------------------------------------
# List Source files
@@ -21,7 +21,6 @@ set (HL_HEADERS
${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h
- ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
${HDF5_HL_SRC_SOURCE_DIR}/H5LTpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5PTpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5TBpublic.h
@@ -29,28 +28,37 @@ set (HL_HEADERS
${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h
)
-add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS})
-TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ")
-target_link_libraries (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
-H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC)
-set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES
- FOLDER libraries/hl
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+set (HL_PRIVATE_HEADERS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
)
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}")
-set (install_targets ${HDF5_HL_LIB_TARGET})
+
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS})
+ target_include_directories (${HDF5_HL_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_options(${HDF5_HL_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}")
+ set (install_targets ${HDF5_HL_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
- add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS})
- TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED " " " ")
- target_link_libraries (${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED ${HDF5_HL_PACKAGE_SOVERSION})
- set_target_properties (${HDF5_HL_LIBSH_TARGET} PROPERTIES
- FOLDER libraries/hl
- COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
+ add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS})
+ target_include_directories (${HDF5_HL_LIBSH_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+ target_compile_options(${HDF5_HL_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_compile_definitions(${HDF5_HL_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB")
+ TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED)
+ target_link_libraries (${HDF5_HL_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED "HL")
+ set_target_properties (${HDF5_HL_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIBSH_TARGET}")
set (install_targets ${install_targets} ${HDF5_HL_LIBSH_TARGET})
endif ()
@@ -74,7 +82,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hllibraries)
+ endif ()
install (
TARGETS
@@ -88,3 +98,51 @@ if (HDF5_EXPORTED_TARGETS)
INCLUDES DESTINATION include
)
endif ()
+
+#-----------------------------------------------------------------------------
+# Create pkgconfig files
+#-----------------------------------------------------------------------------
+set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (_PKG_CONFIG_EXEC_PREFIX \${prefix})
+set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib)
+set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include)
+set (_PKG_CONFIG_LIBNAME "${HDF5_HL_LIB_CORENAME}")
+set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
+
+set (_PKG_CONFIG_LIBS_PRIVATE)
+
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}")
+endif ()
+if (BUILD_SHARED_LIBS)
+ set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_LIB_CORENAME}")
+endif ()
+
+set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}")
+set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}")
+
+configure_file (
+ ${HDF_RESOURCES_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ @ONLY
+)
+install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
+ COMPONENT hllibraries
+)
+
+if (NOT WIN32 AND NOT MINGW)
+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT hllibraries
+ )
+endif ()
diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c
index 99cf2f7..66997cb 100644
--- a/hl/src/H5DO.c
+++ b/hl/src/H5DO.c
@@ -11,90 +11,37 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <stdio.h>
-
/* High-level library internal header file */
#include "H5HLprivate2.h"
/* public LT prototypes */
#include "H5DOpublic.h"
-
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/*-------------------------------------------------------------------------
- * Function: H5DOwrite_chunk
+ * Function: H5DOwrite_chunk
*
- * Purpose: Writes an entire chunk to the file directly.
+ * Purpose: Writes an entire chunk to the file directly.
*
- * Return: Non-negative on success/Negative on failure
+ * The H5DOwrite_chunk() call was moved to H5Dwrite_chunk. This
+ * simple wrapper remains so that people can still link to the
+ * high-level library without changing their code.
*
- * Programmer: Raymond Lu
- * 30 July 2012
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
-H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
size_t data_size, const void *buf)
{
- hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */
- hbool_t do_direct_write = TRUE; /* Flag for direct writes */
- uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
- herr_t ret_value = FAIL; /* Return value */
-
- /* Check arguments */
- if(dset_id < 0)
- goto done;
- if(!buf)
- goto done;
- if(!offset)
- goto done;
- if(!data_size)
- goto done;
- data_size_32 = (uint32_t)data_size;
- if(data_size != (size_t)data_size_32)
- goto done;
-
- /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */
- if(H5P_DEFAULT == dxpl_id) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto done;
- created_dxpl = TRUE;
- } /* end if */
-
- /* Set direct write parameters */
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0)
- goto done;
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0)
- goto done;
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0)
- goto done;
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size_32) < 0)
- goto done;
-
- /* Write chunk */
- if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
- goto done;
+ /* Call underlying H5D function */
+ if (H5Dwrite_chunk(dset_id, dxpl_id, filters, offset, data_size, buf) < 0)
+ return FAIL;
+ else
+ return SUCCEED;
- /* Indicate success */
- ret_value = SUCCEED;
-
-done:
- if(created_dxpl) {
- if(H5Pclose(dxpl_id) < 0)
- ret_value = FAIL;
- } /* end if */
- else {
- /* Reset the direct write flag on user DXPL */
- do_direct_write = FALSE;
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0)
- ret_value = FAIL;
- }
-
- return ret_value;
} /* end H5DOwrite_chunk() */
@@ -103,10 +50,11 @@ done:
*
* Purpose: Reads an entire chunk from the file directly.
*
- * Return: Non-negative on success/Negative on failure
+ * The H5DOread_chunk() call was moved to H5Dread_chunk. This
+ * simple wrapper remains so that people can still link to the
+ * high-level library without changing their code.
*
- * Programmer: Matthew Strong (GE Healthcare)
- * 14 February 2016
+ * Return: Non-negative on success/Negative on failure
*
*---------------------------------------------------------------------------
*/
@@ -114,77 +62,35 @@ herr_t
H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
void *buf)
{
- hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */
- hbool_t do_direct_read = TRUE; /* Flag for direct writes */
- herr_t ret_value = FAIL; /* Return value */
-
- /* Check arguments */
- if(dset_id < 0)
- goto done;
- if(!buf)
- goto done;
- if(!offset)
- goto done;
- if(!filters)
- goto done;
-
- /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */
- if(H5P_DEFAULT == dxpl_id) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto done;
- created_dxpl = TRUE;
- } /* end if */
+ /* Call underlying H5D function */
+ if (H5Dread_chunk(dset_id, dxpl_id, offset, filters, buf) < 0)
+ return FAIL;
+ else
+ return SUCCEED;
+ } /* end H5DOread_chunk() */
- /* Set direct write parameters */
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0)
- goto done;
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &offset) < 0)
- goto done;
-
- /* Read chunk */
- if(H5Dread(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
- goto done;
- /* Get the filter mask */
- if(H5Pget(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, filters) < 0)
- goto done;
-
- /* Indicate success */
- ret_value = SUCCEED;
-
-done:
- if(created_dxpl) {
- if(H5Pclose(dxpl_id) < 0)
- ret_value = FAIL;
- } /* end if */
- else {
- /* Reset the direct read flag on user DXPL */
- do_direct_read = FALSE;
- if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0)
- ret_value = FAIL;
- }
-
- return ret_value;
-} /* end H5DOread_chunk() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------
- * Function: H5DOappend()
+ * Function: H5DOappend()
*
* Purpose: To append elements to a dataset.
- * axis: the dataset dimension (zero-based) for the append
- * extension: the # of elements to append for the axis-th dimension
- * memtype: the datatype
- * buf: buffer with data for the append
*
- * Return: Non-negative on success/Negative on failure
+ * axis: the dataset dimension (zero-based) for the append
+ * extension: the # of elements to append for the axis-th dimension
+ * memtype: the datatype
+ * buf: buffer with data for the append
+ *
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Vailin Choi; Jan 2014
+ * Programmer: Vailin Choi; Jan 2014
*
* Note:
* This routine is copied from the fast forward feature branch: features/hdf5_ff
* src/H5FF.c:H5DOappend() with the following modifications:
* 1) Remove and replace macro calls such as
- * FUNC_ENTER_API, H5TRACE, HGOTO_ERROR
+ * FUNC_ENTER_API, H5TRACE, HGOTO_ERROR
* accordingly because hl does not have these macros
* 2) Replace H5I_get_type() by H5Iget_type()
* 3) Replace H5P_isa_class() by H5Pisa_class()
@@ -197,10 +103,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
+H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
hid_t memtype, const void *buf)
{
- hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */
hsize_t size[H5S_MAX_RANK]; /* The new size (after extension */
hsize_t old_size = 0; /* The size of the dimension to be extended */
int sndims; /* Number of dimensions in dataspace (signed) */
@@ -227,48 +132,45 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
/* check arguments */
if(H5I_DATASET != H5Iget_type(dset_id))
- goto done;
+ goto done;
- /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */
- if(H5P_DEFAULT == dxpl_id) {
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ /* If the user passed in a default DXPL, sanity check it */
+ if(H5P_DEFAULT != dxpl_id)
+ if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
goto done;
- created_dxpl = TRUE;
- } /* end if */
- else if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
- goto done;
/* Get the dataspace of the dataset */
if(FAIL == (space_id = H5Dget_space(dset_id)))
- goto done;
+ goto done;
/* Get the rank of this dataspace */
if((sndims = H5Sget_simple_extent_ndims(space_id)) < 0)
- goto done;
+ goto done;
ndims = (unsigned)sndims;
/* Verify correct axis */
if(axis >= ndims)
- goto done;
+ goto done;
/* Get the dimensions sizes of the dataspace */
if(H5Sget_simple_extent_dims(space_id, size, NULL) < 0)
- goto done;
+ goto done;
- /* Adjust the dimension size of the requested dimension,
- but first record the old dimension size */
+ /* Adjust the dimension size of the requested dimension,
+ * but first record the old dimension size
+ */
old_size = size[axis];
size[axis] += extension;
if(size[axis] < old_size)
- goto done;
+ goto done;
/* Set the extent of the dataset to the new dimension */
if(H5Dset_extent(dset_id, size) < 0)
- goto done;
+ goto done;
/* Get the new dataspace of the dataset */
if(FAIL == (new_space_id = H5Dget_space(dset_id)))
- goto done;
+ goto done;
/* Select a hyperslab corresponding to the append operation */
for(u = 0 ; u < ndims ; u++) {
@@ -282,81 +184,75 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension,
} /* end if */
} /* end for */
if(FAIL == H5Sselect_hyperslab(new_space_id, H5S_SELECT_SET, start, stride, count, block))
- goto done;
+ goto done;
/* The # of elemnts in the new extended dataspace */
if((snelmts = H5Sget_select_npoints(new_space_id)) < 0)
- goto done;
+ goto done;
nelmts = (hsize_t)snelmts;
/* create a memory space */
if(FAIL == (mem_space_id = H5Screate_simple(1, &nelmts, NULL)))
- goto done;
+ goto done;
/* Write the data */
if(H5Dwrite(dset_id, memtype, mem_space_id, new_space_id, dxpl_id, buf) < 0)
- goto done;
+ goto done;
/* Obtain the dataset's access property list */
if((dapl = H5Dget_access_plist(dset_id)) < 0)
- goto done;
+ goto done;
/* Allocate the boundary array */
boundary = (hsize_t *)HDmalloc(ndims * sizeof(hsize_t));
/* Retrieve the append flush property */
if(H5Pget_append_flush(dapl, ndims, boundary, &append_cb, &udata) < 0)
- goto done;
+ goto done;
/* No boundary for this axis */
if(boundary[axis] != 0) {
- /* Determine whether a boundary is hit or not */
- for(k = start[axis]; k < size[axis]; k++)
- if(!((k + 1) % boundary[axis])) {
- hit = TRUE;
- break;
- }
-
- if(hit) { /* Hit the boundary */
- /* Invoke callback if there is one */
- if(append_cb && append_cb(dset_id, size, udata) < 0)
- goto done;
-
- /* Do a dataset flush */
- if(H5Dflush(dset_id) < 0)
- goto done;
- } /* end if */
+ /* Determine whether a boundary is hit or not */
+ for(k = start[axis]; k < size[axis]; k++)
+ if(!((k + 1) % boundary[axis])) {
+ hit = TRUE;
+ break;
+ }
+
+ if(hit) { /* Hit the boundary */
+ /* Invoke callback if there is one */
+ if(append_cb && append_cb(dset_id, size, udata) < 0)
+ goto done;
+
+ /* Do a dataset flush */
+ if(H5Dflush(dset_id) < 0)
+ goto done;
+ } /* end if */
} /* end if */
/* Indicate success */
ret_value = SUCCEED;
done:
- /* Close dxpl if we created it vs. one was passed in */
- if(created_dxpl) {
- if(H5Pclose(dxpl_id) < 0)
- ret_value = FAIL;
- } /* end if */
-
/* Close old dataspace */
if(space_id != FAIL && H5Sclose(space_id) < 0)
- ret_value = FAIL;
+ ret_value = FAIL;
/* Close new dataspace */
if(new_space_id != FAIL && H5Sclose(new_space_id) < 0)
- ret_value = FAIL;
+ ret_value = FAIL;
/* Close memory dataspace */
if(mem_space_id != FAIL && H5Sclose(mem_space_id) < 0)
- ret_value = FAIL;
+ ret_value = FAIL;
/* Close the dataset access property list */
if(dapl != FAIL && H5Pclose(dapl) < 0)
- ret_value = FAIL;
+ ret_value = FAIL;
if(boundary)
- HDfree(boundary);
+ HDfree(boundary);
return ret_value;
} /* H5DOappend() */
diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h
index d5c8de4..e09ebca 100644
--- a/hl/src/H5DOpublic.h
+++ b/hl/src/H5DOpublic.h
@@ -25,18 +25,23 @@ extern "C" {
*-------------------------------------------------------------------------
*/
-H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters,
- const hsize_t *offset, size_t data_size, const void *buf);
-
-H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, /*in*/
- hid_t dxpl_id, /*in*/
- const hsize_t *offset, /*in*/
- uint32_t *filters, /*out*/
- void *buf); /*out*/
-
H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis,
size_t extension, hid_t memtype, const void *buf);
+/* Symbols defined for compatibility with previous versions of the HDF5 API.
+ *
+ * Use of these symbols is deprecated.
+ */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+/* Compatibility wrappers for functionality moved to H5D */
+H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters,
+ const hsize_t *offset, size_t data_size, const void *buf);
+H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset,
+ uint32_t *filters /*out*/, void *buf /*out*/);
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
#ifdef __cplusplus
}
#endif
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 527c92b..63fb461 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -140,10 +140,10 @@ herr_t H5DSattach_scale(hid_t did,
hobj_ref_t ref_j; /* iterator reference */
hvl_t *buf = NULL; /* VL buffer to store in the attribute */
hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
- H5O_info_t oi1, oi2;
+ H5O_info2_t oi1, oi2;
H5I_type_t it1, it2;
int i;
- size_t len;
+ size_t len;
int found_ds=0;
htri_t is_scale;
@@ -156,20 +156,26 @@ herr_t H5DSattach_scale(hid_t did,
return FAIL;
/* the dataset cannot be a DS dataset */
- if ( is_scale == 1)
+ if (is_scale == 1)
return FAIL;
/* get info for the dataset in the parameter list */
- if(H5Oget_info(did, &oi1) < 0)
+ if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0)
return FAIL;
/* get info for the scale in the parameter list */
- if(H5Oget_info(dsid, &oi2) < 0)
+ if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0)
return FAIL;
/* same object, not valid */
- if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr)
- return FAIL;
+ if(oi1.fileno == oi2.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ return FAIL;
+ if(!token_cmp)
+ return FAIL;
+ } /* end if */
/* get ID type */
if ((it1 = H5Iget_type(did)) < 0)
@@ -177,7 +183,7 @@ herr_t H5DSattach_scale(hid_t did,
if ((it2 = H5Iget_type(dsid)) < 0)
return FAIL;
- if (H5I_DATASET!=it1 || H5I_DATASET!=it2)
+ if (H5I_DATASET != it1 || H5I_DATASET != it2)
return FAIL;
/* the DS dataset cannot have dimension scales */
@@ -202,19 +208,19 @@ herr_t H5DSattach_scale(hid_t did,
return FAIL;
/* get rank */
- if ((rank=H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* scalar rank */
- if (rank==0)
- rank=1;
+ if (rank == 0)
+ rank = 1;
/* close dataset space */
if (H5Sclose(sid) < 0)
return FAIL;
/* parameter range checking */
- if (idx>(unsigned)rank-1)
+ if (idx > (unsigned)rank-1)
return FAIL;
/*-------------------------------------------------------------------------
@@ -241,7 +247,7 @@ herr_t H5DSattach_scale(hid_t did,
if (has_dimlist == 0)
{
- dims[0] = (hsize_t)rank;
+ dims[0] = (hsize_t)rank;
/* space for the attribute */
if((sid = H5Screate_simple(1, dims, NULL)) < 0)
@@ -275,7 +281,7 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
/* close */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
if(H5Sclose(sid) < 0)
goto out;
@@ -324,16 +330,22 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
/* get info for DS in the parameter list */
- if(H5Oget_info(dsid, &oi1) < 0)
+ if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0)
goto out;
/* get info for this DS */
- if(H5Oget_info(dsid_j, &oi2) < 0)
+ if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0)
goto out;
/* same object, so this DS scale is already in this DIM IDX */
- if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr)
- found_ds = 1;
+ if(oi1.fileno == oi2.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp)
+ found_ds = 1;
+ } /* end if */
/* close the dereferenced dataset */
if(H5Dclose(dsid_j) < 0)
@@ -361,7 +373,7 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
/* close */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
if(H5Sclose(sid) < 0)
goto out;
@@ -508,7 +520,7 @@ herr_t H5DSattach_scale(hid_t did,
*-------------------------------------------------------------------------
*/
- if((is_ds=H5DSis_scale(dsid)) < 0)
+ if((is_ds = H5DSis_scale(dsid)) < 0)
return FAIL;
if(is_ds == 0) {
@@ -556,9 +568,9 @@ out:
*
* Date: December 20, 2004
*
-* Comments:
+* Comments:
*
-* Modifications: Function didn't delete DIMENSION_LIST attribute, when
+* Modifications: Function didn't delete DIMENSION_LIST attribute, when
* all dimension scales were detached from a dataset; added.
* 2010/05/13 EIP
*
@@ -586,7 +598,7 @@ herr_t H5DSdetach_scale(hid_t did,
int i;
size_t j;
hssize_t ii;
- H5O_info_t did_oi, dsid_oi, tmp_oi;
+ H5O_info2_t did_oi, dsid_oi, tmp_oi;
int found_dset = 0, found_ds = 0;
int have_ds = 0;
htri_t is_scale;
@@ -598,7 +610,7 @@ herr_t H5DSdetach_scale(hid_t did,
/* check for valid types of identifiers */
- if(H5I_DATASET!=H5Iget_type(did) || H5I_DATASET!=H5Iget_type(dsid))
+ if(H5I_DATASET != H5Iget_type(did) || H5I_DATASET != H5Iget_type(dsid))
return FAIL;
if((is_scale = H5DSis_scale(did)) < 0)
@@ -609,16 +621,22 @@ herr_t H5DSdetach_scale(hid_t did,
return FAIL;
/* get info for the dataset in the parameter list */
- if(H5Oget_info(did, &did_oi) < 0)
+ if(H5Oget_info3(did, &did_oi, H5O_INFO_BASIC) < 0)
return FAIL;
/* get info for the scale in the parameter list */
- if(H5Oget_info(dsid, &dsid_oi) < 0)
+ if(H5Oget_info3(dsid, &dsid_oi, H5O_INFO_BASIC) < 0)
return FAIL;
/* same object, not valid */
- if(did_oi.fileno == dsid_oi.fileno && did_oi.addr == dsid_oi.addr)
- return FAIL;
+ if(did_oi.fileno == dsid_oi.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &did_oi.token, &dsid_oi.token, &token_cmp) < 0)
+ return FAIL;
+ if(!token_cmp)
+ return FAIL;
+ } /* end if */
/*-------------------------------------------------------------------------
@@ -626,7 +644,7 @@ herr_t H5DSdetach_scale(hid_t did,
*-------------------------------------------------------------------------
*/
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
- if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST)) < 0)
+ if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0)
return FAIL;
if (has_dimlist == 0)
@@ -637,7 +655,7 @@ herr_t H5DSdetach_scale(hid_t did,
return FAIL;
/* get rank */
- if ((rank=H5Sget_simple_extent_ndims(sid)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
goto out;
/* close dataset space */
@@ -645,7 +663,7 @@ herr_t H5DSdetach_scale(hid_t did,
return FAIL;
/* parameter range checking */
- if (idx>(unsigned)rank-1)
+ if (idx > (unsigned)rank-1)
return FAIL;
/*-------------------------------------------------------------------------
@@ -696,7 +714,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* get info for this DS */
- if(H5Oget_info(dsid_j, &tmp_oi) < 0)
+ if(H5Oget_info3(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0)
goto out;
/* Close the dereferenced dataset */
@@ -704,30 +722,35 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* same object, reset */
- if(dsid_oi.fileno == tmp_oi.fileno && dsid_oi.addr == tmp_oi.addr)
- {
- /* If there are more than one reference in the VL element
- and the reference we found is not the last one,
- copy the last one to replace the found one since the order
- of the references doesn't matter according to the spec;
- reduce the size of the VL element by 1;
- if the length of the element becomes 0, free the pointer
- and reset to NULL */
-
- size_t len = buf[idx].len;
-
- if(j < len - 1)
- ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1];
- len = --buf[idx].len;
- if(len == 0) {
- HDfree(buf[idx].p);
- buf[idx].p = NULL;
- }
- /* Since a reference to a dim. scale can be inserted only once,
- we do not need to continue the search if it is found */
- found_ds = 1;
- break;
- }
+ if(dsid_oi.fileno == tmp_oi.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &dsid_oi.token, &tmp_oi.token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp) {
+ /* If there are more than one reference in the VL element
+ and the reference we found is not the last one,
+ copy the last one to replace the found one since the order
+ of the references doesn't matter according to the spec;
+ reduce the size of the VL element by 1;
+ if the length of the element becomes 0, free the pointer
+ and reset to NULL */
+
+ size_t len = buf[idx].len;
+
+ if(j < len - 1)
+ ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1];
+ len = --buf[idx].len;
+ if(len == 0) {
+ HDfree(buf[idx].p);
+ buf[idx].p = NULL;
+ }
+ /* Since a reference to a dim. scale can be inserted only once,
+ we do not need to continue the search if it is found */
+ found_ds = 1;
+ break;
+ } /* end if */
+ } /* end if */
} /* j */
} /* if */
@@ -736,16 +759,16 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* Write the attribute, but check first, if we have any scales left,
- because if not, we should delete the attribute according to the spec */
+ because if not, we should delete the attribute according to the spec */
for(i = 0; i < rank; i++) {
if(buf[i].len > 0) {
have_ds = 1;
- break;
+ break;
}
}
- if(have_ds) {
+ if(have_ds) {
if(H5Awrite(aid, tid, buf) < 0)
- goto out;
+ goto out;
}
else {
if(H5Adelete(did, DIMENSION_LIST) < 0)
@@ -753,7 +776,7 @@ herr_t H5DSdetach_scale(hid_t did,
}
/* close */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
if(H5Sclose(sid) < 0)
goto out;
@@ -795,7 +818,7 @@ herr_t H5DSdetach_scale(hid_t did,
if(H5Aread(aid, ntid, dsbuf) < 0)
goto out;
- for(ii=0; ii<nelmts; ii++) {
+ for(ii = 0; ii < nelmts; ii++) {
/* First check if we have the same dimension index */
if(idx == dsbuf[ii].dim_idx) {
/* get the reference to the dataset */
@@ -806,7 +829,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* get info for this dataset */
- if(H5Oget_info(did_i, &tmp_oi) < 0)
+ if(H5Oget_info3(did_i, &tmp_oi, H5O_INFO_BASIC) < 0)
goto out;
/* close the dereferenced dataset */
@@ -814,13 +837,19 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* same object, reset. we want to detach only for this DIM */
- if(did_oi.fileno == tmp_oi.fileno && did_oi.addr == tmp_oi.addr) {
- /* copy the last one to replace the one which is found */
- dsbuf[ii] = dsbuf[nelmts-1];
- nelmts--;
- found_dset=1;
- break;
- } /* if */
+ if(did_oi.fileno == tmp_oi.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &did_oi.token, &tmp_oi.token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp) {
+ /* copy the last one to replace the one which is found */
+ dsbuf[ii] = dsbuf[nelmts-1];
+ nelmts--;
+ found_dset=1;
+ break;
+ } /* end if */
+ } /* end if */
} /* if we have the same dimension index */
} /* ii */
@@ -896,7 +925,7 @@ out:
dsbuf = NULL;
}
if(buf) {
- /* Failure occured before H5Dvlen_reclaim was called;
+ /* Failure occured before H5Treclaim was called;
free the pointers allocated when we read data in */
for(i = 0; i < rank; i++) {
if(buf[i].p)
@@ -954,7 +983,7 @@ htri_t H5DSis_attached(hid_t did,
hvl_t *buf = NULL; /* VL buffer to store in the attribute */
hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */
hid_t did_i; /* dataset ID in REFERENCE_LIST */
- H5O_info_t oi1, oi2, oi3, oi4;
+ H5O_info2_t oi1, oi2, oi3, oi4;
H5I_type_t it1, it2;
int i;
int found_dset=0, found_ds=0;
@@ -973,16 +1002,22 @@ htri_t H5DSis_attached(hid_t did,
return FAIL;
/* get info for the dataset in the parameter list */
- if(H5Oget_info(did, &oi1) < 0)
+ if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0)
return FAIL;
/* get info for the scale in the parameter list */
- if(H5Oget_info(dsid, &oi2) < 0)
+ if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0)
return FAIL;
/* same object, not valid */
- if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr)
- return FAIL;
+ if(oi1.fileno == oi2.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ return FAIL;
+ if(!token_cmp)
+ return FAIL;
+ } /* end if */
/* get ID type */
if ((it1 = H5Iget_type(did)) < 0)
@@ -990,7 +1025,7 @@ htri_t H5DSis_attached(hid_t did,
if ((it2 = H5Iget_type(dsid)) < 0)
return FAIL;
- if (H5I_DATASET!=it1 || H5I_DATASET!=it2)
+ if (H5I_DATASET != it1 || H5I_DATASET != it2)
return FAIL;
/*-------------------------------------------------------------------------
@@ -1040,7 +1075,7 @@ htri_t H5DSis_attached(hid_t did,
goto out;
/* read */
- if (H5Aread(aid,tid,buf) < 0)
+ if (H5Aread(aid, tid, buf) < 0)
goto out;
/* iterate all the REFs in this dimension IDX */
@@ -1050,20 +1085,26 @@ 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 = H5Rdereference2(did,H5P_DEFAULT,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 */
- if(H5Oget_info(dsid, &oi1) < 0)
+ if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0)
goto out;
/* get info for this DS */
- if(H5Oget_info(dsid_j, &oi2) < 0)
+ if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0)
goto out;
/* same object */
- if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr)
- found_ds = 1;
+ if(oi1.fileno == oi2.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp)
+ found_ds = 1;
+ } /* end if */
/* close the dereferenced dataset */
if (H5Dclose(dsid_j) < 0)
@@ -1073,7 +1114,7 @@ htri_t H5DSis_attached(hid_t did,
/* close */
- if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
if (H5Sclose(sid) < 0)
goto out;
@@ -1123,7 +1164,7 @@ htri_t H5DSis_attached(hid_t did,
if (dsbuf == NULL)
goto out;
- if (H5Aread(aid,ntid,dsbuf) < 0)
+ if (H5Aread(aid, ntid, dsbuf) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -1131,7 +1172,7 @@ htri_t H5DSis_attached(hid_t did,
*-------------------------------------------------------------------------
*/
- for(i=0; i<nelmts; i++)
+ for(i = 0; i < nelmts; i++)
{
/* get the reference */
ref = dsbuf[i].ref;
@@ -1140,20 +1181,26 @@ htri_t H5DSis_attached(hid_t did,
if (ref)
{
/* get the dataset id */
- if ((did_i = H5Rdereference2(did,H5P_DEFAULT,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 */
- if(H5Oget_info(did, &oi3) < 0)
+ if(H5Oget_info3(did, &oi3, H5O_INFO_BASIC) < 0)
goto out;
/* get info for this dataset */
- if(H5Oget_info(did_i, &oi4) < 0)
+ if(H5Oget_info3(did_i, &oi4, H5O_INFO_BASIC) < 0)
goto out;
/* same object */
- if(oi3.fileno == oi4.fileno && oi3.addr == oi4.addr && idx==dsbuf[i].dim_idx)
- found_dset=1;
+ if(oi3.fileno == oi4.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(did, &oi3.token, &oi4.token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp && (idx == dsbuf[i].dim_idx))
+ found_dset=1;
+ } /* end if */
/* close the dereferenced dataset */
if (H5Dclose(did_i) < 0)
@@ -1373,7 +1420,7 @@ herr_t H5DSiterate_scales(hid_t did,
} /* if */
/* close */
- if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0)
+ if (H5Treclaim(tid,sid,H5P_DEFAULT,buf) < 0)
goto out;
if (H5Sclose(sid) < 0)
goto out;
@@ -1391,7 +1438,7 @@ herr_t H5DSiterate_scales(hid_t did,
out:
H5E_BEGIN_TRY {
if(buf) {
- H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
+ H5Treclaim(tid,sid,H5P_DEFAULT,buf);
HDfree(buf);
}
H5Sclose(sid);
@@ -1445,7 +1492,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
if (H5I_DATASET != it)
return FAIL;
- if (label == NULL)
+ if (label == NULL)
return FAIL;
/* get dataset space */
@@ -1502,7 +1549,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
for (i = 0; i < (unsigned int) rank; i++)
- u.const_buf[i] = NULL;
+ u.const_buf[i] = NULL;
/* store the label information in the required index */
u.const_buf[idx] = label;
@@ -1532,7 +1579,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
else
{
-
+
if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0)
goto out;
@@ -1541,7 +1588,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
/* allocate and initialize */
u.buf = (char **) HDmalloc((size_t) rank * sizeof(char *));
-
+
if (u.buf == NULL)
goto out;
@@ -1626,7 +1673,7 @@ out:
* Comments:
*
* Modifications:
-* JIRA HDFFV-7673: Added a check to see if the label name exists,
+* JIRA HDFFV-7673: Added a check to see if the label name exists,
* if not then returns zero. July 30, 2011. MSB
*
*-------------------------------------------------------------------------
@@ -1714,26 +1761,26 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
if (buf[idx] != NULL)
{
/* get the real string length */
- nbytes = strlen(buf[idx]);
+ nbytes = HDstrlen(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)
+ {
+ HDmemcpy(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])
- HDfree(buf[i]);
+ HDfree(buf[i]);
}
/* close */
@@ -1867,7 +1914,7 @@ ssize_t H5DSget_scale_name(hid_t did,
/* copy all/some of the name */
if (name) {
- memcpy(name, buf, copy_len);
+ HDmemcpy(name, buf, copy_len);
/* terminate the string */
name[copy_len]='\0';
@@ -1951,33 +1998,33 @@ htri_t H5DSis_scale(hid_t did)
if((tid = H5Aget_type(aid)) < 0)
goto out;
- /* check to make sure attribute is a string */
- if(H5T_STRING != H5Tget_class(tid))
- goto out;
+ /* check to make sure attribute is a string */
+ if(H5T_STRING != H5Tget_class(tid))
+ goto out;
- /* check to make sure string is null-terminated */
- if(H5T_STR_NULLTERM != H5Tget_strpad(tid))
- goto out;
+ /* check to make sure string is null-terminated */
+ if(H5T_STR_NULLTERM != H5Tget_strpad(tid))
+ goto out;
- /* allocate buffer large enough to hold string */
- if((storage_size = H5Aget_storage_size(aid)) == 0)
- goto out;
+ /* allocate buffer large enough to hold string */
+ if((storage_size = H5Aget_storage_size(aid)) == 0)
+ goto out;
- buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1);
- if(buf == NULL)
- goto out;
+ buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1);
+ if(buf == NULL)
+ goto out;
- /* Read the attribute */
+ /* Read the attribute */
if(H5Aread(aid, tid, buf) < 0)
- goto out;
+ goto out;
- /* compare strings */
+ /* compare strings */
if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0)
is_ds = 1;
else
is_ds = 0;
- HDfree(buf);
+ HDfree(buf);
if(H5Tclose(tid) < 0)
goto out;
@@ -2095,7 +2142,7 @@ int H5DSget_num_scales(hid_t did,
nscales = (int)buf[idx].len;
/* close */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0)
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0)
goto out;
if(H5Sclose(sid) < 0)
goto out;
@@ -2236,8 +2283,8 @@ out:
static
hid_t H5DS_get_REFLIST_type(void)
{
- hid_t ntid_t = -1;
-
+ hid_t ntid_t = -1;
+
/* Build native type that corresponds to compound datatype
used to store ds_list_t structure in the REFERENCE_LIST
attribute */
@@ -2257,5 +2304,5 @@ out:
H5Tclose(ntid_t);
} H5E_END_TRY;
return FAIL;
-}
+}
diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c
index a4818b8..6f7414b 100644
--- a/hl/src/H5IM.c
+++ b/hl/src/H5IM.c
@@ -44,7 +44,7 @@ herr_t H5IMmake_image_8bit( hid_t loc_id,
hsize_t dims[IMAGE8_RANK];
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Initialize the image dimensions */
@@ -104,9 +104,9 @@ herr_t H5IMmake_image_24bit( hid_t loc_id,
hsize_t dims[IMAGE24_RANK];
/* check the arguments */
- if (interlace == NULL)
+ if (interlace == NULL)
return -1;
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
@@ -180,7 +180,7 @@ static herr_t find_palette(hid_t loc_id,
int ret = H5_ITER_CONT;
/* check the arguments */
- if (name == NULL)
+ if (name == NULL)
return -1;
/* Shut compiler up */
@@ -261,9 +261,9 @@ herr_t H5IMget_image_info( hid_t loc_id,
int has_attr;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
- if (interlace == NULL)
+ if (interlace == NULL)
return -1;
/*assume initially we have no palettes attached*/
@@ -274,7 +274,8 @@ herr_t H5IMget_image_info( hid_t loc_id,
return -1;
/* Try to find the attribute "INTERLACE_MODE" on the >>image<< dataset */
- has_attr = H5LT_find_attribute(did, "INTERLACE_MODE");
+ if ((has_attr = H5LT_find_attribute(did, "INTERLACE_MODE")) < 0)
+ goto out;
/* It exists, get it */
if(has_attr == 1)
@@ -430,7 +431,7 @@ herr_t H5IMread_image( hid_t loc_id,
hid_t did;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Open the dataset. */
@@ -483,7 +484,7 @@ herr_t H5IMmake_palette( hid_t loc_id,
int has_pal;
/* check the arguments */
- if (pal_name == NULL)
+ if (pal_name == NULL)
return -1;
/* Check if the dataset already exists */
@@ -548,11 +549,11 @@ herr_t H5IMlink_palette( hid_t loc_id,
hsize_t dim_ref;
int ok_pal;
-
+
/* check the arguments */
- if (image_name == NULL)
+ if (image_name == NULL)
return -1;
- if (pal_name == NULL)
+ if (pal_name == NULL)
return -1;
/* The image dataset may or may not have the attribute "PALETTE"
@@ -717,9 +718,9 @@ herr_t H5IMunlink_palette( hid_t loc_id,
int ok_pal, has_pal;
/* check the arguments */
- if(image_name == NULL)
+ if(image_name == NULL)
return -1;
- if(pal_name == NULL)
+ if(pal_name == NULL)
return -1;
/* Try to find the palette dataset */
@@ -818,7 +819,7 @@ herr_t H5IMget_npalettes( hid_t loc_id,
int has_pal;
/* check the arguments */
- if(image_name == NULL)
+ if(image_name == NULL)
return -1;
/*assume initially we have no palettes attached*/
@@ -916,7 +917,7 @@ herr_t H5IMget_palette_info( hid_t loc_id,
hsize_t pal_maxdims[2];
/* check the arguments */
- if (image_name == NULL)
+ if (image_name == NULL)
return -1;
/* Open the dataset. */
@@ -1030,9 +1031,9 @@ herr_t H5IMget_palette( hid_t loc_id,
hid_t pal_id;
/* check the arguments */
- if (image_name == NULL)
+ if (image_name == NULL)
return -1;
- if (pal_data == NULL)
+ if (pal_data == NULL)
return -1;
@@ -1133,7 +1134,7 @@ herr_t H5IMis_image( hid_t loc_id,
herr_t ret;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Assume initially fail condition */
@@ -1237,7 +1238,7 @@ herr_t H5IMis_palette( hid_t loc_id,
herr_t ret;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Assume initially fail condition */
diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c
index 1669a30..3106ea8 100644
--- a/hl/src/H5LD.c
+++ b/hl/src/H5LD.c
@@ -209,7 +209,7 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[]/*OUT*/, hid_t par_tid)
valid = FALSE;
end_of_fields = TRUE;
break;
-
+
case '\\': /* escape character */
++fields_ptr; /* skip it */
if(*fields_ptr == '\0')
@@ -241,7 +241,7 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[]/*OUT*/, hid_t par_tid)
gotcomma = TRUE;
break;
- default:
+ default:
*cur++ = *fields_ptr++;
gotmember = TRUE;
break;
@@ -438,7 +438,7 @@ H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims
/* Get dataset's dataspace */
if((sid = H5Dget_space(did)) < 0)
goto done;
-
+
/* Get the number of dimensions */
if((ndims = H5Sget_simple_extent_ndims(sid)) < 0)
goto done;
@@ -508,7 +508,7 @@ H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims
/* Get the total size of the dataset's datatypes */
if(0 == (tot_tsize = H5LD_get_dset_type_size(did, NULL)))
goto done;
-
+
/* Allocate memory for reading in the elements in the dataset selection */
if(NULL == (sav_buf = tmp_buf = (char *)HDcalloc((size_t)num_elmts, tot_tsize)))
goto done;
diff --git a/hl/src/H5LDprivate.h b/hl/src/H5LDprivate.h
index b52928b..203bcea 100644
--- a/hl/src/H5LDprivate.h
+++ b/hl/src/H5LDprivate.h
@@ -19,9 +19,9 @@
#include "H5LDpublic.h"
/* Store information for a field in <list_of_fields> for a compound data type */
-/*
+/*
* Note: This data structure is used by both H5LD.c and hl/tools/h5watch
- * This declaration is repeated in tools/lib/h5tools_str.c
+ * This declaration is repeated in tools/lib/h5tools_str.c
*/
typedef struct H5LD_memb_t {
size_t tot_offset;
@@ -30,7 +30,10 @@ typedef struct H5LD_memb_t {
char **names;
} H5LD_memb_t;
-/*
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
* Note that these two private routines are called by hl/tools/h5watch.
* Have considered the following options:
* 1) Repeat the coding in both H5LD.c and h5watch
@@ -40,8 +43,12 @@ typedef struct H5LD_memb_t {
* #2: these two routines are too specific to be made as public routines
* Decide to do #3 at this point of time after some discussion.
*/
-void H5LD_clean_vector(H5LD_memb_t *listv[]);
-int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
+H5_HLDLL void H5LD_clean_vector(H5LD_memb_t *listv[]);
+H5_HLDLL int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* end _H5LDprivate_H */
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 0074d02..a631533 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -29,19 +29,19 @@ char *myinput;
size_t indent = 0;
-/* File Image operations
-
- A file image is a representation of an HDF5 file in a memory
- buffer. In order to perform operations on an image in a similar way
+/* File Image operations
+
+ A file image is a representation of an HDF5 file in a memory
+ buffer. In order to perform operations on an image in a similar way
to a file, the application buffer is copied to a FAPL buffer, which
- in turn is copied to a VFD buffer. Buffer copying can decrease
- performance, especially when using large file images. A solution to
- this issue is to simulate the copying of the application buffer,
- when actually the same buffer is used for the FAPL and the VFD.
- This is implemented by using callbacks that simulate the standard
- functions for memory management (additional callbacks are used for
- the management of associated data structures). From the application
- standpoint, a file handle can be obtained from a file image by using
+ in turn is copied to a VFD buffer. Buffer copying can decrease
+ performance, especially when using large file images. A solution to
+ this issue is to simulate the copying of the application buffer,
+ when actually the same buffer is used for the FAPL and the VFD.
+ This is implemented by using callbacks that simulate the standard
+ functions for memory management (additional callbacks are used for
+ the management of associated data structures). From the application
+ standpoint, a file handle can be obtained from a file image by using
the API routine H5LTopen_file_image(). This function takes a flag
argument that indicates the HDF5 library how to handle the given image;
several flag values can be combined by using the bitwise OR operator.
@@ -61,9 +61,9 @@ size_t indent = 0;
well. The application is responsible to release the image buffer.
*/
-/* Data structure to pass application data to callbacks. */
+/* Data structure to pass application data to callbacks. */
typedef struct {
- void *app_image_ptr; /* Pointer to application buffer */
+ void *app_image_ptr; /* Pointer to application buffer */
size_t app_image_size; /* Size of application buffer */
void *fapl_image_ptr; /* Pointer to FAPL buffer */
size_t fapl_image_size; /* Size of FAPL buffer */
@@ -88,17 +88,17 @@ static herr_t udata_free(void *udata);
/*-------------------------------------------------------------------------
-* Function: image_malloc
+* Function: image_malloc
*
* Purpose: Simulates malloc() function to avoid copying file images.
* The application buffer is set to the buffer on only one FAPL.
* Then the FAPL buffer can be copied to other FAPL buffers or
-* to only one VFD buffer.
+* to only one VFD buffer.
*
* Return: Address of "allocated" buffer, if successful. Otherwise, it returns
* NULL.
*
-* Programmer: Christian Chilan
+* Programmer: Christian Chilan
*
* Date: October 3, 2011
*
@@ -109,23 +109,23 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
{
H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
void * return_value = NULL;
-
+
/* callback is only used if the application buffer is not actually copied */
- if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
+ if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
switch ( file_image_op ) {
/* the app buffer is "copied" to only one FAPL. Afterwards, FAPLs can be "copied" */
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET:
- if (udata->app_image_ptr == NULL)
+ if (udata->app_image_ptr == NULL)
goto out;
- if (udata->app_image_size != size)
+ if (udata->app_image_size != size)
goto out;
- if (udata->fapl_image_ptr != NULL)
+ if (udata->fapl_image_ptr != NULL)
goto out;
- if (udata->fapl_image_size != 0)
+ if (udata->fapl_image_size != 0)
goto out;
- if (udata->fapl_ref_count != 0)
+ if (udata->fapl_ref_count != 0)
goto out;
udata->fapl_image_ptr = udata->app_image_ptr;
@@ -135,11 +135,11 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
break;
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY:
- if (udata->fapl_image_ptr == NULL)
+ if (udata->fapl_image_ptr == NULL)
goto out;
- if (udata->fapl_image_size != size)
+ if (udata->fapl_image_size != size)
goto out;
- if (udata->fapl_ref_count == 0)
+ if (udata->fapl_ref_count == 0)
goto out;
return_value = udata->fapl_image_ptr;
@@ -151,17 +151,17 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
case H5FD_FILE_IMAGE_OP_FILE_OPEN:
/* FAPL buffer is "copied" to only one VFD buffer */
- if (udata->vfd_image_ptr != NULL)
+ if (udata->vfd_image_ptr != NULL)
goto out;
- if (udata->vfd_image_size != 0)
+ if (udata->vfd_image_size != 0)
goto out;
- if (udata->vfd_ref_count != 0)
+ if (udata->vfd_ref_count != 0)
goto out;
- if (udata->fapl_image_ptr == NULL)
+ if (udata->fapl_image_ptr == NULL)
goto out;
- if (udata->fapl_image_size != size)
+ if (udata->fapl_image_size != size)
goto out;
- if (udata->fapl_ref_count == 0)
+ if (udata->fapl_ref_count == 0)
goto out;
udata->vfd_image_ptr = udata->fapl_image_ptr;
@@ -189,15 +189,15 @@ out:
/*-------------------------------------------------------------------------
* Function: image_memcpy
*
-* Purpose: Simulates memcpy() function to avoid copying file images.
+* Purpose: Simulates memcpy() function to avoid copying file images.
* The image buffer can be set to only one FAPL buffer, and
* "copied" to only one VFD buffer. The FAPL buffer can be
-* "copied" to other FAPLs buffers.
+* "copied" to other FAPLs buffers.
*
* Return: The address of the destination buffer, if successful. Otherwise, it
* returns NULL.
*
-* Programmer: Christian Chilan
+* Programmer: Christian Chilan
*
* Date: October 3, 2011
*
@@ -210,31 +210,31 @@ image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file
H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
/* callback is only used if the application buffer is not actually copied */
- if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
+ if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
switch(file_image_op) {
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET:
- if (dest != udata->fapl_image_ptr)
+ if (dest != udata->fapl_image_ptr)
goto out;
- if (src != udata->app_image_ptr)
+ if (src != udata->app_image_ptr)
goto out;
- if (size != udata->fapl_image_size)
+ if (size != udata->fapl_image_size)
goto out;
- if (size != udata->app_image_size)
+ if (size != udata->app_image_size)
goto out;
- if (udata->fapl_ref_count == 0)
+ if (udata->fapl_ref_count == 0)
goto out;
break;
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY:
- if (dest != udata->fapl_image_ptr)
+ if (dest != udata->fapl_image_ptr)
goto out;
- if (src != udata->fapl_image_ptr)
+ if (src != udata->fapl_image_ptr)
goto out;
- if (size != udata->fapl_image_size)
+ if (size != udata->fapl_image_size)
goto out;
- if (udata->fapl_ref_count < 2)
+ if (udata->fapl_ref_count < 2)
goto out;
break;
@@ -242,17 +242,17 @@ image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file
goto out;
case H5FD_FILE_IMAGE_OP_FILE_OPEN:
- if (dest != udata->vfd_image_ptr)
+ if (dest != udata->vfd_image_ptr)
goto out;
- if (src != udata->fapl_image_ptr)
+ if (src != udata->fapl_image_ptr)
goto out;
- if (size != udata->vfd_image_size)
+ if (size != udata->vfd_image_size)
goto out;
- if (size != udata->fapl_image_size)
+ if (size != udata->fapl_image_size)
goto out;
- if (udata->fapl_ref_count == 0)
+ if (udata->fapl_ref_count == 0)
goto out;
- if (udata->vfd_ref_count != 1)
+ if (udata->vfd_ref_count != 1)
goto out;
break;
@@ -273,15 +273,15 @@ out:
/*-------------------------------------------------------------------------
-* Function: image_realloc
+* Function: image_realloc
*
* Purpose: Reallocates the shared application image buffer and updates data
-* structures that manage buffer "copying".
-*
+* structures that manage buffer "copying".
+*
* Return: Address of reallocated buffer, if successful. Otherwise, it returns
-* NULL.
+* NULL.
*
-* Programmer: Christian Chilan
+* Programmer: Christian Chilan
*
* Date: October 3, 2011
*
@@ -294,29 +294,29 @@ image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *
void * return_value = NULL;
/* callback is only used if the application buffer is not actually copied */
- if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
+ if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
- /* realloc() is not allowed when the HDF5 library won't release the image
+ /* realloc() is not allowed when the HDF5 library won't release the image
buffer because reallocation may change the address of the buffer. The
new address cannot be communicated to the application to release it. */
- if (udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)
- goto out;
+ if (udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)
+ goto out;
/* realloc() is not allowed if the image is open in read-only mode */
- if (!(udata->flags & H5LT_FILE_IMAGE_OPEN_RW))
- goto out;
+ if (!(udata->flags & H5LT_FILE_IMAGE_OPEN_RW))
+ goto out;
if (file_image_op == H5FD_FILE_IMAGE_OP_FILE_RESIZE) {
- if (udata->vfd_image_ptr != ptr)
- goto out;
+ if (udata->vfd_image_ptr != ptr)
+ goto out;
- if (udata->vfd_ref_count != 1)
+ if (udata->vfd_ref_count != 1)
goto out;
if (NULL == (udata->vfd_image_ptr = HDrealloc(ptr, size)))
- goto out;
-
+ goto out;
+
udata->vfd_image_size = size;
return_value = udata->vfd_image_ptr;
} /* end if */
@@ -337,9 +337,9 @@ out:
* reference counters. Shared application buffer is actually
* deallocated if there are no outstanding references.
*
-* Return: SUCCEED or FAIL
+* Return: SUCCEED or FAIL
*
-* Programmer: Christian Chilan
+* Programmer: Christian Chilan
*
* Date: October 3, 2011
*
@@ -351,19 +351,19 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
/* callback is only used if the application buffer is not actually copied */
- if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
+ if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
switch(file_image_op) {
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE:
- if (udata->fapl_image_ptr != ptr)
+ if (udata->fapl_image_ptr != ptr)
goto out;
- if (udata->fapl_ref_count == 0)
+ if (udata->fapl_ref_count == 0)
goto out;
udata->fapl_ref_count--;
- /* release the shared buffer only if indicated by the respective flag and there are no outstanding references */
+ /* release the shared buffer only if indicated by the respective flag and there are no outstanding references */
if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 &&
!(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) {
HDfree(udata->fapl_image_ptr);
@@ -374,14 +374,14 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
break;
case H5FD_FILE_IMAGE_OP_FILE_CLOSE:
- if (udata->vfd_image_ptr != ptr)
+ if (udata->vfd_image_ptr != ptr)
goto out;
- if (udata->vfd_ref_count != 1)
+ if (udata->vfd_ref_count != 1)
goto out;
udata->vfd_ref_count--;
- /* release the shared buffer only if indicated by the respective flag and there are no outstanding references */
+ /* release the shared buffer only if indicated by the respective flag and there are no outstanding references */
if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 &&
!(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) {
HDfree(udata->vfd_image_ptr);
@@ -410,7 +410,7 @@ out:
/*-------------------------------------------------------------------------
-* Function: udata_copy
+* Function: udata_copy
*
* Purpose: Simulates the copying of the user data structure utilized in the
* management of the "copying" of file images.
@@ -418,7 +418,7 @@ out:
* Return: Address of "newly allocated" structure, if successful. Otherwise, it
* returns NULL.
*
-* Programmer: Christian Chilan
+* Programmer: Christian Chilan
*
* Date: October 3, 2011
*
@@ -430,9 +430,9 @@ udata_copy(void *_udata)
H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
/* callback is only used if the application buffer is not actually copied */
- if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
+ if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
- if (udata->ref_count == 0)
+ if (udata->ref_count == 0)
goto out;
udata->ref_count++;
@@ -449,11 +449,11 @@ out:
*
* Purpose: Simulates deallocation of the user data structure utilized in the
* management of the "copying" of file images. The data structure is
-* actually deallocated when there are no outstanding references.
+* actually deallocated when there are no outstanding references.
*
-* Return: SUCCEED or FAIL
+* Return: SUCCEED or FAIL
*
-* Programmer: Christian Chilan
+* Programmer: Christian Chilan
*
* Date: October 3, 2011
*
@@ -465,9 +465,9 @@ udata_free(void *_udata)
H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata;
/* callback is only used if the application buffer is not actually copied */
- if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
+ if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY))
goto out;
- if (udata->ref_count == 0)
+ if (udata->ref_count == 0)
goto out;
udata->ref_count--;
@@ -479,7 +479,7 @@ udata_free(void *_udata)
return(SUCCEED);
-out:
+out:
return(FAIL);
} /* end udata_free */
@@ -522,7 +522,7 @@ H5LT_make_dataset_numerical( hid_t loc_id,
hid_t did = -1, sid = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Create the data space for the dataset. */
@@ -801,7 +801,7 @@ herr_t H5LTmake_dataset_string(hid_t loc_id,
size_t size;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* create a string data type */
@@ -852,11 +852,11 @@ out:
/*-------------------------------------------------------------------------
* Function: H5LTopen_file_image
*
-* Purpose: Open a user supplied file image using the core file driver.
+* Purpose: Open a user supplied file image using the core file driver.
*
* Return: File identifier, Failure: -1
*
-* Programmer: Christian Chilan
+* Programmer: Christian Chilan
*
* Date: October 3, 2011
*
@@ -871,22 +871,22 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
size_t min_incr = 65536; /* Minimum buffer increment */
double buf_prcnt = 0.1f; /* Percentage of buffer size to set
as increment */
- static long file_name_counter;
- H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy,
- &image_realloc, &image_free,
- &udata_copy, &udata_free,
+ static long file_name_counter;
+ H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy,
+ &image_realloc, &image_free,
+ &udata_copy, &udata_free,
(void *)NULL};
/* check arguments */
- if (buf_ptr == NULL)
+ if (buf_ptr == NULL)
goto out;
- if (buf_size == 0)
+ if (buf_size == 0)
goto out;
if (flags & (unsigned)~(H5LT_FILE_IMAGE_ALL))
goto out;
/* Create FAPL to transmit file image */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto out;
/* set allocation increment to a percentage of the supplied buffer size, or
@@ -898,7 +898,7 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
alloc_incr = min_incr;
/* Configure FAPL to use the core file driver */
- if (H5Pset_fapl_core(fapl, alloc_incr, FALSE) < 0)
+ if (H5Pset_fapl_core(fapl, alloc_incr, FALSE) < 0)
goto out;
/* Set callbacks for file image ops ONLY if the file image is NOT copied */
@@ -932,10 +932,10 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
} /* end if */
/* Assign file image in user buffer to FAPL */
- if (H5Pset_file_image(fapl, buf_ptr, buf_size) < 0)
+ if (H5Pset_file_image(fapl, buf_ptr, buf_size) < 0)
goto out;
- /* set file open flags */
+ /* set file open flags */
if (flags & H5LT_FILE_IMAGE_OPEN_RW)
file_open_flags = H5F_ACC_RDWR;
else
@@ -943,17 +943,17 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
/* define a unique file name */
HDsnprintf(file_name, (sizeof(file_name) - 1), "file_image_%ld", file_name_counter++);
-
- /* Assign file image in FAPL to the core file driver */
- if ((file_id = H5Fopen(file_name, file_open_flags, fapl)) < 0)
+
+ /* Assign file image in FAPL to the core file driver */
+ if ((file_id = H5Fopen(file_name, file_open_flags, fapl)) < 0)
goto out;
/* Close FAPL */
- if (H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
goto out;
- /* Return file identifier */
- return file_id;
+ /* Return file identifier */
+ return file_id;
out:
H5E_BEGIN_TRY {
@@ -983,7 +983,7 @@ H5LT_read_dataset_numerical(hid_t loc_id, const char *dset_name, hid_t tid, void
hid_t did;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Open the dataset. */
@@ -1178,7 +1178,7 @@ herr_t H5LTread_dataset_string( hid_t loc_id,
hid_t tid = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Open the dataset. */
@@ -1231,7 +1231,7 @@ herr_t H5LTget_dataset_ndims( hid_t loc_id,
hid_t sid = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* Open the dataset. */
@@ -1291,7 +1291,7 @@ herr_t H5LTget_dataset_info( hid_t loc_id,
hid_t sid = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
return -1;
/* open the dataset. */
@@ -1360,7 +1360,7 @@ out:
*/
static herr_t
-find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_data)
+find_dataset(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *op_data)
{
/* Define a default zero value for return. This will cause the iterator to continue if
* the dataset is not found yet.
@@ -1368,9 +1368,9 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d
int ret = 0;
/* check the arguments */
- if (name == NULL)
+ if (name == NULL)
return ret;
-
+
/* Shut the compiler up */
loc_id = loc_id;
linfo = linfo;
@@ -1407,13 +1407,18 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d
*
*-------------------------------------------------------------------------
*/
-
+/* H5Literate wants a non-const pointer but we have a const pointer in the API
+ * call. It's safe to ignore this because we control the callback, don't
+ * modify the op_data buffer (i.e.: dset_name) during the traversal, and the
+ * library never modifies that buffer.
+ */
+H5_GCC_DIAG_OFF(cast-qual)
herr_t
H5LTfind_dataset( hid_t loc_id, const char *dset_name )
{
- return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name);
+ return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name);
}
-
+H5_GCC_DIAG_ON(cast-qual)
/*-------------------------------------------------------------------------
*
@@ -1455,11 +1460,11 @@ herr_t H5LTset_attribute_string( hid_t loc_id,
size_t attr_size;
/* check the arguments */
- if (obj_name == NULL)
+ if (obj_name == NULL)
return -1;
- if (attr_name == NULL)
+ if (attr_name == NULL)
return -1;
- if (attr_data == NULL)
+ if (attr_data == NULL)
return -1;
/* Open the object */
@@ -1552,9 +1557,9 @@ herr_t H5LT_set_attribute_numerical( hid_t loc_id,
int has_attr;
/* check the arguments */
- if (obj_name == NULL)
+ if (obj_name == NULL)
return -1;
- if (attr_name == NULL)
+ if (attr_name == NULL)
return -1;
/* Open the object */
@@ -1969,7 +1974,7 @@ find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
int ret = H5_ITER_CONT;
/* check the arguments */
- if (name == NULL)
+ if (name == NULL)
return H5_ITER_CONT;
/* Shut compiler up */
@@ -2033,13 +2038,18 @@ herr_t H5LTfind_attribute( hid_t loc_id, const char* attr_name )
*
*-------------------------------------------------------------------------
*/
-
+/* H5Aiterate wants a non-const pointer but we have a const pointer in the API
+ * call. It's safe to ignore this because we control the callback, don't
+ * modify the op_data buffer (i.e.: attr_name) during the traversal, and the
+ * library never modifies that buffer.
+ */
+H5_GCC_DIAG_OFF(cast-qual)
herr_t
H5LT_find_attribute( hid_t loc_id, const char* attr_name )
{
return H5Aiterate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, find_attr, (void *)attr_name);
}
-
+H5_GCC_DIAG_ON(cast-qual)
/*-------------------------------------------------------------------------
@@ -2066,9 +2076,9 @@ herr_t H5LTget_attribute_ndims( hid_t loc_id,
hid_t obj_id;
/* check the arguments */
- if (obj_name == NULL)
+ if (obj_name == NULL)
return -1;
- if (attr_name == NULL)
+ if (attr_name == NULL)
return -1;
/* Open the object */
@@ -2139,9 +2149,9 @@ herr_t H5LTget_attribute_info( hid_t loc_id,
hid_t obj_id;
/* check the arguments */
- if (obj_name == NULL)
+ if (obj_name == NULL)
return -1;
- if (attr_name == NULL)
+ if (attr_name == NULL)
return -1;
/* Open the object */
@@ -2220,7 +2230,7 @@ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type)
hid_t type_id;
/* check the arguments */
- if (text == NULL)
+ if (text == NULL)
return -1;
if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG)
@@ -2263,8 +2273,8 @@ out:
*
*-------------------------------------------------------------------------
*/
-static char*
-realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add)
+static char*
+realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add)
{
size_t size_str_to_add, size_str;
@@ -2288,7 +2298,7 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_ad
/* find the size of the current buffer */
size_str = HDstrlen(buf);
- /* Check to make sure the appended string does not
+ /* Check to make sure the appended string does not
* extend past the allocated buffer; if it does then truncate the string
*/
if(size_str < *len - 1) {
@@ -2360,7 +2370,6 @@ 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[TMP_LEN];
int nchars; /*number of output characters */
@@ -2418,17 +2427,15 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
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), "");
+ HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1);
+ tmp_str[MAX(3, 19 - nchars)] = '\0';
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 + (size_t)i * dst_size;
if (H5T_SGN_NONE == H5Tget_sign(native))
- HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy)));
+ HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int *)((void *)(value + (size_t)i * dst_size))));
else
- HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy)));
+ HDsnprintf(tmp_str, TMP_LEN, "%d", *((int *)((void *)(value + (size_t)i * dst_size))));
if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str)))
goto out;
@@ -2450,8 +2457,12 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
out:
if(0 == nmembs) {
- HDsnprintf(tmp_str, TMP_LEN, "\n%*s <empty>", (int)(indt + 4), "");
+ str = realloc_and_append(no_ubuf, str_len, str, "\n");
+ HDassert((indt + 4) < TMP_LEN);
+ HDmemset(tmp_str, ' ', (indt + 4) + 1);
+ tmp_str[(indt + 4)] = '\0';
str = realloc_and_append(no_ubuf, str_len, str, tmp_str);
+ str = realloc_and_append(no_ubuf, str_len, str, " <empty>");
} /* end if */
/* Release resources */
@@ -2544,7 +2555,7 @@ char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *sl
if(!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, NULL)))
goto out;
-
+
if(lang != H5LT_DDL) {
HDsnprintf(dt_str, *slen, "only DDL is supported for now");
goto out;
@@ -3111,9 +3122,9 @@ herr_t H5LTget_attribute_string( hid_t loc_id,
hid_t obj_id;
/* check the arguments */
- if (obj_name == NULL)
+ if (obj_name == NULL)
return -1;
- if (attr_name == NULL)
+ if (attr_name == NULL)
return -1;
/* Open the object */
@@ -3121,9 +3132,9 @@ herr_t H5LTget_attribute_string( hid_t loc_id,
return -1;
/* Get the attribute */
- if ( H5LT_get_attribute_disk( obj_id, attr_name, data ) < 0 )
+ if ( H5LT_get_attribute_disk( obj_id, attr_name, data ) < 0 )
{
- H5Oclose(obj_id);
+ H5Oclose(obj_id);
return -1;
}
@@ -3537,9 +3548,9 @@ static herr_t H5LT_get_attribute_mem(hid_t loc_id,
hid_t attr_id = -1;
/* check the arguments */
- if (obj_name == NULL)
+ if (obj_name == NULL)
return -1;
- if (attr_name == NULL)
+ if (attr_name == NULL)
return -1;
/* Open the object */
@@ -3779,7 +3790,7 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid)
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;
diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c
index b6a7f58..c05db67 100644
--- a/hl/src/H5LTanalyze.c
+++ b/hl/src/H5LTanalyze.c
@@ -1,25 +1,25 @@
-#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
-#pragma GCC diagnostic ignored "-Wconversion"
-#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
-#pragma GCC diagnostic ignored "-Wlarger-than="
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-#pragma GCC diagnostic ignored "-Wnested-externs"
-#pragma GCC diagnostic ignored "-Wold-style-definition"
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
-#pragma GCC diagnostic ignored "-Wstrict-prototypes"
-#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
-#pragma GCC diagnostic ignored "-Wswitch-default"
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-macros"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#elif defined __SUNPRO_CC
-#pragma disable_warn
-#elif defined _MSC_VER
-#pragma warning(push, 1)
-#endif
+#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
+#pragma GCC diagnostic ignored "-Wlarger-than="
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wnested-externs"
+#pragma GCC diagnostic ignored "-Wold-style-definition"
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#pragma GCC diagnostic ignored "-Wswitch-default"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-macros"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
#line 2 "hl/src/H5LTanalyze.c"
#line 4 "hl/src/H5LTanalyze.c"
@@ -50,7 +50,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 39
+#define YY_FLEX_SUBMINOR_VERSION 37
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -75,7 +75,7 @@
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
@@ -92,7 +92,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
@@ -183,15 +183,7 @@ typedef unsigned int flex_uint32_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
@@ -217,8 +209,7 @@ extern FILE *H5LTyyin, *H5LTyyout;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
- #define YY_LINENO_REWIND_TO(ptr)
-
+
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@@ -275,7 +266,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@@ -893,16 +884,16 @@ char *H5LTyytext;
* If you make any changes to H5LTanalyze.l, please run bin/genparser to
* recreate the output files.
*/
-#line 23 "hl/src/H5LTanalyze.l"
+#line 21 "hl/src/H5LTanalyze.l"
#include <stdlib.h>
#include <string.h>
#include <hdf5.h>
#include "H5LTparse.h"
-/* Turn off suggest const attribute warning in gcc */
-#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
+/* Turn off suggest const & malloc attribute warnings in gcc */
+#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
#pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
-#endif
+#endif
int my_yyinput(char *, int);
#undef YY_INPUT
@@ -952,7 +943,7 @@ extern hbool_t is_opq_tag;
hbool_t first_quote = 1;
-#line 936 "hl/src/H5LTanalyze.c"
+#line 925 "hl/src/H5LTanalyze.c"
#define INITIAL 0
#define TAG_STRING 1
@@ -1005,7 +996,7 @@ extern int H5LTyywrap (void );
#endif
static void yyunput (int c,char *buf_ptr );
-
+
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
@@ -1026,12 +1017,7 @@ static int input (void );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
@@ -1131,7 +1117,12 @@ YY_DECL
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
-
+
+#line 82 "hl/src/H5LTanalyze.l"
+
+
+#line 1103 "hl/src/H5LTanalyze.c"
+
if ( !(yy_init) )
{
(yy_init) = 1;
@@ -1164,12 +1155,6 @@ YY_DECL
H5LTyy_load_buffer_state( );
}
- {
-#line 84 "hl/src/H5LTanalyze.l"
-
-
-#line 1152 "hl/src/H5LTanalyze.c"
-
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = (yy_c_buf_p);
@@ -1190,7 +1175,7 @@ YY_DECL
yy_match:
do
{
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
@@ -1230,293 +1215,293 @@ do_action: /* This label is used only to access EOF actions. */
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
-#line 86 "hl/src/H5LTanalyze.l"
+#line 84 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I8BE_TOKEN);}
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 87 "hl/src/H5LTanalyze.l"
+#line 85 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I8LE_TOKEN);}
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 88 "hl/src/H5LTanalyze.l"
+#line 86 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I16BE_TOKEN);}
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 89 "hl/src/H5LTanalyze.l"
+#line 87 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I16LE_TOKEN);}
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 90 "hl/src/H5LTanalyze.l"
+#line 88 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I32BE_TOKEN);}
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 91 "hl/src/H5LTanalyze.l"
+#line 89 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I32LE_TOKEN);}
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 92 "hl/src/H5LTanalyze.l"
+#line 90 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I64BE_TOKEN);}
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 93 "hl/src/H5LTanalyze.l"
+#line 91 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_I64LE_TOKEN);}
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 95 "hl/src/H5LTanalyze.l"
+#line 93 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U8BE_TOKEN);}
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 96 "hl/src/H5LTanalyze.l"
+#line 94 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U8LE_TOKEN);}
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 97 "hl/src/H5LTanalyze.l"
+#line 95 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U16BE_TOKEN);}
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 98 "hl/src/H5LTanalyze.l"
+#line 96 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U16LE_TOKEN);}
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 99 "hl/src/H5LTanalyze.l"
+#line 97 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U32BE_TOKEN);}
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 100 "hl/src/H5LTanalyze.l"
+#line 98 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U32LE_TOKEN);}
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 101 "hl/src/H5LTanalyze.l"
+#line 99 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U64BE_TOKEN);}
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 102 "hl/src/H5LTanalyze.l"
+#line 100 "hl/src/H5LTanalyze.l"
{return hid(H5T_STD_U64LE_TOKEN);}
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 104 "hl/src/H5LTanalyze.l"
+#line 102 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_CHAR_TOKEN);}
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 105 "hl/src/H5LTanalyze.l"
+#line 103 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_SCHAR_TOKEN);}
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 106 "hl/src/H5LTanalyze.l"
+#line 104 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_UCHAR_TOKEN);}
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 107 "hl/src/H5LTanalyze.l"
+#line 105 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_SHORT_TOKEN);}
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 108 "hl/src/H5LTanalyze.l"
+#line 106 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_USHORT_TOKEN);}
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 109 "hl/src/H5LTanalyze.l"
+#line 107 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_INT_TOKEN);}
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 110 "hl/src/H5LTanalyze.l"
+#line 108 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_UINT_TOKEN);}
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 111 "hl/src/H5LTanalyze.l"
+#line 109 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_LONG_TOKEN);}
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 112 "hl/src/H5LTanalyze.l"
+#line 110 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_ULONG_TOKEN);}
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 113 "hl/src/H5LTanalyze.l"
+#line 111 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_LLONG_TOKEN);}
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 114 "hl/src/H5LTanalyze.l"
+#line 112 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_ULLONG_TOKEN);}
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 116 "hl/src/H5LTanalyze.l"
+#line 114 "hl/src/H5LTanalyze.l"
{return hid(H5T_IEEE_F32BE_TOKEN);}
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 117 "hl/src/H5LTanalyze.l"
+#line 115 "hl/src/H5LTanalyze.l"
{return hid(H5T_IEEE_F32LE_TOKEN);}
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 118 "hl/src/H5LTanalyze.l"
+#line 116 "hl/src/H5LTanalyze.l"
{return hid(H5T_IEEE_F64BE_TOKEN);}
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 119 "hl/src/H5LTanalyze.l"
+#line 117 "hl/src/H5LTanalyze.l"
{return hid(H5T_IEEE_F64LE_TOKEN);}
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 120 "hl/src/H5LTanalyze.l"
+#line 118 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_FLOAT_TOKEN);}
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 121 "hl/src/H5LTanalyze.l"
+#line 119 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_DOUBLE_TOKEN);}
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 122 "hl/src/H5LTanalyze.l"
+#line 120 "hl/src/H5LTanalyze.l"
{return hid(H5T_NATIVE_LDOUBLE_TOKEN);}
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 124 "hl/src/H5LTanalyze.l"
+#line 122 "hl/src/H5LTanalyze.l"
{return token(H5T_STRING_TOKEN);}
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 125 "hl/src/H5LTanalyze.l"
+#line 123 "hl/src/H5LTanalyze.l"
{return token(STRSIZE_TOKEN);}
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 126 "hl/src/H5LTanalyze.l"
+#line 124 "hl/src/H5LTanalyze.l"
{return token(STRPAD_TOKEN);}
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 127 "hl/src/H5LTanalyze.l"
+#line 125 "hl/src/H5LTanalyze.l"
{return token(CSET_TOKEN);}
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 128 "hl/src/H5LTanalyze.l"
+#line 126 "hl/src/H5LTanalyze.l"
{return token(CTYPE_TOKEN);}
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 129 "hl/src/H5LTanalyze.l"
-{return token(H5T_STR_NULLTERM_TOKEN);}
+#line 127 "hl/src/H5LTanalyze.l"
+{return token(H5T_STR_NULLTERM_TOKEN);}
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 130 "hl/src/H5LTanalyze.l"
-{return token(H5T_STR_NULLPAD_TOKEN);}
+#line 128 "hl/src/H5LTanalyze.l"
+{return token(H5T_STR_NULLPAD_TOKEN);}
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 131 "hl/src/H5LTanalyze.l"
-{return token(H5T_STR_SPACEPAD_TOKEN);}
+#line 129 "hl/src/H5LTanalyze.l"
+{return token(H5T_STR_SPACEPAD_TOKEN);}
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 132 "hl/src/H5LTanalyze.l"
+#line 130 "hl/src/H5LTanalyze.l"
{return token(H5T_CSET_ASCII_TOKEN);}
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 133 "hl/src/H5LTanalyze.l"
+#line 131 "hl/src/H5LTanalyze.l"
{return token(H5T_CSET_UTF8_TOKEN);}
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 134 "hl/src/H5LTanalyze.l"
+#line 132 "hl/src/H5LTanalyze.l"
{return token(H5T_C_S1_TOKEN);}
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 135 "hl/src/H5LTanalyze.l"
+#line 133 "hl/src/H5LTanalyze.l"
{return token(H5T_FORTRAN_S1_TOKEN);}
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 136 "hl/src/H5LTanalyze.l"
+#line 134 "hl/src/H5LTanalyze.l"
{return token(H5T_VARIABLE_TOKEN);}
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 138 "hl/src/H5LTanalyze.l"
+#line 136 "hl/src/H5LTanalyze.l"
{return token(H5T_COMPOUND_TOKEN);}
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 139 "hl/src/H5LTanalyze.l"
+#line 137 "hl/src/H5LTanalyze.l"
{return token(H5T_ENUM_TOKEN);}
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 140 "hl/src/H5LTanalyze.l"
+#line 138 "hl/src/H5LTanalyze.l"
{return token(H5T_ARRAY_TOKEN);}
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 141 "hl/src/H5LTanalyze.l"
+#line 139 "hl/src/H5LTanalyze.l"
{return token(H5T_VLEN_TOKEN);}
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 143 "hl/src/H5LTanalyze.l"
+#line 141 "hl/src/H5LTanalyze.l"
{return token(H5T_OPAQUE_TOKEN);}
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 144 "hl/src/H5LTanalyze.l"
+#line 142 "hl/src/H5LTanalyze.l"
{return token(OPQ_SIZE_TOKEN);}
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 145 "hl/src/H5LTanalyze.l"
+#line 143 "hl/src/H5LTanalyze.l"
{return token(OPQ_TAG_TOKEN);}
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 147 "hl/src/H5LTanalyze.l"
-{
- if( is_str_size || (is_enum && is_enum_memb) ||
+#line 145 "hl/src/H5LTanalyze.l"
+{
+ if( is_str_size || (is_enum && is_enum_memb) ||
is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) ||
(csindex>-1 && cmpd_stack[csindex].is_field) ) {
H5LTyylval.ival = atoi(H5LTyytext);
- return NUMBER;
+ return NUMBER;
} else
REJECT;
}
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 157 "hl/src/H5LTanalyze.l"
+#line 155 "hl/src/H5LTanalyze.l"
{
/*if it's first quote, and is a compound field name or an enum symbol*/
- if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field))
+ if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field))
&& first_quote) {
first_quote = 0;
BEGIN TAG_STRING;
@@ -1528,7 +1513,7 @@ YY_RULE_SETUP
case 57:
/* rule 57 can match eol */
YY_RULE_SETUP
-#line 167 "hl/src/H5LTanalyze.l"
+#line 165 "hl/src/H5LTanalyze.l"
{
#ifdef H5_HAVE_WIN32_API
H5LTyylval.sval = _strdup(H5LTyytext);
@@ -1541,52 +1526,52 @@ YY_RULE_SETUP
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 177 "hl/src/H5LTanalyze.l"
+#line 175 "hl/src/H5LTanalyze.l"
{return token('{');}
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 178 "hl/src/H5LTanalyze.l"
+#line 176 "hl/src/H5LTanalyze.l"
{return token('}');}
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 179 "hl/src/H5LTanalyze.l"
+#line 177 "hl/src/H5LTanalyze.l"
{return token('[');}
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 180 "hl/src/H5LTanalyze.l"
+#line 178 "hl/src/H5LTanalyze.l"
{return token(']');}
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 181 "hl/src/H5LTanalyze.l"
+#line 179 "hl/src/H5LTanalyze.l"
{return token(':');}
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 182 "hl/src/H5LTanalyze.l"
+#line 180 "hl/src/H5LTanalyze.l"
{return token(';');}
YY_BREAK
case 64:
/* rule 64 can match eol */
YY_RULE_SETUP
-#line 183 "hl/src/H5LTanalyze.l"
+#line 181 "hl/src/H5LTanalyze.l"
;
YY_BREAK
case 65:
/* rule 65 can match eol */
YY_RULE_SETUP
-#line 184 "hl/src/H5LTanalyze.l"
+#line 182 "hl/src/H5LTanalyze.l"
{ return 0; }
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 186 "hl/src/H5LTanalyze.l"
+#line 184 "hl/src/H5LTanalyze.l"
ECHO;
YY_BREAK
-#line 1570 "hl/src/H5LTanalyze.c"
+#line 1553 "hl/src/H5LTanalyze.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(TAG_STRING):
yyterminate();
@@ -1718,7 +1703,6 @@ ECHO;
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
- } /* end of user's declarations */
} /* end of H5LTyylex */
/* yy_get_next_buffer - try to read in a new buffer
@@ -1837,7 +1821,7 @@ static int yy_get_next_buffer (void)
{
register yy_state_type yy_current_state;
register char *yy_cp;
-
+
yy_current_state = (yy_start);
(yy_state_ptr) = (yy_state_buf);
@@ -1867,7 +1851,7 @@ static int yy_get_next_buffer (void)
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
register int yy_is_jam;
-
+
register YY_CHAR yy_c = 1;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
@@ -1886,7 +1870,7 @@ static int yy_get_next_buffer (void)
static void yyunput (int c, register char * yy_bp )
{
register char *yy_cp;
-
+
yy_cp = (yy_c_buf_p);
/* undo effects of setting up H5LTyytext */
@@ -1929,7 +1913,7 @@ static int yy_get_next_buffer (void)
{
int c;
-
+
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
@@ -1996,12 +1980,12 @@ static int yy_get_next_buffer (void)
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
- *
+ *
* @note This function does not reset the start condition to @c INITIAL .
*/
void H5LTyyrestart (FILE * input_file )
{
-
+
if ( ! YY_CURRENT_BUFFER ){
H5LTyyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
@@ -2014,11 +1998,11 @@ static int yy_get_next_buffer (void)
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
- *
+ *
*/
void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
{
-
+
/* TODO. We should be able to replace this entire function body
* with
* H5LTyypop_buffer_state();
@@ -2058,13 +2042,13 @@ static void H5LTyy_load_buffer_state (void)
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- *
+ *
* @return the allocated buffer state.
*/
YY_BUFFER_STATE H5LTyy_create_buffer (FILE * file, int size )
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" );
@@ -2087,11 +2071,11 @@ static void H5LTyy_load_buffer_state (void)
/** Destroy the buffer.
* @param b a buffer created with H5LTyy_create_buffer()
- *
+ *
*/
void H5LTyy_delete_buffer (YY_BUFFER_STATE b )
{
-
+
if ( ! b )
return;
@@ -2112,7 +2096,7 @@ static void H5LTyy_load_buffer_state (void)
{
int oerrno = errno;
-
+
H5LTyy_flush_buffer(b );
b->yy_input_file = file;
@@ -2128,13 +2112,13 @@ static void H5LTyy_load_buffer_state (void)
}
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
+
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- *
+ *
*/
void H5LTyy_flush_buffer (YY_BUFFER_STATE b )
{
@@ -2163,7 +2147,7 @@ static void H5LTyy_load_buffer_state (void)
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
- *
+ *
*/
void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer )
{
@@ -2193,7 +2177,7 @@ void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer )
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
- *
+ *
*/
void H5LTyypop_buffer_state (void)
{
@@ -2217,7 +2201,7 @@ void H5LTyypop_buffer_state (void)
static void H5LTyyensure_buffer_stack (void)
{
yy_size_t num_to_alloc;
-
+
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
@@ -2230,9 +2214,9 @@ static void H5LTyyensure_buffer_stack (void)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" );
-
+
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
@@ -2260,13 +2244,13 @@ static void H5LTyyensure_buffer_stack (void)
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
- *
- * @return the newly allocated buffer state object.
+ *
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -2295,14 +2279,14 @@ YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to H5LTyylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
- *
+ *
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* H5LTyy_scan_bytes() instead.
*/
YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr )
{
-
+
return H5LTyy_scan_bytes(yystr,strlen(yystr) );
}
@@ -2310,7 +2294,7 @@ YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr )
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- *
+ *
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
@@ -2318,8 +2302,8 @@ YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
- yy_size_t i;
-
+ int i;
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) H5LTyyalloc(n );
@@ -2373,16 +2357,16 @@ static void yy_fatal_error (yyconst char* msg )
/* Accessor methods (get/set functions) to struct members. */
/** Get the current line number.
- *
+ *
*/
int H5LTyyget_lineno (void)
{
-
+
return H5LTyylineno;
}
/** Get the input stream.
- *
+ *
*/
FILE *H5LTyyget_in (void)
{
@@ -2390,7 +2374,7 @@ FILE *H5LTyyget_in (void)
}
/** Get the output stream.
- *
+ *
*/
FILE *H5LTyyget_out (void)
{
@@ -2398,7 +2382,7 @@ FILE *H5LTyyget_out (void)
}
/** Get the length of the current token.
- *
+ *
*/
yy_size_t H5LTyyget_leng (void)
{
@@ -2406,7 +2390,7 @@ yy_size_t H5LTyyget_leng (void)
}
/** Get the current token.
- *
+ *
*/
char *H5LTyyget_text (void)
@@ -2416,18 +2400,18 @@ char *H5LTyyget_text (void)
/** Set the current line number.
* @param line_number
- *
+ *
*/
void H5LTyyset_lineno (int line_number )
{
-
+
H5LTyylineno = line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
- *
+ *
* @see H5LTyy_switch_to_buffer
*/
void H5LTyyset_in (FILE * in_str )
@@ -2486,7 +2470,7 @@ static int yy_init_globals (void)
/* H5LTyylex_destroy is for both reentrant and non-reentrant scanners. */
int H5LTyylex_destroy (void)
{
-
+
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
H5LTyy_delete_buffer(YY_CURRENT_BUFFER );
@@ -2556,14 +2540,14 @@ void H5LTyyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 185 "hl/src/H5LTanalyze.l"
+#line 184 "hl/src/H5LTanalyze.l"
int my_yyinput(char *buf, int max_size)
{
int ret;
-
- memcpy(buf, myinput, input_len);
+
+ memcpy(buf, myinput, input_len);
ret = (int)input_len;
return ret;
}
diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l
index b9b492e..5015053 100644
--- a/hl/src/H5LTanalyze.l
+++ b/hl/src/H5LTanalyze.l
@@ -23,8 +23,8 @@
#include <hdf5.h>
#include "H5LTparse.h"
-/* Turn off suggest const attribute warning in gcc */
-#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
+/* Turn off suggest const & malloc attribute warnings in gcc */
+#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
#pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
#endif
diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c
index 5835dcc..d8661a7 100644
--- a/hl/src/H5LTparse.c
+++ b/hl/src/H5LTparse.c
@@ -1,30 +1,30 @@
-#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2
-#pragma GCC diagnostic ignored "-Wconversion"
-#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
-#pragma GCC diagnostic ignored "-Wlarger-than="
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-#pragma GCC diagnostic ignored "-Wnested-externs"
-#pragma GCC diagnostic ignored "-Wold-style-definition"
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
-#pragma GCC diagnostic ignored "-Wstrict-prototypes"
-#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
-#pragma GCC diagnostic ignored "-Wswitch-default"
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-macros"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#elif defined __SUNPRO_CC
-#pragma disable_warn
-#elif defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-/* A Bison parser, made by GNU Bison 3.0.2. */
+#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
+#pragma GCC diagnostic ignored "-Wlarger-than="
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wnested-externs"
+#pragma GCC diagnostic ignored "-Wold-style-definition"
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wstrict-overflow"
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+#pragma GCC diagnostic ignored "-Wswitch-default"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-macros"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+/* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -66,7 +66,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.2"
+#define YYBISON_VERSION "2.7"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -85,14 +85,14 @@
#define yyparse H5LTyyparse
#define yylex H5LTyylex
#define yyerror H5LTyyerror
-#define yydebug H5LTyydebug
-#define yynerrs H5LTyynerrs
-
#define yylval H5LTyylval
#define yychar H5LTyychar
+#define yydebug H5LTyydebug
+#define yynerrs H5LTyynerrs
/* Copy the first part of user declarations. */
-#line 22 "hl/src/H5LTparse.y" /* yacc.c:339 */
+/* Line 371 of yacc.c */
+#line 20 "hl/src/H5LTparse.y"
#include <stdio.h>
#include <string.h>
@@ -127,7 +127,7 @@ struct arr_info {
};
/*stack for nested array type*/
struct arr_info arr_stack[STACK_SIZE];
-int asindex = -1; /*pointer to the top of array stack*/
+int asindex = -1; /*pointer to the top of array stack*/
hbool_t is_str_size = 0; /*flag to lexer for string size*/
hbool_t is_str_pad = 0; /*flag to lexer for string padding*/
@@ -135,7 +135,7 @@ H5T_str_t str_pad; /*variable for string padding*/
H5T_cset_t str_cset; /*variable for string character set*/
hbool_t is_variable = 0; /*variable for variable-length string*/
size_t str_size; /*variable for string size*/
-
+
hid_t enum_id; /*type ID*/
hbool_t is_enum = 0; /*flag to lexer for enum type*/
hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/
@@ -145,13 +145,14 @@ hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/
hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/
-#line 127 "hl/src/H5LTparse.c" /* yacc.c:339 */
+/* Line 371 of yacc.c */
+#line 128 "hl/src/H5LTparse.c"
-# ifndef YY_NULLPTR
+# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# define YY_NULL nullptr
# else
-# define YY_NULLPTR 0
+# define YY_NULL 0
# endif
# endif
@@ -167,7 +168,7 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/
by #include "H5LTparse.h". */
#ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
# define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
-/* Debug traces. */
+/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
@@ -175,97 +176,113 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/
extern int H5LTyydebug;
#endif
-/* Token type. */
+/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- enum yytokentype
- {
- H5T_STD_I8BE_TOKEN = 258,
- H5T_STD_I8LE_TOKEN = 259,
- H5T_STD_I16BE_TOKEN = 260,
- H5T_STD_I16LE_TOKEN = 261,
- H5T_STD_I32BE_TOKEN = 262,
- H5T_STD_I32LE_TOKEN = 263,
- H5T_STD_I64BE_TOKEN = 264,
- H5T_STD_I64LE_TOKEN = 265,
- H5T_STD_U8BE_TOKEN = 266,
- H5T_STD_U8LE_TOKEN = 267,
- H5T_STD_U16BE_TOKEN = 268,
- H5T_STD_U16LE_TOKEN = 269,
- H5T_STD_U32BE_TOKEN = 270,
- H5T_STD_U32LE_TOKEN = 271,
- H5T_STD_U64BE_TOKEN = 272,
- H5T_STD_U64LE_TOKEN = 273,
- H5T_NATIVE_CHAR_TOKEN = 274,
- H5T_NATIVE_SCHAR_TOKEN = 275,
- H5T_NATIVE_UCHAR_TOKEN = 276,
- H5T_NATIVE_SHORT_TOKEN = 277,
- H5T_NATIVE_USHORT_TOKEN = 278,
- H5T_NATIVE_INT_TOKEN = 279,
- H5T_NATIVE_UINT_TOKEN = 280,
- H5T_NATIVE_LONG_TOKEN = 281,
- H5T_NATIVE_ULONG_TOKEN = 282,
- H5T_NATIVE_LLONG_TOKEN = 283,
- H5T_NATIVE_ULLONG_TOKEN = 284,
- H5T_IEEE_F32BE_TOKEN = 285,
- H5T_IEEE_F32LE_TOKEN = 286,
- H5T_IEEE_F64BE_TOKEN = 287,
- H5T_IEEE_F64LE_TOKEN = 288,
- H5T_NATIVE_FLOAT_TOKEN = 289,
- H5T_NATIVE_DOUBLE_TOKEN = 290,
- H5T_NATIVE_LDOUBLE_TOKEN = 291,
- H5T_STRING_TOKEN = 292,
- STRSIZE_TOKEN = 293,
- STRPAD_TOKEN = 294,
- CSET_TOKEN = 295,
- CTYPE_TOKEN = 296,
- H5T_VARIABLE_TOKEN = 297,
- H5T_STR_NULLTERM_TOKEN = 298,
- H5T_STR_NULLPAD_TOKEN = 299,
- H5T_STR_SPACEPAD_TOKEN = 300,
- H5T_CSET_ASCII_TOKEN = 301,
- H5T_CSET_UTF8_TOKEN = 302,
- H5T_C_S1_TOKEN = 303,
- H5T_FORTRAN_S1_TOKEN = 304,
- H5T_OPAQUE_TOKEN = 305,
- OPQ_SIZE_TOKEN = 306,
- OPQ_TAG_TOKEN = 307,
- H5T_COMPOUND_TOKEN = 308,
- H5T_ENUM_TOKEN = 309,
- H5T_ARRAY_TOKEN = 310,
- H5T_VLEN_TOKEN = 311,
- STRING = 312,
- NUMBER = 313
- };
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ H5T_STD_I8BE_TOKEN = 258,
+ H5T_STD_I8LE_TOKEN = 259,
+ H5T_STD_I16BE_TOKEN = 260,
+ H5T_STD_I16LE_TOKEN = 261,
+ H5T_STD_I32BE_TOKEN = 262,
+ H5T_STD_I32LE_TOKEN = 263,
+ H5T_STD_I64BE_TOKEN = 264,
+ H5T_STD_I64LE_TOKEN = 265,
+ H5T_STD_U8BE_TOKEN = 266,
+ H5T_STD_U8LE_TOKEN = 267,
+ H5T_STD_U16BE_TOKEN = 268,
+ H5T_STD_U16LE_TOKEN = 269,
+ H5T_STD_U32BE_TOKEN = 270,
+ H5T_STD_U32LE_TOKEN = 271,
+ H5T_STD_U64BE_TOKEN = 272,
+ H5T_STD_U64LE_TOKEN = 273,
+ H5T_NATIVE_CHAR_TOKEN = 274,
+ H5T_NATIVE_SCHAR_TOKEN = 275,
+ H5T_NATIVE_UCHAR_TOKEN = 276,
+ H5T_NATIVE_SHORT_TOKEN = 277,
+ H5T_NATIVE_USHORT_TOKEN = 278,
+ H5T_NATIVE_INT_TOKEN = 279,
+ H5T_NATIVE_UINT_TOKEN = 280,
+ H5T_NATIVE_LONG_TOKEN = 281,
+ H5T_NATIVE_ULONG_TOKEN = 282,
+ H5T_NATIVE_LLONG_TOKEN = 283,
+ H5T_NATIVE_ULLONG_TOKEN = 284,
+ H5T_IEEE_F32BE_TOKEN = 285,
+ H5T_IEEE_F32LE_TOKEN = 286,
+ H5T_IEEE_F64BE_TOKEN = 287,
+ H5T_IEEE_F64LE_TOKEN = 288,
+ H5T_NATIVE_FLOAT_TOKEN = 289,
+ H5T_NATIVE_DOUBLE_TOKEN = 290,
+ H5T_NATIVE_LDOUBLE_TOKEN = 291,
+ H5T_STRING_TOKEN = 292,
+ STRSIZE_TOKEN = 293,
+ STRPAD_TOKEN = 294,
+ CSET_TOKEN = 295,
+ CTYPE_TOKEN = 296,
+ H5T_VARIABLE_TOKEN = 297,
+ H5T_STR_NULLTERM_TOKEN = 298,
+ H5T_STR_NULLPAD_TOKEN = 299,
+ H5T_STR_SPACEPAD_TOKEN = 300,
+ H5T_CSET_ASCII_TOKEN = 301,
+ H5T_CSET_UTF8_TOKEN = 302,
+ H5T_C_S1_TOKEN = 303,
+ H5T_FORTRAN_S1_TOKEN = 304,
+ H5T_OPAQUE_TOKEN = 305,
+ OPQ_SIZE_TOKEN = 306,
+ OPQ_TAG_TOKEN = 307,
+ H5T_COMPOUND_TOKEN = 308,
+ H5T_ENUM_TOKEN = 309,
+ H5T_ARRAY_TOKEN = 310,
+ H5T_VLEN_TOKEN = 311,
+ STRING = 312,
+ NUMBER = 313
+ };
#endif
-/* Value type. */
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE YYSTYPE;
-union YYSTYPE
+typedef union YYSTYPE
{
-#line 74 "hl/src/H5LTparse.y" /* yacc.c:355 */
+/* Line 387 of yacc.c */
+#line 72 "hl/src/H5LTparse.y"
int ival; /*for integer token*/
char *sval; /*for name string*/
hid_t hid; /*for hid_t token*/
-#line 232 "hl/src/H5LTparse.c" /* yacc.c:355 */
-};
+
+/* Line 387 of yacc.c */
+#line 236 "hl/src/H5LTparse.c"
+} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-
extern YYSTYPE H5LTyylval;
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+hid_t H5LTyyparse (void *YYPARSE_PARAM);
+#else
+hid_t H5LTyyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
hid_t H5LTyyparse (void);
+#else
+hid_t H5LTyyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
#endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */
/* Copy the second part of user declarations. */
-#line 247 "hl/src/H5LTparse.c" /* yacc.c:358 */
+/* Line 390 of yacc.c */
+#line 264 "hl/src/H5LTparse.c"
#ifdef short
# undef short
@@ -279,8 +296,11 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#else
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -300,7 +320,8 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -322,33 +343,6 @@ typedef short int yytype_int16;
# endif
#endif
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-# define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -356,26 +350,24 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(N) (N)
#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int yyi)
+#else
+static int
+YYID (yyi)
+ int yyi;
#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+{
+ return yyi;
+}
#endif
-
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -393,7 +385,8 @@ typedef short int yytype_int16;
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
@@ -405,8 +398,8 @@ typedef short int yytype_int16;
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -422,7 +415,7 @@ typedef short int yytype_int16;
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -430,13 +423,15 @@ typedef short int yytype_int16;
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -446,7 +441,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -471,16 +466,16 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
#endif
@@ -499,7 +494,7 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (0)
+ while (YYID (0))
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -515,19 +510,17 @@ union yyalloc
#define YYNNTS 46
/* YYNRULES -- Number of rules. */
#define YYNRULES 95
-/* YYNSTATES -- Number of states. */
+/* YYNRULES -- Number of states. */
#define YYNSTATES 143
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 313
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -565,19 +558,64 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint8 yyprhs[] =
+{
+ 0, 0, 3, 4, 6, 8, 10, 12, 14, 16,
+ 18, 20, 22, 24, 26, 28, 30, 32, 34, 36,
+ 38, 40, 42, 44, 46, 48, 50, 52, 54, 56,
+ 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
+ 78, 80, 82, 84, 86, 88, 90, 92, 93, 99,
+ 100, 103, 104, 112, 114, 115, 118, 120, 121, 128,
+ 129, 132, 133, 134, 140, 142, 147, 148, 149, 150,
+ 151, 167, 169, 171, 172, 173, 174, 175, 176, 197,
+ 199, 201, 203, 205, 207, 209, 211, 213, 215, 216,
+ 224, 225, 228, 229, 236, 238
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int8 yyrhs[] =
+{
+ 67, 0, -1, -1, 68, -1, 69, -1, 72, -1,
+ 80, -1, 87, -1, 70, -1, 71, -1, 95, -1,
+ 105, -1, 88, -1, 3, -1, 4, -1, 5, -1,
+ 6, -1, 7, -1, 8, -1, 9, -1, 10, -1,
+ 11, -1, 12, -1, 13, -1, 14, -1, 15, -1,
+ 16, -1, 17, -1, 18, -1, 19, -1, 20, -1,
+ 21, -1, 22, -1, 23, -1, 24, -1, 25, -1,
+ 26, -1, 27, -1, 28, -1, 29, -1, 30, -1,
+ 31, -1, 32, -1, 33, -1, 34, -1, 35, -1,
+ 36, -1, -1, 53, 73, 59, 74, 60, -1, -1,
+ 74, 75, -1, -1, 68, 76, 63, 77, 63, 78,
+ 65, -1, 57, -1, -1, 64, 79, -1, 58, -1,
+ -1, 55, 81, 59, 82, 68, 60, -1, -1, 82,
+ 83, -1, -1, -1, 61, 84, 86, 85, 62, -1,
+ 58, -1, 56, 59, 68, 60, -1, -1, -1, -1,
+ -1, 50, 59, 51, 89, 93, 65, 90, 52, 91,
+ 63, 94, 63, 65, 92, 60, -1, 58, -1, 57,
+ -1, -1, -1, -1, -1, -1, 37, 59, 38, 96,
+ 101, 65, 97, 39, 102, 65, 98, 40, 103, 65,
+ 99, 41, 104, 65, 100, 60, -1, 42, -1, 58,
+ -1, 43, -1, 44, -1, 45, -1, 46, -1, 47,
+ -1, 48, -1, 49, -1, -1, 54, 59, 70, 65,
+ 106, 107, 60, -1, -1, 107, 108, -1, -1, 63,
+ 110, 63, 109, 111, 65, -1, 57, -1, 58, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 107, 107, 108, 110, 111, 112, 113, 115, 116,
- 117, 118, 119, 122, 123, 124, 125, 126, 127, 128,
- 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
- 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
- 151, 152, 153, 154, 155, 156, 157, 161, 160, 169,
- 170, 172, 172, 209, 217, 218, 221, 223, 223, 232,
- 233, 235, 236, 235, 243, 246, 252, 253, 258, 259,
- 250, 267, 269, 273, 274, 282, 291, 298, 271, 322,
- 323, 325, 326, 327, 329, 330, 332, 333, 337, 336,
- 341, 342, 344, 344, 398, 400
+ 0, 105, 105, 106, 108, 109, 110, 111, 113, 114,
+ 115, 116, 117, 120, 121, 122, 123, 124, 125, 126,
+ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
+ 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
+ 149, 150, 151, 152, 153, 154, 155, 159, 158, 167,
+ 168, 170, 170, 207, 215, 216, 219, 221, 221, 230,
+ 231, 233, 234, 233, 241, 244, 250, 251, 256, 257,
+ 248, 265, 267, 271, 272, 280, 289, 296, 269, 320,
+ 321, 323, 324, 325, 327, 328, 330, 331, 335, 334,
+ 339, 340, 342, 342, 396, 398
};
#endif
@@ -614,13 +652,13 @@ static const char *const yytname[] =
"$@5", "dimsize", "vlen_type", "opaque_type", "$@6", "@7", "$@8", "$@9",
"opaque_size", "opaque_tag", "string_type", "$@10", "$@11", "$@12",
"$@13", "@14", "strsize", "strpad", "cset", "ctype", "enum_type", "$@15",
- "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULLPTR
+ "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULL
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -633,40 +671,39 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -25
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-25)))
-
-#define YYTABLE_NINF -1
-
-#define yytable_value_is_error(Yytable_value) \
- 0
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 66, 67, 67, 68, 68, 68, 68, 69, 69,
+ 69, 69, 69, 70, 70, 70, 70, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
+ 71, 71, 71, 71, 71, 71, 71, 73, 72, 74,
+ 74, 76, 75, 77, 78, 78, 79, 81, 80, 82,
+ 82, 84, 85, 83, 86, 87, 89, 90, 91, 92,
+ 88, 93, 94, 96, 97, 98, 99, 100, 95, 101,
+ 101, 102, 102, 102, 103, 103, 104, 104, 106, 105,
+ 107, 107, 109, 108, 110, 111
+};
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int16 yypact[] =
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
{
- 114, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -24, -20, -25, -15, -25,
- -14, 49, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, 19, 45, 38, 168, 39, 114, -25, -25,
- -25, -25, 34, -25, 40, -4, 43, 56, -25, -3,
- -25, -25, -25, 37, -25, 42, -25, -25, -25, -25,
- -25, 44, -25, -25, -25, 50, -23, 47, -25, 64,
- 62, 51, -25, 58, -25, -25, -25, -2, -25, -25,
- 89, -25, 90, 92, -25, -25, -25, 91, 94, 95,
- -25, -25, -25, 98, 100, 96, 102, 122, -25, 103,
- -25, -25, -25, -25, 133, 9, 134, -25, -25, -25,
- 135, -25, -25, 105, 160, -25, 46, -25, -25, 137,
- -25, 143, -25
+ 0, 2, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 0, 5, 0,
+ 2, 0, 7, 1, 0, 2, 1, 0, 6, 0,
+ 2, 0, 0, 5, 1, 4, 0, 0, 0, 0,
+ 15, 1, 1, 0, 0, 0, 0, 0, 20, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 7,
+ 0, 2, 0, 6, 1, 1
};
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
static const yytype_uint8 yydefact[] =
{
2, 13, 14, 15, 16, 17, 18, 19, 20, 21,
@@ -686,17 +723,7 @@ static const yytype_uint8 yydefact[] =
77, 0, 78
};
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -25, -25, -21, -25, 108, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -25
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
+/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 41, 42, 43, 44, 45, 46, 54, 67, 78,
@@ -706,9 +733,42 @@ static const yytype_int16 yydefgoto[] =
79, 86, 94, 116, 102, 124
};
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -25
+static const yytype_int16 yypact[] =
+{
+ 114, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -24, -20, -25, -15, -25,
+ -14, 49, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, 19, 45, 38, 168, 39, 114, -25, -25,
+ -25, -25, 34, -25, 40, -4, 43, 56, -25, -3,
+ -25, -25, -25, 37, -25, 42, -25, -25, -25, -25,
+ -25, 44, -25, -25, -25, 50, -23, 47, -25, 64,
+ 62, 51, -25, 58, -25, -25, -25, -2, -25, -25,
+ 89, -25, 90, 92, -25, -25, -25, 91, 94, 95,
+ -25, -25, -25, 98, 100, 96, 102, 122, -25, 103,
+ -25, -25, -25, -25, 133, 9, 134, -25, -25, -25,
+ 135, -25, -25, 105, 160, -25, 46, -25, -25, 137,
+ -25, 143, -25
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
+{
+ -25, -25, -21, -25, 108, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, -25
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
@@ -734,6 +794,12 @@ static const yytype_uint8 yytable[] =
132, 136, 140, 142
};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-25)))
+
+#define yytable_value_is_error(Yytable_value) \
+ YYID (0)
+
static const yytype_uint8 yycheck[] =
{
3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
@@ -759,8 +825,8 @@ static const yytype_uint8 yycheck[] =
65, 41, 65, 60
};
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
@@ -780,46 +846,30 @@ static const yytype_uint8 yystos[] =
65, 100, 60
};
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 66, 67, 67, 68, 68, 68, 68, 69, 69,
- 69, 69, 69, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
- 71, 71, 71, 71, 71, 71, 71, 73, 72, 74,
- 74, 76, 75, 77, 78, 78, 79, 81, 80, 82,
- 82, 84, 85, 83, 86, 87, 89, 90, 91, 92,
- 88, 93, 94, 96, 97, 98, 99, 100, 95, 101,
- 101, 102, 102, 102, 103, 103, 104, 104, 106, 105,
- 107, 107, 109, 108, 110, 111
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 0, 5, 0,
- 2, 0, 7, 1, 0, 2, 1, 0, 6, 0,
- 2, 0, 0, 5, 1, 4, 0, 0, 0, 0,
- 15, 1, 1, 0, 0, 0, 0, 0, 20, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 7,
- 0, 2, 0, 6, 1, 1
-};
-
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
+
+#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -836,15 +886,27 @@ do \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+ YYERROR; \
+ } \
+while (YYID (0))
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+#define YYTERROR 1
+#define YYERRCODE 256
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -854,36 +916,40 @@ while (0)
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
-
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
@@ -892,8 +958,14 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
# endif
- YYUSE (yytype);
+ switch (yytype)
+ {
+ default:
+ break;
+ }
}
@@ -901,11 +973,22 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
@@ -916,8 +999,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
| TOP (included). |
`------------------------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+#else
+static void
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
+#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -928,42 +1019,49 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+ YYSTYPE *yyvsp;
+ int yyrule;
+#endif
{
- unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
+ unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule); \
-} while (0)
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -977,7 +1075,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1000,8 +1098,15 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1017,8 +1122,16 @@ yystrlen (const char *yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1048,27 +1161,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1091,11 +1204,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
+ const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1103,6 +1216,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -1152,7 +1269,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
@@ -1219,17 +1336,31 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
{
YYUSE (yyvaluep);
+
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
}
@@ -1238,8 +1369,18 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
/* The lookahead symbol. */
int yychar;
+
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+
/* Number of syntax errors so far. */
int yynerrs;
@@ -1248,16 +1389,35 @@ int yynerrs;
| yyparse. |
`----------*/
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+hid_t
+yyparse (void *YYPARSE_PARAM)
+#else
+hid_t
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
hid_t
yyparse (void)
+#else
+hid_t
+yyparse ()
+
+#endif
+#endif
{
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
+ `yyss': related to states.
+ `yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
@@ -1325,23 +1485,23 @@ yyparse (void)
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1349,22 +1509,22 @@ yyparse (void)
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1373,10 +1533,10 @@ yyparse (void)
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1405,7 +1565,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex ();
+ yychar = YYLEX;
}
if (yychar <= YYEOF)
@@ -1470,7 +1630,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
+ `$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1484,439 +1644,440 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 107 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 105 "hl/src/H5LTparse.y"
{ memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ }
-#line 1468 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 3:
-#line 108 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 106 "hl/src/H5LTparse.y"
{ return (yyval.hid);}
-#line 1474 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 13:
-#line 122 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 120 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I8BE); }
-#line 1480 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 14:
-#line 123 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 121 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I8LE); }
-#line 1486 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 15:
-#line 124 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 122 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I16BE); }
-#line 1492 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 16:
-#line 125 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 123 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I16LE); }
-#line 1498 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 17:
-#line 126 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 124 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I32BE); }
-#line 1504 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 18:
-#line 127 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 125 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I32LE); }
-#line 1510 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 19:
-#line 128 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 126 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I64BE); }
-#line 1516 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 20:
-#line 129 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 127 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I64LE); }
-#line 1522 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 21:
-#line 130 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 128 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U8BE); }
-#line 1528 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 22:
-#line 131 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 129 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U8LE); }
-#line 1534 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 23:
-#line 132 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 130 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U16BE); }
-#line 1540 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 24:
-#line 133 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 131 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U16LE); }
-#line 1546 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 25:
-#line 134 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 132 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U32BE); }
-#line 1552 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 26:
-#line 135 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 133 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U32LE); }
-#line 1558 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 27:
-#line 136 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 134 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U64BE); }
-#line 1564 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 28:
-#line 137 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 135 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U64LE); }
-#line 1570 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 29:
-#line 138 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 136 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); }
-#line 1576 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 30:
-#line 139 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 137 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); }
-#line 1582 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 31:
-#line 140 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 138 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); }
-#line 1588 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 32:
-#line 141 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 139 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); }
-#line 1594 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 33:
-#line 142 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 140 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); }
-#line 1600 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 34:
-#line 143 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 141 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); }
-#line 1606 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 35:
-#line 144 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 142 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); }
-#line 1612 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 36:
-#line 145 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 143 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); }
-#line 1618 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 37:
-#line 146 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 144 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); }
-#line 1624 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 38:
-#line 147 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 145 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); }
-#line 1630 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 39:
-#line 148 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 146 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); }
-#line 1636 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 40:
-#line 151 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 149 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); }
-#line 1642 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 41:
-#line 152 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 150 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); }
-#line 1648 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 42:
-#line 153 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 151 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); }
-#line 1654 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 43:
-#line 154 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 152 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); }
-#line 1660 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 44:
-#line 155 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 153 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); }
-#line 1666 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 45:
-#line 156 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 154 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); }
-#line 1672 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 46:
-#line 157 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 155 "hl/src/H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); }
-#line 1678 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 47:
-#line 161 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 159 "hl/src/H5LTparse.y"
{ csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ }
-#line 1684 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 48:
-#line 163 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = cmpd_stack[csindex].id;
+/* Line 1792 of yacc.c */
+#line 161 "hl/src/H5LTparse.y"
+ { (yyval.hid) = cmpd_stack[csindex].id;
cmpd_stack[csindex].id = 0;
- cmpd_stack[csindex].first_memb = 1;
+ cmpd_stack[csindex].first_memb = 1;
csindex--;
}
-#line 1694 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 51:
-#line 172 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 170 "hl/src/H5LTparse.y"
{ cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ }
-#line 1700 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 52:
-#line 174 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
+/* Line 1792 of yacc.c */
+#line 172 "hl/src/H5LTparse.y"
+ {
size_t origin_size, new_size;
hid_t dtype_id = cmpd_stack[csindex].id;
/*Adjust size and insert member, consider both member size and offset.*/
if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/
- new_size = H5Tget_size((yyvsp[-6].hid)) + (yyvsp[-1].ival);
+ new_size = H5Tget_size((yyvsp[(1) - (7)].hid)) + (yyvsp[(6) - (7)].ival);
H5Tset_size(dtype_id, new_size);
/*member name is saved in yylval.sval by lexer*/
- H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid));
+ H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), (yyvsp[(1) - (7)].hid));
cmpd_stack[csindex].first_memb = 0;
} else {
origin_size = H5Tget_size(dtype_id);
-
- if((yyvsp[-1].ival) == 0) {
- new_size = origin_size + H5Tget_size((yyvsp[-6].hid));
+
+ if((yyvsp[(6) - (7)].ival) == 0) {
+ new_size = origin_size + H5Tget_size((yyvsp[(1) - (7)].hid));
H5Tset_size(dtype_id, new_size);
- H5Tinsert(dtype_id, (yyvsp[-3].sval), origin_size, (yyvsp[-6].hid));
+ H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), origin_size, (yyvsp[(1) - (7)].hid));
} else {
- new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-6].hid));
+ new_size = (yyvsp[(6) - (7)].ival) + H5Tget_size((yyvsp[(1) - (7)].hid));
H5Tset_size(dtype_id, new_size);
- H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid));
+ H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), (yyvsp[(1) - (7)].hid));
}
}
- if((yyvsp[-3].sval)) {
- free((yyvsp[-3].sval));
- (yyvsp[-3].sval) = NULL;
+ if((yyvsp[(4) - (7)].sval)) {
+ free((yyvsp[(4) - (7)].sval));
+ (yyvsp[(4) - (7)].sval) = NULL;
}
cmpd_stack[csindex].is_field = 0;
- H5Tclose((yyvsp[-6].hid));
-
+ H5Tclose((yyvsp[(1) - (7)].hid));
+
new_size = H5Tget_size(dtype_id);
}
-#line 1739 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 53:
-#line 210 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 208 "hl/src/H5LTparse.y"
{
(yyval.sval) = strdup(yylval.sval);
free(yylval.sval);
yylval.sval = NULL;
}
-#line 1749 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 54:
-#line 217 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 215 "hl/src/H5LTparse.y"
{ (yyval.ival) = 0; }
-#line 1755 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 55:
-#line 219 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 217 "hl/src/H5LTparse.y"
{ (yyval.ival) = yylval.ival; }
-#line 1761 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 57:
-#line 223 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 221 "hl/src/H5LTparse.y"
{ asindex++; /*pushd onto the stack*/ }
-#line 1767 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 58:
-#line 225 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims);
+/* Line 1792 of yacc.c */
+#line 223 "hl/src/H5LTparse.y"
+ {
+ (yyval.hid) = H5Tarray_create2((yyvsp[(5) - (6)].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims);
arr_stack[asindex].ndims = 0;
asindex--;
- H5Tclose((yyvsp[-1].hid));
+ H5Tclose((yyvsp[(5) - (6)].hid));
}
-#line 1778 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 61:
-#line 235 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 233 "hl/src/H5LTparse.y"
{ arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ }
-#line 1784 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 62:
-#line 236 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 234 "hl/src/H5LTparse.y"
{ unsigned ndims = arr_stack[asindex].ndims;
- arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival;
+ arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival;
arr_stack[asindex].ndims++;
- arr_stack[asindex].is_dim = 0;
+ arr_stack[asindex].is_dim = 0;
}
-#line 1794 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 65:
-#line 247 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); }
-#line 1800 "hl/src/H5LTparse.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 245 "hl/src/H5LTparse.y"
+ { (yyval.hid) = H5Tvlen_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); }
break;
case 66:
-#line 252 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 250 "hl/src/H5LTparse.y"
{ is_opq_size = 1; }
-#line 1806 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 67:
-#line 253 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
+/* Line 1792 of yacc.c */
+#line 251 "hl/src/H5LTparse.y"
+ {
size_t size = (size_t)yylval.ival;
(yyval.hid) = H5Tcreate(H5T_OPAQUE, size);
- is_opq_size = 0;
+ is_opq_size = 0;
}
-#line 1816 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 68:
-#line 258 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 256 "hl/src/H5LTparse.y"
{ is_opq_tag = 1; }
-#line 1822 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 69:
-#line 259 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- H5Tset_tag((yyvsp[-6].hid), yylval.sval);
+/* Line 1792 of yacc.c */
+#line 257 "hl/src/H5LTparse.y"
+ {
+ H5Tset_tag((yyvsp[(7) - (13)].hid), yylval.sval);
free(yylval.sval);
yylval.sval = NULL;
is_opq_tag = 0;
}
-#line 1833 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 70:
-#line 265 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { (yyval.hid) = (yyvsp[-8].hid); }
-#line 1839 "hl/src/H5LTparse.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 263 "hl/src/H5LTparse.y"
+ { (yyval.hid) = (yyvsp[(7) - (15)].hid); }
break;
case 73:
-#line 273 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 271 "hl/src/H5LTparse.y"
{ is_str_size = 1; }
-#line 1845 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 74:
-#line 274 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN)
+/* Line 1792 of yacc.c */
+#line 272 "hl/src/H5LTparse.y"
+ {
+ if((yyvsp[(5) - (6)].ival) == H5T_VARIABLE_TOKEN)
is_variable = 1;
- else
+ else
str_size = yylval.ival;
- is_str_size = 0;
+ is_str_size = 0;
}
-#line 1857 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 75:
-#line 282 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 280 "hl/src/H5LTparse.y"
{
- if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN)
+ if((yyvsp[(9) - (10)].ival) == H5T_STR_NULLTERM_TOKEN)
str_pad = H5T_STR_NULLTERM;
- else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN)
+ else if((yyvsp[(9) - (10)].ival) == H5T_STR_NULLPAD_TOKEN)
str_pad = H5T_STR_NULLPAD;
- else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN)
+ else if((yyvsp[(9) - (10)].ival) == H5T_STR_SPACEPAD_TOKEN)
str_pad = H5T_STR_SPACEPAD;
}
-#line 1870 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 76:
-#line 291 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN)
+/* Line 1792 of yacc.c */
+#line 289 "hl/src/H5LTparse.y"
+ {
+ if((yyvsp[(13) - (14)].ival) == H5T_CSET_ASCII_TOKEN)
str_cset = H5T_CSET_ASCII;
- else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN)
+ else if((yyvsp[(13) - (14)].ival) == H5T_CSET_UTF8_TOKEN)
str_cset = H5T_CSET_UTF8;
}
-#line 1881 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 77:
-#line 298 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 296 "hl/src/H5LTparse.y"
{
- if((yyvsp[-1].hid) == H5T_C_S1_TOKEN)
+ if((yyvsp[(17) - (18)].hid) == H5T_C_S1_TOKEN)
(yyval.hid) = H5Tcopy(H5T_C_S1);
- else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN)
+ else if((yyvsp[(17) - (18)].hid) == H5T_FORTRAN_S1_TOKEN)
(yyval.hid) = H5Tcopy(H5T_FORTRAN_S1);
}
-#line 1892 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 78:
-#line 305 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- {
- hid_t str_id = (yyvsp[-1].hid);
+/* Line 1792 of yacc.c */
+#line 303 "hl/src/H5LTparse.y"
+ {
+ hid_t str_id = (yyvsp[(19) - (20)].hid);
/*set string size*/
if(is_variable) {
@@ -1924,93 +2085,93 @@ yyreduce:
is_variable = 0;
} else
H5Tset_size(str_id, str_size);
-
+
/*set string padding and character set*/
H5Tset_strpad(str_id, str_pad);
H5Tset_cset(str_id, str_cset);
- (yyval.hid) = str_id;
+ (yyval.hid) = str_id;
}
-#line 1913 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 79:
-#line 322 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 320 "hl/src/H5LTparse.y"
{(yyval.ival) = H5T_VARIABLE_TOKEN;}
-#line 1919 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 81:
-#line 325 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 323 "hl/src/H5LTparse.y"
{(yyval.ival) = H5T_STR_NULLTERM_TOKEN;}
-#line 1925 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 82:
-#line 326 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 324 "hl/src/H5LTparse.y"
{(yyval.ival) = H5T_STR_NULLPAD_TOKEN;}
-#line 1931 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 83:
-#line 327 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 325 "hl/src/H5LTparse.y"
{(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;}
-#line 1937 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 84:
-#line 329 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 327 "hl/src/H5LTparse.y"
{(yyval.ival) = H5T_CSET_ASCII_TOKEN;}
-#line 1943 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 85:
-#line 330 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 328 "hl/src/H5LTparse.y"
{(yyval.ival) = H5T_CSET_UTF8_TOKEN;}
-#line 1949 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 86:
-#line 332 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 330 "hl/src/H5LTparse.y"
{(yyval.hid) = H5T_C_S1_TOKEN;}
-#line 1955 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 87:
-#line 333 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 331 "hl/src/H5LTparse.y"
{(yyval.hid) = H5T_FORTRAN_S1_TOKEN;}
-#line 1961 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 88:
-#line 337 "hl/src/H5LTparse.y" /* yacc.c:1646 */
- { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); }
-#line 1967 "hl/src/H5LTparse.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 335 "hl/src/H5LTparse.y"
+ { is_enum = 1; enum_id = H5Tenum_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); }
break;
case 89:
-#line 339 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 337 "hl/src/H5LTparse.y"
{ is_enum = 0; /*reset*/ (yyval.hid) = enum_id; }
-#line 1973 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 92:
-#line 344 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 342 "hl/src/H5LTparse.y"
{
is_enum_memb = 1; /*indicate member of enum*/
#ifdef H5_HAVE_WIN32_API
- enum_memb_symbol = _strdup(yylval.sval);
+ enum_memb_symbol = _strdup(yylval.sval);
#else /* H5_HAVE_WIN32_API */
- enum_memb_symbol = strdup(yylval.sval);
+ enum_memb_symbol = strdup(yylval.sval);
#endif /* H5_HAVE_WIN32_API */
free(yylval.sval);
yylval.sval = NULL;
}
-#line 1988 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
case 93:
-#line 355 "hl/src/H5LTparse.y" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 353 "hl/src/H5LTparse.y"
{
char char_val=(char)yylval.ival;
short short_val=(short)yylval.ival;
@@ -2021,43 +2182,43 @@ yyreduce:
hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND);
H5T_order_t super_order = H5Tget_order(super);
H5T_order_t native_order = H5Tget_order(native);
-
+
if(is_enum && is_enum_memb) { /*if it's an enum member*/
/*To handle machines of different endianness*/
if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) {
if(super_order != native_order)
- H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT);
+ H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &char_val);
} else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) {
if(super_order != native_order)
- H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT);
+ H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &short_val);
} else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) {
if(super_order != native_order)
- H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT);
+ H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &int_val);
} else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) {
if(super_order != native_order)
- H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT);
+ H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &long_val);
} else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) {
if(super_order != native_order)
- H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT);
+ H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT);
H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val);
}
- is_enum_memb = 0;
+ is_enum_memb = 0;
if(enum_memb_symbol) free(enum_memb_symbol);
}
H5Tclose(super);
H5Tclose(native);
}
-#line 2035 "hl/src/H5LTparse.c" /* yacc.c:1646 */
break;
-#line 2039 "hl/src/H5LTparse.c" /* yacc.c:1646 */
+/* Line 1792 of yacc.c */
+#line 2200 "hl/src/H5LTparse.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2079,7 +2240,7 @@ yyreduce:
*++yyvsp = yyval;
- /* Now 'shift' the result of the reduction. Determine what state
+ /* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -2094,9 +2255,9 @@ yyreduce:
goto yynewstate;
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -2147,20 +2308,20 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -2179,7 +2340,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -2192,29 +2353,29 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
+ yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
@@ -2265,14 +2426,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
- /* Do not reclaim the symbols of the rule whose action triggered
+ /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
+ yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -2283,5 +2444,8 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- return yyresult;
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
}
+
+
diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h
index 3d7b4e8..0ecd15d 100644
--- a/hl/src/H5LTparse.h
+++ b/hl/src/H5LTparse.h
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.0.2. */
+/* A Bison parser, made by GNU Bison 2.7. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@
#ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
# define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED
-/* Debug traces. */
+/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
@@ -40,90 +40,105 @@
extern int H5LTyydebug;
#endif
-/* Token type. */
+/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- enum yytokentype
- {
- H5T_STD_I8BE_TOKEN = 258,
- H5T_STD_I8LE_TOKEN = 259,
- H5T_STD_I16BE_TOKEN = 260,
- H5T_STD_I16LE_TOKEN = 261,
- H5T_STD_I32BE_TOKEN = 262,
- H5T_STD_I32LE_TOKEN = 263,
- H5T_STD_I64BE_TOKEN = 264,
- H5T_STD_I64LE_TOKEN = 265,
- H5T_STD_U8BE_TOKEN = 266,
- H5T_STD_U8LE_TOKEN = 267,
- H5T_STD_U16BE_TOKEN = 268,
- H5T_STD_U16LE_TOKEN = 269,
- H5T_STD_U32BE_TOKEN = 270,
- H5T_STD_U32LE_TOKEN = 271,
- H5T_STD_U64BE_TOKEN = 272,
- H5T_STD_U64LE_TOKEN = 273,
- H5T_NATIVE_CHAR_TOKEN = 274,
- H5T_NATIVE_SCHAR_TOKEN = 275,
- H5T_NATIVE_UCHAR_TOKEN = 276,
- H5T_NATIVE_SHORT_TOKEN = 277,
- H5T_NATIVE_USHORT_TOKEN = 278,
- H5T_NATIVE_INT_TOKEN = 279,
- H5T_NATIVE_UINT_TOKEN = 280,
- H5T_NATIVE_LONG_TOKEN = 281,
- H5T_NATIVE_ULONG_TOKEN = 282,
- H5T_NATIVE_LLONG_TOKEN = 283,
- H5T_NATIVE_ULLONG_TOKEN = 284,
- H5T_IEEE_F32BE_TOKEN = 285,
- H5T_IEEE_F32LE_TOKEN = 286,
- H5T_IEEE_F64BE_TOKEN = 287,
- H5T_IEEE_F64LE_TOKEN = 288,
- H5T_NATIVE_FLOAT_TOKEN = 289,
- H5T_NATIVE_DOUBLE_TOKEN = 290,
- H5T_NATIVE_LDOUBLE_TOKEN = 291,
- H5T_STRING_TOKEN = 292,
- STRSIZE_TOKEN = 293,
- STRPAD_TOKEN = 294,
- CSET_TOKEN = 295,
- CTYPE_TOKEN = 296,
- H5T_VARIABLE_TOKEN = 297,
- H5T_STR_NULLTERM_TOKEN = 298,
- H5T_STR_NULLPAD_TOKEN = 299,
- H5T_STR_SPACEPAD_TOKEN = 300,
- H5T_CSET_ASCII_TOKEN = 301,
- H5T_CSET_UTF8_TOKEN = 302,
- H5T_C_S1_TOKEN = 303,
- H5T_FORTRAN_S1_TOKEN = 304,
- H5T_OPAQUE_TOKEN = 305,
- OPQ_SIZE_TOKEN = 306,
- OPQ_TAG_TOKEN = 307,
- H5T_COMPOUND_TOKEN = 308,
- H5T_ENUM_TOKEN = 309,
- H5T_ARRAY_TOKEN = 310,
- H5T_VLEN_TOKEN = 311,
- STRING = 312,
- NUMBER = 313
- };
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ H5T_STD_I8BE_TOKEN = 258,
+ H5T_STD_I8LE_TOKEN = 259,
+ H5T_STD_I16BE_TOKEN = 260,
+ H5T_STD_I16LE_TOKEN = 261,
+ H5T_STD_I32BE_TOKEN = 262,
+ H5T_STD_I32LE_TOKEN = 263,
+ H5T_STD_I64BE_TOKEN = 264,
+ H5T_STD_I64LE_TOKEN = 265,
+ H5T_STD_U8BE_TOKEN = 266,
+ H5T_STD_U8LE_TOKEN = 267,
+ H5T_STD_U16BE_TOKEN = 268,
+ H5T_STD_U16LE_TOKEN = 269,
+ H5T_STD_U32BE_TOKEN = 270,
+ H5T_STD_U32LE_TOKEN = 271,
+ H5T_STD_U64BE_TOKEN = 272,
+ H5T_STD_U64LE_TOKEN = 273,
+ H5T_NATIVE_CHAR_TOKEN = 274,
+ H5T_NATIVE_SCHAR_TOKEN = 275,
+ H5T_NATIVE_UCHAR_TOKEN = 276,
+ H5T_NATIVE_SHORT_TOKEN = 277,
+ H5T_NATIVE_USHORT_TOKEN = 278,
+ H5T_NATIVE_INT_TOKEN = 279,
+ H5T_NATIVE_UINT_TOKEN = 280,
+ H5T_NATIVE_LONG_TOKEN = 281,
+ H5T_NATIVE_ULONG_TOKEN = 282,
+ H5T_NATIVE_LLONG_TOKEN = 283,
+ H5T_NATIVE_ULLONG_TOKEN = 284,
+ H5T_IEEE_F32BE_TOKEN = 285,
+ H5T_IEEE_F32LE_TOKEN = 286,
+ H5T_IEEE_F64BE_TOKEN = 287,
+ H5T_IEEE_F64LE_TOKEN = 288,
+ H5T_NATIVE_FLOAT_TOKEN = 289,
+ H5T_NATIVE_DOUBLE_TOKEN = 290,
+ H5T_NATIVE_LDOUBLE_TOKEN = 291,
+ H5T_STRING_TOKEN = 292,
+ STRSIZE_TOKEN = 293,
+ STRPAD_TOKEN = 294,
+ CSET_TOKEN = 295,
+ CTYPE_TOKEN = 296,
+ H5T_VARIABLE_TOKEN = 297,
+ H5T_STR_NULLTERM_TOKEN = 298,
+ H5T_STR_NULLPAD_TOKEN = 299,
+ H5T_STR_SPACEPAD_TOKEN = 300,
+ H5T_CSET_ASCII_TOKEN = 301,
+ H5T_CSET_UTF8_TOKEN = 302,
+ H5T_C_S1_TOKEN = 303,
+ H5T_FORTRAN_S1_TOKEN = 304,
+ H5T_OPAQUE_TOKEN = 305,
+ OPQ_SIZE_TOKEN = 306,
+ OPQ_TAG_TOKEN = 307,
+ H5T_COMPOUND_TOKEN = 308,
+ H5T_ENUM_TOKEN = 309,
+ H5T_ARRAY_TOKEN = 310,
+ H5T_VLEN_TOKEN = 311,
+ STRING = 312,
+ NUMBER = 313
+ };
#endif
-/* Value type. */
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE YYSTYPE;
-union YYSTYPE
+typedef union YYSTYPE
{
-#line 74 "hl/src/H5LTparse.y" /* yacc.c:1909 */
+/* Line 2058 of yacc.c */
+#line 72 "hl/src/H5LTparse.y"
int ival; /*for integer token*/
char *sval; /*for name string*/
hid_t hid; /*for hid_t token*/
-#line 119 "hl/src/H5LTparse.h" /* yacc.c:1909 */
-};
+
+/* Line 2058 of yacc.c */
+#line 122 "hl/src/H5LTparse.h"
+} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-
extern YYSTYPE H5LTyylval;
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int H5LTyyparse (void *YYPARSE_PARAM);
+#else
+int H5LTyyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
int H5LTyyparse (void);
+#else
+int H5LTyyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
#endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */
diff --git a/hl/src/H5LTpublic.h b/hl/src/H5LTpublic.h
index 47be98a..6df7c4b 100644
--- a/hl/src/H5LTpublic.h
+++ b/hl/src/H5LTpublic.h
@@ -20,7 +20,7 @@
/* user supplied image buffer. The same image is open with the core driver. */
#define H5LT_FILE_IMAGE_DONT_RELEASE 0x0004 /* The HDF5 lib won't */
/* deallocate user supplied image buffer. The user application is reponsible */
-/* for doing so. */
+/* for doing so. */
#define H5LT_FILE_IMAGE_ALL 0x0007
typedef enum H5LT_lang_t {
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index 07d8bfb..f413bea 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -940,7 +940,7 @@ herr_t H5PTfree_vlen_buff( hid_t table_id,
goto error;
/* Free the memory. If this succeeds, ret_value should be 0. */
- if((ret_value = H5Dvlen_reclaim(table->type_id, space_id, H5P_DEFAULT, buff)) < 0)
+ if((ret_value = H5Treclaim(table->type_id, space_id, H5P_DEFAULT, buff)) < 0)
goto error;
/* If the dataspace cannot be closed, return -2 to indicate that memory */
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index a4bcbd4..c54c41f 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -102,7 +102,7 @@ herr_t H5TBmake_table(const char *table_title,
if (field_names == NULL) {
goto out;
}
-
+
dims[0] = nrecords;
dims_chunk[0] = chunk_size;
@@ -300,7 +300,7 @@ herr_t H5TBappend_records(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* get the original number of records and fields */
@@ -374,7 +374,7 @@ herr_t H5TBwrite_records(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* open the dataset. */
@@ -477,9 +477,9 @@ herr_t H5TBwrite_fields_name(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
- if (field_names == NULL)
+ if (field_names == NULL)
goto out;
/* create xfer properties to preserve initialized data */
@@ -640,7 +640,7 @@ herr_t H5TBwrite_fields_index(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* create xfer properties to preserve initialized data */
@@ -801,7 +801,7 @@ herr_t H5TBread_table(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* open the dataset. */
@@ -878,7 +878,7 @@ herr_t H5TBread_records(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* get the number of records and fields */
@@ -959,9 +959,9 @@ herr_t H5TBread_fields_name(hid_t loc_id,
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
- if (field_names == NULL)
+ if (field_names == NULL)
goto out;
/* open the dataset */
@@ -1029,7 +1029,7 @@ herr_t H5TBread_fields_name(hid_t loc_id,
/* check to make sure field was found, no reason to continue if it does not exist */
if(j == 0)
goto out;
-
+
/* get the dataspace handle */
if((sid = H5Dget_space(did)) < 0)
goto out;
@@ -1121,7 +1121,7 @@ herr_t H5TBread_fields_index(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* open the dataset. */
@@ -1281,9 +1281,9 @@ herr_t H5TBdelete_record(hid_t loc_id,
unsigned char *tmp_buf = NULL;
herr_t ret_val = -1;
-
+
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/*-------------------------------------------------------------------------
@@ -1446,7 +1446,7 @@ herr_t H5TBinsert_record(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/*-------------------------------------------------------------------------
@@ -1601,9 +1601,9 @@ herr_t H5TBadd_records_from(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name1 == NULL)
+ if (dset_name1 == NULL)
goto out;
- if (dset_name2 == NULL)
+ if (dset_name2 == NULL)
goto out;
/*-------------------------------------------------------------------------
@@ -1754,11 +1754,11 @@ herr_t H5TBcombine_tables(hid_t loc_id1,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name1 == NULL)
+ if (dset_name1 == NULL)
goto out;
- if (dset_name2 == NULL)
+ if (dset_name2 == NULL)
goto out;
- if (dset_name3 == NULL)
+ if (dset_name3 == NULL)
goto out;
/*-------------------------------------------------------------------------
@@ -2117,9 +2117,9 @@ herr_t H5TBinsert_field(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
- if (field_name == NULL)
+ if (field_name == NULL)
goto out;
/* get the number of records and fields */
@@ -2532,9 +2532,9 @@ herr_t H5TBdelete_field(hid_t loc_id,
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
- if (field_name == NULL)
+ if (field_name == NULL)
goto out;
/* get the number of records and fields */
@@ -2982,7 +2982,7 @@ htri_t H5TBAget_fill(hid_t loc_id,
htri_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* get the number of records and fields */
@@ -3014,7 +3014,7 @@ htri_t H5TBAget_fill(hid_t loc_id,
out:
if(src_offset)
HDfree(src_offset);
-
+
return ret_val;
} /* end H5TBAget_fill() */
@@ -3054,7 +3054,7 @@ herr_t H5TBget_table_info(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* open the dataset. */
@@ -3145,7 +3145,7 @@ herr_t H5TBget_field_info(hid_t loc_id,
herr_t ret_val = -1;
/* check the arguments */
- if (dset_name == NULL)
+ if (dset_name == NULL)
goto out;
/* open the dataset. */
@@ -3253,9 +3253,9 @@ hbool_t H5TB_find_field(const char *field, const char *field_list)
const char *end;
/* check the arguments */
- if (field == NULL)
+ if (field == NULL)
return FALSE;
- if (field_list == NULL)
+ if (field_list == NULL)
return FALSE;
while((end = HDstrstr(start, ",")) != 0) {
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
index 8845505..6349bb3 100644
--- a/hl/test/CMakeLists.txt
+++ b/hl/test/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_TEST)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_TEST C)
# --------------------------------------------------------------------
# Notes: When creating unit test executables they should be prefixed
# with "hl_". This allows for easier filtering of the test suite when
@@ -14,65 +14,71 @@ PROJECT (HDF5_HL_TEST)
set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
-include_directories (${CMAKE_CURRENT_BINARY_DIR})
-include_directories (${HDF5_TEST_SRC_DIR})
-
# --------------------------------------------------------------------
# Macro used to add a unit test
# --------------------------------------------------------------------
-MACRO (HL_ADD_EXE hl_name)
+macro (HL_ADD_EXE hl_name)
add_executable (hl_${hl_name} ${hl_name}.c)
- TARGET_NAMING (hl_${hl_name} STATIC)
- TARGET_C_PROPERTIES (hl_${hl_name} STATIC " " " ")
- target_link_libraries (hl_${hl_name}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_LIB_TARGET}
- )
- set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
-ENDMACRO ()
-
-MACRO (HL_ADD_SHEXE hl_name)
- add_executable (hl_${hl_name} ${hl_name}.c)
- TARGET_NAMING (hl_${hl_name} SHARED)
- TARGET_C_PROPERTIES (hl_${hl_name} SHARED " " " ")
- target_link_libraries (hl_${hl_name}
- ${HDF5_HL_LIBSH_TARGET}
- ${HDF5_TEST_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
- )
+ target_compile_options(hl_${hl_name} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_${hl_name} STATIC)
+ target_link_libraries (hl_${hl_name} PRIVATE
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ else ()
+ TARGET_C_PROPERTIES (hl_${hl_name} SHARED)
+ target_link_libraries (hl_${hl_name} PRIVATE
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+ endif ()
set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
-ENDMACRO ()
+endmacro ()
HL_ADD_EXE (test_lite)
HL_ADD_EXE (test_image)
HL_ADD_EXE (test_file_image)
HL_ADD_EXE (test_table)
HL_ADD_EXE (test_ds)
-HL_ADD_EXE (test_dset_opt)
HL_ADD_EXE (test_ld)
HL_ADD_EXE (test_dset_append)
+HL_ADD_EXE (test_h5do_compat)
# test_packet has two source files
add_executable (hl_test_packet test_packet.c test_packet_vlen.c)
-TARGET_NAMING (hl_test_packet STATIC)
-TARGET_C_PROPERTIES (hl_test_packet STATIC " " " ")
-target_link_libraries (hl_test_packet
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_LIB_TARGET}
-)
+target_compile_options(hl_test_packet PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_test_packet STATIC)
+ target_link_libraries (hl_test_packet PRIVATE
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (hl_test_packet SHARED)
+ target_link_libraries (hl_test_packet PRIVATE
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl)
# --------------------------------------------------------------------
# This executable is used to generate test files for the test_ds test.
# It should only be run during development when new test files are needed
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (hl_gen_test_ds gen_test_ds.c)
- TARGET_NAMING (hl_gen_test_ds STATIC)
- TARGET_C_PROPERTIES (hl_gen_test_ds STATIC " " " ")
- target_link_libraries (hl_gen_test_ds
+ target_compile_options(hl_gen_test_ds PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (hl_gen_test_ds STATIC)
+ target_link_libraries (hl_gen_test_ds PRIVATE
${HDF5_HL_LIB_TARGET}
${HDF5_TEST_LIB_TARGET}
${HDF5_LIB_TARGET}
@@ -80,9 +86,10 @@ if (HDF5_BUILD_GENERATORS)
set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen)
add_executable (hl_gen_test_ld gen_test_ld.c)
- TARGET_NAMING (hl_gen_test_ld STATIC)
- TARGET_C_PROPERTIES (hl_gen_test_ld STATIC " " " ")
- target_link_libraries (hl_gen_test_ld
+ target_compile_options(hl_gen_test_ld PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (hl_gen_test_ld STATIC)
+ target_link_libraries (hl_gen_test_ld PRIVATE
${HDF5_HL_LIB_TARGET}
${HDF5_TEST_LIB_TARGET}
${HDF5_LIB_TARGET}
@@ -90,4 +97,6 @@ if (HDF5_BUILD_GENERATORS)
set_target_properties (hl_gen_test_ld PROPERTIES FOLDER test/hl/gen)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake
index e5eb58e..716a3d7 100644
--- a/hl/test/CMakeTests.cmake
+++ b/hl/test/CMakeTests.cmake
@@ -43,14 +43,53 @@ foreach (h5_file ${HL_REFERENCE_TEST_FILES})
endforeach ()
add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list})
+# Remove any output file left over from previous test run
+set (test_hl_CLEANFILES
+ combine_tables1.h5
+ combine_tables2.h5
+ file_img1.h5
+ file_img2.h5
+ test_append.h5
+ h5do_compat.h5
+ test_detach.h5
+ test_ds1.h5
+ test_ds2.h5
+ test_ds3.h5
+ test_ds4.h5
+ test_ds5.h5
+ test_ds6.h5
+ test_ds7.h5
+ test_ds8.h5
+ test_ds9.h5
+ test_ds10.h5
+ test_image1.h5
+ test_image2.h5
+ test_image3.h5
+ test_lite1.h5
+ test_lite2.h5
+ test_lite3.h5
+ test_lite4.h5
+ test_packet_compress.h5
+ test_packet_table.h5
+ test_packet_table_vlen.h5
+ testfl_packet_table_vlen.h5
+ test_table.h5
+)
+add_test (
+ NAME HL_test-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${test_hl_CLEANFILES}
+)
+set_tests_properties (HL_test-clear-objects PROPERTIES FIXTURES_SETUP clear_test_hl)
+
# --------------------------------------------------------------------
# Macro used to add a unit test
# --------------------------------------------------------------------
macro (HL_ADD_TEST hl_name)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME HL_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>)
+ add_test (NAME HL_${hl_name} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_${hl_name}>)
else ()
add_test (NAME HL_${hl_name} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:hl_${hl_name}>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
@@ -61,61 +100,20 @@ macro (HL_ADD_TEST hl_name)
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test}
+ set_tests_properties (HL_${hl_name} PROPERTIES
+ FIXTURES_REQUIRED clear_test_hl
ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR}
- )
- endif ()
+ )
endmacro ()
-# Remove any output file left over from previous test run
-add_test (
- NAME HL_test-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- combine_tables1.h5
- combine_tables2.h5
- file_img1.h5
- file_img2.h5
- test_append.h5
- test_detach.h5
- test_ds1.h5
- test_ds2.h5
- test_ds3.h5
- test_ds4.h5
- test_ds5.h5
- test_ds6.h5
- test_ds7.h5
- test_ds8.h5
- test_ds9.h5
- test_ds10.h5
- test_dectris.h5
- test_image1.h5
- test_image2.h5
- test_image3.h5
- test_lite1.h5
- test_lite2.h5
- test_lite3.h5
- test_lite4.h5
- test_packet_compress.h5
- test_packet_table.h5
- test_packet_table_vlen.h5
- testfl_packet_table_vlen.h5
- test_table.h5
-)
-if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test})
-endif ()
-set (last_test "HL_test-clear-objects")
-
HL_add_test (test_lite )
HL_add_test (test_image)
HL_add_test (test_file_image)
HL_add_test (test_table)
HL_add_test (test_ds)
HL_add_test (test_packet)
-HL_add_test (test_dset_opt)
HL_add_test (test_ld)
HL_add_test (test_dset_append)
+HL_add_test (test_h5do_compat)
diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am
index e16550f..2e63438 100644
--- a/hl/test/Makefile.am
+++ b/hl/test/Makefile.am
@@ -26,8 +26,8 @@ LDADD=$(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5)
# Test programs. These are our main targets. They should be listed in the
# order to be executed, generally most specific tests to least specific tests.
-TEST_PROG=test_lite test_image test_file_image test_table test_ds test_packet test_dset_opt \
- test_ld test_dset_append
+TEST_PROG=test_lite test_image test_file_image test_table test_ds test_packet \
+ test_ld test_dset_append test_h5do_compat
check_PROGRAMS=$(TEST_PROG)
# These programs generate test files for the tests. They don't need to be
@@ -45,8 +45,8 @@ endif
CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-9].h5 test_ds10.h5 \
test_image[1-3].h5 file_img[1-2].h5 test_lite[1-4].h5 test_table.h5 \
test_packet_table.h5 test_packet_compress.h5 test_detach.h5 \
- test_packet_table_vlen.h5 testfl_packet_table_vlen.h5 \
- test_dectris.h5 test_append.h5
+ test_packet_table_vlen.h5 testfl_packet_table_vlen.h5 test_append.h5 \
+ h5do_compat.h5
# Sources for test_packet executable
test_packet_SOURCES=test_packet.c test_packet_vlen.c
diff --git a/hl/test/dectris_hl_perf.c b/hl/test/dectris_hl_perf.c
deleted file mode 100644
index 13cfac8..0000000
--- a/hl/test/dectris_hl_perf.c
+++ /dev/null
@@ -1,691 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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 COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * This test is for the DECTRIS project to the H5DOwrite_chunk function
- *
- */
-
-#include "hdf5_hl.h"
-
-#ifdef H5_HAVE_FILTER_DEFLATE
-#include <zlib.h>
-
-#if !defined(WIN32) && !defined(__MINGW32__)
-
-#include <math.h>
-
-#ifdef H5_STDC_HEADERS
-# include <errno.h>
-# include <fcntl.h>
-# include <stdio.h>
-# include <stdlib.h>
-#endif
-
-#ifdef H5_HAVE_UNISTD_H
-# include <sys/types.h>
-# include <unistd.h>
-#endif
-
-#ifdef H5_HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if defined(H5_TIME_WITH_SYS_TIME)
-# include <sys/time.h>
-# include <time.h>
-#elif defined(H5_HAVE_SYS_TIME_H)
-# include <sys/time.h>
-#else
-# include <time.h>
-#endif
-
-const char *FILENAME[] = {
- "dectris_perf",
- "unix.raw",
- NULL
-};
-
-/*
- * Print the current location on the standard output stream.
- */
-#define FUNC __func__
-#define AT() printf (" at %s:%d in %s()...\n", \
- __FILE__, __LINE__, FUNC);
-#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
-#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
-#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);}
-#define PASSED() {puts(" PASSED");fflush(stdout);}
-
-#define DIRECT_UNCOMPRESSED_DSET "direct_uncompressed_dset"
-#define DIRECT_COMPRESSED_DSET "direct_compressed_dset"
-#define REG_COMPRESSED_DSET "reg_compressed_dset"
-#define REG_NO_COMPRESS_DSET "reg_no_compress_dset"
-#define RANK 3
-#define NX 100
-#define NY 1000
-#define NZ 250
-#define CHUNK_NX 1
-#define CHUNK_NY 1000
-#define CHUNK_NZ 250
-
-#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12)
-char filename[1024];
-unsigned int *outbuf[NX];
-size_t data_size[NX];
-double total_size = 0.0;
-unsigned int *direct_buf[NX];
-double MB = 1048576.0;
-
-/*--------------------------------------------------
- * Function to report IO rate
- *--------------------------------------------------
- */
-void reportTime(struct timeval start, double mbytes)
-{
- struct timeval timeval_stop,timeval_diff;
-
- /*end timing*/
- gettimeofday(&timeval_stop,NULL);
-
- /* Calculate the elapsed gettimeofday time */
- timeval_diff.tv_usec=timeval_stop.tv_usec-start.tv_usec;
- timeval_diff.tv_sec=timeval_stop.tv_sec-start.tv_sec;
-
- if(timeval_diff.tv_usec<0) {
- timeval_diff.tv_usec+=1000000;
- timeval_diff.tv_sec--;
- } /* end if */
-
-/*printf("mbytes=%lf, sec=%lf, usec=%lf\n", mbytes, (double)timeval_diff.tv_sec, (double)timeval_diff.tv_usec);*/
- printf("MBytes/second: %lf\n", (double)mbytes/((double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0)));
-}
-
-/*--------------------------------------------------
- * Create file, datasets, and initialize data
- *--------------------------------------------------
- */
-int create_file(hid_t fapl_id)
-{
- hid_t file; /* handles */
- hid_t fapl;
- hid_t cparms;
- hid_t dataspace, dataset;
- hsize_t dims[RANK] = {NX, NY, NZ};
- hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ};
- unsigned int aggression = 9; /* Compression aggression setting */
- int ret;
- int i, j, n;
-
- int flag;
- int unix_file;
-
- unsigned int *p;
- size_t buf_size = CHUNK_NY*CHUNK_NZ*sizeof(unsigned int);
-
- const Bytef *z_src;
- Bytef *z_dst; /*destination buffer */
- uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- uLong z_src_nbytes = (uLong)buf_size;
-
- TESTING("Create a file and dataset");
-
- /*
- * Create the data space with unlimited dimensions.
- */
- if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
- TEST_ERROR;
-
- /*
- * Create a new file. If file exists its contents will be overwritten.
- */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
- TEST_ERROR;
-
- /*
- * Modify dataset creation properties, i.e. enable chunking and compression
- */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- TEST_ERROR;
-
- if(H5Pset_chunk( cparms, RANK, chunk_dims) < 0)
- TEST_ERROR;
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- if((dataset = H5Dcreate2(file, DIRECT_UNCOMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
- if(H5Dclose(dataset) < 0)
- TEST_ERROR;
-
- if((dataset = H5Dcreate2(file, REG_NO_COMPRESS_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
- if(H5Dclose(dataset) < 0)
- TEST_ERROR;
-
- /* Set compression */
- if(H5Pset_deflate( cparms, aggression) < 0)
- TEST_ERROR;
-
- if((dataset = H5Dcreate2(file, DIRECT_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
- if(H5Dclose(dataset) < 0)
- TEST_ERROR;
-
-
- if((dataset = H5Dcreate2(file, REG_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
- if(H5Dclose(dataset) < 0)
- TEST_ERROR;
-
- if(H5Fclose(file) < 0)
- TEST_ERROR;
-
- if(H5Sclose(dataspace) < 0)
- TEST_ERROR;
-
- if(H5Pclose(cparms) < 0)
- TEST_ERROR;
-
- /* create a unix file*/
- flag = O_CREAT|O_TRUNC|O_WRONLY;
-
- if ((unix_file=open(FILENAME[1],flag,S_IRWXU))== -1)
- TEST_ERROR;
-
- if (close(unix_file) < 0)
- {
- printf(" unable to close the file\n");
- TEST_ERROR;
- }
-
-
- /* Initialize data for chunks */
- for(i = 0; i < NX; i++) {
- p = direct_buf[i] = (unsigned int*)malloc(CHUNK_NY*CHUNK_NZ*sizeof(unsigned int));
-
- for(j=0; j < CHUNK_NY*CHUNK_NZ; j++, p++)
- *p = rand() % 65000;
-
- z_src = (const Bytef*)direct_buf[i];
-
- z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- /* Allocate output (compressed) buffer */
- outbuf[i] = (unsigned int*)malloc((size_t)z_dst_nbytes);
- z_dst = (Bytef *)outbuf[i];
-
- /* Perform compression from the source to the destination buffer */
- ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
-
- data_size[i] = (size_t)z_dst_nbytes;
- total_size += data_size[i];
-
- /* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
- fprintf(stderr, "overflow");
- TEST_ERROR;
- } else if(Z_MEM_ERROR == ret) {
- fprintf(stderr, "deflate memory error");
- TEST_ERROR;
- } else if(Z_OK != ret) {
- fprintf(stderr, "other deflate error");
- TEST_ERROR;
- }
- }
-
-
- PASSED();
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-}
-
-/*--------------------------------------------------
- * Benchmark the performance of the new function
- * with precompressed data.
- *--------------------------------------------------
- */
-int
-test_direct_write_uncompressed_data(hid_t fapl_id)
-{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t dxpl;
- herr_t status;
- int i;
-
- unsigned filter_mask = 0;
- hsize_t offset[RANK] = {0, 0, 0};
-
- struct timeval timeval_start;
-
- TESTING("H5DOwrite_chunk for uncompressed data");
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- TEST_ERROR;
-
- /* Start the timer */
- gettimeofday(&timeval_start,NULL);
-
- /* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
- TEST_ERROR;
-
- if((dataset = H5Dopen2(file, DIRECT_UNCOMPRESSED_DSET, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
-
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
- for(i=0; i<NX; i++) {
- status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, CHUNK_NY*CHUNK_NZ*sizeof(unsigned int), direct_buf[i]);
- (offset[0])++;
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Pclose(dxpl);
- H5Fclose(file);
-
- /* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Pclose(dxpl);
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-}
-
-
-/*--------------------------------------------------
- * Benchmark the performance of the new function
- * with precompressed data.
- *--------------------------------------------------
- */
-int
-test_direct_write_compressed_data(hid_t fapl_id)
-{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t dxpl;
- herr_t status;
- int i;
-
- unsigned filter_mask = 0;
- hsize_t offset[RANK] = {0, 0, 0};
-
- struct timeval timeval_start;
-
- TESTING("H5DOwrite_chunk for pre-compressed data");
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- TEST_ERROR;
-
- /* Start the timer */
- gettimeofday(&timeval_start,NULL);
-
- /* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
- TEST_ERROR;
-
- if((dataset = H5Dopen2(file, DIRECT_COMPRESSED_DSET, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
-
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
- for(i=0; i<NX; i++) {
- status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, data_size[i], outbuf[i]);
- (offset[0])++;
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Pclose(dxpl);
- H5Fclose(file);
-
- /* Report the performance */
- reportTime(timeval_start, (double)(total_size/MB));
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Pclose(dxpl);
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-}
-
-/*--------------------------------------------------
- * Benchmark the performance of the regular H5Dwrite
- * with compression filter enabled.
- *--------------------------------------------------
- */
-int
-test_compressed_write(hid_t fapl_id)
-{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t mem_space;
- hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ};
- hid_t dxpl;
- herr_t status;
- int i;
-
- hsize_t start[RANK]; /* Start of hyperslab */
- hsize_t stride[RANK]; /* Stride of hyperslab */
- hsize_t count[RANK]; /* Block count */
- hsize_t block[RANK]; /* Block sizes */
-
- struct timeval timeval_start;
-
- TESTING("H5Dwrite with compression enabled");
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- TEST_ERROR;
-
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- TEST_ERROR;
-
- /* Start the timer */
- gettimeofday(&timeval_start,NULL);
-
- /* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
- TEST_ERROR;
-
- if((dataset = H5Dopen2(file, REG_COMPRESSED_DSET, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
- if((dataspace = H5Dget_space(dataset)) < 0)
- TEST_ERROR;
-
- start[0] = start[1] = start[2] = 0;
- stride[0] = stride[1] = stride[2] = 1;
- count[0] = count[1] = count[2] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY; block[2] = CHUNK_NZ;
-
- for(i=0; i<NX; i++) {
- /*
- * Select hyperslab for one chunk in the file
- */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- TEST_ERROR;
- (start[0])++;
-
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace,
- H5P_DEFAULT, direct_buf[i])) < 0)
- TEST_ERROR;
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Sclose(dataspace);
- H5Sclose(mem_space);
- H5Pclose(dxpl);
- H5Fclose(file);
-
- /* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(dataspace);
- H5Sclose(mem_space);
- H5Pclose(dxpl);
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-}
-
-/*--------------------------------------------------
- * Benchmark the performance of the regular H5Dwrite
- * with compression
- *--------------------------------------------------
- */
-int
-test_no_compress_write(hid_t fapl_id)
-{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t mem_space;
- hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ};
- hid_t dxpl;
- herr_t status;
- int i;
-
- hsize_t start[RANK]; /* Start of hyperslab */
- hsize_t stride[RANK]; /* Stride of hyperslab */
- hsize_t count[RANK]; /* Block count */
- hsize_t block[RANK]; /* Block sizes */
-
- struct timeval timeval_start;
-
- TESTING("H5Dwrite without compression");
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- TEST_ERROR;
-
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- TEST_ERROR;
-
- /* Start the timer */
- gettimeofday(&timeval_start,NULL);
-
- /* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
- TEST_ERROR;
-
- if((dataset = H5Dopen2(file, REG_NO_COMPRESS_DSET, H5P_DEFAULT)) < 0)
- TEST_ERROR;
-
- if((dataspace = H5Dget_space(dataset)) < 0)
- TEST_ERROR;
-
- start[0] = start[1] = start[2] = 0;
- stride[0] = stride[1] = stride[2] = 1;
- count[0] = count[1] = count[2] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY; block[2] = CHUNK_NZ;
-
- for(i=0; i<NX; i++) {
- /*
- * Select hyperslab for one chunk in the file
- */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- TEST_ERROR;
- (start[0])++;
-
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace,
- H5P_DEFAULT, direct_buf[i])) < 0)
- TEST_ERROR;
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Sclose(dataspace);
- H5Sclose(mem_space);
- H5Pclose(dxpl);
- H5Fclose(file);
-
- /* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(dataspace);
- H5Sclose(mem_space);
- H5Pclose(dxpl);
- H5Fclose(file);
- } H5E_END_TRY;
- return 1;
-}
-
-/*--------------------------------------------------
- * Benchmark the performance for writing compressed
- * data to a Unix file
- *--------------------------------------------------
- */
-int
-test_unix_write(void)
-{
- int file, flag;
- ssize_t op_size;
- int i;
- struct timeval timeval_start;
-
- TESTING("Write compressed data to a Unix file");
-
- /* create file*/
- flag = O_WRONLY;
-
- /* Start the timer */
- gettimeofday(&timeval_start,NULL);
-
- if ((file=open(FILENAME[1],flag))== -1)
- TEST_ERROR;
-
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
- for(i=0; i<NX; i++) {
- op_size = write(file, outbuf[i],data_size[i]);
- if (op_size < 0)
- {
- printf(" Error in writing data to file because %s \n", strerror(errno));
- TEST_ERROR;
- }
- else if (op_size == 0)
- {
- printf(" unable to write sufficent data to file because %s \n", strerror(errno));
- TEST_ERROR;
- }
- }
-
- if (close(file) < 0)
- {
- printf(" unable to close the file\n");
- TEST_ERROR;
- }
-
- /* Report the performance */
- reportTime(timeval_start, (double)(total_size/MB));
-
- PASSED();
- return 0;
-
-error:
- return 1;
-}
-
-/*--------------------------------------------------
- * Main function
- *--------------------------------------------------
- */
-int
-main (void)
-{
- hid_t fapl = H5P_DEFAULT;
- int i;
-
- /* Testing setup */
-/* h5_reset();
- fapl = h5_fileaccess();
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);*/
-
- sprintf(filename, "%s.h5", FILENAME[0]);
-
- create_file(fapl);
- test_direct_write_uncompressed_data(fapl);
- test_direct_write_compressed_data(fapl);
- test_no_compress_write(fapl);
- test_compressed_write(fapl);
- test_unix_write();
-
- for(i=0; i<NX; i++) {
- free(outbuf[i]);
- free(direct_buf[i]);
- }
-
-/* h5_cleanup(FILENAME, fapl);*/
- return 0;
-}
-
-#else /* WIN32 / MINGW32 */
-
-int
-main(void)
-{
- printf("Non-POSIX platform. Exiting.\n");
- return EXIT_FAILURE;
-} /* end main() */
-
-#endif /* WIN32 / MINGW32 */
-
-#else /* !H5_HAVE_FILTER_DEFLATE */
-
-/*
- * Function: main
- * Purpose: Dummy main() function for if HDF5 was configured without
- * zlib stuff.
- * Return: EXIT_SUCCESS
- */
-int
-main(void)
-{
- HDfprintf(stdout, "No compression IO performance because zlib was not configured\n");
- return EXIT_SUCCESS;
-}
-
-#endif /* !H5_HAVE_FILTER_DEFLATE */
-
diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c
index f8f1d39..285ab77 100644
--- a/hl/test/gen_test_ds.c
+++ b/hl/test/gen_test_ds.c
@@ -79,12 +79,12 @@ int main(int argc , char **argv)
if (argc < 2) {
- printf("Usage: gen_test [le | be]\n");
+ HDprintf("Usage: gen_test [le | be]\n");
return 1;
}
if ( argv[1] && (strcmp("le",argv[1])!=0) && (strcmp("be",argv[1])!=0) ) {
- printf("Usage: gen_test [le | be]\n");
+ HDprintf("Usage: gen_test [le | be]\n");
return 1;
}
@@ -103,11 +103,11 @@ int main(int argc , char **argv)
nerrors += test_long_scalenames(filename) < 0 ? 1 : 0;
if(nerrors) goto error;
- printf("Dimension scales file generation passed.\n");
+ HDprintf("Dimension scales file generation passed.\n");
return 0;
error:
- printf("***** %d DIMENSION SCALES FILE GENERATION FAILED! *****\n",nerrors);
+ HDprintf("***** %d DIMENSION SCALES FILE GENERATION FAILED! *****\n",nerrors);
return 1;
}
@@ -188,11 +188,11 @@ herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int id
if(H5DSis_attached(did, dsid, idx) == 0) {
if(H5DSattach_scale(did, dsid, idx) >= 0) {
if(H5DSis_attached(did, dsid, idx) > 0) {
- /* printf(" scale attached "); */
+ /* HDprintf(" scale attached "); */
ret_value = SUCCEED;
}
else if(H5DSis_attached(did, dsid, idx) == 0) {
- printf(" scale not attached ");
+ HDprintf(" scale not attached ");
}
}
}
@@ -281,7 +281,7 @@ static int test_long_attachscales(const char *filename)
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al");
- TESTING2("test_long_attachscales");
+ HL_TESTING2("test_long_attachscales");
if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
@@ -342,7 +342,7 @@ static int test_duplicatelong_attachscales(const char *filename)
strcpy(dsname, DATASET_NAME);
strcat(dsname, "al2");
- TESTING2("test_duplicatelong_attachscales");
+ HL_TESTING2("test_duplicatelong_attachscales");
if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
@@ -406,7 +406,7 @@ static int test_long_scalenames(const char *filename) {
if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
- TESTING2("set long scale/cmp scale name");
+ HL_TESTING2("set long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
strcat(scalename, "al");
@@ -483,7 +483,7 @@ static int test_samelong_scalenames(const char *filename) {
if((fid = open_test_file(filename)) < 0)
goto out;
- TESTING2("set same long scale/cmp scale name");
+ HL_TESTING2("set same long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
strcpy(scalename, DS_1_NAME);
strcat(scalename, "al");
@@ -554,7 +554,7 @@ static int test_foreign_scaleattached(const char *filename)
hid_t did = -1;
hid_t dsid = -1;
- TESTING2("test_foreign_scaleattached");
+ HL_TESTING2("test_foreign_scaleattached");
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto out;
diff --git a/hl/test/gen_test_ld.c b/hl/test/gen_test_ld.c
index d717a47..981aded 100644
--- a/hl/test/gen_test_ld.c
+++ b/hl/test/gen_test_ld.c
@@ -13,23 +13,23 @@
#include "H5LDprivate.h"
/*
- * WATCH.h5: file with various types of datasets for testing--
+ * WATCH.h5: file with various types of datasets for testing--
*
- * The following datasets are chunked, H5D_ALLOC_TIME_INCR, max. dimensional setting:
- * DSET_ONE: one-dimensional dataset
- * DSET_TWO: two-dimensional dataset
- * DSET_CMPD: one-dimensional dataset with compound type
+ * The following datasets are chunked, H5D_ALLOC_TIME_INCR, max. dimensional setting:
+ * DSET_ONE: one-dimensional dataset
+ * DSET_TWO: two-dimensional dataset
+ * DSET_CMPD: one-dimensional dataset with compound type
* DSET_CMPD_ESC: one-dimensional dataset with compound type and member names with
- * escape/separator characters
- * DSET_CMPD_TWO: two-dimensional dataset with compound type
- *
- * The following datasets are one-dimensional, chunked, max. dimension setting:
- * DSET_ALLOC_EARLY: dataset with H5D_ALLOC_TIME_EARLY
- * DSET_ALLOC_LATE: dataset H5D_ALLOC_TIME_LATE
- *
- * The following datasets are one-dimensional:
- * DSET_NONE: fixed dimension setting, contiguous, H5D_ALLOC_TIME_LATE
- * DSET_NOMAX: fixed dimension setting, chunked, H5D_ALLOC_TIME_INCR
+ * escape/separator characters
+ * DSET_CMPD_TWO: two-dimensional dataset with compound type
+ *
+ * The following datasets are one-dimensional, chunked, max. dimension setting:
+ * DSET_ALLOC_EARLY: dataset with H5D_ALLOC_TIME_EARLY
+ * DSET_ALLOC_LATE: dataset H5D_ALLOC_TIME_LATE
+ *
+ * The following datasets are one-dimensional:
+ * DSET_NONE: fixed dimension setting, contiguous, H5D_ALLOC_TIME_LATE
+ * DSET_NOMAX: fixed dimension setting, chunked, H5D_ALLOC_TIME_INCR
*/
#define ONE_DIMS0 10
#define MAX_ONE_DIMS0 100
diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h
index f368b8e..85f47bd 100644
--- a/hl/test/h5hltest.h
+++ b/hl/test/h5hltest.h
@@ -28,8 +28,8 @@
#include "H5HLprivate2.h"
/* Macros used in HL tests */
-#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);}
-#define TESTING3(WHAT) {printf("%-70s", "" WHAT); fflush(stdout);}
+#define HL_TESTING2(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);}
+#define HL_TESTING3(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);}
/* Implements verbose 'assert' with 'goto error' exit */
#define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0)
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 91f1505..79e6f45 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -186,11 +186,11 @@ int main(void)
if(nerrors) goto error;
- printf("All dimension scales tests passed.\n");
+ HDprintf("All dimension scales tests passed.\n");
return 0;
error:
- printf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
return 1;
}
@@ -1049,7 +1049,7 @@ herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int id
ret_value = SUCCEED;
}
else if(H5DSis_attached(did, dsid, idx) == 0) {
- printf(" scale not attached ");
+ HDprintf(" scale not attached ");
}
}
}
@@ -1110,7 +1110,7 @@ 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*)HDmalloc(((size_t)name_len+1) * sizeof (char));
+ name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char));
if(name_out != NULL) {
if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) {
if(HDstrncmp(scalename, name_out, (size_t)name_len)==0) {
@@ -1138,7 +1138,7 @@ static int test_detachscales(void)
int rank3 = 3;
hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/
int *buf = NULL;
- char dname[10];
+ char dname[16];
int i;
/* This tests creates two three dimensional datasets; then it creates
@@ -1146,29 +1146,29 @@ static int test_detachscales(void)
and detach them to check that at the end there is no attributes
REFERENCE_LIST on a dimension scale and DIMENSION_LIST on a dataset */
- TESTING2("test_detachscales");
+ HL_TESTING2("test_detachscales");
if((fid = H5Fcreate("test_detach.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* make datasets; they are three dimensional*/
for (i=0; i < 2; i++) {
- sprintf(dname,"D%d", i);
+ HDsprintf(dname,"D%d", i);
if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0)
goto out;
- }
+ }
/* create datasets and make them dim. scales */
for (i=0; i < 4; i++) {
- sprintf(dname, "DS%d", i);
+ HDsprintf(dname, "DS%d", i);
if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0)
goto out;
}
- /* attach scales to the first dataset; first dimension will have
+ /* attach scales to the first dataset; first dimension will have
two scales attached */
if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
for (i=0; i<4; i++) {
- sprintf(dname, "DS%d", i);
+ HDsprintf(dname, "DS%d", i);
if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0)
@@ -1185,7 +1185,7 @@ static int test_detachscales(void)
/* attach scales to the second dataset */
if((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) {
for (i=0; i<3; i++) {
- sprintf(dname, "DS%d", i);
+ HDsprintf(dname, "DS%d", i);
if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0)
@@ -1206,20 +1206,20 @@ static int test_detachscales(void)
goto out;
for (i=0; i<2; i++) {
- sprintf(dname, "D%d", i);
+ HDsprintf(dname, "D%d", i);
if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSdetach_scale(did, dsid, (unsigned int)0) < 0)
goto out;
if(H5Dclose(did) < 0)
goto out;
- }
+ }
/* Check that attribute "REFERENCE_LIST" doesn't exist anymore */
if(H5Aexists(dsid, REFERENCE_LIST)!= 0)
goto out;
if(H5Dclose(dsid) < 0)
goto out;
- /* Check that DS3 is the only dim. scale attached to the first
+ /* Check that DS3 is the only dim. scale attached to the first
dimension of D0 */
if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0)
goto out;
@@ -1232,11 +1232,11 @@ static int test_detachscales(void)
if(H5Dclose(dsid) < 0)
goto out;
- /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make
+ /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make
sure that attribute "DIMENSION_LIST" doesn't exist anymore */
if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
for (i=1; i<4; i++) {
- sprintf(dname, "DS%d", i);
+ HDsprintf(dname, "DS%d", i);
if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0)
@@ -1253,7 +1253,7 @@ static int test_detachscales(void)
else
goto out;
-
+
PASSED();
H5Fclose(fid);
@@ -1280,7 +1280,7 @@ static int test_char_attachscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "ac");
- TESTING2("test_char_attachscales");
+ HL_TESTING2("test_char_attachscales");
if((fid = open_test_file(fileext)) < 0)
goto out;
@@ -1333,7 +1333,7 @@ static int test_short_attachscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "as");
- TESTING2("test_short_attachscales");
+ HL_TESTING2("test_short_attachscales");
if((fid = open_test_file(fileext)) < 0)
goto out;
@@ -1410,7 +1410,7 @@ static int test_int_attachscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a");
- TESTING2("test_int_attachscales");
+ HL_TESTING2("test_int_attachscales");
if((fid = open_test_file(fileext)) < 0)
goto out;
@@ -1471,7 +1471,7 @@ static int test_long_attachscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al");
- TESTING2("test_long_attachscales");
+ HL_TESTING2("test_long_attachscales");
if((fid = open_test_file(fileext)) < 0)
goto out;
@@ -1528,7 +1528,7 @@ static int test_duplicatelong_attachscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al2");
- TESTING2("test_duplicatelong_attachscales");
+ HL_TESTING2("test_duplicatelong_attachscales");
if((fid = open_test_file(fileext)) < 0)
goto out;
@@ -1585,7 +1585,7 @@ static int test_float_attachscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "af");
- TESTING2("test_float_attachscales");
+ HL_TESTING2("test_float_attachscales");
if((fid = open_test_file(fileext)) < 0)
goto out;
@@ -1647,7 +1647,7 @@ static int test_numberofscales(const char *fileext)
HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a");
- TESTING2("test_numberofscales");
+ HL_TESTING2("test_numberofscales");
if((fid = open_test_file(fileext)) < 0)
goto out;
@@ -1729,7 +1729,7 @@ static int test_char_scalenames(const char *fileext) {
if((fid = open_test_file(fileext)) < 0)
goto out;
- TESTING2("set char scale/cmp scale name");
+ HL_TESTING2("set char scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "ac");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "ac");
@@ -1789,7 +1789,7 @@ static int test_short_scalenames(const char *fileext) {
if((fid = open_test_file(fileext)) < 0)
goto out;
- TESTING2("set short scale/cmp scale name");
+ HL_TESTING2("set short scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "as");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "as");
@@ -1897,7 +1897,7 @@ static int test_int_scalenames(const char *fileext) {
if((fid = open_test_file(fileext)) < 0)
goto out;
- TESTING2("set int scale/cmp scale name");
+ HL_TESTING2("set int scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "a");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "a");
@@ -1973,7 +1973,7 @@ static int test_long_scalenames(const char *fileext) {
if((fid = open_test_file(fileext)) < 0)
goto out;
- TESTING2("set long scale/cmp scale name");
+ HL_TESTING2("set long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "al");
@@ -2041,7 +2041,7 @@ static int test_samelong_scalenames(const char *fileext) {
if((fid = open_test_file(fileext)) < 0)
goto out;
- TESTING2("set same long scale/cmp scale name");
+ HL_TESTING2("set same long scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al");
HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, "al");
@@ -2109,7 +2109,7 @@ static int test_float_scalenames(const char *fileext) {
if((fid = open_test_file(fileext)) < 0)
goto out;
- TESTING2("set float scale/cmp scale name");
+ HL_TESTING2("set float scale/cmp scale name");
if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "af");
HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "af");
@@ -2181,7 +2181,7 @@ static int test_foreign_scaleattached(const char *fileforeign)
hid_t dsid = -1;
const char *filename = H5_get_srcdir_filename(fileforeign);
- TESTING2("test_foreign_scaleattached");
+ HL_TESTING2("test_foreign_scaleattached");
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto out;
@@ -2255,7 +2255,7 @@ static int test_simple(void)
char snames[3];
int i, j;
- printf("Testing API functions\n");
+ HDprintf("Testing API functions\n");
/*-------------------------------------------------------------------------
* create a file for the test
@@ -2426,7 +2426,7 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- TESTING2("detach scales ");
+ HL_TESTING2("detach scales ");
/*-------------------------------------------------------------------------
@@ -2873,10 +2873,10 @@ static int test_simple(void)
if((sid = H5Screate_simple(rank,dims,NULL)) < 0)
goto out;
for(i = 0; i < 5; i++) {
- sprintf(dname,"dset_%d",i);
+ HDsprintf(dname,"dset_%d",i);
if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- sprintf(sname,"ds_%d",i);
+ HDsprintf(sname,"ds_%d",i);
if((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5DSset_scale(dsid,"scale") < 0)
@@ -2893,11 +2893,11 @@ static int test_simple(void)
*/
for(i = 0; i < 5; i++) {
- sprintf(dname, "dset_%d", i);
+ HDsprintf(dname, "dset_%d", i);
if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
goto out;
for(j = 0; j < 5; j++) {
- sprintf(sname, "ds_%d", j);
+ HDsprintf(sname, "ds_%d", j);
if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did, dsid, DIM0) < 0)
@@ -2915,11 +2915,11 @@ static int test_simple(void)
*/
for(i = 0; i < 5; i++) {
- sprintf(dname, "dset_%d", i);
+ HDsprintf(dname, "dset_%d", i);
if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
goto out;
for(j = 0; j < 5; j++) {
- sprintf(sname, "ds_%d", j);
+ HDsprintf(sname, "ds_%d", j);
if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSdetach_scale(did, dsid, DIM0) < 0)
@@ -2938,11 +2938,11 @@ static int test_simple(void)
*/
for(i=0; i<5; i++) {
- sprintf(dname,"dset_%d",i);
+ HDsprintf(dname,"dset_%d",i);
if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0)
goto out;
for(j=0; j<5; j++) {
- sprintf(sname,"ds_%d",j);
+ HDsprintf(sname,"ds_%d",j);
if((dsid = H5Dopen2(gid,sname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did,dsid,DIM0) < 0)
@@ -3013,7 +3013,7 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- TESTING2("set/get label");
+ HL_TESTING2("set/get label");
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
@@ -3080,7 +3080,7 @@ static int test_simple(void)
/*-------------------------------------------------------------------------
- * get the label using a static buffer smaller than the string lenght
+ * get the label using a static buffer smaller than the string length
*-------------------------------------------------------------------------
*/
@@ -3103,7 +3103,7 @@ static int test_simple(void)
*/
- TESTING2("set scale/get scale name");
+ HL_TESTING2("set scale/get scale name");
if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0)
goto out;
if(H5DSset_scale(dsid,"Latitude set 0") < 0)
@@ -3118,7 +3118,7 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- /* get the lenght of the scale name (pass NULL in name) */
+ /* get the length of the scale name (pass NULL in name) */
if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) < 0)
goto out;
@@ -3151,7 +3151,7 @@ static int test_simple(void)
goto out;
/*-------------------------------------------------------------------------
- * get the scale name using a static buffer smaller than the string lenght
+ * get the scale name using a static buffer smaller than the string length
*-------------------------------------------------------------------------
*/
@@ -3205,7 +3205,7 @@ static int test_simple(void)
*/
- TESTING2("iterate scales");
+ HL_TESTING2("iterate scales");
/*-------------------------------------------------------------------------
@@ -3541,7 +3541,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor
for(i=0; i<nelmts; i++) {
if(buf[i] != data[i]) {
- printf("read and write buffers differ\n");
+ HDprintf("read and write buffers differ\n");
goto out;
}
}
@@ -3740,7 +3740,7 @@ static int test_errors(void)
hid_t sidds = -1; /* space ID */
hsize_t pal_dims[] = {9,3};
- printf("Testing error conditions\n");
+ HDprintf("Testing error conditions\n");
/*-------------------------------------------------------------------------
* create a file, spaces, dataset and group ids
@@ -3771,7 +3771,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attach a dataset to itself");
+ HL_TESTING2("attach a dataset to itself");
if(H5DSattach_scale(did, did, 0) == SUCCEED)
goto out;
@@ -3782,7 +3782,7 @@ static int test_errors(void)
* attempt to attach a group with a dataset, it should fail
*-------------------------------------------------------------------------
*/
- TESTING2("attach a group with a dataset");
+ HL_TESTING2("attach a group with a dataset");
if(H5DSattach_scale(gid,dsid,0)==SUCCEED)
goto out;
@@ -3793,7 +3793,7 @@ static int test_errors(void)
* attempt to attach a dataset with a group, it should fail
*-------------------------------------------------------------------------
*/
- TESTING2("attach a dataset with a group");
+ HL_TESTING2("attach a dataset with a group");
if(H5DSattach_scale(did,gid,0)==SUCCEED)
goto out;
@@ -3804,7 +3804,7 @@ static int test_errors(void)
* attempt to set scale for a group, it should fail
*-------------------------------------------------------------------------
*/
- TESTING2("set scale for a group");
+ HL_TESTING2("set scale for a group");
if(H5DSset_scale(gid,"scale 1")==SUCCEED)
goto out;
@@ -3834,7 +3834,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attach a scale that has scales");
+ HL_TESTING2("attach a scale that has scales");
/* create the data space for the scale */
if((sidds = H5Screate_simple(rankds, s1_dim, NULL)) < 0)
@@ -3903,7 +3903,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attach to a dataset that is a scale");
+ HL_TESTING2("attach to a dataset that is a scale");
/* open the previous written "ds_b", that is a scale */
if((dsid = H5Dopen2(fid,"ds_b", H5P_DEFAULT)) < 0)
@@ -3930,7 +3930,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attach to a dataset that is a reserved class dataset");
+ HL_TESTING2("attach to a dataset that is a reserved class dataset");
/* make an image */
if(H5IMmake_image_8bit(fid,"image",(hsize_t)100,(hsize_t)50,NULL) < 0)
@@ -3965,7 +3965,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("is scale");
+ HL_TESTING2("is scale");
/* open a non scale dataset */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
@@ -3999,7 +3999,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("detach scale from dataset it is not attached to");
+ HL_TESTING2("detach scale from dataset it is not attached to");
/* open the previous written "ds_a" */
if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0)
@@ -4027,7 +4027,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("detach scale from group");
+ HL_TESTING2("detach scale from group");
/* open the previous written "ds_a" */
if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0)
@@ -4055,7 +4055,7 @@ static int test_errors(void)
*-------------------------------------------------------------------------
*/
- TESTING2("detach scale when scale is group");
+ HL_TESTING2("detach scale when scale is group");
/* open the previous written "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
@@ -4119,7 +4119,7 @@ static int test_iterators(void)
char dname[30]; /* dataset name */
int i;
- printf("Testing iterators\n");
+ HDprintf("Testing iterators\n");
/*-------------------------------------------------------------------------
* create a file, spaces, dataset and group ids
@@ -4147,7 +4147,7 @@ static int test_iterators(void)
*-------------------------------------------------------------------------
*/
- TESTING2("iterate when the dataset has no scales ");
+ HL_TESTING2("iterate when the dataset has no scales ");
/* get the dataset id for "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
@@ -4169,7 +4169,7 @@ static int test_iterators(void)
*-------------------------------------------------------------------------
*/
- TESTING2("iterate on dimension that is outside the rank ");
+ HL_TESTING2("iterate on dimension that is outside the rank ");
/* get the dataset id for "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
@@ -4190,7 +4190,7 @@ static int test_iterators(void)
*-------------------------------------------------------------------------
*/
- TESTING2("iterate for dimension with many scales ");
+ HL_TESTING2("iterate for dimension with many scales ");
/* open the previously written "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
@@ -4198,7 +4198,7 @@ static int test_iterators(void)
for(i=0; i<100; i++) {
/* make a DS */
- sprintf(dname,"ds_%d",i);
+ HDsprintf(dname,"ds_%d",i);
if(H5LTmake_dataset_int(fid,dname,rankds,s1_dim,NULL) < 0)
goto out;
/* open */
@@ -4227,7 +4227,7 @@ static int test_iterators(void)
*-------------------------------------------------------------------------
*/
- TESTING2("iterate on group ");
+ HL_TESTING2("iterate on group ");
/* open */
if((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0)
@@ -4249,7 +4249,7 @@ static int test_iterators(void)
*-------------------------------------------------------------------------
*/
- TESTING2("iterate in deleted scales ");
+ HL_TESTING2("iterate in deleted scales ");
if(H5Ldelete(fid, "ds_0", H5P_DEFAULT) < 0)
goto out;
@@ -4311,7 +4311,7 @@ static int test_rank(void)
float buff[1]={1};
int i;
- printf("Testing ranks\n");
+ HDprintf("Testing ranks\n");
/*-------------------------------------------------------------------------
* create a file, a dataset, scales
@@ -4343,13 +4343,13 @@ static int test_rank(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attach");
+ HL_TESTING2("attach");
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
for(i=0; i<3; i++) {
- sprintf(name,"ds_a_%d",i);
+ HDsprintf(name,"ds_a_%d",i);
if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did,dsid,(unsigned)i) < 0)
@@ -4371,13 +4371,13 @@ static int test_rank(void)
*-------------------------------------------------------------------------
*/
- TESTING2("detach");
+ HL_TESTING2("detach");
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
for(i=0; i<3; i++) {
- sprintf(name,"ds_a_%d",i);
+ HDsprintf(name,"ds_a_%d",i);
if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0)
goto out;
if(H5DSdetach_scale(did,dsid,(unsigned)i) < 0)
@@ -4397,13 +4397,13 @@ static int test_rank(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attach, set, get names, labels");
+ HL_TESTING2("attach, set, get names, labels");
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
goto out;
for(i=0; i<3; i++) {
- sprintf(name,"ds_a_%d",i);
+ HDsprintf(name,"ds_a_%d",i);
if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0)
goto out;
if(H5DSset_scale(dsid,name) < 0)
@@ -4436,7 +4436,7 @@ static int test_rank(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attach a scalar scale");
+ HL_TESTING2("attach a scalar scale");
/* create the data space for the dataset */
if((sid = H5Screate_simple(2, dimss, NULL)) < 0)
@@ -4517,7 +4517,7 @@ static int test_types(void)
const char *s1_str = "ABC";
const char *s2_str = "ABCD";
- printf("Testing scales with several datatypes\n");
+ HDprintf("Testing scales with several datatypes\n");
/*-------------------------------------------------------------------------
* create a file for the test
@@ -4549,7 +4549,7 @@ static int test_types(void)
*-------------------------------------------------------------------------
*/
- TESTING2("floating point and short scales");
+ HL_TESTING2("floating point and short scales");
/* get the dataset id for "dset_a" */
if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0)
@@ -4612,7 +4612,7 @@ static int test_types(void)
*-------------------------------------------------------------------------
*/
- TESTING2("string scales");
+ HL_TESTING2("string scales");
/* get the dataset id for "dset_b" */
if((did = H5Dopen2(fid,"dset_b", H5P_DEFAULT)) < 0)
@@ -4694,7 +4694,7 @@ static int test_data(void)
float fill=-99; /* fill value */
- printf("Testing reading ASCII data and generate HDF5 data with scales\n");
+ HDprintf("Testing reading ASCII data and generate HDF5 data with scales\n");
/*-------------------------------------------------------------------------
* create a file for the test
@@ -4709,7 +4709,7 @@ static int test_data(void)
*-------------------------------------------------------------------------
*/
- TESTING2("generating scales");
+ HL_TESTING2("generating scales");
/*-------------------------------------------------------------------------
* create datasets: 1 "data" dataset and 2 dimension scales
@@ -4870,18 +4870,18 @@ static int read_data( const char* fname,
/* read first data file */
f = HDfopen(data_file, "r");
if( f == NULL ) {
- printf( "Could not open file %s\n", data_file );
+ HDprintf( "Could not open file %s\n", data_file );
return -1;
}
for(i=0, nelms=1; i < ndims; i++) {
if(fscanf( f, "%s %u", str, &j) && HDferror(f)) {
- printf( "fscanf error in file %s\n", data_file );
+ HDprintf( "fscanf error in file %s\n", data_file );
HDfclose(f);
return -1;
} /* end if */
if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s\n", data_file );
+ HDprintf( "fscanf error in file %s\n", data_file );
HDfclose(f);
return -1;
} /* end if */
@@ -4892,14 +4892,14 @@ static int read_data( const char* fname,
*buf = (float*) HDmalloc (nelms * sizeof( float ));
if ( *buf == NULL ) {
- printf( "memory allocation failed\n" );
+ HDprintf( "memory allocation failed\n" );
HDfclose(f);
return -1;
}
for(j = 0; j < nelms; j++) {
if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s\n", data_file );
+ HDprintf( "fscanf error in file %s\n", data_file );
HDfclose(f);
return -1;
} /* end if */
@@ -4925,12 +4925,12 @@ static int test_errors2(void)
hsize_t dimd[2] = {3,3}; /* size of data dataset */
hsize_t dims[1] = {3}; /* size of scale dataset */
char lbuf[255]; /* label buffer */
- ssize_t label_len; /* label lenght */
+ ssize_t label_len; /* label length */
int scale_idx; /* scale index */
int nscales; /* number of scales in DIM */
int count; /* visitor data */
- printf("Testing parameter errors\n");
+ HDprintf("Testing parameter errors\n");
/*-------------------------------------------------------------------------
* create a file, a dataset, scales
@@ -4954,7 +4954,7 @@ static int test_errors2(void)
goto out;
- TESTING2("attach scales");
+ HL_TESTING2("attach scales");
/*-------------------------------------------------------------------------
@@ -4977,7 +4977,7 @@ static int test_errors2(void)
PASSED();
- TESTING2("detach scales");
+ HL_TESTING2("detach scales");
/*-------------------------------------------------------------------------
* detach with invalid indices
@@ -4998,7 +4998,7 @@ static int test_errors2(void)
PASSED();
- TESTING2("set/get label");
+ HL_TESTING2("set/get label");
/*-------------------------------------------------------------------------
* set/get label invalid indices
@@ -5014,7 +5014,7 @@ static int test_errors2(void)
goto out;
if ((label_len=H5DSget_label(did,0,NULL,0)) < 0)
goto out;
- if ( label_len != strlen("label") )
+ if ( label_len != HDstrlen("label") )
goto out;
if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0)
goto out;
@@ -5023,7 +5023,7 @@ static int test_errors2(void)
PASSED();
- TESTING2("iterate scales");
+ HL_TESTING2("iterate scales");
/*-------------------------------------------------------------------------
@@ -5122,7 +5122,7 @@ static int test_attach_detach(void)
hid_t var1_id, var2_id, var3_id; /* DS component name */
hsize_t dims[RANK1] = {DIM1};
- TESTING2("permutations of attaching and detaching");
+ HL_TESTING2("permutations of attaching and detaching");
if((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -5134,83 +5134,83 @@ static int test_attach_detach(void)
if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
-
- if((sid = H5Screate_simple(1, dims, dims)) < 0)
+
+ 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)
+ if(H5Sclose(sid) < 0)
goto out;
- if(H5Pclose(dcpl_id) < 0)
+ if(H5Pclose(dcpl_id) < 0)
goto out;
- if(H5DSset_scale(dsid, DS_3_NAME) < 0)
+ 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)
+ 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)
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if(H5Sclose(sid) < 0)
goto out;
- if(H5DSattach_scale(var1_id, dsid, 0) < 0)
+ 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)
+ 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)
+ 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)
+ 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)
+ H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
goto out;
- if(H5Pclose(dcpl_id) < 0)
+ if(H5Pclose(dcpl_id) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if(H5Sclose(sid) < 0)
goto out;
/* Create 3rd variable that uses this dimension scale. */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ 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)
+ 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)
+ 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)
+ H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
goto out;
- if(H5Pclose(dcpl_id) < 0)
+ if(H5Pclose(dcpl_id) < 0)
goto out;
- if(H5Sclose(sid) < 0)
+ if(H5Sclose(sid) < 0)
goto out;
-
+
/* Attached var2 scale */
- if(H5DSattach_scale(var2_id, dsid, 0) < 0)
+ if(H5DSattach_scale(var2_id, dsid, 0) < 0)
goto out;
/* Detach the var2 scale */
- if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
+ if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
goto out;
/* Check if in correct state of detached and attached */
@@ -5220,7 +5220,7 @@ static int test_attach_detach(void)
goto out;
/* Detach the var1 scale */
- if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
+ if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
goto out;
/* Check if in correct state of detached and attached */
@@ -5231,10 +5231,10 @@ static int test_attach_detach(void)
/* Attach the DS again and remove them in the opposite order */
- if(H5DSattach_scale(var1_id, dsid, 0) < 0)
+ if(H5DSattach_scale(var1_id, dsid, 0) < 0)
goto out;
- if(H5DSattach_scale(var2_id, dsid, 0) < 0)
+ if(H5DSattach_scale(var2_id, dsid, 0) < 0)
goto out;
/* Detach the var1 scale */
@@ -5262,13 +5262,13 @@ static int test_attach_detach(void)
* Attach Three DS and remove the middle one first
*****************************************************/
- if(H5DSattach_scale(var1_id, dsid, 0) < 0)
+ if(H5DSattach_scale(var1_id, dsid, 0) < 0)
goto out;
- if(H5DSattach_scale(var2_id, dsid, 0) < 0)
+ if(H5DSattach_scale(var2_id, dsid, 0) < 0)
goto out;
- if(H5DSattach_scale(var3_id, dsid, 0) < 0)
+ if(H5DSattach_scale(var3_id, dsid, 0) < 0)
goto out;
@@ -5314,15 +5314,15 @@ static int test_attach_detach(void)
*-------------------------------------------------------------------------
*/
- if(H5Dclose(var1_id) < 0)
+ if(H5Dclose(var1_id) < 0)
goto out;
- if(H5Dclose(var2_id) < 0)
+ if(H5Dclose(var2_id) < 0)
goto out;
- if(H5Dclose(var3_id) < 0)
+ if(H5Dclose(var3_id) < 0)
goto out;
- if(H5Dclose(dsid) < 0)
+ if(H5Dclose(dsid) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if(H5Gclose(gid) < 0)
goto out;
if(H5Fclose(fid) < 0)
goto out;
diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c
index d890481..1914a08 100644
--- a/hl/test/test_dset_append.c
+++ b/hl/test/test_dset_append.c
@@ -11,38 +11,39 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <math.h>
#include <stdlib.h>
#include <string.h>
+
#include "h5hltest.h"
#include "H5DOpublic.h"
-#include <math.h>
-#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
+#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
# define H5_ZLIB_HEADER "zlib.h"
#endif
#if defined(H5_ZLIB_HEADER)
-# include H5_ZLIB_HEADER /* "zlib.h" */
+#include H5_ZLIB_HEADER /* "zlib.h" */
#endif
-#define FILE "test_append.h5"
-#define DNAME_NOTSET "dataset_notset"
-#define DNAME_UNLIM "dataset_unlim"
-#define DNAME_LESS "dataset_less"
-#define DNAME_VARY "dataset_vary"
-#define DNAME_ROW "dataset_row"
-#define DNAME_COLUMN "dataset_column"
-#define DBUGNAME1 "dataset_bug1"
-#define DBUGNAME2 "dataset_bug2"
+#define FILENAME "test_append.h5"
+#define DNAME_NOTSET "dataset_notset"
+#define DNAME_UNLIM "dataset_unlim"
+#define DNAME_LESS "dataset_less"
+#define DNAME_VARY "dataset_vary"
+#define DNAME_ROW "dataset_row"
+#define DNAME_COLUMN "dataset_column"
+#define DBUGNAME1 "dataset_bug1"
+#define DBUGNAME2 "dataset_bug2"
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_notset
+ * Function: test_dataset_append_notset
*
- * Purpose: Verify that H5DOappend works properly with default dapl.
- * That is, H5Pset_append_flush() is not used to set boundary
- * and callback in dapl.
+ * Purpose: Verify that H5DOappend works properly with default dapl.
+ * That is, H5Pset_append_flush() is not used to set boundary
+ * and callback in dapl.
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Aug 2016
*
@@ -51,68 +52,68 @@
static int
test_dataset_append_notset(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t ffapl = -1; /* The file's file access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t ffapl = -1; /* The file's file access property list */
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10]; /* The data buffers */
- int i, j; /* Local index variables */
- h5_stat_t sb1, sb2; /* File info */
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[10]; /* The data buffers */
+ int i, j; /* Local index variables */
+ h5_stat_t sb1, sb2; /* File info */
- TESTING("Append flush with H5DOappend()--append rows with default dapl");
+ HL_TESTING2("Append flush with H5DOappend()--append rows with default dapl");
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
/* Append 6 rows to the dataset */
for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
- lbuf[j] = (i * 10) + (j + 1);
- /* Append without boundary, callback and flush */
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
- FAIL_STACK_ERROR;
+ for(j = 0; j < 10; j++)
+ lbuf[j] = (i * 10) + (j + 1);
+ /* Append without boundary, callback and flush */
+ if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ FAIL_STACK_ERROR;
} /* end for */
/* File size when not flushed */
- if(HDstat(FILE, &sb1) < 0)
- TEST_ERROR;
+ if(HDstat(FILENAME, &sb1) < 0)
+ TEST_ERROR;
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* File size after flushing */
- if(HDstat(FILE, &sb2) < 0)
- TEST_ERROR;
+ if(HDstat(FILENAME, &sb2) < 0)
+ TEST_ERROR;
/* File size before flushing should be less */
- if(sb1.st_size > sb2.st_size)
- TEST_ERROR;
+ if(sb1.st_size > sb2.st_size)
+ TEST_ERROR;
/* Closing */
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -120,10 +121,10 @@ test_dataset_append_notset(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dcpl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
@@ -148,14 +149,14 @@ append_func(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void
}
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_rows_columns
+ * Function: test_dataset_append_rows_columns
*
- * Purpose: Verify that the object flush property and the append flush property
- * are working properly when appending rows and columns to a dataset
- * with 2 extendible dimensions.
+ * Purpose: Verify that the object flush property and the append flush property
+ * are working properly when appending rows and columns to a dataset
+ * with 2 extendible dimensions.
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -164,91 +165,91 @@ append_func(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void
static int
test_dataset_append_rows_columns(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10], cbuf[6]; /* The data buffers */
- int buf[6][13], rbuf[6][13]; /* The data buffers */
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[10], cbuf[6]; /* The data buffers */
+ int buf[6][13], rbuf[6][13]; /* The data buffers */
- hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
- int i, j; /* Local index variables */
+ int i, j; /* Local index variables */
- TESTING("Append flush with H5DOappend()--append rows & columns");
+ HL_TESTING2("Append flush with H5DOappend()--append rows & columns");
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR;
+ if((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR;
/* Append 6 rows to the dataset */
for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
- lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 10; j++)
+ lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
+ if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 6)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 6)
- TEST_ERROR;
+ TEST_ERROR;
/* Append 3 columns to the dataset */
for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
- cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 6; j++)
+ cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
+ if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 9)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 9)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
+ FAIL_STACK_ERROR;
+
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
@@ -257,33 +258,33 @@ test_dataset_append_rows_columns(hid_t fid)
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the dataset again */
if((did = H5Dopen2(fid, DNAME_UNLIM, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -291,25 +292,25 @@ test_dataset_append_rows_columns(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dapl);
- H5Pclose(dcpl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dapl);
+ H5Pclose(dcpl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
} /* test_dataset_append_rows_columns() */
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_rows
+ * Function: test_dataset_append_rows
*
- * Purpose: Verify that the object flush property and the append flush property
- * are working properly when appending rows to a dataset with
- * one extendible dimension (row).
+ * Purpose: Verify that the object flush property and the append flush property
+ * are working properly when appending rows to a dataset with
+ * one extendible dimension (row).
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -318,71 +319,71 @@ error:
static int
test_dataset_append_rows(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10]; /* The data buffer */
- int buf[6][10], rbuf[6][10]; /* The data buffers */
- int i, j; /* Local index variables */
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[10]; /* The data buffer */
+ int buf[6][10], rbuf[6][10]; /* The data buffers */
+ int i, j; /* Local index variables */
- hsize_t boundary[2] = {1, 0}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hsize_t boundary[2] = {1, 0}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
- TESTING("Append flush with H5DOappend()--append rows");
+ HL_TESTING2("Append flush with H5DOappend()--append rows");
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR;
+ if((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR;
/* Append 6 rows to the dataset */
for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
- lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 10; j++)
+ lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
+ if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 6)
- TEST_ERROR;
+ TEST_ERROR;
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 6)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
+ FAIL_STACK_ERROR;
+
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 10; j++)
+ for(j = 0; j < 10; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
@@ -391,33 +392,33 @@ test_dataset_append_rows(hid_t fid)
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the dataset again */
if((did = H5Dopen2(fid, DNAME_ROW, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 10; j++)
+ for(j = 0; j < 10; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -425,25 +426,25 @@ test_dataset_append_rows(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dapl);
- H5Pclose(dcpl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dapl);
+ H5Pclose(dcpl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
} /* test_dataset_append_rows() */
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_columns
+ * Function: test_dataset_append_columns
*
- * Purpose: Verify that the object flush property and the append flush property
- * are working properly when appending columns to a dataset
- * with one extendible dimension (column).
+ * Purpose: Verify that the object flush property and the append flush property
+ * are working properly when appending columns to a dataset
+ * with one extendible dimension (column).
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -452,72 +453,72 @@ error:
static int
test_dataset_append_columns(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
- hsize_t dims[2] = {6, 0}; /* Current dimension sizes */
- hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int cbuf[6]; /* The data buffer */
- int buf[6][3], rbuf[6][3]; /* The data buffers */
- int i, j; /* Local index variable */
+ hsize_t dims[2] = {6, 0}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int cbuf[6]; /* The data buffer */
+ int buf[6][3], rbuf[6][3]; /* The data buffers */
+ int i, j; /* Local index variable */
- hsize_t boundary[2] = {0, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hsize_t boundary[2] = {0, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
- TESTING("Append flush with H5DOappend()--append columns");
+ HL_TESTING2("Append flush with H5DOappend()--append columns");
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR;
+ if((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR;
/* Append 3 columns to the dataset */
for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
- cbuf[j] = buf[j][i] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 6; j++)
+ cbuf[j] = buf[j][i] = ((i * 6) + (j + 1)) * -1;
+ if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 3)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 3)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
+ FAIL_STACK_ERROR;
+
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 3; j++)
+ for(j = 0; j < 3; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
@@ -526,33 +527,33 @@ test_dataset_append_columns(hid_t fid)
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the dataset again */
if((did = H5Dopen2(fid, DNAME_COLUMN, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 3; j++)
+ for(j = 0; j < 3; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -560,33 +561,34 @@ test_dataset_append_columns(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dapl);
- H5Pclose(dcpl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dapl);
+ H5Pclose(dcpl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
} /* test_dataset_append_columns() */
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_BUG1
+ * Function: test_dataset_append_BUG1
*
- * Purpose: Verify that the object flush property and the append flush property
+ * Purpose: Verify that the object flush property and the append flush property
* are working properly when appending rows and columns to an
* extendible dataset.
- * A BUG occurs:
- * when the extendible dataset is set up as follows:
- * hsize_t dims[2] = {0, 10};
- * hsize_t maxdims[2] = {H5S_UNLIMITED, 50};
- * when append 6 rows and 3 columns to the dataset;
- * The data is correct when the dataset is read at this point;
- * The data is incorrect when the dataset is closed, opened again, and read at this point;
- * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column.
*
- * Return: Success: 0
- * Failure: 1
+ * A BUG occurs:
+ * when the extendible dataset is set up as follows:
+ * hsize_t dims[2] = {0, 10};
+ * hsize_t maxdims[2] = {H5S_UNLIMITED, 50};
+ * when append 6 rows and 3 columns to the dataset;
+ * The data is correct when the dataset is read at this point;
+ * The data is incorrect when the dataset is closed, opened again, and read at this point;
+ * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column.
+ *
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -595,126 +597,124 @@ error:
static int
test_dataset_append_BUG1(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* Dataset creation property */
- hid_t dapl = -1; /* Dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10], cbuf[6]; /* The data buffers */
- int buf[6][13], rbuf[6][13]; /* The data buffers */
- int i, j; /* Local index variables */
-
- hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
-
- TESTING("Append flush with H5DOappend()--append rows & columns--BUG1");
-
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t dapl = -1; /* Dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[10], cbuf[6]; /* The data buffers */
+ int buf[6][13], rbuf[6][13]; /* The data buffers */
+ int i, j; /* Local index variables */
+
+ hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
+
+ HL_TESTING2("Append flush with H5DOappend()--append rows & columns--BUG1");
+
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR;
+ if((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR;
/* Append 6 rows to the dataset */
for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
- lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 10; j++)
+ lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
+ if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 6)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 6)
- TEST_ERROR;
+ TEST_ERROR;
/* Append 3 columns to the dataset */
for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
- cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 6; j++)
+ cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1;
+ if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 9)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 9)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
+ FAIL_STACK_ERROR;
+
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
-#ifdef BUG1
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen(fid, DBUGNAME1, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ if((did = H5Dopen2(fid, DBUGNAME1, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
-#endif
/* Closing */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -722,33 +722,34 @@ test_dataset_append_BUG1(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Pclose(dapl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dcpl);
+ H5Pclose(dapl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
} /* test_dataset_append_BUG1() */
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_BUG2
+ * Function: test_dataset_append_BUG2
*
- * Purpose: Verify that the object flush property and the append flush property
+ * Purpose: Verify that the object flush property and the append flush property
* are working properly when appending rows and columns to an
* extendible dataset.
- * A BUG occurs:
- * when the extendible dataset is set up as follows:
- * hsize_t dims[2] = {0, 10};
- * hsize_t maxdims[2] = {50, H5S_UNLIMITED};
- * when append 6 rows and 3 columns to the dataset;
- * The data is correct when the dataset is read at this point;
- * The data is incorrect when the dataset is closed, opened again, and read at this point;
- * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column.
*
- * Return: Success: 0
- * Failure: 1
+ * A BUG occurs:
+ * when the extendible dataset is set up as follows:
+ * hsize_t dims[2] = {0, 10};
+ * hsize_t maxdims[2] = {50, H5S_UNLIMITED};
+ * when append 6 rows and 3 columns to the dataset;
+ * The data is correct when the dataset is read at this point;
+ * The data is incorrect when the dataset is closed, opened again, and read at this point;
+ * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column.
+ *
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -757,127 +758,125 @@ error:
static int
test_dataset_append_BUG2(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* Dataset creation property */
- hid_t dapl = -1; /* Dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
-
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[10], cbuf[6]; /* Data buffers */
- int buf[6][13], rbuf[6][13]; /* Data buffers */
- int i, j; /* Local index variables */
-
- hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
-
- TESTING("Append flush with H5DOappend()--append rows & columns--BUG2");
-
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t dapl = -1; /* Dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
+
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[10], cbuf[6]; /* Data buffers */
+ int buf[6][13], rbuf[6][13]; /* Data buffers */
+ int i, j; /* Local index variables */
+
+ hsize_t boundary[2] = {1, 1}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
+
+ HL_TESTING2("Append flush with H5DOappend()--append rows & columns--BUG2");
+
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR;
+ if((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR;
/* Append 6 rows to the dataset */
for(i = 0; i < 6; i++) {
- for(j = 0; j < 10; j++)
- lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 10; j++)
+ lbuf[j] = buf[i][j] = (i * 10) + (j + 1);
+ if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 6)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 6)
- TEST_ERROR;
+ TEST_ERROR;
/* Append 3 columns to the dataset */
for(i = 0; i < 3; i++) {
- for(j = 0; j < 6; j++)
- cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1;
- if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
- TEST_ERROR;
+ for(j = 0; j < 6; j++)
+ cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1;
+ if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0)
+ TEST_ERROR;
} /* end for */
/* Verify the # of appends */
if(append_ct != 9)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 9)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
+ FAIL_STACK_ERROR;
+
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
-#ifdef BUG2
HDmemset(rbuf, 0, sizeof(rbuf));
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the dataset again */
- if((did = H5Dopen(fid, DBUGNAME2, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ if((did = H5Dopen2(fid, DBUGNAME2, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
-#endif
/* Closing */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -885,11 +884,11 @@ test_dataset_append_BUG2(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Pclose(dapl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dcpl);
+ H5Pclose(dapl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
@@ -897,15 +896,15 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_less
+ * Function: test_dataset_append_less
*
- * Purpose: Verify that the object flush property and the append flush property
- * are working properly when appending rows and columns to an
- * extendible dataset where the append size is less than the boundary
- * size.
+ * Purpose: Verify that the object flush property and the append flush property
+ * are working properly when appending rows and columns to an
+ * extendible dataset where the append size is less than the boundary
+ * size.
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -914,93 +913,93 @@ error:
static int
test_dataset_append_less(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[20], cbuf[6][3]; /* Data buffers */
- int buf[6][13], rbuf[6][13]; /* Data buffers */
- int i, j, k; /* Local index variables */
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[20], cbuf[6][3]; /* Data buffers */
+ int buf[6][13], rbuf[6][13]; /* Data buffers */
+ int i, j, k; /* Local index variables */
- hsize_t boundary[2] = {3, 3}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hsize_t boundary[2] = {3, 3}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
- TESTING("Append flush with H5DOappend()--append size < boundary size");
+ HL_TESTING2("Append flush with H5DOappend()--append size < boundary size");
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR;
+ if((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR;
/* Append to the dataset 2 rows at a time for 3 times */
for(i = 0, k = 0; i < 6; i++) {
- for(j = 0; j < 10; j++, k++)
- buf[i][j] = lbuf[k] = (i * 10) + (j + 1);
-
- if((i + 1) % 2 == 0) {
- if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0)
- TEST_ERROR;
- k = 0;
- } /* end if */
+ for(j = 0; j < 10; j++, k++)
+ buf[i][j] = lbuf[k] = (i * 10) + (j + 1);
+
+ if((i + 1) % 2 == 0) {
+ if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0)
+ TEST_ERROR;
+ k = 0;
+ } /* end if */
} /* end for */
/* Verify the # of appends */
if(append_ct != 2)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 2)
- TEST_ERROR;
+ TEST_ERROR;
/* Append 3 columns to the dataset, once */
for(i = 0; i < 3; i++)
- for(j = 0; j < 6; j++, k++)
- cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
+ for(j = 0; j < 6; j++, k++)
+ cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Verify the # of appends */
if(append_ct != 3)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 3)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
+ FAIL_STACK_ERROR;
+
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
@@ -1009,33 +1008,33 @@ test_dataset_append_less(hid_t fid)
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the dataset again */
if((did = H5Dopen2(fid, DNAME_LESS, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -1043,29 +1042,29 @@ test_dataset_append_less(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dapl);
- H5Pclose(dcpl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dapl);
+ H5Pclose(dcpl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
} /* test_dataset_append_less() */
/*-------------------------------------------------------------------------
- * Function: test_dataset_append_vary
+ * Function: test_dataset_append_vary
*
- * Purpose: Verify that the object flush property and the append flush property
- * are working properly when appending rows and columns to an
- * extendible dataset where
- * row: the append size is 3 times of the boundary size
- * the append callback/flush is performed on the 1st boundary hit
- * column: the boundary is greater than the append size
- * the boundary is not hit at all
+ * Purpose: Verify that the object flush property and the append flush property
+ * are working properly when appending rows and columns to an
+ * extendible dataset where
+ * row: the append size is 3 times of the boundary size
+ * the append callback/flush is performed on the 1st boundary hit
+ * column: the boundary is greater than the append size
+ * the boundary is not hit at all
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -1074,88 +1073,88 @@ error:
static int
test_dataset_append_vary(hid_t fid)
{
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
- hid_t ffapl = -1; /* The file's file access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t ffapl = -1; /* The file's file access property list */
- hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
- int lbuf[60], cbuf[6][3]; /* Data buffers */
- int buf[6][13], rbuf[6][13]; /* Data buffers */
- int i, j, k; /* Local index variables */
+ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */
+ int lbuf[60], cbuf[6][3]; /* Data buffers */
+ int buf[6][13], rbuf[6][13]; /* Data buffers */
+ int i, j, k; /* Local index variables */
- hsize_t boundary[2] = {3, 7}; /* Boundary sizes */
- unsigned append_ct = 0; /* The # of appends */
- unsigned *flush_ptr; /* Points to the flush counter */
+ hsize_t boundary[2] = {3, 7}; /* Boundary sizes */
+ unsigned append_ct = 0; /* The # of appends */
+ unsigned *flush_ptr; /* Points to the flush counter */
- TESTING("Append flush with H5DOappend()--append & boundary size vary");
+ HL_TESTING2("Append flush with H5DOappend()--append & boundary size vary");
/* Get the file's file access property list */
if((ffapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set to create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
- FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR;
+ if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ FAIL_STACK_ERROR;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set append flush property */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
- TEST_ERROR;
+ if((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR;
/* Append 6 rows to the dataset, once */
for(i = 0, k = 0; i < 6; i++)
- for(j = 0; j < 10; j++, k++)
- buf[i][j] = lbuf[k] = (i * 10) + (j + 1);
+ for(j = 0; j < 10; j++, k++)
+ buf[i][j] = lbuf[k] = (i * 10) + (j + 1);
if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)6, H5T_NATIVE_INT, lbuf) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Verify the # of appends */
if(append_ct != 1)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 1)
- TEST_ERROR;
+ TEST_ERROR;
/* Append 3 columns to the dataset, once */
for(i = 0; i < 3; i++)
- for(j = 0; j < 6; j++, k++)
- cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
+ for(j = 0; j < 6; j++, k++)
+ cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1;
if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Verify the # of appends */
if(append_ct != 1)
- TEST_ERROR;
+ TEST_ERROR;
/* Retrieve and verify object flush counts */
if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(*flush_ptr != 1)
- TEST_ERROR;
+ TEST_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
+ FAIL_STACK_ERROR;
+
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
@@ -1164,33 +1163,33 @@ test_dataset_append_vary(hid_t fid)
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the dataset again */
if((did = H5Dopen2(fid, DNAME_VARY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Read the dataset */
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data */
for(i = 0; i < 6; i++)
- for(j = 0; j < 13; j++)
+ for(j = 0; j < 13; j++)
if(buf[i][j] != rbuf[i][j])
TEST_ERROR;
/* Closing */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(ffapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -1198,24 +1197,23 @@ test_dataset_append_vary(hid_t fid)
error:
H5E_BEGIN_TRY {
- H5Pclose(dapl);
- H5Pclose(dcpl);
- H5Pclose(sid);
- H5Dclose(did);
- H5Pclose(ffapl);
+ H5Pclose(dapl);
+ H5Pclose(dcpl);
+ H5Pclose(sid);
+ H5Dclose(did);
+ H5Pclose(ffapl);
} H5E_END_TRY;
return 1;
} /* test_dataset_append_vary() */
/*-------------------------------------------------------------------------
- * Function: Main function
+ * Function: Main function
*
- * Purpose: Test H5Pset/get_object_flush_cb() and H5Pset/get_append_flush()
- * along with H5DOappend().
+ * Purpose: Test H5Pset/get_object_flush_cb() and H5Pset/get_append_flush()
+ * along with H5DOappend().
*
- * Return: Success: 0
- * Failure: 1
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Vailin Choi; Jan 2014
*
@@ -1223,69 +1221,67 @@ error:
*/
int main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- unsigned flush_ct = 0; /* The # of flushes */
- int nerrors = 0; /* The # of errors encountered */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ unsigned flush_ct = 0; /* The # of flushes */
+ int nerrors = 0; /* The # of errors encountered */
/* Get a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR;
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ FAIL_STACK_ERROR;
/* Set to use the latest library format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Set object flush property */
if(H5Pset_object_flush_cb(fapl, flush_func, &flush_ct) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create the test file */
- if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR;
+ if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR;
nerrors += test_dataset_append_notset(fid);
nerrors += test_dataset_append_rows(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_columns(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_rows_columns(fid);
-#ifdef BUG1_BUG2
/*
* The following tests illustrate the scenarios when H5DOappend does not work with extensible array indexing:
- * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible
- * - the dataset expands along 1 dimension and then expands along the other dimension
+ * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible
+ * - the dataset expands along 1 dimension and then expands along the other dimension
*/
- flush_ct = 0; /* Reset flush counter */
- nerrors += test_dataset_append_BUG1(fid);
+ flush_ct = 0; /* Reset flush counter */
+ nerrors += test_dataset_append_BUG1(fid);
- flush_ct = 0; /* Reset flush counter */
- nerrors += test_dataset_append_BUG2(fid);
-#endif
+ flush_ct = 0; /* Reset flush counter */
+ nerrors += test_dataset_append_BUG2(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_less(fid);
- flush_ct = 0; /* Reset flush counter */
+ flush_ct = 0; /* Reset flush counter */
nerrors += test_dataset_append_vary(fid);
/* Closing */
if(H5Pclose(fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Check for errors */
if(nerrors)
goto error;
- return 0;
+ return EXIT_SUCCESS;
error:
- return 1;
+ return EXIT_FAILURE;
}
diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c
deleted file mode 100644
index 383a87a..0000000
--- a/hl/test/test_dset_opt.c
+++ /dev/null
@@ -1,2028 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* 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 COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include <stdlib.h>
-#include <string.h>
-#include "h5hltest.h"
-#include "H5DOpublic.h"
-#include <math.h>
-
-#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
-# define H5_ZLIB_HEADER "zlib.h"
-#endif
-#if defined(H5_ZLIB_HEADER)
-# include H5_ZLIB_HEADER /* "zlib.h" */
-#endif
-
-#define FILE_NAME "test_dectris.h5"
-
-/* Datasets for Direct Write tests */
-#define DATASETNAME1 "direct_write"
-#define DATASETNAME2 "skip_one_filter"
-#define DATASETNAME3 "skip_two_filters"
-#define DATASETNAME4 "data_conv"
-#define DATASETNAME5 "contiguous_dset"
-#define DATASETNAME6 "invalid_argue"
-#define DATASETNAME7 "overwrite_chunk"
-/* Datasets for Direct Read tests */
-#define DATASETNAME8 "disabled_chunk_cache"
-#define DATASETNAME9 "flush_chunk_cache"
-#define DATASETNAME10 "read_w_valid_cache"
-#define DATASETNAME11 "unallocated_chunk"
-#define DATASETNAME12 "unfiltered_data"
-
-#define RANK 2
-#define NX 16
-#define NY 16
-#define CHUNK_NX 4
-#define CHUNK_NY 4
-
-#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0))
-
-/* Temporary filter IDs used for testing */
-#define H5Z_FILTER_BOGUS1 305
-#define H5Z_FILTER_BOGUS2 306
-#define ADD_ON 7
-#define FACTOR 3
-
-/* Constants for the overwrite test */
-#define OVERWRITE_NDIMS 3
-#define OVERWRITE_CHUNK_NX 3
-#define OVERWRITE_CHUNK_2NX 6
-#define OVERWRITE_CHUNK_NY 2
-#define OVERWRITE_VALUE 42
-
-/* Local prototypes for filter functions */
-static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-
-/* This message derives from H5Z */
-const H5Z_class2_t H5Z_BOGUS1[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS1, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus1", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus1, /* The actual filter function */
-}};
-
-const H5Z_class2_t H5Z_BOGUS2[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS2, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus2", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- filter_bogus2, /* The actual filter function */
-}};
-
-/*-------------------------------------------------------------------------
- * Function: test_direct_chunk_write
- *
- * Purpose: Test the basic functionality of H5DOwrite_chunk
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *
- *-------------------------------------------------------------------------
- */
-#ifdef H5_HAVE_FILTER_DEFLATE
-static int
-test_direct_chunk_write (hid_t file)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int ret;
- int data[NX][NY];
- int i, j, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
-
- const Bytef *z_src = (const Bytef*)(direct_buf);
- Bytef *z_dst = NULL; /*destination buffer */
- uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- uLong z_src_nbytes = (uLong)buf_size;
- int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- TESTING("basic functionality of H5DOwrite_chunk");
-
- /*
- * Create the data space with unlimited dimensions.
- */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
-
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /*
- * Modify dataset creation properties, i.e. enable chunking and compression
- */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
-
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
-
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
- goto error;
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
- data[i][j] = n++;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /*
- * Write the data for the dataset. It should stay in the chunk cache.
- * It will be evicted from the cache by the H5DOwrite_chunk calls.
- */
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
- goto error;
-
- /* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = n++;
-
- /* Allocate output (compressed) buffer */
- outbuf = HDmalloc(z_dst_nbytes);
- z_dst = (Bytef *)outbuf;
-
- /* Perform compression from the source to the destination buffer */
- ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
-
- /* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
- HDfprintf(stderr, "overflow");
- goto error;
- } else if(Z_MEM_ERROR == ret) {
- HDfprintf(stderr, "deflate memory error");
- goto error;
- } else if(Z_OK != ret) {
- HDfprintf(stderr, "other deflate error");
- goto error;
- }
-
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
- status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf);
- offset[1] += CHUNK_NY;
- }
- offset[0] += CHUNK_NX;
- offset[1] = 0;
- }
-
- if(outbuf)
- HDfree(outbuf);
-
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
- goto error;
-
- if(H5Dclose(dataset) < 0)
- goto error;
-
- if((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0)
- goto error;
-
- /*
- * Select hyperslab for one chunk in the file
- */
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- goto error;
-
- /* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- /* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != check_chunk[i][j]) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
- goto error;
- }
- }
- }
-
- /* Reinitialize different data for one chunk */
- for(i = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = i + j;
-
- /* Allocate output (compressed) buffer */
- outbuf = HDmalloc(z_dst_nbytes);
- z_dst = (Bytef *)outbuf;
-
- /* Perform compression from the source to the destination buffer */
- ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
-
- /* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
- HDfprintf(stderr, "overflow");
- goto error;
- } else if(Z_MEM_ERROR == ret) {
- HDfprintf(stderr, "deflate memory error");
- goto error;
- } else if(Z_OK != ret) {
- HDfprintf(stderr, "other deflate error");
- goto error;
- }
-
- /* Rewrite the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
- offset[0] = offset[1] = 0;
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
- status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf);
- offset[1] += CHUNK_NY;
- }
- offset[0] += CHUNK_NX;
- offset[1] = 0;
- }
-
- if(outbuf)
- HDfree(outbuf);
-
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
- goto error;
-
- if(H5Dclose(dataset) < 0)
- goto error;
-
- if((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- /* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != check_chunk[i][j]) {
- HDprintf(" 2. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
- goto error;
- }
- }
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- } H5E_END_TRY;
-
- if(outbuf)
- HDfree(outbuf);
-
- H5_FAILED();
- return 1;
-} /* test_direct_chunk_write() */
-#endif /* H5_HAVE_FILTER_DEFLATE */
-
-/*-------------------------------------------------------------------------
- * Function: test_direct_chunk_overwrite_data
- *
- * Purpose: Test overwriting a chunk with new data.
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Dana Robinson
- * Spring 2017
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_direct_chunk_overwrite_data(hid_t fid)
-{
- size_t buf_size = OVERWRITE_CHUNK_NX * OVERWRITE_CHUNK_NY * sizeof(int16_t);
- int16_t data_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_NX];
- int16_t overwrite_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_NX];
- uint32_t filter_mask = 0;
- hid_t tid = H5T_NATIVE_UINT16;
- hid_t dcpl_id = -1;
- hid_t sid = -1;
- hid_t did = -1;
- uint16_t fill_value = 0;
- hsize_t dset_dims[] = {1, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_2NX};
- hsize_t dset_max_dims[] = {H5S_UNLIMITED, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_2NX};
- hsize_t chunk_dims[] = {1, OVERWRITE_CHUNK_NY, OVERWRITE_CHUNK_NX};
- hsize_t offset[] = {0, 0, 0};
- hsize_t i, j;
- int16_t n;
- int16_t read_buf[OVERWRITE_CHUNK_NY][OVERWRITE_CHUNK_2NX];
-
- TESTING("overwriting existing data with H5DOwrite_chunk");
-
- /* Create the dataset's data space */
- if ((sid = H5Screate_simple(OVERWRITE_NDIMS, dset_dims, dset_max_dims)) < 0)
- FAIL_STACK_ERROR
-
- /* Set chunk size and filll value */
- if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
- if (H5Pset_fill_value(dcpl_id, tid, &fill_value) < 0)
- FAIL_STACK_ERROR
- if (H5Pset_chunk(dcpl_id, OVERWRITE_NDIMS, chunk_dims) < 0)
- FAIL_STACK_ERROR
-
- /* Create dataset */
- if ((did = H5Dcreate2(fid, DATASETNAME7, tid, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
-
- /* Initialize data buffers */
- n = 0;
- for (i = 0; i < OVERWRITE_CHUNK_NY; i++) {
- for (j = 0; j < OVERWRITE_CHUNK_NX; j++) {
- data_buf[i][j] = n++;
- overwrite_buf[i][j] = OVERWRITE_VALUE;
- }
- }
-
- /* Write chunk data using the direct write function. */
- if (H5DOwrite_chunk(did, H5P_DEFAULT, filter_mask, offset, buf_size, data_buf) < 0)
- FAIL_STACK_ERROR
-
- /* Write second chunk. */
- offset[2] = OVERWRITE_CHUNK_NX;
- if (H5DOwrite_chunk(did, H5P_DEFAULT, filter_mask, offset, buf_size, data_buf) < 0)
- FAIL_STACK_ERROR
-
- /* Overwrite first chunk. */
- offset[2] = 0;
- if (H5DOwrite_chunk(did, H5P_DEFAULT, filter_mask, offset, buf_size, overwrite_buf) < 0)
- FAIL_STACK_ERROR
-
- /* Read the data back out */
- if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0)
- FAIL_STACK_ERROR
-
- /* Ensure that the data are correct in chunk 1 */
- for (i = 0; i < OVERWRITE_CHUNK_NY; i++)
- for (j = 0; j < OVERWRITE_CHUNK_NX; j++) {
- if (read_buf[i][j] != OVERWRITE_VALUE)
- TEST_ERROR
- }
-
- if (H5Pclose(dcpl_id) < 0)
- FAIL_STACK_ERROR
- if (H5Sclose(sid) < 0)
- FAIL_STACK_ERROR
- if (H5Dclose(did) < 0)
- FAIL_STACK_ERROR
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl_id);
- H5Sclose(sid);
- H5Dclose(did);
- } H5E_END_TRY;
-
- H5_FAILED();
- return 1;
-} /* end test_direct_chunk_overwrite_data() */
-
-/*-------------------------------------------------------------------------
- * Function: test_skip_compress_write1
- *
- * Purpose: Test skipping compression filter when it is the only filter
- * for the dataset
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_skip_compress_write1(hid_t file)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- int aggression = 9; /* Compression aggression setting */
-
- unsigned read_filter_mask = 0; /* filter mask after direct read */
- int read_direct_buf[CHUNK_NX][CHUNK_NY];
- hsize_t read_buf_size = 0; /* buf size */
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- TESTING("skipping compression filter for H5DOwrite_chunk/H5DOread_chunk");
-
- /*
- * Create the data space with unlimited dimensions.
- */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
-
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /*
- * Modify dataset creation properties, i.e. enable chunking and compression
- */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
-
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
-
- if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0)
- goto error;
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- if((dataset = H5Dcreate2(file, DATASETNAME2, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++) {
- direct_buf[i][j] = n++;
- }
-
- /* write the uncompressed chunk data repeatedly to dataset, using the direct writing function.
- * Indicate skipping the compression filter. */
- offset[0] = CHUNK_NX;
- offset[1] = CHUNK_NY;
-
- filter_mask = 0x00000001;
-
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
- goto error;
-
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
- goto error;
-
- if(H5Dclose(dataset) < 0)
- goto error;
-
- if((dataset = H5Dopen2(file, DATASETNAME2, H5P_DEFAULT)) < 0)
- goto error;
-
- /*
- * Select hyperslab for the chunk just written in the file
- */
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- goto error;
-
- /* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- /* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != check_chunk[i][j]) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
- goto error;
- }
- }
- }
-
- /* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
- goto error;
- if(read_buf_size != buf_size)
- goto error;
-
- /* Read the raw chunk back */
- HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf));
- if((status = H5DOread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0)
- goto error;
- if(read_filter_mask != filter_mask)
- goto error;
-
- /* Check that the direct chunk read is the same as the chunk written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != read_direct_buf[i][j]) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]);
- goto error;
- }
- }
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- } H5E_END_TRY;
-
- H5_FAILED();
- return 1;
-} /* test_skip_compress_write1() */
-
-/*-------------------------------------------------------------------------
- * Function: filter_bogus1
- *
- * Purpose: A bogus filter that adds ADD_ON to the original value
- *
- * Return: Success: Data chunk size
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *
- *-------------------------------------------------------------------------
- */
-static size_t
-filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
-{
- int *int_ptr=(int *)*buf; /* Pointer to the data values */
- ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */
-
- if(flags & H5Z_FLAG_REVERSE) { /* read */
- /* Substract the "add on" value to all the data values */
- while(buf_left>0) {
- *int_ptr++ -= (int)ADD_ON;
- buf_left -= (ssize_t)sizeof(int);
- } /* end while */
- } /* end if */
- else { /* write */
- /* Add the "add on" value to all the data values */
- while(buf_left>0) {
- *int_ptr++ += (int)ADD_ON;
- buf_left -= (ssize_t)sizeof(int);
- } /* end while */
- } /* end else */
-
- return nbytes;
-} /* filter_bogus1() */
-
-/*-------------------------------------------------------------------------
- * Function: filter_bogus2
- *
- * Purpose: A bogus filter that multiplies the original value by FACTOR.
- *
- * Return: Success: Data chunk size
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *-------------------------------------------------------------------------
- */
-static size_t
-filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
-{
- int *int_ptr=(int *)*buf; /* Pointer to the data values */
- ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */
-
- if(flags & H5Z_FLAG_REVERSE) { /* read */
- /* Substract the "add on" value to all the data values */
- while(buf_left>0) {
- *int_ptr++ /= (int)FACTOR;
- buf_left -= (ssize_t)sizeof(int);
- } /* end while */
- } /* end if */
- else { /* write */
- /* Add the "add on" value to all the data values */
- while(buf_left>0) {
- *int_ptr++ *= (int)FACTOR;
- buf_left -= (ssize_t)sizeof(int);
- } /* end while */
- } /* end else */
-
- return nbytes;
-} /* filter_bogus2() */
-
-/*-------------------------------------------------------------------------
- * Function: test_skip_compress_write2
- *
- * Purpose: Test skipping compression filter when there are three filters
- * for the dataset
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_skip_compress_write2(hid_t file)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
-
- unsigned filter_mask = 0; /* orig filter mask */
- int origin_direct_buf[CHUNK_NX][CHUNK_NY];
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- int aggression = 9; /* Compression aggression setting */
-
- unsigned read_filter_mask = 0; /* filter mask after direct read */
- int read_direct_buf[CHUNK_NX][CHUNK_NY];
- hsize_t read_buf_size = 0; /* buf size */
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- TESTING("skipping compression filters but keep two other filters");
-
- /*
- * Create the data space with unlimited dimensions.
- */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
-
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /*
- * Modify dataset creation properties, i.e. enable chunking and compression.
- * The order of filters is bogus 1 + deflate + bogus 2.
- */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
-
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
-
- /* Register and enable first bogus filter */
- if(H5Zregister (H5Z_BOGUS1) < 0)
- goto error;
-
- if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0)
- goto error;
-
- /* Enable compression filter */
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
- goto error;
-
- /* Register and enable second bogus filter */
- if(H5Zregister (H5Z_BOGUS2) < 0)
- goto error;
-
- if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0)
- goto error;
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Initialize data for one chunk. Apply operations of two bogus filters to the chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++) {
- origin_direct_buf[i][j] = n++;
- direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR;
- }
-
- /* write the uncompressed chunk data repeatedly to dataset, using the direct writing function.
- * Indicate skipping the compression filter but keep the other two bogus filters */
- offset[0] = CHUNK_NX;
- offset[1] = CHUNK_NY;
-
- /* compression filter is the middle one to be skipped */
- filter_mask = 0x00000002;
-
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
- goto error;
-
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
- goto error;
-
- if(H5Dclose(dataset) < 0)
- goto error;
-
- if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0)
- goto error;
-
- /*
- * Select hyperslab for one chunk in the file
- */
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- goto error;
-
- /* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- /* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(origin_direct_buf[i][j] != check_chunk[i][j]) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j], check_chunk[i][j]);
- goto error;
- }
- }
- }
-
- /* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
- goto error;
- if(read_buf_size != buf_size)
- goto error;
-
- /* Read the raw chunk back */
- HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf));
- if((status = H5DOread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0)
- goto error;
- if(read_filter_mask != filter_mask)
- goto error;
-
- /* Check that the direct chunk read is the same as the chunk written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if(direct_buf[i][j] != read_direct_buf[i][j]) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]);
- goto error;
- }
- }
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- } H5E_END_TRY;
-
- H5_FAILED();
- return 1;
-} /* test_skip_compress_write2() */
-
-/*-------------------------------------------------------------------------
- * Function: test_data_conv
- *
- * Purpose: Test data conversion
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_data_conv(hid_t file)
-{
- typedef struct {
- int a, b, c[4], d, e;
- } src_type_t;
- typedef struct {
- int a, c[4], e;
- } dst_type_t;
-
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
- const hsize_t four = 4;
- hid_t st=-1, dt=-1;
- hid_t array_dt;
-
- unsigned filter_mask = 0;
- src_type_t direct_buf[CHUNK_NX][CHUNK_NY];
- dst_type_t check_chunk[CHUNK_NX][CHUNK_NY];
- src_type_t read_chunk[CHUNK_NX][CHUNK_NY]; /* For H5DOread_chunk */
-
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(src_type_t);
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- TESTING("data conversion for H5DOwrite_chunk/H5DOread_chunk");
-
- /*
- * Create the data space with unlimited dimensions.
- */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
-
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /*
- * Modify dataset creation properties, i.e. enable chunking
- */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
-
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
-
- /* Build hdf5 datatypes */
- array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 ||
- H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 ||
- H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0)
- goto error;
-
- if(H5Tclose(array_dt) < 0)
- goto error;
-
- array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four);
- if((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 ||
- H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 ||
- H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 ||
- H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0)
- goto error;
-
- if(H5Tclose(array_dt) < 0)
- goto error;
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- (direct_buf[i][j]).a = i*j+0;
- (direct_buf[i][j]).b = i*j+1;
- (direct_buf[i][j]).c[0] = i*j+2;
- (direct_buf[i][j]).c[1] = i*j+3;
- (direct_buf[i][j]).c[2] = i*j+4;
- (direct_buf[i][j]).c[3] = i*j+5;
- (direct_buf[i][j]).d = i*j+6;
- (direct_buf[i][j]).e = i*j+7;
- }
- }
-
- /* write the chunk data to dataset, using the direct writing function.
- * There should be no data conversion involved. */
- offset[0] = CHUNK_NX;
- offset[1] = CHUNK_NY;
-
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
- goto error;
-
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
- goto error;
-
- if(H5Dclose(dataset) < 0)
- goto error;
-
- if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Use H5DOread_chunk() to read the uncompressed data */
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, read_chunk)) < 0)
- goto error;
-
- /* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if ((direct_buf[i][j]).a != (read_chunk[i][j]).a ||
- (direct_buf[i][j]).b != (read_chunk[i][j]).b ||
- (direct_buf[i][j]).c[0] != (read_chunk[i][j]).c[0] ||
- (direct_buf[i][j]).c[1] != (read_chunk[i][j]).c[1] ||
- (direct_buf[i][j]).c[2] != (read_chunk[i][j]).c[2] ||
- (direct_buf[i][j]).c[3] != (read_chunk[i][j]).c[3] ||
- (direct_buf[i][j]).d != (read_chunk[i][j]).d ||
- (direct_buf[i][j]).e != (read_chunk[i][j]).e) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
- (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1],
- (read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e);
-
- goto error;
- }
- }
- }
-
- /*
- * Select hyperslab for the chunk just written in the file
- */
- start[0] = CHUNK_NX; start[1] = CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- goto error;
-
- /* Read the chunk back. Data should be converted */
- if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- /* Check that the values read are the same as the values written */
- for(i = 0; i < CHUNK_NX; i++) {
- for(j = 0; j < CHUNK_NY; j++) {
- if ((direct_buf[i][j]).a != (check_chunk[i][j]).a ||
- (direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] ||
- (direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] ||
- (direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] ||
- (direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] ||
- (direct_buf[i][j]).e != (check_chunk[i][j]).e) {
- HDprintf(" 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
- (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
- HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
- (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
- (check_chunk[i][j]).c[3], (check_chunk[i][j]).e);
-
- goto error;
- }
- }
- }
-
- /*
- * Close/release resources.
- */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- H5Tclose(st);
- H5Tclose(dt);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- H5Tclose(st);
- H5Tclose(dt);
- } H5E_END_TRY;
-
- H5_FAILED();
- return 1;
-} /* test_data_conv() */
-
-/*-------------------------------------------------------------------------
- * Function: test_invalid_parameters
- *
- * Purpose: Test invalid parameters for H5DOwrite_chunk and H5DOread_chunk
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_invalid_parameters(hid_t file)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int i, j, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- int aggression = 9; /* Compression aggression setting */
-
- hsize_t chunk_nbytes; /* Chunk size */
-
- TESTING("invalid parameters for H5DOwrite_chunk/H5DOread_chunk");
-
- /*
- * Create the data space with unlimited dimensions.
- */
- if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
- goto error;
-
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /*
- * Modify dataset creation properties
- */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
-
- /*
- * Create a new contiguous dataset to verify H5DOwrite_chunk/H5DOread_chunk doesn't work
- */
- if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Initialize data for one chunk */
- for(i = n = 0; i < CHUNK_NX; i++)
- for(j = 0; j < CHUNK_NY; j++) {
- direct_buf[i][j] = n++;
- }
-
- /* Try to write the chunk data to contiguous dataset. It should fail */
- offset[0] = CHUNK_NX;
- offset[1] = CHUNK_NY;
-
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Try to get chunk size for a contiguous dataset. It should fail */
- H5E_BEGIN_TRY {
- if((status = H5Dget_chunk_storage_size(dataset, offset, &chunk_nbytes)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Try to H5DOread_chunk from the contiguous dataset. It should fail */
- H5E_BEGIN_TRY {
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- if(H5Dclose(dataset) < 0)
- goto error;
-
-
- /* Create a chunked dataset with compression filter */
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
-
- if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0)
- goto error;
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Check invalid dataset ID for H5DOwrite_chunk and H5DOread_chunk */
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- if((status = H5DOread_chunk((hid_t)-1, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Check invalid DXPL ID for H5DOwrite_chunk and H5DOread_chunk */
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- if((status = H5DOread_chunk(dataset, (hid_t)-1, offset, &filter_mask, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Check invalid OFFSET for H5DOwrite_chunk and H5DOread_chunk */
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- if((status = H5DOread_chunk(dataset, dxpl, NULL, &filter_mask, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Check when OFFSET is out of dataset range for H5DOwrite_chunk and H5DOread_chunk */
- offset[0] = NX + 1;
- offset[1] = NY;
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Check when OFFSET is not on chunk boundary for H5DOwrite_chunk and H5DOread_chunk */
- offset[0] = CHUNK_NX;
- offset[1] = CHUNK_NY + 1;
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Check invalid buffer size for H5DOwrite_chunk only */
- offset[0] = CHUNK_NX;
- offset[1] = CHUNK_NY;
- buf_size = 0;
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- /* Check invalid data buffer for H5DOwrite_chunk and H5DOread_chunk */
- buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- H5E_BEGIN_TRY {
- if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, NULL)) != FAIL)
- goto error;
- } H5E_END_TRY;
-
- if(H5Dclose(dataset) < 0)
- goto error;
-
- /*
- * Close/release resources.
- */
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- } H5E_END_TRY;
-
- H5_FAILED();
- return 1;
-} /* test_invalid_parameters() */
-
-/*-------------------------------------------------------------------------
- * Function: test_direct_chunk_read_no_cache
- *
- * Purpose: Test the basic functionality of H5DOread_chunk with the
- * chunk cache diabled.
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Matthew Strong (GE Healthcare)
- * 14 February 2016
- *
- *-------------------------------------------------------------------------
- */
-#ifdef H5_HAVE_FILTER_DEFLATE
-static int
-test_direct_chunk_read_no_cache (hid_t file)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1, dapl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
- herr_t status; /* status from H5 function calls */
- int ret; /* deflate return status */
- int data[NX][NY];
- int i, j, k, l, n; /* local index variables */
-
- unsigned filter_mask = 0; /* filter mask returned from H5DOread_chunk */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5DOread and manually decompressed */
- int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
- hsize_t offset[2]; /* chunk offset used for H5DOread_chunk */
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
-
- Bytef *z_src = NULL; /* source buffer */
- uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- Bytef *z_dst = (Bytef*)(direct_buf);
- uLong z_dst_nbytes = (uLong)buf_size;
- int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- TESTING("basic functionality of H5DOread_chunk (chunk cache disabled)");
-
- /* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /* Modify dataset creation properties, i.e. enable chunking and compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
- goto error;
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
- goto error;
-
- /* Disable chunk cache by setting number of slots to 0 */
- if((status = H5Pset_chunk_cache(dapl, 0, H5D_CHUNK_CACHE_NBYTES_DEFAULT, H5D_CHUNK_CACHE_W0_DEFAULT)) < 0)
- goto error;
-
- /* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, DATASETNAME8, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, dapl)) < 0)
- goto error;
-
- /* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
- data[i][j] = n++;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Write the data for the dataset.
- * Data will skip chunk cache and go directly to disk. */
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
- goto error;
-
- /* Allocate output (compressed) buffer */
- outbuf = HDmalloc(z_src_nbytes);
- z_src = (Bytef *)outbuf;
-
- /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
- /* Select hyperslab for one chunk in the file */
- start[0] = (hsize_t)i * CHUNK_NX; start[1] = (hsize_t)j * CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
-
- /* Hyperslab selection equals single chunk */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- goto error;
-
- /* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- offset[0] = (hsize_t)i * CHUNK_NX; offset[1] = (hsize_t)j * CHUNK_NY;
- /* Read the compressed chunk back using the direct read function. */
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
- goto error;
-
- /* Check filter mask return value */
- if(filter_mask != 0)
- goto error;
-
- /* Perform decompression from the source to the destination buffer */
- ret = uncompress(z_dst, &z_dst_nbytes, z_src, z_src_nbytes);
-
- /* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
- HDfprintf(stderr, "overflow\n");
- goto error;
- } else if(Z_MEM_ERROR == ret) {
- HDfprintf(stderr, "deflate memory error\n");
- goto error;
- } else if(Z_DATA_ERROR == ret) {
- HDfprintf(stderr, "corrupted data\n");
- goto error;
- } else if(Z_OK != ret) {
- HDfprintf(stderr, "other deflate error\n");
- goto error;
- }
-
- /* Check that the decompressed values match those read from H5Dread */
- for(k = 0; k < CHUNK_NX; k++) {
- for(l = 0; l < CHUNK_NY; l++) {
- if(direct_buf[k][l] != check_chunk[k][l]) {
- HDprintf("\n 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", k, l);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[k][l], check_chunk[k][l]);
- goto error;
- }
- }
- }
- }
- }
-
- /* Close/release resources. */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- H5Pclose(dapl);
-
- if(outbuf)
- HDfree(outbuf);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- H5Pclose(dapl);
- } H5E_END_TRY;
-
- if(outbuf)
- HDfree(outbuf);
-
- H5_FAILED();
- return 1;
-} /* test_direct_chunk_read_no_cache() */
-#endif /* H5_HAVE_FILTER_DEFLATE */
-
-#ifdef H5_HAVE_FILTER_DEFLATE
-static int
-test_direct_chunk_read_cache (hid_t file, hbool_t flush)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
- herr_t status; /* status from H5 function calls */
- int ret; /* deflate return status */
- int data[NX][NY];
- int i, j, k, l, n; /* local index variables */
-
- unsigned filter_mask = 0; /* filter mask returned from H5DOread_chunk */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5DOread and manually decompressed */
- int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
- hsize_t offset[2]; /* chunk offset used for H5DOread_chunk */
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
-
- Bytef *z_src = NULL; /* source buffer */
- uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- Bytef *z_dst = (Bytef*)(direct_buf);
- uLong z_dst_nbytes = (uLong)buf_size;
- int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
- hsize_t read_buf_size = 0;
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- if(flush) {
- TESTING("basic functionality of H5DOread_chunk (flush chunk cache)");
- } else {
- TESTING("basic functionality of H5DOread_chunk (does not flush chunk cache)");
- }
-
- /* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /* Modify dataset creation properties, i.e. enable chunking and compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
- if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0)
- goto error;
-
- /* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, flush?DATASETNAME9:DATASETNAME10, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
- data[i][j] = n++;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Write the data for the dataset.
- * It should stay in the chunk cache. */
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
- goto error;
-
- if(flush) {
- /* Flush the chunk cache to disk. Cache entry is not evicted. */
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
- goto error;
- }
-
- /* Allocate output (compressed) buffer */
- outbuf = HDmalloc(z_src_nbytes);
- z_src = (Bytef *)outbuf;
-
- /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
- /* Select hyperslab for one chunk in the file */
- start[0] = (hsize_t)i * CHUNK_NX; start[1] = (hsize_t)j * CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
-
- /* Hyperslab selection equals single chunk */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- goto error;
-
- /* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- offset[0] = (hsize_t)i * CHUNK_NX; offset[1] = (hsize_t)j * CHUNK_NY;
-
- /* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
- goto error;
- if(read_buf_size == 0)
- goto error;
-
- /* Read the compressed chunk back using the direct read function. */
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
- goto error;
-
- /* Check filter mask return value */
- if(filter_mask != 0)
- goto error;
-
- /* Perform decompression from the source to the destination buffer */
- ret = uncompress(z_dst, &z_dst_nbytes, z_src, z_src_nbytes);
-
- /* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
- HDfprintf(stderr, "overflow\n");
- goto error;
- } else if(Z_MEM_ERROR == ret) {
- HDfprintf(stderr, "deflate memory error\n");
- goto error;
- } else if(Z_DATA_ERROR == ret) {
- HDfprintf(stderr, "corrupted data\n");
- goto error;
- } else if(Z_OK != ret) {
- HDfprintf(stderr, "other deflate error\n");
- goto error;
- }
-
- /* Check that the decompressed values match those read from H5Dread */
- for(k = 0; k < CHUNK_NX; k++) {
- for(l = 0; l < CHUNK_NY; l++) {
- if(direct_buf[k][l] != check_chunk[k][l]) {
- HDprintf("\n 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", k, l);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[k][l], check_chunk[k][l]);
- goto error;
- }
- }
- }
- }
- }
-
- /* Close/release resources. */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
-
- if(outbuf)
- HDfree(outbuf);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- } H5E_END_TRY;
-
- if(outbuf)
- HDfree(outbuf);
-
- H5_FAILED();
- return 1;
-} /* test_direct_chunk_read_cache() */
-#endif /* H5_HAVE_FILTER_DEFLATE */
-
-/*-------------------------------------------------------------------------
- * Function: test_read_unfiltered_dset
- *
- * Purpose: Test the basic functionality of H5DOread_chunk on a dataset
- * without no filters applied.
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Matthew Strong (GE Healthcare)
- * 30 November 2016
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_read_unfiltered_dset(hid_t file)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- herr_t status;
- int data[NX][NY];
- int i, j, k, l, n;
-
- unsigned filter_mask = 0;
- int direct_buf[CHUNK_NX][CHUNK_NY];
- int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */
- hsize_t offset[2] = {0, 0};
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- hsize_t read_buf_size = 0;
-
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
-
- TESTING("basic functionality of H5DOread_chunk on unfiltered datasets");
-
- /* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /* Modify dataset creation properties, i.e. enable chunking, no compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
-
- /* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, DATASETNAME12, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Initialize the dataset */
- for(i = n = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
- data[i][j] = n++;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Write the data for the dataset.
- * It should stay in the chunk cache and will be evicted/flushed by
- * the H5DOread_chunk function call. */
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
- goto error;
-
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
- goto error;
-
- /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */
- for(i=0; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
- /* Select hyperslab for one chunk in the file */
- start[0] = (hsize_t)i * CHUNK_NX; start[1] = (hsize_t)j * CHUNK_NY;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY;
-
- /* Hyperslab selection equals single chunk */
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
- goto error;
-
- /* Read the chunk back */
- if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
- goto error;
-
- /* Query chunk storage size */
- if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0)
- goto error;
-
- if(read_buf_size != buf_size )
- goto error;
-
- offset[0] = (hsize_t)i * CHUNK_NX; offset[1] = (hsize_t)j * CHUNK_NY;
- /* Read the raw chunk back */
- HDmemset(&direct_buf, 0, sizeof(direct_buf));
- filter_mask = UINT_MAX;
- if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) < 0)
- goto error;
-
- /* Check filter mask return value */
- if(filter_mask != 0)
- goto error;
-
- /* Check that the decompressed values match those read from H5Dread */
- for(k = 0; k < CHUNK_NX; k++) {
- for(l = 0; l < CHUNK_NY; l++) {
- if(direct_buf[k][l] != check_chunk[k][l]) {
- HDprintf("\n 1. Read different values than written.");
- HDprintf(" At index %d,%d\n", k, l);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[k][l], check_chunk[k][l]);
- goto error;
- }
- }
- }
- }
- }
-
- /* Close/release resources. */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- } H5E_END_TRY;
-
- H5_FAILED();
- return 1;
-} /* test_read_unfiltered_dset() */
-
-/*-------------------------------------------------------------------------
- * Function: test_read_unallocated_chunk
- *
- * Purpose: Tests the H5DOread_chunk and H5Dget_chunk_storage_size with valid
- * offets to chunks that have not been written to the dataset and are
- * not allocated in the chunk storage on disk.
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Matthew Strong (GE Healthcare)
- * 30 November 2016
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_read_unallocated_chunk (hid_t file)
-{
- hid_t dataspace = -1, dataset = -1;
- hid_t mem_space = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY};
- hsize_t chunk_nbytes = CHUNK_NX*CHUNK_NY*sizeof(int);
- hsize_t direct_chunk_nbytes = 0; /* size (bytes) of the on-disk chunk */
- herr_t status; /* status from H5 function calls */
- hsize_t i, j; /* local index variables */
-
- unsigned filter_mask = 0; /* filter mask returned from H5DOread_chunk */
- int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5DOread and manually decompressed */
- hsize_t offset[2]; /* chunk offset used for H5DOread_chunk */
-
- TESTING("H5DOread_chunk with unallocated chunks");
-
- /* Create the data space with unlimited dimensions. */
- if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
- goto error;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
- goto error;
-
- /* Modify dataset creation properties, i.e. enable chunking, no compression */
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
- if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
- goto error;
-
- /* Create a new dataset within the file using cparms creation properties. */
- if((dataset = H5Dcreate2(file, DATASETNAME11, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
- goto error;
-
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
-
- /* Write a single chunk to intialize the chunk storage */
- HDmemset(&chunk_dims, 0, sizeof(chunk_dims));
- offset[0] = 0; offset[1] = 0;
-
- if(H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, &chunk_dims) < 0)
- goto error;
-
- /* Attempt to read each chunk in the dataset. Chunks are not allocated,
- * therefore we expect the result of H5DOread_chunk to fail. Chunk idx starts
- * at 1, since one chunk was written to init the chunk storage. */
- for(i=1; i<NX/CHUNK_NX; i++) {
- for(j=0; j<NY/CHUNK_NY; j++) {
-
- offset[0] = i * CHUNK_NX;
- offset[1] = j * CHUNK_NY;
-
- /* Read a non-existant chunk using the direct read function. */
- H5E_BEGIN_TRY {
- status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, &direct_buf);
- } H5E_END_TRY;
-
- /* Check that the chunk read call does not succeed. */
- if(status != -1)
- goto error;
-
- /* Query the size of the non-existant chunk */
- direct_chunk_nbytes = ULONG_MAX;
- H5E_BEGIN_TRY {
- status = H5Dget_chunk_storage_size(dataset, offset, &direct_chunk_nbytes);
- } H5E_END_TRY;
-
- /* Check that the chunk storage size call does not succeed. */
- if(status != -1 )
- goto error;
- if(direct_chunk_nbytes != 0 )
- goto error;
-
- }
- }
-
- /* Close/release resources. */
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(mem_space);
- H5Sclose(dataspace);
- H5Pclose(cparms);
- H5Pclose(dxpl);
- } H5E_END_TRY;
-
- H5_FAILED();
- return 1;
-} /* test_read_unallocated_chunk() */
-
-/*-------------------------------------------------------------------------
- * Function: Main function
- *
- * Purpose: Test direct chunk write function H5DOwrite_chunk and
- * chunk direct read function H5DOread_chunk
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Raymond Lu
- * 30 November 2012
- *
- *-------------------------------------------------------------------------
- */
-int main( void )
-{
- hid_t file_id;
- int nerrors=0;
-
- /*
- * Create a new file. If file exists its contents will be overwritten.
- */
- if((file_id = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
-
- /* Test direct chunk write and direct chunk read */
-#ifdef H5_HAVE_FILTER_DEFLATE
- nerrors += test_direct_chunk_write(file_id);
-#endif /* H5_HAVE_FILTER_DEFLATE */
- nerrors += test_direct_chunk_overwrite_data(file_id);
- nerrors += test_skip_compress_write1(file_id);
- nerrors += test_skip_compress_write2(file_id);
- nerrors += test_data_conv(file_id);
- nerrors += test_invalid_parameters(file_id);
-
- /* Test direct chunk read */
-#ifdef H5_HAVE_FILTER_DEFLATE
- nerrors += test_direct_chunk_read_no_cache(file_id);
- nerrors += test_direct_chunk_read_cache(file_id, TRUE);
- nerrors += test_direct_chunk_read_cache(file_id, FALSE);
-#endif /* H5_HAVE_FILTER_DEFLATE */
- nerrors += test_read_unfiltered_dset(file_id);
- nerrors += test_read_unallocated_chunk(file_id);
-
- if(H5Fclose(file_id) < 0)
- goto error;
-
- /* check for errors */
- if (nerrors)
- goto error;
-
- HDputs("All direct chunk read/write tests passed.");
- return EXIT_SUCCESS;
-
-error:
- HDputs("*** TESTS FAILED ***");
- return EXIT_FAILURE;
-}
diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c
index a98642c..504a3f5 100644
--- a/hl/test/test_file_image.c
+++ b/hl/test/test_file_image.c
@@ -44,10 +44,10 @@
extend the image, and then performs writes that extend the images. The fifth
loop reads the extended images and verify that the content are correct. The
sixth and final loop closes the file images and deallocates the image
- buffers if appropriate. */
+ buffers if appropriate. */
/*-------------------------------------------------------------------------
-* test file image operations
+* test file image operations
*-------------------------------------------------------------------------
*/
static int
@@ -67,11 +67,11 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
void **buf_ptr; /* pointer to array of pointers to image buffers */
char **filename; /* pointer to array of pointers to filenames */
unsigned *input_flags; /* pointer to array of flag combinations */
- size_t i, j, k, nrow, n_values;
+ size_t i, j, k, nrow, n_values;
herr_t status1;
void *handle_ptr = NULL; /* pointers to driver buffer */
- unsigned char **core_buf_ptr_ptr = NULL;
-
+ unsigned char **core_buf_ptr_ptr = NULL;
+
VERIFY(open_images > 1 , "The number of open images must be greater than 1");
VERIFY(nflags > 0, "The number of flag combinations must be greater than 0");
@@ -100,7 +100,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
if (NULL == (dset_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
- TESTING("get file images");
+ HL_TESTING2("get file images");
/* create several file images */
for (i = 0; i < open_images; i++) {
@@ -112,17 +112,17 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
filename[i] = (char *)HDmalloc(sizeof(char) * 32);
/* create file name */
- sprintf(filename[i], "image_file%d.h5", (int)i);
+ HDsprintf(filename[i], "image_file%d.h5", (int)i);
/* create file */
if ((file_id[i] = H5Fcreate(filename[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("H5Fcreate() failed");
- /* define dataspace for the dataset */
- if ((file_space = H5Screate_simple(RANK, dims1, max_dims)) < 0)
+ /* define dataspace for the dataset */
+ if ((file_space = H5Screate_simple(RANK, dims1, max_dims)) < 0)
FAIL_PUTS_ERROR("H5Screate_simple() failed");
- /* create dataset property list */
+ /* create dataset property list */
if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_PUTS_ERROR("H5Pcreate() failed");
@@ -133,8 +133,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* create and write an integer type dataset named "dset" */
if ((dset_id[i] = H5Dcreate2(file_id[i], DSET_NAME, H5T_NATIVE_INT, file_space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("H5Dcreate() failed");
-
- /* dataset in open image 1 is written with "wrong" data */
+
+ /* dataset in open image 1 is written with "wrong" data */
if (i == 1) {
if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2) < 0)
FAIL_PUTS_ERROR("H5Dwrite() failed");
@@ -144,7 +144,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1) < 0)
FAIL_PUTS_ERROR("H5Dwrite() failed");
} /* end else */
-
+
/* flush into the file */
if (H5Fflush(file_id[i], H5F_SCOPE_LOCAL) < 0)
FAIL_PUTS_ERROR("H5Fflush() failed");
@@ -152,7 +152,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* close dataset property list */
if (H5Pclose(plist) < 0)
FAIL_PUTS_ERROR("H5Pclose() failed");
-
+
/* close dataspace */
if (H5Sclose(file_space) < 0)
FAIL_PUTS_ERROR("H5Sclose() failed");
@@ -172,7 +172,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* buffer for file image 2 is filled with counter data (non-valid image) */
if (i == 2) {
for (j = 0; j < (size_t)buf_size[i]; j++)
- ((char*)(buf_ptr[i]))[j] = (char)j;
+ ((char*)(buf_ptr[i]))[j] = (char)j;
} /* end if */
/* buffers for the rest of the file images are filled with data from the respective files */
else {
@@ -187,14 +187,14 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
PASSED();
- TESTING("open file images and check image copies");
-
- /* open the file images with the core driver for data access */
+ HL_TESTING2("open file images and check image copies");
+
+ /* open the file images with the core driver for data access */
for (i = 0; i < open_images; i++) {
/* open file image 2 filled with counter data (non-valid image) */
if (i == 2) {
H5E_BEGIN_TRY {
- /* attempt to set file image in the core driver */
+ /* attempt to set file image in the core driver */
file_id[i] = H5LTopen_file_image(buf_ptr[i], (size_t)buf_size[i], input_flags[i]);
} H5E_END_TRY
@@ -202,7 +202,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
} /* end if */
/* open rest of valid file images */
else {
- /* set file image in the core driver */
+ /* set file image in the core driver */
if ((file_id[i] = H5LTopen_file_image(buf_ptr[i], (size_t)buf_size[i], input_flags[i])) < 0)
FAIL_PUTS_ERROR("H5LTopen_file_image() failed");
@@ -218,7 +218,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
else
VERIFY(*core_buf_ptr_ptr != buf_ptr[i], "vfd buffer and user buffer should be different");
- /*
+ /*
* When the vfd and user buffers are different and H5LT_FILE_IMAGE_OPEN_RW is enabled,
* status_flags in the superblock needs to be cleared in the vfd buffer for
* the comparison to proceed as expected. The user buffer as returned from H5Fget_file_image()
@@ -249,7 +249,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
PASSED();
- TESTING("read file images");
+ HL_TESTING2("read file images");
/* read open file images and verify data */
for (i = 0; i < open_images; i++) {
@@ -259,7 +259,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
continue;
} /* end if */
- /* open dataset in file image */
+ /* open dataset in file image */
if ((dset_id[i] = H5Dopen2(file_id[i], DSET_NAME, H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("H5Dopen() failed");
@@ -274,8 +274,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* read dataset */
if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0)
FAIL_PUTS_ERROR("H5Dread() failed");
-
- /* compute number of elements in dataset */
+
+ /* compute number of elements in dataset */
n_values = (size_t)(dims3[0] * dims3[1]);
/* determine the number of rows in dataset */
@@ -297,15 +297,15 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
if (data3[j * nrow + k ] != data1[j * nrow + k ])
FAIL_PUTS_ERROR("comparison of image values with original data failed");
} /* end else */
-
- /* close dataspace */
+
+ /* close dataspace */
if (H5Sclose (file_space) < 0)
FAIL_PUTS_ERROR("H5Sclose() failed");
} /* end for */
- PASSED();
+ PASSED();
- TESTING("write and extend file images");
+ HL_TESTING2("write and extend file images");
/* write open file images and verify data */
for (i = 0; i < open_images; i++) {
@@ -365,7 +365,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
hid_t attr_space_id = -1;
hid_t attr_id = -1;
herr_t status2;
- size_t l;
+ size_t l;
if ((attr_space_id = H5Screate_simple(attr_rank, attr_dims, attr_dims)) < 0)
FAIL_PUTS_ERROR("attr_space H5Screate_simple() failed");
@@ -396,9 +396,9 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
H5Aclose(attr_id);
} H5E_END_TRY;
#endif
- if (H5Dclose(dset_id[i]) < 0)
- FAIL_PUTS_ERROR("H5Dclose() failed");
- dset_id[i] = -1;
+ if (H5Dclose(dset_id[i]) < 0)
+ FAIL_PUTS_ERROR("H5Dclose() failed");
+ dset_id[i] = -1;
} /* end if */
else {
/* write dataset without extending it */
@@ -422,7 +422,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
PASSED();
- TESTING("read extended file images");
+ HL_TESTING2("read extended file images");
/* read open file images and verify data */
for (i = 0; i < open_images; i++) {
@@ -430,7 +430,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
if ((dset_id[i] < 0) || (file_id[i] < 0) || (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW )))
continue;
- /* open dataset in file image */
+ /* open dataset in file image */
if ((dset_id[i] = H5Dopen2(file_id[i], DSET_NAME, H5P_DEFAULT)) < 0)
FAIL_PUTS_ERROR("H5Dopen() failed");
@@ -445,8 +445,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* read dataset */
if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0)
FAIL_PUTS_ERROR("H5Dread() failed");
-
- /* compute number of elements in dataset */
+
+ /* compute number of elements in dataset */
n_values = (size_t)(dims3[0] * dims3[1]);
/* determine the number of rows in dataset */
@@ -457,8 +457,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
for (k = 0; k < nrow; k++)
if (data3[j * nrow + k ] != data4[j * nrow + k ])
FAIL_PUTS_ERROR("comparison of image values with original data failed");
-
- /* close dataspace */
+
+ /* close dataspace */
if (H5Sclose (file_space) < 0)
FAIL_PUTS_ERROR("H5Sclose() failed");
@@ -467,9 +467,9 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("H5Dclose() failed");
} /* end for */
- PASSED()
+ PASSED();
- TESTING("close file images");
+ HL_TESTING2("close file images");
/* close file images and release buffer if appropriate */
for (i = 0; i < open_images; i++) {
@@ -489,7 +489,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
VERIFY(buf_ptr[i] != NULL, "buffer pointer must be non NULL");
HDfree(buf_ptr[i]);
} /* end if */
-
+
} /* end for */
/* release temporary working buffers */
@@ -521,8 +521,8 @@ int main( void )
size_t open_images = 10; /* number of open file images */
size_t nflags = 8; /* number of flag combinations */
unsigned flags[8]; /* array with flag combinations */
-
- /* set flag combinations for testing */
+
+ /* set flag combinations for testing */
flags[0] = 0;
flags[1] = H5LT_FILE_IMAGE_DONT_RELEASE;
flags[2] = H5LT_FILE_IMAGE_DONT_COPY;
@@ -536,11 +536,11 @@ int main( void )
nerrors += test_file_image(open_images, nflags, flags) < 0? 1 : 0;
if (nerrors) goto error;
- printf("File image tests passed.\n");
+ HDprintf("File image tests passed.\n");
return 0;
error:
- printf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
return 1;
}
diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c
new file mode 100644
index 0000000..75028fb
--- /dev/null
+++ b/hl/test/test_h5do_compat.c
@@ -0,0 +1,286 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5hltest.h"
+#include "H5DOpublic.h"
+
+/* This test is a minimal test to ensure that the H5DO compatibility wrappers
+ * work correctly.
+ */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+
+#define FILE_NAME "h5do_compat.h5"
+#define DATASET_NAME "direct_chunk_io"
+
+#define NX 8
+#define CHUNK_NX 4
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_direct_chunk_write
+ *
+ * Purpose: Test the basic functionality of H5DOwrite_chunk
+ *
+ * Return: Success: An identifer for the dataset used in the tests
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+static hid_t
+create_dataset(hid_t fid)
+{
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hsize_t dims[1] = {NX};
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t chunk_dims[1] = {CHUNK_NX};
+ int data[NX];
+ int i;
+
+ /* Create a dataspace for the new dataset */
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ goto error;
+
+ /* Set up dataset creation parameters */
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl_id, 1, chunk_dims) < 0)
+ goto error;
+
+ /* Create a new dataset */
+ if ((did = H5Dcreate2(fid, DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Initialize the data */
+ for (i = 0; i < NX; i++)
+ data[i] = i;
+
+ /* Write the initialized data */
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ goto error;
+
+ /* Close everything */
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl_id) < 0)
+ goto error;
+
+ return did;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dcpl_id);
+ } H5E_END_TRY;
+
+ return H5I_INVALID_HID;
+
+} /* end create_dataset() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_direct_chunk_write
+ *
+ * Purpose: Test the basic functionality of H5DOwrite_chunk
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_direct_chunk_write(hid_t did)
+{
+ unsigned filter_mask = 0;
+ int chunk_data[CHUNK_NX];
+ hsize_t offset[1];
+ size_t data_size;
+ int i;
+
+ HL_TESTING2("H5DOwrite_chunk wrapper");
+
+ /* Set the size of the chunk data */
+ data_size = CHUNK_NX * sizeof(int);
+
+ /* Initialize the chunk data */
+ for (i = 0; i < CHUNK_NX; i++)
+ chunk_data[i] = (i * 10) + i;
+
+ /* Write the direct chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function.
+ */
+ offset[0] = 0;
+ for (i = 0; i < NX/CHUNK_NX; i++) {
+ if (H5DOwrite_chunk(did, H5P_DEFAULT, filter_mask, offset, data_size, chunk_data) < 0)
+ TEST_ERROR
+ offset[0] += CHUNK_NX;
+ }
+
+ PASSED();
+ return 0;
+
+error:
+ H5_FAILED();
+ return 1;
+} /* test_direct_chunk_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_direct_chunk_read
+ *
+ * Purpose: Test the basic functionality of H5DOread_chunk
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_direct_chunk_read(hid_t did)
+{
+ hid_t mem_sid = H5I_INVALID_HID;
+ hid_t file_sid = H5I_INVALID_HID;
+ hsize_t dims[1] = {NX};
+ hsize_t chunk_dims[1] = {CHUNK_NX};
+
+ unsigned filter_mask;
+ int chunk_data[CHUNK_NX]; /* Chunk read with H5DOread_chunk */
+ int check[CHUNK_NX]; /* Chunk read with H5Dread */
+ hsize_t offset[1];
+
+ hsize_t start[1]; /* Start of hyperslab */
+ hsize_t stride[1]; /* Stride of hyperslab */
+ hsize_t count[1]; /* Block count */
+ hsize_t block[1]; /* Block sizes */
+
+ int i,j;
+
+ HL_TESTING2("H5DOread_chunk wrapper");
+
+ /* Create dataspaces for reading */
+ if ((mem_sid = H5Screate_simple(1, chunk_dims, NULL)) < 0)
+ TEST_ERROR
+ if ((file_sid = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */
+ for (i = 0; i < NX/CHUNK_NX; i++) {
+
+ /* Select hyperslab for one chunk in the file */
+ start[0] = (hsize_t)i * CHUNK_NX;
+ stride[0] = 1;
+ count[0] = 1;
+ block[0] = CHUNK_NX;
+
+ /* Hyperslab selection equals single chunk */
+ if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Read the chunk back */
+ if (H5Dread(did, H5T_NATIVE_INT, mem_sid, file_sid, H5P_DEFAULT, check) < 0)
+ TEST_ERROR
+
+ /* Read the raw chunk back */
+ HDmemset(chunk_data, 0, CHUNK_NX * sizeof(int));
+ filter_mask = UINT_MAX;
+ offset[0] = (hsize_t)i * CHUNK_NX;
+ if (H5DOread_chunk(did, H5P_DEFAULT, offset, &filter_mask, chunk_data) < 0)
+ TEST_ERROR
+
+ /* Check filter mask return value */
+ if (filter_mask != 0)
+ TEST_ERROR
+
+ /* Check that the values are correct */
+ for (j = 0; j < CHUNK_NX; j++)
+ if (chunk_data[i] != check[i])
+ TEST_ERROR
+ }
+
+ /* Close */
+ if (H5Sclose(mem_sid) < 0)
+ TEST_ERROR
+ if (H5Sclose(file_sid) < 0)
+ TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(mem_sid);
+ H5Sclose(file_sid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return 1;
+} /* test_direct_chunk_read() */
+
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Test direct chunk write function H5DOwrite_chunk and
+ * chunk direct read function H5DOread_chunk
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+int main( void )
+{
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+
+ HDputs("Direct chunk read/write wrapper tests SKIPPED.");
+ HDputs("(Backward compatibility not configured)");
+ return EXIT_SUCCESS;
+
+#else
+
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ int nerrors = 0;
+
+ if ((fid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if ((did = create_dataset(fid)) < 0)
+ goto error;
+
+ nerrors += test_direct_chunk_write(did);
+ nerrors += test_direct_chunk_read(did);
+
+ if (H5Dclose(did) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
+
+ /* check for errors */
+ if (nerrors)
+ goto error;
+
+ HDputs("All direct chunk read/write wrapper tests passed.");
+ return EXIT_SUCCESS;
+
+error:
+ HDputs("*** TESTS FAILED ***");
+ return EXIT_FAILURE;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+} /* end main() */
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index c30b572..6d13419 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -75,11 +75,11 @@ int main(void)
nerrors += test_generate()<0 ?1:0;
if (nerrors) goto error;
- printf("All image tests passed.\n");
+ HDprintf("All image tests passed.\n");
return 0;
error:
- printf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
return 1;
}
@@ -169,7 +169,7 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- TESTING("indexed image");
+ HL_TESTING2("indexed image");
/* Write image */
if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf1 ) < 0 )
@@ -205,7 +205,7 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- TESTING("true color image");
+ HL_TESTING2("true color image");
/* Write image */
if ( H5IMmake_image_24bit( fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", buf2 ) )
@@ -232,7 +232,7 @@ static int test_simple(void)
*-------------------------------------------------------------------------
*/
- TESTING("pallete functions");
+ HL_TESTING2("pallete functions");
if ( H5IMget_npalettes( fid, IMAGE1_NAME, &npals ) < 0 )
goto out;
@@ -344,14 +344,14 @@ static int test_data(void)
if ((fid=H5Fcreate(FILE2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
goto out;
- printf("Testing read ascii image data and generate images\n");
+ HDprintf("Testing read ascii image data and generate images\n");
/*-------------------------------------------------------------------------
* read 8bit image data
*-------------------------------------------------------------------------
*/
- TESTING2("make indexed image");
+ HL_TESTING2("make indexed image");
/* read first data file */
if (read_data(DATA_FILE1,&width,&height)<0)
@@ -364,7 +364,7 @@ static int test_data(void)
PASSED();
- TESTING2("attaching palettes");
+ HL_TESTING2("attaching palettes");
/*-------------------------------------------------------------------------
* palette #1. rainbow palette. data is contained in "pal_rgb.h"
@@ -464,7 +464,7 @@ static int test_data(void)
*-------------------------------------------------------------------------
*/
- TESTING2("make true color image with pixel interlace");
+ HL_TESTING2("make true color image with pixel interlace");
/* read second data file */
if ((read_data(DATA_FILE2,&width,&height))<0)
@@ -481,7 +481,7 @@ static int test_data(void)
*-------------------------------------------------------------------------
*/
- TESTING2("make true color image with plane interlace");
+ HL_TESTING2("make true color image with plane interlace");
/* read third data file */
if ((read_data(DATA_FILE3,&width,&height))<0)
@@ -551,7 +551,7 @@ static int test_generate(void)
if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
goto out;
- printf("Testing read and process data and make indexed images\n");
+ HDprintf("Testing read and process data and make indexed images\n");
/*-------------------------------------------------------------------------
* read data; the file data format is described below
@@ -561,7 +561,7 @@ static int test_generate(void)
f = HDfopen( data_file, "r" ) ;
if ( f == NULL )
{
- printf( "Could not find file %s. Try set $srcdir \n", data_file );
+ HDprintf( "Could not find file %s. Try set $srcdir \n", data_file );
goto out;
}
@@ -602,11 +602,11 @@ static int test_generate(void)
if(fscanf( f, "%d %d %d", &imax, &jmax, &kmax ) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
if(fscanf( f, "%f %f %f", &valex, &xmin, &xmax ) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
@@ -627,7 +627,7 @@ static int test_generate(void)
goto out;
if(n_elements > INT_MAX / (int)sizeof(float))
goto out;
-
+
data = (float *)HDmalloc((size_t)n_elements * sizeof(float));
if(NULL == data)
goto out;
@@ -638,7 +638,7 @@ static int test_generate(void)
for ( i = 0; i < n_elements; i++ )
{
if(fscanf( f, "%f ", &value ) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
data[i] = value;
@@ -652,7 +652,7 @@ static int test_generate(void)
*-------------------------------------------------------------------------
*/
- TESTING2("make indexed image from all the data");
+ HL_TESTING2("make indexed image from all the data");
for ( i = 0; i < n_elements; i++ )
image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / (xmax - xmin ));
@@ -669,7 +669,7 @@ static int test_generate(void)
*-------------------------------------------------------------------------
*/
- TESTING2("make indexed image from land data");
+ HL_TESTING2("make indexed image from land data");
for ( i = 0; i < n_elements; i++ )
{
@@ -691,7 +691,7 @@ static int test_generate(void)
*-------------------------------------------------------------------------
*/
- TESTING2("make indexed image from sea data");
+ HL_TESTING2("make indexed image from sea data");
for ( i = 0; i < n_elements; i++ )
{
@@ -712,7 +712,7 @@ static int test_generate(void)
*-------------------------------------------------------------------------
*/
- TESTING2("attaching palettes");
+ HL_TESTING2("attaching palettes");
/* make a palette */
if ((H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb))<0)
@@ -797,37 +797,37 @@ static int read_data(const char* fname, /*IN*/
*/
if(NULL == (f = HDfopen(data_file, "r"))) {
- printf( "Could not open file %s. Try set $srcdir \n", data_file );
+ HDprintf( "Could not open file %s. Try set $srcdir \n", data_file );
goto out;
}
if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
if(fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
-
+
if(fscanf(f, "%d", &h) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
if(fscanf(f, "%s", str) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
if(fscanf(f, "%d", &w) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
@@ -861,7 +861,7 @@ static int read_data(const char* fname, /*IN*/
/* Read data elements */
for(i = 0; i < n_elements; i++) {
if(fscanf(f, "%d", &n) < 0 && HDferror(f)) {
- printf( "fscanf error in file %s.\n", data_file );
+ HDprintf( "fscanf error in file %s.\n", data_file );
goto out;
} /* end if */
image_data[i] = (unsigned char)n;
@@ -870,7 +870,7 @@ static int read_data(const char* fname, /*IN*/
/* Indicate success */
ret_val = 1;
-out:
+out:
if(f)
HDfclose(f);
@@ -917,7 +917,7 @@ static int read_palette(const char* fname,
/* open the input file */
if (!(file = HDfopen(data_file, "r")))
{
- printf( "Could not open file %s. Try set $srcdir \n", data_file );
+ HDprintf( "Could not open file %s. Try set $srcdir \n", data_file );
return -1;
}
diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c
index 12a226a..e3cde5d 100644
--- a/hl/test/test_ld.c
+++ b/hl/test/test_ld.c
@@ -29,12 +29,12 @@
#define DSET_ONE "DSET_ONE"
#define DSET_ALLOC_LATE "DSET_ALLOC_LATE"
#define DSET_ALLOC_EARLY "DSET_ALLOC_EARLY"
-#define DSET_TWO "DSET_TWO"
-#define TWO_DIM_1 4
-#define TWO_DIM_2 10
-#define DSET_CMPD "DSET_CMPD"
-#define DSET_CMPD_ESC "DSET_CMPD_ESC"
-#define DSET_CMPD_TWO "DSET_CMPD_TWO"
+#define DSET_TWO "DSET_TWO"
+#define TWO_DIM_1 4
+#define TWO_DIM_2 10
+#define DSET_CMPD "DSET_CMPD"
+#define DSET_CMPD_ESC "DSET_CMPD_ESC"
+#define DSET_CMPD_TWO "DSET_CMPD_TWO"
#define DSET_NULL "DSET_NULL"
#define DSET_SCALAR "DSET_SCALAR"
@@ -53,63 +53,63 @@
#define INVALID_ESC_FIELDS2 "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,."
#define INVALID_ESC_FIELDS3 "field2\\..\\,,b.a,field2\\..\\\\c,field4\\,.b\\,"
-/*
+/*
* Test variations (retained original) for one-dimensional dataset:
- * Varies from 10->13; 10->9, 10->10, 10->1, 10->11
+ * Varies from 10->13; 10->9, 10->10, 10->1, 10->11
*/
#define ONE_NTESTS 5
int one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1};
-/*
+/*
* Test variations (retained original) for two-dimensional dataset:
- * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10};
- * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10};
- * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10}
+ * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10};
+ * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10};
+ * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10}
*/
-#define TWO_NTESTS 9
+#define TWO_NTESTS 9
int two_tests[TWO_NTESTS][2] = { {2,2}, {2,-1}, {2,0},
- {-1,2}, {-1,-1}, {-1,0},
- {0,2}, {0,-1}, {0,0} };
+ {-1,2}, {-1,-1}, {-1,0},
+ {0,2}, {0,-1}, {0,0} };
/* Verify that the two input values are the same */
-#define VERIFY_EQUAL(_x, _y) \
-{ \
- long __x = (long)_x, __y = (long)_y; \
- if(__x != __y) TEST_ERROR \
+#define VERIFY_EQUAL(_x, _y) \
+{ \
+ long __x = (long)_x, __y = (long)_y; \
+ if(__x != __y) TEST_ERROR \
}
/* Temporary buffer for reading in the test file */
-#define TMP_BUF_SIZE 2048
+#define TMP_BUF_SIZE 2048
char g_tmp_buf[TMP_BUF_SIZE];
/* Macros for verifying compound fields */
/* Verify all fields */
-#define VERIFY_ELMTS_ALL(ent1, ent2) { \
- VERIFY_EQUAL(ent1.field1, ent2.field1); \
- VERIFY_EQUAL(ent1.field2.a, ent2.field2.a); \
- VERIFY_EQUAL(ent1.field2.b.a, ent2.field2.b.a); \
- VERIFY_EQUAL(ent1.field2.b.b, ent2.field2.b.b); \
- VERIFY_EQUAL(ent1.field2.b.c, ent2.field2.b.c); \
- VERIFY_EQUAL(ent1.field2.c, ent2.field2.c); \
- VERIFY_EQUAL(ent1.field3, ent2.field3); \
- VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
+#define VERIFY_ELMTS_ALL(ent1, ent2) { \
+ VERIFY_EQUAL(ent1.field1, ent2.field1); \
+ VERIFY_EQUAL(ent1.field2.a, ent2.field2.a); \
+ VERIFY_EQUAL(ent1.field2.b.a, ent2.field2.b.a); \
+ VERIFY_EQUAL(ent1.field2.b.b, ent2.field2.b.b); \
+ VERIFY_EQUAL(ent1.field2.b.c, ent2.field2.b.c); \
+ VERIFY_EQUAL(ent1.field2.c, ent2.field2.c); \
+ VERIFY_EQUAL(ent1.field3, ent2.field3); \
+ VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
}
/* Verify fields selected in VALID_FIELDS1 */
-#define VERIFY_ELMTS_VALID1(ent1, ent2) { \
- VERIFY_EQUAL(ent1.field1, ent2.field1); \
- VERIFY_EQUAL(ent1.field2_a, ent2.field2.a); \
- VERIFY_EQUAL(ent1.field3, ent2.field3); \
- VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
- VERIFY_EQUAL(ent1.field4.b, ent2.field4.b); \
+#define VERIFY_ELMTS_VALID1(ent1, ent2) { \
+ VERIFY_EQUAL(ent1.field1, ent2.field1); \
+ VERIFY_EQUAL(ent1.field2_a, ent2.field2.a); \
+ VERIFY_EQUAL(ent1.field3, ent2.field3); \
+ VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \
+ VERIFY_EQUAL(ent1.field4.b, ent2.field4.b); \
}
/* Verify fields selected in VALID_FIELDS2 */
-#define VERIFY_ELMTS_VALID2(ent1, ent2) { \
- VERIFY_EQUAL(ent1.field2_b_a, ent2.field2.b.a); \
- VERIFY_EQUAL(ent1.field2_c, ent2.field2.c); \
- VERIFY_EQUAL(ent1.field4_b, ent2.field4.b); \
+#define VERIFY_ELMTS_VALID2(ent1, ent2) { \
+ VERIFY_EQUAL(ent1.field2_b_a, ent2.field2.b.a); \
+ VERIFY_EQUAL(ent1.field2_c, ent2.field2.c); \
+ VERIFY_EQUAL(ent1.field4_b, ent2.field4.b); \
}
/* The types of 2-dimensional dataset: DSET_TWO or DSET_CMPD_TWO */
@@ -118,34 +118,34 @@ char g_tmp_buf[TMP_BUF_SIZE];
#define TWO_CMPD_VALID1 2 /* DSET_CMPD_TWO with VALID_FIELDS1 or VALID_ESC_FIELDS1 */
#define TWO_CMPD_VALID2 3 /* DSET_CMPD_TWO with VALID_FIELDS2 or VALID_ESC_FIELDS2 */
-#define VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) { \
- if(type == TWO_NONE) { \
- int *iib = (int *)_ldbuf; \
- int *ib = (int *)_buf; \
- \
- VERIFY_EQUAL(iib[k], ib[ind + n]) \
- } else if(type == TWO_CMPD_NULL) { \
- set_t *ccb = (set_t *)_ldbuf; \
- set_t *cb = (set_t *)_buf; \
- \
- VERIFY_ELMTS_ALL(ccb[k], cb[ind + n]) \
- } else if(type == TWO_CMPD_VALID1) { \
- test_valid_fields1 *vb1 = (test_valid_fields1 *)_ldbuf; \
- set_t *cb = (set_t *)_buf; \
- \
- VERIFY_ELMTS_VALID1(vb1[k], cb[ind + n]) \
- } else if(type == TWO_CMPD_VALID2) { \
- test_valid_fields2 *vb2 = (test_valid_fields2 *)_ldbuf; \
- set_t *cb = (set_t *)_buf; \
- \
- VERIFY_ELMTS_VALID2(vb2[k], cb[ind + n]) \
- } \
+#define VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) { \
+ if(type == TWO_NONE) { \
+ int *iib = (int *)_ldbuf; \
+ int *ib = (int *)_buf; \
+ \
+ VERIFY_EQUAL(iib[k], ib[ind + n]) \
+ } else if(type == TWO_CMPD_NULL) { \
+ set_t *ccb = (set_t *)_ldbuf; \
+ set_t *cb = (set_t *)_buf; \
+ \
+ VERIFY_ELMTS_ALL(ccb[k], cb[ind + n]) \
+ } else if(type == TWO_CMPD_VALID1) { \
+ test_valid_fields1 *vb1 = (test_valid_fields1 *)_ldbuf; \
+ set_t *cb = (set_t *)_buf; \
+ \
+ VERIFY_ELMTS_VALID1(vb1[k], cb[ind + n]) \
+ } else if(type == TWO_CMPD_VALID2) { \
+ test_valid_fields2 *vb2 = (test_valid_fields2 *)_ldbuf; \
+ set_t *cb = (set_t *)_buf; \
+ \
+ VERIFY_ELMTS_VALID2(vb2[k], cb[ind + n]) \
+ } \
}
/* Tests for test_LD_elmts_pipe() */
-#define ONE_TESTS 3
+#define ONE_TESTS 3
int onetests[ONE_TESTS] = {3, 9, 1};
-#define TWO_TESTS 5
+#define TWO_TESTS 5
int twotests[TWO_TESTS][2] = { {2,2}, {2,-1}, {2,0}, {-1,2}, {0,2} };
@@ -185,9 +185,9 @@ typedef struct set_t {
sub4_t field4;
} set_t;
-/* NOTE:
- * This will fail on heiwa and amani when VALID_FIELDS1 is "field1,field3,field4"
- * because of alignment problems:
+/* NOTE:
+ * This will fail on heiwa and amani when VALID_FIELDS1 is "field1,field3,field4"
+ * because of alignment problems:
* amani and heiwa - 8 byte alignment
* jam - 4 byte alignemnt
* This will need to be fixed in the library for H5Tget_native_type().
@@ -211,185 +211,185 @@ typedef struct test_valid_fields2 {
/* Temporary buffers for tests: test_LD_elmts_one() & test_LD_elmts_two() */
-#define TEST_BUF_SIZE 100
-int *iibuf; /* buffer for storing retrieved elements */
-int *ibuf; /* buffer for storing retrieved elements (integer) */
-set_t *cbuf; /* buffer for storing retrieved elemnets (compound) */
-set_t *ccbuf; /* buffer for storing retrieved elemnets (compound) */
-test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */
-test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */
-
-
-/*
+#define TEST_BUF_SIZE 100
+int *iibuf; /* buffer for storing retrieved elements */
+int *ibuf; /* buffer for storing retrieved elements (integer) */
+set_t *cbuf; /* buffer for storing retrieved elemnets (compound) */
+set_t *ccbuf; /* buffer for storing retrieved elemnets (compound) */
+test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */
+test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */
+
+
+/*
*********************************************************************************
*
* Testing for the High Level public routine: H5LDget_dset_dims()
- * 1) An invalid dataset id
- * 2) "DSET_ALLOC_EARLY": NULL cur_dims
- * 3) "DSET_ALLOC_LATE": nonNULL cur_dims
- * 4) "DSET_CMPD_TWO": nonNULL cur_dims
- * 5) "DSET_NULL": nonNULL cur_dims
- * 6) "DSET_SCALAR": nonNULL cur_dims
+ * 1) An invalid dataset id
+ * 2) "DSET_ALLOC_EARLY": NULL cur_dims
+ * 3) "DSET_ALLOC_LATE": nonNULL cur_dims
+ * 4) "DSET_CMPD_TWO": nonNULL cur_dims
+ * 5) "DSET_NULL": nonNULL cur_dims
+ * 6) "DSET_SCALAR": nonNULL cur_dims
*
*********************************************************************************
*/
static herr_t
test_LD_dims_params(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
- hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
+ hid_t fid=-1; /* file identifier */
+ hid_t did=-1; /* dataset identifier */
+ hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
+ hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
hid_t invalid_id = -1;
- herr_t ret; /* return value */
+ herr_t ret; /* return value */
const char *filename = H5_get_srcdir_filename(file);
- TESTING("H5LDget_dset_dims");
+ HL_TESTING2("H5LDget_dset_dims");
/* Open the copied file */
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* 1. Verify failure with negative dataset id
*/
H5E_BEGIN_TRY {
- ret = H5LDget_dset_dims(invalid_id, one_cur_dims);
+ ret = H5LDget_dset_dims(invalid_id, one_cur_dims);
} H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
- /*
+ /*
* 2. Verify failure for NULL cur_dims
*/
if((did = H5Dopen2(fid, DSET_ALLOC_EARLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
H5E_BEGIN_TRY {
- ret = H5LDget_dset_dims(did, NULL);
+ ret = H5LDget_dset_dims(did, NULL);
} H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* 3. Verify for nonNULL cur_dims
*/
if((did = H5Dopen2(fid, DSET_ALLOC_LATE, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
VERIFY_EQUAL(one_cur_dims[0], 10)
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* 4. Verify nonNULL cur_dims for a 2-dimensional dataset
*/
if((did = H5Dopen2(fid, DSET_CMPD_TWO, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5LDget_dset_dims(did, two_cur_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
VERIFY_EQUAL(two_cur_dims[0], TWO_DIM_1)
VERIFY_EQUAL(two_cur_dims[1], TWO_DIM_2)
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* 5. Verify nonNULL cur_dims for dataset with H5S_NULL dataspace
*/
one_cur_dims[0] = 0;
if((did = H5Dopen2(fid, DSET_NULL, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
VERIFY_EQUAL(one_cur_dims[0], 0)
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* 6. Verify nonNULL cur_dims for dataset with H5S_SCALAR dataspace
*/
one_cur_dims[0] = 0;
if((did = H5Dopen2(fid, DSET_SCALAR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
VERIFY_EQUAL(one_cur_dims[0], 0)
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Dclose(did);
- H5Fclose(fid);
+ H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
return(-1);
} /* test_LD_dims_params() */
-
-/*
+
+/*
*********************************************************************************
*
* Testing for the High Level public routine: H5LDget_dset_dims()
* Verify that the dimension sizes retrieved via H5LDget_dset_dims() are correct
* for the following cases:
*
- * DSET_ONE: one-dimensional dataset
- * 1. Increase dims[0]
- * 2. Decrease dims[0]
- * 3. same dims[0]
- * 4. Decrease dims[0]
- * 5. Increase dims[0]
+ * DSET_ONE: one-dimensional dataset
+ * 1. Increase dims[0]
+ * 2. Decrease dims[0]
+ * 3. same dims[0]
+ * 4. Decrease dims[0]
+ * 5. Increase dims[0]
*
- * one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1}
- * Varies from 10->3; 10->9, 10->10, 10->1, 10->11
+ * one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1}
+ * Varies from 10->3; 10->9, 10->10, 10->1, 10->11
*
- * DSET_TWO: two-dimensional dataset
- * 1. Increase dims[0], increase dims[1]
- * 2. Increase dims[0], decrease dims[1]
- * 3. Increase dims[0], same dims[1]
- * 4. Decrease dims[0], increase dims[1]
- * 5. Decrease dims[0], decrease dims[1]
- * 6. Decrease dims[0], same dims[1]
- * 7. same dims[0], increase dims[1]
- * 8. same dims[0], decrease dims[1]
- * 9. same dims[0], same dims[1]
+ * DSET_TWO: two-dimensional dataset
+ * 1. Increase dims[0], increase dims[1]
+ * 2. Increase dims[0], decrease dims[1]
+ * 3. Increase dims[0], same dims[1]
+ * 4. Decrease dims[0], increase dims[1]
+ * 5. Decrease dims[0], decrease dims[1]
+ * 6. Decrease dims[0], same dims[1]
+ * 7. same dims[0], increase dims[1]
+ * 8. same dims[0], decrease dims[1]
+ * 9. same dims[0], same dims[1]
*
- * two_tests[TWO_NTESTS][2] = { {2,2}, {2,-1}, {2,0},
- * {-1,2}, {-1,-1}, {-1,0},
- * {0,2}, {0,-1}, {0,0} }
- * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10};
- * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10};
- * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10}
+ * two_tests[TWO_NTESTS][2] = { {2,2}, {2,-1}, {2,0},
+ * {-1,2}, {-1,-1}, {-1,0},
+ * {0,2}, {0,-1}, {0,0} }
+ * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10};
+ * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10};
+ * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10}
*
*********************************************************************************
*/
static herr_t
test_LD_dims(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hsize_t one_prev_dims[1]; /* original dimension sizes for 1-dimensonal dataset */
- hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
- hsize_t one_ext_dims[1]; /* extended dimension sizes for 1-dimensonal dataset */
- hsize_t two_prev_dims[2]; /* original dimension sizes for 2-dimensional dataset */
- hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
- hsize_t two_ext_dims[2]; /* extended dimension sizes for 2-dimensional dataset*/
- int i; /* local index variable */
-
- TESTING("H5LDget_dset_dims with H5Dset_extent");
+ hid_t fid=-1; /* file identifier */
+ hid_t did=-1; /* dataset identifier */
+ hsize_t one_prev_dims[1]; /* original dimension sizes for 1-dimensonal dataset */
+ hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */
+ hsize_t one_ext_dims[1]; /* extended dimension sizes for 1-dimensonal dataset */
+ hsize_t two_prev_dims[2]; /* original dimension sizes for 2-dimensional dataset */
+ hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */
+ hsize_t two_ext_dims[2]; /* extended dimension sizes for 2-dimensional dataset*/
+ int i; /* local index variable */
+
+ HL_TESTING2("H5LDget_dset_dims with H5Dset_extent");
/* Make a copy of the test file */
if(h5_make_local_copy(file, COPY_FILENAME) < 0)
@@ -397,75 +397,75 @@ test_LD_dims(const char *file)
/* Open the copied file */
if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* Testing with one-dimensional dataset: DSET_ONE
*/
if((did = H5Dopen2(fid, DSET_ONE, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve dimension sizes */
if(H5LDget_dset_dims(did, one_prev_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
for(i = 0; i < ONE_NTESTS; i++) {
- /* Set up the extended dimension sizes */
- one_ext_dims[0] = (hsize_t)((int)one_prev_dims[0] + one_tests[i]);
+ /* Set up the extended dimension sizes */
+ one_ext_dims[0] = (hsize_t)((int)one_prev_dims[0] + one_tests[i]);
- /* Change the dimension size */
- if(H5Dset_extent(did, one_ext_dims) < 0)
- FAIL_STACK_ERROR
+ /* Change the dimension size */
+ if(H5Dset_extent(did, one_ext_dims) < 0)
+ FAIL_STACK_ERROR
- /* Retrieve the dimension size */
- if(H5LDget_dset_dims(did, one_cur_dims) < 0)
- FAIL_STACK_ERROR
+ /* Retrieve the dimension size */
+ if(H5LDget_dset_dims(did, one_cur_dims) < 0)
+ FAIL_STACK_ERROR
- /* Verify that the retrieved dimension size is correct as expected */
- VERIFY_EQUAL(one_cur_dims[0], one_ext_dims[0])
+ /* Verify that the retrieved dimension size is correct as expected */
+ VERIFY_EQUAL(one_cur_dims[0], one_ext_dims[0])
}
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* Testing with two-dimensional dataset: DSET_TWO
*/
if((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the dimension sizes */
if(H5LDget_dset_dims(did, two_prev_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
for(i = 0; i < TWO_NTESTS; i++) {
- /* Set up the extended dimension sizes */
- two_ext_dims[0] = (hsize_t)((int)two_prev_dims[0] + two_tests[i][0]);
- two_ext_dims[1] = (hsize_t) ((int)two_prev_dims[1] + two_tests[i][1]);
+ /* Set up the extended dimension sizes */
+ two_ext_dims[0] = (hsize_t)((int)two_prev_dims[0] + two_tests[i][0]);
+ two_ext_dims[1] = (hsize_t) ((int)two_prev_dims[1] + two_tests[i][1]);
- /* Change the dimension sizes */
- if(H5Dset_extent(did, two_ext_dims) < 0)
- FAIL_STACK_ERROR
+ /* Change the dimension sizes */
+ if(H5Dset_extent(did, two_ext_dims) < 0)
+ FAIL_STACK_ERROR
- /* Retrieve the dimension sizes */
- if(H5LDget_dset_dims(did, two_cur_dims) < 0)
- FAIL_STACK_ERROR
+ /* Retrieve the dimension sizes */
+ if(H5LDget_dset_dims(did, two_cur_dims) < 0)
+ FAIL_STACK_ERROR
- /* Verify that the retrieved dimension sizes are correct as expected */
- VERIFY_EQUAL(two_cur_dims[0], two_ext_dims[0])
- VERIFY_EQUAL(two_cur_dims[1], two_ext_dims[1])
+ /* Verify that the retrieved dimension sizes are correct as expected */
+ VERIFY_EQUAL(two_cur_dims[0], two_ext_dims[0])
+ VERIFY_EQUAL(two_cur_dims[1], two_ext_dims[1])
} /* end TWO_NTESTS */
/* Close the dataset */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Remove the copied file */
HDremove(COPY_FILENAME);
@@ -475,172 +475,172 @@ test_LD_dims(const char *file)
error:
H5E_BEGIN_TRY {
- H5Dclose(did);
- H5Fclose(fid);
+ H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
return(-1);
} /* test_LD_dims() */
-
-/*
+
+/*
**********************************************************************************
*
* Testing for the High Level public routine: H5LDget_dset_type_size()
* Verify that the data type size returned via H5LDget_dset_type_size()
* are correct for the following cases:
*
- * Verify failure for an invalid dataset id
+ * Verify failure for an invalid dataset id
*
- * DSET_CMPD: one-dimensional dataset with compound type
- * 1. The whole element
- * 2. VALID_FIELDS1: "field1,field2.a,field3,field4"
- * 3. VALID_FIELDS2: "field2.b.a,field2.c,field4.b"
- * 4. INVALID_FIELDS1: "field2.k.a,field2.c,field4.k"
- * 5. INVALID_FIELDS2: "field2.b.a,field2.c,field4.b."
- * 6. INVALID_FIELDS3: "field2.b.a,,field2.c,field4.b"
+ * DSET_CMPD: one-dimensional dataset with compound type
+ * 1. The whole element
+ * 2. VALID_FIELDS1: "field1,field2.a,field3,field4"
+ * 3. VALID_FIELDS2: "field2.b.a,field2.c,field4.b"
+ * 4. INVALID_FIELDS1: "field2.k.a,field2.c,field4.k"
+ * 5. INVALID_FIELDS2: "field2.b.a,field2.c,field4.b."
+ * 6. INVALID_FIELDS3: "field2.b.a,,field2.c,field4.b"
*
- * DSET_CMPD_ESC: one-dimensional dataset with compound type and
- * member names with escape/separator characters
- * 1. The whole element
- * 2. VALID_ESC_FIELDS1: "field\\,1,field2\\..\\.a,field\\\\3,field4\\,"
- * 3. VALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,"
- * 4. INVALID_ESC_FIELDS1: "field2\\..\\,k.a,field2\\..\\\\c,field4\\,.k\\,"
- * 5. INVALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,."
- * 6. INVALID_ESC_FIELDS3: "field2\\..\\,,b.a,field2\\..\\\\c,field4\\,.b\\,"
+ * DSET_CMPD_ESC: one-dimensional dataset with compound type and
+ * member names with escape/separator characters
+ * 1. The whole element
+ * 2. VALID_ESC_FIELDS1: "field\\,1,field2\\..\\.a,field\\\\3,field4\\,"
+ * 3. VALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,"
+ * 4. INVALID_ESC_FIELDS1: "field2\\..\\,k.a,field2\\..\\\\c,field4\\,.k\\,"
+ * 5. INVALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,."
+ * 6. INVALID_ESC_FIELDS3: "field2\\..\\,,b.a,field2\\..\\\\c,field4\\,.b\\,"
*
**********************************************************************************
*/
static int
test_LD_size(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t dtid=-1; /* dataset's datatype identifier */
+ hid_t fid=-1; /* file identifier */
+ hid_t did=-1; /* dataset identifier */
+ hid_t dtid=-1; /* dataset's datatype identifier */
hid_t invalid_id=-1;
- hid_t memb0_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb1_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb2_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb3_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb_tid=-1; /* type identifier for a member in the compound type */
- hid_t memb_tid2=-1; /* type identifier for a member in the compound type */
- size_t dsize; /* size of the dataset's datatype */
- size_t ck_dsize; /* size of the dataset's datatype to be checked against */
+ hid_t memb0_tid=-1; /* type identifier for a member in the compound type */
+ hid_t memb1_tid=-1; /* type identifier for a member in the compound type */
+ hid_t memb2_tid=-1; /* type identifier for a member in the compound type */
+ hid_t memb3_tid=-1; /* type identifier for a member in the compound type */
+ hid_t memb_tid=-1; /* type identifier for a member in the compound type */
+ hid_t memb_tid2=-1; /* type identifier for a member in the compound type */
+ size_t dsize; /* size of the dataset's datatype */
+ size_t ck_dsize; /* size of the dataset's datatype to be checked against */
const char *filename = H5_get_srcdir_filename(file);
- TESTING("H5LDget_dset_type_size");
+ HL_TESTING2("H5LDget_dset_type_size");
/* Open the file */
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* Verify failure with an invalid dataset id
*/
H5E_BEGIN_TRY {
- dsize = H5LDget_dset_type_size(invalid_id, NULL);
+ dsize = H5LDget_dset_type_size(invalid_id, NULL);
} H5E_END_TRY;
VERIFY_EQUAL(dsize, 0)
- /*
+ /*
* Testing one-dimensional dataset with compound datatype:
- * DSET_CMPD
+ * DSET_CMPD
*/
/* Open dataset DSET_CMPD */
if((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Return size of the whole element */
if((dsize = H5LDget_dset_type_size(did, NULL)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the dataset's datatype and then its datatype size */
if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
FAIL_STACK_ERROR
if((ck_dsize = H5Tget_size(dtid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Verify case #1 */
VERIFY_EQUAL(dsize, ck_dsize)
/* Get datatype id for each member */
if((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field1" */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2" */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field3" */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4" */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Obtain size for VALID_FIELDS1: "field1,field2.a,field3,field4" */
if((dsize = H5LDget_dset_type_size(did, VALID_FIELDS1)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the datatype size for "field1" */
if((ck_dsize = H5Tget_size(memb0_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2.a" */
if((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field3" */
if((ck_dsize += H5Tget_size(memb2_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4" */
if((ck_dsize += H5Tget_size(memb3_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Verify case #2 */
VERIFY_EQUAL(dsize, ck_dsize)
/* Obtain datatype size for VALID_FIELDS2: "field2.b.a,field2.c,field4.b" */
if((dsize = H5LDget_dset_type_size(did, VALID_FIELDS2)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the datatype size for "field2.b.a" */
if((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize = H5Tget_size(memb_tid2)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2.c" */
if((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4.b" */
if((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Verify case #3 */
VERIFY_EQUAL(dsize, ck_dsize)
/*
- * Verify failure for the following invalid nested fields:
- * INVALID_FIELDS1: "field2.k.a,field2.c,field4.k"
+ * Verify failure for the following invalid nested fields:
+ * INVALID_FIELDS1: "field2.k.a,field2.c,field4.k"
* INVALID_FIELDS2: "field2.b.a,field2.c,field4.b."
* INVALID_FIELDS3: "field2.b.a,,field2.c,field4.b"
*/
@@ -655,119 +655,119 @@ test_LD_size(const char *file)
/* Verify failure for case #6 */
dsize = H5LDget_dset_type_size(did, INVALID_FIELDS3);
VERIFY_EQUAL(dsize, 0)
-
+
/* Closing */
if(H5Tclose(memb0_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb1_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb2_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb3_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(dtid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* Testing one-dimensional dataset with compound datatype and
- * member names consisting of escape/separator characters:
- * DSET_CMPD_ESC
+ * member names consisting of escape/separator characters:
+ * DSET_CMPD_ESC
*/
/* Open dataset DSET_CMPD_ESC */
if((did = H5Dopen2(fid, DSET_CMPD_ESC, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Return size of the whole element */
if((dsize = H5LDget_dset_type_size(did, NULL)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the dataset's datatype and then its datatype size */
if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
FAIL_STACK_ERROR
if((ck_dsize = H5Tget_size(dtid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Verify case #1 */
VERIFY_EQUAL(dsize, ck_dsize)
/* Get datatype id for each member */
if((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field,1" */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2." */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field\3" */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4," */
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Obtain size for VALID_ESC_FIELDS1: "field\\,1,field2\\..\\.a,field\\\\3,field4\\," */
if((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS1)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the datatype size for "field\\,1" */
if((ck_dsize = H5Tget_size(memb0_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2\\..\\.a" */
if((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field\\\\3" */
if((ck_dsize += H5Tget_size(memb2_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4\\," */
if((ck_dsize += H5Tget_size(memb3_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Verify case #2 */
VERIFY_EQUAL(dsize, ck_dsize)
- /* Obtain datatype size for VALID_ESC_FIELDS2:
- "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\," */
+ /* Obtain datatype size for VALID_ESC_FIELDS2:
+ "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\," */
if((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS2)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the datatype size for "field2\..,b.a" */
if((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize = H5Tget_size(memb_tid2)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field2\..\\c" */
if((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Add the datatype size for "field4\,.b\," */
if((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((ck_dsize += H5Tget_size(memb_tid)) == 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Verify case #3 */
VERIFY_EQUAL(dsize, ck_dsize)
/*
- * Verify failure for the following invalid nested fields:
+ * Verify failure for the following invalid nested fields:
* INVALID_ESC_FIELDS1: "field2\..\,k.a,field2\..\\c,field4\,.k\,"
* INVALID_ESC_FIELDS2: "field2\..\,b.a,field2\..\\c,field4\,.b\,."
* INVALID_ESC_FIELDS3: "field2\..\,,b.a,field2\..\\c,field4\,.b\,"
@@ -786,90 +786,90 @@ test_LD_size(const char *file)
/* Closing */
if(H5Tclose(memb0_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb1_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb2_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(memb3_tid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Tclose(dtid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Tclose(memb0_tid);
- H5Tclose(memb1_tid);
- H5Tclose(memb2_tid);
- H5Tclose(memb3_tid);
- H5Tclose(memb_tid);
- H5Tclose(memb_tid2);
- H5Tclose(dtid);
- H5Dclose(did);
- H5Fclose(fid);
+ H5Tclose(memb0_tid);
+ H5Tclose(memb1_tid);
+ H5Tclose(memb2_tid);
+ H5Tclose(memb3_tid);
+ H5Tclose(memb_tid);
+ H5Tclose(memb_tid2);
+ H5Tclose(dtid);
+ H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
return(-1);
} /* test_LD_size() */
-
-/*
+
+/*
**************************************************************************************
* Testing for the High Level public routine: H5LDget_dset_elmts()
- * Verify failures when calling H5LDget_dset_elmts() with the following
- * invalid conditions:
+ * Verify failures when calling H5LDget_dset_elmts() with the following
+ * invalid conditions:
*
- * A. DSET_TWO: two-dimensional dataset
- * 1. CUR_DIMS and PREV_DIMS are NULL
- * 2. PREV_DIMS is NULL
- * 3. CUR_DIMS is NULL
- * 4. FIELDS is nonnull but the dataset is not compound datatype
- * 5. BUF is NULL
- * 6. CUR_DIMS is not greater than PREV_DIMS
+ * A. DSET_TWO: two-dimensional dataset
+ * 1. CUR_DIMS and PREV_DIMS are NULL
+ * 2. PREV_DIMS is NULL
+ * 3. CUR_DIMS is NULL
+ * 4. FIELDS is nonnull but the dataset is not compound datatype
+ * 5. BUF is NULL
+ * 6. CUR_DIMS is not greater than PREV_DIMS
*
- * B. DSET_CMPD: one-dimensional dataset with compound type
- * 1. Invalid dataset id
- * 2. FIELDS are not valid members in the compound type
+ * B. DSET_CMPD: one-dimensional dataset with compound type
+ * 1. Invalid dataset id
+ * 2. FIELDS are not valid members in the compound type
*
**************************************************************************************
*/
static int
test_LD_elmts_invalid(const char *file)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t sid=-1; /* dataspace identifier */
+ hid_t fid=-1; /* file identifier */
+ hid_t did=-1; /* dataset identifier */
+ hid_t sid=-1; /* dataspace identifier */
hid_t invalid_id=-1;
- int ret; /* return value */
- hsize_t cur_dims[2]; /* current dimension sizes of the dataset */
- hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
- char tbuf[2]; /* temporary buffer for testing */
- int ndims; /* # of dimension sizes */
- int i; /* local index variable */
+ int ret; /* return value */
+ hsize_t cur_dims[2]; /* current dimension sizes of the dataset */
+ hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
+ char tbuf[2]; /* temporary buffer for testing */
+ int ndims; /* # of dimension sizes */
+ int i; /* local index variable */
const char *filename = H5_get_srcdir_filename(file);
- TESTING("H5LDget_dset_elmts on invalid conditions");
+ HL_TESTING2("H5LDget_dset_elmts on invalid conditions");
/* Open the copied file */
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* Testing two-dimensional dataset: DSET_TWO
*/
/* Open dataset: DSET_TWO */
if((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Verify failure from case #1: cur_dims and prev_dims are NULL */
ret = H5LDget_dset_elmts(did, NULL, NULL, NULL, NULL);
@@ -884,15 +884,15 @@ test_LD_elmts_invalid(const char *file)
VERIFY_EQUAL(ret, FAIL)
if((sid = H5Dget_space(did)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the # of dimensions and current dimension sizes */
if((ndims = H5Sget_simple_extent_dims(sid, cur_dims, NULL)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Set up valid cur_dims and prev_dims */
for(i = 0; i < ndims; i++)
- prev_dims[i] = cur_dims[i] - 1;
+ prev_dims[i] = cur_dims[i] - 1;
/* Verify failure from case #4: FIELDS is nonNULL but the dataset is not compound datatype */
ret = H5LDget_dset_elmts(did, prev_dims, cur_dims, "field1", tbuf);
@@ -910,26 +910,26 @@ test_LD_elmts_invalid(const char *file)
/* Close DSET_TWO */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /*
+ /*
* Testing one-dimensional dataset with compound datatype:
- * DSET_CMPD
+ * DSET_CMPD
*/
/* Verify failure from case #1: an invalid dataset id */
H5E_BEGIN_TRY {
- ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf);
+ ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf);
} H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
/* Open dataset: DSET_CMPD */
if((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the current dimension sizes */
if(H5LDget_dset_dims(did, cur_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Set up valid cur_dims, prev_dims */
prev_dims[0] = cur_dims[0] - 1;
@@ -940,118 +940,118 @@ test_LD_elmts_invalid(const char *file)
/* Close DSET_CMPD */
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Sclose(sid);
- H5Dclose(did);
- H5Fclose(fid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
return(-1);
} /* test_LD_elmts_invalid() */
-
-/*
+
+/*
**************************************************************************************
* Testing for the High Level public routine: H5LDget_dset_elmts()
- * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected
- * when the dataset's dimension sizes are changed according to one_tests[]:
+ * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected
+ * when the dataset's dimension sizes are changed according to one_tests[]:
*
- * one-dimensional dataset :
- * DSET_ONE with NULL fields
- * DSET_CMPD with fields: NULL, VALID_FIELDS1, VALID_FIELDS2
- * DSET_CMPD_ESC with fields: NULL, VALID_ESC_FIELDS1, VALID_ESC_FIELDS2
- *
- * case #1. increase dims[0]
- * case #2. decrease dims[0] (failure)
- * case #3. same dims[0] (failure)
- * case #4. decrease dims[0] (failure)
- * case #5. increase dims[0]
+ * one-dimensional dataset :
+ * DSET_ONE with NULL fields
+ * DSET_CMPD with fields: NULL, VALID_FIELDS1, VALID_FIELDS2
+ * DSET_CMPD_ESC with fields: NULL, VALID_ESC_FIELDS1, VALID_ESC_FIELDS2
+ *
+ * case #1. increase dims[0]
+ * case #2. decrease dims[0] (failure)
+ * case #3. same dims[0] (failure)
+ * case #4. decrease dims[0] (failure)
+ * case #5. increase dims[0]
*
**************************************************************************************
*/
static herr_t
test_LD_elmts_one(const char *file, const char *dname, const char *fields)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t dtype=-1; /* dataset's data type */
- hsize_t ext_dims[1]; /* extended dimension sizes of the dataset */
- hsize_t prev_dims[1]; /* previous dimension sizes of the dataset */
- int i, j; /* local index variable */
- int ret = 0; /* return value */
+ hid_t fid=-1; /* file identifier */
+ hid_t did=-1; /* dataset identifier */
+ hid_t dtype=-1; /* dataset's data type */
+ hsize_t ext_dims[1]; /* extended dimension sizes of the dataset */
+ hsize_t prev_dims[1]; /* previous dimension sizes of the dataset */
+ int i, j; /* local index variable */
+ int ret = 0; /* return value */
- TESTING("H5LDget_dset_elmts: one-dimensional dataset");
+ HL_TESTING2("H5LDget_dset_elmts: one-dimensional dataset");
/* Copy the test file */
if(h5_make_local_copy(file, COPY_FILENAME) < 0)
TEST_ERROR
for(i = 0; i < TEST_BUF_SIZE; i++) {
- cbuf[i].field1 = i;
- cbuf[i].field2.a = i;
- cbuf[i].field2.b.a = i;
- cbuf[i].field2.b.b = i;
- cbuf[i].field2.b.c = i;
- cbuf[i].field2.c = i;
- cbuf[i].field3 = (double)i;
- cbuf[i].field4.a = i;
- cbuf[i].field4.b = i;
- ibuf[i] = i;
+ cbuf[i].field1 = i;
+ cbuf[i].field2.a = i;
+ cbuf[i].field2.b.a = i;
+ cbuf[i].field2.b.b = i;
+ cbuf[i].field2.b.c = i;
+ cbuf[i].field2.c = i;
+ cbuf[i].field3 = (double)i;
+ cbuf[i].field4.a = i;
+ cbuf[i].field4.b = i;
+ ibuf[i] = i;
} /* end for */
/* Open the copied file */
if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Open the dataset */
if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the dataset's data type */
if((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get current dimension sizes before extending the dataset's dimension sizes */
if(H5LDget_dset_dims(did, prev_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Loop through different variations of extending the dataset */
for(i = 0; i < ONE_NTESTS; i++) {
- HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
- HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
- HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
-
- ext_dims[0] = (hsize_t)((int)prev_dims[0] + one_tests[i]);
-
- /* Change the dimension sizes of the dataset */
- if(H5Dset_extent(did, ext_dims) < 0)
- FAIL_STACK_ERROR
-
- /* Initialize data */
- if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
- FAIL_STACK_ERROR
- } /* end if */
+ HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
+ HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
+ HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
+ HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
+
+ ext_dims[0] = (hsize_t)((int)prev_dims[0] + one_tests[i]);
+
+ /* Change the dimension sizes of the dataset */
+ if(H5Dset_extent(did, ext_dims) < 0)
+ FAIL_STACK_ERROR
+
+ /* Initialize data */
+ if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
+ if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end if */
else if(!HDstrcmp(dname, DSET_ONE)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
- FAIL_STACK_ERROR
- } /* end if */
-
- /* There are changes in dimension sizes */
- if(one_tests[i] > 0) {
- if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
- if(fields) {
+ if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end if */
+
+ /* There are changes in dimension sizes */
+ if(one_tests[i] > 0) {
+ if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
+ if(fields) {
if(!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) {
/* Retrieve the elmemts in BUF */
if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0)
@@ -1067,24 +1067,24 @@ test_LD_elmts_one(const char *file, const char *dname, const char *fields)
VERIFY_ELMTS_VALID2(vbuf2[j], cbuf[prev_dims[0] + (hsize_t)j])
} /* end else-if */
else
- TEST_ERROR
- } /* end if */
+ TEST_ERROR
+ } /* end if */
else {
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
- TEST_ERROR
- for(j = 0; j < one_tests[i]; j++)
- VERIFY_ELMTS_ALL(ccbuf[j], cbuf[prev_dims[0] + (hsize_t)j])
- } /* end else-if */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
+ TEST_ERROR
+ for(j = 0; j < one_tests[i]; j++)
+ VERIFY_ELMTS_ALL(ccbuf[j], cbuf[prev_dims[0] + (hsize_t)j])
+ } /* end else-if */
+ } /* end if */
else {
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
- TEST_ERROR
- for(j = 0; j < one_tests[i]; j++)
- VERIFY_EQUAL(iibuf[j], ibuf[prev_dims[0] + (hsize_t)j])
- } /* end else */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
+ TEST_ERROR
+ for(j = 0; j < one_tests[i]; j++)
+ VERIFY_EQUAL(iibuf[j], ibuf[prev_dims[0] + (hsize_t)j])
+ } /* end else */
+ } /* end if */
else {
/* Verify failure when changes between prev_dims and ext_dims are same/decrease */
ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf);
@@ -1108,56 +1108,56 @@ test_LD_elmts_one(const char *file, const char *dname, const char *fields)
error:
H5E_BEGIN_TRY {
- H5Tclose(dtype);
- H5Dclose(did);
- H5Fclose(fid);
+ H5Tclose(dtype);
+ H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
return(-1);
} /* test_LD_elmts_one() */
-
+
/*
**************************************************************************************
*
- * Helper routine to verify elements of a 2-dimensional dataset
- * _ldbuf contains the elements retrieved via H5LDget_dset_elmts()
- * _buf contains the data written to the dataset
+ * Helper routine to verify elements of a 2-dimensional dataset
+ * _ldbuf contains the elements retrieved via H5LDget_dset_elmts()
+ * _buf contains the data written to the dataset
*
- * e.g. prev_dims[2] = {4, 6}; ext_dims[2] = {6, 10}
- * elements marked in 'v' in _buf are compared to elements in _ldbuf
- * 0 1 2 3 4 5 | 6 7 8 9
- * 0 | v v v v
- * 1 | v v v v
- * 2 | v v v v
- * 3 | v v v v
- * ---------------------
- * 4 v v v v v v v v v v
- * 5 v v v v v v v v v v
+ * e.g. prev_dims[2] = {4, 6}; ext_dims[2] = {6, 10}
+ * elements marked in 'v' in _buf are compared to elements in _ldbuf
+ * 0 1 2 3 4 5 | 6 7 8 9
+ * 0 | v v v v
+ * 1 | v v v v
+ * 2 | v v v v
+ * 3 | v v v v
+ * ---------------------
+ * 4 v v v v v v v v v v
+ * 5 v v v v v v v v v v
*
**************************************************************************************
*/
static herr_t
verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf)
{
- int k, m; /* Local index variable */
+ int k, m; /* Local index variable */
- k = 0;
+ k = 0;
for(m = 0; m < (int)ext_dims[0]; m++) {
- int n, ind; /* Local index variable */
-
- ind = m * (int)ext_dims[1];
- if(m < (int)prev_dims[0]) {
- for(n = (int)prev_dims[1]; n < (int)ext_dims[1]; n++) {
- VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
- ++k;
- } /* end for */
- } /* end if */
- else {
- for(n = 0; n < (int)ext_dims[1]; n++) {
- VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
- ++k;
- } /* end for */
- } /* end else */
+ int n, ind; /* Local index variable */
+
+ ind = m * (int)ext_dims[1];
+ if(m < (int)prev_dims[0]) {
+ for(n = (int)prev_dims[1]; n < (int)ext_dims[1]; n++) {
+ VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
+ ++k;
+ } /* end for */
+ } /* end if */
+ else {
+ for(n = 0; n < (int)ext_dims[1]; n++) {
+ VERIFY_ELMTS(type, k, ind, _ldbuf, _buf)
+ ++k;
+ } /* end for */
+ } /* end else */
} /* end for */
return(0);
@@ -1166,106 +1166,106 @@ error:
return(-1);
} /* verify_elmts_two() */
-
-/*
+
+/*
**************************************************************************************
* Testing for the High Level public routine: H5LDget_dset_elmts()
- * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected when
- * the datset's dimension sizes are changed accordingly to two_tests[]:
+ * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected when
+ * the datset's dimension sizes are changed accordingly to two_tests[]:
*
- * two-dimensional dataset: DSET_TWO with NULL fields
- * DSET_CMPD_TWO with fields: NULL, VALID_FIELDS1, VALID_FIELDS2
+ * two-dimensional dataset: DSET_TWO with NULL fields
+ * DSET_CMPD_TWO with fields: NULL, VALID_FIELDS1, VALID_FIELDS2
+ *
+ * dims[0] dims[1]
+ * ------- -------
+ * case #1: increase increase
+ * case #2: increase decrease
+ * case #3: increase same
+ * case #4: decrease increase
+ * case #5: decrease decrease (failure)
+ * case #6: decrease same (failure)
+ * case #7: same increase
+ * case #8: same decrease (failure)
+ * case #9: same same (failure)
*
- * dims[0] dims[1]
- * ------- -------
- * case #1: increase increase
- * case #2: increase decrease
- * case #3: increase same
- * case #4: decrease increase
- * case #5: decrease decrease (failure)
- * case #6: decrease same (failure)
- * case #7: same increase
- * case #8: same decrease (failure)
- * case #9: same same (failure)
- *
**************************************************************************************
*/
static herr_t
test_LD_elmts_two(const char *file, const char *dname, const char *fields)
{
- hid_t fid=-1; /* file identifier */
- hid_t did=-1; /* dataset identifier */
- hid_t dtype=-1; /* dataset's data type */
- hsize_t ext_dims[2]; /* extended dimension sizes of the dataset */
- hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
- int i; /* local index variable */
- int ret = 0; /* return value */
+ hid_t fid=-1; /* file identifier */
+ hid_t did=-1; /* dataset identifier */
+ hid_t dtype=-1; /* dataset's data type */
+ hsize_t ext_dims[2]; /* extended dimension sizes of the dataset */
+ hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */
+ int i; /* local index variable */
+ int ret = 0; /* return value */
- TESTING("H5LDget_dset_elmts: two-dimensional dataset");
+ HL_TESTING2("H5LDget_dset_elmts: two-dimensional dataset");
/* Copy the test file */
if(h5_make_local_copy(file, COPY_FILENAME) < 0)
TEST_ERROR
for(i = 0; i < TEST_BUF_SIZE; i++) {
- cbuf[i].field1 = i;
- cbuf[i].field2.a = i;
- cbuf[i].field2.b.a = i;
- cbuf[i].field2.b.b = i;
- cbuf[i].field2.b.c = i;
- cbuf[i].field2.c = i;
- cbuf[i].field3 = (double)i;
- cbuf[i].field4.a = i;
- cbuf[i].field4.b = i;
- ibuf[i] = i;
+ cbuf[i].field1 = i;
+ cbuf[i].field2.a = i;
+ cbuf[i].field2.b.a = i;
+ cbuf[i].field2.b.b = i;
+ cbuf[i].field2.b.c = i;
+ cbuf[i].field2.c = i;
+ cbuf[i].field3 = (double)i;
+ cbuf[i].field4.a = i;
+ cbuf[i].field4.b = i;
+ ibuf[i] = i;
} /* end for */
/* Open the copied file */
if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Open the dataset */
if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get the dataset's data type */
if((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Get current dimension sizes before extending the dataset's dimension sizes */
if(H5LDget_dset_dims(did, prev_dims) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Loop through different variations of extending the dataset */
for(i = 0; i < TWO_NTESTS; i++) {
- HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
- HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
- HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
-
- ext_dims[0] = (hsize_t)((int)prev_dims[0] + two_tests[i][0]);
- ext_dims[1] = (hsize_t)((int)prev_dims[1] + two_tests[i][1]);
-
- /* Change the dimension sizes of the dataset */
- if(H5Dset_extent(did, ext_dims) < 0)
- FAIL_STACK_ERROR
-
- /* Initialize data */
- if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
- FAIL_STACK_ERROR
- } /* end if */
+ HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1));
+ HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2));
+ HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
+ HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int));
+
+ ext_dims[0] = (hsize_t)((int)prev_dims[0] + two_tests[i][0]);
+ ext_dims[1] = (hsize_t)((int)prev_dims[1] + two_tests[i][1]);
+
+ /* Change the dimension sizes of the dataset */
+ if(H5Dset_extent(did, ext_dims) < 0)
+ FAIL_STACK_ERROR
+
+ /* Initialize data */
+ if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
+ if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end if */
else if(!HDstrcmp(dname, DSET_TWO)) {
- if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
- FAIL_STACK_ERROR
- } /* end else-if */
+ if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
+ FAIL_STACK_ERROR
+ } /* end else-if */
else
TEST_ERROR
- /* There are changes in dimension sizes */
- if(two_tests[i][0] > 0 || two_tests[i][1] > 0) {
- if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
- if(fields) {
+ /* There are changes in dimension sizes */
+ if(two_tests[i][0] > 0 || two_tests[i][1] > 0) {
+ if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
+ if(fields) {
if(!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) {
/* Retrieve the elmemts in BUF */
if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0)
@@ -1282,37 +1282,37 @@ test_LD_elmts_two(const char *file, const char *dname, const char *fields)
} /* end else-if */
else
TEST_ERROR
- } /* end if */
+ } /* end if */
else {
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
- TEST_ERROR
- if(verify_elmts_two(TWO_CMPD_NULL, ext_dims, prev_dims, ccbuf, cbuf) < 0)
- TEST_ERROR
- } /* end else */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0)
+ TEST_ERROR
+ if(verify_elmts_two(TWO_CMPD_NULL, ext_dims, prev_dims, ccbuf, cbuf) < 0)
+ TEST_ERROR
+ } /* end else */
+ } /* end if */
else { /* DSET_TWO */
- /* Retrieve the elmemts in BUF */
- if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
- TEST_ERROR
- if(verify_elmts_two(TWO_NONE, ext_dims, prev_dims, iibuf, ibuf) < 0)
- TEST_ERROR
- } /* end else */
- } /* end if */
+ /* Retrieve the elmemts in BUF */
+ if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0)
+ TEST_ERROR
+ if(verify_elmts_two(TWO_NONE, ext_dims, prev_dims, iibuf, ibuf) < 0)
+ TEST_ERROR
+ } /* end else */
+ } /* end if */
else {
- /* Verify failure when changes between prev_dims and ext_dims are same/decrease */
- ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf);
- VERIFY_EQUAL(ret, FAIL)
- } /* end else */
+ /* Verify failure when changes between prev_dims and ext_dims are same/decrease */
+ ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf);
+ VERIFY_EQUAL(ret, FAIL)
+ } /* end else */
} /* end for */
/* Closing */
if(H5Tclose(dtype) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Remove the copied file */
HDremove(COPY_FILENAME);
@@ -1322,16 +1322,16 @@ test_LD_elmts_two(const char *file, const char *dname, const char *fields)
error:
H5E_BEGIN_TRY {
- H5Tclose(dtype);
- H5Dclose(did);
- H5Fclose(fid);
+ H5Tclose(dtype);
+ H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
return(-1);
} /* test_LD_elmts_two() */
/*
- * Tests for High Level routines:
- * H5LDget_dset_dims(), H5LDget_dset_elmts, H5LDget_dset_type_size()
+ * Tests for High Level routines:
+ * H5LDget_dset_dims(), H5LDget_dset_elmts, H5LDget_dset_type_size()
*/
int main(void)
{
@@ -1339,60 +1339,60 @@ int main(void)
/* Set up temporary buffers for tests: test_LD_elmts_one() & test_LD_elmts_two() */
if(NULL == (ibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(NULL == (iibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(NULL == (cbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(NULL == (ccbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(NULL == (vbuf1 = (test_valid_fields1 *)HDmalloc(sizeof(test_valid_fields1) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(NULL == (vbuf2 = (test_valid_fields2 *)HDmalloc(sizeof(test_valid_fields2) * TEST_BUF_SIZE)))
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
- /*
- * Testing H5LDget_dset_dims()
+ /*
+ * Testing H5LDget_dset_dims()
*/
nerrors += test_LD_dims_params(FILE);
nerrors += test_LD_dims(FILE);
- /*
- * Testing H5LDget_dset_type_size()
+ /*
+ * Testing H5LDget_dset_type_size()
*/
nerrors += test_LD_size(FILE);
- /*
+ /*
* Testing invalid conditions for H5LDget_dset_elmts()
*/
nerrors += test_LD_elmts_invalid(FILE);
- /*
- * Testing H5LDget_dset_elmts():
- * 1-dimensional dataset
+ /*
+ * Testing H5LDget_dset_elmts():
+ * 1-dimensional dataset
*/
nerrors += test_LD_elmts_one(FILE, DSET_ONE, NULL);
- /*
- * Testing H5LDget_dset_elmts():
- * 1-dimensional dataset w/ compound datatype
+ /*
+ * Testing H5LDget_dset_elmts():
+ * 1-dimensional dataset w/ compound datatype
*/
nerrors += test_LD_elmts_one(FILE, DSET_CMPD, NULL);
nerrors += test_LD_elmts_one(FILE, DSET_CMPD, VALID_FIELDS1);
nerrors += test_LD_elmts_one(FILE, DSET_CMPD, VALID_FIELDS2);
- /*
+ /*
* Testing H5LDget_dset_elmts():
- * 1-dimensional dataset with compound datatype and
- * member names with escape/separator characters
+ * 1-dimensional dataset with compound datatype and
+ * member names with escape/separator characters
*/
nerrors += test_LD_elmts_one(FILE, DSET_CMPD_ESC, NULL);
nerrors += test_LD_elmts_one(FILE, DSET_CMPD_ESC, VALID_ESC_FIELDS1);
nerrors += test_LD_elmts_one(FILE, DSET_CMPD_ESC, VALID_ESC_FIELDS2);
- /*
+ /*
* Testing H5LDget_dset_elmts() for 2-dimensional datasets
*/
nerrors += test_LD_elmts_two(FILE, DSET_TWO, NULL);
@@ -1416,7 +1416,7 @@ int main(void)
/* check for errors */
if(nerrors)
- goto error;
+ goto error;
puts("All tests for H5LD high level routines passed.");
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 763fdb5..e6b4668 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -87,7 +87,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset");
+ HL_TESTING2("H5LTmake_dataset");
/* Make dataset */
if ( H5LTmake_dataset( file_id, DSET0_NAME, rank, dims, H5T_NATIVE_INT, data_int_in ) < 0 )
@@ -118,7 +118,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTread_dataset");
+ HL_TESTING2("H5LTread_dataset");
if ( H5LTread_dataset( file_id, DSET0_NAME, H5T_NATIVE_INT, data_int_out ) < 0 )
goto out;
@@ -143,7 +143,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset_char");
+ HL_TESTING2("H5LTmake_dataset_char");
/* Make dataset char */
if ( H5LTmake_dataset_char( file_id, DSET1_NAME, rank, dims, data_char_in ) < 0 )
@@ -179,7 +179,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset_short");
+ HL_TESTING2("H5LTmake_dataset_short");
/* Make dataset short */
if ( H5LTmake_dataset_short( file_id, DSET2_NAME, rank, dims, data_short_in ) < 0 )
@@ -214,7 +214,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset_int");
+ HL_TESTING2("H5LTmake_dataset_int");
/* Make dataset int */
if ( H5LTmake_dataset_int( file_id, DSET3_NAME, rank, dims, data_int_in ) < 0 )
@@ -250,7 +250,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset_long");
+ HL_TESTING2("H5LTmake_dataset_long");
/* Make dataset long */
if ( H5LTmake_dataset_long( file_id, DSET4_NAME, rank, dims, data_long_in ) < 0 )
@@ -286,7 +286,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset_float");
+ HL_TESTING2("H5LTmake_dataset_float");
/* Make dataset float */
if ( H5LTmake_dataset_float( file_id, DSET5_NAME, rank, dims, data_float_in ) < 0 )
@@ -322,7 +322,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset_double");
+ HL_TESTING2("H5LTmake_dataset_double");
/* Make dataset double */
if ( H5LTmake_dataset_double( file_id, DSET6_NAME, rank, dims, data_double_in ) < 0 )
@@ -358,7 +358,7 @@ static int test_dsets( void )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTmake_dataset_string");
+ HL_TESTING2("H5LTmake_dataset_string");
/* Make dataset string */
if ( H5LTmake_dataset_string(file_id,DSET7_NAME,data_string_in) < 0 )
@@ -517,7 +517,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_string");
+ HL_TESTING2("H5LTset_attribute_string");
/* Set the attribute */
if ( H5LTset_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_in ) < 0 )
@@ -530,7 +530,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_string");
+ HL_TESTING2("H5LTget_attribute_string");
/* Get the attribute */
@@ -550,7 +550,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_char");
+ HL_TESTING2("H5LTset_attribute_char");
/* Set the attribute */
if ( H5LTset_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_in, (size_t)5 ) < 0 )
@@ -563,7 +563,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_char");
+ HL_TESTING2("H5LTget_attribute_char");
/* Get the attribute */
if ( H5LTget_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_out ) < 0 )
@@ -594,7 +594,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_short");
+ HL_TESTING2("H5LTset_attribute_short");
/* Set the attribute */
if ( H5LTset_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_in, (size_t)5 ) < 0 )
@@ -608,7 +608,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_short");
+ HL_TESTING2("H5LTget_attribute_short");
/* Get the attribute */
if ( H5LTget_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_out ) < 0 )
@@ -640,7 +640,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_int");
+ HL_TESTING2("H5LTset_attribute_int");
/* Set the attribute */
if ( H5LTset_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_in, (size_t)5 ) < 0 )
@@ -661,7 +661,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_int");
+ HL_TESTING2("H5LTget_attribute_int");
/* Get the attribute */
if ( H5LTget_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_out ) < 0 )
@@ -712,7 +712,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_long");
+ HL_TESTING2("H5LTset_attribute_long");
/* Set the attribute */
if ( H5LTset_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_in, (size_t)5 ) < 0 )
@@ -725,7 +725,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_long");
+ HL_TESTING2("H5LTget_attribute_long");
/* Get the attribute */
if ( H5LTget_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_out ) < 0 )
@@ -756,7 +756,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_uchar");
+ HL_TESTING2("H5LTset_attribute_uchar");
/* Set the attribute */
if ( H5LTset_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_in, (size_t)5 ) < 0 )
@@ -769,7 +769,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_uchar");
+ HL_TESTING2("H5LTget_attribute_uchar");
/* Get the attribute */
if ( H5LTget_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_out ) < 0 )
@@ -800,7 +800,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_ushort");
+ HL_TESTING2("H5LTset_attribute_ushort");
/* Set the attribute */
if ( H5LTset_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_in, (size_t)5 ) < 0 )
@@ -814,7 +814,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_ushort");
+ HL_TESTING2("H5LTget_attribute_ushort");
/* Get the attribute */
if ( H5LTget_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_out ) < 0 )
@@ -846,7 +846,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_uint");
+ HL_TESTING2("H5LTset_attribute_uint");
/* Set the attribute */
if ( H5LTset_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_in, (size_t)5 ) < 0 )
@@ -859,7 +859,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_uint");
+ HL_TESTING2("H5LTget_attribute_uint");
/* Get the attribute */
if ( H5LTget_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_out ) < 0 )
@@ -890,7 +890,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_ulong");
+ HL_TESTING2("H5LTset_attribute_ulong");
/* Set the attribute */
if ( H5LTset_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_in, (size_t)5 ) < 0 )
@@ -903,7 +903,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_ulong");
+ HL_TESTING2("H5LTget_attribute_ulong");
/* Get the attribute */
if ( H5LTget_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_out ) < 0 )
@@ -935,7 +935,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_float");
+ HL_TESTING2("H5LTset_attribute_float");
/* Set the attribute */
if ( H5LTset_attribute_float( loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5 ) < 0 )
@@ -948,7 +948,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_float");
+ HL_TESTING2("H5LTget_attribute_float");
/* Get the attribute */
@@ -980,7 +980,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTset_attribute_double");
+ HL_TESTING2("H5LTset_attribute_double");
/* Set the attribute */
if ( H5LTset_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5 ) < 0 )
@@ -993,7 +993,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_double");
+ HL_TESTING2("H5LTget_attribute_double");
/* Get the attribute */
if ( H5LTget_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_out ) < 0 )
@@ -1026,7 +1026,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*/
- TESTING("H5LTget_attribute_ndims");
+ HL_TESTING2("H5LTget_attribute_ndims");
if ( H5LTget_attribute_ndims( loc_id, obj_name, ATTR2_NAME, &rank_out ) < 0 )
return -1;
@@ -1042,7 +1042,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
*-------------------------------------------------------------------------
*/
- TESTING("H5LTget_attribute_info");
+ HL_TESTING2("H5LTget_attribute_info");
if(NULL==(dims_out = (hsize_t*) HDmalloc( sizeof(hsize_t) * (size_t)rank_out ))) return -1;
@@ -1050,7 +1050,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
HDfree( dims_out );
return -1;
}
-
+
for (i = 0; i < rank_out; i++) {
if ( dims_out[i] != 5 ) {
HDfree( dims_out );
@@ -1079,7 +1079,7 @@ static int test_integers(void)
char* dt_str;
size_t str_len;
- TESTING3("\n text for integer types");
+ HL_TESTING3("\n text for integer types");
if((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL))<0)
goto out;
@@ -1136,7 +1136,7 @@ static int test_fps(void)
char* dt_str;
size_t str_len;
- TESTING3(" text for floating-point types");
+ HL_TESTING3(" text for floating-point types");
if((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE\n", H5LT_DDL))<0)
goto out;
@@ -1152,7 +1152,7 @@ static int test_fps(void)
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) {
@@ -1197,7 +1197,7 @@ static int test_strings(void)
char* dt_str = NULL;
size_t str_len;
- TESTING3(" text for string types");
+ HL_TESTING3(" text for string types");
if((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE 13; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }", H5LT_DDL))<0)
goto out;
@@ -1228,7 +1228,7 @@ static int test_strings(void)
goto out;
}
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);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1260,7 +1260,7 @@ static int test_strings(void)
goto out;
}
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);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1270,13 +1270,13 @@ static int test_strings(void)
str_len = str_len + 10;
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(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) {
- printf("dt=\n%s\n", dt_str);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1292,10 +1292,10 @@ static int test_strings(void)
goto out;
}
/* check the truncated string */
- if(strlen(dt_str) != str_len-1) goto out;
- str_len = strlen(dt_str);
+ if(HDstrlen(dt_str) != str_len-1) goto out;
+ str_len = HDstrlen(dt_str);
if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) {
- printf("dt=\n%s\n", dt_str);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1328,7 +1328,7 @@ static int test_opaques(void)
char* dt_str;
size_t str_len;
- TESTING3(" text for opaque types");
+ HL_TESTING3(" text for opaque types");
if((dtype = H5LTtext_to_dtype("H5T_OPAQUE { OPQ_SIZE 19; OPQ_TAG \"This is a tag for opaque type\"; }", H5LT_DDL))<0)
goto out;
@@ -1352,7 +1352,7 @@ static int test_opaques(void)
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);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1385,7 +1385,7 @@ static int test_enums(void)
char* dt_str;
size_t str_len;
- TESTING3(" text for enum types");
+ HL_TESTING3(" text for enum types");
if((dtype = H5LTtext_to_dtype("H5T_ENUM { H5T_STD_I32LE; \"RED\" 5; \"GREEN\" 6; \"BLUE\" 7; \"WHITE\" 8; }", H5LT_DDL))<0)
goto out;
@@ -1428,7 +1428,7 @@ static int test_enums(void)
}
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);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1457,7 +1457,7 @@ static int test_variables(void)
char* dt_str;
size_t str_len;
- TESTING3(" text for variable types");
+ HL_TESTING3(" text for variable types");
if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }\n", H5LT_DDL))<0)
goto out;
@@ -1469,16 +1469,16 @@ 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;
if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
@@ -1488,15 +1488,15 @@ static int test_variables(void)
goto out;
}
if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) {
- printf("dt=\n%s\n", dt_str);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
-
+
if(H5Tclose(dtype)<0)
goto out;
-
+
PASSED();
return 0;
@@ -1518,7 +1518,7 @@ static int test_arrays(void)
char* dt_str;
size_t str_len;
- TESTING3(" text for array types");
+ HL_TESTING3(" text for array types");
if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }", H5LT_DDL))<0)
goto out;
@@ -1547,7 +1547,7 @@ static int test_arrays(void)
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);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1579,7 +1579,7 @@ static int test_compounds(void)
char* dt_str;
size_t str_len;
- TESTING3(" text for compound types");
+ HL_TESTING3(" text for compound types");
if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL))<0)
goto out;
@@ -1603,7 +1603,7 @@ static int test_compounds(void)
goto out;
}
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);
+ HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@@ -1637,7 +1637,7 @@ out:
}
/*-------------------------------------------------------------------------
-* subroutine for test_text_dtype(): test_compound_bug(). Test case for
+* subroutine for test_text_dtype(): test_compound_bug(). Test case for
* issue 7701.
*-------------------------------------------------------------------------
*/
@@ -1673,7 +1673,7 @@ static int test_compound_bug(void)
" } } \"sub\" : 8;\n"
"}\n";
- TESTING3(" text for compound type of bug fix");
+ HL_TESTING3(" text for compound type of bug fix");
if((dtype = H5LTtext_to_dtype(text, H5LT_DDL))<0)
goto out;
@@ -1765,12 +1765,12 @@ static int test_complicated_compound(void)
size_t size = 1024;
const char *filename = H5_get_srcdir_filename(INPUT_FILE);
- TESTING3(" text for complicated compound types");
+ HL_TESTING3(" text for complicated compound types");
/* Open input file */
fp = HDfopen(filename, "r");
if(fp == NULL) {
- printf( "Could not find file %s. Try set $srcdir \n", filename);
+ HDprintf( "Could not find file %s. Try set $srcdir \n", filename);
goto out;
}
@@ -1834,7 +1834,7 @@ out:
*/
static int test_text_dtype(void)
{
- TESTING("H5LTtext_to_dtype");
+ HL_TESTING2("H5LTtext_to_dtype");
if(test_integers()<0)
goto out;
@@ -1881,9 +1881,9 @@ static int test_valid_path(void)
hid_t file_id, group;
htri_t path_valid;
const char *data_string_in = "test";
-
- TESTING("H5LTpath_valid");
-
+
+ HL_TESTING2("H5LTpath_valid");
+
/* Create a new file using default properties. */
/**************************************************************
@@ -1908,11 +1908,11 @@ static int test_valid_path(void)
* |
* |
* | --- Gcyc (soft link to /G1)
- * / \
- * / \
- * G5 \
+ * / \
+ * / \
+ * G5 \
* (soft link G6 (external link /G1 in FILENAME4)
- * to /G2)
+ * to /G2)
*
****************************************************************/
@@ -1941,7 +1941,7 @@ static int test_valid_path(void)
*/
if(H5LTmake_dataset_string(group, "/G2/DS4", data_string_in)<0)
goto out;
-
+
/*
* Create a soft link
*/
@@ -2023,9 +2023,9 @@ static int test_valid_path(void)
* |
* |
* |
- * G1
+ * G1
* / \
- * / \
+ * / \
* DS1 G2
* (dangled soft link to /G1/G20)
*
@@ -2056,13 +2056,13 @@ static int test_valid_path(void)
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
+ * CHECK ABSOLUTE PATHS
**************************************/
if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) {
@@ -2076,7 +2076,7 @@ static int test_valid_path(void)
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;
@@ -2094,7 +2094,7 @@ static int test_valid_path(void)
if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE)
goto out;
-
+
if( (path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE)
goto out;
@@ -2114,14 +2114,14 @@ static int test_valid_path(void)
/* check soft links */
if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE)
goto out;
-
+
/**************************************
- * CHECK RELATIVE PATHS
+ * CHECK RELATIVE PATHS
***************************************/
if( (group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0)
goto out;
-
+
if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) {
goto out;
}
@@ -2156,22 +2156,22 @@ static int test_valid_path(void)
goto out;
if( (path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE)
- goto out;
+ 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;
+ goto out;
/* Should fail, does not exist */
if( (path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE)
- goto out;
+ goto out;
/* Should fail, does not exist */
if( (path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE)
- goto out;
+ goto out;
if(H5Gclose(group)<0)
goto out;
@@ -2220,7 +2220,7 @@ static int test_valid_path(void)
PASSED();
return 0;
- out:
+ out:
H5_FAILED();
return -1;
}
diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c
index 7003b26..61aebc7 100644
--- a/hl/test/test_packet.c
+++ b/hl/test/test_packet.c
@@ -178,7 +178,7 @@ static int test_create_close(hid_t fid)
hid_t table;
hid_t part_t;
- TESTING("H5PTcreate_fl and H5PTclose");
+ HL_TESTING2("H5PTcreate_fl and H5PTclose");
/* Create a datatype for the particle struct */
part_t = make_particle_type();
@@ -188,11 +188,11 @@ static int test_create_close(hid_t fid)
/* Create the table */
table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1);
if (H5Tclose(part_t) < 0)
- goto error;
+ goto error;
if( H5PTis_valid(table) < 0)
- goto error;
+ goto error;
if( H5PTis_varlen(table) != 0)
- goto error;
+ goto error;
/* Close the table */
err = H5PTclose(table);
@@ -219,7 +219,7 @@ static int test_open(hid_t fid)
herr_t err;
hid_t table;
- TESTING("H5PTopen");
+ HL_TESTING2("H5PTopen");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
@@ -255,7 +255,7 @@ static int test_append(hid_t fid)
hid_t table;
hsize_t count = 0;
- TESTING("H5PTappend");
+ HL_TESTING2("H5PTappend");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
@@ -322,7 +322,7 @@ static int test_read(hid_t fid)
particle_t readBuf[NRECORDS];
size_t c;
- TESTING("H5PTread_packets");
+ HL_TESTING2("H5PTread_packets");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
@@ -383,7 +383,7 @@ static int test_get_next(hid_t fid)
particle_t readBuf2[NRECORDS];
size_t c;
- TESTING("H5PTget_next");
+ HL_TESTING2("H5PTget_next");
/* Open the table */
table = H5PTopen(fid, PT_NAME);
@@ -454,7 +454,7 @@ static int test_big_table(hid_t fid)
particle_t readPart;
hsize_t count;
- TESTING("large packet table");
+ HL_TESTING2("large packet table");
/* Create a datatype for the particle struct */
part_t = make_particle_type();
@@ -528,7 +528,7 @@ static int test_opaque(hid_t fid)
size_t c;
particle_t readBuf[NRECORDS];
- TESTING("opaque data");
+ HL_TESTING2("opaque data");
/* Create an opaque datatype for the particle struct */
if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 )
@@ -602,7 +602,7 @@ test_compress(void)
particle_t readPart[1];
hsize_t count;
- TESTING("packet table compression");
+ HL_TESTING2("packet table compression");
/* Create a file. */
if((fid1 = H5Fcreate(TEST_COMPRESS_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
@@ -739,7 +739,7 @@ static int test_rw_nonnative_dt(hid_t fid)
int writeBuffer[5];
int readBuffer[5];
- TESTING("reading/writing non-native packet table");
+ HL_TESTING2("reading/writing non-native packet table");
/* Initialize buffers */
for(x=0; x<5; x++) {
@@ -794,7 +794,7 @@ static int test_rw_nonnative_dt(hid_t fid)
/* Close the packet table */
if( (err = H5PTclose(ptable)) < 0)
goto error;
-
+
PASSED();
return SUCCEED;
@@ -819,7 +819,7 @@ static int test_error(hid_t fid)
int id_open=0;
particle_t readBuf[1];
- TESTING("error conditions");
+ HL_TESTING2("error conditions");
/* Create a HL table */
if(create_hl_table(fid) < 0)
@@ -981,7 +981,7 @@ int main(void)
/* Close the file */
if (H5Fclose(fid) < 0)
- status = 1;
+ status = 1;
return status;
}
diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c
index 1d6231e..b41e73d 100644
--- a/hl/test/test_packet_vlen.c
+++ b/hl/test/test_packet_vlen.c
@@ -46,101 +46,101 @@ static int verify_attribute(hid_t fid, const char *table_name, const char *attr_
/*-------------------------------------------------------------------------
* test_VLof_atomic(): Test that a packet table with VL datatypes of atomic
- * datatypes can be created and written correctly. (HDFFV-442)
+ * datatypes can be created and written correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int test_VLof_atomic(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
-
- TESTING3(" with vlen of atomic");
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
+
+ HL_TESTING3(" with vlen of atomic");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int));
if (writeBuf[uu].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++)
- ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a vlen type that uses an atomic datatype as its base type */
vltype = H5Tvlen_create (H5T_NATIVE_UINT);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of an atomic type */
ptable = H5PTcreate(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Close the vlen datatype */
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
for (uu = 0; uu < NRECORDS; uu++)
for (vv = 0; vv < (uu + 1); vv++)
{
- if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
- printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
- printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
- }
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ HDprintf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ HDprintf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
+ }
}
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf );
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -157,7 +157,7 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* test_VLof_comptype(): Test that a packet table with VL datatypes of
- * compound datatypes can be created and written correctly. (HDFFV-442)
+ * compound datatypes can be created and written correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
@@ -169,26 +169,26 @@ static int test_VLof_comptype(void)
unsigned u;
float f;
} VLcomp_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- char msg[80]; /* For error message */
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ char msg[80]; /* For error message */
herr_t ret;
- TESTING3(" with vlen of compound datatypes");
+ HL_TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
if(writeBuf[uu].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++) {
((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
@@ -199,88 +199,88 @@ static int test_VLof_comptype(void)
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create the base compound type */
cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t));
if (cmptype < 0)
- goto error;
+ goto error;
/* Insert fields */
ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
/* Create a variable length type that uses the VLcomp_t as its base type */
vltype = H5Tvlen_create(cmptype);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of compound datatype */
ptable = H5PTcreate(fid, PT_VLEN_COMP, vltype, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release the datatypes */
if (H5Tclose(cmptype) < 0)
- goto error;
+ goto error;
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)5, writeBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].len != readBuf[uu].len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len);
- continue;
- } /* write len != read len */
+ HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len);
+ continue;
+ } /* write len != read len */
for (vv = 0; vv < (uu + 1); vv++) {
if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
- fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]);
+ HDfprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]);
continue;
- } /* write value != read value */
- }
+ } /* write value != read value */
+ }
} /* end for */
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -298,8 +298,8 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* test_compound_VL_VL(): Test that a packet table of compound datatypes
- * containing VL datatypes can be created and written
- * correctly. (HDFFV-442)
+ * containing VL datatypes can be created and written
+ * correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
@@ -310,23 +310,23 @@ static int test_compound_VL_VLtype(void)
typedef struct {
unsigned u;
float f;
- hvl_t v;
+ hvl_t v;
} compVLVL_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */
- hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing
- a VL of VL of atomic datatype */
- hsize_t count; /* Number of records in the table */
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing
+ a VL of VL of atomic datatype */
+ hsize_t count; /* Number of records in the table */
compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
hvl_t *t1, *t2;
- unsigned uu, vv, ww; /* Loop variables */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ unsigned uu, vv, ww; /* Loop variables */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
- TESTING3(" with compound datatype containing vlen datatype");
+ HL_TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
@@ -334,17 +334,17 @@ static int test_compound_VL_VLtype(void)
writeBuf[uu].f = (float)(uu * 20) / 3.0F;
writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
if (writeBuf[uu].v.p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].v.len = uu + L1_INCM;
for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
- {
+ {
t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
- if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv + L2_INCM;
for (ww = 0; ww < vv + L2_INCM; ww++)
((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
@@ -354,91 +354,91 @@ static int test_compound_VL_VLtype(void)
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
/* Create a VL datatype of the VL of atomic datatype */
vlofvl = H5Tvlen_create (vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create the base compound type */
comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t));
if (comp_vlvl < 0)
- goto error;
+ goto error;
/* Insert fields: atomic, atomic, vlen */
ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl);
if (ret < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a compound datatype of vlen datatype */
ptable = H5PTcreate(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
if (H5Tclose(comp_vlvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].u != readBuf[uu].u) {
- fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
+ HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f,readBuf[uu].f)) {
- fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
+ HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
if (writeBuf[uu].v.len != readBuf[uu].v.len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
+ HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
+ HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
for (ww = 0; (size_t)ww < t2->len; ww++) {
if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
- fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
+ HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
} /* end for */
@@ -448,19 +448,19 @@ static int test_compound_VL_VLtype(void)
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -479,43 +479,43 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* test_VLof_VLtype(): Test that a packet table of VL datatype with VL
- * datatypes of atomic datatypes can be created and written
- * correctly. (HDFFV-442)
+ * datatypes of atomic datatypes can be created and written
+ * correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int test_VLof_VLtype(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
- hsize_t count; /* Number of records in the table */
- hvl_t *t1; /* pointer to advance */
- unsigned uu, vv, ww; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
-
- TESTING3(" with vlen datatype of vlen datatype");
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
+ hsize_t count; /* Number of records in the table */
+ hvl_t *t1; /* pointer to advance */
+ unsigned uu, vv, ww; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
+
+ HL_TESTING3(" with vlen datatype of vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t));
if (writeBuf[uu].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
} /* end if */
writeBuf[uu].len = uu + 1;
for (t1=(hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
- {
+ {
t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
- if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv * 1;
for (ww = 0; ww < (vv * 1); ww++)
((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
@@ -525,64 +525,64 @@ static int test_VLof_VLtype(void)
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
vlofvl = H5Tvlen_create (vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of vlen datatype */
ptable = H5PTcreate(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)5, writeBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -600,41 +600,41 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* verify_ptlengthtype() - helper function, verifies that the named packet
- * table is a fixed-length or variable-length as indicated by the last
- * argument.
+ * table is a fixed-length or variable-length as indicated by the last
+ * argument.
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expected_value)
{
- hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
herr_t is_varlen = 0;
herr_t ret = FAIL;
/* Open the named packet table */
if( (ptable = H5PTopen(fid, table_name)) < 0)
- goto error;
+ goto error;
/* Verify the value returned from H5PTis_varlen is as expected */
is_varlen = H5PTis_varlen(ptable);
if (is_varlen == FAIL)
- goto error;
+ goto error;
else if (is_varlen == expected_value)
- ret = SUCCEED;
+ ret = SUCCEED;
else
{
- char lenthtype[20];
- HDstrcpy(lenthtype, "fixed-length");
- if (expected_value == 1)
- HDstrcpy(lenthtype, "variable-length");
- fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype);
- ret = FAIL;
+ char lenthtype[20];
+ HDstrcpy(lenthtype, "fixed-length");
+ if (expected_value == 1)
+ HDstrcpy(lenthtype, "variable-length");
+ HDfprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype);
+ ret = FAIL;
}
/* Close the packet table */
if (H5PTclose(ptable) < 0)
- goto error;
+ goto error;
return ret;
@@ -645,71 +645,71 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* test_H5PTis_varlen(): Test that H5PTis_varlen works correctly on both
- * fixed- and variable-length packet tables.
+ * fixed- and variable-length packet tables.
*
* Description:
- * - Added a fixed-length packet table to the file for variety
- * - Use the helper funtion verify_ptlengthtype to test H5PTis_varlen
- * on each packet table.
+ * - Added a fixed-length packet table to the file for variety
+ * - Use the helper funtion verify_ptlengthtype to test H5PTis_varlen
+ * on each packet table.
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int test_H5PTis_varlen(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- herr_t ret; /* Returned status from a callee */
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ herr_t ret; /* Returned status from a callee */
- TESTING("H5PTis_varlen");
+ HL_TESTING2("H5PTis_varlen");
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a new table */
ptable = H5PTcreate(fid, PT_FIXED_LEN, H5T_STD_I32BE, (hsize_t)100, H5P_DEFAULT);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Open each packet table, and verify that H5PTis_varlen returns correct
type for each table */
ret = verify_ptlengthtype(fid, PT_VLEN_ATOMIC, 1); /* vlen of atomic */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_VLEN_COMP, 1); /* vlen of compound */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_COMP_VLEN, 0); /* compound of vlen, no vlen */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_VLEN_VLEN, 1); /* vlen of vlen */
if (ret < 0)
- goto error;
+ goto error;
ret = verify_ptlengthtype(fid, PT_FIXED_LEN, 0); /* no vlen */
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -722,11 +722,11 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* adding_attribute() - helper function, adds an attribute to the named
- * packet table.
+ * packet table.
* Note:
- * For simplicity, the attributes that are added to the packet tables
- * have the same characteristics except their names. They have the
- * same type, space, and values.
+ * For simplicity, the attributes that are added to the packet tables
+ * have the same characteristics except their names. They have the
+ * same type, space, and values.
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
@@ -737,47 +737,47 @@ int attr_data[ATTR_DIM]={256,11945,-22107}; /* values to be written to attr */
static int adding_attribute(hid_t fid, const char *table_name, const char *attr_name)
{
- hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
- hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */
- hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */
- hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */
- hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */
- int ret = FAIL; /* Returned status from a callee */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */
+ hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */
+ hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */
+ int ret = FAIL; /* Returned status from a callee */
/* Create dataspace for attribute */
space_id = H5Screate_simple(ATTR_RANK, dims, NULL);
if (space_id < 0)
- goto error;
+ goto error;
/* Open the named packet table */
if( (ptable = H5PTopen(fid, table_name)) < 0)
- goto error;
+ goto error;
dset_id = H5PTget_dataset(ptable);
if (dset_id < 0)
- goto error;
+ goto error;
/* Add the specified attribute to it */
attr_id = H5Acreate2(dset_id, attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT);
if (attr_id < 0)
- goto error;
+ goto error;
/* Write attribute values */
ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data);
if (ret < 0)
- goto error;
+ goto error;
/* Close the attribute */
if (H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Close the dataspace */
if (H5Sclose(space_id) < 0)
- goto error;
+ goto error;
/* Close the packet table */
if (H5PTclose(ptable) < 0)
- goto error;
+ goto error;
return SUCCEED;
@@ -790,39 +790,39 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* verify_attribute() - helper function, verifies the named attribute can
- * be read correctly.
+ * be read correctly.
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static herr_t verify_attribute(hid_t fid, const char *table_name, const char *attr_name)
{
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */
- hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */
- int read_data[ATTR_DIM]; /* Output buffer */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */
+ hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */
+ int read_data[ATTR_DIM]; /* Output buffer */
int ii;
- herr_t ret = FAIL; /* Returned status from a callee */
+ herr_t ret = FAIL; /* Returned status from a callee */
/* Open the named packet table */
ptable = H5PTopen(fid, table_name);
if (ptable < 0)
- goto error;
+ goto error;
/* Get the dataset id of this packet table */
dset_id = H5PTget_dataset(ptable);
if (dset_id < 0)
- goto error;
+ goto error;
/* Open first attribute for the dataset */
attr_id = H5Aopen(dset_id, attr_name, H5P_DEFAULT);
if (attr_id < 0)
- goto error;
+ goto error;
/* Read attribute values */
ret = H5Aread(attr_id, H5T_NATIVE_INT, read_data);
if (ret < 0)
- goto error;
+ goto error;
/* Verify values read in */
for (ii = 0; ii < ATTR_DIM; ii++)
@@ -831,11 +831,11 @@ static herr_t verify_attribute(hid_t fid, const char *table_name, const char *at
/* Close the attribute */
if (H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Close the packet table */
if (H5PTclose(ptable) < 0)
- goto error;
+ goto error;
return SUCCEED;
@@ -849,58 +849,58 @@ error: /* An error has occurred. Clean up and exit. */
* test_attributes(): Test adding attributes to packet tables
*
* Description:
- * Added attributes to some random packet tables in the file.
+ * Added attributes to some random packet tables in the file.
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int test_attributes(void)
{
- hid_t fid=H5I_INVALID_HID; /* File identifier */
- hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */
- herr_t ret = FAIL; /* Returned status from a callee */
+ hid_t fid=H5I_INVALID_HID; /* File identifier */
+ hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */
+ herr_t ret = FAIL; /* Returned status from a callee */
- TESTING("adding attributes to packet tables");
+ HL_TESTING2("adding attributes to packet tables");
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Add an arbitrary attribute to a few packet tables, using helper func */
attr_id = adding_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1");
if (attr_id < 0)
- goto error;
+ goto error;
attr_id = adding_attribute(fid, PT_VLEN_COMP, "Attribute 2");
if (attr_id < 0)
- goto error;
+ goto error;
attr_id = adding_attribute(fid, PT_COMP_VLEN, "Attribute 3");
if (attr_id < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
/* Open the file again */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Read each attribute and verify the values, using helper function */
ret = verify_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1");
if (ret < 0)
- goto error;
+ goto error;
ret = verify_attribute(fid, PT_VLEN_COMP, "Attribute 2");
if (ret < 0)
- goto error;
+ goto error;
ret = verify_attribute(fid, PT_COMP_VLEN, "Attribute 3");
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return(ret);
@@ -913,17 +913,17 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* verify_accessors() - helper function, verifies that various info can be
- * retrieved correctly using the info returned by the accessor functions.
+ * retrieved correctly using the info returned by the accessor functions.
*
* Description:
- * Testing functions H5PTget_dataset and H5PTget_type
+ * Testing functions H5PTget_dataset and H5PTget_type
*
- * - Opens the named packet table
- * - Gets its associated dataset ID then calls a C function on that ID
- * to verify the dataset name
- * - Gets its associated datatype ID then calls a C function on that ID
- * to verify that the packet table is variable- or fixed-length as
- * indicated by the expected_value argument
+ * - Opens the named packet table
+ * - Gets its associated dataset ID then calls a C function on that ID
+ * to verify the dataset name
+ * - Gets its associated datatype ID then calls a C function on that ID
+ * to verify that the packet table is variable- or fixed-length as
+ * indicated by the expected_value argument
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
@@ -990,18 +990,18 @@ error: /* An error has occurred. Clean up and exit. */
* test_accessors(): Test the accessor functions
*
* Description:
- * Retrieves the dataset and datatype IDs and verifies various info
- * to ensure these IDs are correct.
+ * Retrieves the dataset and datatype IDs and verifies various info
+ * to ensure these IDs are correct.
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int test_accessors(void)
{
- hid_t fid=H5I_INVALID_HID; /* File identifier */
- herr_t ret = FAIL; /* Returned status from a callee */
+ hid_t fid=H5I_INVALID_HID; /* File identifier */
+ herr_t ret = FAIL; /* Returned status from a callee */
- TESTING("accessor functions");
+ HL_TESTING2("accessor functions");
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -1031,109 +1031,109 @@ error: /* An error has occurred. Clean up and exit. */
} /* test_accessors */
/**************************************************************************
- Test set for deprecated function H5PTcreate_fl
- Each test in this set is the same as the corresponding one in the
- set for H5PTcreate, as of Mar 2016
+ Test set for deprecated function H5PTcreate_fl
+ Each test in this set is the same as the corresponding one in the
+ set for H5PTcreate, as of Mar 2016
**************************************************************************/
/*-------------------------------------------------------------------------
* testfl_VLof_atomic(): Test that a packet table with VL datatypes of atomic
- * datatypes can be created and written correctly. (HDFFV-442)
+ * datatypes can be created and written correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int testfl_VLof_atomic(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
-
- TESTING3(" with vlen of atomic");
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
+
+ HL_TESTING3(" with vlen of atomic");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int));
if (writeBuf[uu].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++)
- ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a vlen type that uses an atomic datatype as its base type */
vltype = H5Tvlen_create (H5T_NATIVE_UINT);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of an atomic type */
ptable = H5PTcreate_fl(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Close the vlen datatype */
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
for (uu = 0; uu < NRECORDS; uu++)
for (vv = 0; vv < (uu + 1); vv++)
{
- if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
- printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
- printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
- }
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ HDprintf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ HDprintf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
+ }
}
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf );
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -1150,7 +1150,7 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* testfl_VLof_comptype(): Test that a packet table with VL datatypes of
- * compound datatypes can be created and written correctly. (HDFFV-442)
+ * compound datatypes can be created and written correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
@@ -1162,26 +1162,26 @@ static int testfl_VLof_comptype(void)
unsigned u;
float f;
} VLcomp_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
- hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- hsize_t count; /* Number of records in the table */
- unsigned uu, vv; /* Loop variables */
- char msg[80]; /* For error message */
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ hsize_t count; /* Number of records in the table */
+ unsigned uu, vv; /* Loop variables */
+ char msg[80]; /* For error message */
herr_t ret;
- TESTING3(" with vlen of compound datatypes");
+ HL_TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
if(writeBuf[uu].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].len = uu + 1;
for (vv = 0; vv < (uu + 1); vv++) {
((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
@@ -1192,88 +1192,88 @@ static int testfl_VLof_comptype(void)
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create the base compound type */
cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t));
if (cmptype < 0)
- goto error;
+ goto error;
/* Insert fields */
ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
/* Create a variable length type that uses the VLcomp_t as its base type */
vltype = H5Tvlen_create(cmptype);
if (vltype < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of compound datatype */
ptable = H5PTcreate_fl(fid, PT_VLEN_COMP, vltype, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release the datatypes */
if (H5Tclose(cmptype) < 0)
- goto error;
+ goto error;
if (H5Tclose(vltype) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)5, writeBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].len != readBuf[uu].len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len);
- continue;
- } /* write len != read len */
+ HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len);
+ continue;
+ } /* write len != read len */
for (vv = 0; vv < (uu + 1); vv++) {
if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
- fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]);
+ HDfprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]);
continue;
- } /* write value != read value */
- }
+ } /* write value != read value */
+ }
} /* end for */
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -1291,8 +1291,8 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* testfl_compound_VL_VL(): Test that a packet table of compound datatypes
- * containing VL datatypes can be created and written
- * correctly. (HDFFV-442)
+ * containing VL datatypes can be created and written
+ * correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
@@ -1303,23 +1303,23 @@ static int testfl_compound_VL_VLtype(void)
typedef struct {
unsigned u;
float f;
- hvl_t v;
+ hvl_t v;
} compVLVL_t;
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */
- hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing
- a VL of VL of atomic datatype */
- hsize_t count; /* Number of records in the table */
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing
+ a VL of VL of atomic datatype */
+ hsize_t count; /* Number of records in the table */
compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
hvl_t *t1, *t2;
- unsigned uu, vv, ww; /* Loop variables */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
+ unsigned uu, vv, ww; /* Loop variables */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
- TESTING3(" with compound datatype containing vlen datatype");
+ HL_TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
@@ -1327,17 +1327,17 @@ static int testfl_compound_VL_VLtype(void)
writeBuf[uu].f = (float)(uu * 20) / 3.0F;
writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
if (writeBuf[uu].v.p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
- }
+ }
writeBuf[uu].v.len = uu + L1_INCM;
for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
- {
+ {
t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
- if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv + L2_INCM;
for (ww = 0; ww < vv + L2_INCM; ww++)
((unsigned int*)t1->p)[ww] = uu * 100 + vv * 10 + ww;
@@ -1347,91 +1347,91 @@ static int testfl_compound_VL_VLtype(void)
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
/* Create a VL datatype of the VL of atomic datatype */
vlofvl = H5Tvlen_create (vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create the base compound type */
comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t));
if (comp_vlvl < 0)
- goto error;
+ goto error;
/* Insert fields: atomic, atomic, vlen */
ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
if (ret < 0)
- goto error;
+ goto error;
ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl);
if (ret < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a compound datatype of vlen datatype */
ptable = H5PTcreate_fl(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
if (H5Tclose(comp_vlvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Compare data read in */
for (uu = 0; uu < NRECORDS; uu++) {
if (writeBuf[uu].u != readBuf[uu].u) {
- fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
+ HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) {
- fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
+ HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
if (writeBuf[uu].v.len != readBuf[uu].v.len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
+ HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
+ HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
for (ww = 0; (size_t)ww < t2->len; ww++) {
if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
- fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
+ HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
} /* end for */
@@ -1441,19 +1441,19 @@ static int testfl_compound_VL_VLtype(void)
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -1472,43 +1472,43 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* testfl_VLof_VLtype(): Test that a packet table of VL datatype with VL
- * datatypes of atomic datatypes can be created and written
- * correctly. (HDFFV-442)
+ * datatypes of atomic datatypes can be created and written
+ * correctly. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
static int testfl_VLof_VLtype(void)
{
- hid_t fid=H5I_INVALID_HID; /* Test file identifier */
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
- hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
- hsize_t count; /* Number of records in the table */
- hvl_t *t1; /* pointer to advance */
- unsigned uu, vv, ww; /* Loop variables */
- hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
- hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
- char msg[80]; /* For error message */
- herr_t ret; /* Returned status from a callee */
-
- TESTING3(" with vlen datatype of vlen datatype");
+ hid_t fid=H5I_INVALID_HID; /* Test file identifier */
+ hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
+ hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */
+ hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
+ hsize_t count; /* Number of records in the table */
+ hvl_t *t1; /* pointer to advance */
+ unsigned uu, vv, ww; /* Loop variables */
+ hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
+ hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
+ char msg[80]; /* For error message */
+ herr_t ret; /* Returned status from a callee */
+
+ HL_TESTING3(" with vlen datatype of vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
for (uu = 0; uu < NRECORDS; uu++) {
writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t));
if (writeBuf[uu].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
} /* end if */
writeBuf[uu].len = uu + 1;
for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
- {
+ {
t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
- if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
- goto error;
- }
+ if (t1->p == NULL) {
+ HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
+ goto error;
+ }
t1->len = vv + 1;
for (ww = 0; ww < (vv + 1); ww++)
((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
@@ -1518,64 +1518,64 @@ static int testfl_VLof_VLtype(void)
/* Open the file */
fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
/* Create a VL datatype of an atomic type */
vlatomic = H5Tvlen_create (H5T_NATIVE_UINT);
if (vlatomic < 0)
- goto error;
+ goto error;
vlofvl = H5Tvlen_create (vlatomic);
if (vlofvl < 0)
- goto error;
+ goto error;
/* Create a packet table that uses a vlen datatype of vlen datatype */
ptable = H5PTcreate_fl(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, 0);
/* Ensure that PT is created successfully */
if (ptable == H5I_INVALID_HID)
- goto error;
+ goto error;
/* Release datatypes */
if (H5Tclose(vlatomic) < 0)
- goto error;
+ goto error;
if (H5Tclose(vlofvl) < 0)
- goto error;
+ goto error;
/* Write the entire buffer to the packet table */
ret = H5PTappend(ptable, (size_t)5, writeBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Get the number of packets in the packet table, should be NRECORDS. */
ret = H5PTget_num_packets(ptable, &count);
if (ret < 0)
- goto error;
+ goto error;
- sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf );
if (ret < 0)
- goto error;
+ goto error;
/* Free the buffers */
ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf);
if (ret < 0)
- goto error;
+ goto error;
ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf);
if (ret < 0)
- goto error;
+ goto error;
/* Close the packet table */
ret = H5PTclose(ptable);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
@@ -1593,25 +1593,25 @@ error: /* An error has occurred. Clean up and exit. */
/*-------------------------------------------------------------------------
* test_packet_table_with_varlen(): Invokes individual tests to ensure that
- * packet tables with variable length are created and written correctly
- * without the specific VL PT functionality. (HDFFV-442)
+ * packet tables with variable length are created and written correctly
+ * without the specific VL PT functionality. (HDFFV-442)
*
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
int test_packet_table_with_varlen(void)
{
- hid_t fid=H5I_INVALID_HID; /* File identifier */
+ hid_t fid=H5I_INVALID_HID; /* File identifier */
int status = SUCCEED;
/* Create a file using default properties */
fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid < 0)
- return FAIL;
+ return FAIL;
/* Close the file. The file will be opened by each test function below */
if (H5Fclose(fid) < 0)
- return FAIL;
+ return FAIL;
HDputs("Testing packet table with various variable-length datatypes");
@@ -1620,46 +1620,46 @@ int test_packet_table_with_varlen(void)
/* Test variable length of a simple type */
if (test_VLof_atomic() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a compound type */
if (test_VLof_comptype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test compound type with variable length */
if (test_compound_VL_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a variable length */
if (test_VLof_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a variable length */
if (test_H5PTis_varlen() < 0)
- status = FAIL;
+ status = FAIL;
/* Test adding attributes to packet table */
if (test_attributes() < 0)
- status = FAIL;
+ status = FAIL;
/* Test accessor functions */
if (test_accessors() < 0)
- status = FAIL;
+ status = FAIL;
/**************************************************************************
- Calling test functions for deprecated function H5PTcreate_fl
- Mar 2016, -BMR
+ Calling test functions for deprecated function H5PTcreate_fl
+ Mar 2016, -BMR
**************************************************************************/
/* Create a file using default properties */
fid = H5Fcreate(TESTFL_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid < 0)
- return FAIL;
+ return FAIL;
/* Close the file. The file will be opened by each test function below */
if (H5Fclose(fid) < 0)
- return FAIL;
+ return FAIL;
HDputs("Testing packet table with various variable-length datatypes - H5PTcreate_fl");
@@ -1668,19 +1668,19 @@ int test_packet_table_with_varlen(void)
/* Test variable length of a simple type */
if (testfl_VLof_atomic() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a compound type */
if (testfl_VLof_comptype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test compound type with variable length */
if (testfl_compound_VL_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
/* Test variable length of a variable length */
if (testfl_VLof_VLtype() < 0)
- status = FAIL;
+ status = FAIL;
return(status);
}
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index 0215697..1d6bcec 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -51,8 +51,6 @@
#define NRECORDS 8
#define NRECORDS_ADD 3
-#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);}
-
/*-------------------------------------------------------------------------
* structure used for all tests, a particle with properties
*-------------------------------------------------------------------------
@@ -117,7 +115,7 @@ typedef struct particle3_t
*-------------------------------------------------------------------------
*/
-/* Push current alignment rule forcing 4-byte alignment boundary
+/* Push current alignment rule forcing 4-byte alignment boundary
* to the internal stack ...
*/
#pragma pack(push,4)
@@ -129,7 +127,7 @@ typedef struct particle3_t
float aty[3];
float rro[2];
} particle4_t;
-/*
+/*
* ... and restore original alignment rules from stack
*/
#pragma pack(pop)
@@ -164,14 +162,14 @@ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf )
if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) ||
rbuf[i].lati != wbuf[j].lati ||
rbuf[i].longi != wbuf[j].longi ||
- !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) ||
- !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) )
+ !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) ||
+ !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) )
{
HDfprintf(stderr,"read and write buffers have differences\n");
HDfprintf(stderr,"%s %ld %f %f %d\n",
- rbuf[i].name,rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati);
+ rbuf[i].name,rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati);
HDfprintf(stderr,"%s %ld %f %f %d\n",
- wbuf[j].name,wbuf[j].longi,(double)wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati);
+ wbuf[j].name,wbuf[j].longi,(double)wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati);
return -1;
}
return 0;
@@ -424,7 +422,7 @@ static int test_table(hid_t fid, int do_write)
sizeof( rbuf[0].lati)
};
- const char *field_names4[NFIELDS+1] =
+ const char *field_names4[NFIELDS+1] =
{ "F1", "F2", "F3", "F4", "F5", "F6"};
hid_t field_type4[NFIELDS+1];
particle4_t fill_data[1] = { {9999999, -9999999, 999999, {999,999,999},{999,999,999}, {999,999}} };
@@ -458,7 +456,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("making table");
+ HL_TESTING2("making table");
if (H5TBmake_table(TITLE,fid,"table1",FIELDS,RECORDS,type_size_mem,
field_names,field_offset,field_type,
@@ -467,7 +465,7 @@ static int test_table(hid_t fid, int do_write)
PASSED();
}
- TESTING2("reading table");
+ HL_TESTING2("reading table");
/*-------------------------------------------------------------------------
* read the table
@@ -497,7 +495,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("writing records");
+ HL_TESTING2("writing records");
/* create an empty table */
if (H5TBmake_table(TITLE,fid,"table2",FIELDS,RECORDS,type_size_mem,
@@ -540,7 +538,7 @@ static int test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- TESTING2("reading records");
+ HL_TESTING2("reading records");
/*-------------------------------------------------------------------------
* read records, start at 0, read 8
@@ -584,7 +582,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("appending records");
+ HL_TESTING2("appending records");
/*-------------------------------------------------------------------------
* append 2 records
@@ -630,7 +628,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("inserting records");
+ HL_TESTING2("inserting records");
/*-------------------------------------------------------------------------
* insert 2 records
@@ -690,7 +688,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("deleting records");
+ HL_TESTING2("deleting records");
/*-------------------------------------------------------------------------
* Create a table
@@ -883,54 +881,54 @@ static int test_table(hid_t fid, int do_write)
/*------------------------------------------------------------------------
* Functions tested:
*
- * H5TBdelete_record -- With differing memory layout from machine memory
+ * H5TBdelete_record -- With differing memory layout from machine memory
* layout. HDFFV-8055
*
*-------------------------------------------------------------------------
*/
if (do_write)
{
- TESTING2("deleting records (differing memory layout)");
+ HL_TESTING2("deleting records (differing memory layout)");
- dims = 3;
- arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
+ dims = 3;
+ arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
- dims = 2;
- arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
+ dims = 2;
+ arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims);
- /* Initialize the field field_type */
- field_type4[0] = H5T_NATIVE_UINT32;
- field_type4[1] = H5T_NATIVE_DOUBLE;
- field_type4[2] = H5T_NATIVE_DOUBLE;
- field_type4[3] = arry3_32f;
- field_type4[4] = arry3_32f;
- field_type4[5] = arry2_32f;
+ /* Initialize the field field_type */
+ field_type4[0] = H5T_NATIVE_UINT32;
+ field_type4[1] = H5T_NATIVE_DOUBLE;
+ field_type4[2] = H5T_NATIVE_DOUBLE;
+ field_type4[3] = arry3_32f;
+ field_type4[4] = arry3_32f;
+ field_type4[5] = arry2_32f;
- /* Make the table */
- if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS,
+ /* Make the table */
+ if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS,
tbl_size, field_names4, tbl_offset, field_type4,
chunk_size, fill_data, compress, p_data)<0)
- goto out;
- /* Delete records */
- start = 3;
- nrecords = 3;
- if (H5TBdelete_record(fid, "table", start, nrecords)<0)
- goto out;;
- /* Get table info */
- if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0)
- goto out;
- /* check */
- if( (int)nfields_out != (int)NFIELDS+1)
- goto out;
-
- if( (int)nrecords_out != (int)NRECORDS-3)
- goto out;
-
- /* close type */
- H5Tclose(arry3_32f);
- H5Tclose(arry2_32f);
-
- PASSED();
+ goto out;
+ /* Delete records */
+ start = 3;
+ nrecords = 3;
+ if (H5TBdelete_record(fid, "table", start, nrecords)<0)
+ goto out;;
+ /* Get table info */
+ if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0)
+ goto out;
+ /* check */
+ if( (int)nfields_out != (int)NFIELDS+1)
+ goto out;
+
+ if( (int)nrecords_out != (int)NRECORDS-3)
+ goto out;
+
+ /* close type */
+ H5Tclose(arry3_32f);
+ H5Tclose(arry2_32f);
+
+ PASSED();
}
/*-------------------------------------------------------------------------
@@ -945,7 +943,7 @@ static int test_table(hid_t fid, int do_write)
if (do_write)
{
- TESTING2("adding records");
+ HL_TESTING2("adding records");
/* create 2 tables */
if (H5TBmake_table(TITLE,fid,"table4",FIELDS,RECORDS,type_size_mem,
@@ -1005,7 +1003,7 @@ static int test_table(hid_t fid, int do_write)
if (do_write)
{
- TESTING2("combining tables");
+ HL_TESTING2("combining tables");
/* create 2 tables */
if (H5TBmake_table(TITLE,fid,"table6",FIELDS,RECORDS,type_size_mem,
@@ -1100,7 +1098,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("writing fields by name");
+ HL_TESTING2("writing fields by name");
/* make an empty table with fill values */
if (H5TBmake_table(TITLE,fid,"table9",FIELDS,RECORDS,type_size_mem,
@@ -1138,10 +1136,10 @@ static int test_table(hid_t fid, int do_write)
{
if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
- !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) )
+ !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) )
{
HDfprintf(stderr,"%ld %f %d\n",
- rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].lati);
+ rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].lati);
HDfprintf(stderr,"%ld %f %d\n",
position_in[i].longi,(double)pressure_in[i],position_in[i].lati);
goto out;
@@ -1163,7 +1161,7 @@ static int test_table(hid_t fid, int do_write)
*
*-------------------------------------------------------------------------
*/
- TESTING2("reading fields by name");
+ HL_TESTING2("reading fields by name");
/*-------------------------------------------------------------------------
* write and read the "Pressure" field
@@ -1191,7 +1189,7 @@ static int test_table(hid_t fid, int do_write)
if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords,
sizeof(float),0,field_sizes_pre,pressure_out) >=0)
goto out;
-
+
/* read the "Pressure" field */
if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords,
sizeof(float),0,field_sizes_pre,pressure_out)<0)
@@ -1263,7 +1261,7 @@ static int test_table(hid_t fid, int do_write)
for( i = 0; i < NRECORDS; i++ )
{
if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) {
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) {
goto out;
}
}
@@ -1292,7 +1290,7 @@ static int test_table(hid_t fid, int do_write)
{
hsize_t iistart = start;
if ( ( HDstrcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart+i].pressure) ) {
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart+i].pressure) ) {
goto out;
}
}
@@ -1311,7 +1309,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("writing fields by index");
+ HL_TESTING2("writing fields by index");
/* make an empty table */
if (H5TBmake_table(TITLE,fid,"table11",FIELDS,RECORDS,type_size_mem,
@@ -1351,7 +1349,7 @@ static int test_table(hid_t fid, int do_write)
{
if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
- !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) )
+ !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) )
goto out;
}
}
@@ -1369,7 +1367,7 @@ static int test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- TESTING2("reading fields by index");
+ HL_TESTING2("reading fields by index");
if (do_write)
{
@@ -1470,8 +1468,8 @@ static int test_table(hid_t fid, int do_write)
for( i = 0; i < NRECORDS; i++ )
{
if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) {
- goto out;
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) {
+ goto out;
}
}
@@ -1501,7 +1499,7 @@ static int test_table(hid_t fid, int do_write)
{
int iistart = (int) start;
if ( ( HDstrcmp( namepre_out[i].name, wbuf[iistart+(int)i].name ) != 0 ) ||
- !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart+(int)i].pressure) ) {
+ !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart+(int)i].pressure) ) {
goto out;
}
}
@@ -1520,7 +1518,7 @@ static int test_table(hid_t fid, int do_write)
if (do_write)
{
- TESTING2("inserting fields");
+ HL_TESTING2("inserting fields");
/* make a table */
if (H5TBmake_table(TITLE,fid,"table13",FIELDS,RECORDS,type_size_mem,
@@ -1544,8 +1542,8 @@ static int test_table(hid_t fid, int do_write)
if ( ( HDstrcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) ||
rbuf2[i].lati != wbuf[i].lati ||
rbuf2[i].longi != wbuf[i].longi ||
- !H5_FLT_ABS_EQUAL(rbuf2[i].pressure,wbuf[i].pressure) ||
- !H5_DBL_ABS_EQUAL(rbuf2[i].temperature,wbuf[i].temperature) ||
+ !H5_FLT_ABS_EQUAL(rbuf2[i].pressure,wbuf[i].pressure) ||
+ !H5_DBL_ABS_EQUAL(rbuf2[i].temperature,wbuf[i].temperature) ||
rbuf2[i].new_field != buf_new[i] ) {
goto out;
}
@@ -1563,7 +1561,7 @@ static int test_table(hid_t fid, int do_write)
*/
if (do_write)
{
- TESTING2("deleting fields");
+ HL_TESTING2("deleting fields");
/* make a table */
if (H5TBmake_table(TITLE,fid,"table14",FIELDS,RECORDS,type_size_mem,
@@ -1585,7 +1583,7 @@ static int test_table(hid_t fid, int do_write)
if ( ( HDstrcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) ||
rbuf3[i].lati != wbuf[i].lati ||
rbuf3[i].longi != wbuf[i].longi ||
- !H5_DBL_ABS_EQUAL(rbuf3[i].temperature,wbuf[i].temperature) ) {
+ !H5_DBL_ABS_EQUAL(rbuf3[i].temperature,wbuf[i].temperature) ) {
goto out;
}
}
@@ -1603,7 +1601,7 @@ static int test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- TESTING2("getting table info");
+ HL_TESTING2("getting table info");
/* get table info */
if ( H5TBget_table_info (fid, "table1", &rfields, &rrecords ) < 0 )
@@ -1624,7 +1622,7 @@ static int test_table(hid_t fid, int do_write)
*-------------------------------------------------------------------------
*/
- TESTING2("getting field info");
+ HL_TESTING2("getting field info");
/* alocate */
names_out = (char**) HDmalloc( sizeof(char*) * (size_t)NFIELDS );
diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt
index 9536517..fd9b6d9 100644
--- a/hl/tools/CMakeLists.txt
+++ b/hl/tools/CMakeLists.txt
@@ -1,6 +1,6 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_TOOLS C CXX)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_TOOLS C)
-add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5 ${HDF5_HL_TOOLS_BINARY_DIR}/gif2h5)
+add_subdirectory (gif2h5)
-add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/h5watch ${HDF5_HL_TOOLS_BINARY_DIR}/h5watch)
+add_subdirectory (h5watch)
diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt
index 9d7a406..0b895a3 100644
--- a/hl/tools/gif2h5/CMakeLists.txt
+++ b/hl/tools/gif2h5/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_TOOLS_GIF2H5)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_TOOLS_GIF2H5 C)
#-----------------------------------------------------------------------------
# Define Sources
@@ -14,45 +14,82 @@ set (GIF2H5_SOURCES
)
#-- Add gif2hdf5 program
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
-INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR})
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (gif2h5 ${GIF2H5_SOURCES})
+ target_compile_options(gif2h5 PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (gif2h5 STATIC)
+ target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5")
+ set (H5_DEP_EXECUTABLES
+ gif2h5
+ )
+endif ()
-add_executable (gif2h5 ${GIF2H5_SOURCES})
-TARGET_NAMING (gif2h5 STATIC)
-TARGET_C_PROPERTIES (gif2h5 STATIC " " " ")
-target_link_libraries (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5")
+if (BUILD_SHARED_LIBS)
+ add_executable (gif2h5-shared ${GIF2H5_SOURCES})
+ target_compile_options(gif2h5-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (gif2h5-shared SHARED)
+ target_link_libraries (gif2h5-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (gif2h5-shared PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5-shared")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ gif2h5-shared
+ )
+endif ()
#-- Add h52gif program
set (hdf2gif_SOURCES
${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdf2gif.c
${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdfgifwr.c
)
-add_executable (h52gif ${hdf2gif_SOURCES})
-TARGET_NAMING (h52gif STATIC)
-TARGET_C_PROPERTIES (h52gif STATIC " " " ")
-target_link_libraries (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h52gif PROPERTIES FOLDER tools/hl)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h52gif ${hdf2gif_SOURCES})
+ target_compile_options(h52gif PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h52gif STATIC)
+ target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h52gif PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h52gif
+ )
+endif ()
-if (BUILD_TESTING)
+if (BUILD_SHARED_LIBS)
+ add_executable (h52gif-shared ${hdf2gif_SOURCES})
+ target_compile_options(h52gif-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h52gif-shared SHARED)
+ target_link_libraries (h52gif-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (h52gif-shared PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif-shared")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h52gif-shared
+ )
+endif ()
+
+if (BUILD_TESTING AND HDF5_TEST_SERIAL)
# --------------------------------------------------------------------
# This executable can generate the actual test files - Currently not
# used in the CMake Build system as we rely on the test files that are
# shipped with HDF5 source archives
# --------------------------------------------------------------------
- if (HDF5_BUILD_GENERATORS)
+ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/h52gifgentst.c)
- TARGET_NAMING (hl_h52gifgentest STATIC)
- TARGET_C_PROPERTIES (hl_h52gifgentest STATIC " " " ")
- target_link_libraries (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (hl_h52gifgentest STATIC)
+ target_link_libraries (hl_h52gifgentest PRIVATE ${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>)
+# add_test (NAME hl_h52gifgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_h52gifgentest>)
endif ()
- include (CMakeTests.cmake)
+ if (HDF5_TEST_TOOLS)
+ include (CMakeTests.cmake)
+ endif ()
endif ()
#-----------------------------------------------------------------------------
@@ -61,8 +98,7 @@ endif ()
if (HDF5_EXPORTED_TARGETS)
install (
TARGETS
- gif2h5
- h52gif
+ ${H5_DEP_EXECUTABLES}
EXPORT
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications
diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake
index 61c004e..094a7b5 100644
--- a/hl/tools/gif2h5/CMakeTests.cmake
+++ b/hl/tools/gif2h5/CMakeTests.cmake
@@ -37,20 +37,32 @@ add_test (
image.gif
image24.gif
)
+set_tests_properties (HL_TOOLS-clear-objects PROPERTIES FIXTURES_SETUP clear_tools_hl)
-add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5)
-set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects)
+add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:gif2h5${tgt_file_ext}> testfiles/image1.gif image1.h5)
+set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES
+ FIXTURES_REQUIRED clear_tools_hl
+)
-add_test (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image)
-set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects)
+add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/h52giftst.h5 image1.gif -i image)
+set_tests_properties (HL_TOOLS_h52gif PROPERTIES
+ FIXTURES_REQUIRED clear_tools_hl
+)
-add_test (NAME HL_TOOLS_h52gif_none COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i nosuch_image)
-set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true")
-set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects)
+add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/h52giftst.h5 image.gif -i nosuch_image)
+set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES
+ WILL_FAIL "true"
+ FIXTURES_REQUIRED clear_tools_hl
+)
-#add_test (NAME HL_TOOLS_h52gifpal COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i palette)
-#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true")
+#add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/h52giftst.h5 image.gif -i palette)
+#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES
+# WILL_FAIL "true"
+# FIXTURES_REQUIRED clear_tools_hl
+#)
-add_test (NAME HL_TOOLS_h52gif24bits COMMAND $<TARGET_FILE:h52gif> testfiles/ex_image2.h5 image24.gif -i image24bitpixel)
-set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true")
-set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects)
+add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h52gif${tgt_file_ext}> testfiles/ex_image2.h5 image24.gif -i image24bitpixel)
+set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES
+ WILL_FAIL "true"
+ FIXTURES_REQUIRED clear_tools_hl
+)
diff --git a/hl/tools/gif2h5/Makefile.am b/hl/tools/gif2h5/Makefile.am
index d30d66a..9de2135 100644
--- a/hl/tools/gif2h5/Makefile.am
+++ b/hl/tools/gif2h5/Makefile.am
@@ -23,26 +23,28 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/sr
# These are our main targets, the tools
-TEST_SCRIPT=h52giftest.sh
-check_SCRIPTS=$(TEST_SCRIPT)
-
bin_PROGRAMS=gif2h5 h52gif
-noinst_PROGRAMS=h52gifgentst
# Add h52gif and gif2h5 specific linker flags here
h52gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
gif2h5_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
-gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c
+gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c
-h52gif_SOURCES=hdf2gif.c hdfgifwr.c
+h52gif_SOURCES=hdf2gif.c hdfgifwr.c
-h52gifgentst_SOURCES=h52gifgentst.c
# Programs all depend on the hdf5 library, the tools library, and the HL
# library.
LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5)
+if BUILD_TESTS_CONDITIONAL
+ TEST_SCRIPT=h52giftest.sh
+ check_SCRIPTS=$(TEST_SCRIPT)
+ noinst_PROGRAMS=h52gifgentst
+ h52gifgentst_SOURCES=h52gifgentst.c
+endif
+
CHECK_CLEANFILES+=*.h5
CHECK_CLEANFILES+=*.gif
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 453db12..129fa60 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -15,13 +15,13 @@
#include "gif.h"
-WORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip;
+GIFWORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip;
unsigned long cols[256];
char *cmd;
FILE *fp;
-static WORD
+static GIFWORD
XC = 0, YC = 0, /* Output X and Y coords of current pixel */
InitCodeSize, /* Starting code size, used during Clear */
CodeSize, /* Code size, read from GIF header */
@@ -29,7 +29,7 @@ static WORD
IWidth, IHeight; /* image dimensions */
static int
BitOffset = 0, /* Bit Offset of next code */
- Pass = 0, /* Used by output routine if WORDerlaced pic */
+ Pass = 0, /* Used by output routine if GIFWORDerlaced pic */
OutCount = 0, /* Decompressor output 'stack count' */
Code, /* Value returned by ReadCode */
MaxCode, /* limiting value for current code size */
@@ -43,26 +43,26 @@ static int
ReadMask; /* Code AND mask for current code size */
/*MODIFICATIONS*/
-BYTE tempbyte[10];
-BYTE * tempBYTEptr[10];
-WORD tempint[10];
-WORD ImageCount = 0;
+GIFBYTE tempbyte[10];
+GIFBYTE * tempGIFBYTEptr[10];
+GIFWORD tempint[10];
+GIFWORD ImageCount = 0;
/*END MODIFICATION*/
boolean Interlace, HasColormap;
-BYTE *Image; /* The result array */
-BYTE *RawGIF; /* The heap array to hold it, raw */
-BYTE *Raster; /* The raster data stream, unblocked */
+GIFBYTE *Image; /* The result array */
+GIFBYTE *RawGIF; /* The heap array to hold it, raw */
+GIFBYTE *Raster; /* The raster data stream, unblocked */
/* The hash table used by the decompressor */
-int Prefix[4096];
-int Suffix[4096];
+int *Prefix;
+int *Suffix;
/* An output array used by the decompressor */
-int OutCode[1025];
+int *OutCode;
/* The color map, read from the GIF header */
@@ -70,10 +70,10 @@ int numused;
/*
* Fetch the next code from the raster data stream. The codes can be any
- * length from 3 to 12 bits, packed WORDo 8-bit BYTEs, so we have to maWORDain
- * our location in the Raster array as a BIT Offset. We compute the BYTE
- * Offset WORDo the raster array by dividing this by 8, pick up three BYTEs,
- * compute the bit Offset WORDo our 24-bit chunk, shift to bring the desired
+ * length from 3 to 12 bits, packed into 8-bit GIFBYTEs, so we have to maintain
+ * our location in the Raster array as a BIT Offset. We compute the GIFBYTE
+ * Offset into the raster array by dividing this by 8, pick up three GIFBYTEs,
+ * compute the bit Offset into our 24-bit chunk, shift to bring the desired
* code to the bottom, then mask it off and return it.
*/
static int
@@ -93,7 +93,7 @@ ReadCode(void)
}
static void
-AddToPixel(BYTE Index)
+AddToPixel(GIFBYTE Index)
{
if (YC<IHeight)
*(Image + YC * BytesPerScanline + XC) = Index;
@@ -104,8 +104,8 @@ AddToPixel(BYTE Index)
* Y-coordinate */
if (++XC == IWidth) {
/*
- * If a non-WORDerlaced picture, just increment YC to the next scan
- * line. If it's WORDerlaced, deal with the WORDerlace as described
+ * If a non-interlaced picture, just increment YC to the next scan
+ * line. If it's interlaced, deal with the interlace as described
* in the GIF spec. Put the decoded scan line out to the screen if we
* haven't gone past the bottom of it.
*/
@@ -154,11 +154,24 @@ AddToPixel(BYTE Index)
/* Main routine. Convert a GIF image to an HDF image */
-BYTE *
+GIFBYTE *
Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
{
int i;
+ if (!(Prefix = calloc(4096, sizeof(int)))) {
+ printf("Out of memory");
+ exit(EXIT_FAILURE);
+ }
+ if (!(Suffix = calloc(4096, sizeof(int)))) {
+ printf("Out of memory");
+ exit(EXIT_FAILURE);
+ }
+ if (!(OutCode = calloc(1024, sizeof(int)))) {
+ printf("Out of memory");
+ exit(EXIT_FAILURE);
+ }
+
XC = 0;
YC = 0;
Pass = 0;
@@ -173,7 +186,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
/* Now read in values from the image descriptor */
IWidth = GifImageDesc->ImageWidth;
IHeight = GifImageDesc->ImageHeight;
- Interlace = GifImageDesc->PackedField & 0x40;
+ Interlace = (uint8_t)(GifImageDesc->PackedField & 0x40);
/*
* Note that I ignore the possible existence of a local color map. I'm
@@ -183,7 +196,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
*/
/*
- * Start reading the raster data. First we get the WORDial code size and
+ * Start reading the raster data. First we get the intial code size and
* compute decompressor constant values, based on this code size.
*/
@@ -206,13 +219,13 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
/*
* Read the raster data. Here we just transpose it from the GIF array to
- * the Raster array, turning it from a series of blocks WORDo one long
+ * the Raster array, turning it from a series of blocks into one long
* data stream, which makes life much easier for ReadCode().
*/
/* Allocate the Image */
- if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
+ if (!(Image = (GIFBYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
printf("Out of memory");
exit(EXIT_FAILURE);
}
@@ -238,7 +251,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
FreeCode = FirstFree;
CurCode = OldCode = Code = ReadCode();
FinChar = CurCode & DataMask;
- AddToPixel((BYTE)FinChar);
+ AddToPixel((GIFBYTE)FinChar);
} else {
/*
* If not a clear code, then must be data: save same as CurCode
@@ -256,12 +269,12 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
}
/*
- * Unless this code is raw data, pursue the chain poWORDed to by
+ * Unless this code is raw data, pursue the chain pointed to by
* CurCode through the hash table to its end; each code in the
* chain puts its associated output code on the output queue.
*/
while (CurCode > DataMask) {
- if (OutCount > 1024) {
+ if (OutCount >= 1024) {
/*return error message*/
}
@@ -278,7 +291,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
* stacked LIFO, so deal with it that way...
*/
for (i = OutCount - 1; i >= 0; i--)
- AddToPixel((BYTE)OutCode[i]);
+ AddToPixel((GIFBYTE)OutCode[i]);
OutCount = 0;
@@ -291,7 +304,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
OldCode = InCode;
/*
- * PoWORD to the next slot in the table. If we exceed the current
+ * Point to the next slot in the table. If we exceed the current
* MaxCode value, increment the code size unless it's already 12.
* If it is, do nothing: the next code decompressed better be
* CLEAR
@@ -309,5 +322,9 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
Code = ReadCode();
}
+ free(Prefix);
+ free(Suffix);
+ free(OutCode);
+
return Image;
}
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h
index ed1cc81..0c0f963 100644
--- a/hl/tools/gif2h5/gif.h
+++ b/hl/tools/gif2h5/gif.h
@@ -26,17 +26,24 @@
#define MAX_PAL 768
-/* typedef H5T_NATIVE_UINT8 BYTE; */
-typedef unsigned char BYTE;
+/* typedef H5T_NATIVE_UINT8 GIFBYTE; */
+typedef unsigned char GIFBYTE;
-/* typedef H5T_NATIVE_UINT16 WORD; */
-typedef unsigned long WORD;
+/* typedef H5T_NATIVE_UINT16 GIFWORD; */
+typedef unsigned long GIFWORD;
-typedef char CHAR;
+typedef char GIFCHAR;
+
+#ifndef boolean
typedef unsigned char boolean;
+#endif
+#ifndef false
#define false 0
+#endif
+#ifndef true
#define true 1
+#endif
/* Set the EndianOrder.
** The GIF Reader file should do this.
@@ -52,15 +59,15 @@ extern int EndianOrder;
** descriptor, and the global color table for the GIF image.
*/
typedef struct _GifHeader { /* Offset Description */
- BYTE PackedField; /* 0Ah Color Information */
- WORD TableSize;
- BYTE ImageCount; /* Keep a count of the number of images */
- BYTE CommentCount;
- BYTE ApplicationCount;
- BYTE PlainTextCount;
- BYTE HDFPalette[256][3];
- BYTE HeaderDump[6]; /* BYTE array to dump header contents */
- BYTE LSDDump[7]; /* Logical Screen Descriptor dump */
+ GIFBYTE PackedField; /* 0Ah Color Information */
+ GIFWORD TableSize;
+ GIFBYTE ImageCount; /* Keep a count of the number of images */
+ GIFBYTE CommentCount;
+ GIFBYTE ApplicationCount;
+ GIFBYTE PlainTextCount;
+ GIFBYTE HDFPalette[256][3];
+ GIFBYTE HeaderDump[6]; /* GIFBYTE array to dump header contents */
+ GIFBYTE LSDDump[7]; /* Logical Screen Descriptor dump */
} GIFHEAD;
@@ -68,32 +75,32 @@ typedef struct _GifHeader { /* Offset Description */
** The GIF Image Descriptor.
*/
typedef struct _GifImageDescriptor {
- WORD ImageWidth; /* Width of the image in pixels */
- WORD ImageHeight; /* Height of the image in pixels */
- BYTE PackedField; /* Image and Color Table Data Information */
- WORD TableSize;
- WORD CodeSize; /* Minimum LZW CodeSize for image data */
- BYTE HDFPalette[256][3];
- BYTE GIDDump[9]; /* GifImageDescriptor dump */
-
- BYTE *Image; /* Decompressed Raster Image */
- BYTE *GIFImage;
+ GIFWORD ImageWidth; /* Width of the image in pixels */
+ GIFWORD ImageHeight; /* Height of the image in pixels */
+ GIFBYTE PackedField; /* Image and Color Table Data Information */
+ GIFWORD TableSize;
+ GIFWORD CodeSize; /* Minimum LZW CodeSize for image data */
+ GIFBYTE HDFPalette[256][3];
+ GIFBYTE GIDDump[9]; /* GifImageDescriptor dump */
+
+ GIFBYTE *Image; /* Decompressed Raster Image */
+ GIFBYTE *GIFImage;
} GIFIMAGEDESC;
/*
** GIF 89a Graphic Control Extension Block
*/
typedef struct _GifGraphicControlExtension {
- BYTE GCEDump[5]; /* Graphic Control Extension Dump */
+ GIFBYTE GCEDump[5]; /* Graphic Control Extension Dump */
} GIFGRAPHICCONTROL;
/*
** GIF 89a Plain Text Extension Block
*/
typedef struct _GifPlainTextExtension {
- BYTE PTEDump[15]; /* Plain Text Extension Dump */
- BYTE *PlainTextData; /* Plain Text data sub-blocks */
- WORD DataSize;
+ GIFBYTE PTEDump[15]; /* Plain Text Extension Dump */
+ GIFBYTE *PlainTextData; /* Plain Text data sub-blocks */
+ GIFWORD DataSize;
} GIFPLAINTEXT;
@@ -101,19 +108,19 @@ typedef struct _GifPlainTextExtension {
** GIF 89a Application Extension Block
*/
typedef struct _GifApplicationExtension {
- BYTE AEDump[14]; /* Application Extension Dump */
- BYTE *ApplicationData; /* Application data sub-blocks */
- WORD DataSize;
+ GIFBYTE AEDump[14]; /* Application Extension Dump */
+ GIFBYTE *ApplicationData; /* Application data sub-blocks */
+ GIFWORD DataSize;
} GIFAPPLICATION;
/*
** GIF 89a Comment Extension Block
*/
typedef struct _GifCommentExtension {
- BYTE CEDump[2]; /* Comment Extension Dump */
- BYTE *CommentData; /* Comment data sub-blocks */
- WORD DataSize;
- BYTE Terminator; /* Block Terminator (always 0) */
+ GIFBYTE CEDump[2]; /* Comment Extension Dump */
+ GIFBYTE *CommentData; /* Comment data sub-blocks */
+ GIFWORD DataSize;
+ GIFBYTE Terminator; /* Block Terminator (always 0) */
} GIFCOMMENT;
/*
@@ -128,12 +135,12 @@ typedef struct _GifCommentExtension {
** extension.
*/
typedef struct _GifToMem {
- GIFHEAD *GifHeader;
- GIFIMAGEDESC **GifImageDesc;
- GIFGRAPHICCONTROL **GifGraphicControlExtension;
- GIFPLAINTEXT **GifPlainTextExtension;
- GIFAPPLICATION **GifApplicationExtension;
- GIFCOMMENT **GifCommentExtension;
+ GIFHEAD *GifHeader;
+ GIFIMAGEDESC **GifImageDesc;
+ GIFGRAPHICCONTROL **GifGraphicControlExtension;
+ GIFPLAINTEXT **GifPlainTextExtension;
+ GIFAPPLICATION **GifApplicationExtension;
+ GIFCOMMENT **GifCommentExtension;
} GIFTOMEM;
/*
@@ -141,40 +148,40 @@ typedef struct _GifToMem {
*/
/* GIF2MEM.C */
-int Gif2Mem(BYTE *, GIFTOMEM *);
+int Gif2Mem(GIFBYTE *, GIFTOMEM *);
/* GIFREAD.C */
-int ReadGifHeader(GIFHEAD *, BYTE **);
-int ReadGifImageDesc(GIFIMAGEDESC *, BYTE **);
-int ReadGifGraphicControl(GIFGRAPHICCONTROL *, BYTE **);
-int ReadGifPlainText(GIFPLAINTEXT *, BYTE **);
-int ReadGifApplication(GIFAPPLICATION *, BYTE **);
-int ReadGifComment(GIFCOMMENT *, BYTE **);
+int ReadGifHeader(GIFHEAD *, GIFBYTE **);
+int ReadGifImageDesc(GIFIMAGEDESC *, GIFBYTE **);
+int ReadGifGraphicControl(GIFGRAPHICCONTROL *, GIFBYTE **);
+int ReadGifPlainText(GIFPLAINTEXT *, GIFBYTE **);
+int ReadGifApplication(GIFAPPLICATION *, GIFBYTE **);
+int ReadGifComment(GIFCOMMENT *, GIFBYTE **);
/* HDFGIFWR.C */
-int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap,
- BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, int numcols,
+int hdfWriteGIF(FILE *fp, GIFBYTE *pic, int ptype, int w, int h, GIFBYTE *rmap,
+ GIFBYTE *gmap, GIFBYTE *bmap, GIFBYTE *pc2ncmap, int numcols,
int colorstyle, int BitsPerPixel);
/* WRITEHDF.C */
-int WriteHDF(GIFTOMEM , CHAR * );
+int WriteHDF(GIFTOMEM , GIFCHAR * );
/* Function: ReadHDF
** Return: 0 on completion without error, -1 on error
-** Input: CHAR *h5_file - HDF file name
-** CHAR *dset_name - Name of the HDF Image dataset
-** CHAR *pal_name - Name of the HDF palette
-** Output: BYTE* data - the HDF Image to be converted
-** BYTE palette[256][3] - the corresponding palette
+** Input: GIFCHAR *h5_file - HDF file name
+** GIFCHAR *dset_name - Name of the HDF Image dataset
+** GIFCHAR *pal_name - Name of the HDF palette
+** Output: GIFBYTE* data - the HDF Image to be converted
+** GIFBYTE palette[256][3] - the corresponding palette
** hsize_t* image_size - the size of each dimension of the image
*/
-int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
- CHAR *h5_file, CHAR *dset_name, CHAR *pal_name);
+int ReadHDF(GIFBYTE** data, GIFBYTE palette[256][3], hsize_t *image_size,
+ GIFCHAR *h5_file, GIFCHAR *dset_name, GIFCHAR *pal_name);
-BYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *);
-BYTE GetByte(BYTE *);
-WORD GetWord(BYTE *);
+GIFBYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *);
+GIFBYTE GetByte(GIFBYTE *);
+GIFWORD GetWord(GIFBYTE *);
-void cleanup(BYTE*);
+void cleanup(GIFBYTE*);
#endif /* GIF_H_ */
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index 2e06d34..051ff56 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -31,8 +31,8 @@ main(int argv , char *argc[])
long i, ImageCount;
long filesize;
- BYTE *MemGif;
- BYTE *StartPos;
+ GIFBYTE *MemGif;
+ GIFBYTE *StartPos;
char *GIFFileName;
char *HDFFileName;
@@ -81,7 +81,7 @@ main(int argv , char *argc[])
if (filesize == 0)
printf("File Size Zero");
- if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) {
+ if (!(MemGif = StartPos = (GIFBYTE *)malloc((size_t)filesize))) {
printf("Out of memory");
exit(EXIT_FAILURE);
}
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index ec029ea..ae0a113 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -36,7 +36,7 @@
#include "gif.h"
int
-Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
+Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
{
/*
* The gif structure outline for passing data to memory is given in gif.h.
@@ -49,22 +49,22 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
GIFCOMMENT **gifComment; /* Comment Extension structure */
GIFGRAPHICCONTROL **gifGraphicControl; /* Graphic Control Extension strct */
- register WORD i; /* Loop counter */
- BYTE Identifier; /* Extension block identifier holder */
- BYTE Label; /* Extension block label holder */
- BYTE ImageCount; /* Count of the number of images in the file */
- BYTE ImageArray; /* Keep the size of the array to store Images */
- BYTE CommentCount;
- BYTE CommentArray;
- BYTE ApplicationCount;
- BYTE ApplicationArray;
- BYTE PlainTextCount;
- BYTE PlainTextArray;
- BYTE GCEflag;
- BYTE aTemp;
- BYTE j;
- BYTE w; /* Two more variables needed only while testing */
- BYTE *b; /* Endian Ordering */
+ register GIFWORD i; /* Loop counter */
+ GIFBYTE Identifier; /* Extension block identifier holder */
+ GIFBYTE Label; /* Extension block label holder */
+ GIFBYTE ImageCount; /* Count of the number of images in the file */
+ GIFBYTE ImageArray; /* Keep the size of the array to store Images */
+ GIFBYTE CommentCount;
+ GIFBYTE CommentArray;
+ GIFBYTE ApplicationCount;
+ GIFBYTE ApplicationArray;
+ GIFBYTE PlainTextCount;
+ GIFBYTE PlainTextArray;
+ GIFBYTE GCEflag;
+ GIFBYTE aTemp;
+ GIFBYTE j;
+ GIFBYTE w; /* Two more variables needed only while testing */
+ GIFBYTE *b; /* Endian Ordering */
/* Allocate memory for the GIF structures */
/* Plug the structs into GifMemoryStruct at the end */
@@ -90,7 +90,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
/* Carry out Endian Testing and set Endian Order */
w = 0x0001;
- b = (BYTE *) &w;
+ b = (GIFBYTE *) &w;
EndianOrder = (b[0] ? 1 : 0);
/* Read the GIF image file header information */
@@ -151,7 +151,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
if (ImageCount > ImageArray) {
aTemp = ImageArray;
- ImageArray = (BYTE)((ImageArray << 1) + 1);
+ ImageArray = (GIFBYTE)((ImageArray << 1) + 1);
if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc,
sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
@@ -218,7 +218,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
PlainTextCount++;
if (PlainTextCount > PlainTextArray)
- PlainTextArray = (BYTE)((PlainTextArray << 1) + 1);
+ PlainTextArray = (GIFBYTE)((PlainTextArray << 1) + 1);
if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) {
printf("Out of memory!");
@@ -240,7 +240,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
CommentCount++;
if (CommentCount > CommentArray)
- CommentArray = (BYTE)((CommentArray << 1) + 1);
+ CommentArray = (GIFBYTE)((CommentArray << 1) + 1);
if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) {
printf("Out of memory!");
@@ -267,7 +267,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
if (ImageCount > ImageArray) {
aTemp = ImageArray;
- ImageArray = (BYTE)((ImageArray << 1) + 1);
+ ImageArray = (GIFBYTE)((ImageArray << 1) + 1);
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
@@ -295,7 +295,8 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
fprintf(stderr,
"Error reading Graphic Control Extension information\n");
- if (!*MemGif++ == 0)
+ (*MemGif)++;
+ if ((!*MemGif) == 0)
fprintf(stderr,
"Error reading Graphic Control Extension\n");
@@ -305,7 +306,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
ApplicationCount++;
if (ApplicationCount > ApplicationArray)
- ApplicationArray = (BYTE)((ApplicationArray << 1) + 1);
+ ApplicationArray = (GIFBYTE)((ApplicationArray << 1) + 1);
if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) {
printf("Out of memory!");
diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c
index 948e112..79671aa 100644
--- a/hl/tools/gif2h5/gifread.c
+++ b/hl/tools/gif2h5/gifread.c
@@ -17,33 +17,33 @@
int EndianOrder;
-static BYTE *ReadDataSubBlocks(BYTE **MemGif2, WORD *DSize);
+static GIFBYTE *ReadDataSubBlocks(GIFBYTE **MemGif2, GIFWORD *DSize);
-WORD
-GetWord(BYTE *MemGif)
+GIFWORD
+GetWord(GIFBYTE *MemGif)
{
- WORD w;
+ GIFWORD w;
if (EndianOrder == 1) {
/* LittleEndian */
- w = (WORD) (*MemGif++ & 0xFF);
- w |= (WORD) ((*MemGif++ & 0xFF) << 0x08);
+ w = (GIFWORD) (*MemGif++ & 0xFF);
+ w |= (GIFWORD) ((*MemGif++ & 0xFF) << 0x08);
} else {
- w = (WORD) (*MemGif++ & 0xFF);
- w = ((WORD) (*MemGif++ & 0xFF)) | (w << 0x08);
+ w = (GIFWORD) (*MemGif++ & 0xFF);
+ w = ((GIFWORD) (*MemGif++ & 0xFF)) | (w << 0x08);
}
return w;
}
-BYTE
-GetByte(BYTE *MemGif)
+GIFBYTE
+GetByte(GIFBYTE *MemGif)
{
return *MemGif;
}
/*
- * Read a GIF image BYTE Header.
+ * Read a GIF image GIFBYTE Header.
*
* This function reads the Header, Logical Screen Descriptor, and
* Global Color Table (if any) from a GIF image file. The information
@@ -54,10 +54,10 @@ GetByte(BYTE *MemGif)
*/
int
ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
- BYTE **MemGif2) /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2) /* GIF image file input FILE stream */
{
- WORD i; /* Loop counter */
- WORD tableSize; /* Number of entires in the Global Color Table */
+ GIFWORD i; /* Loop counter */
+ GIFWORD tableSize; /* Number of entires in the Global Color Table */
GifHead->TableSize = 0;
for (i = 0 ; i < 6 ; i++) {
@@ -78,7 +78,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
/* Check if a Global Color Table is present */
if (GifHead->PackedField & 0x80) {
/* Read number of color table entries */
- tableSize = (WORD) (1L << ((GifHead->PackedField & 0x07) + 1));
+ tableSize = (GIFWORD) (1L << ((GifHead->PackedField & 0x07) + 1));
GifHead->TableSize = tableSize;
/* Read the Global Color Table */
@@ -122,13 +122,13 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
int
ReadGifImageDesc(
GIFIMAGEDESC *GifImageDesc, /* Pointer to GIF image descriptor structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
- WORD i; /* Loop counter */
- WORD tableSize; /* Number of entries in the Local Color Table */
- /* BYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
- BYTE *TempPtr;
+ GIFWORD i; /* Loop counter */
+ GIFWORD tableSize; /* Number of entries in the Local Color Table */
+ /* GIFBYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
+ GIFBYTE *TempPtr;
int ch , ch1;
GifImageDesc->TableSize = 0;
@@ -145,20 +145,20 @@ ReadGifImageDesc(
if (EndianOrder == 1) /* LittleEndian */
{
- GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth |= (WORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
+ GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth |= (GIFWORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
- GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
- GifImageDesc->ImageHeight |= (WORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
+ GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight |= (GIFWORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
}
else
{
- GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth = ((WORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth = ((GIFWORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
- GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
- GifImageDesc->ImageHeight = ((WORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight = ((GIFWORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
}
@@ -171,7 +171,7 @@ ReadGifImageDesc(
if (GifImageDesc->PackedField & 0x80)
{
/* Read number of color table entries */
- tableSize = (WORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1));
+ tableSize = (GIFWORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1));
GifImageDesc->TableSize = tableSize;
/* Read the Local Color Table */
for (i = 0; i < tableSize; i++)
@@ -185,10 +185,10 @@ ReadGifImageDesc(
/*
** Get LZW minimum Code Size
*/
- GifImageDesc->CodeSize = (WORD)*(*MemGif2)++;
+ GifImageDesc->CodeSize = (GIFWORD)*(*MemGif2)++;
/*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
- if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
+ if (!(GifImageDesc->GIFImage = (GIFBYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
printf("Out of memory");
exit(EXIT_FAILURE);
}
@@ -219,7 +219,7 @@ ReadGifImageDesc(
int
ReadGifGraphicControl(
GIFGRAPHICCONTROL *GifGraphicControl, /* Pointer to GC Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
int i;
@@ -244,7 +244,7 @@ ReadGifGraphicControl(
int
ReadGifPlainText(
GIFPLAINTEXT *GifPlainText, /* Pointer to Plain Text Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
int i;
@@ -283,7 +283,7 @@ ReadGifPlainText(
int
ReadGifApplication(
GIFAPPLICATION *GifApplication, /* Pointer to Application Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
int i;
@@ -321,7 +321,7 @@ ReadGifApplication(
int
ReadGifComment(
GIFCOMMENT *GifComment, /* Pointer to GIF Comment Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
@@ -345,14 +345,14 @@ ReadGifComment(
** Returns: A NULL pointer if a memory allocation error occured,
** otherwise a valid pointer if no error occured.
*/
-static BYTE *
-ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream */
- WORD *DSize)
+static GIFBYTE *
+ReadDataSubBlocks(GIFBYTE **MemGif2, /* GIF image file input FILE stream */
+ GIFWORD *DSize)
{
- BYTE *ptr1; /* Pointer used to "walk the heap" */
- BYTE *ptr2; /* Pointer used to mark the top of the heap */
- BYTE dataSize; /* Size of the current data sub-block being read */
- WORD bufSize; /* Total size of the Plain Text data buffer */
+ GIFBYTE *ptr1; /* Pointer used to "walk the heap" */
+ GIFBYTE *ptr2; /* Pointer used to mark the top of the heap */
+ GIFBYTE dataSize; /* Size of the current data sub-block being read */
+ GIFWORD bufSize; /* Total size of the Plain Text data buffer */
int tempcount = 0;
bufSize = 0; /* The output buffer is empty */
@@ -360,9 +360,9 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream
dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */
/* Allocate initial data buffer */
- if (!(ptr1 = ptr2 = (BYTE *) malloc((size_t)dataSize + 1))) {
+ if (!(ptr1 = ptr2 = (GIFBYTE *) malloc((size_t)dataSize + 1))) {
printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed");
- return((BYTE *) NULL);
+ return((GIFBYTE *) NULL);
}
for (;;)
{
@@ -381,8 +381,8 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream
break; /* Block Terminator encountered */
/* Increase the buffer size to accomodate the next sub-block */
- if (!(ptr1 = ptr2 = (BYTE *) realloc(ptr2, bufSize + dataSize + 1)))
- return((BYTE *) NULL);
+ if (!(ptr1 = ptr2 = (GIFBYTE *) realloc(ptr2, bufSize + dataSize + 1)))
+ return((GIFBYTE *) NULL);
ptr1 += bufSize; /* Move pointer to the end of the data */
diff --git a/hl/tools/gif2h5/h52giftest.sh.in b/hl/tools/gif2h5/h52giftest.sh.in
index 5643e30..02c9e89 100644
--- a/hl/tools/gif2h5/h52giftest.sh.in
+++ b/hl/tools/gif2h5/h52giftest.sh.in
@@ -70,20 +70,20 @@ echo ""
# Positive tests for h52gif
echo "**validate the h52gif tool processes input correctly..."
-TESTING "./h52gif h52giftst.h5 image1.gif -i image"
+TESTING "./h52gif h52giftst.h5 image1.gif -i image"
TOOLTEST ./h52gif $TESTFILE1 image1.gif -i image
echo ""
# Negative tests.
echo "**verify that the h52gif tool handles error conditions correctly..."
# nonexisting dataset name
-TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image"
-TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image"
+TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image"
+TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image"
# this test should have failed but it did not. Comment it out for now.
-#TESTING "./h52gif h52giftst.h5 image.gif -i palette"
-#TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i palette"
-TESTING "./h52gif h52giftst.h5 image24.gif -i image24bitpixel"
-TOOLTESTFAIL "./h52gif $TESTFILE3 image24.gif -i image24bitpixel"
+#TESTING "./h52gif h52giftst.h5 image.gif -i palette"
+#TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i palette"
+TESTING "./h52gif h52giftst.h5 image24.gif -i image24bitpixel"
+TOOLTESTFAIL "./h52gif $TESTFILE3 image24.gif -i image24bitpixel"
echo ""
# all done. summarize results.
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index ae63e92..0e2a898 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -45,20 +45,20 @@ usage(void)
FILE *fpGif = NULL;
int main(int argc , char **argv)
{
- BYTE *Image;
+ GIFBYTE *Image;
void *edata;
H5E_auto2_t func;
/* compression structs */
- CHAR *HDFName = NULL;
- CHAR *GIFName = NULL;
+ GIFCHAR *HDFName = NULL;
+ GIFCHAR *GIFName = NULL;
- BYTE* b;
+ GIFBYTE* b;
- BYTE GlobalPalette[256][3];
- BYTE Red[256];
- BYTE Green[256];
- BYTE Blue[256];
+ GIFBYTE GlobalPalette[256][3];
+ GIFBYTE Red[256];
+ GIFBYTE Green[256];
+ GIFBYTE Blue[256];
int RWidth, RHeight;
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
@@ -66,7 +66,7 @@ int main(int argc , char **argv)
int i;
int numcols = 0;
- BYTE pc2nc[256] , r1[256] , g1[256] , b1[256];
+ GIFBYTE pc2nc[256] , r1[256] , g1[256] , b1[256];
int arg_index = 2;
int bool_is_image = 0; /* 0 = false , 1 = true */
@@ -110,7 +110,7 @@ int main(int argc , char **argv)
{
/* allocate space to store the image name */
size_t len = strlen(argv[arg_index]);
- image_name = (CHAR*) malloc( len + 1);
+ image_name = (GIFCHAR*) malloc( len + 1);
strcpy(image_name , argv[arg_index]);
bool_is_image = 0;
@@ -125,7 +125,7 @@ int main(int argc , char **argv)
/* Do Endian Order testing and set Endian Order */
idx = 0x0001;
- b = (BYTE *) &idx;
+ b = (GIFBYTE *) &idx;
EndianOrder = (b[0] ? 1:0);
if (!(fpGif = fopen(GIFName , "wb")))
@@ -149,32 +149,43 @@ int main(int argc , char **argv)
goto out;
}
- /* read image */
+ /* get image's information */
if ( H5IMget_image_info( fid, image_name, &width, &height, &planes, interlace, &npals ) < 0 )
+ {
+ fprintf(stderr , "Unable to get information of the image. Aborting.\n");
goto out;
+ }
- if (width > IMAGE_WIDTH_MAX || height > IMAGE_HEIGHT_MAX){
- fprintf(stderr, "HDF5 image is too large. Limit is %d by %d.\n", IMAGE_WIDTH_MAX, IMAGE_HEIGHT_MAX);
- goto out;
- }
+ if (width > IMAGE_WIDTH_MAX || height > IMAGE_HEIGHT_MAX)
+ {
+ fprintf(stderr, "HDF5 image is too large. Limit is %d by %d.\n", IMAGE_WIDTH_MAX, IMAGE_HEIGHT_MAX);
+ goto out;
+ }
- /* tool can handle single plane images only. */
- if (planes > 1){
- fprintf(stderr, "Cannot handle multiple planes image\n");
- goto out;
- }
+ /* tool can handle single plane images only. */
+ if (planes > 1)
+ {
+ fprintf(stderr, "Cannot handle multiple planes image\n");
+ goto out;
+ }
- Image = (BYTE*) malloc( (size_t) width * (size_t) height );
+ Image = (GIFBYTE*) malloc( (size_t) width * (size_t) height );
if ( H5IMread_image( fid, image_name, Image ) < 0 )
+ {
+ fprintf(stderr , "Unable to read the image. Aborting.\n");
goto out;
+ }
if (npals)
{
if ( H5IMget_palette_info( fid, image_name, 0, pal_dims ) < 0 )
+ {
+ fprintf(stderr , "Unable to get information of the palette. Aborting.\n");
goto out;
+ }
- pal = (BYTE*) malloc( (size_t) pal_dims[0] * (size_t) pal_dims[1] );
+ pal = (GIFBYTE*) malloc( (size_t) pal_dims[0] * (size_t) pal_dims[1] );
if ( H5IMget_palette( fid, image_name, 0, pal ) < 0 )
goto out;
@@ -211,9 +222,9 @@ int main(int argc , char **argv)
numcols = 256;
for (i = 0 ; i < numcols ; i++)
{
- Red[i] = (BYTE)(255 - i);
- Green[i] = (BYTE)(255 - i);
- Blue[i] = (BYTE)(255 - i);
+ Red[i] = (GIFBYTE)(255 - i);
+ Green[i] = (GIFBYTE)(255 - i);
+ Blue[i] = (GIFBYTE)(255 - i);
}
}
else
@@ -246,7 +257,7 @@ int main(int argc , char **argv)
if (j==i)
{
/* wasn't found */
- pc2nc[i] = (BYTE)nc;
+ pc2nc[i] = (GIFBYTE)nc;
r1[nc] = Red[i];
g1[nc] = Green[i];
b1[nc] = Blue[i];
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index 6f5ab58..d44ff7a 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -51,7 +51,7 @@
#include "gif.h"
-typedef BYTE byte;
+typedef GIFBYTE byte;
typedef long int count_int;
#ifdef __STDC__
@@ -69,45 +69,6 @@ static void char_init(), char_out(), flush_char();
static byte pc2nc[256];
-/*************************************************************/
-int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
- byte *gmap, byte *bmap, byte *pc2ncmap, int numcols,
- int colorstyle, int BitsPerPixel)
-{
- int InitCodeSize;
- int i;
- byte *pic8 = pic;
-
- /* Shut compiler up... */
- ptype=ptype;
- rmap=rmap;
- gmap=gmap;
- bmap=bmap;
- numcols=numcols;
- colorstyle=colorstyle;
-
- for (i = 0; i < 256; i++) {
- pc2nc[i] = pc2ncmap[i];
- }
-
- if (BitsPerPixel <= 1)
- InitCodeSize = 2;
- else
- InitCodeSize = BitsPerPixel;
-
- if (!fp) {
- fprintf(stderr, "WriteGIF: file not open for writing\n" );
- return (1);
- }
-
- compress(InitCodeSize+1, fp, pic8, w*h);
-
- if (ferror(fp))
- return -1;
-
- return 0 ;
-}
-
/***********************************************************************/
static unsigned long cur_accum = 0;
static int cur_bits = 0;
@@ -123,8 +84,8 @@ static int maxbits = XV_BITS; /* user settable max # bits/code */
static int maxcode; /* maximum code, given n_bits */
static int maxmaxcode = 1 << XV_BITS; /* NEVER generate this */
-static count_int htab [HSIZE];
-static unsigned short codetab [HSIZE];
+static count_int *htab;
+static unsigned short *codetab;
#define HashTabOf(i) htab[i]
#define CodeTabOf(i) codetab[i]
@@ -173,6 +134,57 @@ static FILE *g_outfile;
static int ClearCode;
static int EOFCode;
+/*************************************************************/
+int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap,
+ byte *gmap, byte *bmap, byte *pc2ncmap, int numcols,
+ int colorstyle, int BitsPerPixel)
+{
+ int InitCodeSize;
+ int i;
+ byte *pic8 = pic;
+
+ if (!(htab = calloc(HSIZE, sizeof(count_int)))) {
+ fprintf(stderr, "Out of memory");
+ return 1;
+ }
+ if (!(codetab = calloc(HSIZE, sizeof(unsigned short)))) {
+ fprintf(stderr, "Out of memory");
+ return 1;
+ }
+
+ /* Shut compiler up... */
+ ptype=ptype;
+ rmap=rmap;
+ gmap=gmap;
+ bmap=bmap;
+ numcols=numcols;
+ colorstyle=colorstyle;
+
+ for (i = 0; i < 256; i++) {
+ pc2nc[i] = pc2ncmap[i];
+ }
+
+ if (BitsPerPixel <= 1)
+ InitCodeSize = 2;
+ else
+ InitCodeSize = BitsPerPixel;
+
+ if (!fp) {
+ fprintf(stderr, "WriteGIF: file not open for writing\n");
+ return 1;
+ }
+
+ compress(InitCodeSize+1, fp, pic8, w*h);
+
+ free(htab);
+ free(codetab);
+
+ if (ferror(fp))
+ return -1;
+
+ return 0 ;
+}
+
/********************************************************/
static void compress(int init_bits, FILE *outfile, byte *data, int len)
{
@@ -194,8 +206,6 @@ static void compress(int init_bits, FILE *outfile, byte *data, int len)
/* initialize 'compress' globals */
maxbits = XV_BITS;
maxmaxcode = 1<<XV_BITS;
- memset(htab, 0, sizeof(htab));
- memset(codetab, 0, sizeof(codetab));
hsize = HSIZE;
free_ent = 0;
clear_flg = 0;
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index b656c36..c2933c5 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -62,9 +62,9 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
/* get some data from gifHead */
ImageCount = gifHead.ImageCount;
#ifdef UNUSED
- CommentCount = (WORD)gifHead.CommentCount;
- ApplicationCount = (WORD)gifHead.ApplicationCount;
- PlainTextCount = (WORD)gifHead.PlainTextCount;
+ CommentCount = (GIFWORD)gifHead.CommentCount;
+ ApplicationCount = (GIFWORD)gifHead.ApplicationCount;
+ PlainTextCount = (GIFWORD)gifHead.PlainTextCount;
#endif /* UNUSED */
if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) {
diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt
index fde40e3..c5ad976 100644
--- a/hl/tools/h5watch/CMakeLists.txt
+++ b/hl/tools/h5watch/CMakeLists.txt
@@ -1,35 +1,48 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_HL_TOOLS_H5WATCH)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_HL_TOOLS_H5WATCH C)
#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
set (H5WATCH_SOURCES
- ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watch
+ ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watch.c
)
#-- Add h5watch program
-include_directories (${HDF5_TOOLS_DIR}/lib)
-include_directories (${HDF5_HL_TOOLS_DIR}/src)
-include_directories (${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR})
-
-add_executable (h5watch ${H5WATCH_SOURCES})
-TARGET_NAMING (h5watch STATIC)
-TARGET_C_PROPERTIES (h5watch STATIC " " " ")
-target_link_libraries (h5watch ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h5watch PROPERTIES FOLDER tools/hl)
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5watch ${H5WATCH_SOURCES})
+ target_compile_options(h5watch PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5watch STATIC)
+ target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5watch PROPERTIES FOLDER tools/hl)
+ set (H5_DEP_EXECUTABLES h5watch)
+endif ()
+if (BUILD_SHARED_LIBS)
+ add_executable (h5watch-shared ${H5WATCH_SOURCES})
+ target_compile_options(h5watch-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5watch-shared SHARED)
+ target_link_libraries (h5watch-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (h5watch-shared PROPERTIES FOLDER tools/hl)
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared)
+endif ()
-if (BUILD_TESTING)
- include_directories (${HDF5_TEST_SRC_DIR})
- include_directories(${HDF5_HL_SRC_DIR}/test)
+if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL)
#-- Add swmr_check_compat_vfd program
set (hl_swmr_check_compat_vfd_SOURCES
${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c
)
add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES})
- TARGET_NAMING (hl_swmr_check_compat_vfd STATIC)
- TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC " " " ")
- target_link_libraries (hl_swmr_check_compat_vfd ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_compile_options(hl_swmr_check_compat_vfd PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC)
+ target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd SHARED)
+ target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl)
#-- Add extend_dset program
@@ -37,18 +50,32 @@ if (BUILD_TESTING)
${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c
)
add_executable (extend_dset ${extend_dset_SOURCES})
- TARGET_NAMING (extend_dset STATIC)
- TARGET_C_PROPERTIES (extend_dset STATIC " " " ")
- target_link_libraries (extend_dset ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_compile_options(extend_dset PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (extend_dset STATIC)
+ target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (extend_dset SHARED)
+ target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ endif ()
set_target_properties (extend_dset PROPERTIES FOLDER tools/hl)
add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c)
- TARGET_NAMING (h5watchgentest STATIC)
- TARGET_C_PROPERTIES (h5watchgentest STATIC " " " ")
- target_link_libraries (h5watchgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_compile_options(h5watchgentest PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5watchgentest STATIC)
+ target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5watchgentest SHARED)
+ target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl)
- include (CMakeTests.cmake)
+ if (HDF5_TEST_TOOLS)
+ include (CMakeTests.cmake)
+ endif ()
endif ()
#-----------------------------------------------------------------------------
@@ -57,7 +84,7 @@ endif ()
if (HDF5_EXPORTED_TARGETS)
install (
TARGETS
- h5watch
+ ${H5_DEP_EXECUTABLES}
EXPORT
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications
diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake
index 0b7b4d4..19d47cb 100644
--- a/hl/tools/h5watch/CMakeTests.cmake
+++ b/hl/tools/h5watch/CMakeTests.cmake
@@ -18,16 +18,16 @@
set (H5WATCH_TEST_FILES
w-help1.ddl
- w-err-cmpd1.ddl
- w-err-cmpd2.ddl
- w-err-cmpd3.ddl
- w-err-cmpd4.ddl
- w-err-cmpd5.ddl
- w-err-dset1.ddl
- w-err-dset2.ddl
- w-err-dset-nomax.ddl
- w-err-dset-none.ddl
- w-err-file.ddl
+ w-err-cmpd1.err
+ w-err-cmpd2.err
+ w-err-cmpd3.err
+ w-err-cmpd4.err
+ w-err-cmpd5.err
+ w-err-dset1.err
+ w-err-dset2.err
+ w-err-dset-nomax.err
+ w-err-dset-none.err
+ w-err-file.err
w-err-poll.ddl
w-err-poll0.ddl
w-err-width.ddl
@@ -73,7 +73,8 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
add_test (
NAME H5WATCH_ARGS-h5watch-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_file_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -81,7 +82,33 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
-D "TEST_REFERENCE=${resultfile}.ddl"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
- set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES
+ DEPENDS ${last_test}
+ FIXTURES_REQUIRED gen_test_watch
+ )
+ set (last_test "H5WATCH_ARGS-h5watch-${resultfile}")
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5_ERR_TEST resultfile resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5WATCH_ARGS-h5watch-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.mty"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES
+ DEPENDS ${last_test}
+ FIXTURES_REQUIRED gen_test_watch
+ )
set (last_test "H5WATCH_ARGS-h5watch-${resultfile}")
endif ()
endmacro ()
@@ -91,14 +118,14 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
add_test (
NAME H5WATCH-${resultfile}-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- ${resultfile}.h5
+ -E remove ${resultfile}.h5
)
set_tests_properties (H5WATCH-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
add_test (
NAME H5WATCH-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_file_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -106,7 +133,11 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
-D "TEST_REFERENCE=${resultfile}.txt"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
- set_tests_properties (H5WATCH-${resultfile} PROPERTIES DEPENDS H5WATCH-${resultfile}-clear-objects)
+ set_tests_properties (H5WATCH-${resultfile} PROPERTIES
+ DEPENDS H5WATCH-${resultfile}-clear-objects
+ FIXTURES_REQUIRED gen_test_watch
+ )
+ set (last_test "H5WATCH-${resultfile}")
endif ()
endmacro ()
@@ -124,11 +155,9 @@ if (NOT SWMR_INCOMPAT)
# Remove any output file left over from previous test run
add_test (
NAME H5WATCH-clearall-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- WATCH.h5
+ COMMAND ${CMAKE_COMMAND} -E remove WATCH.h5
)
- if (NOT "${last_test}" STREQUAL "")
+ if (last_test)
set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5WATCH-clearall-objects")
@@ -153,29 +182,32 @@ if (NOT SWMR_INCOMPAT)
# #
#################################################################################################
# create the output files to be used.
- add_test (NAME H5WATCH-h5watchgentest COMMAND $<TARGET_FILE:h5watchgentest>)
- set_tests_properties (H5WATCH-h5watchgentest PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- set_tests_properties (H5WATCH-h5watchgentest PROPERTIES DEPENDS "H5WATCH-clearall-objects")
+ add_test (NAME H5WATCH-h5watchgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5watchgentest>)
+ set_tests_properties (H5WATCH-h5watchgentest PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS "H5WATCH-clearall-objects"
+ )
+ set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_SETUP gen_test_watch)
set (last_test "H5WATCH-h5watchgentest")
# Test on --help options
ADD_H5_TEST (w-help1 0 --help)
#
# Tests on expected failures
- ADD_H5_TEST (w-err-dset1 1 WATCH.h5)
- ADD_H5_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD)
- ADD_H5_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE)
- ADD_H5_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX)
- ADD_H5_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-dset1 1 WATCH.h5)
+ ADD_H5_ERR_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE)
+ ADD_H5_ERR_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX)
+ ADD_H5_ERR_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD)
ADD_H5_TEST (w-err-width 1 --width=-8 WATCH.h5/DSET_ONE)
ADD_H5_TEST (w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE)
ADD_H5_TEST (w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE)
#
# Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD
- ADD_H5_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD)
#
endif ()
diff --git a/hl/tools/h5watch/Makefile.am b/hl/tools/h5watch/Makefile.am
index c60fceb..0bf265e 100644
--- a/hl/tools/h5watch/Makefile.am
+++ b/hl/tools/h5watch/Makefile.am
@@ -19,15 +19,12 @@
include $(top_srcdir)/config/commence.am
# Include src and tools/lib directories
-AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src -I$(top_srcdir)/hl/test
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src
# These are our main targets, the tools
-TEST_SCRIPT=testh5watch.sh
-check_SCRIPTS=$(TEST_SCRIPT)
-SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT)
bin_PROGRAMS=h5watch
-noinst_PROGRAMS=swmr_check_compat_vfd h5watchgentest extend_dset
+noinst_PROGRAMS=swmr_check_compat_vfd
# Add h5watch specific linker flags here
h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
@@ -36,13 +33,19 @@ h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# library.
LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5)
-# Add extend_dset specific preprocessor flags here
-# (add the main test subdirectory to the include file path)
-extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test
-# Add extend_dset specific library flags here
-# (add the main test library to the list of libraries)
-extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5)
-
+if BUILD_TESTS_CONDITIONAL
+ AM_CPPFLAGS+=-I$(top_srcdir)/hl/test
+ TEST_SCRIPT=testh5watch.sh
+ check_SCRIPTS=$(TEST_SCRIPT)
+ SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT)
+ noinst_PROGRAMS+=h5watchgentest extend_dset
+ # Add extend_dset specific preprocessor flags here
+ # (add the main test subdirectory to the include file path)
+ extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test
+ # Add extend_dset specific library flags here
+ # (add the main test library to the list of libraries)
+ extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5)
+endif
#
CHECK_CLEANFILES+=*.h5
DISTCLEANFILES=testh5watch.sh
diff --git a/hl/tools/h5watch/extend_dset.c b/hl/tools/h5watch/extend_dset.c
index 4dcf25e..6b59ea1 100644
--- a/hl/tools/h5watch/extend_dset.c
+++ b/hl/tools/h5watch/extend_dset.c
@@ -66,7 +66,7 @@ typedef struct set_t {
*
* Extending a two-dimensional dataset by action1 and action2.
* --action1 and action2 can be a positive # or negative # or 0.
- *
+ *
***********************************************************************
*/
static herr_t
@@ -399,12 +399,12 @@ main(int argc, const char *argv[])
if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
if(extend_dset_one(fname, dname, action1) < 0)
goto error;
- } else if(!HDstrcmp(dname, DSET_ONE) ||
- !HDstrcmp(dname, DSET_ALLOC_LATE) ||
+ } else if(!HDstrcmp(dname, DSET_ONE) ||
+ !HDstrcmp(dname, DSET_ALLOC_LATE) ||
!HDstrcmp(dname, DSET_ALLOC_EARLY)) {
if(extend_dset_one(fname, dname, action1) < 0)
goto error;
- } else if(!HDstrcmp(dname, DSET_TWO) ||
+ } else if(!HDstrcmp(dname, DSET_TWO) ||
!HDstrcmp(dname, DSET_CMPD_TWO)) {
if(extend_dset_two(fname, dname, action1, action2) < 0)
goto error;
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index 11514b0..ff9a078 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -20,13 +20,13 @@
*/
#define PROGRAMNAME "h5watch" /* Name of tool */
#define FIELD_SEP "," /* nested field separator */
-#define DEFAULT_RETRY 50 /* number of times to try opening the file */
+#define DEFAULT_RETRY 50 /* number of times to try opening the file */
/*
* Note:(see comments in hl/src/H5LDprivate.h)
* This tool uses private routines H5LD_construct_vector()and H5LD_clean_vector()
- * This tool uses H5LD_memb_t data structure declared in H5LDprivate.h
+ * This tool uses H5LD_memb_t data structure declared in H5LDprivate.h
*/
const char *progname = "h5watch"; /* tool name */
@@ -35,7 +35,7 @@ static char *g_dup_fields = NULL; /* copy of "list_of_fields" */
static H5LD_memb_t **g_listv = NULL; /* vector info for "list_of_fields" */
static hbool_t g_monitor_size_only = FALSE; /* monitor changes in dataset dimension sizes */
-static unsigned g_polling_interval = 1; /* polling interval to check appended data */
+static unsigned g_polling_interval = 1; /* polling interval to check appended data */
static hbool_t g_label = FALSE; /* label compound values */
static int g_display_width = 80; /* output width in characters */
@@ -109,7 +109,7 @@ static struct long_options l_opts[] = {
*
* Purpose: Prepare to print the dataset's appended data.
* Call the tools library routine h5tools_dump_dset() to do the printing.
- * (This routine is mostly copied from dump_dataset_values() in tools/h5ls/h5ls.c
+ * (This routine is mostly copied from dump_dataset_values() in tools/h5ls/h5ls.c
* and modified accordingly).
*
* Return: 0 on success; negative on failure
@@ -121,15 +121,15 @@ static struct long_options l_opts[] = {
static herr_t
doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t info; /* Format info for the tools library */
- static char fmt_double[16], fmt_float[16]; /* Format info */
- struct subset_t subset; /* Subsetting info */
- hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */
- hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */
- hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */
- hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */
- int i; /* Local index variable */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t info; /* Format info for the tools library */
+ static char fmt_double[16], fmt_float[16]; /* Format info */
+ struct subset_t subset; /* Subsetting info */
+ hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */
+ hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */
+ hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */
+ hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */
+ int i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
/* Subsetting information for the tools library printing routines */
@@ -147,6 +147,7 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
} /* end for */
HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.sset = &subset;
/* Set to all default values and then override */
HDmemset(&info, 0, sizeof info);
@@ -220,7 +221,7 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank)
} /* end if */
/* Print the values. */
- if((ret_value = h5tools_dump_dset(stdout, &info, &ctx, did, &subset)) < 0)
+ if((ret_value = h5tools_dump_dset(stdout, &info, &ctx, did)) < 0)
error_msg("unable to print data\n");
HDfprintf(stdout, "\n");
@@ -255,7 +256,7 @@ slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims, hsize_t *start, hsi
int i; /* Local index variable */
int ind; /* Index for the current rank */
herr_t ret_value = SUCCEED; /* Return value */
-
+
ind = rank - subrank;
if((subrank - 1) > 0) {
@@ -288,7 +289,7 @@ done:
return ret_value;
} /* end slicendump() */
-
+
/*-------------------------------------------------------------------------
* Function: monitor_dataset
*
@@ -305,16 +306,16 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static herr_t
monitor_dataset(hid_t fid, char *dsetname)
{
- hid_t did; /* dataset id */
- hid_t sid; /* dataspace id */
- int ndims; /* # of dimensions in the dataspace */
- int i, u; /* local index variable */
- hsize_t prev_dims[H5S_MAX_RANK]; /* current dataspace dimensions */
- hsize_t cur_dims[H5S_MAX_RANK]; /* previous dataspace dimensions */
- herr_t ret_value = SUCCEED; /* return value */
+ hid_t did; /* dataset id */
+ hid_t sid; /* dataspace id */
+ int ndims; /* # of dimensions in the dataspace */
+ int i, u; /* local index variable */
+ hsize_t prev_dims[H5S_MAX_RANK]; /* current dataspace dimensions */
+ hsize_t cur_dims[H5S_MAX_RANK]; /* previous dataspace dimensions */
+ herr_t ret_value = SUCCEED; /* return value */
HDfprintf(stdout, "Monitoring dataset %s...\n", dsetname);
@@ -323,7 +324,7 @@ monitor_dataset(hid_t fid, char *dsetname)
error_msg("error in opening dataset \"%s\"\n", dsetname);
ret_value = FAIL;
goto done;
- }
+ }
if((sid = H5Dget_space(did)) < 0) {
error_msg("error in getting dataspace id for dataset \"%s\"\n", dsetname);
ret_value = FAIL;
@@ -398,7 +399,7 @@ monitor_dataset(hid_t fid, char *dsetname)
}
HDfflush(stdout);
}
-
+
/* Save the current dimension sizes */
HDmemcpy(prev_dims, cur_dims, (size_t)ndims * sizeof(hsize_t));
@@ -438,7 +439,7 @@ process_cmpd_fields(hid_t fid, char *dsetname)
herr_t ret_value = SUCCEED; /* Return value */
HDassert(g_list_of_fields && *g_list_of_fields);
-
+
/* Open the dataset */
if((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
error_msg("error in opening dataset \"%s\"\n", dsetname);
@@ -457,14 +458,14 @@ process_cmpd_fields(hid_t fid, char *dsetname)
if(H5Tget_class(dtid) != H5T_COMPOUND) {
error_msg("dataset should be compound type for <list_of_fields>\n");
ret_value = FAIL;
- goto done;
+ goto done;
}
/* Make a copy of "g_list_of_fields" */
if((g_dup_fields = HDstrdup(g_list_of_fields)) == NULL) {
error_msg("error in duplicating g_list_of_fields\n");
ret_value = FAIL;
- goto done;
+ goto done;
}
/* Estimate the number of comma-separated fields in "g_list of_fields" */
@@ -474,7 +475,7 @@ process_cmpd_fields(hid_t fid, char *dsetname)
if((g_listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))) == NULL) {
error_msg("error in allocating memory for H5LD_memb_t\n");
ret_value = FAIL;
- goto done;
+ goto done;
}
/* Process and store info for "g_listv" */
@@ -495,7 +496,7 @@ done:
return(ret_value);
} /* process_cmpd_fields() */
-
+
/*-------------------------------------------------------------------------
* Function: check_dataset
*
@@ -512,18 +513,18 @@ done:
static herr_t
check_dataset(hid_t fid, char *dsetname)
{
- hid_t did=-1; /* Dataset id */
- hid_t dcp=-1; /* Dataset creation property */
- hid_t sid=-1; /* Dataset's dataspace id */
- int ndims; /* # of dimensions in the dataspace */
- unsigned u; /* Local index variable */
- hsize_t cur_dims[H5S_MAX_RANK]; /* size of dataspace dimensions */
- hsize_t max_dims[H5S_MAX_RANK]; /* maximum size of dataspace dimensions */
- hbool_t unlim_max_dims = FALSE; /* whether dataset has unlimited or max. dimension setting */
+ hid_t did=-1; /* Dataset id */
+ hid_t dcp=-1; /* Dataset creation property */
+ hid_t sid=-1; /* Dataset's dataspace id */
+ int ndims; /* # of dimensions in the dataspace */
+ unsigned u; /* Local index variable */
+ hsize_t cur_dims[H5S_MAX_RANK]; /* size of dataspace dimensions */
+ hsize_t max_dims[H5S_MAX_RANK]; /* maximum size of dataspace dimensions */
+ hbool_t unlim_max_dims = FALSE; /* whether dataset has unlimited or max. dimension setting */
void *edata;
H5E_auto2_t func;
H5D_layout_t layout;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
@@ -574,17 +575,17 @@ check_dataset(hid_t fid, char *dsetname)
/* Check whether dataset has unlimited dimension or max. dimension setting */
for(u = 0; u < (unsigned)ndims; u++)
- if(max_dims[u] == H5S_UNLIMITED || cur_dims[u] != max_dims[u]) {
+ if(max_dims[u] == H5S_UNLIMITED || cur_dims[u] != max_dims[u]) {
unlim_max_dims = TRUE;
- break;
- }
+ break;
+ }
if(!unlim_max_dims) {
error_msg("\"%s\" should have unlimited or max. dimension setting\n", dsetname);
ret_value = FAIL;
}
-done:
+done:
H5Eset_auto2(H5E_DEFAULT, func, edata);
/* Closing */
@@ -597,7 +598,7 @@ done:
return(ret_value);
} /* check_dataset() */
-
+
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -618,7 +619,7 @@ leave(int ret)
exit(ret);
}
-
+
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -630,7 +631,7 @@ leave(int ret)
*
*-------------------------------------------------------------------------
*/
-static void
+static void
usage(const char *prog)
{
HDfflush(stdout);
@@ -653,7 +654,7 @@ usage(const char *prog)
HDfprintf(stdout, " for a compound data type. <list_of_fields> can be\n");
HDfprintf(stdout, " specified as follows:\n");
HDfprintf(stdout, " 1) A comma-separated list of field names in a\n");
- HDfprintf(stdout, " compound data type. \",\" is the separator\n");
+ HDfprintf(stdout, " compound data type. \",\" is the separator\n");
HDfprintf(stdout, " for field names while \".\" is the separator\n");
HDfprintf(stdout, " for a nested field.\n");
HDfprintf(stdout, " 2) A single field name in a compound data type.\n");
@@ -672,7 +673,7 @@ usage(const char *prog)
} /* usage() */
-
+
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -688,7 +689,7 @@ usage(const char *prog)
static void
parse_command_line(int argc, const char *argv[])
{
- int opt; /* Command line option */
+ int opt; /* Command line option */
int tmp;
/* no arguments */
@@ -704,6 +705,7 @@ parse_command_line(int argc, const char *argv[])
case 'h': /* --help */
usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
+ break;
case 'V': /* --version */
print_version(progname);
@@ -725,7 +727,7 @@ parse_command_line(int argc, const char *argv[])
case 'S': /* --simple */
g_simple_output = TRUE;
break;
-
+
case 'l': /* --label */
g_label = TRUE;
break;
@@ -771,7 +773,7 @@ parse_command_line(int argc, const char *argv[])
leave(EXIT_FAILURE);
}
}
-
+
/* check for object to be processed */
if (argc <= opt_ind) {
@@ -781,7 +783,7 @@ parse_command_line(int argc, const char *argv[])
}
} /* parse_command_line() */
-
+
/*-------------------------------------------------------------------------
* Function: catch_signal
*
@@ -820,7 +822,9 @@ main(int argc, const char *argv[])
char *fname = NULL; /* File name */
char *dname = NULL; /* Dataset name */
void *edata; /* Error reporting */
+ void *tools_edata; /* Error reporting */
H5E_auto2_t func; /* Error reporting */
+ H5E_auto2_t tools_func; /* Error reporting */
char *x; /* Temporary string pointer */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
@@ -836,6 +840,10 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
+ /* Disable tools error reporting */
+ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
+
/* To exit from h5watch for SIGTERM signal */
if(HDsignal(SIGTERM, catch_signal) == SIG_ERR) {
error_msg("An error occurred while setting a signal handler.\n");
@@ -858,9 +866,9 @@ main(int argc, const char *argv[])
}
/* Mostly copied from tools/h5ls coding & modified accordingly */
- /*
- * [OBJECT] is specified as
- * [<filename>/<path_to_dataset>/<dsetname>]
+ /*
+ * [OBJECT] is specified as
+ * [<filename>/<path_to_dataset>/<dsetname>]
*
* Example: ../dir1/foo/bar/dset
* \_________/\______/
@@ -870,7 +878,7 @@ main(int argc, const char *argv[])
* succeeds. The first call uses the entire name and each subsequent call
* chops off the last component. If we reach the beginning of the name
* then there must have been something wrong with the file (perhaps it
- * doesn't exist).
+ * doesn't exist).
*/
if((fname = HDstrdup(argv[opt_ind])) == NULL) {
error_msg("memory allocation failed (file %s:line %d)\n",
@@ -888,7 +896,7 @@ main(int argc, const char *argv[])
do {
while(fname && *fname) {
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl, NULL, drivername, sizeof drivername);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl, FALSE, drivername, sizeof drivername);
if(fid >= 0) {
HDfprintf(stdout, "Opened \"%s\" with %s driver.\n", fname, drivername);
@@ -912,7 +920,7 @@ main(int argc, const char *argv[])
if(fname) HDfree(fname);
if(fapl >= 0) H5Pclose(fapl);
leave(EXIT_FAILURE);
- }
+ }
if(!dname) {
error_msg("no dataset specified\n");
@@ -934,13 +942,13 @@ main(int argc, const char *argv[])
if(process_cmpd_fields(fid, dname) < 0)
h5tools_setstatus(EXIT_FAILURE);
}
- }
+ }
/* If everything is fine, start monitoring the datset */
if(h5tools_getstatus() != EXIT_FAILURE)
if(monitor_dataset(fid, dname) < 0)
h5tools_setstatus(EXIT_FAILURE);
-
+
/* Free spaces */
if(fname) HDfree(fname);
if(dname) HDfree(dname);
@@ -964,6 +972,8 @@ main(int argc, const char *argv[])
}
H5Eset_auto2(H5E_DEFAULT, func, edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
+
/* exit */
leave(h5tools_getstatus());
} /* main() */
diff --git a/hl/tools/h5watch/h5watchgentest.c b/hl/tools/h5watch/h5watchgentest.c
index 18e15fc..19c9876 100644
--- a/hl/tools/h5watch/h5watchgentest.c
+++ b/hl/tools/h5watch/h5watchgentest.c
@@ -15,23 +15,23 @@
#include "H5HLprivate2.h"
/*
- * WATCH.h5: file with various types of datasets for testing--
+ * WATCH.h5: file with various types of datasets for testing--
*
- * The following datasets are chunked, H5D_ALLOC_TIME_INCR, max. dimensional setting:
- * DSET_ONE: one-dimensional dataset
- * DSET_TWO: two-dimensional dataset
- * DSET_CMPD: one-dimensional dataset with compound type
+ * The following datasets are chunked, H5D_ALLOC_TIME_INCR, max. dimensional setting:
+ * DSET_ONE: one-dimensional dataset
+ * DSET_TWO: two-dimensional dataset
+ * DSET_CMPD: one-dimensional dataset with compound type
* DSET_CMPD_ESC: one-dimensional dataset with compound type and member names with
- * escape/separator characters
- * DSET_CMPD_TWO: two-dimensional dataset with compound type
- *
- * The following datasets are one-dimensional, chunked, max. dimension setting:
- * DSET_ALLOC_EARLY: dataset with H5D_ALLOC_TIME_EARLY
- * DSET_ALLOC_LATE: dataset H5D_ALLOC_TIME_LATE
- *
- * The following datasets are one-dimensional:
- * DSET_NONE: fixed dimension setting, contiguous, H5D_ALLOC_TIME_LATE
- * DSET_NOMAX: fixed dimension setting, chunked, H5D_ALLOC_TIME_INCR
+ * escape/separator characters
+ * DSET_CMPD_TWO: two-dimensional dataset with compound type
+ *
+ * The following datasets are one-dimensional, chunked, max. dimension setting:
+ * DSET_ALLOC_EARLY: dataset with H5D_ALLOC_TIME_EARLY
+ * DSET_ALLOC_LATE: dataset H5D_ALLOC_TIME_LATE
+ *
+ * The following datasets are one-dimensional:
+ * DSET_NONE: fixed dimension setting, contiguous, H5D_ALLOC_TIME_LATE
+ * DSET_NOMAX: fixed dimension setting, chunked, H5D_ALLOC_TIME_INCR
*/
#define ONE_DIMS0 10
#define MAX_ONE_DIMS0 100
diff --git a/hl/tools/h5watch/swmr_check_compat_vfd.c b/hl/tools/h5watch/swmr_check_compat_vfd.c
index 7d11a73..608f4a8 100644
--- a/hl/tools/h5watch/swmr_check_compat_vfd.c
+++ b/hl/tools/h5watch/swmr_check_compat_vfd.c
@@ -13,7 +13,7 @@
/* Purpose: This is a small program that checks if the HDF5_DRIVER
* environment variable is set to a value that supports SWMR.
- *
+ *
* It is intended for use in shell scripts.
*/
@@ -48,7 +48,7 @@ main(void)
driver = HDgetenv("HDF5_DRIVER");
- if(H5FD_supports_swmr_test(driver))
+ if(H5FD__supports_swmr_test(driver))
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in
index 05e66bf..24ff6aa 100644
--- a/hl/tools/h5watch/testh5watch.sh.in
+++ b/hl/tools/h5watch/testh5watch.sh.in
@@ -18,7 +18,7 @@
# supports SWMR.
./swmr_check_compat_vfd
rc=$?
-if [[ $rc != 0 ]] ; then
+if [ $rc != 0 ] ; then
echo
echo "The VFD specified by the HDF5_DRIVER environment variable"
echo "does not support SWMR."
@@ -32,19 +32,19 @@ fi
#echo
#exit 0
-H5WATCH=h5watch # The tool name
-H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH
-EXTEND_DSET=extend_dset # Routine to extend the dataset when watching
-EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET
+H5WATCH=h5watch # The tool name
+H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH
+EXTEND_DSET=extend_dset # Routine to extend the dataset when watching
+EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET
#
EXIT_SUCCESS=0
EXIT_FAILURE=1
#
-GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets
-GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST
+GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets
+GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST
WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch
TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests
-TRY_MAX=10 # Try running the test again
+TRY_MAX=30 # Try running the test again
#
# These 3 defines should be the same as the defines in ./extend_dset.c
WRITER_MESSAGE=writer_message # The message file created by the "extend" process
@@ -53,7 +53,7 @@ MESSAGE_TIMEOUT=300 # Message timeout length in secs
#
CMP='cmp -s'
DIFF='diff -c'
-NLINES=20 # Max. lines of output to display if test fails
+NLINES=20 # Max. lines of output to display if test fails
#
# Mac OS: just to make sure echo "backslash backslash" behaves properly
if test `uname -s` = 'Darwin'; then
@@ -83,9 +83,9 @@ TESTING() {
# Overall algorithm:
#
# Run a test and print PASSED or FAILED
-# If a test did not return with the expected return code,
+# If a test did not return with the expected return code,
# increment the `nerrors' global variable and (if $verbose is set) display up to $NLINES
-# lines of the actual output from the test.
+# lines of the actual output from the test.
# If the test did return the expected code,
# compare the actual output with the expected output;
# If the outputs are the same, print PASSED,
@@ -137,7 +137,54 @@ TOOLTEST() {
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
+ rm -f $actual $actual_err
+ fi
+}
+#
+# TOOLTEST_ERR():
+# same as toolset only compare error file
+#
+# Arguments:
+#
+# $1 -- expected output
+# $2 -- expected return code
+# $3 and on -- arguments for h5watch
+TOOLTEST_ERR() {
+ expect="$srcdir/../testfiles/$1"
+ expect_err="$srcdir/../testfiles/`basename $1 .ddl`.err"
+ actual="../testfiles/`basename $1 .ddl`.out"
+ actual_err="../testfiles/`basename $1 .ddl`.out.err"
+ shift
+ retvalexpect=$1
+ shift
+ # Run test.
+ TESTING $H5WATCH $@
+ (
+ $RUNSERIAL $H5WATCH_BIN "$@"
+ ) > $actual 2>$actual_err
+ exitcode=$?
+ if [ $exitcode -ne $retvalexpect ]; then
+ $ECHO "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if [ yes = "$verbose" ]; then
+ $ECHO "test returned with exit code $exitcode"
+ $ECHO "test output: (up to $NLINES lines)"
+ head -$NLINES $actual
+ $ECHO "***end of test output***"
+ $ECHO ""
+ fi
+ elif $CMP $expect_err $actual_err; then
+ $ECHO " PASSED"
+ else
+ $ECHO "*FAILED*"
+ $ECHO " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
fi
}
@@ -176,15 +223,15 @@ do
# Wait for message from "extend_dset" process to start h5watch--
# To wait for the writer message file or till the maximum # of seconds is reached
# This performs similar function as the routine h5_wait_message() in test/h5test.c
- mexist=0 # Indicate whether the message file is found
- t0=`date +%s` # Get current time in seconds
- difft=0 # Initialize the time difference
- while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
+ mexist=0 # Indicate whether the message file is found
+ t0=`date +%s` # Get current time in seconds
+ difft=0 # Initialize the time difference
+ while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
do
- t1=`date +%s` # Get current time in seconds
- difft=`expr $t1 - $t0` # Calculate the time difference
+ t1=`date +%s` # Get current time in seconds
+ difft=`expr $t1 - $t0` # Calculate the time difference
if [ -e $WRITER_MESSAGE ]; then # If message file is found:
- mexist=1 # indicate the message file is found
+ mexist=1 # indicate the message file is found
rm $WRITER_MESSAGE # remove the message file
break # get out of the while loop
fi
@@ -211,8 +258,8 @@ do
wait $extend_pid # Wait for "extend" process to complete
extend_exit=$? # Collect "extend" process' exit code
sleep 1 # Sleep to make sure output is flushed
- kill $watch_pid # Kill h5watch
- wait $watch_pid # Wait for "h5watch" process to complete
+ kill $watch_pid # Kill h5watch
+ wait $watch_pid # Wait for "h5watch" process to complete
#
if [ $extend_exit -ne 0 ]; then # Error returned from "extend" process
$ECHO "*FAILED*"
@@ -265,7 +312,7 @@ done;
# DSET_ONE: one-dimensional dataset #
# DSET_TWO: two-dimensional dataset #
# DSET_CMPD: one-dimensional dataset with compound type #
-# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters #
+# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters #
# DSET_CMPD_TWO: two-dimensional dataset with compound type #
# #
# The following datasets are one-dimensional, chunked, max. dimension setting: #
@@ -282,11 +329,11 @@ done;
#################################################################################################
# #
# Tests on expected failures: #
-# Invalid file name #
-# Unable to find dataset, invalid dataset #
-# DSET_NONE and DSET_NOMAX #
-# Invalid input to options --width and --polling #
-# Invalid field names for -f option #
+# Invalid file name #
+# Unable to find dataset, invalid dataset #
+# DSET_NONE and DSET_NOMAX #
+# Invalid input to options --width and --polling #
+# Invalid field names for -f option #
# #
#################################################################################################
#
@@ -296,21 +343,21 @@ $GEN_TEST_BIN
TOOLTEST w-help1.ddl 0 --help
#
# Tests on expected failures
-TOOLTEST w-err-dset1.ddl 1 WATCH.h5
-TOOLTEST w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD
-TOOLTEST w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE
-TOOLTEST w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX
-TOOLTEST w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-dset1.ddl 1 WATCH.h5
+TOOLTEST_ERR w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD
+TOOLTEST_ERR w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE
+TOOLTEST_ERR w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX
+TOOLTEST_ERR w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD
TOOLTEST w-err-width.ddl 1 --width=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll.ddl 1 --polling=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll0.ddl 1 --polling=0 WATCH.h5/DSET_ONE
#
# Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD
-TOOLTEST w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD
#
echo "DONE WITH 1st SET OF TESTS"
#
diff --git a/hl/tools/testfiles/w-err-cmpd3.ddl b/hl/tools/testfiles/w-err-cmpd1.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd3.ddl
+++ b/hl/tools/testfiles/w-err-cmpd1.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd4.ddl b/hl/tools/testfiles/w-err-cmpd2.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd4.ddl
+++ b/hl/tools/testfiles/w-err-cmpd2.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd1.ddl b/hl/tools/testfiles/w-err-cmpd3.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd1.ddl
+++ b/hl/tools/testfiles/w-err-cmpd3.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd2.ddl b/hl/tools/testfiles/w-err-cmpd4.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd2.ddl
+++ b/hl/tools/testfiles/w-err-cmpd4.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd5.err b/hl/tools/testfiles/w-err-cmpd5.err
new file mode 100644
index 0000000..9c165fb
--- /dev/null
+++ b/hl/tools/testfiles/w-err-cmpd5.err
@@ -0,0 +1 @@
+h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-dset-nomax.ddl b/hl/tools/testfiles/w-err-dset-nomax.err
index b99cf84..fd5ca7e 100644
--- a/hl/tools/testfiles/w-err-dset-nomax.ddl
+++ b/hl/tools/testfiles/w-err-dset-nomax.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: "/DSET_NOMAX" should have unlimited or max. dimension setting
diff --git a/hl/tools/testfiles/w-err-dset-none.ddl b/hl/tools/testfiles/w-err-dset-none.err
index cbf6770..db781c3 100644
--- a/hl/tools/testfiles/w-err-dset-none.ddl
+++ b/hl/tools/testfiles/w-err-dset-none.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: "/DSET_NONE" should be a chunked or virtual dataset
diff --git a/hl/tools/testfiles/w-err-dset1.ddl b/hl/tools/testfiles/w-err-dset1.err
index 433c4d6..d6b2a6e 100644
--- a/hl/tools/testfiles/w-err-dset1.ddl
+++ b/hl/tools/testfiles/w-err-dset1.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: no dataset specified
diff --git a/hl/tools/testfiles/w-err-dset2.ddl b/hl/tools/testfiles/w-err-dset2.err
index 81b52de..3f77ec8 100644
--- a/hl/tools/testfiles/w-err-dset2.ddl
+++ b/hl/tools/testfiles/w-err-dset2.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: unable to open dataset "/group/DSET_CMPD"
diff --git a/hl/tools/testfiles/w-err-file.ddl b/hl/tools/testfiles/w-err-file.err
index 015661f..015661f 100644
--- a/hl/tools/testfiles/w-err-file.ddl
+++ b/hl/tools/testfiles/w-err-file.err
diff --git a/hl/tools/testfiles/w-err-cmpd5.ddl b/hl/tools/testfiles/w-err-std.ddl
index 775d6a0..775d6a0 100644
--- a/hl/tools/testfiles/w-err-cmpd5.ddl
+++ b/hl/tools/testfiles/w-err-std.ddl