summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
Diffstat (limited to 'hl')
-rw-r--r--hl/CMakeLists.txt42
-rwxr-xr-xhl/Makefile.in2
-rw-r--r--hl/c++/CMakeLists.txt22
-rw-r--r--hl/c++/Makefile.in2
-rw-r--r--hl/c++/examples/CMakeLists.txt51
-rw-r--r--hl/c++/examples/Makefile.in2
-rw-r--r--hl/c++/src/CMakeLists.txt46
-rw-r--r--hl/c++/src/H5PacketTable.cpp2
-rw-r--r--hl/c++/src/Makefile.in4
-rw-r--r--hl/c++/test/CMakeLists.txt43
-rw-r--r--hl/c++/test/Makefile.in2
-rw-r--r--hl/examples/CMakeLists.txt46
-rw-r--r--hl/examples/Makefile.in2
-rw-r--r--hl/fortran/CMakeLists.txt41
-rw-r--r--hl/fortran/Makefile.in2
-rw-r--r--hl/fortran/examples/CMakeLists.txt44
-rw-r--r--hl/fortran/examples/Makefile.in2
-rw-r--r--hl/fortran/src/CMakeLists.txt100
-rw-r--r--hl/fortran/src/H5IMcc.h2
-rw-r--r--hl/fortran/src/Makefile.in4
-rw-r--r--hl/fortran/test/CMakeLists.txt85
-rw-r--r--hl/fortran/test/Makefile.in2
-rw-r--r--hl/src/CMakeLists.txt67
-rw-r--r--hl/src/H5DS.c303
-rw-r--r--hl/src/H5DSprivate.h1
-rw-r--r--hl/src/Makefile.in4
-rw-r--r--hl/test/CMakeLists.txt87
-rw-r--r--hl/test/Makefile.am2
-rw-r--r--hl/test/Makefile.in5
-rw-r--r--hl/test/test_ds.c162
-rw-r--r--hl/tools/CMakeLists.txt85
-rw-r--r--hl/tools/Makefile.in2
-rw-r--r--hl/tools/gif2h5/Makefile.in2
33 files changed, 1082 insertions, 186 deletions
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt
new file mode 100644
index 0000000..bc7c652
--- /dev/null
+++ b/hl/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL)
+
+#-----------------------------------------------------------------------------
+# Shared Libs
+#-----------------------------------------------------------------------------
+IF (BUILD_SHARED_LIBS)
+ SET (HL_BUILT_AS_DYNAMIC_LIB 1)
+ENDIF (BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# List Source files
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src )
+
+ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/src ${HDF5_HL_BINARY_DIR}/src)
+
+#-- Build the High level Tools
+IF (HDF5_BUILD_TOOLS)
+ ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/tools ${HDF5_HL_BINARY_DIR}/tools)
+ENDIF (HDF5_BUILD_TOOLS)
+
+#-- Add High Level Examples
+IF (HDF5_BUILD_EXAMPLES)
+ ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/examples ${HDF5_HL_BINARY_DIR}/examples)
+ENDIF (HDF5_BUILD_EXAMPLES)
+
+#-- 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)
+ ENDIF (BUILD_TESTING)
+ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
+
+#-- Build the High Level Fortran source codes
+IF (HDF5_BUILD_FORTRAN)
+ ADD_SUBDIRECTORY (fortran)
+ENDIF (HDF5_BUILD_FORTRAN)
+
+IF (HDF5_BUILD_CPP_LIB)
+ ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/c++ ${HDF5_HL_BINARY_DIR}/c++)
+ENDIF (HDF5_BUILD_CPP_LIB)
diff --git a/hl/Makefile.in b/hl/Makefile.in
index 0d4c6c1..d44f082 100755
--- a/hl/Makefile.in
+++ b/hl/Makefile.in
@@ -203,12 +203,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt
new file mode 100644
index 0000000..15ae809
--- /dev/null
+++ b/hl/c++/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_CPP)
+
+#-----------------------------------------------------------------------------
+# Main HL lib is in /src
+#-----------------------------------------------------------------------------
+ADD_SUBDIRECTORY (${HDF5_HL_CPP_SOURCE_DIR}/src ${HDF5_HL_CPP_BINARY_DIR}/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)
+ENDIF (HDF5_BUILD_EXAMPLES)
+
+# --------------------------------------------------------------------
+# Add in the unit tests for the packet table c++ wrapper
+# --------------------------------------------------------------------
+
+IF (BUILD_TESTING)
+ ADD_SUBDIRECTORY (${HDF5_HL_CPP_SOURCE_DIR}/test ${HDF5_HL_CPP_BINARY_DIR}/test)
+ENDIF (BUILD_TESTING)
diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in
index 0a5d32d..95b16b2 100644
--- a/hl/c++/Makefile.in
+++ b/hl/c++/Makefile.in
@@ -199,12 +199,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt
new file mode 100644
index 0000000..8fcb9bd
--- /dev/null
+++ b/hl/c++/examples/CMakeLists.txt
@@ -0,0 +1,51 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_CPP_EXAMPLES)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src)
+
+# --------------------------------------------------------------------
+# Add in the examples for the Packet Table codes
+# --------------------------------------------------------------------
+IF (HDF5_BUILD_EXAMPLES)
+ ADD_EXECUTABLE (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp)
+ H5_NAMING (ptExampleFL)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (ptExampleFL
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (
+ ptExampleFL
+ ${HDF5_HL_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+
+ ADD_EXECUTABLE (ptExampleVL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleVL.cpp)
+ H5_NAMING (ptExampleVL)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (ptExampleVL
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (
+ ptExampleVL
+ ${HDF5_HL_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ENDIF (HDF5_BUILD_EXAMPLES)
diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in
index 51c04ad..fd1a100 100644
--- a/hl/c++/examples/Makefile.in
+++ b/hl/c++/examples/Makefile.in
@@ -165,12 +165,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
new file mode 100644
index 0000000..459520e
--- /dev/null
+++ b/hl/c++/src/CMakeLists.txt
@@ -0,0 +1,46 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_CPP_SRC)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (HDF5_HL_CPP_SRCS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp)
+SET (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h)
+INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR})
+
+ADD_LIBRARY ( ${HDF5_HL_CPP_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_CPP_SRCS})
+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} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+ FILES
+ ${HDF5_HL_CPP_HDRS}
+ DESTINATION
+ include/hl/cpp
+ COMPONENT
+ hlcppheaders
+)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF5_EXPORTED_TARGETS)
+ INSTALL (
+ TARGETS
+ ${HDF5_HL_CPP_LIB_TARGET}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ LIBRARY DESTINATION lib COMPONENT hlcpplibraries
+ ARCHIVE DESTINATION lib COMPONENT hlcpplibraries
+ RUNTIME DESTINATION bin COMPONENT hlcpplibraries
+ )
+ENDIF (HDF5_EXPORTED_TARGETS)
diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp
index f815a66..74b8029 100644
--- a/hl/c++/src/H5PacketTable.cpp
+++ b/hl/c++/src/H5PacketTable.cpp
@@ -190,7 +190,7 @@
if (startIndex > endIndex)
return -1;
- return H5PTread_packets(table_id, startIndex, endIndex-startIndex+1, data);
+ return H5PTread_packets(table_id, startIndex, (size_t)(endIndex-startIndex+1), data);
}
/* GetNextPacket (single packet)
diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in
index 1ebda2b..325323a 100644
--- a/hl/c++/src/Makefile.in
+++ b/hl/c++/src/Makefile.in
@@ -211,12 +211,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
@@ -380,7 +380,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 59
+LT_VERS_REVISION = 63
LT_VERS_AGE = 0
# Include src directory
diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt
new file mode 100644
index 0000000..e9b09da
--- /dev/null
+++ b/hl/c++/test/CMakeLists.txt
@@ -0,0 +1,43 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_CPP_TEST)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src)
+
+# --------------------------------------------------------------------
+# Add in the unit tests for the packet table c++ wrapper
+# --------------------------------------------------------------------
+
+IF (BUILD_TESTING)
+ INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR})
+ INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/test)
+ INCLUDE_DIRECTORIES (${HDF5_CPP_SOURCE_DIR}/src)
+
+ ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp)
+ H5_NAMING (hl_ptableTest)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_ptableTest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ 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}
+ )
+ GET_TARGET_PROPERTY (hl_ptableTestpath hl_ptableTest LOCATION)
+ GET_FILENAME_COMPONENT (hl_ptableTestexe ${hl_ptableTestpath} NAME)
+
+ ADD_TEST (NAME hl_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>)
+ENDIF (BUILD_TESTING)
diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in
index 644966b..fc59115 100644
--- a/hl/c++/test/Makefile.in
+++ b/hl/c++/test/Makefile.in
@@ -185,12 +185,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt
new file mode 100644
index 0000000..0d29b7f
--- /dev/null
+++ b/hl/examples/CMakeLists.txt
@@ -0,0 +1,46 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_EXAMPLES )
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (examples
+ ex_lite1
+ ex_lite2
+ ex_lite3
+ ptExampleFL
+ ptExampleVL
+ ex_image1
+ ex_image2
+ ex_table_01
+ ex_table_02
+ ex_table_03
+ ex_table_04
+ ex_table_05
+ ex_table_06
+ ex_table_07
+ ex_table_08
+ ex_table_09
+ ex_table_10
+ ex_table_11
+ ex_table_12
+ ex_ds1
+)
+
+FOREACH (example ${examples})
+ ADD_EXECUTABLE (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c)
+ H5_NAMING (hl_ex_${example})
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_ex_${example}
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ENDFOREACH (example ${examples})
+
+
diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in
index 31c21f0..2b18c3d 100644
--- a/hl/examples/Makefile.in
+++ b/hl/examples/Makefile.in
@@ -165,12 +165,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt
new file mode 100644
index 0000000..1aca0d7
--- /dev/null
+++ b/hl/fortran/CMakeLists.txt
@@ -0,0 +1,41 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT(HDF5_HL_F90 C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR})
+INCLUDE_DIRECTORIES (${HDF5_F90_SRC_BINARY_DIR})
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY})
+
+LINK_DIRECTORIES (${HDF5_SRC_DIR} ${HDF5_FORTRAN_SOURCE_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+
+#-----------------------------------------------------------------------------
+# Add debug information (intel Fortran : JB)
+#-----------------------------------------------------------------------------
+IF (CMAKE_Fortran_COMPILER MATCHES ifort)
+ IF (WIN32)
+ SET (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
+ ENDIF (WIN32)
+ENDIF (CMAKE_Fortran_COMPILER MATCHES ifort)
+
+#-----------------------------------------------------------------------------
+# List Source files
+#-----------------------------------------------------------------------------
+ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src)
+
+#-----------------------------------------------------------------------------
+# Build the HL Fortran Examples
+#-----------------------------------------------------------------------------
+IF (HDF5_BUILD_FORTRAN_EXAMPLES)
+ ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples)
+ENDIF (HDF5_BUILD_FORTRAN_EXAMPLES)
+
+#-----------------------------------------------------------------------------
+# Testing
+#-----------------------------------------------------------------------------
+IF (BUILD_TESTING)
+ ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test)
+ENDIF (BUILD_TESTING)
diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in
index 799edee..c382dbd 100644
--- a/hl/fortran/Makefile.in
+++ b/hl/fortran/Makefile.in
@@ -203,12 +203,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt
new file mode 100644
index 0000000..bd9a695
--- /dev/null
+++ b/hl/fortran/examples/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+LINK_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_HL_F90_BINARY_DIR}
+ ${HDF5_F90_BINARY_DIR}
+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+SET (examples
+ exlite
+)
+
+FOREACH (example ${examples})
+ ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.f90)
+ H5_NAMING (hl_f90_ex_${example})
+ IF (WIN32)
+ IF (MSVC)
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_ex_${example}
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ELSE (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_ex_${example}
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (hl_f90_ex_${example}
+ ${HDF5_HL_F90_LIB_TARGET}
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+ENDFOREACH (example ${examples})
diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in
index 3abc2dd..5e5584f 100644
--- a/hl/fortran/examples/Makefile.in
+++ b/hl/fortran/examples/Makefile.in
@@ -165,12 +165,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
new file mode 100644
index 0000000..71302f3
--- /dev/null
+++ b/hl/fortran/src/CMakeLists.txt
@@ -0,0 +1,100 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT(HDF5_HL_F90_SRC C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_F90_BINARY_DIR}
+ ${HDF5_F90_SOURCE_DIR}/src
+ ${HDF5_F90_SRC_BINARY_DIR}
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}
+ ${HDF5_HL_SOURCE_DIR}/src
+)
+LINK_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_HL_F90_BINARY_DIR}
+ ${HDF5_F90_BINARY_DIR}
+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+#-----------------------------------------------------------------------------
+# List Source files
+#-----------------------------------------------------------------------------
+SET (HDF5_HL_F90_F_SRCS
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBff.f90
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.f90
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.f90
+)
+
+SET (HDF5_HL_F90_C_SRCS
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTfc.c
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMfc.c
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMcc.c
+ ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBfc.c
+)
+
+SET (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h)
+
+ADD_LIBRARY (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_C_SRCS} ${HDF5_HL_F90_HEADERS})
+TARGET_LINK_LIBRARIES (${HDF5_HL_F90_C_LIB_TARGET}
+ ${HDF5_F90_C_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+)
+#
+# To Ensure that generated files are built, we must force a dependency
+ADD_DEPENDENCIES(${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET})
+
+SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT
+ "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}"
+)
+H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} ${LIB_TYPE})
+
+ADD_LIBRARY (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_F_SRCS})
+IF (BUILD_SHARED_LIBS)
+ IF (WIN32)
+ SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ BUILD_HDF5_DLL
+ )
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET}
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE /DLL"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ENDIF (BUILD_SHARED_LIBS)
+IF (WIN32)
+ SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ HDF5F90_WINDOWS
+ )
+ SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
+ENDIF (WIN32)
+SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT
+ "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}"
+)
+TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET}
+ ${HDF5_HL_F90_C_LIB_TARGET}
+ ${HDF5_F90_LIB_TARGET}
+)
+H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} ${LIB_TYPE})
+ADD_DEPENDENCIES (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET})
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF5_EXPORTED_TARGETS)
+ INSTALL (
+ TARGETS
+ ${HDF5_HL_F90_C_LIB_TARGET}
+ ${HDF5_HL_F90_LIB_TARGET}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ LIBRARY DESTINATION lib COMPONENT hlfortlibraries
+ ARCHIVE DESTINATION lib COMPONENT hlfortlibraries
+ RUNTIME DESTINATION bin COMPONENT hlfortlibraries
+ )
+ENDIF (HDF5_EXPORTED_TARGETS)
diff --git a/hl/fortran/src/H5IMcc.h b/hl/fortran/src/H5IMcc.h
index 9f70bac..0b8a345 100644
--- a/hl/fortran/src/H5IMcc.h
+++ b/hl/fortran/src/H5IMcc.h
@@ -18,7 +18,7 @@
#include "H5LTprivate.h"
#include "H5IMprivate.h"
-#include "../../fortran/src/H5f90i_gen.h"
+#include "H5f90i_gen.h"
#ifdef __cplusplus
extern "C" {
diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in
index a01bcfa..bf1fe89 100644
--- a/hl/fortran/src/Makefile.in
+++ b/hl/fortran/src/Makefile.in
@@ -220,12 +220,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
@@ -389,7 +389,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 59
+LT_VERS_REVISION = 63
LT_VERS_AGE = 0
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \
-I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src
diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt
new file mode 100644
index 0000000..14bd622
--- /dev/null
+++ b/hl/fortran/test/CMakeLists.txt
@@ -0,0 +1,85 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Add Tests
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+LINK_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_HL_F90_BINARY_DIR}
+ ${HDF5_F90_BINARY_DIR}
+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+#-- Adding test for hl_f90_tstlite
+ADD_EXECUTABLE (hl_f90_tstlite tstlite.f90)
+H5_NAMING (hl_f90_tstlite)
+IF (WIN32)
+ IF (MSVC)
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_tstlite
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ELSE (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_tstlite
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>)
+
+#-- Adding test for hl_f90_tstimage
+ADD_EXECUTABLE (hl_f90_tstimage tstimage.f90)
+H5_NAMING (hl_f90_tstimage)
+IF (WIN32)
+ IF (MSVC)
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_tstimage
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ELSE (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_tstimage
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>)
+
+#-- Adding test for hl_f90_tsttable
+ADD_EXECUTABLE (hl_f90_tsttable tsttable.f90)
+H5_NAMING (hl_f90_tsttable)
+IF (WIN32)
+ IF (MSVC)
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_tsttable
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ELSE (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_f90_tsttable
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET})
+SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>)
diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in
index 6ff5d02..1f73b79 100644
--- a/hl/fortran/test/Makefile.in
+++ b/hl/fortran/test/Makefile.in
@@ -194,12 +194,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
new file mode 100644
index 0000000..6042853
--- /dev/null
+++ b/hl/src/CMakeLists.txt
@@ -0,0 +1,67 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_SRC)
+
+#-----------------------------------------------------------------------------
+# Shared Libs
+#-----------------------------------------------------------------------------
+IF (BUILD_SHARED_LIBS)
+ SET (HL_BUILT_AS_DYNAMIC_LIB 1)
+ENDIF (BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# List Source files
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
+
+SET (HL_SRCS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5IM.c
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LT.c
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5PT.c
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5TB.c
+)
+
+SET (HL_HEADERS
+ ${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
+ ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h
+)
+
+ADD_LIBRARY (${HDF5_HL_LIB_TARGET} ${LIB_TYPE} ${HL_SRCS} ${HL_HEADERS})
+SET_TARGET_PROPERTIES(${HDF5_HL_LIB_TARGET} PROPERTIES DEFINE_SYMBOL ${HDF5_HL_LIB_CORENAME}_EXPORTS)
+TARGET_LINK_LIBRARIES (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}")
+H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+ FILES
+ ${HL_HEADERS}
+ DESTINATION
+ include
+ COMPONENT
+ hlheaders
+)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF5_EXPORTED_TARGETS)
+ INSTALL (
+ TARGETS
+ ${HDF5_HL_LIB_TARGET}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ LIBRARY DESTINATION lib COMPONENT hllibraries
+ ARCHIVE DESTINATION lib COMPONENT hllibraries
+ RUNTIME DESTINATION bin COMPONENT hllibraries
+ )
+ENDIF (HDF5_EXPORTED_TARGETS)
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 245a2c5..faa6d30 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -132,7 +132,7 @@ herr_t H5DSattach_scale(hid_t did,
hid_t ntid = -1; /* attribute native type ID */
hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
- hsize_t *dims=NULL; /* dimension of the "REFERENCE_LIST" array */
+ hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */
ds_list_t dsl; /* attribute data in the DS pointing to the dataset */
ds_list_t *dsbuf=NULL; /* array of attribute data in the DS pointing to the dataset */
hobj_ref_t ref_to_ds; /* reference to the DS */
@@ -238,11 +238,6 @@ herr_t H5DSattach_scale(hid_t did,
*/
if (has_dimlist == 0)
{
- /* create one entry array */
- dims = (hsize_t*) malloc (1 * sizeof (hsize_t));
-
- if(dims == NULL)
- return FAIL;
dims[0] = rank;
@@ -288,11 +283,6 @@ herr_t H5DSattach_scale(hid_t did,
if (H5Aclose(aid) < 0)
goto out;
- if (dims)
- {
- free(dims);
- dims = NULL;
- }
if (buf)
{
free(buf);
@@ -411,11 +401,6 @@ herr_t H5DSattach_scale(hid_t did,
*/
if (has_reflist == 0)
{
- /* create one entry array */
- dims = (hsize_t*) malloc (1 * sizeof (hsize_t));
-
- if (dims == NULL)
- goto out;
dims[0] = 1;
@@ -454,11 +439,6 @@ herr_t H5DSattach_scale(hid_t did,
if(H5Aclose(aid) < 0)
goto out;
- if(dims)
- {
- free(dims);
- dims = NULL;
- }
}
/*-------------------------------------------------------------------------
@@ -474,7 +454,8 @@ herr_t H5DSattach_scale(hid_t did,
if((tid = H5Aget_type(aid)) < 0)
goto out;
- if((ntid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
+ /* get native type to read attribute REFERENCE_LIST */
+ if((ntid = H5DS_get_REFLIST_type()) < 0)
goto out;
/* get and save the old reference(s) */
@@ -499,8 +480,6 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
if (H5Aclose(aid) < 0)
goto out;
- if (H5Tclose(ntid) < 0)
- goto out;
/*-------------------------------------------------------------------------
* create a new attribute
@@ -516,26 +495,17 @@ herr_t H5DSattach_scale(hid_t did,
dsbuf[nelmts-1] = dsl;
/* create a new data space for the new references array */
- dims = (hsize_t *)malloc((size_t)nelmts * sizeof(hsize_t));
- if(dims == NULL)
- goto out;
dims[0] = nelmts;
if((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if (dims)
- {
- free(dims);
- dims = NULL;
- }
-
/* create the attribute again with the changes of space */
if((aid = H5Acreate2(dsid, REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* write the attribute with the new references */
- if(H5Awrite(aid, tid, dsbuf) < 0)
+ if(H5Awrite(aid, ntid, dsbuf) < 0)
goto out;
/* close */
@@ -545,6 +515,8 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
if(H5Aclose(aid) < 0)
goto out;
+ if (H5Tclose(ntid) < 0)
+ goto out;
if (dsbuf)
{
@@ -573,11 +545,6 @@ herr_t H5DSattach_scale(hid_t did,
/* error zone */
out:
- if (dims)
- {
- free(dims);
- dims = NULL;
- }
if (buf)
{
free(buf);
@@ -620,9 +587,11 @@ out:
*
* Date: December 20, 2004
*
-* Comments:
+* Comments:
*
-* Modifications:
+* Modifications: Function didn't delete DIMENSION_LIST attribute, when
+* all dimension scales were detached from a dataset; added.
+* 2010/05/13 EIP
*
*-------------------------------------------------------------------------
*/
@@ -642,14 +611,15 @@ herr_t H5DSdetach_scale(hid_t did,
hid_t aid = -1; /* attribute ID */
int rank; /* rank of dataset */
ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */
- ds_list_t *dsbufn = NULL; /* array of attribute data in the DS pointing to the dataset */
- hsize_t *dims = NULL; /* dimension of the "REFERENCE_LIST" array */
+ hsize_t dims[1]; /* dimension of the "REFERENCE_LIST" array */
hobj_ref_t ref; /* reference to the DS */
hvl_t *buf = NULL; /* VL buffer to store in the attribute */
- unsigned i, j, jj;
- H5O_info_t oi1, oi2, oi3, oi4;
+ int i;
+ size_t j;
+ hssize_t ii;
+ H5O_info_t did_oi, dsid_oi, tmp_oi;
int found_dset = 0, found_ds = 0;
- H5I_type_t it1, it2;
+ int have_ds = 0;
htri_t is_scale;
/*-------------------------------------------------------------------------
@@ -657,32 +627,28 @@ herr_t H5DSdetach_scale(hid_t did,
*-------------------------------------------------------------------------
*/
- if ((is_scale = H5DSis_scale(did)) < 0)
+ /* check for valid types of identifiers */
+
+ if(H5I_DATASET!=H5Iget_type(did) || H5I_DATASET!=H5Iget_type(dsid))
+ return FAIL;
+
+ if((is_scale = H5DSis_scale(did)) < 0)
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_info(did, &did_oi) < 0)
return FAIL;
/* get info for the scale in the parameter list */
- if(H5Oget_info(dsid, &oi2) < 0)
+ if(H5Oget_info(dsid, &dsid_oi) < 0)
return FAIL;
/* same object, not valid */
- if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr)
- return FAIL;
-
- /* get ID type */
- if ((it1 = H5Iget_type(did)) < 0)
- return FAIL;
- if ((it2 = H5Iget_type(dsid)) < 0)
- return FAIL;
-
- if (H5I_DATASET!=it1 || H5I_DATASET!=it2)
+ if(did_oi.fileno == dsid_oi.fileno && did_oi.addr == dsid_oi.addr)
return FAIL;
@@ -761,46 +727,62 @@ herr_t H5DSdetach_scale(hid_t did,
if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
goto out;
- /* get info for DS in the parameter list */
- if(H5Oget_info(dsid, &oi1) < 0)
+ /* get info for this DS */
+ if(H5Oget_info(dsid_j, &tmp_oi) < 0)
goto out;
- /* get info for this DS */
- if(H5Oget_info(dsid_j, &oi2) < 0)
+ /* Close the dereferenced dataset */
+ if (H5Dclose(dsid_j) < 0)
goto out;
/* same object, reset */
- if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr)
+ if(dsid_oi.fileno == tmp_oi.fileno && dsid_oi.addr == tmp_oi.addr)
{
- size_t len;
-
- for(jj=j; jj<buf[idx].len-1; jj++)
- {
- ((hobj_ref_t *)buf[idx].p)[jj] = ((hobj_ref_t *)buf[idx].p)[jj+1];
+ /* 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) {
+ free(buf[idx].p);
+ buf[idx].p = NULL;
}
-
- buf[idx].len--;
- len = buf[idx].len;
- buf[idx].p = realloc( buf[idx].p, len * sizeof(hobj_ref_t));
-
+ /* 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;
-
- /* close the dereferenced dataset and break */
- if (H5Dclose(dsid_j) < 0)
- goto out;
break;
}
-
- /* close the dereferenced dataset */
- if (H5Dclose(dsid_j) < 0)
- goto out;
} /* j */
} /* if */
- /* write the attribute */
- if (H5Awrite(aid,tid,buf) < 0)
+ /* the scale must be present to continue */
+ if(found_ds == 0)
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 */
+ for(i=0; i < rank; i++) {
+ if(buf[i].len > 0) {
+ have_ds = 1;
+ break;
+ }
+ }
+ if(have_ds) {
+ if(H5Awrite(aid,tid,buf) < 0)
+ goto out;
+ }
+ else {
+ if(H5Adelete(did,DIMENSION_LIST) < 0)
+ goto out;
+ }
+
/* close */
if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0)
goto out;
@@ -817,9 +799,6 @@ herr_t H5DSdetach_scale(hid_t did,
buf = NULL;
}
- /* the scale must be present */
- if(found_ds == 0)
- goto out;
/*-------------------------------------------------------------------------
* the "REFERENCE_LIST" array exists, update
@@ -832,7 +811,8 @@ herr_t H5DSdetach_scale(hid_t did,
if((tid = H5Aget_type(aid)) < 0)
goto out;
- if((ntid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
+ /* get native type to read attribute REFERENCE_LIST */
+ if((ntid = H5DS_get_REFLIST_type()) < 0)
goto out;
/* get and save the old reference(s) */
@@ -849,49 +829,42 @@ herr_t H5DSdetach_scale(hid_t did,
if (H5Aread(aid,ntid,dsbuf) < 0)
goto out;
- for(i=0; i<nelmts; i++)
- {
- /* get the reference to the dataset */
- ref = dsbuf[i].ref;
-
- /* get the dataset id */
- if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
- goto out;
-
- /* get info for dataset in the parameter list */
- if(H5Oget_info(did, &oi3) < 0)
- goto out;
-
- /* get info for this dataset */
- if(H5Oget_info(did_i, &oi4) < 0)
- goto out;
+ for(ii=0; ii<nelmts; ii++) {
+ /* First check if we have the same dimension index */
+ if((int)idx == dsbuf[ii].dim_idx) {
+ /* get the reference to the dataset */
+ ref = dsbuf[ii].ref;
- /* same object, reset. we want to detach only for this DIM */
- if(oi3.fileno == oi4.fileno && oi3.addr == oi4.addr && (int)idx == dsbuf[i].dim_idx) {
- for(jj=i; jj<nelmts-1; jj++)
- dsbuf[jj] = dsbuf[jj+1];
- nelmts--;
- found_dset=1;
+ /* get the dataset id */
+ if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0)
+ goto out;
- /* close the dereferenced dataset and break */
- if (H5Dclose(did_i) < 0)
+ /* get info for this dataset */
+ if(H5Oget_info(did_i, &tmp_oi) < 0)
goto out;
- break;
- } /* if */
- /* close the dereferenced dataset */
- if (H5Dclose(did_i) < 0)
- goto out;
+ /* close the dereferenced dataset */
+ if(H5Dclose(did_i) < 0)
+ goto out;
- } /* i */
+ /* same object, reset. we want to detach only for this DIM */
+ if(did_oi.fileno == tmp_oi.fileno && did_oi.addr == tmp_oi.addr) {
+ /* if we found not the last one, copy the last one to replace
+ the one which is found */
+ if(i < nelmts-1)
+ dsbuf[ii] = dsbuf[nelmts-1];
+ nelmts--;
+ found_dset=1;
+ break;
+ } /* if */
+ } /* if we have the same dimension index */
+ } /* ii */
/* close space and attribute */
if (H5Sclose(sid) < 0)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- if (H5Tclose(ntid) < 0)
- goto out;
/*-------------------------------------------------------------------------
* check if we found the pointed dataset
@@ -915,19 +888,8 @@ herr_t H5DSdetach_scale(hid_t did,
if(nelmts)
{
/* create a new data space for the new references array */
- dims = (hsize_t*)malloc((size_t)nelmts * sizeof (hsize_t));
- if(dims == NULL)
- goto out;
dims[0] = nelmts;
- dsbufn = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t));
- if(dsbufn == NULL)
- goto out;
-
- /* store the new information */
- for(i = 0; i < nelmts; i++)
- dsbufn[i] = dsbuf[i];
-
if((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
@@ -936,7 +898,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* write the new attribute with the new references */
- if(H5Awrite(aid, tid, dsbufn) < 0)
+ if(H5Awrite(aid, ntid, dsbuf) < 0)
goto out;
/* close space and attribute */
@@ -949,22 +911,14 @@ herr_t H5DSdetach_scale(hid_t did,
/* close type */
if (H5Tclose(tid) < 0)
goto out;
+ if (H5Tclose(ntid) < 0)
+ goto out;
if (dsbuf)
{
free(dsbuf);
dsbuf=NULL;
}
- if (dsbufn)
- {
- free(dsbufn);
- dsbufn=NULL;
- }
- if (dims)
- {
- free(dims);
- dims=NULL;
- }
return SUCCEED;
@@ -982,18 +936,14 @@ out:
free(dsbuf);
dsbuf=NULL;
}
- if (dsbufn)
- {
- free(dsbufn);
- dsbufn=NULL;
- }
- if (dims)
- {
- free(dims);
- dims=NULL;
- }
if (buf)
{
+ /* Failure occured before H5Dvlen_reclaim was called;
+ free the pointers allocated when we read data in */
+ for(i=0; i<rank; i++) {
+ if(buf[i].p)
+ free(buf[i].p);
+ }
free(buf);
buf=NULL;
}
@@ -1203,7 +1153,8 @@ htri_t H5DSis_attached(hid_t did,
if((tid = H5Aget_type(aid)) < 0)
goto out;
- if((ntid = H5Tget_native_type(tid, H5T_DIR_DEFAULT)) < 0)
+ /* get native type to read REFERENCE_LIST attribute */
+ if((ntid = H5DS_get_REFLIST_type()) < 0)
goto out;
/* get and save the old reference(s) */
@@ -1218,7 +1169,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;
/*-------------------------------------------------------------------------
@@ -1284,6 +1235,7 @@ out:
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(tid);
+ H5Tclose(ntid);
} H5E_END_TRY;
if (buf)
@@ -2269,6 +2221,47 @@ out:
return FAIL;
}
+/*-------------------------------------------------------------------------
+* Function: H5DS_get_REFLIST_type
+*
+* Purpose: This is a helper function to return a native type for
+* the REFERENCE_LIST attribute.
+*
+* Return: Type identifier on success and negative on failure
+*
+* Programmer: epourmal@hdfgroup.org
+*
+* Date: May 22, 2010
+*
+* Comments:
+*
+* Modifications:
+*
+*-------------------------------------------------------------------------
+*/
+hid_t H5DS_get_REFLIST_type(void)
+{
+ 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 */
+
+ if((ntid_t = H5Tcreate(H5T_COMPOUND, sizeof(ds_list_t))) < 0)
+ goto out;
+ if(H5Tinsert(ntid_t, "dataset", HOFFSET(ds_list_t,ref), H5T_STD_REF_OBJ) < 0)
+ goto out;
+
+ if(H5Tinsert(ntid_t, "dimension", HOFFSET(ds_list_t, dim_idx), H5T_NATIVE_INT) < 0)
+ goto out;
+
+ return ntid_t;
+out:
+ H5E_BEGIN_TRY {
+ H5Tclose(ntid_t);
+ } H5E_END_TRY;
+ return FAIL;
+}
diff --git a/hl/src/H5DSprivate.h b/hl/src/H5DSprivate.h
index 9d921b3..5094208 100644
--- a/hl/src/H5DSprivate.h
+++ b/hl/src/H5DSprivate.h
@@ -38,6 +38,7 @@ typedef struct ds_list_t {
*/
H5_HLDLL herr_t H5DS_is_reserved( hid_t did);
+H5_HLDLL hid_t H5DS_get_REFLIST_type(void);
#endif
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index 10027e3..e22494e 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -211,12 +211,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
@@ -380,7 +380,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 59
+LT_VERS_REVISION = 63
LT_VERS_AGE = 0
# This library is our main target.
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
new file mode 100644
index 0000000..91d7c80
--- /dev/null
+++ b/hl/test/CMakeLists.txt
@@ -0,0 +1,87 @@
+cmake_minimum_required (VERSION 2.8)
+# --------------------------------------------------------------------
+# Notes: When creating unit test executables they should be prefixed
+# with "hl_". This allows for easier filtering of the test suite when
+# using ctest. An example would be
+# ctest -R hl_
+# which would only run the High Level based unit tests.
+# --------------------------------------------------------------------
+
+PROJECT (HDF5_HL_TEST)
+
+#-----------------------------------------------------------------------------
+# Generate the H5srcdir_str.h file containing user settings needed by compilation
+#-----------------------------------------------------------------------------
+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_SOURCE_DIR})
+
+# --------------------------------------------------------------------
+# Macro used to add a unit test
+# --------------------------------------------------------------------
+MACRO (HL_ADD_TEST hl_name files)
+ ADD_EXECUTABLE (hl_${hl_name} ${hl_name}.c)
+ H5_NAMING (hl_${hl_name})
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_${hl_name}
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (hl_${hl_name}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ )
+
+ ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>)
+
+ #-- Copy the necessary files.
+ FOREACH (h5_file ${files})
+ SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}")
+ ADD_CUSTOM_COMMAND (
+ TARGET hl_${hl_name}
+ PRE_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest}
+ )
+
+ ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES})
+ENDMACRO (HL_ADD_TEST)
+
+HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5")
+HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri")
+HL_ADD_TEST (test_lite "dtype_file.txt")
+HL_ADD_TEST (test_packet "")
+HL_ADD_TEST (test_table "test_table_be.hdf5;test_table_cray.hdf5;test_table_le.hdf5")
+
+# --------------------------------------------------------------------
+# 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 (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (hl_gen_test_ds gen_test_ds.c)
+ H5_NAMING (hl_gen_test_ds)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hl_gen_test_ds
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (hl_gen_test_ds
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ )
+ENDIF (NOT BUILD_SHARED_LIBS)
diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am
index fc6e969..86e3318 100644
--- a/hl/test/Makefile.am
+++ b/hl/test/Makefile.am
@@ -46,6 +46,6 @@ endif
# Temporary files. These files are the ones created by running `make test'.
CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-9].h5 test_image[1-3].h5 \
test_lite[1-2].h5 test_table.h5 test_packet_table.h5 \
- test_packet_compress.h5
+ test_packet_compress.h5 test_detach.h5
include $(top_srcdir)/config/conclude.am
diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in
index 3d37e3e..a68831e 100644
--- a/hl/test/Makefile.in
+++ b/hl/test/Makefile.in
@@ -215,12 +215,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
@@ -383,7 +383,8 @@ TRACE = perl $(top_srcdir)/bin/trace
# Temporary files. These files are the ones created by running `make test'.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog combine_tables[1-2].h5 \
test_ds[1-9].h5 test_image[1-3].h5 test_lite[1-2].h5 \
- test_table.h5 test_packet_table.h5 test_packet_compress.h5
+ test_table.h5 test_packet_table.h5 test_packet_compress.h5 \
+ test_detach.h5
# The tests depend on the hdf5, hdf5 test, and hdf5_hl libraries
LDADD = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5)
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index d1705ec..53870f5 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -71,6 +71,7 @@ static int test_long_scalenames(const char *fileext);
static int test_samelong_scalenames(const char *fileext);
static int test_float_scalenames(const char *fileext);
static int test_foreign_scaleattached(const char *fileforeign);
+static int test_detachscales(void);
static int test_simple(void);
static int test_errors(void);
@@ -136,6 +137,9 @@ static int read_data( const char* fname, int ndims, hsize_t *dims, float **buf )
#define FILE6 "test_ds8.h5"
#define FILE7 "test_ds9.h5"
+#define DIMENSION_LIST "DIMENSION_LIST"
+#define REFERENCE_LIST "REFERENCE_LIST"
+
/*-------------------------------------------------------------------------
* the main program
*-------------------------------------------------------------------------
@@ -169,6 +173,7 @@ int main(void)
nerrors += test_samelong_scalenames("2") < 0 ? 1 : 0;
nerrors += test_foreign_scaleattached(FOREIGN_FILE1) < 0 ? 1 : 0;
nerrors += test_foreign_scaleattached(FOREIGN_FILE2) < 0 ? 1 : 0;
+ nerrors += test_detachscales() < 0 ? 1 : 0;
/* the following tests have not been rewritten to match those above */
nerrors += test_simple() < 0 ?1:0;
@@ -238,8 +243,7 @@ herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims)
int rank = 3;
int rankds = 1;
hsize_t dims[3] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE};
- char buf[DIM_DATA*3] = {1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12};
+ char buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE];
hsize_t s1_dim[1] = {DIM1_SIZE};
hsize_t s2_dim[1] = {DIM2_SIZE};
hsize_t s3_dim[1] = {DIM3_SIZE};
@@ -292,8 +296,7 @@ herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims)
int rank = 3;
int rankds = 1;
hsize_t dims[3] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE};
- short buf[DIM_DATA*3] = {1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12};
+ short buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE];
hsize_t s1_dim[1] = {DIM1_SIZE};
hsize_t s2_dim[1] = {DIM2_SIZE};
hsize_t s3_dim[1] = {DIM3_SIZE};
@@ -347,7 +350,7 @@ herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
int rank = RANK;
int rankds = 1;
hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
- int buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12};
+ int buf[DIM1_SIZE*DIM2_SIZE];
hsize_t s1_dim[1] = {DIM1_SIZE};
hsize_t s2_dim[1] = {DIM2_SIZE};
int s1_wbuf[DIM1_SIZE] = {10,20,30};
@@ -389,10 +392,7 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int
int rank = 4;
int rankds = 1;
hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE};
- long buf[DIM_DATA*3*2] = {1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,
- 1,2,3,4,5,6,7,8,9,10,11,12};
+ long buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE*DIM4_SIZE];
hsize_t s1_dim[1] = {DIM1_SIZE};
hsize_t s2_dim[1] = {DIM2_SIZE};
hsize_t s3_dim[1] = {DIM3_SIZE};
@@ -458,7 +458,7 @@ herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims)
int rank = RANK;
int rankds = 1;
hsize_t dims[RANK] = {DIM1_SIZE,DIM2_SIZE};
- float buf[DIM_DATA] = {1,2,3,4,5,6,7,8,9,10,11,12};
+ float buf[DIM1_SIZE*DIM2_SIZE];
hsize_t s1_dim[1] = {DIM1_SIZE};
hsize_t s2_dim[1] = {DIM2_SIZE};
float s1_wbuf[DIM1_SIZE] = {10,20,30};
@@ -1144,6 +1144,148 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc
return ret_value;
}
+static int test_detachscales(void)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t dsid = -1;
+ int rank1 = 1;
+ int rank3 = 3;
+ hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/
+ int *buf = NULL;
+ char dname[10];
+ int i;
+
+ /* This tests creates two three dimensional datasets; then it creates
+ four integer datasets that are used as dim. scales; we will attach
+ 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");
+
+ 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);
+ 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);
+ if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0)
+ goto out;
+ }
+ /* 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);
+ if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0)
+ goto out;
+ if(H5Dclose(dsid) < 0)
+ goto out;
+ }
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ /* 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);
+ if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0)
+ goto out;
+ if(H5Dclose(dsid) < 0)
+ goto out;
+ }
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+ /* detach DS0 from first dimension of D0 and D1; then check
+ that DS0 doesn't have attribute REFERENCE _LIST */
+
+ if((dsid = H5Dopen2(fid, "DS0", H5P_DEFAULT)) < 0)
+ goto out;
+
+ for (i=0; i<2; i++) {
+ sprintf(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
+ dimension of D0 */
+ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0)
+ goto out;
+ if((dsid = H5Dopen2(fid, "DS3", H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5DSis_attached(did, dsid, (unsigned int) 0) <= 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+ if(H5Dclose(dsid) < 0)
+ goto out;
+
+ /* 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);
+ if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0)
+ goto out;
+ if(H5Dclose(dsid) < 0)
+ goto out;
+ }
+ /* Check that attribute "DIMENSION_LIST" doesn't exist anymore */
+ if(H5Aexists(did, DIMENSION_LIST)!= 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+ }
+ else
+ goto out;
+
+
+ PASSED();
+
+ H5Fclose(fid);
+ return SUCCEED;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Dclose(dsid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+
+ return FAIL;
+}
+
static int test_char_attachscales(const char *fileext)
{
hid_t fid = -1;
diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt
new file mode 100644
index 0000000..e8c729d
--- /dev/null
+++ b/hl/tools/CMakeLists.txt
@@ -0,0 +1,85 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_TOOLS)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (GIF2H5_SRCS
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif.h
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/decompress.c
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif2hdf.c
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif2mem.c
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gifread.c
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/writehdf.c
+)
+
+#-- Add gif2hdf5 program
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5)
+
+ADD_EXECUTABLE (gif2h5 ${GIF2H5_SRCS})
+H5_NAMING (gif2h5)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (gif2h5
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+#-- Add h52gif program
+SET (hdf2gif_SRCS
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/hdf2gif.c
+ ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/hdfgifwr.c
+)
+ADD_EXECUTABLE (hdf2gif ${hdf2gif_SRCS})
+H5_NAMING (hdf2gif)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (hdf2gif
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (hdf2gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+# --------------------------------------------------------------------
+# 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 (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c)
+ H5_NAMING (hl_h52gifgentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (hl_h52gifgentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>)
+ENDIF (NOT BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ gif2h5
+ hdf2gif
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ hltoolsapplications
+)
diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in
index 99d627d..f6d8563 100644
--- a/hl/tools/Makefile.in
+++ b/hl/tools/Makefile.in
@@ -200,12 +200,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in
index ed61e3c..70c78bf 100644
--- a/hl/tools/gif2h5/Makefile.in
+++ b/hl/tools/gif2h5/Makefile.in
@@ -200,12 +200,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@