From 6ee0e05fb94445551840fcb80b9b1c254c736799 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 18 Apr 2013 13:23:51 -0500 Subject: [svn-r23599] Bring revisions 22802 : 23085 from trunk to revise_chunks. h5committested. --- CMakeLists.txt | 11 +- MANIFEST | 46 +- README.txt | 2 +- bin/h5vers | 8 - bin/trace | 1 + c++/src/CMakeLists.txt | 2 + c++/src/H5AbstractDs.cpp | 5 - c++/src/H5AbstractDs.h | 2 +- c++/src/H5ArrayType.h | 2 +- c++/src/H5AtomType.h | 2 +- c++/src/H5Attribute.cpp | 25 + c++/src/H5Attribute.h | 6 +- c++/src/H5Classes.h | 1 + c++/src/H5CompType.h | 20 +- c++/src/H5Cpp.h | 1 + c++/src/H5CppDoc.h | 2 +- c++/src/H5DataSet.cpp | 48 -- c++/src/H5DataSet.h | 9 +- c++/src/H5DataSpace.h | 2 +- c++/src/H5DataType.cpp | 45 -- c++/src/H5DataType.h | 7 +- c++/src/H5DcreatProp.h | 2 +- c++/src/H5DxferProp.h | 2 +- c++/src/H5EnumType.h | 2 +- c++/src/H5FaccProp.h | 2 +- c++/src/H5FcreatProp.h | 2 +- c++/src/H5File.cpp | 237 +------- c++/src/H5File.h | 33 +- c++/src/H5FloatType.h | 2 +- c++/src/H5Group.cpp | 47 -- c++/src/H5Group.h | 7 +- c++/src/H5IdComponent.h | 2 +- c++/src/H5IntType.h | 2 +- c++/src/H5Location.cpp | 669 ++++++++++++++++++++++ c++/src/H5Location.h | 146 +++++ c++/src/H5Object.cpp | 514 +---------------- c++/src/H5Object.h | 93 +-- c++/src/H5PredType.h | 2 +- c++/src/H5PropList.h | 2 +- c++/src/H5StrType.h | 2 +- c++/src/H5VarLenType.h | 2 +- c++/src/Makefile.am | 17 +- c++/src/Makefile.in | 32 +- c++/test/dsets.cpp | 11 +- c++/test/h5cpputil.cpp | 1 + c++/test/tattr.cpp | 135 +++-- c++/test/tfile.cpp | 137 ++++- c++/test/th5s.cpp | 2 +- c++/test/trefer.cpp | 44 +- config/apple | 16 + config/cmake/H5pubconf.h.in | 18 + config/cmake/prunTest.cmake | 24 +- config/cmake/runTest.cmake | 48 +- config/ibm-aix | 8 +- config/lt_vers.am | 2 +- configure | 93 +-- configure.ac | 19 +- fortran/examples/CMakeLists.txt | 5 +- fortran/examples/Makefile.am | 5 +- fortran/examples/Makefile.in | 5 +- fortran/examples/grpit.f90 | 215 ------- fortran/robodoc.rc | 82 ++- fortran/src/CMakeLists.txt | 28 +- fortran/src/H5FDmpiof.c | 37 ++ fortran/src/H5FDmpioff.f90 | 82 ++- fortran/src/H5Gff.f90 | 2 +- fortran/src/H5Of.c | 655 ++++++++++++++++++--- fortran/src/H5Off.f90 | 468 ++++++++++++++- fortran/src/H5Off_F03.f90 | 232 +++++++- fortran/src/H5Pff.f90 | 2 + fortran/src/H5Rf.c | 41 ++ fortran/src/H5Rff.f90 | 61 -- fortran/src/H5Rff_F03.f90 | 174 +++++- fortran/src/H5Rff_F90.f90 | 65 +++ fortran/src/H5_f.c | 6 +- fortran/src/H5f90global.f90 | 14 +- fortran/src/H5f90kit.c | 2 +- fortran/src/H5f90proto.h | 37 +- fortran/src/H5match_types.c | 24 +- fortran/src/Makefile.in | 2 +- fortran/src/hdf5_fortrandll.def | 528 ----------------- fortran/src/hdf5_fortrandll.def.in | 570 +++++++++++++++++++ fortran/src/phdf5_fortrandll.def | 531 ----------------- fortran/test/CMakeLists.txt | 5 +- fortran/test/Makefile.am | 2 +- fortran/test/Makefile.in | 6 +- fortran/test/fortranlib_test_1_8.f90 | 141 ----- fortran/test/fortranlib_test_F03.f90 | 37 +- fortran/test/tH5A.f90 | 4 +- fortran/test/tH5O.f90 | 255 ++++++++- fortran/test/tH5O_F03.f90 | 547 ++++++++++++++++++ fortran/test/tH5T.f90 | 4 +- fortran/test/tH5T_F03.f90 | 307 +++++++++- fortran/testpar/hyper.f90 | 19 + hl/c++/src/Makefile.in | 2 +- hl/fortran/src/Makefile.in | 2 +- hl/src/H5TB.c | 100 ++-- hl/src/Makefile.in | 2 +- hl/test/test_image.c | 2 +- perform/Makefile.am | 3 +- perform/Makefile.in | 31 +- release_docs/RELEASE.txt | 368 ++++++++---- src/CMakeLists.txt | 1 + src/H5AC.c | 22 +- src/H5ACprivate.h | 32 +- src/H5Dmpio.c | 304 ++-------- src/H5Dprivate.h | 4 - src/H5Edefin.h | 4 +- src/H5Einit.h | 4 +- src/H5Eint.c | 4 + src/H5Epubgen.h | 4 +- src/H5Eterm.h | 2 +- src/H5FDcore.c | 2 +- src/H5FDdirect.c | 9 +- src/H5FDfamily.c | 4 +- src/H5FDlog.c | 18 +- src/H5FDmpio.c | 4 +- src/H5FDmpiposix.c | 4 +- src/H5Fprivate.h | 70 ++- src/H5Fsfile.c | 8 +- src/H5P.c | 88 ++- src/H5Pdapl.c | 16 +- src/H5Pdcpl.c | 536 +++++++++++++++++- src/H5Pdeprec.c | 5 +- src/H5Pdxpl.c | 798 ++++++++++++++++++++++++-- src/H5Pencdec.c | 813 +++++++++++++++++++++++++++ src/H5Pfapl.c | 717 +++++++++++++++++++++-- src/H5Pfcpl.c | 389 ++++++++++++- src/H5Pfmpl.c | 14 +- src/H5Pgcpl.c | 199 ++++++- src/H5Pint.c | 262 ++++++++- src/H5Plapl.c | 273 ++++++++- src/H5Plcpl.c | 11 +- src/H5Pocpl.c | 222 +++++++- src/H5Pocpypl.c | 157 +++++- src/H5Ppkg.h | 32 +- src/H5Pprivate.h | 1 + src/H5Ppublic.h | 7 +- src/H5Pstrcpl.c | 87 ++- src/H5T.c | 8 +- src/H5Tconv.c | 80 +++ src/H5Tpkg.h | 4 + src/H5Tprivate.h | 2 + src/H5detect.c | 21 +- src/H5err.txt | 6 +- src/H5public.h | 4 +- src/H5trace.c | 4 - src/Makefile.am | 3 +- src/Makefile.in | 14 +- test/CMakeLists.txt | 44 ++ test/Makefile.am | 4 +- test/Makefile.in | 92 +-- test/enc_dec_plist.c | 480 ++++++++++++++++ test/enc_dec_plist_with_endianess.c | 160 ++++++ test/enum.c | 102 +++- test/gen_plist.c | 435 ++++++++++++++ test/h5test.h | 1 + test/links.c | 87 +-- test/mount.c | 75 +-- test/testfiles/plist_files/acpl_be | Bin 0 -> 23 bytes test/testfiles/plist_files/acpl_le | Bin 0 -> 23 bytes test/testfiles/plist_files/dapl_be | Bin 0 -> 136 bytes test/testfiles/plist_files/dapl_le | Bin 0 -> 136 bytes test/testfiles/plist_files/dcpl_be | Bin 0 -> 221 bytes test/testfiles/plist_files/dcpl_le | Bin 0 -> 221 bytes test/testfiles/plist_files/dxpl_be | Bin 0 -> 229 bytes test/testfiles/plist_files/dxpl_le | Bin 0 -> 229 bytes test/testfiles/plist_files/fapl_be | Bin 0 -> 1402 bytes test/testfiles/plist_files/fapl_le | Bin 0 -> 1402 bytes test/testfiles/plist_files/fcpl_be | Bin 0 -> 413 bytes test/testfiles/plist_files/fcpl_le | Bin 0 -> 413 bytes test/testfiles/plist_files/gcpl_be | Bin 0 -> 113 bytes test/testfiles/plist_files/gcpl_le | Bin 0 -> 113 bytes test/testfiles/plist_files/lapl_be | Bin 0 -> 1502 bytes test/testfiles/plist_files/lapl_le | Bin 0 -> 1502 bytes test/testfiles/plist_files/lcpl_be | Bin 0 -> 47 bytes test/testfiles/plist_files/lcpl_le | Bin 0 -> 47 bytes test/testfiles/plist_files/ocpl_be | Bin 0 -> 86 bytes test/testfiles/plist_files/ocpl_le | Bin 0 -> 86 bytes test/testfiles/plist_files/ocpypl_be | Bin 0 -> 56 bytes test/testfiles/plist_files/ocpypl_le | Bin 0 -> 56 bytes test/testfiles/plist_files/strcpl_be | Bin 0 -> 23 bytes test/testfiles/plist_files/strcpl_le | Bin 0 -> 23 bytes testpar/CMakeLists.txt | 1 + testpar/Makefile.am | 3 +- testpar/Makefile.in | 6 +- testpar/t_coll_chunk.c | 36 +- testpar/t_dset.c | 104 ++-- testpar/t_prop.c | 452 +++++++++++++++ testpar/testphdf5.c | 5 +- testpar/testphdf5.h | 10 +- tools/h5copy/h5copygentest.c | 10 +- tools/h5dump/CMakeLists.txt | 6 + tools/h5dump/h5dump.c | 20 +- tools/h5dump/h5dump_xml.c | 3 +- tools/h5dump/h5dump_xml.h | 8 - tools/h5dump/h5dumpgentest.c | 64 ++- tools/h5dump/testh5dump.sh.in | 4 + tools/h5import/h5import.c | 369 ++++++------ tools/h5import/h5import.h | 35 -- tools/h5repack/CMakeLists.txt | 22 + tools/h5repack/h5repack.c | 1 + tools/h5repack/h5repack.sh.in | 21 + tools/h5repack/h5repack_copy.c | 20 + tools/h5repack/h5repacktst.c | 101 +++- tools/h5repack/testfiles/h5repack_layout3.h5 | Bin 966904 -> 491840 bytes tools/h5stat/testh5stat.sh.in | 14 +- tools/lib/h5diff_attr.c | 18 + tools/lib/h5tools.h | 2 +- tools/lib/h5tools_dump.c | 50 +- tools/lib/h5tools_dump.h | 3 +- tools/misc/talign.c | 23 +- tools/testfiles/tscalarattrintsize.ddl | 18 +- tools/testfiles/tscalarattrintsize.h5 | Bin 12944 -> 12944 bytes tools/testfiles/tscalarintsize.ddl | 18 +- tools/testfiles/tscalarintsize.h5 | Bin 15968 -> 15968 bytes tools/testfiles/tscalarstring.ddl | 28 + tools/testfiles/tscalarstring.h5 | Bin 0 -> 2208 bytes vms/src/h5pubconf.h | 6 +- 219 files changed, 12312 insertions(+), 4256 deletions(-) create mode 100644 c++/src/H5Location.cpp create mode 100644 c++/src/H5Location.h delete mode 100644 fortran/examples/grpit.f90 delete mode 100644 fortran/src/hdf5_fortrandll.def create mode 100644 fortran/src/hdf5_fortrandll.def.in delete mode 100644 fortran/src/phdf5_fortrandll.def create mode 100644 fortran/test/tH5O_F03.f90 create mode 100644 src/H5Pencdec.c create mode 100644 test/enc_dec_plist.c create mode 100644 test/enc_dec_plist_with_endianess.c create mode 100644 test/gen_plist.c create mode 100644 test/testfiles/plist_files/acpl_be create mode 100644 test/testfiles/plist_files/acpl_le create mode 100644 test/testfiles/plist_files/dapl_be create mode 100644 test/testfiles/plist_files/dapl_le create mode 100644 test/testfiles/plist_files/dcpl_be create mode 100644 test/testfiles/plist_files/dcpl_le create mode 100644 test/testfiles/plist_files/dxpl_be create mode 100644 test/testfiles/plist_files/dxpl_le create mode 100644 test/testfiles/plist_files/fapl_be create mode 100644 test/testfiles/plist_files/fapl_le create mode 100644 test/testfiles/plist_files/fcpl_be create mode 100644 test/testfiles/plist_files/fcpl_le create mode 100644 test/testfiles/plist_files/gcpl_be create mode 100644 test/testfiles/plist_files/gcpl_le create mode 100644 test/testfiles/plist_files/lapl_be create mode 100644 test/testfiles/plist_files/lapl_le create mode 100644 test/testfiles/plist_files/lcpl_be create mode 100644 test/testfiles/plist_files/lcpl_le create mode 100644 test/testfiles/plist_files/ocpl_be create mode 100644 test/testfiles/plist_files/ocpl_le create mode 100644 test/testfiles/plist_files/ocpypl_be create mode 100644 test/testfiles/plist_files/ocpypl_le create mode 100644 test/testfiles/plist_files/strcpl_be create mode 100644 test/testfiles/plist_files/strcpl_le create mode 100644 testpar/t_prop.c create mode 100644 tools/testfiles/tscalarstring.ddl create mode 100644 tools/testfiles/tscalarstring.h5 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6138b9a..3ddef9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,10 +274,10 @@ SET (H5_ENABLE_SHARED_LIB NO) SET (H5_ENABLE_STATIC_LIB NO) IF (BUILD_SHARED_LIBS) SET (LIB_TYPE SHARED) - ADD_DEFINITIONS (-DH5_BUILT_AS_DYNAMIC_LIB) + SET (H5_BUILT_AS_DYNAMIC_LIB 1) SET (H5_ENABLE_SHARED_LIB YES) ELSE (BUILD_SHARED_LIBS) - ADD_DEFINITIONS (-DH5_BUILT_AS_STATIC_LIB) + SET (H5_BUILT_AS_STATIC_LIB 1) SET (H5_ENABLE_STATIC_LIB YES) IF (NOT WIN32) # should this be a user setting : Everyone uses it anyway ? @@ -759,6 +759,11 @@ IF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for IF (HDF5_BUILD_FORTRAN) OPTION (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" OFF) INCLUDE (${HDF5_RESOURCES_DIR}/HDF5UseFortran.cmake) + IF (HDF5_ENABLE_F2003) + IF (NOT FORTRAN_HAVE_ISO_C_BINDING) + SET (HDF5_ENABLE_F2003 OFF) + ENDIF (NOT FORTRAN_HAVE_ISO_C_BINDING) + ENDIF (HDF5_ENABLE_F2003) # ----------------------------------------------------------------------- # wrapper script variables @@ -916,7 +921,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY ) INSTALL ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF5_PACKAGE_EXT}-config-version.cmake + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} COMPONENT configinstall ) diff --git a/MANIFEST b/MANIFEST index ee8d6cd..4bbea49 100644 --- a/MANIFEST +++ b/MANIFEST @@ -246,7 +246,6 @@ ./fortran/examples/fileexample.f90 ./fortran/examples/groupexample.f90 ./fortran/examples/grpdsetexample.f90 -./fortran/examples/grpit.f90 ./fortran/examples/grpsexample.f90 ./fortran/examples/hyperslab.f90 ./fortran/examples/mountexample.f90 @@ -325,8 +324,7 @@ ./fortran/src/README ./fortran/src/README_DEVELOPEMENT _DO_NOT_DISTRIBUTE_ ./fortran/src/h5fc.in -./fortran/src/hdf5_fortrandll.def -./fortran/src/phdf5_fortrandll.def +./fortran/src/hdf5_fortrandll.def.in ./fortran/test/Makefile.am ./fortran/test/Makefile.in @@ -349,6 +347,7 @@ ./fortran/test/tH5I.f90 ./fortran/test/tH5L_F03.f90 ./fortran/test/tH5O.f90 +./fortran/test/tH5O_F03.f90 ./fortran/test/tH5P_F03.f90 ./fortran/test/tH5P.f90 ./fortran/test/tH5R.f90 @@ -441,6 +440,8 @@ ./c++/src/H5IntType.h ./c++/src/H5Library.cpp ./c++/src/H5Library.h +./c++/src/H5Location.cpp +./c++/src/H5Location.h ./c++/src/H5Object.cpp ./c++/src/H5Object.h ./c++/src/H5PredType.cpp @@ -523,8 +524,6 @@ ./release_docs/INSTALL_parallel ./release_docs/INSTALL_VMS.txt ./release_docs/INSTALL_Windows.txt -./release_docs/INSTALL_Windows_From_Command_Line.txt -./release_docs/INSTALL_Windows_Short_VS2008.TXT ./release_docs/RELEASE.txt ./release_docs/USING_CMake.txt ./release_docs/USING_Windows.txt @@ -833,6 +832,7 @@ ./src/H5Pdcpl.c ./src/H5Pdeprec.c ./src/H5Pdxpl.c +./src/H5Pencdec.c ./src/H5Pfapl.c ./src/H5Pfcpl.c ./src/H5Pfmpl.c @@ -960,6 +960,8 @@ ./test/dtransform.c ./test/earray.c ./test/efc.c +./test/enc_dec_plist.c +./test/enc_dec_plist_with_endianess.c ./test/enum.c ./test/extend.c ./test/external.c @@ -1004,6 +1006,7 @@ ./test/gen_old_group.c _DO_NOT_DISTRIBUTE_ ./test/gen_old_layout.c _DO_NOT_DISTRIBUTE_ ./test/gen_old_mtime.c _DO_NOT_DISTRIBUTE_ +./test/gen_plist.c _DO_NOT_DISTRIBUTE_ ./test/gen_sizes_lheap.c _DO_NOT_DISTRIBUTE_ ./test/gen_specmetaread.c _DO_NOT_DISTRIBUTE_ ./test/gen_udlinks.c _DO_NOT_DISTRIBUTE_ @@ -1106,23 +1109,48 @@ ./test/testfiles/error_test_1 ./test/testfiles/error_test_2 ./test/testfiles/links_env.out +./test/testfiles/plist_files/acpl_be +./test/testfiles/plist_files/acpl_le +./test/testfiles/plist_files/dapl_be +./test/testfiles/plist_files/dapl_le +./test/testfiles/plist_files/dcpl_be +./test/testfiles/plist_files/dcpl_le +./test/testfiles/plist_files/dxpl_be +./test/testfiles/plist_files/dxpl_le +./test/testfiles/plist_files/fapl_be +./test/testfiles/plist_files/fapl_le +./test/testfiles/plist_files/fcpl_be +./test/testfiles/plist_files/fcpl_le +./test/testfiles/plist_files/gcpl_be +./test/testfiles/plist_files/gcpl_le +./test/testfiles/plist_files/lapl_be +./test/testfiles/plist_files/lapl_le +./test/testfiles/plist_files/lcpl_be +./test/testfiles/plist_files/lcpl_le +./test/testfiles/plist_files/ocpl_be +./test/testfiles/plist_files/ocpl_le +./test/testfiles/plist_files/ocpypl_be +./test/testfiles/plist_files/ocpypl_le +./test/testfiles/plist_files/strcpl_be +./test/testfiles/plist_files/strcpl_le ./testpar/COPYING ./testpar/Makefile.am ./testpar/Makefile.in ./testpar/t_cache.c +./testpar/t_chunk_alloc.c +./testpar/t_coll_chunk.c ./testpar/t_dset.c ./testpar/t_file.c ./testpar/t_file_image.c +./testpar/t_filter_read.c ./testpar/t_mdset.c ./testpar/t_mpi.c ./testpar/t_ph5basic.c ./testpar/t_pflush1.c ./testpar/t_pflush2.c -./testpar/t_chunk_alloc.c -./testpar/t_coll_chunk.c -./testpar/t_filter_read.c ./testpar/t_posix_compliant.c +./testpar/t_prop.c ./testpar/t_shapesame.c ./testpar/t_span_tree.c ./testpar/testpar.h @@ -1485,6 +1513,8 @@ ./tools/testfiles/tscalarattrintsize.h5 ./tools/testfiles/tscalarintsize.ddl ./tools/testfiles/tscalarintsize.h5 +./tools/testfiles/tscalarstring.ddl +./tools/testfiles/tscalarstring.h5 ./tools/testfiles/tscaleoffset.ddl ./tools/testfiles/tslink-1.ddl ./tools/testfiles/tslink-2.ddl diff --git a/README.txt b/README.txt index 4a516a1..6ce1c80 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.131-FA_a5 currently under development +HDF5 version 1.9.137-FA_a5 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/bin/h5vers b/bin/h5vers index 138a8e9..475ff5a 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -187,10 +187,6 @@ die "unable to read file: $RELEASE\n" unless -r $file; my $CONFIGURE = $file; $CONFIGURE =~ s/[^\/]*$/..\/configure.ac/; die "unable to read file: $CONFIGURE\n" unless -r $file; -# windows/src/H5pubconf.h -my $H5PUBCONF = $file; -$H5PUBCONF =~ s/[^\/]*$/..\/windows\/src\/H5pubconf.h/; -die "unable to read file: $H5PUBCONF\n" unless -r $file; # vms/src/h5pubconf.h my $H5VMSPUBCONF = $file; $H5VMSPUBCONF =~ s/[^\/]*$/..\/vms\/src\/h5pubconf.h/; @@ -242,7 +238,6 @@ if ($set) { $README = ""; $RELEASE = ""; $CONFIGURE = ""; - $H5PUBCONF = ""; $H5VMSPUBCONF = ""; $LT_VERS = ""; @newver = @curver; @@ -392,9 +387,6 @@ sub gen_h5pubconf { close FILE; } -# Update the Windows-maintained H5pubconf.h file -gen_h5pubconf("HDF5", $H5PUBCONF, @newver) if $H5PUBCONF; - # Update the VMS-maintained h5pubconf.h file gen_h5pubconf("HDF5", $H5VMSPUBCONF, @newver) if $H5VMSPUBCONF; diff --git a/bin/trace b/bin/trace index e9d1203..67aeb17 100755 --- a/bin/trace +++ b/bin/trace @@ -64,6 +64,7 @@ $Source = ""; "int32_t" => "Is", "unsigned" => "Iu", "unsigned int" => "Iu", + "uint32_t" => "Iu", "H5I_type_t" => "It", "H5G_link_t" => "Ll", #Same as H5L_type_t now "H5L_type_t" => "Ll", diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 375bd4a..d983d1e 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -40,6 +40,7 @@ SET (CPP_SRCS ${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp @@ -74,6 +75,7 @@ SET (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 9cf1ee8..e6cacf9 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -25,11 +25,6 @@ #include "H5CommonFG.h" #include "H5Alltypes.h" -#include // remove when done - - using std::cerr; - using std::endl; - #ifndef H5_NO_NAMESPACE namespace H5 { #endif diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 1d04d6c..354b47b 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -65,7 +65,7 @@ class H5_DLLCPP AbstractDs { // dataset - pure virtual. virtual hsize_t getStorageSize() const = 0; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass() const = 0; // Copy constructor diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index d50017a..7daafed 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -36,7 +36,7 @@ class H5_DLLCPP ArrayType : public DataType { // Returns the sizes of dimensions of this array datatype. int getArrayDims(hsize_t* dims); - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("ArrayType"); } // Copy constructor: makes copy of the original object. diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index 1ddfd7d..25770f5 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -57,7 +57,7 @@ class H5_DLLCPP AtomType : public DataType { // Sets the total size for an atomic datatype. void setSize( size_t size ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("AtomType"); } // Copy constructor - makes copy of the original object diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 226ae5c..120ed39 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -385,6 +385,31 @@ hsize_t Attribute::getStorageSize() const } //-------------------------------------------------------------------------- +// Function: Attribute::flush +///\brief Flushes all buffers associated with a file specified by +/// this attribute, to disk. +///\param scope - IN: Specifies the scope of the flushing action, +/// which can be either of these values: +/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file +/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file +///\exception H5::AttributeIException +///\par Description +/// This attribute is used to identify the file to be flushed. +// Programmer Binh-Minh Ribler - 2012 +// Modification +// Sep 2012 - BMR +// Duplicated from H5Location +//-------------------------------------------------------------------------- +void Attribute::flush(H5F_scope_t scope) const +{ + herr_t ret_value = H5Fflush(getId(), scope); + if( ret_value < 0 ) + { + throw AttributeIException("Attribute::flush", "H5Fflush failed"); + } +} + +//-------------------------------------------------------------------------- // Function: Attribute::getId // Purpose: Get the id of this attribute // Description: diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 284e5bc..dd37a99 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -51,7 +51,11 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { void write(const DataType& mem_type, const void *buf ) const; void write(const DataType& mem_type, const H5std_string& strg ) const; - // Returns this class name + // Flushes all buffers associated with the file specified by this + // attribute to disk + void flush( H5F_scope_t scope ) const; + + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Attribute"); } // Creates a copy of an existing attribute using the attribute id diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h index f691548..c3b61ca 100644 --- a/c++/src/H5Classes.h +++ b/c++/src/H5Classes.h @@ -22,6 +22,7 @@ namespace H5 { #endif class Exception; class IdComponent; + class H5Location; class H5Object; class PropList; class FileCreatPropList; diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index ae030ee..9b2b572 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -26,12 +26,21 @@ namespace H5 { class H5_DLLCPP CompType : public DataType { public: + // Default constructor + CompType(); + + // Creates a compound datatype using an existing id + CompType( const hid_t existing_id ); + // Creates a new compound datatype, given the type's size CompType( size_t size ); // H5Tcreate // Gets the compound datatype of the specified dataset CompType( const DataSet& dataset ); // H5Dget_type + // Copy constructor - makes a copy of original object + CompType( const CompType& original ); + // Returns the type class of the specified member of this compound // datatype. It provides to the user a way of knowing what type // to create another datatype of the same class @@ -88,18 +97,9 @@ class H5_DLLCPP CompType : public DataType { // Recursively removes padding from within this compound datatype. void pack() const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("CompType"); } - // Default constructor - CompType(); - - // Creates a compound datatype using an existing id - CompType( const hid_t existing_id ); - - // Copy constructor - makes a copy of original object - CompType( const CompType& original ); - // Noop destructor. virtual ~CompType(); diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index 75d82ba..ddf4f19 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -22,6 +22,7 @@ #include "H5IdComponent.h" #include "H5DataSpace.h" #include "H5PropList.h" +#include "H5Location.h" #include "H5Object.h" #include "H5AbstractDs.h" #include "H5Attribute.h" diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index b974238..ab3fa79 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -30,7 +30,7 @@ * It is assumed that the user has knowledge of the HDF5 file format * and its components. If you are not familiar with HDF5 file format, * and would like to find out more, please refer to the HDF5 documentation - * at http://hdf.ncsa.uiuc.edu/HDF5/doc/H5.intro.html + * at http://www.hdfgroup.org/HDF5/doc/index.html * * Because the HDF5 library maps very well to * the object oriented design approach, classes in the C++ API can diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index f7aaa72..6a1524d 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -644,54 +644,6 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) } } -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: DataSet::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\param ref - IN: Reference to query -///\return An object type, which can be one of the following: -/// \li \c H5G_LINK (0) - Object is a symbolic link. -/// \li \c H5G_GROUP (1) - Object is a group. -/// \li \c H5G_DATASET (2) - Object is a dataset. -/// \li \c H5G_TYPE (3) - Object is a named datatype -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw DataSetIException("DataSet::getObjType", E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: DataSet::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -/// to H5R_DATASET_REGION -///\return DataSpace instance -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw DataSetIException("DataSet::getRegion", E.getDetailMsg()); - } -} - //-------------------------------------------------------------------------- // Function: DataSet::getId ///\brief Get the id of this dataset. diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 3d9183d..54e9d6f 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -76,15 +76,10 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. @@ -110,6 +105,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { private: hid_t id; // HDF5 dataset id +#ifndef DOXYGEN_SHOULD_SKIP_THIS // This function contains the common code that is used by // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific @@ -123,6 +119,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { protected: // Sets the dataset id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 80842f7..9afb8ab 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -103,7 +103,7 @@ class H5_DLLCPP DataSpace : public IdComponent { // Sets or resets the size of this dataspace. void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSpace"); } // Creates a DataSpace object using an existing dataspace id. diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 3edb163..99525bc 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -679,51 +679,6 @@ bool DataType::isVariableStr() const } } -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: DataType::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query -///\return Object type, which can be one of the following: -/// \li \c H5G_LINK Object is a symbolic link. -/// \li \c H5G_GROUP Object is a group. -/// \li \c H5G_DATASET Object is a dataset. -/// \li \c H5G_TYPE Object is a named datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t DataType::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw DataTypeIException(inMemFunc("getObjType"), E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: DataType::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -///\return DataSpace instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace DataType::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw DataTypeIException(inMemFunc("getRegion"), E.getDetailMsg()); - } -} - //-------------------------------------------------------------------------- // Function: DataType::getId // Purpose: Get the id of this attribute diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 48aeaf8..98514bb 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -101,15 +101,10 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } // Creates a copy of an existing DataType using its id diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index b7f5823..ac7664e 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -107,7 +107,7 @@ class H5_DLLCPP DSetCreatPropList : public PropList { // Sets SZIP compression method. void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DSetCreatPropList"); } // Copy constructor: creates a copy of a DSetCreatPropList object. diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 11e15fc..66216d8 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -92,7 +92,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { // Determines whether error-detection is enabled for dataset reads. H5Z_EDC_t getEDCCheck(); - // Returns this class name. + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DSetMemXferPropList"); } // Copy constructor: makes a copy of a DSetMemXferPropList object. diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 2a2c263..914eb66 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -57,7 +57,7 @@ class H5_DLLCPP EnumType : public DataType { void valueOf( const char* name, void *value ) const; void valueOf( const H5std_string& name, void *value ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("EnumType"); } // Default constructor diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 7f133bb..0c2cc21 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -123,7 +123,7 @@ class H5_DLLCPP FileAccPropList : public PropList { // Returns garbage collecting references setting. unsigned getGcReferences() const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("FileAccPropList"); } // Copy constructor: creates a copy of a FileAccPropList object. diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 1aa102f..61074ea 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -62,7 +62,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { // indexing chunked datasets. void setIstorek( unsigned ik ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("FileCreatPropList"); } // Copy constructor: creates a copy of a FileCreatPropList object. diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index da0241f..92c4d32 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -50,7 +50,7 @@ namespace H5 { ///\brief Default constructor: creates a stub H5File object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File() : IdComponent(), id(0) {} +H5File::H5File() : H5Location(), id(0) {} //-------------------------------------------------------------------------- // Function: H5File overloaded constructor @@ -79,7 +79,7 @@ H5File::H5File() : IdComponent(), id(0) {} /// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0) +H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) { p_get_file(name, flags, create_plist, access_plist); } @@ -97,7 +97,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c /// FileCreatPropList::DEFAULT // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent(0) +H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) { p_get_file(name.c_str(), flags, create_plist, access_plist); } @@ -140,34 +140,15 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro ///\param original - IN: H5File instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File(const H5File& original) : IdComponent(original) +H5File::H5File(const H5File& original) : H5Location(original) { id = original.getId(); incRefCount(); // increment number of references to this id } //-------------------------------------------------------------------------- -// Function: H5File::flush -///\brief Flushes all buffers associated with a file to disk. -///\param scope - IN: Specifies the scope of the flushing action, -/// which can be either of these values: -/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file -/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - Dec. 2005 -//-------------------------------------------------------------------------- -void H5File::flush(H5F_scope_t scope) const -{ - herr_t ret_value = H5Fflush( id, scope ); - if( ret_value < 0 ) - { - throw FileIException("H5File::flush", "H5Fflush failed"); - } -} - -//-------------------------------------------------------------------------- // Function: H5File::isHdf5 -///\brief Determines whether a file in HDF5 format. +///\brief Determines whether a file in HDF5 format. (Static) ///\param name - IN: Name of the file ///\return true if the file is in HDF5 format, and false, otherwise ///\exception H5::FileIException @@ -191,7 +172,7 @@ bool H5File::isHdf5(const char* name) //-------------------------------------------------------------------------- // Function: H5File::isHdf5 ///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. +/// It takes an \c H5std_string for \a name. (Static) ///\param name - IN: Name of the file - \c H5std_string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -269,8 +250,8 @@ void H5File::reOpen() throw FileIException("H5File::reOpen", close_error.getDetailMsg()); } - // call C routine to reopen the file - Note: not sure about this - // does id need to be closed later? which id to be the parameter? + // call C routine to reopen the file - Note: not sure about this, + // which id to be the parameter when closing? id = H5Freopen( id ); if( id < 0 ) // Raise exception when H5Freopen returns a neg value throw FileIException("H5File::reOpen", "H5Freopen failed"); @@ -278,12 +259,10 @@ void H5File::reOpen() //-------------------------------------------------------------------------- // Function: H5File::reopen -///\brief Reopens this file. -/// -///\exception H5::FileIException -///\par Description -/// This function will be replaced by the above function \c reOpen -/// in future releases. +// Purpose: Reopens this file. +// Exception H5::FileIException +// Description +// This function is replaced by the above function reOpen. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5File::reopen() @@ -490,70 +469,6 @@ void H5File::getVFDHandle(void **file_handle) const } //-------------------------------------------------------------------------- -// Function: H5File::getFileName -///\brief Gets the name of this file. -///\return File name -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - Jul, 2004 -//-------------------------------------------------------------------------- -H5std_string H5File::getFileName() const -{ - try { - return(p_get_file_name()); - } - catch (IdComponentException E) { - throw FileIException("H5File::getFileName", E.getDetailMsg()); - } -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5File::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference -///\return Object type, which can be one of the following: -/// \li \c H5G_LINK - Object is a symbolic link. -/// \li \c H5G_GROUP - Object is a group. -/// \li \c H5G_DATASET - Object is a dataset. -/// \li \c H5G_TYPE - Object is a named datatype -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t H5File::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw FileIException("H5File::getObjType", E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: H5File::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -///\return DataSpace instance -///\exception H5::FileIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace H5File::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw FileIException("H5File::getRegion", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- // Function: H5File::getFileSize ///\brief Returns the file size of the HDF5 file. ///\return File size @@ -575,134 +490,6 @@ hsize_t H5File::getFileSize() const } //-------------------------------------------------------------------------- -// Function: H5File::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. -// Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const -{ - herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); - if (ret_value < 0) - { - throw IdComponentException("", "H5Rcreate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference - this is the default -///\exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name, dataspace.getId(), ref_type); - } - catch (IdComponentException E) { - throw IdComponentException("H5File::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::IdComponentException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::reference(void* ref, const char* name) const -{ - try { - p_reference(ref, name, -1, H5R_OBJECT); - } - catch (IdComponentException E) { - throw IdComponentException("H5File::reference", E.getDetailMsg()); - } -} -//-------------------------------------------------------------------------- -// Function: H5File::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5File::reference(void* ref, const H5std_string& name) const -{ - reference(ref, name.c_str()); -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5File::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. -// Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_LINK Object is a symbolic link. -// H5G_GROUP Object is a group. -// H5G_DATASET Object is a dataset. -// H5G_TYPE Object is a named datatype -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t H5File::p_get_obj_type(void *ref, H5R_type_t ref_type) const -{ - H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); - - if (obj_type == H5G_UNKNOWN) - { - throw IdComponentException("", "H5Rget_obj_type failed"); - } - return(obj_type); -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - -//-------------------------------------------------------------------------- -// Function: H5File::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -hid_t H5File::p_get_region(void *ref, H5R_type_t ref_type) const -{ - hid_t space_id = H5Rget_region(getId(), ref_type, ref); - if (space_id < 0) - { - throw IdComponentException("", "H5Rget_region failed"); - } - return(space_id); -} - -//-------------------------------------------------------------------------- // Function: H5File::getLocId // Purpose: Get the id of this file // Description diff --git a/c++/src/H5File.h b/c++/src/H5File.h index b69c963..cfb6bdf 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -21,7 +21,7 @@ namespace H5 { #endif -class H5_DLLCPP H5File : public IdComponent, public CommonFG { +class H5_DLLCPP H5File : public H5Location, public CommonFG { public: // Creates or opens an HDF5 file. H5File( const char* name, unsigned int flags, @@ -40,18 +40,12 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // Close this file. virtual void close(); - // Flushes all buffers associated with this file to disk - void flush(H5F_scope_t scope) const; - // Gets the access property list of this file. FileAccPropList getAccessPlist() const; // Gets the creation property list of this file. FileCreatPropList getCreatePlist() const; - // Gets the name of this file. - H5std_string getFileName() const; - // Retrieves the file size of an opened file. hsize_t getFileSize() const; @@ -67,11 +61,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; @@ -87,14 +76,7 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { void reOpen(); // added for better name void reopen(); - // Creates a reference to a named HDF5 object or to a dataset region - // in this object. - void reference(void* ref, const char* name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; - - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("H5File"); } // Throw file exception. @@ -124,17 +106,6 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // constructors taking a string or a char* void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ); - // Creates a reference to an HDF5 object or a dataset region. - void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; - -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - protected: // Sets the HDF5 file id. virtual void p_setId(const hid_t new_id); diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index 7444bd5..cbb9541 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -53,7 +53,7 @@ class H5_DLLCPP FloatType : public AtomType { // Sets the mantissa normalization of a floating-point datatype. void setNorm( H5T_norm_t norm ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("FloatType"); } // Default constructor diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 6ec2dbb..e83b635 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -147,53 +147,6 @@ Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() } } -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: Group::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5G_LINK (0) - Object is a symbolic link. -/// \li \c H5G_GROUP (1) - Object is a group. -/// \li \c H5G_DATASET (2) - Object is a dataset. -/// \li \c H5G_TYPE (3) - Object is a named datatype -///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t Group::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return(p_get_obj_type(ref, ref_type)); - } - catch (IdComponentException E) { - throw GroupIException("Group::getObjType", E.getDetailMsg()); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: Group::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -///\return DataSpace instance -///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -DataSpace Group::getRegion(void *ref, H5R_type_t ref_type) const -{ - try { - DataSpace dataspace(p_get_region(ref, ref_type)); - return(dataspace); - } - catch (IdComponentException E) { - throw GroupIException("Group::getRegion", E.getDetailMsg()); - } -} - //-------------------------------------------------------------------------- // Function: Group::getId // Purpose: Get the id of this attribute diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 9978cf0..e4c2415 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -26,15 +26,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } // Throw group exception. diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index b217c10..7dc1da3 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -65,7 +65,7 @@ class H5_DLLCPP IdComponent { // is returned by fromClass(). H5std_string inMemFunc(const char* func_name) const; - // Returns this class name. + ///\brief Returns this class name. virtual H5std_string fromClass() const { return("IdComponent");} #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index b712103..53864ee 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -35,7 +35,7 @@ class H5_DLLCPP IntType : public AtomType { // Sets the sign proprety for an integer type. void setSign( H5T_sign_t sign ) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("IntType"); } // Default constructor diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp new file mode 100644 index 0000000..b93cd86 --- /dev/null +++ b/c++/src/H5Location.cpp @@ -0,0 +1,669 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +#include "H5Include.h" +#include "H5Exception.h" +#include "H5IdComponent.h" +#include "H5PropList.h" +#include "H5Location.h" +#include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5DxferProp.h" +#include "H5FaccProp.h" +#include "H5FcreatProp.h" +#include "H5CommonFG.h" +#include "H5DataType.h" +#include "H5DataSpace.h" +#include "H5AbstractDs.h" +#include "H5File.h" +#include "H5DataSet.h" +#include "H5Attribute.h" + +#ifndef H5_NO_NAMESPACE +namespace H5 { +#endif + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// userAttrOpWrpr simply interfaces between the user's function and the +// C library function H5Aiterate2; used to resolve the different prototype +// problem. May be moved to Iterator later. +extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, + const H5A_info_t *ainfo, void *op_data) +{ + H5std_string s_attr_name = H5std_string( attr_name ); +#ifdef NO_STATIC_CAST + UserData4Aiterate* myData = (UserData4Aiterate *) op_data; +#else + UserData4Aiterate* myData = static_cast (op_data); +#endif + myData->op( *myData->location, s_attr_name, myData->opData ); + return 0; +} + +//-------------------------------------------------------------------------- +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::H5Location() : IdComponent(0) {} + +//-------------------------------------------------------------------------- +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +//-------------------------------------------------------------------------- +// Function: H5Location copy constructor +///\brief Copy constructor: makes a copy of the original H5Location +/// instance. +///\param original - IN: H5Location instance to copy +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} + +//-------------------------------------------------------------------------- +// Function: H5Location::createAttribute +///\brief Creates an attribute for a group, dataset, or named datatype. +///\param name - IN: Name of the attribute +///\param data_type - IN: Datatype for the attribute +///\param data_space - IN: Dataspace for the attribute - only simple +/// dataspaces are allowed at this time +///\param create_plist - IN: Creation property list - default to +/// PropList::DEFAULT +///\return Attribute instance +///\exception H5::AttributeIException +///\par Description +/// The attribute name specified in \a name must be unique. +/// Attempting to create an attribute with the same name as an +/// existing attribute will raise an exception, leaving the +/// pre-existing attribute intact. To overwrite an existing +/// attribute with a new attribute of the same name, first +/// delete the existing one with \c H5Location::removeAttr, then +/// recreate it with this function. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const +{ + hid_t type_id = data_type.getId(); + hid_t space_id = data_space.getId(); + hid_t plist_id = create_plist.getId(); + hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT ); + + // If the attribute id is valid, create and return the Attribute object + if( attr_id > 0 ) + { + Attribute attr( attr_id ); + return( attr ); + } + else + throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::createAttribute +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const +{ + return( createAttribute( name.c_str(), data_type, data_space, create_plist )); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::openAttribute +///\brief Opens an attribute given its name. +///\param name - IN: Name of the attribute +///\return Attribute instance +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::openAttribute( const char* name ) const +{ + hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT); + if( attr_id > 0 ) + { + Attribute attr( attr_id ); + return( attr ); + } + else + { + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::openAttribute +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::openAttribute( const H5std_string& name ) const +{ + return( openAttribute( name.c_str()) ); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::openAttribute +///\brief Opens an attribute given its index. +///\param idx - IN: Index of the attribute, a 0-based, non-negative integer +///\return Attribute instance +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +Attribute H5Location::openAttribute( const unsigned int idx ) const +{ + hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, + H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT); + if( attr_id > 0 ) + { + Attribute attr( attr_id ); + return( attr ); + } + else + { + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::iterateAttrs +///\brief Iterates a user's function over all the attributes of an H5 +/// object, which may be a group, dataset or named datatype. +///\param user_op - IN: User's function to operate on each attribute +///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices +///\param op_data - IN: User's data to pass to user's operator function +///\return Returned value of the last operator if it was non-zero, or +/// zero if all attributes were processed +///\exception H5::AttributeIException +///\par Description +/// The signature of user_op is +/// void (*)(H5::H5Location&, H5std_string, void*). +/// For information, please refer to the C layer Reference Manual +/// at: +/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data ) +{ + // store the user's function and data + UserData4Aiterate* userData = new UserData4Aiterate; + userData->opData = op_data; + userData->op = user_op; + userData->location = this; + + // call the C library routine H5Aiterate2 to iterate the attributes + hsize_t idx = _idx ? (hsize_t)*_idx : 0; + int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, + userAttrOpWrpr, (void *) userData); + + // release memory + delete userData; + + if( ret_value >= 0 ) { + /* Pass back update index value to calling code */ + if (_idx) + *_idx = (unsigned)idx; + + return( ret_value ); + } + else // raise exception when H5Aiterate returns a negative value + throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNumAttrs +///\brief Returns the number of attributes attached to this HDF5 object. +///\return Number of attributes +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +int H5Location::getNumAttrs() const +{ + H5O_info_t oinfo; /* Object info */ + + if(H5Oget_info(getId(), &oinfo) < 0) + throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); + else + return( (int)oinfo.num_attrs ); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeAttr +///\brief Removes the named attribute from this object. +///\param name - IN: Name of the attribute to be removed +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void H5Location::removeAttr( const char* name ) const +{ + herr_t ret_value = H5Adelete(getId(), name); + if( ret_value < 0 ) + throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeAttr +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void H5Location::removeAttr( const H5std_string& name ) const +{ + removeAttr( name.c_str() ); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::renameAttr +///\brief Renames the named attribute from this object. +///\param oldname - IN: Name of the attribute to be renamed +///\param newname - IN: New name ame of the attribute +///\exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Mar, 2005 +//-------------------------------------------------------------------------- +void H5Location::renameAttr(const char* oldname, const char* newname) const +{ + herr_t ret_value = H5Arename(getId(), oldname, newname); + if (ret_value < 0) + throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::renameAttr +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for the names. +// Programmer Binh-Minh Ribler - Mar, 2005 +//-------------------------------------------------------------------------- +void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const +{ + renameAttr (oldname.c_str(), newname.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::flush +///\brief Flushes all buffers associated with a location to disk. +///\param scope - IN: Specifies the scope of the flushing action, +/// which can be either of these values: +/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file +/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file +///\exception H5::FileIException +///\par Description +/// This location is used to identify the file to be flushed. +// Programmer Binh-Minh Ribler - 2012 +// Modification +// Sep 2012 - BMR +// Moved from H5File/H5Object +//-------------------------------------------------------------------------- +void H5Location::flush(H5F_scope_t scope) const +{ + herr_t ret_value = H5Fflush(getId(), scope); + if( ret_value < 0 ) + { + throw FileIException(inMemFunc("flush"), "H5Fflush failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getFileName +///\brief Gets the name of the file, in which this HDF5 object belongs. +///\return File name +///\exception H5::IdComponentException +// Programmer Binh-Minh Ribler - Jul, 2004 +//-------------------------------------------------------------------------- +H5std_string H5Location::getFileName() const +{ + try { + return(p_get_file_name()); + } + catch (IdComponentException E) { + throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. +// Parameters +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const +{ + herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); + if (ret_value < 0) + { + throw ReferenceException("", "H5Rcreate failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. - this is the default +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const +{ + try { + p_reference(ref, name, dataspace.getId(), ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it only creates +/// a reference to an HDF5 object, not to a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c char pointer +///\exception H5::ReferenceException +///\par Description +// This function passes H5R_OBJECT and -1 to the protected +// function for it to pass to the C API H5Rcreate +// to create a reference to the named object. +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const char* name) const +{ + try { + p_reference(ref, name, -1, H5R_OBJECT); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const H5std_string& name) const +{ + reference(ref, name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_dereference (protected) +// Purpose Dereference a ref into an hdf5 object. +// Parameters +// loc_id - IN: An hdf5 identifier specifying the location of the +// referenced object +// ref - IN: Reference pointer +// ref_type - IN: Reference type +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May 2008 - BMR +// Moved from IdComponent. +//-------------------------------------------------------------------------- +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); + if (temp_id < 0) + { + throw ReferenceException("", "H5Rdereference failed"); + } + + // No failure, set id to the object + return(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. +///\param obj - IN: Object specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(obj.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); + } + p_setId(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. +///\param h5file - IN: HDF5 file specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(h5file.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); + } + p_setId(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an attribute. +///\param attr - IN: Attribute specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(attr.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); + } + p_setId(temp_id); +} + +#ifndef H5_NO_DEPRECATED_SYMBOLS +//-------------------------------------------------------------------------- +// Function: H5Location::getObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT \tReference is an object reference. +/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference. +///\param ref - IN: Reference to query +///\return An object type, which can be one of the following: +/// \li \c H5G_UNKNOWN \tA failure occurs. (-1) +/// \li \c H5G_GROUP \tObject is a group. +/// \li \c H5G_DATASET \tObject is a dataset. +/// \li \c H5G_TYPE Object \tis a named datatype +/// \li \c H5G_LINK \tObject is a symbolic link. +/// \li \c H5G_UDLINK \tObject is a user-defined link. +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +// Modification +// Sep 2012: Moved up from H5File, Group, DataSet, and DataType +//-------------------------------------------------------------------------- +H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const +{ + try { + return(p_get_obj_type(ref, ref_type)); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::getObjType", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. +// Parameters +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const +{ + H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); + + if (obj_type == H5G_UNKNOWN) + { + throw ReferenceException("", "H5Rget_obj_type1 failed"); + } + return(obj_type); +} +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + +//-------------------------------------------------------------------------- +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const +{ + try { + return(p_get_ref_obj_type(ref, ref_type)); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::getRefObjType", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. +// Parameters +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5O_TYPE_UNKNOWN - Unknown object type (-1) +// H5O_TYPE_GROUP - Object is a group +// H5O_TYPE_DATASET - Object is a dataset +// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +// H5O_TYPE_NTYPES - Number of object types +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const +{ + H5O_type_t obj_type = H5O_TYPE_UNKNOWN; + herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type); + + if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) + { + throw ReferenceException("", "H5Rget_obj_type2 failed"); + } + return(obj_type); +} + + +//-------------------------------------------------------------------------- +// Function: H5Location::p_get_region (protected) +// Purpose Retrieves a dataspace with the region pointed to selected. +// Parameters +// ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +// ref - IN: Reference to get region of +// Return Dataspace id +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const +{ + hid_t space_id = H5Rget_region(getId(), ref_type, ref); + if (space_id < 0) + { + throw ReferenceException("", "H5Rget_region failed"); + } + return(space_id); +} + + +//-------------------------------------------------------------------------- +// Function: H5Location destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5Location::~H5Location() {} + +#ifndef H5_NO_NAMESPACE +} // end namespace +#endif diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h new file mode 100644 index 0000000..d1dd892 --- /dev/null +++ b/c++/src/H5Location.h @@ -0,0 +1,146 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5Location_H +#define _H5Location_H + +#include "H5Classes.h" // constains forward class declarations + +// H5Location is an abstract class. It provides a collection of wrappers +// of C functions which take location IDs. Most of these were in H5Object +// but are now moved here for H5File's access. + +#ifndef H5_NO_NAMESPACE +namespace H5 { +#endif + +class H5_DLLCPP H5Location; // forward declaration for UserData4Aiterate + +// Define the operator function pointer for H5Aiterate(). +typedef void (*attr_operator_t)( H5Location& loc/*in*/, + const H5std_string attr_name/*in*/, + void *operator_data/*in,out*/); + +class UserData4Aiterate { // user data for attribute iteration + public: + attr_operator_t op; + void* opData; + H5Location* location; +}; + +// An H5Location can be a file, group, dataset, named datatype, or attribute. + +class H5_DLLCPP H5Location : public IdComponent { + public: + // Creates an attribute for the specified object at this location + // PropList is currently not used, so always be default. + Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; + Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; + + // Given its name, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute( const char* name ) const; + Attribute openAttribute( const H5std_string& name ) const; + + // Given its index, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute( const unsigned int idx ) const; + + // Flushes all buffers associated with this location to disk. + void flush( H5F_scope_t scope ) const; + + // Gets the name of the file, specified by this location. + H5std_string getFileName() const; + + // Determines the number of attributes at this location. + int getNumAttrs() const; + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Retrieves the type of object that an object reference points to. + H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Retrieves the type of object that an object reference points to. + H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; + // Note: getRefObjType deprecates getObjType, but getObjType's name is + // misleading, so getRefObjType is used in the new function instead. + + // Iterate user's function over the attributes at this location. + int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL ); + + // Removes the named attribute from this location. + void removeAttr( const char* name ) const; + void removeAttr( const H5std_string& name ) const; + + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + + // Creates a reference to a named object or to a dataset region + // in this object. + void reference(void* ref, const char* name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; + void reference(void* ref, const char* name) const; + void reference(void* ref, const H5std_string& name) const; + + // Open a referenced object whose location is specified by either + // a file, an HDF5 object, or an attribute. + void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + + // For subclasses. + virtual hid_t getId() const = 0; + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Default constructor, + H5Location(); + + // Creates a copy of an existing object giving the location id. + H5Location(const hid_t loc_id); + + // Copy constructor. + H5Location(const H5Location& original); + + // Creates a reference to an HDF5 object or a dataset region. + void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; + + // Dereferences a ref into an HDF5 id. + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Retrieves the type of object that an object reference points to. + H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Retrieves the type of object that an object reference points to. + H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; + + // Retrieves a dataspace with the region pointed to selected. + hid_t p_get_region(void *ref, H5R_type_t ref_type) const; + + // Noop destructor. + virtual ~H5Location(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; /* end class H5Location */ + +#ifndef H5_NO_NAMESPACE +} +#endif +#endif diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 3c85502..e29e80e 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -37,30 +37,11 @@ namespace H5 { #endif #ifndef DOXYGEN_SHOULD_SKIP_THIS -// userAttrOpWrpr simply interfaces between the user's function and the -// C library function H5Aiterate2; used to resolve the different prototype -// problem. May be moved to Iterator later. -extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, - const H5A_info_t *ainfo, void *op_data) -{ - H5std_string s_attr_name = H5std_string( attr_name ); -#ifdef NO_STATIC_CAST - UserData4Aiterate* myData = (UserData4Aiterate *) op_data; -#else - UserData4Aiterate* myData = static_cast (op_data); -#endif - myData->op( *myData->object, s_attr_name, myData->opData ); - return 0; -} - //-------------------------------------------------------------------------- // Function: H5Object default constructor (protected) -// Description -// The id is set by IdComponent() but subclass constructor will -// set it to a valid HDF5 id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::H5Object() : IdComponent(0) {} +H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- // Function: H5Object overloaded constructor (protected) @@ -69,7 +50,7 @@ H5Object::H5Object() : IdComponent(0) {} // Parameters object_id - IN: Id of an existing HDF5 object // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {} +H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} #endif // DOXYGEN_SHOULD_SKIP_THIS @@ -80,496 +61,7 @@ H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {} ///\param original - IN: H5Object instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Object::H5Object( const H5Object& original ) : IdComponent( original ) {} - -//-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief Creates an attribute for a group, dataset, or named datatype. -///\param name - IN: Name of the attribute -///\param data_type - IN: Datatype for the attribute -///\param data_space - IN: Dataspace for the attribute - only simple -/// dataspaces are allowed at this time -///\param create_plist - IN: Creation property list - default to -/// PropList::DEFAULT -///\return Attribute instance -///\exception H5::AttributeIException -///\par Description -/// The attribute name specified in \a name must be unique. -/// Attempting to create an attribute with the same name as an -/// existing attribute will raise an exception, leaving the -/// pre-existing attribute intact. To overwrite an existing -/// attribute with a new attribute of the same name, first -/// delete the existing one with \c H5Object::removeAttr, then -/// recreate it with this function. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const -{ - hid_t type_id = data_type.getId(); - hid_t space_id = data_space.getId(); - hid_t plist_id = create_plist.getId(); - hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT ); - - // If the attribute id is valid, create and return the Attribute object - if( attr_id > 0 ) - { - Attribute attr( attr_id ); - return( attr ); - } - else - throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const -{ - return( createAttribute( name.c_str(), data_type, data_space, create_plist )); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its name. -///\param name - IN: Name of the attribute -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const char* name ) const -{ - hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT); - if( attr_id > 0 ) - { - Attribute attr( attr_id ); - return( attr ); - } - else - { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const H5std_string& name ) const -{ - return( openAttribute( name.c_str()) ); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its index. -///\param idx - IN: Index of the attribute, a 0-based, non-negative integer -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute H5Object::openAttribute( const unsigned int idx ) const -{ - hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, - H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT); - if( attr_id > 0 ) - { - Attribute attr( attr_id ); - return( attr ); - } - else - { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::iterateAttrs -///\brief Iterates a user's function over all the attributes of an H5 -/// object, which may be a group, dataset or named datatype. -///\param user_op - IN: User's function to operate on each attribute -///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices -///\param op_data - IN: User's data to pass to user's operator function -///\return Returned value of the last operator if it was non-zero, or -/// zero if all attributes were processed -///\exception H5::AttributeIException -///\par Description -/// The signature of user_op is -/// void (*)(H5::H5Object&, H5std_string, void*). -/// For information, please refer to the C layer Reference Manual -/// at: -/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data ) -{ - // store the user's function and data - UserData4Aiterate* userData = new UserData4Aiterate; - userData->opData = op_data; - userData->op = user_op; - userData->object = this; - - // call the C library routine H5Aiterate2 to iterate the attributes - hsize_t idx = _idx ? (hsize_t)*_idx : 0; - int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, (void *) userData); - - // release memory - delete userData; - - if( ret_value >= 0 ) { - /* Pass back update index value to calling code */ - if (_idx) - *_idx = (unsigned)idx; - - return( ret_value ); - } - else // raise exception when H5Aiterate returns a negative value - throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getNumAttrs -///\brief Returns the number of attributes attached to this HDF5 object. -///\return Number of attributes -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int H5Object::getNumAttrs() const -{ - H5O_info_t oinfo; /* Object info */ - - if(H5Oget_info(getId(), &oinfo) < 0) - throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); - else - return( (int)oinfo.num_attrs ); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief Removes the named attribute from this object. -///\param name - IN: Name of the attribute to be removed -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void H5Object::removeAttr( const char* name ) const -{ - herr_t ret_value = H5Adelete(getId(), name); - if( ret_value < 0 ) - throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void H5Object::removeAttr( const H5std_string& name ) const -{ - removeAttr( name.c_str() ); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief Renames the named attribute from this object. -///\param oldname - IN: Name of the attribute to be renamed -///\param newname - IN: New name ame of the attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -void H5Object::renameAttr(const char* oldname, const char* newname) const -{ - herr_t ret_value = H5Arename(getId(), oldname, newname); - if (ret_value < 0) - throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for the names. -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const -{ - renameAttr (oldname.c_str(), newname.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::flush -///\brief Flushes all buffers associated with a file to disk. -///\param scope - IN: Specifies the scope of the flushing action, -/// which can be either of these values: -/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file -/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::AttributeIException -///\par Description -/// This object is used to identify the file to be flushed. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void H5Object::flush(H5F_scope_t scope) const -{ - herr_t ret_value = H5Fflush(getId(), scope); - if( ret_value < 0 ) - { - throw FileIException(inMemFunc("flush"), "H5Fflush failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getFileName -///\brief Gets the name of the file, in which this HDF5 object belongs. -///\return File name -///\exception H5::IdComponentException -// Programmer Binh-Minh Ribler - Jul, 2004 -//-------------------------------------------------------------------------- -H5std_string H5Object::getFileName() const -{ - try { - return(p_get_file_name()); - } - catch (IdComponentException E) { - throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. -// Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const -{ - herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); - if (ret_value < 0) - { - throw IdComponentException("", "H5Rcreate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. - this is the default -///\exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name, dataspace.getId(), ref_type); - } - catch (IdComponentException E) { - throw IdComponentException("H5Object::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::IdComponentException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::reference(void* ref, const char* name) const -{ - try { - p_reference(ref, name, -1, H5R_OBJECT); - } - catch (IdComponentException E) { - throw IdComponentException("H5Object::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Object::reference(void* ref, const H5std_string& name) const -{ - reference(ref, name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::p_dereference (protected) -// Purpose Dereference a ref into an hdf5 object. -// Parameters -// loc_id - IN: An hdf5 identifier specifying the location of the -// referenced object -// ref - IN: Reference pointer -// ref_type - IN: Reference type -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May 2008 - BMR -// Moved from IdComponent. -//-------------------------------------------------------------------------- -hid_t H5Object::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); - if (temp_id < 0) - { - throw ReferenceException("", "H5Rdereference failed"); - } - - // No failure, set id to the object - return(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. -///\param obj - IN: Object specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Object::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(obj.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Object::dereference - located by object", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. -///\param h5file - IN: HDF5 file specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Object::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(h5file.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Object::dereference - located by file", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::dereference -///\brief Dereferences a reference into an HDF5 object, given an attribute. -///\param attr - IN: Attribute specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Object::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(attr.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Object::dereference - located by attribute", E.getDetailMsg()); - } - p_setId(temp_id); -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5Object::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. -// Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_LINK Object is a symbolic link. -// H5G_GROUP Object is a group. -// H5G_DATASET Object is a dataset. -// H5G_TYPE Object is a named datatype -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t H5Object::p_get_obj_type(void *ref, H5R_type_t ref_type) const -{ - H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); - - if (obj_type == H5G_UNKNOWN) - { - throw IdComponentException("", "H5Rget_obj_type failed"); - } - return(obj_type); -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - -//-------------------------------------------------------------------------- -// Function: H5Object::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -hid_t H5Object::p_get_region(void *ref, H5R_type_t ref_type) const -{ - hid_t space_id = H5Rget_region(getId(), ref_type, ref); - if (space_id < 0) - { - throw IdComponentException("", "H5Rget_region failed"); - } - return(space_id); -} - +H5Object::H5Object( const H5Object& original ) : H5Location( original ) {} //-------------------------------------------------------------------------- // Function: H5Object destructor diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 4ac417b..bfd5e6f 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -17,81 +17,29 @@ #ifndef _H5Object_H #define _H5Object_H +#include "H5Location.h" #include "H5Classes.h" // constains forward class declarations // H5Object is a baseclass. It has these subclasses: // Group, DataSet, and DataType. // DataType, in turn, has several specific datatypes as subclasses. +// Modification: +// Sept 18, 2012: Added class H5Location in between IdComponent and +// H5Object. An H5File now inherits from H5Location. All HDF5 +// wrappers in H5Object are moved up to H5Location. H5Object +// is left mostly empty for future wrappers that are only for +// group, dataset, and named datatype. Note that the reason for +// adding H5Location instead of simply moving H5File to be under +// H5Object is H5File is not an HDF5 object, and renaming H5Object +// to H5Location will risk breaking user applications. +// -BMR #ifndef H5_NO_NAMESPACE namespace H5 { #endif -#ifndef DOXYGEN_SHOULD_SKIP_THIS -class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate - -// Define the operator function pointer for H5Aiterate(). -typedef void (*attr_operator_t)( H5Object& loc/*in*/, - const H5std_string attr_name/*in*/, - void *operator_data/*in,out*/); - -class UserData4Aiterate { // user data for attribute iteration - public: - attr_operator_t op; - void* opData; - H5Object* object; -}; -#endif // DOXYGEN_SHOULD_SKIP_THIS - -// The above part is being moved into Iterator, but not completed - -class H5_DLLCPP H5Object : public IdComponent { +class H5_DLLCPP H5Object : public H5Location { public: - // Creates an attribute for a group, dataset, or named datatype. - // PropList is currently not used, so always be default. - Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; - Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; - - // Opens an attribute given its name. - Attribute openAttribute( const char* name ) const; - Attribute openAttribute( const H5std_string& name ) const; - - // Opens an attribute given its index. - Attribute openAttribute( const unsigned int idx ) const; - - // Flushes all buffers associated with this object to disk - void flush( H5F_scope_t scope ) const; - - // Gets the name of the file, in which this HDF5 object belongs. - H5std_string getFileName() const; - - // Determines the number of attributes attached to this object. - int getNumAttrs() const; - - // Iterate user's function over the attributes of this object - int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL ); - - // Removes the named attribute from this object. - void removeAttr( const char* name ) const; - void removeAttr( const H5std_string& name ) const; - - // Renames the attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; - - // Creates a reference to a named Hdf5 object or to a dataset region - // in this object. - void reference(void* ref, const char* name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; - - // Open a referenced HDF5 object whose location is specified by either - // a file, an HDF5 object, or an attribute. - void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - // Copy constructor: makes copy of an H5Object object. H5Object(const H5Object& original); @@ -106,23 +54,6 @@ class H5_DLLCPP H5Object : public IdComponent { // Creates a copy of an existing object giving the object id H5Object( const hid_t object_id ); - // Gets the id of the H5 file in which the given object is located. - hid_t p_get_file_id(); - - // Creates a reference to an HDF5 object or a dataset region. - void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; - - // Dereferences a ref into an hdf5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); - -#ifndef H5_NO_DEPRECATED_SYMBOLS - // Retrieves the type of object that an object reference points to. - H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - #endif // DOXYGEN_SHOULD_SKIP_THIS }; /* end class H5Object */ diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 9cb1c65..8a04f0c 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -36,7 +36,7 @@ namespace H5 { class H5_DLLCPP PredType : public AtomType { public: - ///\brief Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("PredType"); } // Makes a copy of the predefined type and stores the new diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 5dfa538..7e47b32 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -94,7 +94,7 @@ class H5_DLLCPP PropList : public IdComponent { void removeProp(const char *name) const; void removeProp(const H5std_string& name) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("PropList"); } // Default constructor: creates a stub PropList object. diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index d4a0016..be9fed8 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -47,7 +47,7 @@ class H5_DLLCPP StrType : public AtomType { // Defines the storage mechanism for character strings. void setStrpad(H5T_str_t strpad) const; - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("StrType"); } // default constructor diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 91f653e..0cee219 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -30,7 +30,7 @@ class H5_DLLCPP VarLenType : public DataType { // on the specified base type. VarLenType(const DataType* base_type); - // Returns this class name + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("VarLenType"); } // Copy constructor: makes copy of the original object. diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 6278fa0..ec942fd 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -40,12 +40,12 @@ bin_SCRIPTS=h5c++ # Source files for the library libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ - H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \ - H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \ - H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \ - H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \ - H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \ - H5CommonFG.cpp H5Group.cpp H5File.cpp + H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \ + H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \ + H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ + H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \ + H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp # HDF5 C++ library depends on HDF5 Library. libhdf5_cpp_la_LIBADD=$(LIBHDF5) @@ -55,8 +55,9 @@ include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \ H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \ - H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \ - H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h + H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \ + H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \ + H5VarLenType.h # h5c++ and libhdf5.settings are generated during configure. Remove only when # distclean. diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 4265900..d8b2367 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -120,12 +120,12 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5) am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \ - H5Library.lo H5Attribute.lo H5Object.lo H5PropList.lo \ - H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo H5DxferProp.lo \ - H5DataType.lo H5DataSpace.lo H5AbstractDs.lo H5AtomType.lo \ - H5PredType.lo H5EnumType.lo H5IntType.lo H5FloatType.lo \ - H5StrType.lo H5ArrayType.lo H5VarLenType.lo H5CompType.lo \ - H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo + H5Library.lo H5Attribute.lo H5Location.lo H5Object.lo \ + H5PropList.lo H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo \ + H5DxferProp.lo H5DataType.lo H5DataSpace.lo H5AbstractDs.lo \ + H5AtomType.lo H5PredType.lo H5EnumType.lo H5IntType.lo \ + H5FloatType.lo H5StrType.lo H5ArrayType.lo H5VarLenType.lo \ + H5CompType.lo H5DataSet.lo H5CommonFG.lo H5Group.lo H5File.lo libhdf5_cpp_la_OBJECTS = $(am_libhdf5_cpp_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -467,7 +467,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 = 121 +LT_VERS_REVISION = 127 LT_VERS_AGE = 0 # Include src directory @@ -482,12 +482,12 @@ bin_SCRIPTS = h5c++ # Source files for the library libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ - H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp \ - H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp \ - H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp \ - H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp \ - H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \ - H5CommonFG.cpp H5Group.cpp H5File.cpp + H5Attribute.cpp H5Location.cpp H5Object.cpp H5PropList.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp \ + H5DataType.cpp H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp \ + H5PredType.cpp H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ + H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \ + H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp # HDF5 C++ library depends on HDF5 Library. @@ -498,8 +498,9 @@ include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \ H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \ H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h \ - H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h \ - H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h + H5Include.h H5IntType.h H5Library.h H5Location.h H5Object.h \ + H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h H5ArrayType.h \ + H5VarLenType.h # h5c++ and libhdf5.settings are generated during configure. Remove only when @@ -664,6 +665,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IdComponent.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IntType.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Library.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Location.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Object.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PredType.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PropList.Plo@am__quote@ diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 26abace..e822b36 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -61,7 +61,6 @@ const int H5Z_FILTER_BOGUS = 305; static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - /*------------------------------------------------------------------------- * Function: test_create * @@ -179,7 +178,7 @@ test_create( H5File& file) return -1; } } // test_create - + /*------------------------------------------------------------------------- * Function: test_simple_io * @@ -266,7 +265,7 @@ test_simple_io( H5File& file) return -1; } } // test_simple_io - + /*------------------------------------------------------------------------- * Function: test_datasize * @@ -337,7 +336,7 @@ test_datasize() return -1; } } // test_datasize - + /*------------------------------------------------------------------------- * Function: test_tconv * @@ -460,7 +459,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, return nbytes; } - /*------------------------------------------------------------------------- * Function: test_compression * @@ -830,7 +828,6 @@ test_multiopen (H5File& file) } } // test_multiopen - /*------------------------------------------------------------------------- * Function: test_types * @@ -1019,7 +1016,7 @@ test_types(H5File& file) return -1; } } // test_types - + /*------------------------------------------------------------------------- * Function: test_dset * diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 4485808..c6a7a2a 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -100,6 +100,7 @@ void issue_fail_msg(const char* where, int line, const char* file_name, { //if (GetTestVerbosity()>=VERBO_HI) { + cerr << endl; cerr << ">>> FAILED in " << where << " at line " << line << " in " << file_name << " - " << message << endl << endl; } diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 6bb9ca0..100e725 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -42,8 +42,13 @@ #include "h5cpputil.h" // C++ utilility header file -const H5std_string FILENAME("tattr.h5"); -const H5std_string ATTR_TMP_NAME("temp_name"); +const H5std_string FILE_BASIC("tattr_basic.h5"); +const H5std_string FILE_COMPOUND("tattr_compound.h5"); +const H5std_string FILE_SCALAR("tattr_scalar.h5"); +const H5std_string FILE_MULTI("tattr_multi.h5"); +const H5std_string FILE_DTYPE("tattr_dtype.h5"); +const H5std_string ATTR_TMP_NAME("temp_attr_name"); +const H5std_string FATTR_TMP_NAME("temp_fattr_name"); const size_t ATTR_MAX_DIMS = 7; /* 3-D dataset with fixed dimensions */ @@ -63,6 +68,10 @@ const int ATTR1_RANK = 1; const int ATTR1_DIM1 = 3; int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */ +// File attribute, using the same rank and dimensions as ATTR1_NAME's +const H5std_string FATTR1_NAME("File Attr1"); +const H5std_string FATTR2_NAME("File Attr2"); + const H5std_string ATTR2_NAME("Attr2"); const int ATTR2_RANK = 2; const int ATTR2_DIM1 = 2; @@ -121,7 +130,7 @@ static void test_attr_basic_write() try { // Create file - H5File fid1 (FILENAME, H5F_ACC_TRUNC); + H5File fid1 (FILE_BASIC, H5F_ACC_TRUNC); // Create dataspace for dataset DataSpace ds_space (SPACE1_RANK, dims1); @@ -136,6 +145,12 @@ static void test_attr_basic_write() // Create dataspace for attribute DataSpace att_space (ATTR1_RANK, dims2); + // Create a file attribute + Attribute file_attr2 = fid1.createAttribute (FATTR1_NAME, PredType::NATIVE_INT, att_space); + + // Create a file attribute + Attribute file_attr1 = fid1.createAttribute (FATTR2_NAME, PredType::NATIVE_INT, att_space); + // Create an attribute for the dataset Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); @@ -163,8 +178,9 @@ static void test_attr_basic_write() if(attr_data1[i]!=read_data1[i]) TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); - // Create another attribute for this dataset - Attribute ds_attr2 = dataset.createAttribute (ATTR1A_NAME, PredType::NATIVE_INT, att_space); + // Create two more attributes for this dataset, but only write to one. + Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att_space); + Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_INT, att_space); // Write attribute information ds_attr2.write (PredType::NATIVE_INT, attr_data1a); @@ -180,6 +196,7 @@ static void test_attr_basic_write() // Close both attributes ds_attr1.close(); ds_attr2.close(); + ds_attr3.close(); /* * Test attribute with group @@ -240,14 +257,32 @@ static void test_attr_rename() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + + // Check rename of attribute belonging to a file + + // Change attribute name + fid1.renameAttr(FATTR1_NAME, FATTR_TMP_NAME); + + // Open attribute again + Attribute fattr1(fid1.openAttribute(FATTR_TMP_NAME)); + + // Verify new attribute name + H5std_string fattr_name = fattr1.getName(); + verify_val(fattr_name, FATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__); + + int num_attrs = fid1.getNumAttrs(); + verify_val(num_attrs, 2, "Attribute::getNumAttrs", __LINE__, __FILE__); + + // Change first file attribute back to the original name + fid1.renameAttr(FATTR_TMP_NAME, FATTR1_NAME); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); - // Check rename + // Check rename of attribute belonging to a dataset - // change attribute name + // Change attribute name dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME); // Open attribute again @@ -269,11 +304,11 @@ static void test_attr_rename() attr1.close(); // Open the second attribute - Attribute attr2(dataset.openAttribute(ATTR1A_NAME)); + Attribute attr2(dataset.openAttribute(ATTR2_NAME)); // Verify second attribute name H5std_string attr2_name = attr2.getName(); - verify_val(attr2_name, ATTR1A_NAME, "Attribute::getName", __LINE__, __FILE__); + verify_val(attr2_name, ATTR2_NAME, "Attribute::getName", __LINE__, __FILE__); // Read attribute information immediately, without closing attribute attr2.read (PredType::NATIVE_INT, read_data1); @@ -311,14 +346,14 @@ static void test_attr_basic_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open an attribute for the dataset Attribute ds_attr=dataset.openAttribute(ATTR1_NAME); @@ -378,7 +413,7 @@ static void test_attr_compound_write() try { // Create file - H5File fid1(FILENAME.c_str(), H5F_ACC_TRUNC); + H5File fid1(FILE_COMPOUND.c_str(), H5F_ACC_TRUNC); // Create dataspace for dataset hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -442,14 +477,14 @@ static void test_attr_compound_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_COMPOUND, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); @@ -571,7 +606,7 @@ static void test_attr_scalar_write() try { // Create file - H5File fid1(FILENAME, H5F_ACC_TRUNC); + H5File fid1(FILE_SCALAR, H5F_ACC_TRUNC); // Create dataspace for dataset hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -625,14 +660,14 @@ static void test_attr_scalar_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_SCALAR, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open an attribute for the dataset Attribute ds_attr=dataset.openAttribute(ATTR5_NAME); @@ -669,7 +704,7 @@ static void test_attr_mult_write() try { // Create file - H5File fid1 (FILENAME, H5F_ACC_TRUNC); + H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC); // Create dataspace for dataset hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -746,14 +781,14 @@ static void test_attr_mult_read() try { // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_MULTI, H5F_ACC_RDWR); // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); @@ -929,22 +964,42 @@ static void test_attr_mult_read() static void test_attr_delete() { H5std_string attr_name; // Buffer for attribute names + int ii; - // Output message about test being performed + // Output message about test being performed SUBTEST("Removing Attribute Function"); try { - // Open file - H5File fid1(FILENAME, H5F_ACC_RDWR); + // Open file. + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + + // Get the number of file attributes + int num_attrs = fid1.getNumAttrs(); + verify_val(num_attrs, 2, "H5File::getNumAttrs", __LINE__, __FILE__); + + // Delete the second file attribute + fid1.removeAttr(FATTR2_NAME); + + // Get the number of file attributes + num_attrs = fid1.getNumAttrs(); + verify_val(num_attrs, 1, "H5File::getNumAttrs", __LINE__, __FILE__); + + // Verify the name of the only file attribute left + Attribute fattr = fid1.openAttribute((unsigned)0); + H5std_string attr_name = fattr.getName(); + verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__); + fattr.close(); + + // Test deleting non-existing attribute // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); // Verify the correct number of attributes - int num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); - // Try to delete bogus attribute, should fail. + // Try to delete bogus attribute, should fail try { dataset.removeAttr("Bogus"); @@ -954,16 +1009,18 @@ static void test_attr_delete() catch (AttributeIException E) // catching invalid removing attribute {} // do nothing, exception expected + // Test deleting dataset's attributes + // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Delete middle (2nd) attribute dataset.removeAttr(ATTR2_NAME); // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 2, "DataSet::getNumAttrs", __LINE__, __FILE__); // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); @@ -989,9 +1046,9 @@ static void test_attr_delete() // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); - // Open last (formally 3rd) attribute for the dataset + // Open the only attribute for the dataset (formally 3rd) attr = dataset.openAttribute((unsigned)0); // Verify Name @@ -1005,7 +1062,7 @@ static void test_attr_delete() // Verify the correct number of attributes num_attrs = dataset.getNumAttrs(); - verify_val(num_attrs, 0, "H5Object::getNumAttrs", __LINE__, __FILE__); + verify_val(num_attrs, 0, "DataSet::getNumAttrs", __LINE__, __FILE__); PASSED(); } // end try block @@ -1035,19 +1092,19 @@ static void test_attr_dtype_shared() try { // Create a file - H5File fid1(FILENAME, H5F_ACC_TRUNC); + H5File fid1(FILE_DTYPE, H5F_ACC_TRUNC); // Close file fid1.close(); // Get size of file h5_stat_size_t empty_filesize; // Size of empty file - empty_filesize = h5_get_file_size(FILENAME.c_str(), H5P_DEFAULT); + empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); if (empty_filesize < 0) TestErrPrintf("Line %d: file size wrong!\n", __LINE__); // Open the file again - fid1.openFile(FILENAME, H5F_ACC_RDWR); + fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR); // Enclosing to work around the issue of unused variables and/or // objects created by copy constructors stay around until end of @@ -1120,7 +1177,7 @@ static void test_attr_dtype_shared() fid1.close(); // Open the file again - fid1.openFile(FILENAME, H5F_ACC_RDWR); + fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR); { // Second enclosed block... @@ -1161,7 +1218,7 @@ static void test_attr_dtype_shared() fid1.close(); // Check size of file - filesize = h5_get_file_size(FILENAME.c_str(), H5P_DEFAULT); + filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT); verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__); PASSED(); @@ -1192,7 +1249,7 @@ static void test_string_attr() try { // Create file - H5File fid1(FILENAME, H5F_ACC_RDWR); + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); // // Fixed-lenth string attributes @@ -1349,6 +1406,6 @@ extern "C" #endif void cleanup_attr() { - HDremove(FILENAME.c_str()); + //HDremove(FILENAME.c_str()); } diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index df01752..ba38d7a 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -333,6 +333,7 @@ static void test_file_open() tmpl1.getSymk( iparm1, iparm2); verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + PASSED(); } // end of try block @@ -381,8 +382,16 @@ static void test_file_size() hsize_t file_size = file4.getFileSize(); // Check if file size is reasonable. It's supposed to be 2KB now. - if(file_size<1*KB || file_size>4*KB) - issue_fail_msg("test_file_size()", __LINE__, __FILE__); + if (file_size < 1*KB || file_size > 4*KB) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFileSize() returned unreasonable value"); + + // Get the amount of free space in the file + hssize_t free_space = file4.getFreeSpace(); + + // Check if it's reasonable. It's 0 now. + if (free_space < 0 || free_space > 4*KB) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value"); + PASSED(); } // end of try block @@ -415,7 +424,8 @@ const int NX = 4; const int NY = 5; const H5std_string GROUPNAME ("group"); const H5std_string DSETNAME ("dataset"); -const H5std_string ATTRNAME ("attribute"); +const H5std_string DATTRNAME ("dataset attribute"); +const H5std_string FATTRNAME ("file attribute"); const H5std_string DTYPENAME ("compound"); // Compound datatype @@ -431,17 +441,17 @@ static void test_file_name() H5std_string file_name; try { - // Create a file using default properties. + // Create a file using default properties H5File file4(FILE4, H5F_ACC_TRUNC); - // Get file name from the file instance. + // Get file name from the file instance file_name = file4.getFileName(); verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__); // Create a group in the root group Group group(file4.createGroup(GROUPNAME, 0)); - // Get and verify file name + // Get and verify file name via a group file_name = group.getFileName(); verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__); @@ -452,12 +462,12 @@ static void test_file_name() // Create a new dataset DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); - // Get and verify file name + // Get and verify file name via a dataset file_name = dataset.getFileName(); verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); // Create an attribute for the dataset - Attribute attr(dataset.createAttribute(ATTRNAME, PredType::NATIVE_INT, space)); + Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); // Get and verify file name file_name = attr.getFileName(); @@ -486,6 +496,116 @@ static void test_file_name() } // test_file_name() +#define NUM_OBJS 4 +#define NUM_ATTRS 3 +const int RANK1 = 1; +const int ATTR1_DIM1 = 3; +const H5std_string FILE5("tfattrs.h5"); +const H5std_string FATTR1_NAME ("file attribute 1"); +const H5std_string FATTR2_NAME ("file attribute 2"); +int fattr_data[ATTR1_DIM1]={512,-234,98123}; /* Test data for file attribute */ +int dattr_data[ATTR1_DIM1]={256,-123,1000}; /* Test data for dataset attribute */ +static void test_file_attribute() +{ + int rdata[ATTR1_DIM1]; + int i; + + // Output message about test being performed + SUBTEST("File Attribute"); + + H5std_string file_name; + try { + // Create a file using default properties. + H5File file5(FILE5, H5F_ACC_TRUNC); + + // Create the data space + hsize_t dims[RANK1] = {ATTR1_DIM1}; + DataSpace space(RANK1, dims); + + // Create two attributes for the file + Attribute fattr1(file5.createAttribute(FATTR1_NAME, PredType::NATIVE_FLOAT, space)); + Attribute fattr2(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); + + fattr2.write(PredType::NATIVE_INT, fattr_data); + + try { + // Try to create the same attribute again (should fail) + Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space)); + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute."); + } + catch( AttributeIException E ) // catch creating existing attribute + {} // do nothing, FAIL expected + + // Create a new dataset + DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); + + // Create an attribute for the dataset + Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); + + // Write data to the second file attribute + dattr.write(PredType::NATIVE_INT, dattr_data); + + // Test flushing out the data from the attribute object + dattr.flush(H5F_SCOPE_GLOBAL); + + // Get and verify the number of all objects in the file + // Current: 1 file, 2 file attr, 1 ds, and 1 ds attr. + ssize_t num_objs = file5.getObjCount(H5F_OBJ_ALL); + verify_val(num_objs, 5, "H5File::getObjCount", __LINE__, __FILE__); + + num_objs = file5.getObjCount(H5F_OBJ_GROUP); + verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_GROUP)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_DATASET); + verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_DATASET)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_ATTR); + verify_val(num_objs, 3, "H5File::getObjCount(H5F_OBJ_ATTR)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_DATATYPE); + verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_DATATYPE)", __LINE__, __FILE__); + num_objs = file5.getObjCount(H5F_OBJ_FILE); + verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_FILE)", __LINE__, __FILE__); + + // Get the file name using the attributes + H5std_string fname = fattr1.getFileName(); + verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); + + fname.clear(); + fname = dattr.getFileName(); + verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__); + + // Get the class of a file attribute's datatype + H5T_class_t atclass = fattr1.getTypeClass(); + verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__); + + // Get and verify the number of attributes attached to a file + int n_attrs = file5.getNumAttrs(); + verify_val(n_attrs, 2, "H5File::getNumAttrs()", __LINE__, __FILE__); + + // Get and verify the number of attributes attached to a dataset + n_attrs = 0; + n_attrs = dataset.getNumAttrs(); + verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__); + + // Read back attribute's data + HDmemset(rdata, 0, sizeof(rdata)); + dattr.read(PredType::NATIVE_INT, rdata); + /* Check results */ + for (i = 0; i < ATTR1_DIM1; i++) { + if (rdata[i] != dattr_data[i]) { + H5_FAILED(); + cerr << endl; + cerr << "element [" << i << "] is " << rdata[i] << + "but should have been " << dattr_data[i] << endl; + } + } + PASSED(); + } // end of try block + + catch (Exception E) { + issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); + } +} // test_file_attribute() + /*------------------------------------------------------------------------- * Function: test_file * @@ -513,6 +633,7 @@ void test_file() test_file_open(); // Test file opening test_file_size(); // Test file size test_file_name(); // Test getting file's name + test_file_attribute(); // Test file attribute feature } // test_file() diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 221a61b..32c40d5 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -188,7 +188,7 @@ static void test_h5s_basic() * If this test fails and the H5S_MAX_RANK variable has changed, follow * the instructions in space_overflow.c for regenating the th5s.h5 file. */ - const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); + const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); // Create file H5File fid1(testfile, H5F_ACC_RDONLY); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 7f63d33..4eb5b21 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -149,34 +149,25 @@ static void test_reference_obj(void) // Create a dataset dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); - // Create reference to dataset + // Create reference to dataset and test getRefObjType file1->reference(&wbuf[0], "/Group1/Dataset1"); + H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); -#ifndef H5_NO_DEPRECATED_SYMBOLS - H5G_obj_t obj_type = dataset.getObjType(&wbuf[0], H5R_OBJECT); - verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - // Create reference to dataset + // Create reference to dataset and test getRefObjType file1->reference(&wbuf[1], "/Group1/Dataset2"); -#ifndef H5_NO_DEPRECATED_SYMBOLS - obj_type = dataset.getObjType(&wbuf[1], H5R_OBJECT); - verify_val(obj_type, H5G_DATASET, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); // Create reference to group file1->reference(&wbuf[2], "/Group1"); -#ifndef H5_NO_DEPRECATED_SYMBOLS - obj_type = dataset.getObjType(&wbuf[2], H5R_OBJECT); - verify_val(obj_type, H5G_GROUP, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__); // Create reference to named datatype file1->reference(&wbuf[3], "/Group1/Datatype1"); -#ifndef H5_NO_DEPRECATED_SYMBOLS - obj_type = dataset.getObjType(&wbuf[3], H5R_OBJECT); - verify_val(obj_type, H5G_TYPE, "DataSet::getObjType", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ + refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT); + verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__); // Write selection to disk dataset.write(wbuf, PredType::STD_REF_OBJ); @@ -253,7 +244,7 @@ static void test_reference_obj(void) // Test getting the type of objects // Test getObjTypeByIdx(hsize_t idx) - obj_type = group.getObjTypeByIdx(0); + H5G_obj_t obj_type = group.getObjTypeByIdx(0); verify_val(obj_type, H5G_DATASET, "Group::getObjTypeByIdx(index)", __LINE__, __FILE__); // Test getObjTypeByIdx(hsize_t idx, char* type_name) @@ -333,6 +324,18 @@ static void test_reference_obj(void) /**************************************************************** ** +** test_reference_compat(): Test basic object reference functionality. +** Tests references to various kinds of objects using deprecated API. +** +****************************************************************/ +static void test_reference_compat(void) +{ + // Not yet +} // test_reference_compat() + + +/**************************************************************** +** ** test_reference(): Main reference testing routine. ** ****************************************************************/ @@ -346,6 +349,7 @@ void test_reference(void) MESSAGE(5, ("Testing References\n")); test_reference_obj(); // Test basic object reference functionality + test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() diff --git a/config/apple b/config/apple index a2d6ae4..34085e0 100644 --- a/config/apple +++ b/config/apple @@ -28,6 +28,22 @@ fi # Figure out compiler flags . $srcdir/config/gnu-flags +# temp patch: if GCC 4.2.1 is used in Lion or Mountain Lion systems, do not +# use -O option as it causes failures in test/dt_arith. +#echo host_os=$host_os +case "$host_os" in + darwin1[12].*) # lion & mountain lion + #echo cc_vendor=$cc_vendor'-'cc_version=$cc_version + case "$cc_vendor-$cc_version" in + gcc-4.2.1) + # Remove any -O flags + #echo PROD_CFLAGS=$PROD_CFLAGS + PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" + #echo new PROD_CFLAGS=$PROD_CFLAGS + ;; + esac + ;; +esac . $srcdir/config/intel-flags if test "X-" = "X-$FC"; then diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 71e8c10..6fca1ae 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -15,6 +15,24 @@ /* Define if using a Windows compiler (i.e. Visual Studio) */ #cmakedefine H5_HAVE_VISUAL_STUDIO @H5_HAVE_VISUAL_STUDIO@ +/* Defined if HDF5 was built with CMake AND build as a shared library */ +#cmakedefine H5_BUILT_AS_DYNAMIC_LIB @H5_BUILT_AS_DYNAMIC_LIB@ + +/* Defined if HDF5 was built with CMake AND build as a static library */ +#cmakedefine H5_BUILT_AS_STATIC_LIB @H5_BUILT_AS_STATIC_LIB@ + +/* Defined if HDF5 CPP was built with CMake AND build as a shared library */ +#cmakedefine H5_CPP_BUILT_AS_DYNAMIC_LIB @H5_CPP_BUILT_AS_DYNAMIC_LIB@ + +/* Defined if HDF5 CPP was built with CMake AND build as a static library */ +#cmakedefine H5_CPP_BUILT_AS_STATIC_LIB @H5_CPP_BUILT_AS_STATIC_LIB@ + +/* Defined if HDF5 HL was built with CMake AND build as a shared library */ +#cmakedefine H5_HL_BUILT_AS_DYNAMIC_LIB @H5_HL_BUILT_AS_DYNAMIC_LIB@ + +/* Defined if HDF5 HL was built with CMake AND build as a static library */ +#cmakedefine H5_HL_BUILT_AS_STATIC_LIB @H5_HL_BUILT_AS_STATIC_LIB@ + /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ diff --git a/config/cmake/prunTest.cmake b/config/cmake/prunTest.cmake index 8bcf729..261f8a4 100644 --- a/config/cmake/prunTest.cmake +++ b/config/cmake/prunTest.cmake @@ -103,16 +103,30 @@ IF (NOT TEST_SKIP_COMPARE) ENDIF (WIN32 AND NOT MINGW) # now compare the output with the reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/P_${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) + SET (TEST_RESULT 0) + FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + LIST (LENGTH "${test_act}" len_act) + FILE (STRINGS ${TEST_FOLDER}/P_${TEST_REFERENCE} test_ref) + LIST (LENGTH "${test_ref}" len_ref) + MATH (EXPR _FP_LEN "${len_ref} - 1") + FOREACH (line RANGE 0 ${_FP_LEN}) + LIST (GET "${test_act}" ${line} str_act) + LIST (GET "${test_ref}" ${line} str_ref) + STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res) + IF (${str_res}) + SET (TEST_RESULT 1) + MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}") + ENDIF (${str_res}) + ENDFOREACH (line RANGE 0 ${_FP_LEN}) + IF (NOT ${len_act} STREQUAL ${len_ref}) + SET (TEST_RESULT 1) + ENDIF (NOT ${len_act} STREQUAL ${len_ref}) MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout IF (NOT ${TEST_RESULT} STREQUAL 0) - MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match P_${TEST_REFERENCE}") + MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match P_${TEST_REFERENCE}") ENDIF (NOT ${TEST_RESULT} STREQUAL 0) ENDIF (NOT TEST_SKIP_COMPARE) diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 4738523..78ccf9f 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -108,16 +108,30 @@ IF (NOT TEST_SKIP_COMPARE) ENDIF (WIN32 AND NOT MINGW) # now compare the output with the reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) + SET (TEST_RESULT 0) + FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + LIST (LENGTH "${test_act}" len_act) + FILE (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + LIST (LENGTH "${test_ref}" len_ref) + MATH (EXPR _FP_LEN "${len_ref} - 1") + FOREACH (line RANGE 0 ${_FP_LEN}) + LIST (GET "${test_act}" ${line} str_act) + LIST (GET "${test_ref}" ${line} str_ref) + STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res) + IF (${str_res}) + SET (TEST_RESULT 1) + MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}") + ENDIF (${str_res}) + ENDFOREACH (line RANGE 0 ${_FP_LEN}) + IF (NOT ${len_act} STREQUAL ${len_ref}) + SET (TEST_RESULT 1) + ENDIF (NOT ${len_act} STREQUAL ${len_ref}) MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout IF (NOT ${TEST_RESULT} STREQUAL 0) - MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}") + MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") ENDIF (NOT ${TEST_RESULT} STREQUAL 0) IF (TEST_ERRREF) @@ -127,16 +141,30 @@ IF (NOT TEST_SKIP_COMPARE) ENDIF (WIN32 AND NOT MINGW) # now compare the error output with the error reference - EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} - RESULT_VARIABLE TEST_RESULT - ) + SET (TEST_RESULT 0) + FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + LIST (LENGTH "${test_act}" len_act) + FILE (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + LIST (LENGTH "${test_ref}" len_ref) + MATH (EXPR _FP_LEN "${len_ref} - 1") + FOREACH (line RANGE 0 ${_FP_LEN}) + LIST (GET "${test_act}" ${line} str_act) + LIST (GET "${test_ref}" ${line} str_ref) + STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res) + IF (${str_res}) + SET (TEST_RESULT 1) + MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}") + ENDIF (${str_res}) + ENDFOREACH (line RANGE 0 ${_FP_LEN}) + IF (NOT ${len_act} STREQUAL ${len_ref}) + SET (TEST_RESULT 1) + ENDIF (NOT ${len_act} STREQUAL ${len_ref}) MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout IF (NOT ${TEST_RESULT} STREQUAL 0) - MESSAGE (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not match ${TEST_ERRREF}") + MESSAGE (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") ENDIF (NOT ${TEST_RESULT} STREQUAL 0) ENDIF (TEST_ERRREF) ENDIF (NOT TEST_SKIP_COMPARE) diff --git a/config/ibm-aix b/config/ibm-aix index c8b1fc3..28498e2 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -56,12 +56,12 @@ fi # to ensure the flag is present for both configure as well as for the build. if test "X-" = "X-$f9x_flags_set"; then F9XSUFFIXFLAG="-qsuffix=f=f90" - FCFLAGS="$FCFLAGS -O ${F9XSUFFIXFLAG}" - H5_FCFLAGS="$H5_FCFLAGS -O ${F9XSUFFIXFLAG}" + FCFLAGS="$FCFLAGS ${F9XSUFFIXFLAG}" + H5_FCFLAGS="$H5_FCFLAGS ${F9XSUFFIXFLAG}" FSEARCH_DIRS="-I./ -I../src" - DEBUG_FCFLAGS="-O" + DEBUG_FCFLAGS="-g" PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-O" + PROFILE_FCFLAGS="-g -pg" f9x_flags_set=yes fi diff --git a/config/lt_vers.am b/config/lt_vers.am index 9abc39d..461ac3a 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 121 +LT_VERS_REVISION = 127 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 491cce0..9b8b289 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.131-FA_a5. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.137-FA_a5. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.131-FA_a5' -PACKAGE_STRING='HDF5 1.9.131-FA_a5' +PACKAGE_VERSION='1.9.137-FA_a5' +PACKAGE_STRING='HDF5 1.9.137-FA_a5' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1484,7 +1484,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.131-FA_a5 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.137-FA_a5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1554,7 +1554,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.131-FA_a5:";; + short | recursive ) echo "Configuration of HDF5 1.9.137-FA_a5:";; esac cat <<\_ACEOF @@ -1750,7 +1750,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.131-FA_a5 +HDF5 configure 1.9.137-FA_a5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2844,7 +2844,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.131-FA_a5, which was +It was created by HDF5 $as_me 1.9.137-FA_a5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3676,7 +3676,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.131-FA_a5' + VERSION='1.9.137-FA_a5' cat >>confdefs.h <<_ACEOF @@ -27153,11 +27153,18 @@ else echo "int main(int argc, char * argv) {return 0;}" > conftest.c $CC $CFLAGS conftest.c > /dev/null 2> /dev/null - echo "./a.out :" > conftest.sh +case "`uname`" in + CYGWIN*) + echo "./a.exe :" > conftest.sh + ;; + *) + echo "./a.out :" > conftest.sh + ;; +esac chmod 700 conftest.sh ./conftest.sh 2> conftest.out - rm a.out + rm -f a.out a.exe TEST_OUTPUT=`cat conftest.out` if test "X$TEST_OUTPUT" = "X"; then @@ -28653,9 +28660,9 @@ else unset MPE fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOG_Init in -llmpe" >&5 -$as_echo_n "checking for CLOG_Init in -llmpe... " >&6; } -if ${ac_cv_lib_lmpe_CLOG_Init+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_mpi_io in -llmpe" >&5 +$as_echo_n "checking for MPE_Init_mpi_io in -llmpe... " >&6; } +if ${ac_cv_lib_lmpe_MPE_Init_mpi_io+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28669,7 +28676,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char CLOG_Init (); +char MPE_Init_mpi_io (); #ifdef FC_DUMMY_MAIN #ifndef FC_DUMMY_MAIN_EQ_F77 # ifdef __cplusplus @@ -28681,23 +28688,23 @@ char CLOG_Init (); int main () { -return CLOG_Init (); +return MPE_Init_mpi_io (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lmpe_CLOG_Init=yes + ac_cv_lib_lmpe_MPE_Init_mpi_io=yes else - ac_cv_lib_lmpe_CLOG_Init=no + ac_cv_lib_lmpe_MPE_Init_mpi_io=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_CLOG_Init" >&5 -$as_echo "$ac_cv_lib_lmpe_CLOG_Init" >&6; } -if test "x$ac_cv_lib_lmpe_CLOG_Init" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_MPE_Init_mpi_io" >&5 +$as_echo "$ac_cv_lib_lmpe_MPE_Init_mpi_io" >&6; } +if test "x$ac_cv_lib_lmpe_MPE_Init_mpi_io" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBLMPE 1 _ACEOF @@ -28828,9 +28835,9 @@ else LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOG_Init in -llmpe" >&5 -$as_echo_n "checking for CLOG_Init in -llmpe... " >&6; } -if ${ac_cv_lib_lmpe_CLOG_Init+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_mpi_io in -llmpe" >&5 +$as_echo_n "checking for MPE_Init_mpi_io in -llmpe... " >&6; } +if ${ac_cv_lib_lmpe_MPE_Init_mpi_io+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28844,7 +28851,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char CLOG_Init (); +char MPE_Init_mpi_io (); #ifdef FC_DUMMY_MAIN #ifndef FC_DUMMY_MAIN_EQ_F77 # ifdef __cplusplus @@ -28856,23 +28863,23 @@ char CLOG_Init (); int main () { -return CLOG_Init (); +return MPE_Init_mpi_io (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lmpe_CLOG_Init=yes + ac_cv_lib_lmpe_MPE_Init_mpi_io=yes else - ac_cv_lib_lmpe_CLOG_Init=no + ac_cv_lib_lmpe_MPE_Init_mpi_io=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_CLOG_Init" >&5 -$as_echo "$ac_cv_lib_lmpe_CLOG_Init" >&6; } -if test "x$ac_cv_lib_lmpe_CLOG_Init" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_MPE_Init_mpi_io" >&5 +$as_echo "$ac_cv_lib_lmpe_MPE_Init_mpi_io" >&6; } +if test "x$ac_cv_lib_lmpe_MPE_Init_mpi_io" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBLMPE 1 _ACEOF @@ -28940,9 +28947,9 @@ else unset MPE fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOG_Init in -llmpe" >&5 -$as_echo_n "checking for CLOG_Init in -llmpe... " >&6; } -if ${ac_cv_lib_lmpe_CLOG_Init+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_mpi_io in -llmpe" >&5 +$as_echo_n "checking for MPE_Init_mpi_io in -llmpe... " >&6; } +if ${ac_cv_lib_lmpe_MPE_Init_mpi_io+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -28956,7 +28963,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char CLOG_Init (); +char MPE_Init_mpi_io (); #ifdef FC_DUMMY_MAIN #ifndef FC_DUMMY_MAIN_EQ_F77 # ifdef __cplusplus @@ -28968,23 +28975,23 @@ char CLOG_Init (); int main () { -return CLOG_Init (); +return MPE_Init_mpi_io (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lmpe_CLOG_Init=yes + ac_cv_lib_lmpe_MPE_Init_mpi_io=yes else - ac_cv_lib_lmpe_CLOG_Init=no + ac_cv_lib_lmpe_MPE_Init_mpi_io=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_CLOG_Init" >&5 -$as_echo "$ac_cv_lib_lmpe_CLOG_Init" >&6; } -if test "x$ac_cv_lib_lmpe_CLOG_Init" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lmpe_MPE_Init_mpi_io" >&5 +$as_echo "$ac_cv_lib_lmpe_MPE_Init_mpi_io" >&6; } +if test "x$ac_cv_lib_lmpe_MPE_Init_mpi_io" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBLMPE 1 _ACEOF @@ -31715,7 +31722,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.131-FA_a5, which was +This file was extended by HDF5 $as_me 1.9.137-FA_a5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31781,7 +31788,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.131-FA_a5 +HDF5 config.status 1.9.137-FA_a5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -34558,7 +34565,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.131-FA_a5 +HDF5 config.lt 1.9.137-FA_a5 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. diff --git a/configure.ac b/configure.ac index bbd3257..492473c 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.131-FA_a5], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.137-FA_a5], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -2233,11 +2233,18 @@ AC_CACHE_CHECK([if lone colon can be used as an argument], [ echo "int main(int argc, char * argv[]) {return 0;}" > conftest.c $CC $CFLAGS conftest.c > /dev/null 2> /dev/null - echo "./a.out :" > conftest.sh +case "`uname`" in + CYGWIN*) + echo "./a.exe :" > conftest.sh + ;; + *) + echo "./a.out :" > conftest.sh + ;; +esac chmod 700 conftest.sh ./conftest.sh 2> conftest.out - rm a.out + rm -f a.out a.exe TEST_OUTPUT=`cat conftest.out` if test "X$TEST_OUTPUT" = "X"; then @@ -2821,7 +2828,7 @@ if test -n "$PARALLEL"; then X-yes) AC_CHECK_HEADERS([mpe.h],, [unset MPE]) AC_CHECK_LIB([mpe], [MPE_Init_log],, [unset MPE]) - AC_CHECK_LIB([lmpe], [CLOG_Init],, [unset MPE]) + AC_CHECK_LIB([lmpe], [MPE_Init_mpi_io],, [unset MPE]) ;; *) case "$withval" in @@ -2863,12 +2870,12 @@ if test -n "$PARALLEL"; then AM_LDFLAGS="$AM_LDFLAGS -L$mpe_lib" AC_CHECK_LIB([mpe], [MPE_Init_log],, [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE]) - AC_CHECK_LIB([lmpe], [CLOG_Init],, + AC_CHECK_LIB([lmpe], [MPE_Init_mpi_io],, [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE]) else AC_CHECK_LIB([mpe], [MPE_Init_log],, [unset MPE]) - AC_CHECK_LIB([lmpe], [CLOG_Init],, [unset MPE]) + AC_CHECK_LIB([lmpe], [MPE_Init_mpi_io],, [unset MPE]) fi ;; esac diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 814da48..0825f81 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -23,7 +23,6 @@ SET (examples grpdsetexample hyperslab selectele - grpit refobjexample refregexample mountexample @@ -64,7 +63,7 @@ FOREACH (example ${examples}) ENDFOREACH (example ${examples}) -IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +IF (HDF5_ENABLE_F2003) FOREACH (example ${F2003_examples}) ADD_EXECUTABLE (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) TARGET_NAMING (f03_ex_${example} ${LIB_TYPE}) @@ -89,7 +88,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) SET (last_test "f03_ex_${example}") ENDIF (BUILD_TESTING) ENDFOREACH (example ${F2003_examples}) -ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ENDIF (HDF5_ENABLE_F2003) IF (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) ADD_EXECUTABLE (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am index 4fb4180..310c4e2 100644 --- a/fortran/examples/Makefile.am +++ b/fortran/examples/Makefile.am @@ -33,13 +33,13 @@ endif # compile them with the regular fortran compiler. EXAMPLE_PROG=dsetexample fileexample rwdsetexample attrexample groupexample \ - grpsexample grpdsetexample hyperslab selectele grpit refobjexample \ + grpsexample grpdsetexample hyperslab selectele refobjexample \ refregexample mountexample compound # List files to be installed here INSTALL_FILES=dsetexample.f90 fileexample.f90 rwdsetexample.f90 \ attrexample.f90 groupexample.f90 grpsexample.f90 grpdsetexample.f90 \ - hyperslab.f90 selectele.f90 grpit.f90 refobjexample.f90 \ + hyperslab.f90 selectele.f90 refobjexample.f90 \ refregexample.f90 mountexample.f90 compound.f90 ph5example.f90 INSTALL_SCRIPT_FILES = run-fortran-ex.sh @@ -93,7 +93,6 @@ grpsexample: grpsexample.f90 grpdsetexample: grpdsetexample.f90 hyperslab: hyperslab.f90 selectele: selectele.f90 -grpit: grpit.f90 refobjexample: refobjexample.f90 refregexample: refregexample.f90 mountexample: mountexample.f90 diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 06c2632..21adf62 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -407,13 +407,13 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 # compile them with the regular fortran compiler. EXAMPLE_PROG = dsetexample fileexample rwdsetexample attrexample \ groupexample grpsexample grpdsetexample hyperslab selectele \ - grpit refobjexample refregexample mountexample compound \ + refobjexample refregexample mountexample compound \ $(am__append_1) # List files to be installed here INSTALL_FILES = dsetexample.f90 fileexample.f90 rwdsetexample.f90 \ attrexample.f90 groupexample.f90 grpsexample.f90 \ - grpdsetexample.f90 hyperslab.f90 selectele.f90 grpit.f90 \ + grpdsetexample.f90 hyperslab.f90 selectele.f90 \ refobjexample.f90 refregexample.f90 mountexample.f90 \ compound.f90 ph5example.f90 $(am__append_2) INSTALL_SCRIPT_FILES = run-fortran-ex.sh @@ -697,7 +697,6 @@ grpsexample: grpsexample.f90 grpdsetexample: grpdsetexample.f90 hyperslab: hyperslab.f90 selectele: selectele.f90 -grpit: grpit.f90 refobjexample: refobjexample.f90 refregexample: refregexample.f90 mountexample: mountexample.f90 diff --git a/fortran/examples/grpit.f90 b/fortran/examples/grpit.f90 deleted file mode 100644 index 9361b17..0000000 --- a/fortran/examples/grpit.f90 +++ /dev/null @@ -1,215 +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 files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! In this example we iterate through the members of the groups. -! - - - PROGRAM GRPITEXAMPLE - - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - - CHARACTER(LEN=11), PARAMETER :: filename = "iteratef.h5" ! File name - CHARACTER(LEN=7), PARAMETER :: groupname1 = "MyGroup" ! Group name - CHARACTER(LEN=15), PARAMETER :: groupname2 = "Group_A" ! Group name - CHARACTER(LEN=13), PARAMETER :: dsetname1 = "dset1" ! Dataset name - CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! - - CHARACTER(LEN=20) :: name_buffer ! Buffer to hold object's name - INTEGER :: type ! Type of the object - INTEGER :: nmembers ! Number of group members - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dataset1_id ! Dataset1 identifier - INTEGER(HID_T) :: dataset2_id ! Dataset2 identifier - INTEGER(HID_T) :: dataspace1_id ! Data space identifier - INTEGER(HID_T) :: dataspace2_id ! Data space identifier - INTEGER(HID_T) :: group1_id, group2_id ! Group identifiers - - INTEGER :: i, j - - INTEGER :: error ! Error flag - - INTEGER, DIMENSION(3,3) :: dset1_data ! Arrays to hold data - INTEGER, DIMENSION(2,10) :: dset2_data ! - - - INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/3,3/) ! Dataset dimensions - INTEGER(HSIZE_T), DIMENSION(2) :: dims2 = (/2,10/)! - INTEGER :: rank = 2 ! Datasets rank - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims - - ! - ! Initialize dset1_data array. - ! - do i = 1, 3 - do j = 1, 3 - dset1_data(i,j) = j; - end do - end do - - - ! - ! Initialize dset2_data array. - ! - do i = 1, 2 - do j = 1, 10 - dset2_data(i,j) = j; - end do - end do - - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(error) - - ! - ! Create a new file using default properties. - ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) - - ! - ! Create group "MyGroup" in the root group using absolute name. - ! - CALL h5gcreate_f(file_id, groupname1, group1_id, error) - - ! - ! Create group "Group_A" in group "MyGroup" using relative name. - ! - CALL h5gcreate_f(group1_id, groupname2, group2_id, error) - - ! - ! Create the data space for the first dataset. - ! - CALL h5screate_simple_f(rank, dims1, dataspace1_id, error) - - ! - ! Create a dataset in group "MyGroup" with default properties. - ! - CALL h5dcreate_f(group1_id, dsetname1, H5T_NATIVE_INTEGER, dataspace1_id, & - dataset1_id, error) - - ! - ! Write the first dataset. - ! - data_dims(1) = 3 - data_dims(2) = 3 - CALL h5dwrite_f(dataset1_id, H5T_NATIVE_INTEGER, dset1_data, data_dims, error) - - ! - ! Create the data space for the second dataset. - ! - CALL h5screate_simple_f(rank, dims2, dataspace2_id, error) - - ! - ! Create the second dataset in group "Group_A" with default properties - ! - CALL h5dcreate_f(group2_id, dsetname2, H5T_NATIVE_INTEGER, dataspace2_id, & - dataset2_id, error) - - ! - ! Write the second dataset - ! - data_dims(1) = 2 - data_dims(2) = 10 - CALL h5dwrite_f(dataset2_id, H5T_NATIVE_INTEGER, dset2_data, data_dims, error) - - ! - ! Get number of members in the root group. - ! - CALL h5gn_members_f(file_id, "/", nmembers, error) - write(*,*) "Number of root group member is " , nmembers - - ! - ! Print each group member's name and type. - ! - do i = 0, nmembers - 1 - CALL h5gget_obj_info_idx_f(file_id, "/", i, name_buffer, type, & - error) - write(*,*) name_buffer, type - end do - - ! - ! Get number of members in MyGroup. - ! - CALL h5gn_members_f(file_id, "MyGroup", nmembers, error) - write(*,*) "Number of group MyGroup member is ", nmembers - - ! - ! Print each group member's name and type in "MyGroup" group. - ! - do i = 0, nmembers - 1 - CALL h5gget_obj_info_idx_f(file_id, groupname1, i, name_buffer, type, & - error) - write(*,*) name_buffer, type - end do - - - ! - ! Get number of members in MyGroup/Group_A. - ! - CALL h5gn_members_f(file_id, "MyGroup/Group_A", nmembers, error) - write(*,*) "Number of group MyGroup/Group_A member is ", nmembers - - ! - ! Print each group member's name and type in "MyGroup/Group_A" group. - ! - do i = 0, nmembers - 1 - CALL h5gget_obj_info_idx_f(file_id,"MyGroup/Group_A" , i, name_buffer, type, & - error) - write(*,*) name_buffer, type - end do - - ! - ! Close the dataspace for the first dataset. - ! - CALL h5sclose_f(dataspace1_id, error) - - ! - ! Close the first dataset. - ! - CALL h5dclose_f(dataset1_id, error) - - ! - ! Close the dataspace for the second dataset. - ! - CALL h5sclose_f(dataspace2_id, error) - - ! - ! Close the second dataset. - ! - CALL h5dclose_f(dataset2_id, error) - - ! - ! Close the groups. - ! - CALL h5gclose_f(group1_id, error) - - CALL h5gclose_f(group2_id, error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - - ! - ! Close FORTRAN interface. - ! - CALL h5close_f(error) - - END PROGRAM GRPITEXAMPLE diff --git a/fortran/robodoc.rc b/fortran/robodoc.rc index 1366f77..07b8b35 100644 --- a/fortran/robodoc.rc +++ b/fortran/robodoc.rc @@ -9,13 +9,11 @@ items: AUTHOR CREATION DATE MODIFICATION HISTORY - HISTORY - INPUTS + HISTORY ARGUMENTS OPTIONS PARAMETERS SWITCHES - OUTPUTS SIDE EFFECTS RESULT RETURN VALUE @@ -41,12 +39,77 @@ items: USED BY PARENTS COMMANDS - SOURCE - CONTAINS SUBROUTINES + SOURCE + INPUTS + OUTPUTS OPTIONAL PARAMETERS + CONTAINS SUBROUTINES FILE + Fortran2003 Interface: + Fortran90 Interface: + Fortran2003 Derived Type: + Outputs: + Inputs: + Optional parameters: + Components: ignore items: + NAME COPYRIGHT + SYNOPSIS + USAGE + FUNCTION + DESCRIPTION + PURPOSE + AUTHOR + CREATION DATE + MODIFICATION HISTORY + HISTORY + ARGUMENTS + OPTIONS + PARAMETERS + SWITCHES + SIDE EFFECTS + RESULT + RETURN VALUE + EXAMPLE + NOTES + DIAGNOSTICS + WARNINGS + ERRORS + BUGS + TODO + IDEAS + PORTABILITY + SEE ALSO + METHODS + NEW METHODS + ATTRIBUTES + NEW ATTRIBUTES + TAGS + DERIVED FROM + DERIVED BY + USES + CHILDREN + USED BY + PARENTS + COMMANDS + CONTAINS SUBROUTINES + FILE +item order: + Fortran90 Interface: + Fortran2003 Interface: + Inputs: + Outputs: + Optional parameters: + Fortran2003 Derived Type: + Components: +source items: + Fortran90 Interface: + Fortran2003 Interface: + Fortran2003 Derived Type: + SOURCE + + headertypes: s Subroutines robo_subroutines options: @@ -60,14 +123,19 @@ options: --sections --sectionnameonly --documenttitle "HDF5 FORTRAN Developer's Guide" - --cmode + --footless + --headless + --one_file_per_header ignore files: .svn *~ *.o *e *.mod -accept files: + *_F90.f90 *.c +accept files: + *_F03.f90 + *_F90.f90 *.f90 *.h diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 25e14ba..374bc44 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -2,6 +2,22 @@ cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_F90_SRC C CXX Fortran) #----------------------------------------------------------------------------- +# configure def file for shared libs on windows +IF (WIN32 AND NOT CYGWIN) + IF (BUILD_SHARED_LIBS) + IF (MSVC) + IF (NOT H5_HAVE_PARALLEL) + SET (H5_NOPAREXP ";") + ENDIF (NOT H5_HAVE_PARALLEL) + IF (NOT HDF5_ENABLE_F2003) + SET (H5_NOF03EXP ";") + ENDIF (NOT HDF5_ENABLE_F2003) + CONFIGURE_FILE (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY) + ENDIF (MSVC) + ENDIF (BUILD_SHARED_LIBS) +ENDIF (WIN32 AND NOT CYGWIN) + +#----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities # H5test_kind(_SIZEOF).f90 used to generate H5fortran_detect.f90 # H5fortran_detect.f90 used to generate H5fort_type_defines.h @@ -126,13 +142,13 @@ SET_TARGET_PROPERTIES (${HDF5_F90_C_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C) #----------------------------------------------------------------------------- # Fortran 2003 standard #----------------------------------------------------------------------------- -IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +IF (HDF5_ENABLE_F2003) # default real is 4 bytes, so include double signatures SET (F_STATUS "_F03") -ELSE (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ELSE (HDF5_ENABLE_F2003) # default real is 8 bytes, so exclude double signatures SET (F_STATUS "_F90") -ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ENDIF (HDF5_ENABLE_F2003) #----------------------------------------------------------------------------- # Fortran Real Size @@ -208,11 +224,7 @@ IF (WIN32 AND NOT CYGWIN) BUILD_HDF5_DLL ) IF (MSVC) - IF (H5_HAVE_PARALLEL) - SET (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_SOURCE_DIR}/phdf5_fortrandll.def") - ELSE (H5_HAVE_PARALLEL) - SET (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def") - ENDIF (H5_HAVE_PARALLEL) + SET (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") ENDIF (MSVC) ENDIF (BUILD_SHARED_LIBS) SET_PROPERTY (TARGET ${HDF5_F90_LIB_TARGET} diff --git a/fortran/src/H5FDmpiof.c b/fortran/src/H5FDmpiof.c index 89b4180..993b5ac 100644 --- a/fortran/src/H5FDmpiof.c +++ b/fortran/src/H5FDmpiof.c @@ -300,3 +300,40 @@ nh5pget_fapl_mpiposix_c(hid_t_f *prp_id, int_f* comm, int_f* flag) ret_value = 0; return ret_value; } + +/****if* H5Pf/h5pget_mpio_actual_io_mode_c + * NAME + * h5pget_mpio_actual_io_mode_c + * PURPOSE + * Calls H5Pget_mpio_actual_io_mode + * + * INPUTS + * dxpl_id - Dataset transfer property list identifier. + * OUTPUTS + * actual_io_mode - The type of I/O performed by this process. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * July 27, 2012 + * SOURCE +*/ +int_f +nh5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode) +/******/ +{ + int ret_value = -1; + H5D_mpio_actual_io_mode_t c_actual_io_mode; + + /* + * Call H5Pget_mpio_actual_io_mode_f function. + */ + if( (H5Pget_mpio_actual_io_mode((hid_t)*dxpl_id, &c_actual_io_mode)) <0 ) + return ret_value; /* error occurred */ + + *actual_io_mode =(int_f)c_actual_io_mode; + + ret_value = 0; + return ret_value; +} diff --git a/fortran/src/H5FDmpioff.f90 b/fortran/src/H5FDmpioff.f90 index ea9283c..d9faef3 100644 --- a/fortran/src/H5FDmpioff.f90 +++ b/fortran/src/H5FDmpioff.f90 @@ -174,24 +174,23 @@ CONTAINS ! access property list. ! ! INPUTS -! prp_id - file access property list identifier -! comm - MPI-2 communicator -! use_gpfs - logical flag to use the GPFS hints +! prp_id - File access property list identifier. +! comm - MPI-2 communicator. +! use_gpfs - Logical flag to use the GPFS hints. ! OUTPUTS -! hdferr - Returns 0 if successful and -1 if fails +! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR ! Elena Pourmal ! May 6, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_mpiposix_f(prp_id, comm, use_gpfs, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier - INTEGER, INTENT(IN) :: comm ! MPI communicator to be used for file open - ! as defined in MPI_FILE_OPEN of MPI-2 - LOGICAL, INTENT(IN) :: use_gpfs - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: prp_id + INTEGER, INTENT(IN) :: comm + LOGICAL, INTENT(IN) :: use_gpfs + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: flag INTEGER, EXTERNAL :: h5pset_fapl_mpiposix_c @@ -209,22 +208,22 @@ CONTAINS ! Returns MPI communicator information. ! ! INPUTS -! prp_id - file access property list identifier +! prp_id - File access property list identifier. ! OUTPUTS -! comm - MPI-2 communicator -! use_gpfs - flag to use GPFS hints -! hdferr - Returns 0 if successful and -1 if fails +! comm - MPI-2 communicator. +! use_gpfs - Flag to use GPFS hints. +! hdferr - Returns 0 if successful and -1 if fails. ! AUTHOR ! Elena Pourmal ! May 6, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fapl_mpiposix_f(prp_id, comm, use_gpfs, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier - INTEGER, INTENT(OUT) :: comm ! Buffer to return communicator - LOGICAL, INTENT(OUT) :: use_gpfs - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: prp_id + INTEGER, INTENT(OUT) :: comm + LOGICAL, INTENT(OUT) :: use_gpfs + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: flag @@ -234,4 +233,49 @@ CONTAINS IF (flag .EQ. 1) use_gpfs = .TRUE. END SUBROUTINE h5pget_fapl_mpiposix_f + +!****s* H5P/h5pget_mpio_actual_io_mode_f +! NAME +! h5pget_mpio_actual_io_mode_f +! +! PURPOSE +! Retrieves the type of I/O that HDF5 actually performed on the last +! parallel I/O call. This is not necessarily the type of I/O requested. +! +! INPUTS +! dxpl_id - Dataset transfer property list identifier. +! OUTPUTS +! actual_io_mode - The type of I/O performed by this process. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! July 27, 2012 +! +! HISTORY +! +! Fortran90 Interface: + SUBROUTINE h5pget_mpio_actual_io_mode_f(dxpl_id, actual_io_mode, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dxpl_id + INTEGER , INTENT(OUT) :: actual_io_mode + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5PGET_MPIO_ACTUAL_IO_MODE_C'::h5pget_mpio_actual_io_mode_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dxpl_id + INTEGER , INTENT(OUT) :: actual_io_mode + END FUNCTION h5pget_mpio_actual_io_mode_c + END INTERFACE + + actual_io_mode = -1 + + hdferr = h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode) + + END SUBROUTINE h5pget_mpio_actual_io_mode_f + END MODULE H5FDMPIO diff --git a/fortran/src/H5Gff.f90 b/fortran/src/H5Gff.f90 index 6bcee7c..155185a 100644 --- a/fortran/src/H5Gff.f90 +++ b/fortran/src/H5Gff.f90 @@ -927,7 +927,7 @@ CONTAINS ! Buffer to hold a comment INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Lenghth of the current_name string + INTEGER :: namelen ! Length of the current_name string INTERFACE INTEGER FUNCTION h5gget_comment_c(loc_id, name, namelen, size, buffer) diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 531f09c..8e75989 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -24,6 +24,83 @@ #include "H5f90.h" #include "H5Eprivate.h" +int_f +fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { + + struct tm *ts; + + object_info->fileno = Oinfo.fileno; + object_info->addr = (haddr_t_f)Oinfo.addr; + + object_info->type = (int_f)Oinfo.type; + object_info->rc = (int_f)Oinfo.rc; + + ts = HDgmtime(&Oinfo.atime); + + object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->atime[2] = (int_f)ts->tm_mday; + object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->atime[4] = (int_f)ts->tm_hour; + object_info->atime[5] = (int_f)ts->tm_min; + object_info->atime[6] = (int_f)ts->tm_sec; + object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.btime); + + object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->btime[2] = (int_f)ts->tm_mday; + object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->btime[4] = (int_f)ts->tm_hour; + object_info->btime[5] = (int_f)ts->tm_min; + object_info->btime[6] = (int_f)ts->tm_sec; + object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.ctime); + + object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->ctime[2] = (int_f)ts->tm_mday; + object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->ctime[4] = (int_f)ts->tm_hour; + object_info->ctime[5] = (int_f)ts->tm_min; + object_info->ctime[6] = (int_f)ts->tm_sec; + object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.mtime); + + object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->mtime[2] = (int_f)ts->tm_mday; + object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->mtime[4] = (int_f)ts->tm_hour; + object_info->mtime[5] = (int_f)ts->tm_min; + object_info->mtime[6] = (int_f)ts->tm_sec; + object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; + + object_info->hdr.version = (int_f)Oinfo.hdr.version; + object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; + object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; + object_info->hdr.flags = (int_f)Oinfo.hdr.flags; + + object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; + object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; + object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; + object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; + + object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; + object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; + + object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; + object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; + + return 0; + +} + /****if* H5Of/h5olink_c * NAME * h5olink_c @@ -215,7 +292,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) return ret_value; } -/* ***if* H5Of/H5Oget_info_by_name_c +/****if* H5Of/H5Oget_info_by_name_c * NAME * H5Oget_info_by_name_c * PURPOSE @@ -226,10 +303,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) * namelen - Name length. * lapl_id - Link access property list. * OUTPUTS - * corder_valid - Indicates whether the the creation order data is valid for this attribute. - * corder - Is a positive integer containing the creation order of the attribute. - * cset - Indicates the character set used for the attribute’s name. - * data_size - indicates the size, in the number of characters, of the attribute. + * object_info - Buffer in which to return object information. * * RETURNS * 0 on success, -1 on failure @@ -261,74 +335,100 @@ nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f * &Oinfo, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); - object_info->fileno = Oinfo.fileno; - object_info->addr = (haddr_t_f)Oinfo.addr; - - - object_info->type = (int_f)Oinfo.type; - object_info->rc = (int_f)Oinfo.rc; - - ts = HDgmtime(&Oinfo.atime); - - object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->atime[2] = (int_f)ts->tm_mday; - object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->atime[4] = (int_f)ts->tm_hour; - object_info->atime[5] = (int_f)ts->tm_min; - object_info->atime[6] = (int_f)ts->tm_sec; - object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ - - ts = HDgmtime(&Oinfo.btime); - - object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->btime[2] = (int_f)ts->tm_mday; - object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->btime[4] = (int_f)ts->tm_hour; - object_info->btime[5] = (int_f)ts->tm_min; - object_info->btime[6] = (int_f)ts->tm_sec; - object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + ret_value = fill_h5o_info_t_f(Oinfo,object_info); - ts = HDgmtime(&Oinfo.ctime); - - object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->ctime[2] = (int_f)ts->tm_mday; - object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->ctime[4] = (int_f)ts->tm_hour; - object_info->ctime[5] = (int_f)ts->tm_min; - object_info->ctime[6] = (int_f)ts->tm_sec; - object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + done: + if(c_name) + HDfree(c_name); + return ret_value; +} - ts = HDgmtime(&Oinfo.mtime); +/****if* H5Of/H5Oget_info_by_idx_c + * NAME + * H5Oget_info_by_idx_c + * PURPOSE + * Calls H5Oget_info_by_idx + * INPUTS + * loc_id - File or group identifier specifying location of group in which object is located. + * name - Name of group, relative to loc_id. + * namelen - Name length. + * lapl_id - Link access property list. + * OUTPUTS + * object_info - Buffer in which to return object information. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * December 1, 2008 + * SOURCE +*/ +int_f +nh5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info) +/******/ +{ + char *c_group_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + H5O_info_t Oinfo; + H5_index_t c_index_field; + H5_iter_order_t c_order; + + /* + * Convert FORTRAN name to C name + */ + if((c_group_name = HD5f2cstring( group_name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); - object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->mtime[2] = (int_f)ts->tm_mday; - object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ - object_info->mtime[4] = (int_f)ts->tm_hour; - object_info->mtime[5] = (int_f)ts->tm_min; - object_info->mtime[6] = (int_f)ts->tm_sec; - object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + c_index_field = (H5_index_t)*index_field; + c_order = (H5_iter_order_t)*order; - object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; + /* + * Call H5Oinfo_by_idx function. + */ + if(H5Oget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + &Oinfo, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); - object_info->hdr.version = (int_f)Oinfo.hdr.version; - object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; - object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; - object_info->hdr.flags = (int_f)Oinfo.hdr.flags; + ret_value = fill_h5o_info_t_f(Oinfo,object_info); - object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; - object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; - object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; - object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; + done: + if(c_group_name) + HDfree(c_group_name); + return ret_value; +} - object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; - object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; +/****if* H5Of/H5Oget_info_c + * NAME + * H5Oget_info_c + * PURPOSE + * Calls H5Oget_info + * INPUTS + * object_id - Identifier for target object. + * OUTPUTS + * object_info - Buffer in which to return object information. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) +/******/ +{ + int_f ret_value = 0; /* Return value */ + H5O_info_t Oinfo; + + /* + * Call H5Oinfo_by_name function. + */ + if(H5Oget_info((hid_t)*object_id, &Oinfo) < 0) + HGOTO_DONE(FAIL); - object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; - object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; + ret_value = fill_h5o_info_t_f(Oinfo,object_info); done: return ret_value; @@ -391,3 +491,428 @@ nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, return ret_value; } + +/****if* H5Of/h5ovisit_by_name_c + * NAME + * h5ovisit_by_name_c + * PURPOSE + * Calls H5Ovisit_by_name + * INPUTS + * object_id - Identifier specifying subject group + * index_type - Type of index which determines the order + * order - Order within index + * idx - Iteration position at which to start + * op - Callback function passing data regarding the link to the calling application + * op_data - User-defined pointer to data required by the application for its processing of the link + * + * OUTPUTS + * idx - Position at which an interrupted iteration may be restarted + * + * RETURNS + * >0 on success, 0< on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, + H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ) +/******/ +{ + int_f ret_value = -1; /* Return value */ + herr_t func_ret_value; /* H5Linterate return value */ + char *c_object_name = NULL; /* Buffer to hold C string */ + + + /* + * Convert FORTRAN name to C name + */ + if( (c_object_name = HD5f2cstring(object_name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Ovisit + */ + func_ret_value = H5Ovisit_by_name( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + op, op_data, (hid_t)*lapl_id); + ret_value = (int_f)func_ret_value; + + done: + if(c_object_name) + HDfree(c_object_name); + return ret_value; + +} + +/****if* H5Of/h5odecr_refcount_c + * NAME + * h5odecr_refcount_c + * PURPOSE + * Calls H5Odecr_refcount + * INPUTS + * object_id - Object identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5odecr_refcount_c (hid_t_f *object_id) +/******/ +{ + int_f ret_value = 0; /* Return value */ + + /* + * Call H5Odecr_refcount function. + */ + if((hid_t_f)H5Odecr_refcount((hid_t)*object_id) < 0) + HGOTO_DONE(FAIL); + + done: + return ret_value; +} + +/****if* H5Of/h5oexists_by_name_c + * NAME + * h5oexists_by_name_c + * PURPOSE + * Calls H5Oexists_by_name + * INPUTS + * loc_id - File or group identifier + * name - Attribute access property list + * namelen - Size of name + * lapl_id - Link access property list + * + * RETURNS + * link status: 0 = false, 1 = true, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id) +/******/ +{ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + htri_t status = 0; + + /* + * Convert FORTRAN name to C name + */ + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oopen function. + */ + if((ret_value = (int_f)H5Oexists_by_name((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_name) + HDfree(c_name); + return ret_value; +} + +/****if* H5Of/h5oincr_refcount_c + * NAME + * h5oincr_refcount_c + * PURPOSE + * Calls H5Oincr_refcount + * INPUTS + * object_id - Object identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5oincr_refcount_c (hid_t_f *object_id) +/******/ +{ + int_f ret_value = 0; /* Return value */ + + /* + * Call H5Oincr_refcount function. + */ + if((hid_t_f)H5Oincr_refcount((hid_t)*object_id) < 0) + HGOTO_DONE(FAIL); + + done: + return ret_value; +} + +/****if* H5Of/h5oset_comment_c + * NAME + * h5oset_comment_c + * PURPOSE + * Calls H5Oset_comment + * INPUTS + * object_id - Identifier of the target object. + * comment - The new comment. + * commentlen - Length of the comment. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + + /* + * Convert FORTRAN string to C string + */ + if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oset_comment function. + */ + if((hid_t_f)H5Oset_comment((hid_t)*object_id, c_comment) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_comment) + HDfree(c_comment); + return ret_value; +} + +/****if* H5Of/h5oset_comment_by_name_c + * NAME + * h5oset_comment_by_name_c + * PURPOSE + * Calls H5Oset_comment_by_name + * INPUTS + * object_id - Identifier of the target object. + * name - Name of the object whose comment is to be set or reset, + * specified as a path relative to loc_id. + * namelen - Length of the name. + * comment - The new comment. + * commentlen - Length of the comment. + * lapl_id - Link access property list identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + + /* + * Convert FORTRAN string to C string + */ + if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL) + HGOTO_DONE(FAIL); + /* + * Convert FORTRAN string to C string + */ + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oset_comment_by_name function. + */ + if((hid_t_f)H5Oset_comment_by_name((hid_t)*object_id, c_name, c_comment, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_name) + HDfree(c_name); + if(c_comment) + HDfree(c_comment); + return ret_value; +} +/****if* H5Of/h5oopen_by_idx_c + * NAME + * h5oopen_by_idx_c + * PURPOSE + * Calls H5Oopen_by_idx_c + * INPUTS + * loc_id - A file or group identifier. + * group_name - Name of group, relative to loc_id, in which object is located. + * group_namelen - Length of group_name + * index_type - Type of index by which objects are ordered. + * order - Order of iteration within index. + * n - Object to open. + * lapl_id - Link access property list. + * OUTPUTS + * obj_id - An object identifier for the opened object. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id) +/******/ +{ + char *c_group_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; + H5_index_t c_index_type; + H5_iter_order_t c_order; + + /* + * Convert FORTRAN string to C string + */ + if((c_group_name = HD5f2cstring( group_name, (size_t)*group_namelen)) == NULL) + HGOTO_DONE(FAIL); + + c_index_type = (H5_index_t)*index_type; + c_order = (H5_iter_order_t)*order; + + /* + * Call H5Oopen_by_idx function. + */ + if((*obj_id =(hid_t_f)H5Oopen_by_idx((hid_t)*loc_id, c_group_name, c_index_type, c_order, (hsize_t)*n, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_group_name) + HDfree(c_group_name); + return ret_value; +} + +/****if* H5Of/h5oget_comment_c + * NAME + * h5oget_comment_c + * PURPOSE + * Calls H5Oget_comment + * INPUTS + * object_id - Identifier for the target object. + * bufsize - Anticipated required size of the comment buffer. + * OUTPUTS + * comment - The comment. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * June 24, 2012 + * SOURCE +*/ +int_f +nh5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + size_t c_commentsize; + + c_commentsize = (size_t)*commentsize + 1; + + /* + * Allocate buffer to hold comment name + */ + + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) + HGOTO_DONE(FAIL); + + /* + * Call H5Oget_comment function. + */ + + if((*bufsize = (hssize_t_f)H5Oget_comment((hid_t)*object_id, c_comment, (size_t)*commentsize)) < 0) + HGOTO_DONE(FAIL); + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + if(c_comment) + HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1); + return ret_value; + + done: + if(c_comment) + HDfree(c_comment); + + return ret_value; +} + +/****if* H5Of/h5oget_comment_by_name_c + * NAME + * h5oget_comment_by_name_c + * PURPOSE + * Calls H5Oget_comment_by_name + * INPUTS + * object_id - Identifier for the target object. + * bufsize - Anticipated required size of the comment buffer. + * OUTPUTS + * comment - The comment. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * July 6, 2012 + * SOURCE +*/ +int_f +nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, + _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + size_t c_commentsize; + + /* + * Convert FORTRAN string to C string + */ + if((c_name = HD5f2cstring(name, (size_t)*name_size)) == NULL) + HGOTO_DONE(FAIL); + + c_commentsize = (size_t)*commentsize + 1; + + /* + * Allocate buffer to hold comment name + */ + + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) + HGOTO_DONE(FAIL); + + /* + * Call H5Oget_comment_by_name function. + */ + + if((*bufsize = (size_t_f)H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0) + HGOTO_DONE(FAIL); + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + if(c_comment) + HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1); + return ret_value; + + done: + if(c_comment) + HDfree(c_comment); + if(c_name) + HDfree(c_name); + + return ret_value; +} diff --git a/fortran/src/H5Off.f90 b/fortran/src/H5Off.f90 index 4f1ea18..ce8c55c 100644 --- a/fortran/src/H5Off.f90 +++ b/fortran/src/H5Off.f90 @@ -119,15 +119,15 @@ CONTAINS ! Opens an object in an HDF5 file by location identifier and path name. ! ! Inputs: -! loc_id - File or group identifier. -! name - Path to the object, relative to loc_id. +! loc_id - File or group identifier. +! name - Path to the object, relative to loc_id. ! ! Outputs: -! obj_id - Object identifier for the opened object. -! hdferr - Returns 0 if successful and -1 if fails. +! obj_id - Object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! lapl_id - Access property list identifier for the link pointing to the object. +! lapl_id - Access property list identifier for the link pointing to the object. ! ! AUTHOR ! M. Scot Breitenfeld @@ -215,12 +215,12 @@ CONTAINS ! Opens an object using its address within an HDF5 file. ! ! Inputs: -! loc_id - File or group identifier. -! addr - Object’s address in the file. +! loc_id - File or group identifier. +! addr - Object’s address in the file. ! ! Outputs: -! obj_id - Object identifier for the opened object. -! hdferr - Returns 0 if successful and -1 if fails. +! obj_id - Object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR ! M. Scot Breitenfeld @@ -321,5 +321,455 @@ CONTAINS END SUBROUTINE h5ocopy_f +!****s* H5O/h5odecr_refcount_f +! NAME +! h5odecr_refcount_f +! +! PURPOSE +! Decrements an object reference count. +! +! Inputs: +! object_id - Object identifier. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5odecr_refcount_f(object_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: object_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5odecr_refcount_c(object_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5ODECR_REFCOUNT_C'::h5odecr_refcount_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: object_id + END FUNCTION h5odecr_refcount_c + END INTERFACE + + hdferr = h5odecr_refcount_c(object_id) + + END SUBROUTINE h5odecr_refcount_f + +!****s* H5O/h5oexists_by_name_f +! NAME +! h5oexists_by_name_f +! +! PURPOSE +! Determines whether a link resolves to an actual object. +! +! Inputs: +! loc_id - Identifier of the file or group to query. +! name - The name of the link to check. +! +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! Outputs: +! link_exists - Existing link resolves to an object. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oexists_by_name_f(loc_id, name, link_exists, hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + LOGICAL , INTENT(OUT) :: link_exists + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id +!***** + + INTEGER(size_t) :: namelen + INTEGER :: status + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oexists_by_name_c(loc_id, name, namelen, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OEXISTS_BY_NAME_C'::h5oexists_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER(HID_T) , INTENT(IN) :: lapl_id + + END FUNCTION h5oexists_by_name_c + END INTERFACE + + namelen = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + status = h5oexists_by_name_c(loc_id, name, namelen, lapl_id_default) + + link_exists = .FALSE. + IF(status.EQ.1)THEN + link_exists = .TRUE. + ENDIF + + hdferr = 0 + IF(status.LT.0)THEN + hdferr = -1 + ENDIF + + END SUBROUTINE h5oexists_by_name_f + +!****s* H5O/h5oget_comment_f +! NAME +! h5oget_comment_f +! +! PURPOSE +! Retrieves comment for specified object. +! +! Inputs: +! obj_id - Identifier for the target object. +! +! Optional parameters: +! bufsize - Size of the comment buffer. +! +! Outputs: +! comment - The comment. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oget_comment_f(obj_id, comment, hdferr, bufsize) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*) , INTENT(OUT) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HSSIZE_T), INTENT(OUT), OPTIONAL :: bufsize +!***** + + INTEGER(SIZE_T) :: commentsize_default + INTEGER(HSSIZE_T) :: bufsize_default + + INTERFACE + INTEGER FUNCTION h5oget_comment_c(obj_id, comment, commentsize_default, bufsize) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_C'::h5oget_comment_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default + INTEGER(HSSIZE_T) , INTENT(OUT) :: bufsize + END FUNCTION h5oget_comment_c + END INTERFACE + + commentsize_default = LEN(comment) + + hdferr = h5oget_comment_c(obj_id, comment, commentsize_default, bufsize_default) + + IF(PRESENT(bufsize)) bufsize = bufsize_default + + END SUBROUTINE h5oget_comment_f + +!****s* H5O/h5oget_comment_by_name_f +! NAME +! h5oget_comment_by_name_f +! +! PURPOSE +! Retrieves comment for specified object. +! +! Inputs: +! loc_id - Identifier of a file, group, dataset, or named datatype. +! name - Name of the object whose comment is to be retrieved, +! specified as a path relative to loc_id. +! +! Optional parameters: +! bufsize - Size of the comment buffer. +! +! Outputs: +! comment - The comment. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! July 6, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oget_comment_by_name_f(loc_id, name, comment, hdferr, bufsize, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(SIZE_T) , INTENT(OUT), OPTIONAL :: bufsize + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + + INTEGER(SIZE_T) :: commentsize_default + INTEGER(SIZE_T) :: name_size + INTEGER(SIZE_T) :: bufsize_default + INTEGER(HID_T) :: lapl_id_default + INTERFACE + INTEGER FUNCTION h5oget_comment_by_name_c(loc_id, name, name_size, & + comment, commentsize_default, bufsize_default, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_BY_NAME_C'::h5oget_comment_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment, name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: name_size + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default + INTEGER(SIZE_T) , INTENT(OUT) :: bufsize_default + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5oget_comment_by_name_c + END INTERFACE + + commentsize_default = LEN(comment) + name_size = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oget_comment_by_name_c(loc_id, name, name_size, & + comment, commentsize_default, bufsize_default, lapl_id_default) + + IF(PRESENT(bufsize)) bufsize = bufsize_default + + END SUBROUTINE h5oget_comment_by_name_f + +!****s* H5O/h5oincr_refcount_f +! NAME +! h5oincr_refcount_f +! +! PURPOSE +! Increments an object reference count. +! +! Inputs: +! obj_id - Object identifier. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oincr_refcount_f(obj_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5oincr_refcount_c(obj_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OINCR_REFCOUNT_C'::h5oincr_refcount_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: obj_id + END FUNCTION h5oincr_refcount_c + END INTERFACE + + hdferr = h5oincr_refcount_c(obj_id) + + END SUBROUTINE h5oincr_refcount_f + +!****s* H5O/h5oopen_by_idx_f +! +! NAME +! h5oopen_by_idx_f +! +! PURPOSE +! Open the nth object in a group. +! +! Inputs: +! loc_id - A file or group identifier. +! group_name - Name of group, relative to loc_id, in which object is located. +! index_type - Type of index by which objects are ordered. +! order - Order of iteration within index, NOTE: zero-based. +! n - Object to open. +! +! Outputs: +! obj_id - An object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list. +! +! AUTHOR +! M. Scot Breitenfeld +! May 17, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oopen_by_idx_f(loc_id, group_name, index_type, order, n, obj_id, & + hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(OUT) :: obj_id + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + INTEGER(SIZE_T) :: group_namelen + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OOPEN_BY_IDX_C'::h5oopen_by_idx_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: group_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER(SIZE_T) , INTENT(IN) :: group_namelen + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(OUT) :: obj_id + INTEGER(HID_T) , INTENT(IN) :: lapl_id_default + + END FUNCTION h5oopen_by_idx_c + END INTERFACE + + group_namelen = LEN(group_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default) + + END SUBROUTINE H5Oopen_by_idx_f + +!****s* H5O/h5oset_comment_f +! NAME +! h5oset_comment_f +! +! PURPOSE +! Sets comment for specified object. +! +! Inputs: +! obj_id - Identifier of the target object. +! comment - The new comment. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oset_comment_f(obj_id, comment, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER , INTENT(OUT) :: hdferr +!***** + INTEGER(SIZE_T) :: commentlen + + INTERFACE + INTEGER FUNCTION h5oset_comment_c(obj_id, comment, commentlen) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_C'::h5oset_comment_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentlen + + END FUNCTION h5oset_comment_c + END INTERFACE + + commentlen = LEN(comment) + + hdferr = h5oset_comment_c(obj_id, comment, commentlen) + + END SUBROUTINE h5oset_comment_f + +!****s* H5O/h5oset_comment_by_name_f +! NAME +! h5oset_comment_by_name_f +! +! PURPOSE +! Sets comment for specified object. +! +! Inputs: +! loc_id - Identifier of a file, group, dataset, or named datatype. +! name - Name of the object whose comment is to be set or reset, +! specified as a path relative to loc_id. +! comment - The new comment. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oset_comment_by_name_f(loc_id, name, comment, hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id +!***** + INTEGER(SIZE_T) :: commentlen + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_BY_NAME_C'::h5oset_comment_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name, comment + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentlen + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5oset_comment_by_name_c + END INTERFACE + + commentlen = LEN(comment) + namelen = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id_default) + + END SUBROUTINE h5oset_comment_by_name_f + END MODULE H5O diff --git a/fortran/src/H5Off_F03.f90 b/fortran/src/H5Off_F03.f90 index 8eb7a4b..f4ddd3e 100644 --- a/fortran/src/H5Off_F03.f90 +++ b/fortran/src/H5Off_F03.f90 @@ -82,9 +82,9 @@ MODULE H5O_PROVISIONAL ENDTYPE meta_size_t TYPE, BIND(C) :: h5o_info_t - INTEGER(c_long) :: fileno ! File number that object is located in + INTEGER(C_LONG) :: fileno ! File number that object is located in INTEGER(haddr_t) :: addr ! Object address in file - INTEGER :: type ! Basic object type (group, dataset, etc.) + INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) INTEGER :: rc ! Reference count of object INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE -- @@ -181,14 +181,14 @@ CONTAINS ! Inputs: ! loc_id - File or group identifier specifying location of group ! in which object is located. -! name - Name of group, relative to loc_id +! name - Name of group, relative to loc_id. ! ! Outputs: -! object_info - Buffer in which to return object information -! hdferr - Returns 0 if successful and -1 if fails +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! lapl_id - Link access property list +! lapl_id - Link access property list. ! ! AUTHOR ! M. Scot Breitenfeld @@ -218,11 +218,12 @@ CONTAINS !DEC$IF DEFINED(HDF5F90_WINDOWS) !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_NAME_C'::h5oget_info_by_name_c !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name INTEGER(HID_T) , INTENT(IN) :: loc_id CHARACTER(LEN=*), INTENT(IN) :: name INTEGER(SIZE_T) , INTENT(IN) :: namelen INTEGER(HID_T) , INTENT(IN) :: lapl_id_default - TYPE(C_PTR),value :: object_info + TYPE(C_PTR),VALUE :: object_info END FUNCTION h5oget_info_by_name_c END INTERFACE @@ -238,5 +239,222 @@ CONTAINS END SUBROUTINE H5Oget_info_by_name_f +!****s* H5O (F03)/h5oget_info_f_F03 +! +! NAME +! h5oget_info_f +! +! PURPOSE +! Retrieves the metadata for an object specified by an identifier. +! +! Inputs: +! object_id - Identifier for target object. +! +! Outputs: +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5oget_info_f(object_id, object_info, hdferr) + + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: object_id + TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info + INTEGER , INTENT(OUT) :: hdferr +!***** + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5oget_info_c(object_id, object_info) + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_C'::h5oget_info_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: object_id + TYPE(C_PTR), VALUE :: object_info + + END FUNCTION h5oget_info_c + END INTERFACE + + ptr = C_LOC(object_info) + hdferr = H5Oget_info_c(object_id, ptr) + + END SUBROUTINE H5Oget_info_f + +!****s* H5O (F03)/h5oget_info_by_idx_f_F03 +! +! NAME +! h5oget_info_by_idx_f +! +! PURPOSE +! Retrieves the metadata for an object, identifying the object by an index position. +! +! Inputs: +! loc_id - File or group identifier specifying location of group +! in which object is located. +! group_name - Name of group in which object is located. +! index_field - Index or field that determines the order. +! order - Order within field or index. +! n - Object for which information is to be returned +! +! Outputs: +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list. (Not currently used.) +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5oget_info_by_idx_f(loc_id, group_name, index_field, order, n, & + object_info, hdferr, lapl_id) + + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER , INTENT(IN) :: index_field + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + INTEGER :: corder_valid + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, & + index_field, order, n, lapl_id_default, object_info) + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_IDX_C'::h5oget_info_by_idx_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: group_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER , INTENT(IN) :: index_field + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(IN) :: lapl_id_default + TYPE(C_PTR), VALUE :: object_info + + END FUNCTION h5oget_info_by_idx_c + END INTERFACE + + namelen = LEN(group_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + ptr = C_LOC(object_info) + hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr) + + END SUBROUTINE H5Oget_info_by_idx_f + + +!****s* H5O (F03)/h5ovisit_by_name_f_F03 +! +! NAME +! h5ovisit_by_name_f +! +! PURPOSE +! Recursively visits all objects starting from a specified object. +! +! Inputs: +! loc_id - Identifier of a file or group. +! object_name - Name of the object, generally relative to loc_id, that will serve as root of the iteration +! index_type - Type of index; valid values include: +! H5_INDEX_NAME_F +! H5_INDEX_CRT_ORDER_F +! order - Order in which index is traversed; valid values include: +! H5_ITER_DEC_F +! H5_ITER_INC_F +! H5_ITER_NATIVE_F +! op - Callback function passing data regarding the group to the calling application +! op_data - User-defined pointer to data required by the application for its processing of the group +! +! Outputs: +! return_value - Returns the return value of the first operator that returns a positive value, or +! zero if all members were processed with no operator returning non-zero. +! hdferr - Returns 0 if successful and -1 if fails +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! AUTHOR +! M. Scot Breitenfeld +! November 19, 2008 +! +! Fortran2003 Interface: + SUBROUTINE h5ovisit_by_name_f(loc_id, object_name, index_type, order, op, op_data, & + return_value, hdferr, lapl_id) + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: object_name + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + + TYPE(C_FUNPTR) :: op + TYPE(C_PTR) :: op_data + INTEGER , INTENT(OUT) :: return_value + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & + op, op_data, lapl_id) + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OVISIT_BY_NAME_C'::h5ovisit_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: object_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: object_name + INTEGER(SIZE_T) :: namelen + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + TYPE(C_FUNPTR) , VALUE :: op + TYPE(C_PTR) , VALUE :: op_data + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5ovisit_by_name_c + END INTERFACE + + namelen = LEN(object_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + return_value = h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & + op, op_data, lapl_id_default) + + IF(return_value.GE.0)THEN + hdferr = 0 + ELSE + hdferr = -1 + END IF + + END SUBROUTINE h5ovisit_by_name_f + END MODULE H5O_PROVISIONAL diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 index d50e3b9..4254b7f 100644 --- a/fortran/src/H5Pff.f90 +++ b/fortran/src/H5Pff.f90 @@ -6419,3 +6419,5 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END MODULE H5P + + diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c index 86e0e61..0799e11 100644 --- a/fortran/src/H5Rf.c +++ b/fortran/src/H5Rf.c @@ -331,6 +331,47 @@ done: return ret_value; } /* end nh5rget_region_region_c() */ +/****if* H5Rf/h5rget_region_ptr_c + * NAME + * h5rget_region_ptr_c + * PURPOSE + * Call H5Rget_region to dereference dataspace region + * INPUTS + * dset_id - dataset identifier + * ref - reference to the dataset region + * OUTPUTS + * space_id - dereferenced dataset dataspace identifier + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * August 4, 2012 + * HISTORY + * + * SOURCE +*/ +int_f +nh5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id) +/******/ +{ + hid_t c_space_id; + hdset_reg_ref_t ref_c; + int_f ret_value = 0; + + /* + * Call H5Rget_region function. + */ + if((c_space_id = H5Rget_region((hid_t)*dset_id, H5R_DATASET_REGION, ref)) < 0) + HGOTO_DONE(FAIL) + + /* Copy the dataspace ID */ + *space_id = (hid_t_f)c_space_id; + +done: + return ret_value; +} /* end nh5rget_region_ptr_c() */ + + /****if* H5Rf/h5rget_object_type_obj_c * NAME * h5rget_object_type_obj_c diff --git a/fortran/src/H5Rff.f90 b/fortran/src/H5Rff.f90 index 35a3ed6..89ffc10 100644 --- a/fortran/src/H5Rff.f90 +++ b/fortran/src/H5Rff.f90 @@ -53,12 +53,6 @@ MODULE H5R ! END TYPE ! - INTERFACE h5rget_region_f - - MODULE PROCEDURE h5rget_region_region_f - - END INTERFACE - INTERFACE h5rget_object_type_f MODULE PROCEDURE h5rget_object_type_obj_f @@ -67,61 +61,6 @@ MODULE H5R CONTAINS -!****s* H5R/h5rget_region_region_f -! -! NAME -! h5rget_region_region_f -! -! PURPOSE -! Retrieves a dataspace with the specified region selected -! -! INPUTS -! dset_id - identifier of the dataset containing -! reference to the regions -! ref - reference to open -! OUTPUTS -! space_id - dataspace identifier -! hdferr - Returns 0 if successful and -1 if fails -! AUTHOR -! Elena Pourmal -! August 12, 1999 -! -! HISTORY -! Explicit Fortran interfaces were added for -! called C functions (it is needed for Windows -! port). February 28, 2001 -! -! NOTES -! This is a module procedure for the h5rget_region_f subroutine. -! -! SOURCE - SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr) - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier - TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference - INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier - INTEGER, INTENT(OUT) :: hdferr ! Error code -!***** - INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference - - INTERFACE - INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id) - USE H5GLOBAL - !DEC$IF DEFINED(HDF5F90_WINDOWS) - !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c - !DEC$ENDIF - INTEGER(HID_T), INTENT(IN) :: dset_id - ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 - INTEGER :: ref_f(REF_REG_BUF_LEN) - INTEGER(HID_T), INTENT(OUT) :: space_id - END FUNCTION h5rget_region_region_c - END INTERFACE - - ref_f = ref%ref - hdferr = h5rget_region_region_c(dset_id, ref_f, space_id ) - - END SUBROUTINE h5rget_region_region_f - !****s* H5R/h5rget_object_type_obj_f ! ! NAME diff --git a/fortran/src/H5Rff_F03.f90 b/fortran/src/H5Rff_F03.f90 index 7f66745..88ec8cf 100644 --- a/fortran/src/H5Rff_F03.f90 +++ b/fortran/src/H5Rff_F03.f90 @@ -37,6 +37,7 @@ !***** MODULE H5R_PROVISIONAL USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING ! If you change the value of these parameters, do not forget to change corresponding ! values in the H5f90.h file. @@ -51,6 +52,19 @@ MODULE H5R_PROVISIONAL ! INTEGER ref(REF_REG_BUF_LEN) ! END TYPE ! + + TYPE :: hdset_reg_ref_t_f03 + INTEGER(C_SIGNED_CHAR), DIMENSION(1:H5R_DSET_REG_REF_BUF_SIZE_F) :: ref + END TYPE hdset_reg_ref_t_f03 + + INTERFACE h5rget_region_f + + MODULE PROCEDURE h5rget_region_region_f ! obsolete + MODULE PROCEDURE h5rget_region_ptr_f ! F2003 + + END INTERFACE + + INTERFACE h5rcreate_f MODULE PROCEDURE h5rcreate_object_f ! obsolete @@ -123,8 +137,114 @@ MODULE H5R_PROVISIONAL END FUNCTION h5rcreate_ptr_c END INTERFACE + INTERFACE + INTEGER FUNCTION h5rget_region_ptr_c(dset_id, ref, space_id) + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_PTR_C':: h5rget_region_ptr_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dset_id + TYPE(C_PTR), VALUE :: ref + INTEGER(HID_T), INTENT(OUT) :: space_id + END FUNCTION h5rget_region_ptr_c + END INTERFACE + CONTAINS +!****s* H5R/h5rget_region_region_f +! +! NAME +! h5rget_region_region_f +! +! PURPOSE +! Retrieves a dataspace with the specified region selected +! +! INPUTS +! dset_id - identifier of the dataset containing +! reference to the regions +! ref - reference to open +! OUTPUTS +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! Elena Pourmal +! August 12, 1999 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). February 28, 2001 +! +! NOTES +! This is a module procedure for the h5rget_region_f subroutine. +! +! SOURCE + SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference + INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code +!***** + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference + + INTERFACE + INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dset_id + ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 + INTEGER :: ref_f(REF_REG_BUF_LEN) + INTEGER(HID_T), INTENT(OUT) :: space_id + END FUNCTION h5rget_region_region_c + END INTERFACE + + ref_f = ref%ref + hdferr = h5rget_region_region_c(dset_id, ref_f, space_id ) + + END SUBROUTINE h5rget_region_region_f + +!****s* H5R/h5rget_region_ptr_f +! +! NAME +! h5rget_region_ptr_f +! +! PURPOSE +! Retrieves a dataspace with the specified region +! selected using pointer +! +! INPUTS +! dset_id - identifier of the dataset containing +! reference to the regions +! ref - reference to open +! OUTPUTS +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! M. Scot Breitenfeld +! August 4, 2012 +! +! NOTES +! This is a module procedure for the h5rget_region_f subroutine. +! +! SOURCE + SUBROUTINE h5rget_region_ptr_f(dset_id, ref, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(C_PTR), INTENT(IN) :: ref ! Dataset region reference + INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code +!***** + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference + + hdferr = h5rget_region_ptr_c(dset_id, ref, space_id ) + + END SUBROUTINE h5rget_region_ptr_f + + !****s* H5R (F03)/h5rcreate_object_f ! ! NAME @@ -175,7 +295,7 @@ CONTAINS END SUBROUTINE h5rcreate_object_f -!****s* H5R (F03)/h5rcreate_region_f +!****s* H5R (F90)/h5rcreate_region_f ! ! NAME ! h5rcreate_region_f @@ -183,16 +303,15 @@ CONTAINS ! PURPOSE ! Creates reference to the dataset region ! -! Inputs: +! INPUTS ! loc_id - location identifier ! name - name of the dataset at the specified location ! space_id - dataspace identifier that describes selected region -! Outputs: +! OUTPUTS ! ref - reference to the dataset region ! hdferr: - error code ! Success: 0 ! Failure: -1 -! ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -205,46 +324,39 @@ CONTAINS ! NOTES ! This is a module procedure for the h5rcreate_f subroutine. ! -! Signature: +! SOURCE SUBROUTINE h5rcreate_region_f(loc_id, name, space_id, ref, hdferr) - USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: loc_id ! Location identifier CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the dataset at location specified ! by loc_id identifier INTEGER(HID_T), INTENT(IN) :: space_id ! Dataset's dataspace identifier - TYPE(hdset_reg_ref_t_f), INTENT(INOUT), TARGET :: ref ! Dataset region reference + TYPE(hdset_reg_ref_t_f), INTENT(OUT) :: ref ! Dataset region reference INTEGER, INTENT(OUT) :: hdferr ! Error code !***** INTEGER :: namelen ! Name length INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference - TYPE(C_PTR) :: f_ptr - -! !$ INTERFACE -! !$ INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id) -! !$ USE H5GLOBAL -! !$ !DEC$IF DEFINED(HDF5F90_WINDOWS) -! !$ !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c -! !$ !DEC$ENDIF -! !$ !DEC$ATTRIBUTES reference :: name -! !$ ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 -! !$ INTEGER :: ref_f(REF_REG_BUF_LEN) -! !$ INTEGER(HID_T), INTENT(IN) :: loc_id -! !$ CHARACTER(LEN=*), INTENT(IN) :: name -! !$ INTEGER :: namelen -! !$ INTEGER(HID_T), INTENT(IN) :: space_id -! !$ END FUNCTION h5rcreate_region_c -! !$ END INTERFACE - - f_ptr = C_LOC(ref) + INTERFACE + INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 + INTEGER :: ref_f(REF_REG_BUF_LEN) + INTEGER(HID_T), INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER :: namelen + INTEGER(HID_T), INTENT(IN) :: space_id + END FUNCTION h5rcreate_region_c + END INTERFACE namelen = LEN(name) - hdferr = h5rcreate_ptr_c(f_ptr, loc_id, name, namelen, 1, space_id) - -! !$ ref_f = 0 -! !$ hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id ) -! !$ ref%ref = ref_f + ref_f = 0 + hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id ) + ref%ref = ref_f END SUBROUTINE h5rcreate_region_f diff --git a/fortran/src/H5Rff_F90.f90 b/fortran/src/H5Rff_F90.f90 index 3f02825..0190e57 100644 --- a/fortran/src/H5Rff_F90.f90 +++ b/fortran/src/H5Rff_F90.f90 @@ -72,8 +72,73 @@ MODULE H5R_PROVISIONAL END INTERFACE + INTERFACE h5rget_region_f + + MODULE PROCEDURE h5rget_region_region_f + + END INTERFACE + + CONTAINS + +!****s* H5R/h5rget_region_region_f +! +! NAME +! h5rget_region_region_f +! +! PURPOSE +! Retrieves a dataspace with the specified region selected +! +! INPUTS +! dset_id - identifier of the dataset containing +! reference to the regions +! ref - reference to open +! OUTPUTS +! space_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! Elena Pourmal +! August 12, 1999 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). February 28, 2001 +! +! NOTES +! This is a module procedure for the h5rget_region_f subroutine. +! +! SOURCE + SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference + INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code +!***** + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference + + INTERFACE + INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: dset_id + ! INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 + INTEGER :: ref_f(REF_REG_BUF_LEN) + INTEGER(HID_T), INTENT(OUT) :: space_id + END FUNCTION h5rget_region_region_c + END INTERFACE + + ref_f = ref%ref + hdferr = h5rget_region_region_c(dset_id, ref_f, space_id ) + + END SUBROUTINE h5rget_region_region_f + + + !****s* H5R (F90)/h5rcreate_object_f ! ! NAME diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 7b55384..4c85df2 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -398,7 +398,11 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5e_flags, hid_t_f *h5e_hid_flags, int h5d_flags[19] = (int_f)H5D_CHUNK_CACHE_NSLOTS_DEFAULT; h5d_flags[20] = (int_f)H5D_CHUNK_CACHE_NBYTES_DEFAULT; h5d_flags[21] = (int_f)H5D_CHUNK_CACHE_W0_DEFAULT; - + h5d_flags[22] = (int_f)H5D_MPIO_NO_COLLECTIVE; + h5d_flags[23] = (int_f)H5D_MPIO_CHUNK_INDEPENDENT; + h5d_flags[24] = (int_f)H5D_MPIO_CHUNK_COLLECTIVE; + h5d_flags[25] = (int_f)H5D_MPIO_CHUNK_MIXED; + h5d_flags[26] = (int_f)H5D_MPIO_CONTIGUOUS_COLLECTIVE; /* * H5E flags */ diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90 index 3d4f7f8..a6168d52 100644 --- a/fortran/src/H5f90global.f90 +++ b/fortran/src/H5f90global.f90 @@ -354,7 +354,7 @@ MODULE H5GLOBAL ! H5D flags declaration ! - INTEGER, PARAMETER :: H5D_FLAGS_LEN = 22 + INTEGER, PARAMETER :: H5D_FLAGS_LEN = 27 INTEGER H5D_flags(H5D_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) !DEC$ATTRIBUTES DLLEXPORT :: /H5D_FLAGS/ @@ -387,10 +387,17 @@ MODULE H5GLOBAL ! shortened "_DEFAULT" to "_DFLT" to satisfy the limit of 31 ! characters for variable names in Fortran. +! shortened "_CONTIGUOUS" to "_CONTIG" to satisfy the limit of 31 +! characters for variable names in Fortran. INTEGER :: H5D_CHUNK_CACHE_NSLOTS_DFLT_F INTEGER :: H5D_CHUNK_CACHE_NBYTES_DFLT_F INTEGER :: H5D_CHUNK_CACHE_W0_DFLT_F + INTEGER :: H5D_MPIO_NO_COLLECTIVE_F + INTEGER :: H5D_MPIO_CHUNK_INDEPENDENT_F + INTEGER :: H5D_MPIO_CHUNK_COLLECTIVE_F + INTEGER :: H5D_MPIO_CHUNK_MIXED_F + INTEGER :: H5D_MPIO_CONTIG_COLLECTIVE_F EQUIVALENCE(H5D_flags(1), H5D_COMPACT_F) EQUIVALENCE(H5D_flags(2), H5D_CONTIGUOUS_F) @@ -419,6 +426,11 @@ MODULE H5GLOBAL EQUIVALENCE(H5D_flags(20), H5D_CHUNK_CACHE_NSLOTS_DFLT_F) EQUIVALENCE(H5D_flags(21), H5D_CHUNK_CACHE_NBYTES_DFLT_F) EQUIVALENCE(H5D_flags(22), H5D_CHUNK_CACHE_W0_DFLT_F) + EQUIVALENCE(H5D_flags(23), H5D_MPIO_NO_COLLECTIVE_F) + EQUIVALENCE(H5D_flags(24), H5D_MPIO_CHUNK_INDEPENDENT_F) + EQUIVALENCE(H5D_flags(25), H5D_MPIO_CHUNK_COLLECTIVE_F) + EQUIVALENCE(H5D_flags(26), H5D_MPIO_CHUNK_MIXED_F) + EQUIVALENCE(H5D_flags(27), H5D_MPIO_CONTIG_COLLECTIVE_F) ! ! H5E flags declaration diff --git a/fortran/src/H5f90kit.c b/fortran/src/H5f90kit.c index 059685e..0bc721f 100644 --- a/fortran/src/H5f90kit.c +++ b/fortran/src/H5f90kit.c @@ -53,7 +53,7 @@ HD5f2cstring(_fcd fdesc, size_t len) /* Search for the end of the string */ str = _fcdtocp(fdesc); - for(i = (int)len - 1; i >= 0 && !HDisgraph((int)str[i]); i--) + for(i = (int)len - 1; i >= 0 && HDisspace((int)str[i]) && str[i] == ' '; i--) /*EMPTY*/; /* Allocate C string */ diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index d0a8361..9340c2a 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -61,7 +61,7 @@ typedef struct H5O_hdr_info_t_f { typedef struct H5O_info_t_f { unsigned long fileno; /* File number that object is located in */ haddr_t_f addr; /* Object address in file */ - int_f type; /* Basic object type (group, dataset, etc.) */ + int type; /* Basic object type (group, dataset, etc.) */ int_f rc; /* Reference count of object */ int_f atime[8]; /* Access time */ int_f mtime[8]; /* Modification time */ @@ -806,11 +806,21 @@ H5_FCDLL int_f nh5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, #define nh5olink_c H5_FC_FUNC_(h5olink_c, H5OLINK_C) #define nh5oopen_c H5_FC_FUNC_(h5oopen_c, H5OOPEN_C) #define nh5oclose_c H5_FC_FUNC_(h5oclose_c, H5OCLOSE_C) -#define nh5ovisit_c H5_FC_FUNC_(h5ovisit_c,H5OVISIT_C) +#define nh5ovisit_c H5_FC_FUNC_(h5ovisit_c, H5OVISIT_C) +#define nh5ovisit_by_name_c H5_FC_FUNC_(h5ovisit_by_name_c, H5OVISIT_BY_NAME_C) +#define nh5oget_info_c H5_FC_FUNC_(h5oget_info_c, H5OGET_INFO_C) +#define nh5oget_info_by_idx_c H5_FC_FUNC_(h5oget_info_by_idx_c ,H5OGET_INFO_BY_IDX_C) #define nh5oget_info_by_name_c H5_FC_FUNC_(h5oget_info_by_name_c ,H5OGET_INFO_BY_NAME_C) #define nh5oopen_by_addr_c H5_FC_FUNC_(h5oopen_by_addr_c, H5OOPEN_BY_ADDR_C) #define nh5ocopy_c H5_FC_FUNC_(h5ocopy_c, H5OCOPY_C) - +#define nh5odecr_refcount_c H5_FC_FUNC_(h5odecr_refcount_c, H5ODECR_REFCOUNT_C) +#define nh5oincr_refcount_c H5_FC_FUNC_(h5oincr_refcount_c, H5OINCR_REFCOUNT_C) +#define nh5oexists_by_name_c H5_FC_FUNC_(h5oexists_by_name_c, H5OEXISTS_BY_NAME_C) +#define nh5oset_comment_c H5_FC_FUNC_(h5oset_comment_c, H5OSET_COMMENT_C) +#define nh5oset_comment_by_name_c H5_FC_FUNC_(h5oset_comment_by_name_c, H5OSET_COMMENT_BY_NAME_C) +#define nh5oopen_by_idx_c H5_FC_FUNC_(h5oopen_by_idx_c, H5OOPEN_BY_IDX_C) +#define nh5oget_comment_c H5_FC_FUNC_(h5oget_comment_c, H5OGET_COMMENT_C) +#define nh5oget_comment_by_name_c H5_FC_FUNC_(h5oget_comment_by_name_c, H5OGET_COMMENT_BY_NAME_C) H5_FCDLL int_f nh5oopen_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_t_f *obj_id); H5_FCDLL int_f nh5oclose_c (hid_t_f *object_id ); @@ -818,11 +828,26 @@ H5_FCDLL int_f nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *ob H5_FCDLL int_f nh5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id); H5_FCDLL int_f nh5ovisit_c (hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data); -H5_FCDLL int_f nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen,hid_t_f *lapl_id, +H5_FCDLL int_f nh5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, + H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ); +H5_FCDLL int_f nh5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info); +H5_FCDLL int_f nh5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info); +H5_FCDLL int_f nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, H5O_info_t_f *object_info); H5_FCDLL int_f nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len, hid_t_f *ocpypl_id, hid_t_f *lcpl_id ); +H5_FCDLL int_f nh5odecr_refcount_c (hid_t_f *object_id); +H5_FCDLL int_f nh5oincr_refcount_c (hid_t_f *object_id); +H5_FCDLL int_f nh5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id); +H5_FCDLL int_f nh5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen); +H5_FCDLL int_f nh5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id); +H5_FCDLL int_f nh5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id); +H5_FCDLL int_f nh5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize); +H5_FCDLL int_f nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, + _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id); /* * Functions from H5Pf.c */ @@ -982,6 +1007,7 @@ H5_FCDLL int_f nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_nam #define nh5pget_nlinks_c H5_FC_FUNC_(h5pget_nlinks_c, H5PGET_NLINKS_C) #define nh5pset_chunk_cache_c H5_FC_FUNC_(h5pset_chunk_cache_c, H5PSET_CHUNK_CACHE_C) #define nh5pget_chunk_cache_c H5_FC_FUNC_(h5pget_chunk_cache_c, H5PGET_CHUNK_CACHE_C) +#define nh5pget_mpio_actual_io_mode_c H5_FC_FUNC_(h5pget_mpio_actual_io_mode_c, H5PGET_MPIO_ACTUAL_IO_MODE_C) H5_FCDLL int_f nh5pcreate_c ( hid_t_f *cls, hid_t_f *prp_id ); H5_FCDLL int_f nh5pclose_c ( hid_t_f *prp_id ); @@ -1142,6 +1168,7 @@ H5_FCDLL int_f nh5pset_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks); H5_FCDLL int_f nh5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks); H5_FCDLL int_f nh5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0); H5_FCDLL int_f nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nbytes, real_f *rdcc_w0); +H5_FCDLL int_f nh5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode); /* * Functions frome H5Rf.c */ @@ -1152,6 +1179,7 @@ H5_FCDLL int_f nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, si #define nh5rdereference_object_c H5_FC_FUNC_(h5rdereference_object_c, H5RDEREFERENCE_OBJECT_C) #define nh5rdereference_ptr_c H5_FC_FUNC_(h5rdereference_ptr_c, H5RDEREFERENCE_PTR_C) #define nh5rget_region_region_c H5_FC_FUNC_(h5rget_region_region_c, H5RGET_REGION_REGION_C) +#define nh5rget_region_ptr_c H5_FC_FUNC_(h5rget_region_ptr_c, H5RGET_REGION_PTR_C) #define nh5rget_object_type_obj_c H5_FC_FUNC_(h5rget_object_type_obj_c, H5RGET_OBJECT_TYPE_OBJ_C) #define nh5rget_name_object_c H5_FC_FUNC_(h5rget_name_object_c, H5RGET_NAME_OBJECT_C) #define nh5rget_name_region_c H5_FC_FUNC_(h5rget_name_region_c, H5RGET_NAME_REGION_C) @@ -1166,6 +1194,7 @@ H5_FCDLL int_f nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f * H5_FCDLL int_f nh5rdereference_object_c (hid_t_f *dset_id, haddr_t_f *ref, hid_t_f *obj_id); H5_FCDLL int_f nh5rdereference_ptr_c (hid_t_f *obj_id, int_f *ref_type, void *ref, hid_t_f *ref_obj_id); H5_FCDLL int_f nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id); +H5_FCDLL int_f nh5rget_region_ptr_c(hid_t_f *dset_id, void *ref, hid_t_f *space_id); H5_FCDLL int_f nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type); H5_FCDLL int_f nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default); H5_FCDLL int_f nh5rget_name_region_c (hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default); diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 61504ec..4c83d21 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -533,7 +533,21 @@ int main(void) /* double_f */ #if defined H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND - writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND); + if(H5_C_HAS_REAL_NATIVE_16 != 0) { /* Check if C has 16 byte floats */ + writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND); + } else { +#if defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND /* Fall back to 8 byte floats */ + writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_REAL_NATIVE_8_KIND); + } +#elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND /* Fall back to 4 byte floats */ + writeFloatToFiles("Fortran_DOUBLE", "double_f", 4, H5_FORTRAN_HAS_REAL_NATIVE_4_KIND); + } +#else + /* Error: couldn't find a size for double_f when fortran has 16 byte reals */ + return -1; + } +#endif + #elif defined H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND); #else @@ -541,6 +555,14 @@ int main(void) return -1; #endif + /* Need the buffer size for the fortran derive type 'hdset_reg_ref_t_f03' + * in order to be interoperable with C's structure, the C buffer size + * H5R_DSET_REG_REF_BUF_SIZE is (sizeof(haddr_t)+4) + */ + + fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 ); + + /* Close files */ endCfile(); endFfile(); diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 069846a5..c2cd64c 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -517,7 +517,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 = 121 +LT_VERS_REVISION = 127 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/fortran/src/hdf5_fortrandll.def b/fortran/src/hdf5_fortrandll.def deleted file mode 100644 index 29e83f5..0000000 --- a/fortran/src/hdf5_fortrandll.def +++ /dev/null @@ -1,528 +0,0 @@ -EXPORTS -; H5LIB -H5LIB_mp_H5OPEN_F -H5LIB_mp_H5CLOSE_F -H5LIB_mp_H5GET_LIBVERSION_F -H5LIB_mp_H5CHECK_VERSION_F -H5LIB_mp_H5GARBAGE_COLLECT_F -H5LIB_mp_H5DONT_ATEXIT_F -; H5_DBLE_INTERFACE -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5DFILL_DOUBLE -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5PGET_DOUBLE -H5_DBLE_INTERFACE_mp_H5PSET_DOUBLE -H5_DBLE_INTERFACE_mp_H5PSET_FILL_VALUE_DOUBLE -H5_DBLE_INTERFACE_mp_H5PGET_FILL_VALUE_DOUBLE -H5_DBLE_INTERFACE_mp_H5PINSERT_DOUBLE -H5_DBLE_INTERFACE_mp_H5PREGISTER_DOUBLE -; H5A -H5A_mp_H5ACREATE_F -H5A_mp_H5AOPEN_NAME_F -H5A_mp_H5AOPEN_IDX_F -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_SCALAR -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_1 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_2 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_3 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_4 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_5 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_6 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_7 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_SCALAR -H5A_PROVISIONAL_mp_H5AWRITE_REAL_1 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_2 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_3 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_4 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_5 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_6 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_7 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_SCALAR -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_1 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_2 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_3 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_4 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_5 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_6 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_7 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_SCALAR -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_1 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_2 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_3 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_4 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_5 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_6 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_7 -H5A_PROVISIONAL_mp_H5AREAD_REAL_SCALAR -H5A_PROVISIONAL_mp_H5AREAD_REAL_1 -H5A_PROVISIONAL_mp_H5AREAD_REAL_2 -H5A_PROVISIONAL_mp_H5AREAD_REAL_3 -H5A_PROVISIONAL_mp_H5AREAD_REAL_4 -H5A_PROVISIONAL_mp_H5AREAD_REAL_5 -H5A_PROVISIONAL_mp_H5AREAD_REAL_6 -H5A_PROVISIONAL_mp_H5AREAD_REAL_7 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_SCALAR -H5A_PROVISIONAL_mp_H5AREAD_CHAR_1 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_2 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_3 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_4 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_5 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_6 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_7 -H5A_mp_H5AGET_SPACE_F -H5A_mp_H5AGET_TYPE_F -H5A_mp_H5AGET_NAME_F -H5A_mp_H5AGET_NAME_BY_IDX_F -H5A_mp_H5AGET_NUM_ATTRS_F -H5A_mp_H5ADELETE_F -H5A_mp_H5ACLOSE_F -H5A_mp_H5AGET_STORAGE_SIZE_F -H5A_mp_H5AGET_CREATE_PLIST_F -H5A_mp_H5ARENAME_BY_NAME_F -H5A_mp_H5AOPEN_F -H5A_mp_H5ADELETE_BY_IDX_F -H5A_mp_H5ADELETE_BY_NAME_F -H5A_mp_H5AOPEN_BY_IDX_F -H5A_mp_H5AGET_INFO_F -H5A_mp_H5AGET_INFO_BY_IDX_F -H5A_mp_H5AGET_INFO_BY_NAME_F -H5A_mp_H5ACREATE_BY_NAME_F -H5A_mp_H5AEXISTS_F -H5A_mp_H5AEXISTS_BY_NAME_F -H5A_mp_H5AOPEN_BY_NAME_F -H5A_mp_H5ARENAME_F -; H5D -H5D_mp_H5DCREATE_F -H5D_mp_H5DOPEN_F -H5D_mp_H5DCLOSE_F -H5D_PROVISIONAL_mp_H5DWRITE_REFERENCE_OBJ -H5D_PROVISIONAL_mp_H5DWRITE_REFERENCE_DSETREG -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_SCALAR -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_1 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_2 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_3 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_4 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_5 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_6 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_7 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_SCALAR -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_1 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_2 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_3 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_4 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_5 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_6 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_7 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_SCALAR -H5D_PROVISIONAL_mp_H5DWRITE_REAL_1 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_2 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_3 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_4 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_5 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_6 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_7 -H5D_PROVISIONAL_mp_H5DREAD_REFERENCE_OBJ -H5D_PROVISIONAL_mp_H5DREAD_REFERENCE_DSETREG -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_SCALAR -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_1 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_2 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_3 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_4 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_5 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_6 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_7 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_SCALAR -H5D_PROVISIONAL_mp_H5DREAD_CHAR_1 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_2 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_3 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_4 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_5 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_6 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_7 -H5D_PROVISIONAL_mp_H5DREAD_REAL_SCALAR -H5D_PROVISIONAL_mp_H5DREAD_REAL_1 -H5D_PROVISIONAL_mp_H5DREAD_REAL_2 -H5D_PROVISIONAL_mp_H5DREAD_REAL_3 -H5D_PROVISIONAL_mp_H5DREAD_REAL_4 -H5D_PROVISIONAL_mp_H5DREAD_REAL_5 -H5D_PROVISIONAL_mp_H5DREAD_REAL_6 -H5D_PROVISIONAL_mp_H5DREAD_REAL_7 -H5D_mp_H5DGET_SPACE_F -H5D_mp_H5DGET_TYPE_F -H5D_mp_H5DSET_EXTENT_F -H5D_mp_H5DGET_CREATE_PLIST_F -H5D_mp_H5DGET_STORAGE_SIZE_F -H5D_mp_H5DVLEN_GET_MAX_LEN_F -H5D_mp_H5DWRITE_VL_INTEGER -H5D_mp_H5DREAD_VL_INTEGER -H5D_mp_H5DWRITE_VL_REAL -H5D_mp_H5DREAD_VL_REAL -H5D_mp_H5DWRITE_VL_STRING -H5D_mp_H5DREAD_VL_STRING -H5D_PROVISIONAL_mp_H5DFILL_INTEGER -H5D_PROVISIONAL_mp_H5DFILL_REAL -H5D_PROVISIONAL_mp_H5DFILL_CHAR -H5D_mp_H5DGET_SPACE_STATUS_F -H5D_mp_H5DCREATE_ANON_F -H5D_mp_H5DGET_SPACE_F -H5D_mp_H5DGET_TYPE_F -H5D_mp_H5DSET_EXTENT_F -H5D_mp_H5DGET_CREATE_PLIST_F -H5D_mp_H5DGET_STORAGE_SIZE_F -H5D_mp_H5DVLEN_GET_MAX_LEN_F -H5D_mp_H5DGET_ACCESS_PLIST_F -; H5E -H5E_mp_H5ECLEAR_F -H5E_mp_H5EPRINT_F -H5E_mp_H5EGET_MAJOR_F -H5E_mp_H5EGET_MINOR_F -H5E_PROVISIONAL_mp_H5ESET_AUTO_F -; H5F -H5F_mp_H5FCREATE_F -H5F_mp_H5FFLUSH_F -H5F_mp_H5FCLOSE_F -H5F_mp_H5FGET_OBJ_COUNT_F -H5F_mp_H5FGET_OBJ_IDS_F -H5F_mp_H5FGET_FREESPACE_F -H5F_mp_H5FMOUNT_F -H5F_mp_H5FUNMOUNT_F -H5F_mp_H5FOPEN_F -H5F_mp_H5FREOPEN_F -H5F_mp_H5FGET_CREATE_PLIST_F -H5F_mp_H5FGET_ACCESS_PLIST_F -H5F_mp_H5FIS_HDF5_F -H5F_mp_H5FGET_NAME_F -H5F_mp_H5FGET_FILESIZE_F -; H5G -H5G_mp_H5GOPEN_F -H5G_mp_H5GCREATE_F -H5G_mp_H5GCLOSE_F -H5G_mp_H5GGET_OBJ_INFO_IDX_F -H5G_mp_H5GN_MEMBERS_F -H5G_mp_H5GLINK_F -H5G_mp_H5GLINK2_F -H5G_mp_H5GUNLINK_F -H5G_mp_H5GMOVE_F -H5G_mp_H5GMOVE2_F -H5G_mp_H5GGET_LINKVAL_F -H5G_mp_H5GSET_COMMENT_F -H5G_mp_H5GGET_COMMENT_F -H5G_mp_H5GCREATE_ANON_F -H5G_mp_H5GGET_CREATE_PLIST_F -H5G_mp_H5GGET_INFO_F -H5G_mp_H5GGET_INFO_BY_IDX_F -H5G_mp_H5GGET_INFO_BY_NAME_F -H5G_mp_H5GGET_OBJ_INFO_IDX_F -; H5GLOBAL -; PREDEFINED_TYPES DATA -; FLOATING_TYPES DATA -; INTEGER_TYPES DATA -; H5F_FLAGS DATA -; H5GENERIC_FLAGS DATA -; H5G_FLAGS DATA -; H5D_FLAGS DATA -; H5FD_FLAGS DATA -; H5FD_HID_FLAGS DATA -; H5I_FLAGS DATA -; H5L_FLAGS DATA -; H5O_FLAGS DATA -; H5P_FLAGS DATA -; H5P_FLAGS_INT DATA -; H5R_FLAGS DATA -; H5S_FLAGS DATA -; H5T_FLAGS DATA -; H5Z_FLAGS DATA -; H5LIB_FLAGS DATA -; H5I -H5I_mp_H5IGET_TYPE_F -H5I_mp_H5IGET_NAME_F -H5I_mp_H5IINC_REF_F -H5I_mp_H5IDEC_REF_F -H5I_mp_H5IGET_REF_F -H5I_mp_H5IGET_FILE_ID_F -H5I_mp_H5IIS_VALID_F -; H5L -H5L_mp_H5LCOPY_F -H5L_mp_H5LDELETE_F -H5L_mp_H5LCREATE_SOFT_F -H5L_mp_H5LCREATE_HARD_F -H5L_mp_H5LCREATE_EXTERNAL_F -H5L_mp_H5LDELETE_BY_IDX_F -H5L_mp_H5LEXISTS_F -H5L_mp_H5LGET_INFO_F -H5L_mp_H5LGET_INFO_BY_IDX_F -H5L_mp_H5LIS_REGISTERED_F -H5L_mp_H5LMOVE_F -H5L_mp_H5LGET_NAME_BY_IDX_F -; H5O -H5O_mp_H5OCOPY_F -H5O_mp_H5OLINK_F -H5O_mp_H5OOPEN_F -H5O_mp_H5OOPEN_BY_ADDR_F -; H5P -H5P_mp_H5PCREATE_F -H5P_mp_H5PSET_PRESERVE_F -H5P_mp_H5PGET_PRESERVE_F -H5P_mp_H5PGET_CLASS_F -H5P_mp_H5PCOPY_F -H5P_mp_H5PCLOSE_F -H5P_mp_H5PSET_CHUNK_F -H5P_mp_H5PGET_CHUNK_F -H5P_mp_H5PSET_DEFLATE_F -H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_INTEGER -H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_INTEGER -H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_REAL -H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_REAL -H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_CHAR -H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_CHAR -H5P_mp_H5PGET_VERSION_F -H5P_mp_H5PSET_USERBLOCK_F -H5P_mp_H5PGET_USERBLOCK_F -H5P_mp_H5PSET_SIZES_F -H5P_mp_H5PGET_SIZES_F -H5P_mp_H5PSET_SYM_K_F -H5P_mp_H5PGET_SYM_K_F -H5P_mp_H5PSET_ISTORE_K_F -H5P_mp_H5PGET_ISTORE_K_F -H5P_mp_H5PGET_DRIVER_F -H5P_mp_H5PSET_FAPL_STDIO_F -H5P_mp_H5PSET_FAPL_SEC2_F -H5P_mp_H5PSET_ALIGNMENT_F -H5P_mp_H5PGET_ALIGNMENT_F -H5P_mp_H5PSET_FAPL_CORE_F -H5P_mp_H5PGET_FAPL_CORE_F -H5P_mp_H5PSET_FAPL_FAMILY_F -H5P_mp_H5PGET_FAPL_FAMILY_F -H5P_mp_H5PSET_CACHE_F -H5P_mp_H5PGET_CACHE_F -H5P_mp_H5PSET_FAPL_SPLIT_F -H5P_mp_H5PSET_GC_REFERENCES_F -H5P_mp_H5PGET_GC_REFERENCES_F -H5P_mp_H5PSET_LAYOUT_F -H5P_mp_H5PGET_LAYOUT_F -H5P_mp_H5PSET_FILTER_F -H5P_mp_H5PGET_NFILTERS_F -H5P_mp_H5PGET_FILTER_F -H5P_mp_H5PSET_EXTERNAL_F -H5P_mp_H5PGET_EXTERNAL_COUNT_F -H5P_mp_H5PGET_EXTERNAL_F -H5P_mp_H5PSET_BTREE_RATIOS_F -H5P_mp_H5PGET_BTREE_RATIOS_F -H5P_mp_H5PGET_FCLOSE_DEGREE_F -H5P_mp_H5PSET_FCLOSE_DEGREE_F -H5P_mp_H5PEQUAL_F -H5P_mp_H5PSET_BUFFER_F -H5P_mp_H5PGET_BUFFER_F -H5P_mp_H5PFILL_VALUE_DEFINED_F -H5P_mp_H5PSET_ALLOC_TIME_F -H5P_mp_H5PGET_ALLOC_TIME_F -H5P_mp_H5PSET_FILL_TIME_F -H5P_mp_H5PGET_FILL_TIME_F -H5P_mp_H5PSET_META_BLOCK_SIZE_F -H5P_mp_H5PGET_META_BLOCK_SIZE_F -H5P_mp_H5PSET_SIEVE_BUF_SIZE_F -H5P_mp_H5PGET_SIEVE_BUF_SIZE_F -H5P_mp_H5PSET_SMALL_DATA_BLOCK_SIZE_F -H5P_mp_H5PGET_SMALL_DATA_BLOCK_SIZE_F -H5P_mp_H5PSET_HYPER_VECTOR_SIZE_F -H5P_mp_H5PGET_HYPER_VECTOR_SIZE_F -H5P_PROVISIONAL_mp_H5PSET_INTEGER -H5P_PROVISIONAL_mp_H5PSET_REAL -H5P_PROVISIONAL_mp_H5PSET_CHAR -H5P_PROVISIONAL_mp_H5PGET_INTEGER -H5P_PROVISIONAL_mp_H5PGET_REAL -H5P_PROVISIONAL_mp_H5PGET_CHAR -H5P_mp_H5PEXIST_F -H5P_mp_H5PGET_SIZE_F -H5P_mp_H5PGET_NPROPS_F -H5P_mp_H5PGET_CLASS_NAME_F -H5P_mp_H5PGET_CLASS_PARENT_F -H5P_mp_H5PISA_CLASS_F -H5P_mp_H5PCOPY_PROP_F -H5P_mp_H5PREMOVE_F -H5P_mp_H5PUNREGISTER_F -H5P_mp_H5PCLOSE_CLASS_F -H5P_PROVISIONAL_mp_H5PCREATE_CLASS_F -H5P_PROVISIONAL_mp_H5PREGISTER_INTEGER -H5P_PROVISIONAL_mp_H5PREGISTER_REAL -H5P_PROVISIONAL_mp_H5PREGISTER_CHAR -H5P_PROVISIONAL_mp_H5PINSERT_INTEGER -H5P_PROVISIONAL_mp_H5PINSERT_REAL -H5P_PROVISIONAL_mp_H5PINSERT_CHAR -H5P_mp_H5PSET_SHUFFLE_F -H5P_mp_H5PSET_EDC_CHECK_F -H5P_mp_H5PGET_EDC_CHECK_F -H5P_mp_H5PSET_FLETCHER32_F -H5P_mp_H5PSET_FAMILY_OFFSET_F -H5P_mp_H5PSET_FAPL_MULTI_L -H5P_mp_H5PSET_FAPL_MULTI_S -H5P_mp_H5PGET_FAPL_MULTI_F -H5P_mp_H5PSET_SZIP_F -H5P_mp_H5PALL_FILTERS_AVAIL_F -H5P_mp_H5PGET_FILTER_BY_ID_F -H5P_mp_H5PMODIFY_FILTER_F -H5P_mp_H5PREMOVE_FILTER_F -H5P_mp_H5PGET_ATTR_PHASE_CHANGE_F -H5P_mp_H5PSET_ATTR_CREATION_ORDER_F -H5P_mp_H5PSET_SHARED_MESG_NINDEXES_F -H5P_mp_H5PSET_SHARED_MESG_INDEX_F -H5P_mp_H5PGET_ATTR_CREATION_ORDER_F -H5P_mp_H5PSET_LIBVER_BOUNDS_F -H5P_mp_H5PSET_LINK_CREATION_ORDER_F -H5P_mp_H5PGET_LINK_PHASE_CHANGE_F -H5P_mp_H5PGET_OBJ_TRACK_TIMES_F -H5P_mp_H5PSET_OBJ_TRACK_TIMES_F -H5P_mp_H5PSET_CREATE_INTER_GROUP_F -H5P_mp_H5PGET_LINK_CREATION_ORDER_F -H5P_mp_H5PSET_CHAR_ENCODING_F -H5P_mp_H5PGET_CHAR_ENCODING_F -H5P_mp_H5PSET_COPY_OBJECT_F -H5P_mp_H5PGET_COPY_OBJECT_F -H5P_mp_H5PGET_DATA_TRANSFORM_F -H5P_mp_H5PSET_DATA_TRANSFORM_F -H5P_mp_H5PGET_LOCAL_HEAP_SIZE_HINT_F -H5P_mp_H5PGET_EST_LINK_INFO_F -H5P_mp_H5PSET_LOCAL_HEAP_SIZE_HINT_F -H5P_mp_H5PSET_EST_LINK_INFO_F -H5P_mp_H5PSET_LINK_PHASE_CHANGE_F -H5P_mp_H5PSET_FAPL_DIRECT_F -H5P_mp_H5PGET_FAPL_DIRECT_F -H5P_mp_H5PSET_ATTR_PHASE_CHANGE_F -H5P_mp_H5PSET_NBIT_F -H5P_mp_H5PSET_SCALEOFFSET_F -H5P_mp_H5PSET_NLINKS_F -H5P_mp_H5PGET_NLINKS_F -H5P_mp_H5PGET_CREATE_INTER_GROUP_F -H5P_mp_H5PSET_CHUNK_CACHE_F -H5P_mp_H5PGET_CHUNK_CACHE_F -; H5R -H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F -H5R_PROVISIONAL_mp_H5RCREATE_REGION_F -H5R_PROVISIONAL_mp_H5RDEREFERENCE_OBJECT_F -H5R_PROVISIONAL_mp_H5RDEREFERENCE_REGION_F -H5R_mp_H5RGET_REGION_REGION_F -H5R_mp_H5RGET_OBJECT_TYPE_OBJ_F -H5R_PROVISIONAL_mp_H5RGET_NAME_OBJECT_F -H5R_PROVISIONAL_mp_H5RGET_NAME_REGION_F -; H5S -H5S_mp_H5SCREATE_SIMPLE_F -H5S_mp_H5SCLOSE_F -H5S_mp_H5SCREATE_F -H5S_mp_H5SCOPY_F -H5S_mp_H5SGET_SELECT_HYPER_NBLOCKS_F -H5S_mp_H5SGET_SELECT_HYPER_BLOCKLIST_F -H5S_mp_H5SGET_SELECT_BOUNDS_F -H5S_mp_H5SGET_SELECT_ELEM_NPOINTS_F -H5S_mp_H5SGET_SELECT_ELEM_POINTLIST_F -H5S_mp_H5SSELECT_ELEMENTS_F -H5S_mp_H5SSELECT_ALL_F -H5S_mp_H5SSELECT_NONE_F -H5S_mp_H5SSELECT_VALID_F -H5S_mp_H5SGET_SIMPLE_EXTENT_NPOINTS_F -H5S_mp_H5SGET_SELECT_NPOINTS_F -H5S_mp_H5SGET_SIMPLE_EXTENT_NDIMS_F -H5S_mp_H5SGET_SIMPLE_EXTENT_DIMS_F -H5S_mp_H5SGET_SIMPLE_EXTENT_TYPE_F -H5S_mp_H5SSET_EXTENT_SIMPLE_F -H5S_mp_H5SIS_SIMPLE_F -H5S_mp_H5SOFFSET_SIMPLE_F -H5S_mp_H5SEXTENT_COPY_F -H5S_mp_H5SSET_EXTENT_NONE_F -H5S_mp_H5SSELECT_HYPERSLAB_F -H5S_mp_H5SGET_SELECT_TYPE_F -H5S_mp_H5SDECODE_F -H5S_mp_H5SENCODE_F -H5S_mp_H5SEXTENT_EQUAL_F -; H5T -H5T_mp_H5TOPEN_F -H5T_mp_H5TCOMMIT_F -H5T_mp_H5TCOPY_F -H5T_mp_H5TEQUAL_F -H5T_mp_H5TCLOSE_F -H5T_mp_H5TGET_CLASS_F -H5T_mp_H5TGET_SIZE_F -H5T_mp_H5TSET_SIZE_F -H5T_mp_H5TGET_ORDER_F -H5T_mp_H5TSET_ORDER_F -H5T_mp_H5TGET_PRECISION_F -H5T_mp_H5TSET_PRECISION_F -H5T_mp_H5TGET_OFFSET_F -H5T_mp_H5TSET_OFFSET_F -H5T_mp_H5TGET_PAD_F -H5T_mp_H5TSET_PAD_F -H5T_mp_H5TGET_SIGN_F -H5T_mp_H5TSET_SIGN_F -H5T_mp_H5TGET_FIELDS_F -H5T_mp_H5TSET_FIELDS_F -H5T_mp_H5TGET_EBIAS_F -H5T_mp_H5TSET_EBIAS_F -H5T_mp_H5TGET_NORM_F -H5T_mp_H5TSET_NORM_F -H5T_mp_H5TGET_INPAD_F -H5T_mp_H5TSET_INPAD_F -H5T_mp_H5TGET_CSET_F -H5T_mp_H5TSET_CSET_F -H5T_mp_H5TGET_STRPAD_F -H5T_mp_H5TSET_STRPAD_F -H5T_mp_H5TGET_NMEMBERS_F -H5T_mp_H5TGET_MEMBER_NAME_F -H5T_mp_H5TGET_MEMBER_OFFSET_F -H5T_mp_H5TGET_MEMBER_INDEX_F -H5T_mp_H5TGET_ARRAY_DIMS_F -H5T_mp_H5TGET_ARRAY_NDIMS_F -H5T_mp_H5TGET_SUPER_F -H5T_mp_H5TGET_MEMBER_TYPE_F -H5T_mp_H5TCREATE_F -H5T_mp_H5TINSERT_F -H5T_mp_H5TPACK_F -H5T_mp_H5TARRAY_CREATE_F -H5T_mp_H5TENUM_CREATE_F -H5T_mp_H5TENUM_INSERT_F -H5T_mp_H5TENUM_NAMEOF_F -H5T_mp_H5TENUM_VALUEOF_F -H5T_mp_H5TGET_MEMBER_VALUE_F -H5T_mp_H5TSET_TAG_F -H5T_mp_H5TGET_TAG_F -H5T_mp_H5TVLEN_CREATE_F -H5T_mp_H5TIS_VARIABLE_STR_F -H5T_mp_H5TGET_MEMBER_CLASS_F -H5T_mp_H5TCOMMIT_ANON_F -H5T_mp_H5TCOMMITTED_F -H5T_mp_H5TDECODE_F -H5T_mp_H5TENCODE_F -H5T_mp_H5TGET_CREATE_PLIST_F -H5T_mp_H5TCOMPILER_CONV_F -H5T_mp_H5TGET_NATIVE_TYPE_F -; H5Z -H5Z_mp_H5ZUNREGISTER_F -H5Z_mp_H5ZFILTER_AVAIL_F -H5Z_mp_H5ZGET_FILTER_INFO_F diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in new file mode 100644 index 0000000..bf7596d --- /dev/null +++ b/fortran/src/hdf5_fortrandll.def.in @@ -0,0 +1,570 @@ +EXPORTS +; H5LIB +H5LIB_mp_H5OPEN_F +H5LIB_mp_H5CLOSE_F +H5LIB_mp_H5GET_LIBVERSION_F +H5LIB_mp_H5CHECK_VERSION_F +H5LIB_mp_H5GARBAGE_COLLECT_F +H5LIB_mp_H5DONT_ATEXIT_F +@H5_NOF03EXP@H5LIB_PROVISIONAL_mp_H5OFFSETOF +; H5_DBLE_INTERFACE +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_SCALAR +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_1 +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_2 +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_3 +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_4 +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_5 +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_6 +H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_7 +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_SCALAR +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_1 +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_2 +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_3 +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_4 +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_5 +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_6 +H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_7 +H5_DBLE_INTERFACE_mp_H5DFILL_DOUBLE +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_SCALAR +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_1 +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_2 +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_3 +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_4 +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_5 +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_6 +H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_7 +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_SCALAR +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_1 +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_2 +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_3 +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_4 +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_5 +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_6 +H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_7 +H5_DBLE_INTERFACE_mp_H5PGET_DOUBLE +H5_DBLE_INTERFACE_mp_H5PSET_DOUBLE +H5_DBLE_INTERFACE_mp_H5PSET_FILL_VALUE_DOUBLE +H5_DBLE_INTERFACE_mp_H5PGET_FILL_VALUE_DOUBLE +H5_DBLE_INTERFACE_mp_H5PINSERT_DOUBLE +H5_DBLE_INTERFACE_mp_H5PREGISTER_DOUBLE +; H5A +H5A_mp_H5ACREATE_F +H5A_mp_H5AOPEN_NAME_F +H5A_mp_H5AOPEN_IDX_F +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_SCALAR +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_1 +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_2 +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_3 +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_4 +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_5 +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_6 +H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_7 +H5A_PROVISIONAL_mp_H5AWRITE_REAL_SCALAR +H5A_PROVISIONAL_mp_H5AWRITE_REAL_1 +H5A_PROVISIONAL_mp_H5AWRITE_REAL_2 +H5A_PROVISIONAL_mp_H5AWRITE_REAL_3 +H5A_PROVISIONAL_mp_H5AWRITE_REAL_4 +H5A_PROVISIONAL_mp_H5AWRITE_REAL_5 +H5A_PROVISIONAL_mp_H5AWRITE_REAL_6 +H5A_PROVISIONAL_mp_H5AWRITE_REAL_7 +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_SCALAR +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_1 +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_2 +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_3 +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_4 +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_5 +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_6 +H5A_PROVISIONAL_mp_H5AWRITE_CHAR_7 +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_SCALAR +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_1 +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_2 +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_3 +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_4 +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_5 +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_6 +H5A_PROVISIONAL_mp_H5AREAD_INTEGER_7 +H5A_PROVISIONAL_mp_H5AREAD_REAL_SCALAR +H5A_PROVISIONAL_mp_H5AREAD_REAL_1 +H5A_PROVISIONAL_mp_H5AREAD_REAL_2 +H5A_PROVISIONAL_mp_H5AREAD_REAL_3 +H5A_PROVISIONAL_mp_H5AREAD_REAL_4 +H5A_PROVISIONAL_mp_H5AREAD_REAL_5 +H5A_PROVISIONAL_mp_H5AREAD_REAL_6 +H5A_PROVISIONAL_mp_H5AREAD_REAL_7 +H5A_PROVISIONAL_mp_H5AREAD_CHAR_SCALAR +H5A_PROVISIONAL_mp_H5AREAD_CHAR_1 +H5A_PROVISIONAL_mp_H5AREAD_CHAR_2 +H5A_PROVISIONAL_mp_H5AREAD_CHAR_3 +H5A_PROVISIONAL_mp_H5AREAD_CHAR_4 +H5A_PROVISIONAL_mp_H5AREAD_CHAR_5 +H5A_PROVISIONAL_mp_H5AREAD_CHAR_6 +H5A_PROVISIONAL_mp_H5AREAD_CHAR_7 +H5A_mp_H5AGET_SPACE_F +H5A_mp_H5AGET_TYPE_F +H5A_mp_H5AGET_NAME_F +H5A_mp_H5AGET_NAME_BY_IDX_F +H5A_mp_H5AGET_NUM_ATTRS_F +H5A_mp_H5ADELETE_F +H5A_mp_H5ACLOSE_F +H5A_mp_H5AGET_STORAGE_SIZE_F +H5A_mp_H5AGET_CREATE_PLIST_F +H5A_mp_H5ARENAME_BY_NAME_F +H5A_mp_H5AOPEN_F +H5A_mp_H5ADELETE_BY_IDX_F +H5A_mp_H5ADELETE_BY_NAME_F +H5A_mp_H5AOPEN_BY_IDX_F +H5A_mp_H5AGET_INFO_F +H5A_mp_H5AGET_INFO_BY_IDX_F +H5A_mp_H5AGET_INFO_BY_NAME_F +H5A_mp_H5ACREATE_BY_NAME_F +H5A_mp_H5AEXISTS_F +H5A_mp_H5AEXISTS_BY_NAME_F +H5A_mp_H5AOPEN_BY_NAME_F +H5A_mp_H5ARENAME_F +@H5_NOF03EXP@H5A_PROVISIONAL_mp_H5AWRITE_PTR +@H5_NOF03EXP@H5A_PROVISIONAL_mp_H5AREAD_PTR +; H5D +H5D_mp_H5DCREATE_F +H5D_mp_H5DOPEN_F +H5D_mp_H5DCLOSE_F +H5D_PROVISIONAL_mp_H5DWRITE_REFERENCE_OBJ +H5D_PROVISIONAL_mp_H5DWRITE_REFERENCE_DSETREG +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_SCALAR +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_1 +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_2 +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_3 +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_4 +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_5 +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_6 +H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_7 +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_SCALAR +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_1 +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_2 +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_3 +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_4 +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_5 +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_6 +H5D_PROVISIONAL_mp_H5DWRITE_CHAR_7 +H5D_PROVISIONAL_mp_H5DWRITE_REAL_SCALAR +H5D_PROVISIONAL_mp_H5DWRITE_REAL_1 +H5D_PROVISIONAL_mp_H5DWRITE_REAL_2 +H5D_PROVISIONAL_mp_H5DWRITE_REAL_3 +H5D_PROVISIONAL_mp_H5DWRITE_REAL_4 +H5D_PROVISIONAL_mp_H5DWRITE_REAL_5 +H5D_PROVISIONAL_mp_H5DWRITE_REAL_6 +H5D_PROVISIONAL_mp_H5DWRITE_REAL_7 +H5D_PROVISIONAL_mp_H5DREAD_REFERENCE_OBJ +H5D_PROVISIONAL_mp_H5DREAD_REFERENCE_DSETREG +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_SCALAR +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_1 +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_2 +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_3 +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_4 +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_5 +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_6 +H5D_PROVISIONAL_mp_H5DREAD_INTEGER_7 +H5D_PROVISIONAL_mp_H5DREAD_CHAR_SCALAR +H5D_PROVISIONAL_mp_H5DREAD_CHAR_1 +H5D_PROVISIONAL_mp_H5DREAD_CHAR_2 +H5D_PROVISIONAL_mp_H5DREAD_CHAR_3 +H5D_PROVISIONAL_mp_H5DREAD_CHAR_4 +H5D_PROVISIONAL_mp_H5DREAD_CHAR_5 +H5D_PROVISIONAL_mp_H5DREAD_CHAR_6 +H5D_PROVISIONAL_mp_H5DREAD_CHAR_7 +H5D_PROVISIONAL_mp_H5DREAD_REAL_SCALAR +H5D_PROVISIONAL_mp_H5DREAD_REAL_1 +H5D_PROVISIONAL_mp_H5DREAD_REAL_2 +H5D_PROVISIONAL_mp_H5DREAD_REAL_3 +H5D_PROVISIONAL_mp_H5DREAD_REAL_4 +H5D_PROVISIONAL_mp_H5DREAD_REAL_5 +H5D_PROVISIONAL_mp_H5DREAD_REAL_6 +H5D_PROVISIONAL_mp_H5DREAD_REAL_7 +H5D_mp_H5DGET_SPACE_F +H5D_mp_H5DGET_TYPE_F +H5D_mp_H5DSET_EXTENT_F +H5D_mp_H5DGET_CREATE_PLIST_F +H5D_mp_H5DGET_STORAGE_SIZE_F +H5D_mp_H5DVLEN_GET_MAX_LEN_F +H5D_mp_H5DWRITE_VL_INTEGER +H5D_mp_H5DREAD_VL_INTEGER +H5D_mp_H5DWRITE_VL_REAL +H5D_mp_H5DREAD_VL_REAL +H5D_mp_H5DWRITE_VL_STRING +H5D_mp_H5DREAD_VL_STRING +H5D_PROVISIONAL_mp_H5DFILL_INTEGER +H5D_PROVISIONAL_mp_H5DFILL_REAL +H5D_PROVISIONAL_mp_H5DFILL_CHAR +H5D_mp_H5DGET_SPACE_STATUS_F +H5D_mp_H5DCREATE_ANON_F +H5D_mp_H5DGET_SPACE_F +H5D_mp_H5DGET_TYPE_F +H5D_mp_H5DSET_EXTENT_F +H5D_mp_H5DGET_CREATE_PLIST_F +H5D_mp_H5DGET_STORAGE_SIZE_F +H5D_mp_H5DVLEN_GET_MAX_LEN_F +H5D_mp_H5DGET_ACCESS_PLIST_F +@H5_NOF03EXP@H5D_PROVISIONAL_mp_H5DWRITE_PTR +@H5_NOF03EXP@H5D_PROVISIONAL_mp_H5DREAD_PTR +@H5_NOF03EXP@H5D_PROVISIONAL_mp_H5DVLEN_RECLAIM_F +; H5E +H5E_mp_H5ECLEAR_F +H5E_mp_H5EPRINT_F +H5E_mp_H5EGET_MAJOR_F +H5E_mp_H5EGET_MINOR_F +H5E_PROVISIONAL_mp_H5ESET_AUTO_F +; H5F +H5F_mp_H5FCREATE_F +H5F_mp_H5FFLUSH_F +H5F_mp_H5FCLOSE_F +H5F_mp_H5FGET_OBJ_COUNT_F +H5F_mp_H5FGET_OBJ_IDS_F +H5F_mp_H5FGET_FREESPACE_F +H5F_mp_H5FMOUNT_F +H5F_mp_H5FUNMOUNT_F +H5F_mp_H5FOPEN_F +H5F_mp_H5FREOPEN_F +H5F_mp_H5FGET_CREATE_PLIST_F +H5F_mp_H5FGET_ACCESS_PLIST_F +H5F_mp_H5FIS_HDF5_F +H5F_mp_H5FGET_NAME_F +H5F_mp_H5FGET_FILESIZE_F +; H5G +H5G_mp_H5GOPEN_F +H5G_mp_H5GCREATE_F +H5G_mp_H5GCLOSE_F +H5G_mp_H5GGET_OBJ_INFO_IDX_F +H5G_mp_H5GN_MEMBERS_F +H5G_mp_H5GLINK_F +H5G_mp_H5GLINK2_F +H5G_mp_H5GUNLINK_F +H5G_mp_H5GMOVE_F +H5G_mp_H5GMOVE2_F +H5G_mp_H5GGET_LINKVAL_F +H5G_mp_H5GSET_COMMENT_F +H5G_mp_H5GGET_COMMENT_F +H5G_mp_H5GCREATE_ANON_F +H5G_mp_H5GGET_CREATE_PLIST_F +H5G_mp_H5GGET_INFO_F +H5G_mp_H5GGET_INFO_BY_IDX_F +H5G_mp_H5GGET_INFO_BY_NAME_F +H5G_mp_H5GGET_OBJ_INFO_IDX_F +; H5GLOBAL +; PREDEFINED_TYPES DATA +; FLOATING_TYPES DATA +; INTEGER_TYPES DATA +; H5F_FLAGS DATA +; H5GENERIC_FLAGS DATA +; H5G_FLAGS DATA +; H5D_FLAGS DATA +; H5FD_FLAGS DATA +; H5FD_HID_FLAGS DATA +; H5I_FLAGS DATA +; H5L_FLAGS DATA +; H5O_FLAGS DATA +; H5P_FLAGS DATA +; H5P_FLAGS_INT DATA +; H5R_FLAGS DATA +; H5S_FLAGS DATA +; H5T_FLAGS DATA +; H5Z_FLAGS DATA +; H5LIB_FLAGS DATA +; H5I +H5I_mp_H5IGET_TYPE_F +H5I_mp_H5IGET_NAME_F +H5I_mp_H5IINC_REF_F +H5I_mp_H5IDEC_REF_F +H5I_mp_H5IGET_REF_F +H5I_mp_H5IGET_FILE_ID_F +H5I_mp_H5IIS_VALID_F +; H5L +H5L_mp_H5LCOPY_F +H5L_mp_H5LDELETE_F +H5L_mp_H5LCREATE_SOFT_F +H5L_mp_H5LCREATE_HARD_F +H5L_mp_H5LCREATE_EXTERNAL_F +H5L_mp_H5LDELETE_BY_IDX_F +H5L_mp_H5LEXISTS_F +H5L_mp_H5LGET_INFO_F +H5L_mp_H5LGET_INFO_BY_IDX_F +H5L_mp_H5LIS_REGISTERED_F +H5L_mp_H5LMOVE_F +H5L_mp_H5LGET_NAME_BY_IDX_F +@H5_NOF03EXP@H5L_PROVISIONAL_mp_H5LITERATE_F +@H5_NOF03EXP@H5L_PROVISIONAL_mp_H5LITERATE_BY_NAME_F +; H5O +H5O_mp_H5OCLOSE_F +H5O_mp_H5OCOPY_F +H5O_mp_H5ODECR_REFCOUNT_F +H5O_mp_H5OEXISTS_BY_NAME_F +H5O_mp_H5OGET_COMMENT_F +H5O_mp_H5OGET_COMMENT_BY_NAME_F +H5O_mp_H5OINCR_REFCOUNT_F +H5O_mp_H5OLINK_F +H5O_mp_H5OOPEN_BY_ADDR_F +H5O_mp_H5OOPEN_BY_IDX_F +H5O_mp_H5OOPEN_F +H5O_mp_H5OSET_COMMENT_F +H5O_mp_H5OSET_COMMENT_BY_NAME_F +@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OGET_INFO_BY_IDX_F +@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OGET_INFO_BY_NAME_F +@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OGET_INFO_F +@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OVISIT_BY_NAME_F +@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OVISIT_F +; H5P +H5P_mp_H5PCREATE_F +H5P_mp_H5PSET_PRESERVE_F +H5P_mp_H5PGET_PRESERVE_F +H5P_mp_H5PGET_CLASS_F +H5P_mp_H5PCOPY_F +H5P_mp_H5PCLOSE_F +H5P_mp_H5PSET_CHUNK_F +H5P_mp_H5PGET_CHUNK_F +H5P_mp_H5PSET_DEFLATE_F +H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_INTEGER +H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_INTEGER +H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_REAL +H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_REAL +H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_CHAR +H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_CHAR +H5P_mp_H5PGET_VERSION_F +H5P_mp_H5PSET_USERBLOCK_F +H5P_mp_H5PGET_USERBLOCK_F +H5P_mp_H5PSET_SIZES_F +H5P_mp_H5PGET_SIZES_F +H5P_mp_H5PSET_SYM_K_F +H5P_mp_H5PGET_SYM_K_F +H5P_mp_H5PSET_ISTORE_K_F +H5P_mp_H5PGET_ISTORE_K_F +H5P_mp_H5PGET_DRIVER_F +H5P_mp_H5PSET_FAPL_STDIO_F +H5P_mp_H5PSET_FAPL_SEC2_F +H5P_mp_H5PSET_ALIGNMENT_F +H5P_mp_H5PGET_ALIGNMENT_F +H5P_mp_H5PSET_FAPL_CORE_F +H5P_mp_H5PGET_FAPL_CORE_F +H5P_mp_H5PSET_FAPL_FAMILY_F +H5P_mp_H5PGET_FAPL_FAMILY_F +H5P_mp_H5PSET_CACHE_F +H5P_mp_H5PGET_CACHE_F +H5P_mp_H5PSET_FAPL_SPLIT_F +H5P_mp_H5PSET_GC_REFERENCES_F +H5P_mp_H5PGET_GC_REFERENCES_F +H5P_mp_H5PSET_LAYOUT_F +H5P_mp_H5PGET_LAYOUT_F +H5P_mp_H5PSET_FILTER_F +H5P_mp_H5PGET_NFILTERS_F +H5P_mp_H5PGET_FILTER_F +H5P_mp_H5PSET_EXTERNAL_F +H5P_mp_H5PGET_EXTERNAL_COUNT_F +H5P_mp_H5PGET_EXTERNAL_F +H5P_mp_H5PSET_BTREE_RATIOS_F +H5P_mp_H5PGET_BTREE_RATIOS_F +H5P_mp_H5PGET_FCLOSE_DEGREE_F +H5P_mp_H5PSET_FCLOSE_DEGREE_F +H5P_mp_H5PEQUAL_F +H5P_mp_H5PSET_BUFFER_F +H5P_mp_H5PGET_BUFFER_F +H5P_mp_H5PFILL_VALUE_DEFINED_F +H5P_mp_H5PSET_ALLOC_TIME_F +H5P_mp_H5PGET_ALLOC_TIME_F +H5P_mp_H5PSET_FILL_TIME_F +H5P_mp_H5PGET_FILL_TIME_F +H5P_mp_H5PSET_META_BLOCK_SIZE_F +H5P_mp_H5PGET_META_BLOCK_SIZE_F +H5P_mp_H5PSET_SIEVE_BUF_SIZE_F +H5P_mp_H5PGET_SIEVE_BUF_SIZE_F +H5P_mp_H5PSET_SMALL_DATA_BLOCK_SIZE_F +H5P_mp_H5PGET_SMALL_DATA_BLOCK_SIZE_F +H5P_mp_H5PSET_HYPER_VECTOR_SIZE_F +H5P_mp_H5PGET_HYPER_VECTOR_SIZE_F +H5P_PROVISIONAL_mp_H5PSET_INTEGER +H5P_PROVISIONAL_mp_H5PSET_REAL +H5P_PROVISIONAL_mp_H5PSET_CHAR +H5P_PROVISIONAL_mp_H5PGET_INTEGER +H5P_PROVISIONAL_mp_H5PGET_REAL +H5P_PROVISIONAL_mp_H5PGET_CHAR +H5P_mp_H5PEXIST_F +H5P_mp_H5PGET_SIZE_F +H5P_mp_H5PGET_NPROPS_F +H5P_mp_H5PGET_CLASS_NAME_F +H5P_mp_H5PGET_CLASS_PARENT_F +H5P_mp_H5PISA_CLASS_F +H5P_mp_H5PCOPY_PROP_F +H5P_mp_H5PREMOVE_F +H5P_mp_H5PUNREGISTER_F +H5P_mp_H5PCLOSE_CLASS_F +H5P_PROVISIONAL_mp_H5PCREATE_CLASS_F +H5P_PROVISIONAL_mp_H5PREGISTER_INTEGER +H5P_PROVISIONAL_mp_H5PREGISTER_REAL +H5P_PROVISIONAL_mp_H5PREGISTER_CHAR +H5P_PROVISIONAL_mp_H5PINSERT_INTEGER +H5P_PROVISIONAL_mp_H5PINSERT_REAL +H5P_PROVISIONAL_mp_H5PINSERT_CHAR +H5P_mp_H5PSET_SHUFFLE_F +H5P_mp_H5PSET_EDC_CHECK_F +H5P_mp_H5PGET_EDC_CHECK_F +H5P_mp_H5PSET_FLETCHER32_F +H5P_mp_H5PSET_FAMILY_OFFSET_F +H5P_mp_H5PSET_FAPL_MULTI_L +H5P_mp_H5PSET_FAPL_MULTI_S +H5P_mp_H5PGET_FAPL_MULTI_F +H5P_mp_H5PSET_SZIP_F +H5P_mp_H5PALL_FILTERS_AVAIL_F +H5P_mp_H5PGET_FILTER_BY_ID_F +H5P_mp_H5PMODIFY_FILTER_F +H5P_mp_H5PREMOVE_FILTER_F +H5P_mp_H5PGET_ATTR_PHASE_CHANGE_F +H5P_mp_H5PSET_ATTR_CREATION_ORDER_F +H5P_mp_H5PSET_SHARED_MESG_NINDEXES_F +H5P_mp_H5PSET_SHARED_MESG_INDEX_F +H5P_mp_H5PGET_ATTR_CREATION_ORDER_F +H5P_mp_H5PSET_LIBVER_BOUNDS_F +H5P_mp_H5PSET_LINK_CREATION_ORDER_F +H5P_mp_H5PGET_LINK_PHASE_CHANGE_F +H5P_mp_H5PGET_OBJ_TRACK_TIMES_F +H5P_mp_H5PSET_OBJ_TRACK_TIMES_F +H5P_mp_H5PSET_CREATE_INTER_GROUP_F +H5P_mp_H5PGET_LINK_CREATION_ORDER_F +H5P_mp_H5PSET_CHAR_ENCODING_F +H5P_mp_H5PGET_CHAR_ENCODING_F +H5P_mp_H5PSET_COPY_OBJECT_F +H5P_mp_H5PGET_COPY_OBJECT_F +H5P_mp_H5PGET_DATA_TRANSFORM_F +H5P_mp_H5PSET_DATA_TRANSFORM_F +H5P_mp_H5PGET_LOCAL_HEAP_SIZE_HINT_F +H5P_mp_H5PGET_EST_LINK_INFO_F +H5P_mp_H5PSET_LOCAL_HEAP_SIZE_HINT_F +H5P_mp_H5PSET_EST_LINK_INFO_F +H5P_mp_H5PSET_LINK_PHASE_CHANGE_F +H5P_mp_H5PSET_FAPL_DIRECT_F +H5P_mp_H5PGET_FAPL_DIRECT_F +H5P_mp_H5PSET_ATTR_PHASE_CHANGE_F +H5P_mp_H5PSET_NBIT_F +H5P_mp_H5PSET_SCALEOFFSET_F +H5P_mp_H5PSET_NLINKS_F +H5P_mp_H5PGET_NLINKS_F +H5P_mp_H5PGET_CREATE_INTER_GROUP_F +H5P_mp_H5PSET_CHUNK_CACHE_F +H5P_mp_H5PGET_CHUNK_CACHE_F +@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_PTR +@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_PTR +@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PSET_PTR +@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PGET_PTR +@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PREGISTER_PTR +@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PINSERT_PTR +; H5R +H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F +H5R_PROVISIONAL_mp_H5RCREATE_REGION_F +H5R_PROVISIONAL_mp_H5RDEREFERENCE_OBJECT_F +H5R_PROVISIONAL_mp_H5RDEREFERENCE_REGION_F +H5R_PROVISIONAL_mp_H5RGET_REGION_REGION_F +H5R_mp_H5RGET_OBJECT_TYPE_OBJ_F +H5R_PROVISIONAL_mp_H5RGET_NAME_OBJECT_F +H5R_PROVISIONAL_mp_H5RGET_NAME_REGION_F +@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RGET_REGION_PTR_F +@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RCREATE_PTR_F +@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RDEREFERENCE_PTR_F +@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RGET_NAME_PTR_F +@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RGET_OBJ_TYPE_F +; H5S +H5S_mp_H5SCREATE_SIMPLE_F +H5S_mp_H5SCLOSE_F +H5S_mp_H5SCREATE_F +H5S_mp_H5SCOPY_F +H5S_mp_H5SGET_SELECT_HYPER_NBLOCKS_F +H5S_mp_H5SGET_SELECT_HYPER_BLOCKLIST_F +H5S_mp_H5SGET_SELECT_BOUNDS_F +H5S_mp_H5SGET_SELECT_ELEM_NPOINTS_F +H5S_mp_H5SGET_SELECT_ELEM_POINTLIST_F +H5S_mp_H5SSELECT_ELEMENTS_F +H5S_mp_H5SSELECT_ALL_F +H5S_mp_H5SSELECT_NONE_F +H5S_mp_H5SSELECT_VALID_F +H5S_mp_H5SGET_SIMPLE_EXTENT_NPOINTS_F +H5S_mp_H5SGET_SELECT_NPOINTS_F +H5S_mp_H5SGET_SIMPLE_EXTENT_NDIMS_F +H5S_mp_H5SGET_SIMPLE_EXTENT_DIMS_F +H5S_mp_H5SGET_SIMPLE_EXTENT_TYPE_F +H5S_mp_H5SSET_EXTENT_SIMPLE_F +H5S_mp_H5SIS_SIMPLE_F +H5S_mp_H5SOFFSET_SIMPLE_F +H5S_mp_H5SEXTENT_COPY_F +H5S_mp_H5SSET_EXTENT_NONE_F +H5S_mp_H5SSELECT_HYPERSLAB_F +H5S_mp_H5SGET_SELECT_TYPE_F +H5S_mp_H5SDECODE_F +H5S_mp_H5SENCODE_F +H5S_mp_H5SEXTENT_EQUAL_F +; H5T +H5T_mp_H5TOPEN_F +H5T_mp_H5TCOMMIT_F +H5T_mp_H5TCOPY_F +H5T_mp_H5TEQUAL_F +H5T_mp_H5TCLOSE_F +H5T_mp_H5TGET_CLASS_F +H5T_mp_H5TGET_SIZE_F +H5T_mp_H5TSET_SIZE_F +H5T_mp_H5TGET_ORDER_F +H5T_mp_H5TSET_ORDER_F +H5T_mp_H5TGET_PRECISION_F +H5T_mp_H5TSET_PRECISION_F +H5T_mp_H5TGET_OFFSET_F +H5T_mp_H5TSET_OFFSET_F +H5T_mp_H5TGET_PAD_F +H5T_mp_H5TSET_PAD_F +H5T_mp_H5TGET_SIGN_F +H5T_mp_H5TSET_SIGN_F +H5T_mp_H5TGET_FIELDS_F +H5T_mp_H5TSET_FIELDS_F +H5T_mp_H5TGET_EBIAS_F +H5T_mp_H5TSET_EBIAS_F +H5T_mp_H5TGET_NORM_F +H5T_mp_H5TSET_NORM_F +H5T_mp_H5TGET_INPAD_F +H5T_mp_H5TSET_INPAD_F +H5T_mp_H5TGET_CSET_F +H5T_mp_H5TSET_CSET_F +H5T_mp_H5TGET_STRPAD_F +H5T_mp_H5TSET_STRPAD_F +H5T_mp_H5TGET_NMEMBERS_F +H5T_mp_H5TGET_MEMBER_NAME_F +H5T_mp_H5TGET_MEMBER_OFFSET_F +H5T_mp_H5TGET_MEMBER_INDEX_F +H5T_mp_H5TGET_ARRAY_DIMS_F +H5T_mp_H5TGET_ARRAY_NDIMS_F +H5T_mp_H5TGET_SUPER_F +H5T_mp_H5TGET_MEMBER_TYPE_F +H5T_mp_H5TCREATE_F +H5T_mp_H5TINSERT_F +H5T_mp_H5TPACK_F +H5T_mp_H5TARRAY_CREATE_F +H5T_mp_H5TENUM_CREATE_F +H5T_mp_H5TENUM_INSERT_F +H5T_mp_H5TENUM_NAMEOF_F +H5T_mp_H5TENUM_VALUEOF_F +H5T_mp_H5TGET_MEMBER_VALUE_F +H5T_mp_H5TSET_TAG_F +H5T_mp_H5TGET_TAG_F +H5T_mp_H5TVLEN_CREATE_F +H5T_mp_H5TIS_VARIABLE_STR_F +H5T_mp_H5TGET_MEMBER_CLASS_F +H5T_mp_H5TCOMMIT_ANON_F +H5T_mp_H5TCOMMITTED_F +H5T_mp_H5TDECODE_F +H5T_mp_H5TENCODE_F +H5T_mp_H5TGET_CREATE_PLIST_F +H5T_mp_H5TCOMPILER_CONV_F +H5T_mp_H5TGET_NATIVE_TYPE_F +@H5_NOF03EXP@H5T_PROVISIONAL_mp_H5TCONVERT_F +; H5Z +H5Z_mp_H5ZUNREGISTER_F +H5Z_mp_H5ZFILTER_AVAIL_F +H5Z_mp_H5ZGET_FILTER_INFO_F +; Parallel +@H5_NOPAREXP@H5FDMPIO_mp_H5PSET_FAPL_MPIO_F +@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_FAPL_MPIO_F +@H5_NOPAREXP@H5FDMPIO_mp_H5PSET_DXPL_MPIO_F +@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_DXPL_MPIO_F +@H5_NOPAREXP@H5FDMPIO_mp_H5PSET_FAPL_MPIPOSIX_F +@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_FAPL_MPIPOSIX_F +@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F diff --git a/fortran/src/phdf5_fortrandll.def b/fortran/src/phdf5_fortrandll.def deleted file mode 100644 index 7a196cd..0000000 --- a/fortran/src/phdf5_fortrandll.def +++ /dev/null @@ -1,531 +0,0 @@ -EXPORTS -; H5LIB -H5LIB_mp_H5OPEN_F -H5LIB_mp_H5CLOSE_F -H5LIB_mp_H5GET_LIBVERSION_F -H5LIB_mp_H5CHECK_VERSION_F -H5LIB_mp_H5GARBAGE_COLLECT_F -H5LIB_mp_H5DONT_ATEXIT_F -; H5_DBLE_INTERFACE -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5AWRITE_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5DFILL_DOUBLE -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5DREAD_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_SCALAR -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_1 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_2 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_3 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_4 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_5 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_6 -H5_DBLE_INTERFACE_mp_H5DWRITE_DOUBLE_7 -H5_DBLE_INTERFACE_mp_H5PGET_DOUBLE -H5_DBLE_INTERFACE_mp_H5PSET_DOUBLE -H5_DBLE_INTERFACE_mp_H5PSET_FILL_VALUE_DOUBLE -H5_DBLE_INTERFACE_mp_H5PGET_FILL_VALUE_DOUBLE -H5_DBLE_INTERFACE_mp_H5PINSERT_DOUBLE -H5_DBLE_INTERFACE_mp_H5PREGISTER_DOUBLE -; H5A -H5A_mp_H5ACREATE_F -H5A_mp_H5AOPEN_NAME_F -H5A_mp_H5AOPEN_IDX_F -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_SCALAR -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_1 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_2 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_3 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_4 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_5 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_6 -H5A_PROVISIONAL_mp_H5AWRITE_INTEGER_7 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_SCALAR -H5A_PROVISIONAL_mp_H5AWRITE_REAL_1 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_2 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_3 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_4 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_5 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_6 -H5A_PROVISIONAL_mp_H5AWRITE_REAL_7 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_SCALAR -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_1 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_2 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_3 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_4 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_5 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_6 -H5A_PROVISIONAL_mp_H5AWRITE_CHAR_7 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_SCALAR -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_1 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_2 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_3 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_4 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_5 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_6 -H5A_PROVISIONAL_mp_H5AREAD_INTEGER_7 -H5A_PROVISIONAL_mp_H5AREAD_REAL_SCALAR -H5A_PROVISIONAL_mp_H5AREAD_REAL_1 -H5A_PROVISIONAL_mp_H5AREAD_REAL_2 -H5A_PROVISIONAL_mp_H5AREAD_REAL_3 -H5A_PROVISIONAL_mp_H5AREAD_REAL_4 -H5A_PROVISIONAL_mp_H5AREAD_REAL_5 -H5A_PROVISIONAL_mp_H5AREAD_REAL_6 -H5A_PROVISIONAL_mp_H5AREAD_REAL_7 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_SCALAR -H5A_PROVISIONAL_mp_H5AREAD_CHAR_1 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_2 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_3 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_4 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_5 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_6 -H5A_PROVISIONAL_mp_H5AREAD_CHAR_7 -H5A_mp_H5AGET_SPACE_F -H5A_mp_H5AGET_TYPE_F -H5A_mp_H5AGET_NAME_F -H5A_mp_H5AGET_NAME_BY_IDX_F -H5A_mp_H5AGET_NUM_ATTRS_F -H5A_mp_H5ADELETE_F -H5A_mp_H5ACLOSE_F -H5A_mp_H5AGET_STORAGE_SIZE_F -H5A_mp_H5AGET_CREATE_PLIST_F -H5A_mp_H5ARENAME_BY_NAME_F -H5A_mp_H5AOPEN_F -H5A_mp_H5ADELETE_BY_IDX_F -H5A_mp_H5ADELETE_BY_NAME_F -H5A_mp_H5AOPEN_BY_IDX_F -H5A_mp_H5AGET_INFO_F -H5A_mp_H5AGET_INFO_BY_IDX_F -H5A_mp_H5AGET_INFO_BY_NAME_F -H5A_mp_H5ACREATE_BY_NAME_F -H5A_mp_H5AEXISTS_F -H5A_mp_H5AEXISTS_BY_NAME_F -H5A_mp_H5AOPEN_BY_NAME_F -H5A_mp_H5ARENAME_F -; H5D -H5D_mp_H5DCREATE_F -H5D_mp_H5DOPEN_F -H5D_mp_H5DCLOSE_F -H5D_PROVISIONAL_mp_H5DWRITE_REFERENCE_OBJ -H5D_PROVISIONAL_mp_H5DWRITE_REFERENCE_DSETREG -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_SCALAR -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_1 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_2 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_3 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_4 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_5 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_6 -H5D_PROVISIONAL_mp_H5DWRITE_INTEGER_7 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_SCALAR -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_1 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_2 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_3 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_4 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_5 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_6 -H5D_PROVISIONAL_mp_H5DWRITE_CHAR_7 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_SCALAR -H5D_PROVISIONAL_mp_H5DWRITE_REAL_1 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_2 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_3 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_4 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_5 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_6 -H5D_PROVISIONAL_mp_H5DWRITE_REAL_7 -H5D_PROVISIONAL_mp_H5DREAD_REFERENCE_OBJ -H5D_PROVISIONAL_mp_H5DREAD_REFERENCE_DSETREG -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_SCALAR -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_1 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_2 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_3 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_4 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_5 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_6 -H5D_PROVISIONAL_mp_H5DREAD_INTEGER_7 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_SCALAR -H5D_PROVISIONAL_mp_H5DREAD_CHAR_1 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_2 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_3 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_4 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_5 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_6 -H5D_PROVISIONAL_mp_H5DREAD_CHAR_7 -H5D_PROVISIONAL_mp_H5DREAD_REAL_SCALAR -H5D_PROVISIONAL_mp_H5DREAD_REAL_1 -H5D_PROVISIONAL_mp_H5DREAD_REAL_2 -H5D_PROVISIONAL_mp_H5DREAD_REAL_3 -H5D_PROVISIONAL_mp_H5DREAD_REAL_4 -H5D_PROVISIONAL_mp_H5DREAD_REAL_5 -H5D_PROVISIONAL_mp_H5DREAD_REAL_6 -H5D_PROVISIONAL_mp_H5DREAD_REAL_7 -H5D_mp_H5DGET_SPACE_F -H5D_mp_H5DGET_TYPE_F -H5D_mp_H5DSET_EXTENT_F -H5D_mp_H5DGET_CREATE_PLIST_F -H5D_mp_H5DGET_STORAGE_SIZE_F -H5D_mp_H5DVLEN_GET_MAX_LEN_F -H5D_mp_H5DWRITE_VL_INTEGER -H5D_mp_H5DREAD_VL_INTEGER -H5D_mp_H5DWRITE_VL_REAL -H5D_mp_H5DREAD_VL_REAL -H5D_mp_H5DWRITE_VL_STRING -H5D_mp_H5DREAD_VL_STRING -H5D_PROVISIONAL_mp_H5DFILL_INTEGER -H5D_PROVISIONAL_mp_H5DFILL_REAL -H5D_PROVISIONAL_mp_H5DFILL_CHAR -H5D_mp_H5DGET_SPACE_STATUS_F -H5D_mp_H5DCREATE_ANON_F -H5D_mp_H5DGET_SPACE_F -H5D_mp_H5DGET_TYPE_F -H5D_mp_H5DSET_EXTENT_F -H5D_mp_H5DGET_CREATE_PLIST_F -H5D_mp_H5DGET_STORAGE_SIZE_F -H5D_mp_H5DVLEN_GET_MAX_LEN_F -H5D_mp_H5DGET_ACCESS_PLIST_F -; H5E -H5E_mp_H5ECLEAR_F -H5E_mp_H5EPRINT_F -H5E_mp_H5EGET_MAJOR_F -H5E_mp_H5EGET_MINOR_F -H5E_PROVISIONAL_mp_H5ESET_AUTO_F -; H5F -H5F_mp_H5FCREATE_F -H5F_mp_H5FFLUSH_F -H5F_mp_H5FCLOSE_F -H5F_mp_H5FGET_OBJ_COUNT_F -H5F_mp_H5FGET_OBJ_IDS_F -H5F_mp_H5FGET_FREESPACE_F -H5F_mp_H5FMOUNT_F -H5F_mp_H5FUNMOUNT_F -H5F_mp_H5FOPEN_F -H5F_mp_H5FREOPEN_F -H5F_mp_H5FGET_CREATE_PLIST_F -H5F_mp_H5FGET_ACCESS_PLIST_F -H5F_mp_H5FIS_HDF5_F -H5F_mp_H5FGET_NAME_F -H5F_mp_H5FGET_FILESIZE_F -; H5G -H5G_mp_H5GOPEN_F -H5G_mp_H5GCREATE_F -H5G_mp_H5GCLOSE_F -H5G_mp_H5GGET_OBJ_INFO_IDX_F -H5G_mp_H5GN_MEMBERS_F -H5G_mp_H5GLINK_F -H5G_mp_H5GLINK2_F -H5G_mp_H5GUNLINK_F -H5G_mp_H5GMOVE_F -H5G_mp_H5GMOVE2_F -H5G_mp_H5GGET_LINKVAL_F -H5G_mp_H5GSET_COMMENT_F -H5G_mp_H5GGET_COMMENT_F -H5G_mp_H5GCREATE_ANON_F -H5G_mp_H5GGET_CREATE_PLIST_F -H5G_mp_H5GGET_INFO_F -H5G_mp_H5GGET_INFO_BY_IDX_F -H5G_mp_H5GGET_INFO_BY_NAME_F -H5G_mp_H5GGET_OBJ_INFO_IDX_F -; H5GLOBAL -; PREDEFINED_TYPES DATA -; FLOATING_TYPES DATA -; INTEGER_TYPES DATA -; H5F_FLAGS DATA -; H5GENERIC_FLAGS DATA -; H5G_FLAGS DATA -; H5D_FLAGS DATA -; H5FD_FLAGS DATA -; H5FD_HID_FLAGS DATA -; H5I_FLAGS DATA -; H5L_FLAGS DATA -; H5O_FLAGS DATA -; H5P_FLAGS DATA -; H5P_FLAGS_INT DATA -; H5R_FLAGS DATA -; H5S_FLAGS DATA -; H5T_FLAGS DATA -; H5Z_FLAGS DATA -; H5LIB_FLAGS DATA -; H5I -H5I_mp_H5IGET_TYPE_F -H5I_mp_H5IGET_NAME_F -H5I_mp_H5IINC_REF_F -H5I_mp_H5IDEC_REF_F -H5I_mp_H5IGET_REF_F -H5I_mp_H5IGET_FILE_ID_F -H5I_mp_H5IIS_VALID_F -; H5L -H5L_mp_H5LCOPY_F -H5L_mp_H5LDELETE_F -H5L_mp_H5LCREATE_SOFT_F -H5L_mp_H5LCREATE_HARD_F -H5L_mp_H5LCREATE_EXTERNAL_F -H5L_mp_H5LDELETE_BY_IDX_F -H5L_mp_H5LEXISTS_F -H5L_mp_H5LGET_INFO_F -H5L_mp_H5LGET_INFO_BY_IDX_F -H5L_mp_H5LIS_REGISTERED_F -H5L_mp_H5LMOVE_F -H5L_mp_H5LGET_NAME_BY_IDX_F -; H5O -H5O_mp_H5OCOPY_F -H5O_mp_H5OLINK_F -H5O_mp_H5OOPEN_F -H5O_mp_H5OOPEN_BY_ADDR_F -; H5P -H5P_mp_H5PCREATE_F -H5P_mp_H5PSET_PRESERVE_F -H5P_mp_H5PGET_PRESERVE_F -H5P_mp_H5PGET_CLASS_F -H5P_mp_H5PCOPY_F -H5P_mp_H5PCLOSE_F -H5P_mp_H5PSET_CHUNK_F -H5P_mp_H5PGET_CHUNK_F -H5P_mp_H5PSET_DEFLATE_F -H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_INTEGER -H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_INTEGER -H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_REAL -H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_REAL -H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_CHAR -H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_CHAR -H5P_mp_H5PGET_VERSION_F -H5P_mp_H5PSET_USERBLOCK_F -H5P_mp_H5PGET_USERBLOCK_F -H5P_mp_H5PSET_SIZES_F -H5P_mp_H5PGET_SIZES_F -H5P_mp_H5PSET_SYM_K_F -H5P_mp_H5PGET_SYM_K_F -H5P_mp_H5PSET_ISTORE_K_F -H5P_mp_H5PGET_ISTORE_K_F -H5P_mp_H5PGET_DRIVER_F -H5P_mp_H5PSET_FAPL_STDIO_F -H5P_mp_H5PSET_FAPL_SEC2_F -H5P_mp_H5PSET_ALIGNMENT_F -H5P_mp_H5PGET_ALIGNMENT_F -H5P_mp_H5PSET_FAPL_CORE_F -H5P_mp_H5PGET_FAPL_CORE_F -H5P_mp_H5PSET_FAPL_FAMILY_F -H5P_mp_H5PGET_FAPL_FAMILY_F -H5P_mp_H5PSET_CACHE_F -H5P_mp_H5PGET_CACHE_F -H5P_mp_H5PSET_FAPL_SPLIT_F -H5P_mp_H5PSET_GC_REFERENCES_F -H5P_mp_H5PGET_GC_REFERENCES_F -H5P_mp_H5PSET_LAYOUT_F -H5P_mp_H5PGET_LAYOUT_F -H5P_mp_H5PSET_FILTER_F -H5P_mp_H5PGET_NFILTERS_F -H5P_mp_H5PGET_FILTER_F -H5P_mp_H5PSET_EXTERNAL_F -H5P_mp_H5PGET_EXTERNAL_COUNT_F -H5P_mp_H5PGET_EXTERNAL_F -H5P_mp_H5PSET_BTREE_RATIOS_F -H5P_mp_H5PGET_BTREE_RATIOS_F -H5P_mp_H5PGET_FCLOSE_DEGREE_F -H5P_mp_H5PSET_FCLOSE_DEGREE_F -H5P_mp_H5PEQUAL_F -H5P_mp_H5PSET_BUFFER_F -H5P_mp_H5PGET_BUFFER_F -H5P_mp_H5PFILL_VALUE_DEFINED_F -H5P_mp_H5PSET_ALLOC_TIME_F -H5P_mp_H5PGET_ALLOC_TIME_F -H5P_mp_H5PSET_FILL_TIME_F -H5P_mp_H5PGET_FILL_TIME_F -H5P_mp_H5PSET_META_BLOCK_SIZE_F -H5P_mp_H5PGET_META_BLOCK_SIZE_F -H5P_mp_H5PSET_SIEVE_BUF_SIZE_F -H5P_mp_H5PGET_SIEVE_BUF_SIZE_F -H5P_mp_H5PSET_SMALL_DATA_BLOCK_SIZE_F -H5P_mp_H5PGET_SMALL_DATA_BLOCK_SIZE_F -H5P_mp_H5PSET_HYPER_VECTOR_SIZE_F -H5P_mp_H5PGET_HYPER_VECTOR_SIZE_F -H5P_PROVISIONAL_mp_H5PSET_INTEGER -H5P_PROVISIONAL_mp_H5PSET_REAL -H5P_PROVISIONAL_mp_H5PSET_CHAR -H5P_PROVISIONAL_mp_H5PGET_INTEGER -H5P_PROVISIONAL_mp_H5PGET_REAL -H5P_PROVISIONAL_mp_H5PGET_CHAR -H5P_mp_H5PEXIST_F -H5P_mp_H5PGET_SIZE_F -H5P_mp_H5PGET_NPROPS_F -H5P_mp_H5PGET_CLASS_NAME_F -H5P_mp_H5PGET_CLASS_PARENT_F -H5P_mp_H5PISA_CLASS_F -H5P_mp_H5PCOPY_PROP_F -H5P_mp_H5PREMOVE_F -H5P_mp_H5PUNREGISTER_F -H5P_mp_H5PCLOSE_CLASS_F -H5P_PROVISIONAL_mp_H5PCREATE_CLASS_F -H5P_PROVISIONAL_mp_H5PREGISTER_INTEGER -H5P_PROVISIONAL_mp_H5PREGISTER_REAL -H5P_PROVISIONAL_mp_H5PREGISTER_CHAR -H5P_PROVISIONAL_mp_H5PINSERT_INTEGER -H5P_PROVISIONAL_mp_H5PINSERT_REAL -H5P_PROVISIONAL_mp_H5PINSERT_CHAR -H5P_mp_H5PSET_SHUFFLE_F -H5P_mp_H5PSET_EDC_CHECK_F -H5P_mp_H5PGET_EDC_CHECK_F -H5P_mp_H5PSET_FLETCHER32_F -H5P_mp_H5PSET_FAMILY_OFFSET_F -H5P_mp_H5PSET_FAPL_MULTI_L -H5P_mp_H5PSET_FAPL_MULTI_S -H5P_mp_H5PGET_FAPL_MULTI_F -H5P_mp_H5PSET_SZIP_F -H5P_mp_H5PALL_FILTERS_AVAIL_F -H5P_mp_H5PGET_FILTER_BY_ID_F -H5P_mp_H5PMODIFY_FILTER_F -H5P_mp_H5PREMOVE_FILTER_F -H5P_mp_H5PGET_ATTR_PHASE_CHANGE_F -H5P_mp_H5PSET_ATTR_CREATION_ORDER_F -H5P_mp_H5PSET_SHARED_MESG_NINDEXES_F -H5P_mp_H5PSET_SHARED_MESG_INDEX_F -H5P_mp_H5PGET_ATTR_CREATION_ORDER_F -H5P_mp_H5PSET_LIBVER_BOUNDS_F -H5P_mp_H5PSET_LINK_CREATION_ORDER_F -H5P_mp_H5PGET_LINK_PHASE_CHANGE_F -H5P_mp_H5PGET_OBJ_TRACK_TIMES_F -H5P_mp_H5PSET_OBJ_TRACK_TIMES_F -H5P_mp_H5PSET_CREATE_INTER_GROUP_F -H5P_mp_H5PGET_LINK_CREATION_ORDER_F -H5P_mp_H5PSET_CHAR_ENCODING_F -H5P_mp_H5PGET_CHAR_ENCODING_F -H5P_mp_H5PSET_COPY_OBJECT_F -H5P_mp_H5PGET_COPY_OBJECT_F -H5P_mp_H5PGET_DATA_TRANSFORM_F -H5P_mp_H5PSET_DATA_TRANSFORM_F -H5P_mp_H5PGET_LOCAL_HEAP_SIZE_HINT_F -H5P_mp_H5PGET_EST_LINK_INFO_F -H5P_mp_H5PSET_LOCAL_HEAP_SIZE_HINT_F -H5P_mp_H5PSET_EST_LINK_INFO_F -H5P_mp_H5PSET_LINK_PHASE_CHANGE_F -H5P_mp_H5PSET_FAPL_DIRECT_F -H5P_mp_H5PGET_FAPL_DIRECT_F -H5P_mp_H5PSET_ATTR_PHASE_CHANGE_F -H5P_mp_H5PSET_NBIT_F -H5P_mp_H5PSET_SCALEOFFSET_F -H5P_mp_H5PSET_NLINKS_F -H5P_mp_H5PGET_NLINKS_F -H5P_mp_H5PGET_CREATE_INTER_GROUP_F -H5P_mp_H5PSET_CHUNK_CACHE_F -H5P_mp_H5PGET_CHUNK_CACHE_F -; H5R -H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F -H5R_PROVISIONAL_mp_H5RCREATE_REGION_F -H5R_PROVISIONAL_mp_H5RDEREFERENCE_OBJECT_F -H5R_PROVISIONAL_mp_H5RDEREFERENCE_REGION_F -H5R_mp_H5RGET_REGION_REGION_F -H5R_mp_H5RGET_OBJECT_TYPE_OBJ_F -H5R_PROVISIONAL_mp_H5RGET_NAME_OBJECT_F -H5R_PROVISIONAL_mp_H5RGET_NAME_REGION_F -; H5S -H5S_mp_H5SCREATE_SIMPLE_F -H5S_mp_H5SCLOSE_F -H5S_mp_H5SCREATE_F -H5S_mp_H5SCOPY_F -H5S_mp_H5SGET_SELECT_HYPER_NBLOCKS_F -H5S_mp_H5SGET_SELECT_HYPER_BLOCKLIST_F -H5S_mp_H5SGET_SELECT_BOUNDS_F -H5S_mp_H5SGET_SELECT_ELEM_NPOINTS_F -H5S_mp_H5SGET_SELECT_ELEM_POINTLIST_F -H5S_mp_H5SSELECT_ELEMENTS_F -H5S_mp_H5SSELECT_ALL_F -H5S_mp_H5SSELECT_NONE_F -H5S_mp_H5SSELECT_VALID_F -H5S_mp_H5SGET_SIMPLE_EXTENT_NPOINTS_F -H5S_mp_H5SGET_SELECT_NPOINTS_F -H5S_mp_H5SGET_SIMPLE_EXTENT_NDIMS_F -H5S_mp_H5SGET_SIMPLE_EXTENT_DIMS_F -H5S_mp_H5SGET_SIMPLE_EXTENT_TYPE_F -H5S_mp_H5SSET_EXTENT_SIMPLE_F -H5S_mp_H5SIS_SIMPLE_F -H5S_mp_H5SOFFSET_SIMPLE_F -H5S_mp_H5SEXTENT_COPY_F -H5S_mp_H5SSET_EXTENT_NONE_F -H5S_mp_H5SSELECT_HYPERSLAB_F -H5S_mp_H5SGET_SELECT_TYPE_F -H5S_mp_H5SDECODE_F -H5S_mp_H5SENCODE_F -H5S_mp_H5SEXTENT_EQUAL_F -; H5T -H5T_mp_H5TOPEN_F -H5T_mp_H5TCOMMIT_F -H5T_mp_H5TCOPY_F -H5T_mp_H5TEQUAL_F -H5T_mp_H5TCLOSE_F -H5T_mp_H5TGET_CLASS_F -H5T_mp_H5TGET_SIZE_F -H5T_mp_H5TSET_SIZE_F -H5T_mp_H5TGET_ORDER_F -H5T_mp_H5TSET_ORDER_F -H5T_mp_H5TGET_PRECISION_F -H5T_mp_H5TSET_PRECISION_F -H5T_mp_H5TGET_OFFSET_F -H5T_mp_H5TSET_OFFSET_F -H5T_mp_H5TGET_PAD_F -H5T_mp_H5TSET_PAD_F -H5T_mp_H5TGET_SIGN_F -H5T_mp_H5TSET_SIGN_F -H5T_mp_H5TGET_FIELDS_F -H5T_mp_H5TSET_FIELDS_F -H5T_mp_H5TGET_EBIAS_F -H5T_mp_H5TSET_EBIAS_F -H5T_mp_H5TGET_NORM_F -H5T_mp_H5TSET_NORM_F -H5T_mp_H5TGET_INPAD_F -H5T_mp_H5TSET_INPAD_F -H5T_mp_H5TGET_CSET_F -H5T_mp_H5TSET_CSET_F -H5T_mp_H5TGET_STRPAD_F -H5T_mp_H5TSET_STRPAD_F -H5T_mp_H5TGET_NMEMBERS_F -H5T_mp_H5TGET_MEMBER_NAME_F -H5T_mp_H5TGET_MEMBER_OFFSET_F -H5T_mp_H5TGET_MEMBER_INDEX_F -H5T_mp_H5TGET_ARRAY_DIMS_F -H5T_mp_H5TGET_ARRAY_NDIMS_F -H5T_mp_H5TGET_SUPER_F -H5T_mp_H5TGET_MEMBER_TYPE_F -H5T_mp_H5TCREATE_F -H5T_mp_H5TINSERT_F -H5T_mp_H5TPACK_F -H5T_mp_H5TARRAY_CREATE_F -H5T_mp_H5TENUM_CREATE_F -H5T_mp_H5TENUM_INSERT_F -H5T_mp_H5TENUM_NAMEOF_F -H5T_mp_H5TENUM_VALUEOF_F -H5T_mp_H5TGET_MEMBER_VALUE_F -H5T_mp_H5TSET_TAG_F -H5T_mp_H5TGET_TAG_F -H5T_mp_H5TVLEN_CREATE_F -H5T_mp_H5TIS_VARIABLE_STR_F -H5T_mp_H5TGET_MEMBER_CLASS_F -H5T_mp_H5TCOMMIT_ANON_F -H5T_mp_H5TCOMMITTED_F -H5T_mp_H5TDECODE_F -H5T_mp_H5TENCODE_F -H5T_mp_H5TGET_CREATE_PLIST_F -H5T_mp_H5TCOMPILER_CONV_F -H5T_mp_H5TGET_NATIVE_TYPE_F -; H5Z -H5Z_mp_H5ZUNREGISTER_F -H5Z_mp_H5ZFILTER_AVAIL_F -H5Z_mp_H5ZGET_FILTER_INFO_F -; Parallel -H5FDMPIO_mp_H5PSET_FAPL_MPIO_F -H5FDMPIO_mp_H5PSET_DXPL_MPIO_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d19baea..92ba651 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -100,12 +100,13 @@ ADD_TEST (NAME testhdf5_fortran_1_8 COMMAND $) SET_TESTS_PROPERTIES(testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") #-- Adding test for fortranlib_test_F03 -IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +IF (HDF5_ENABLE_F2003) ADD_EXECUTABLE (fortranlib_test_F03 fortranlib_test_F03.f90 tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 + tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 ) @@ -124,7 +125,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) ADD_TEST (NAME fortranlib_test_F03 COMMAND $) SET_TESTS_PROPERTIES(fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") -ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ENDIF (HDF5_ENABLE_F2003) #-- Adding test for fflush1 ADD_EXECUTABLE (fflush1 fflush1.f90) diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index b261785..42dd127 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -68,7 +68,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ if FORTRAN_2003_CONDITIONAL_F fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 endif diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index e42b080..b9f05e3 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -136,11 +136,13 @@ fortranlib_test_1_8_LDADD = $(LDADD) fortranlib_test_1_8_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \ $(LIBH5F) $(LIBHDF5) am__fortranlib_test_F03_SOURCES_DIST = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 \ + tH5T_F03.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@am_fortranlib_test_F03_OBJECTS = fortranlib_test_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5E_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5L_F03.$(OBJEXT) \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5O_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5P_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5T_F03.$(OBJEXT) fortranlib_test_F03_OBJECTS = $(am_fortranlib_test_F03_OBJECTS) @@ -525,7 +527,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ -@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 fflush1_SOURCES = fflush1.f90 fflush2_SOURCES = fflush2.f90 diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90 index 321cb99..d3ced72 100644 --- a/fortran/test/fortranlib_test_1_8.f90 +++ b/fortran/test/fortranlib_test_1_8.f90 @@ -94,12 +94,6 @@ PROGRAM fortranlibtest total_error) ret_total_error = 0 - CALL test_nbit(cleanup, ret_total_error ) - CALL write_test_status(ret_total_error, & - ' Testing nbit filter', & - total_error) - - ret_total_error = 0 CALL test_scaleoffset(cleanup, ret_total_error ) CALL write_test_status(ret_total_error, & ' Testing scaleoffset filter', & @@ -401,141 +395,6 @@ SUBROUTINE test_h5s_encode(cleanup, total_error) END SUBROUTINE test_h5s_encode !------------------------------------------------------------------------- -! Function: test_nbit -! -! Purpose: Tests (real) datatype for nbit filter -! -! Return: Success: 0 -! Failure: >0 -! -! Programmer: M. Scot Breitenfeld -! Decemeber 7, 2010 -! -! Modifications: -! -!------------------------------------------------------------------------- -! - -SUBROUTINE test_nbit(cleanup, total_error ) - - USE HDF5 - - IMPLICIT NONE - INTEGER, PARAMETER :: wp = KIND(1.0) - LOGICAL, INTENT(IN) :: cleanup - INTEGER, INTENT(INOUT) :: total_error - INTEGER(hid_t) :: file - - INTEGER(hid_t) :: dataset, datatype, space, dc - INTEGER(hsize_t), DIMENSION(1:2) :: dims = (/2,5/) - INTEGER(hsize_t), DIMENSION(1:2) :: chunk_dim = (/2,5/) - ! orig_data[] are initialized to be within the range that can be represented by - ! dataset datatype (no precision loss during datatype conversion) - ! - REAL(kind=wp), DIMENSION(1:2,1:5) :: orig_data = RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, & - 5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) ) - REAL(kind=wp), DIMENSION(1:2,1:5) :: new_data - INTEGER(size_t) :: PRECISION, offset - INTEGER :: error - LOGICAL :: status - INTEGER*8 :: ii - INTEGER(size_t) :: i, j - - - ! check to see if filter is available - CALL H5Zfilter_avail_f(H5Z_FILTER_NBIT_F, status, error) - IF(.NOT.status)THEN ! We don't have H5Z_FILTER_NBIT_F filter - total_error = -1 ! so return - RETURN - ENDIF - - CALL H5Fcreate_f("nbit.h5", H5F_ACC_TRUNC_F, file, error) - CALL check("H5Fcreate_f", error, total_error) - - ! Define dataset datatype (integer), and set precision, offset - CALL H5Tcopy_f(H5T_IEEE_F32BE, datatype, error) - CALL CHECK(" H5Tcopy_f", error, total_error) - CALL H5Tset_fields_f(datatype, 26_size_t, 20_size_t, 6_size_t, 7_size_t, 13_size_t, error) - CALL CHECK(" H5Tset_fields_f", error, total_error) - offset = 7 - CALL H5Tset_offset_f(datatype, offset, error) - CALL CHECK(" H5Tset_offset_f", error, total_error) - PRECISION = 20 - CALL H5Tset_precision_f(datatype,PRECISION, error) - CALL CHECK(" H5Tset_precision_f", error, total_error) - - CALL H5Tset_size_f(datatype, 4_size_t, error) - CALL CHECK(" H5Tset_size_f", error, total_error) - - CALL H5Tset_ebias_f(datatype, 31_size_t, error) - CALL CHECK(" H5Tset_ebias_f", error, total_error) - - ! Create the data space - CALL H5Screate_simple_f(2, dims, space, error) - CALL CHECK(" H5Screate_simple_f", error, total_error) - - ! USE nbit filter - CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dc, error) - CALL CHECK(" H5Pcreate_f", error, total_error) - - CALL H5Pset_chunk_f(dc, 2, chunk_dim, error) - CALL CHECK(" H5Pset_chunk_f", error, total_error) - CALL H5Pset_nbit_f(dc, error) - CALL CHECK(" H5Pset_nbit_f", error, total_error) - - ! Create the dataset - CALL H5Dcreate_f(file, "nbit_real", datatype, & - space, dataset, error, dc) - CALL CHECK(" H5Dcreate_f", error, total_error) - - !---------------------------------------------------------------------- - ! STEP 1: Test nbit by setting up a chunked dataset and writing - ! to it. - !---------------------------------------------------------------------- - ! - CALL H5Dwrite_f(dataset, H5T_NATIVE_REAL, orig_data, dims, error) - CALL CHECK(" H5Dwrite_f", error, total_error) - - !---------------------------------------------------------------------- - ! STEP 2: Try to read the data we just wrote. - !---------------------------------------------------------------------- - ! - CALL H5Dread_f(dataset, H5T_NATIVE_REAL, new_data, dims, error) - CALL CHECK(" H5Dread_f", error, total_error) - - ! Check that the values read are the same as the values written - ! Assume size of long long = size of double - ! - i_loop: DO i = 1, dims(1) - j_loop: DO j = 1, dims(2) - IF(.NOT.(orig_data(i,j).EQ.orig_data(i,j))) CYCLE ! skip IF value is NaN - IF(new_data(i,j) .NE. orig_data(i,j))THEN - total_error = total_error + 1 - WRITE(*,'(" Read different values than written.")') - WRITE(*,'(" At index ", 2(1X,I0))') i, j - EXIT i_loop - END IF - ENDDO j_loop - ENDDO i_loop - - !---------------------------------------------------------------------- - ! Cleanup - !---------------------------------------------------------------------- - ! - CALL H5Tclose_f(datatype, error) - CALL CHECK(" H5Tclose_f", error, total_error) - CALL H5Pclose_f(dc, error) - CALL CHECK(" H5Pclose_f", error, total_error) - CALL H5Sclose_f(space, error) - CALL CHECK(" H5Sclose_f", error, total_error) - CALL H5Dclose_f(dataset, error) - CALL CHECK(" H5Dclose_f", error, total_error) - CALL H5Fclose_f(file, error) - CALL CHECK(" H5Fclose_f", error, total_error) - -END SUBROUTINE test_nbit - -!------------------------------------------------------------------------- ! Function: test_scaleoffset ! ! Purpose: Tests the integer datatype for scaleoffset filter diff --git a/fortran/test/fortranlib_test_F03.f90 b/fortran/test/fortranlib_test_F03.f90 index 1b69f7f..a03241c 100644 --- a/fortran/test/fortranlib_test_F03.f90 +++ b/fortran/test/fortranlib_test_F03.f90 @@ -64,10 +64,7 @@ PROGRAM fortranlibtest_F03 ! CALL write_test_status(ret_total_error, ' Test error API based on data I/O', total_error) WRITE(*,*) -! write(*,*) -! write(*,*) '=========================================' -! write(*,*) 'Testing DATATYPE interface ' -! write(*,*) '=========================================' + ret_total_error = 0 CALL test_array_compound_atomic(ret_total_error) CALL write_test_status(ret_total_error, ' Testing 1-D Array of Compound Datatypes Functionality', total_error) @@ -117,16 +114,16 @@ PROGRAM fortranlibtest_F03 CALL write_test_status(ret_total_error, ' Testing writing/reading string datatypes, using C_LOC', total_error) ret_total_error = 0 + CALL vl_test_special_char(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing string datatypes containing control characters', total_error) + + ret_total_error = 0 CALL test_create(ret_total_error) - CALL write_test_status(ret_total_error, & - ' Testing filling functions', & - total_error) + CALL write_test_status(ret_total_error, ' Testing filling functions', total_error) ret_total_error = 0 CALL test_h5kind_to_type(total_error) - CALL write_test_status(ret_total_error, & - ' Test function h5kind_to_type', & - total_error) + CALL write_test_status(ret_total_error, ' Test function h5kind_to_type', total_error) ret_total_error = 0 CALL test_array_bkg(ret_total_error) @@ -138,14 +135,30 @@ PROGRAM fortranlibtest_F03 ret_total_error = 0 CALL test_iter_group(ret_total_error) - CALL write_test_status(ret_total_error, ' Testing Group Iteration Functionality', total_error) + CALL write_test_status(ret_total_error, ' Testing group iteration functionality', total_error) + + ret_total_error = 0 + CALL test_nbit(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing nbit filter', total_error) + ! write(*,*) ! write(*,*) '=========================================' ! write(*,*) 'Testing GROUP interface ' ! write(*,*) '=========================================' - + ret_total_error = 0 + CALL test_h5o_refcount(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object functions ', total_error) + + ret_total_error = 0 + CALL obj_visit(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object visiting functions ', total_error) + + ret_total_error = 0 + CALL obj_info(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error) + WRITE(*,*) WRITE(*,*) ' ============================================ ' diff --git a/fortran/test/tH5A.f90 b/fortran/test/tH5A.f90 index 03522f7..cecaded 100644 --- a/fortran/test/tH5A.f90 +++ b/fortran/test/tH5A.f90 @@ -100,7 +100,7 @@ CHARACTER(LEN=35), DIMENSION(2) :: aread_data ! Buffer to put read back ! string attr data CHARACTER :: attr_character_data = 'A' - DOUBLE PRECISION, DIMENSION(1) :: attr_double_data = 3.459 + REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459 REAL, DIMENSION(1) :: attr_real_data = 4.0 INTEGER, DIMENSION(1) :: attr_integer_data = 5 INTEGER(HSIZE_T), DIMENSION(7) :: data_dims @@ -109,7 +109,7 @@ CHARACTER :: aread_character_data ! variable to put read back Character attr data INTEGER, DIMENSION(1) :: aread_integer_data ! variable to put read back integer attr data INTEGER, DIMENSION(1) :: aread_null_data = 7 ! variable to put read back null attr data - DOUBLE PRECISION, DIMENSION(1) :: aread_double_data ! variable to put read back double attr data + REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: aread_double_data ! variable to put read back double attr data REAL, DIMENSION(1) :: aread_real_data ! variable to put read back real attr data ! diff --git a/fortran/test/tH5O.f90 b/fortran/test/tH5O.f90 index 247d1d0..b68e7ca 100644 --- a/fortran/test/tH5O.f90 +++ b/fortran/test/tH5O.f90 @@ -35,15 +35,8 @@ SUBROUTINE test_h5o(cleanup, total_error) INTEGER, INTENT(OUT) :: total_error INTEGER :: error - ! /* Output message about test being performed */ - ! WRITE(*,*) "Testing Objects" - -!!$ test_h5o_open(); /* Test generic OPEN FUNCTION */ -!!$ test_h5o_open_by_addr(); /* Test opening objects by address */ -!!$ test_h5o_close(); /* Test generic CLOSE FUNCTION */ -!!$ test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - CALL test_h5o_plist(total_error) ! /* Test object creation properties */ - CALL test_h5o_link(total_error) ! /* Test object link routine */ + CALL test_h5o_plist(total_error) ! Test object creation properties + CALL test_h5o_link(total_error) ! Test object link routine IF(cleanup) CALL h5_cleanup_f("TestFile", H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) @@ -100,6 +93,19 @@ SUBROUTINE test_h5o_link(total_error) INTEGER(HSIZE_T), DIMENSION(1:1) :: dims2 = (/dim0/) ! size read/write buffer INTEGER , DIMENSION(1:dim0) :: wdata2, & ! Write buffer rdata2 ! Read buffer + LOGICAL :: link_exists + CHARACTER(LEN=8) :: chr_exact + CHARACTER(LEN=10) :: chr_lg + INTEGER(size_t) :: nlinks + INTEGER(HID_T) :: plist = -1 + + CHARACTER(LEN=20) :: dset_comment = "dataset comment" + CHARACTER(LEN=13) :: grp_comment = "group comment" + CHARACTER(LEN=10) :: comment_sm ! to small comment sized buffer + CHARACTER(LEN=15) :: comment ! exact comment sized buffer + CHARACTER(LEN=20) :: comment_lg ! large comment sized buffer + INTEGER(HSSIZE_T) :: comment_size + INTEGER(SIZE_T) :: comment_size2 ! Initialize the raw data DO i = 1, TEST6_DIM1 @@ -131,8 +137,6 @@ SUBROUTINE test_h5o_link(total_error) CALL H5Pset_libver_bounds_f(fapl_id, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error) CALL check("H5Pset_libver_bounds_f",error, total_error) -!!$ ret = H5Pset_libver_bounds(fapl_id, (new_format ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST); - ! Create a new HDF5 file CALL H5Fcreate_f(TEST_FILENAME, H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id) CALL check("H5Fcreate_f", error, total_error) @@ -155,10 +159,9 @@ SUBROUTINE test_h5o_link(total_error) ! Create a dataset with no name using the committed datatype CALL H5Dcreate_anon_f(file_id, type_id, space_id, dset_id, error ) ! using no optional parameters CALL check("H5Dcreate_anon_f",error,total_error) - - + ! ! Verify that we can write to and read from the dataset - + ! ! Write the data to the dataset !EP CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata, dims, error, & @@ -199,7 +202,6 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tclose_f(type_id, error) CALL check("h5tclose_f", error, total_error) - ! Re-open datatype using new link CALL H5Topen_f(group_id, "datatype", type_id, error) CALL check("h5topen_f", error, total_error) @@ -208,12 +210,10 @@ SUBROUTINE test_h5o_link(total_error) CALL H5Olink_f(group_id, file_id, "/group", error) CALL check("H5Olink_f", error, total_error) - CALL h5gclose_f(group_id, error) CALL check("h5gclose_f",error,total_error) ! Open dataset through root group and verify its data - CALL H5Dopen_f(file_id, "/group/inter_group/dataset", dset_id, error) CALL check("test_lcpl.h5dopen_f", error, total_error) @@ -236,7 +236,6 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tclose_f(type_id, error) CALL check("h5tclose_f",error,total_error) - ! Close remaining IDs CALL h5sclose_f(space_id, error) CALL check("h5sclose_f",error,total_error) @@ -264,16 +263,214 @@ SUBROUTINE test_h5o_link(total_error) CALL check("h5gcreate_f", error, total_error) CALL h5gcreate_f(file_id,"/G1/G2/G3",group_id,error) CALL check("h5gcreate_f", error, total_error) + + ! Try putting a comment on the group /G1/G2/G3 by name + CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3", grp_comment, error) + CALL check("h5oset_comment_by_name_f", error, total_error) + + comment_lg = ' ' + + CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3", comment_lg, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment_lg(1:13).NE.grp_comment)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! Try putting a comment on the group /G1/G2/G3 by name with trailing blanks + + CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3"//' ', grp_comment, error) + CALL check("h5oset_comment_by_name_f", error, total_error) + + comment_lg = ' ' + + CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3"//' ', comment_lg, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment_lg(1:13).NE.grp_comment)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + ! ! Create the dataset ! CALL h5dcreate_f(group_id, dataset, H5T_STD_I32LE, space_id, dset_id, error) CALL check("h5dcreate_f", error, total_error) + + ! Putting a comment on the dataset + CALL h5oset_comment_f(dset_id, dset_comment, error) + CALL check("h5oset_comment_f", error, total_error) + + ! Try reading into a buffer that is the correct size + + CALL h5oget_comment_f(dset_id, comment, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! Try reading into a buffer that is to small + + CALL h5oget_comment_f(dset_id, comment_sm, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment_sm(1:10).NE.dset_comment(1:10))THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! Try reading into a buffer that is larger then needed + + comment_lg = ' ' + + CALL h5oget_comment_f(dset_id, comment_lg, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment_lg(1:15).NE.dset_comment)THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + IF(comment_lg(16:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + ! + ! Check optional parameter + ! + CALL h5oget_comment_f(dset_id, comment_lg, error, comment_size) + CALL check("h5oget_comment_f", error, total_error) + + IF( comment_size.NE.15)THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! CHECK h5oget_comment_by_name_f + + ! Try reading into a buffer that is the correct size + + CALL h5oget_comment_by_name_f(dset_id, ".", comment, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! Try with trailing blanks in the name + + CALL h5oget_comment_by_name_f(dset_id, ". ", comment, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! + ! Check optional parameter + ! + CALL h5oget_comment_by_name_f(dset_id, ". ", comment_lg, error, comment_size2) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF( comment_size2.NE.15)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + ! ! Write the data to the dataset. ! CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata2, dims2, error) CALL check("h5dwrite_f", error, total_error) + + ! ************************* + ! CHECK H5OEXISTS_BY_NAME_F + ! ************************* + + ! Create a soft link to /G1 + CALL h5lcreate_soft_f("/G1", file_id, "/G1_LINK", error) + CALL check("h5lcreate_soft_f", error, total_error) + + + ! Create a soft link to /G1000, does not exist + CALL h5lcreate_soft_f("/G1000", file_id, "/G1_FALSE", error) + CALL check("h5lcreate_soft_f", error, total_error) + + ! Create a soft link to /G1_LINK + CALL h5lcreate_soft_f("/G1_FALSE", file_id, "/G2_FALSE", error) + CALL check("h5lcreate_soft_f", error, total_error) + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_exact = "/G1_LINK" + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_exact, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_lg = "/G1_LINK" + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_lg = "/G1_LINK " + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_FALSE", link_exists, error) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should not exist + IF(link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + ! Check optional parameter + + CALL h5pcreate_f(H5P_LINK_ACCESS_F,plist,error) + CALL check("h5pcreate_f",error,total_error) + + nlinks = 2 + CALL h5pset_nlinks_f(plist, nlinks, error) + CALL check("h5pset_nlinks_f", error, total_error) + ! Ensure that nlinks was set successfully + nlinks = 0 + CALL h5pget_nlinks_f(plist, nlinks, error) + CALL check("h5pget_nlinks_f",error,total_error) + CALL VERIFY("h5pget_nlinks_f", INT(nlinks), 2, total_error) + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error, plist) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.not.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF ! ! Close and release resources. ! @@ -283,6 +480,14 @@ SUBROUTINE test_h5o_link(total_error) CALL check("h5sclose_f", error, total_error) CALL h5gclose_f(group_id, error) CALL check("h5gclose_f", error, total_error) + + ! Test opening an object by index, note + CALL h5oopen_by_idx_f(file_id, "/G1/G2/G3", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, group_id, error) + CALL check("h5oopen_by_idx_f", error, total_error) + + CALL h5oclose_f(group_id, error) + CALL check("h5gclose_f", error, total_error) + ! ! create property to pass copy options ! @@ -324,7 +529,7 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tcopy_f(H5T_NATIVE_INTEGER, tid, error) CALL check("h5tcopy_f", error, total_error) - ! create named datatype + ! create named datatype CALL h5tcommit_f(file_id, NAME_DATATYPE_SIMPLE, tid, error) CALL check("h5tcommit_f", error, total_error) @@ -346,8 +551,7 @@ SUBROUTINE test_h5o_link(total_error) ! Compare the datatypes CALL h5tequal_f(tid, tid2, flag, error) IF(.NOT.flag)THEN - WRITE(*,*) "h5ocopy_f FAILED" - total_error = total_error + 1 + CALL check("h5ocopy_f FAILED", -1, total_error) ENDIF ! close the destination datatype @@ -436,7 +640,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Create a group, dataset, and committed datatype within the file, ! using the respective type of creation property lists. ! @@ -472,7 +675,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL h5sclose_f(dspace, error) CALL check("h5sclose_f",error,total_error) - ! Close current creation property lists CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) @@ -482,7 +684,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL check("h5pclose_f", error, total_error) ! Retrieve each object's creation property list - CALL H5Gget_create_plist_f(grp, gcpl, error) CALL check("H5Gget_create_plist", error, total_error) @@ -492,7 +693,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL H5Dget_create_plist_f(dset, dcpl, error) CALL check("H5Dget_create_plist_f", error, total_error) - ! Retrieve attribute phase change values on each creation property list and verify CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error) CALL check("H5Pget_attr_phase_change_f", error, total_error) @@ -509,9 +709,7 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Close current objects - CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) CALL h5pclose_f(dcpl,error) @@ -552,7 +750,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL H5Dget_create_plist_f(dset, dcpl, error) CALL check("H5Dget_create_plist_f", error, total_error) - ! Retrieve attribute phase change values on each creation property list and verify CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error) CALL check("H5Pget_attr_phase_change_f", error, total_error) @@ -569,9 +766,7 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Close current objects - CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) CALL h5pclose_f(dcpl,error) diff --git a/fortran/test/tH5O_F03.f90 b/fortran/test/tH5O_F03.f90 new file mode 100644 index 0000000..f060a7d --- /dev/null +++ b/fortran/test/tH5O_F03.f90 @@ -0,0 +1,547 @@ +!****h* root/fortran/test/tH5O_F03.f90 +! +! NAME +! tH5O_F03.f90 +! +! FUNCTION +! Test FORTRAN HDF5 H5O APIs which are dependent on FORTRAN 2003 +! features. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +!***** + +! ***************************************** +! *** H 5 O T E S T S +! ***************************************** +MODULE visit_cb + + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, PARAMETER :: info_size = 9 + + !------------------------------------------------------------------------- + ! Function: visit_obj_cb + ! + ! Purpose: Callback routine for visiting objects in a file + ! + ! Return: Success: 0 + ! Failure: -1 + ! + ! Programmer: M.S. Breitenfeld + ! July 12, 2012 + ! Adopted from C test. + ! + !------------------------------------------------------------------------- + ! + ! Object visit structs + TYPE, bind(c) :: obj_visit_t + CHARACTER(LEN=1), DIMENSION(1:180) :: path ! Path to object + INTEGER :: type_obj ! type of object + END TYPE obj_visit_t + + TYPE, bind(c) :: ovisit_ud_t + INTEGER :: idx ! Index in object visit structure + TYPE(obj_visit_t), DIMENSION(1:info_size) :: info ! Pointer to the object visit structure to use + END TYPE ovisit_ud_t + +CONTAINS + + INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo, op_data) bind(C) + + IMPLICIT NONE + + INTEGER(HID_T) :: group_id + CHARACTER(LEN=1), DIMENSION(1:180) :: name + TYPE(h5o_info_t) :: oinfo + TYPE(ovisit_ud_t) :: op_data + + INTEGER :: len, i + INTEGER :: idx + + visit_obj_cb = 0 + + ! Since the name is generated in C and passed to a Fortran string, it + ! will be NULL terminated, so we need to find the end of the string. + + len = 1 + DO len = 1, 180 + IF(name(len) .EQ. C_NULL_CHAR) EXIT + ENDDO + + len = len - 1 + + ! Check for correct object information + + idx = op_data%idx + + DO i = 1, len + IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN + visit_obj_cb = -1 + RETURN + ENDIF + + IF(op_data%info(idx)%type_obj .NE. oinfo%type)THEN + visit_obj_cb = -1 + RETURN + ENDIF + + ENDDO + + ! Advance to next location in expected output + op_data%idx = op_data%idx + 1 + + END FUNCTION visit_obj_cb + +END MODULE visit_cb + +!/**************************************************************** +!** +!** test_h5o_refcount(): Test H5O refcounting functions. +!** +!****************************************************************/ + +SUBROUTINE test_h5o_refcount(total_error) + + USE HDF5 + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + CHARACTER(LEN=11), PARAMETER :: FILENAME = "th5o_ref.h5" + INTEGER, PARAMETER :: DIM0 = 5 + INTEGER, PARAMETER :: DIM1 = 10 + INTEGER(hid_t) :: fid ! HDF5 File ID + INTEGER(hid_t) :: grp, dset, dtype, dspace ! Object identifiers + TYPE(h5o_info_t) :: oinfo ! Object info struct + INTEGER(hsize_t), DIMENSION(1:2) :: dims + INTEGER :: error ! Value returned from API calls + + ! Create a new HDF5 file + CALL h5fcreate_f(FILENAME,H5F_ACC_TRUNC_F,fid,error) + CALL check("h5fcreate_f", error, total_error) + + ! Create a group, dataset, and committed datatype within the file + ! Create the group + CALL h5gcreate_f(fid, "group", grp, error) + CALL check("h5gcreate_f",error, total_error) + + ! Commit the type inside the group + CALL h5tcopy_f(H5T_NATIVE_INTEGER, dtype, error) + CALL check("H5Tcopy_f",error, total_error) + CALL h5tcommit_f(fid, "datatype", dtype, error) + CALL check("h5tcommit_f", error, total_error) + + ! Create the data space for the dataset. + dims(1) = DIM0 + dims(2) = DIM1 + + CALL h5screate_simple_f(2, dims, dspace, error) + CALL check("h5screate_simple_f", error, total_error) + + ! Create the dataset. + CALL h5dcreate_f(fid, "dataset", H5T_NATIVE_INTEGER, dspace, dset, error) + CALL check("h5dcreate_f", error, total_error) + CALL h5sclose_f(dspace, error) + CALL check("h5sclose_f", error, total_error) + + ! Get ref counts for each object. They should all be 1, since each object has a hard link. + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + ! Check h5oget_info + CALL h5oget_info_f(grp, oinfo, error) + CALL check("h5oget_info_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_f", -1, total_error) + ENDIF + IF(oinfo%type.NE.H5O_TYPE_GROUP_F)THEN + CALL check("h5oget_info_f", -1, total_error) + ENDIF + + ! Increment each object's reference count. + CALL h5oincr_refcount_f(grp, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5oincr_refcount_f(dtype, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5oincr_refcount_f(dset, error) + CALL check("h5oincr_refcount_f", error, total_error) + + ! Get ref counts for each object. They should all be 2 now. + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + ! Decrement the reference counts and check that they decrease back to 1. + CALL h5odecr_refcount_f(grp, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5odecr_refcount_f(dtype, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5odecr_refcount_f(dset, error) + CALL check("h5oincr_refcount_f", error, total_error) + + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + CALL h5gclose_f(grp, error) + CALL check("h5gclose_f",error, total_error) + CALL h5tclose_f(dtype, error) + CALL check("h5tclose_f",error, total_error) + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f",error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f",error, total_error) + +END SUBROUTINE test_h5o_refcount + +!**************************************************************** +!** +!** test_h5o_refcount(): Test H5O visit functions. +!** +!**************************************************************** + +SUBROUTINE obj_visit(total_error) + + USE HDF5 + + USE visit_cb + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + TYPE(ovisit_ud_t), TARGET :: udata ! User-data for visiting + INTEGER(hid_t) :: fid = -1 + INTEGER(hid_t) :: gid = -1 ! Group ID + TYPE(C_PTR) :: f_ptr + TYPE(C_FUNPTR) :: fun_ptr + CHARACTER(LEN=180) :: object_name + INTEGER :: ret_val + INTEGER :: error + + ! Construct "interesting" file to visit + CALL build_visit_file(fid) + + ! Inialize udata for testing purposes + udata%info(1)%path(1:1) ="." + udata%info(1)%type_obj = H5O_TYPE_GROUP_F + udata%info(2)%path(1:12) = & + (/"D","a","t","a","s","e","t","_","z","e","r","o"/) + udata%info(2)%type_obj =H5O_TYPE_DATASET_F + udata%info(3)%path(1:6) = & + (/"G","r","o","u","p","1"/) + udata%info(3)%type_obj = H5O_TYPE_GROUP_F + udata%info(4)%path(1:18) =& + (/"G","r","o","u","p","1","/","D","a","t","a","s","e","t","_","o","n","e"/) + udata%info(4)%type_obj = H5O_TYPE_DATASET_F + udata%info(5)%path(1:13) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2"/) + udata%info(5)%type_obj = H5O_TYPE_GROUP_F + udata%info(6)%path(1:25) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","D","a","t","a","s","e","t","_","t","w","o"/) + udata%info(6)%type_obj = H5O_TYPE_DATASET_F + udata%info(7)%path(1:22) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","T","y","p","e","_","t","w","o"/) + udata%info(7)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + udata%info(8)%path(1:15) =& + (/"G","r","o","u","p","1","/","T","y","p","e","_","o","n","e"/) + udata%info(8)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + udata%info(9)%path(1:9) =& + (/"T","y","p","e","_","z","e","r","o"/) + udata%info(9)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + + ! Visit all the objects reachable from the root group (with file ID) + udata%idx = 1 + + fun_ptr = C_FUNLOC(visit_obj_cb) + f_ptr = C_LOC(udata) + + ! Test h5ovisit_f + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + + ! Test h5ovisit_by_name_f + + object_name = "/" + udata%idx = 1 + + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f",error, total_error) + +END SUBROUTINE obj_visit + +!**************************************************************** +!** +!** test_h5o_refcount(): Test H5O info functions. +!** +!**************************************************************** + +SUBROUTINE obj_info(total_error) + + USE HDF5 + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + INTEGER(hid_t) :: fid = -1 ! File ID + INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs + INTEGER(hid_t) :: did ! Dataset ID + INTEGER(hid_t) :: sid ! Dataspace ID + TYPE(hobj_ref_t_f), TARGET :: wref ! Reference to write + TYPE(hobj_ref_t_f), TARGET :: rref ! Reference to read + TYPE(H5O_info_t) :: oinfo ! Object info struct + INTEGER :: count = 0 ! Count within iterated group + INTEGER :: error + TYPE(C_PTR) :: f_ptr + + CHARACTER(LEN=6) :: GROUPNAME = "/group" + CHARACTER(LEN=6) :: GROUPNAME2 = "group2" + CHARACTER(LEN=6) :: GROUPNAME3 = "group3" + CHARACTER(LEN=5) :: DSETNAME = "/dset" + CHARACTER(LEN=5) :: DSETNAME2 = "dset2" + + ! Create file with a group and a dataset containing an object reference to the group + CALL h5fcreate_f("get_info.h5", H5F_ACC_TRUNC_F, fid, error) + CALL check("h5fcreate_f",error, total_error) + + ! Create dataspace to use for dataset + CALL h5screate_f(H5S_SCALAR_F, sid, error) + CALL check("h5screate_f",error,total_error) + + ! Create group to refer to + CALL h5gcreate_f(fid, GROUPNAME, gid, error) + CALL check("h5gcreate_f",error,total_error) + + ! Create nested groups + CALL h5gcreate_f(gid, GROUPNAME2, gid2, error) + CALL check("h5gcreate_f",error,total_error) + CALL h5gclose_f(gid2, error) + CALL check("h5gclose_f",error,total_error) + + CALL h5gcreate_f(gid, GROUPNAME3, gid2, error) + CALL check("h5gcreate_f",error,total_error) + CALL h5gclose_f(gid2, error) + CALL check("h5gclose_f",error,total_error) + + ! Create bottom dataset + CALL h5dcreate_f(gid, DSETNAME2, H5T_NATIVE_INTEGER, sid, did, error) + CALL check("h5dcreate_f",error, total_error) + + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + + CALL h5gclose_f(gid, error) + CALL check("h5gclose_f",error,total_error) + + ! Create dataset + CALL h5dcreate_f(fid, DSETNAME, H5T_STD_REF_OBJ, sid, did, error) + CALL check("h5dcreate_f",error, total_error) + + f_ptr = C_LOC(wref) + + ! Create reference to group + CALL h5rcreate_f(fid, GROUPNAME, H5R_OBJECT_F, f_ptr, error) + CALL check("h5rcreate_f",error, total_error) + + ! Write reference to disk + CALL h5dwrite_f(did, H5T_STD_REF_OBJ, f_ptr, error) + CALL check("h5dwrite_f",error, total_error) + + ! Close objects + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + CALL h5sclose_f(sid, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f", error, total_error) + + ! Re-open file + CALL h5fopen_f("get_info.h5", H5F_ACC_RDWR_F, fid, error) + CALL check("h5fopen_f", error, total_error) + + ! Re-open dataset + CALL h5dopen_f(fid, DSETNAME, did, error) + CALL check("h5dopen_f", error, total_error) + + ! Read in the reference + + f_ptr = C_LOC(rref) + + CALL h5dread_f(did, H5T_STD_REF_OBJ, f_ptr, error) + CALL check("H5Dread_f",error, total_error) + + ! Dereference to get the group + + CALL h5rdereference_f(did, H5R_OBJECT_F, f_ptr, gid, error) + CALL check("h5rdereference_f", error, total_error) + + CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error) + CALL check("h5oget_info_by_idx_f", error, total_error) + + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + + IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + + ! Close objects + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + CALL h5gclose_f(gid, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f", error, total_error) + +END SUBROUTINE obj_info + +!------------------------------------------------------------------------- +! Function: build_visit_file +! +! Purpose: Build an "interesting" file to use for visiting links & objects +! +! Programmer: M. Scot Breitenfeld +! July 12, 2012 +! NOTE: Adapted from C test. +! +!------------------------------------------------------------------------- +! + +SUBROUTINE build_visit_file(fid) + + USE HDF5 + IMPLICIT NONE + + INTEGER(hid_t) :: fid ! File ID + INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs + INTEGER(hid_t) :: sid = -1 ! Dataspace ID + INTEGER(hid_t) :: did = -1 ! Dataset ID + INTEGER(hid_t) :: tid = -1 ! Datatype ID + CHARACTER(LEN=20) :: filename = 'visit.h5' + INTEGER :: error + + ! Create file for visiting + CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, fid, error) + + ! Create group + CALL H5Gcreate_f(fid, "/Group1", gid, error) + + ! Create nested group + CALL H5Gcreate_f(gid, "Group2", gid2, error) + + ! Close groups + CALL h5gclose_f(gid2, error) + CALL h5gclose_f(gid, error) + + ! Create soft links to groups created + CALL H5Lcreate_soft_f("/Group1", fid, "/soft_one", error) + CALL H5Lcreate_soft_f("/Group1/Group2", fid, "/soft_two", error) + + ! Create dangling soft link + CALL H5Lcreate_soft_f("nowhere", fid, "/soft_dangle", error) + + ! Create hard links to all groups + CALL H5Lcreate_hard_f(fid, "/", fid, "hard_zero", error) + CALL H5Lcreate_hard_f(fid, "/Group1", fid, "hard_one", error) + CALL H5Lcreate_hard_f(fid, "/Group1/Group2", fid, "hard_two", error) + + ! Create loops w/hard links + CALL H5Lcreate_hard_f(fid, "/Group1", fid, "/Group1/hard_one", error) + CALL H5Lcreate_hard_f(fid, "/", fid, "/Group1/Group2/hard_zero", error) + + ! Create dataset in each group + CALL H5Screate_f(H5S_SCALAR_F, sid, error) + + CALL H5Dcreate_f(fid, "/Dataset_zero", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Dcreate_f(fid, "/Group1/Dataset_one", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Dcreate_f(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Sclose_f(sid, error) + + ! Create named datatype in each group + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + + CALL H5Tcommit_f(fid, "/Type_zero", tid, error) + CALL H5Tclose_f(tid, error) + + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + CALL H5Tcommit_f(fid, "/Group1/Type_one", tid, error) + CALL H5Tclose_f(tid, error) + + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + CALL H5Tcommit_f(fid, "/Group1/Group2/Type_two", tid, error) + CALL H5Tclose_f(tid, error) + +END SUBROUTINE build_visit_file diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90 index 9605c45..b42a8e6 100644 --- a/fortran/test/tH5T.f90 +++ b/fortran/test/tH5T.f90 @@ -86,8 +86,8 @@ CHARACTER(LEN=2), DIMENSION(dimsize) :: char_member_out ! Buffer to read data out INTEGER, DIMENSION(dimsize) :: int_member INTEGER, DIMENSION(dimsize) :: int_member_out - DOUBLE PRECISION, DIMENSION(dimsize) :: double_member - DOUBLE PRECISION, DIMENSION(dimsize) :: double_member_out + REAL(KIND=Fortran_DOUBLE), DIMENSION(dimsize) :: double_member + REAL(KIND=Fortran_DOUBLE), DIMENSION(dimsize) :: double_member_out REAL, DIMENSION(dimsize) :: real_member REAL, DIMENSION(dimsize) :: real_member_out INTEGER :: i diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index 215ac9e..1c4da8b 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -103,7 +103,7 @@ SUBROUTINE test_array_compound_atomic(total_error) ! Create file CALL h5fcreate_f(FILENAME,H5F_ACC_TRUNC_F,fid1,error) - CALL check("h5fcreate_f", error, total_error) + CALL check("h5fcreate_f", error, total_error) ! Create dataspace for datasets CALL h5screate_simple_f(SPACE1_RANK, sdims1, sid1, error) @@ -1976,8 +1976,8 @@ SUBROUTINE t_regref(total_error) INTEGER(HSIZE_T), DIMENSION(1:1) :: maxdims INTEGER(hssize_t) :: npoints - TYPE(hdset_reg_ref_t_f), DIMENSION(1:dim0), TARGET :: wdata ! Write buffer - TYPE(hdset_reg_ref_t_f), DIMENSION(:), ALLOCATABLE, TARGET :: rdata ! Read buffer + TYPE(hdset_reg_ref_t_f03), DIMENSION(1:dim0), TARGET :: wdata ! Write buffer + TYPE(hdset_reg_ref_t_f03), DIMENSION(:), ALLOCATABLE, TARGET :: rdata ! Read buffer INTEGER(size_t) :: size CHARACTER(LEN=1), DIMENSION(1:ds2dim0,1:ds2dim1), TARGET :: wdata2 @@ -2058,7 +2058,6 @@ SUBROUTINE t_regref(total_error) CALL check("h5sclose_f",error, total_error) CALL h5fclose_f(file , error) CALL check("h5fclose_f",error, total_error) - ! ! Now we begin the read section of this example. ! @@ -2095,10 +2094,11 @@ SUBROUTINE t_regref(total_error) ! Open the referenced object, retrieve its region as a ! dataspace selection. ! - CALL H5Rdereference_f(dset, rdata(i), dset2, error) + f_ptr = C_LOC(rdata(i)) + CALL H5Rdereference_f(dset, H5R_DATASET_REGION_F, f_ptr, dset2, error) CALL check("H5Rdereference_f",error, total_error) - - CALL H5Rget_region_f(dset, rdata(i), space, error) + + CALL H5Rget_region_f(dset, f_ptr, space, error) CALL check("H5Rget_region_f",error, total_error) ! @@ -2754,7 +2754,7 @@ SUBROUTINE t_string(total_error) CALL check("H5Dget_type_f",error, total_error) CALL H5Tget_size_f(filetype, size, error) CALL check("H5Tget_size_f",error, total_error) - CALL VERIFY("H5Tget_size_f", size, sdim, total_error) + CALL VERIFY("H5Tget_size_f", INT(size), INT(sdim), total_error) ! ! Get dataspace. ! @@ -2800,4 +2800,295 @@ SUBROUTINE t_string(total_error) END SUBROUTINE t_string +SUBROUTINE vl_test_special_char(cleanup, total_error) + + USE hdf5 + IMPLICIT NONE + + INTERFACE + SUBROUTINE setup_buffer(data_in, line_lengths, char_type) + USE hdf5 + USE ISO_C_BINDING + IMPLICIT NONE + CHARACTER(len=*), DIMENSION(:) :: data_in + INTEGER(size_t), DIMENSION(:) :: line_lengths + CHARACTER(KIND=C_CHAR,LEN=*) :: char_type + END SUBROUTINE setup_buffer + END INTERFACE + + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=16), PARAMETER :: filename = "t_controlchar.h5" + INTEGER, PARAMETER :: line_length = 10 + INTEGER(hid_t) :: file + INTEGER(hid_t) :: dataset0 + CHARACTER(len=line_length), DIMENSION(1:100) :: data_in + CHARACTER(len=line_length), DIMENSION(1:100) :: data_out + INTEGER(size_t), DIMENSION(1:100) :: line_lengths + INTEGER(hid_t) :: string_id, space, dcpl + INTEGER(hsize_t), DIMENSION(1:1) :: dims = (/0/) + INTEGER(hsize_t), DIMENSION(1:1) :: max_dims = (/0/) + INTEGER(hsize_t), DIMENSION(1:2) :: data_dims = (/0,0/) + INTEGER(hsize_t), DIMENSION(1:1) :: chunk =(/10/) + INTEGER, PARAMETER :: ncontrolchar = 7 + CHARACTER(KIND=C_CHAR,LEN=1), DIMENSION(1:ncontrolchar) :: controlchar = & + (/C_ALERT, C_BACKSPACE,C_CARRIAGE_RETURN, C_FORM_FEED,C_HORIZONTAL_TAB,C_VERTICAL_TAB, C_NEW_LINE/) + INTEGER :: i, j, n, error + n = 8 + ! + ! Create a new file using the default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file, error) + CALL check("h5fcreate_f",error, total_error) + + max_dims = (/H5S_UNLIMITED_F/) + + ! + ! Create the memory datatype. + ! + CALL h5tcopy_f(h5t_string, string_id, error) + CALL check("h5tcopy_f", error, total_error) + CALL h5tset_strpad_f(string_id, h5t_str_nullpad_f, error) + CALL check("h5tset_strpad_f", error, total_error) + dims(1) = n + ! + ! Create dataspace. + ! + CALL h5screate_simple_f(1, dims, space, error, max_dims) + CALL check("h5screate_simple_f", error, total_error) + CALL h5pcreate_f(h5p_dataset_create_f, dcpl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_chunk_f(dcpl, 1, chunk, error) + CALL check("h5pset_chunk_f", error, total_error) + + data_dims(1) = line_length + data_dims(2) = n + ! + ! Create data with strings containing various control characters. + ! + DO i = 1, ncontrolchar + ! + ! Create the dataset, for the string with control character and write the string data to it. + ! + CALL h5dcreate_f(file, controlchar(i), string_id, space, dataset0, error, dcpl) + CALL check("h5dcreate_f", error, total_error) + CALL setup_buffer(data_in(1:n), line_lengths, controlchar(i)) + CALL h5dwrite_vl_f(dataset0, string_id, data_in(1:n), data_dims, line_lengths(1:n), error, space) + CALL check("h5dwrite_vl_f", error, total_error) + ! + ! Read the string back. + ! + CALL h5dread_vl_f(dataset0, string_id, data_out(1:n), data_dims, line_lengths(1:n), error, space) + CALL check("h5dread_vl_f", error, total_error) + + DO j = 1, n + IF(data_in(j).NE.data_out(j))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + CALL h5dclose_f(dataset0, error) + CALL check("h5dclose_f", error, total_error) + ENDDO + + CALL h5pclose_f(dcpl, error) + CALL check("h5pclose_f", error, total_error) + CALL h5sclose_f(space, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(file, error) + CALL check("h5fclose_f", error, total_error) + +END SUBROUTINE vl_test_special_char + + +SUBROUTINE setup_buffer(data_in, line_lengths, char_type) + + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + ! Creates a simple "Data_in" consisting of the letters of the alphabet, + ! one per line, with a control character. + + CHARACTER(len=10), DIMENSION(:) :: data_in + INTEGER(size_t), DIMENSION(:) :: line_lengths + INTEGER, DIMENSION(1:3) :: letters + CHARACTER(LEN=3) :: lets + CHARACTER(KIND=C_CHAR,LEN=*) :: char_type + CHARACTER(KIND=C_CHAR,LEN=1) :: char_tmp + INTEGER :: i, j, n, ff + + ! Convert the letters and special character to integers + lets = 'abc' + + READ(lets,'(3A1)') letters + READ(char_type,'(A1)') ff + n = SIZE(data_in) + j = 1 + DO i=1,n-1 + IF( j .EQ. 4 )THEN + WRITE(char_tmp,'(A1)') ff + data_in(i:i) = char_tmp + ELSE + WRITE(char_tmp,'(A1)') letters(j) + data_in(i:i) = char_tmp + ENDIF + line_lengths(i) = LEN_TRIM(data_in(i)) + j = j + 1 + IF( j .EQ. 5 ) j = 1 + END DO + WRITE(char_tmp,'(A1)') ff + data_in(n:n) = char_tmp + line_lengths(n) = 1 + +END SUBROUTINE setup_buffer + +!------------------------------------------------------------------------- +! Function: test_nbit +! +! Purpose: Tests (real, 4 byte) datatype for nbit filter +! +! Return: Success: 0 +! Failure: >0 +! +! Programmer: M. Scot Breitenfeld +! Decemeber 7, 2010 +! +! Modifications: Moved this subroutine from the 1.8 test file and +! modified it to use F2003 features. +! This routine requires 4 byte reals, so we use F2003 features to +! ensure the requirement is satisfied in a portable way. +! The need for this arises when a user specifies the default real is 8 bytes. +! MSB 7/31/12 +! +!------------------------------------------------------------------------- +! + +SUBROUTINE test_nbit(cleanup, total_error ) + + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + INTEGER, PARAMETER :: wp = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(INOUT) :: total_error + INTEGER(hid_t) :: file + + INTEGER(hid_t) :: dataset, datatype, space, dc, mem_type_id + INTEGER(hsize_t), DIMENSION(1:2) :: dims = (/2,5/) + INTEGER(hsize_t), DIMENSION(1:2) :: chunk_dim = (/2,5/) + ! orig_data[] are initialized to be within the range that can be represented by + ! dataset datatype (no precision loss during datatype conversion) + ! + REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: orig_data = & + RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, & + 5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) ) + REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: new_data + INTEGER(size_t) :: PRECISION, offset + INTEGER :: error + LOGICAL :: status + INTEGER(size_t) :: i, j + TYPE(C_PTR) :: f_ptr + + ! check to see if filter is available + CALL H5Zfilter_avail_f(H5Z_FILTER_NBIT_F, status, error) + IF(.NOT.status)THEN ! We don't have H5Z_FILTER_NBIT_F filter + total_error = -1 ! so return + RETURN + ENDIF + + CALL H5Fcreate_f("nbit.h5", H5F_ACC_TRUNC_F, file, error) + CALL check("H5Fcreate_f", error, total_error) + + ! Define dataset datatype (integer), and set precision, offset + CALL H5Tcopy_f(H5T_IEEE_F32BE, datatype, error) + CALL CHECK(" H5Tcopy_f", error, total_error) + CALL H5Tset_fields_f(datatype, 26_size_t, 20_size_t, 6_size_t, 7_size_t, 13_size_t, error) + CALL CHECK(" H5Tset_fields_f", error, total_error) + offset = 7 + CALL H5Tset_offset_f(datatype, offset, error) + CALL CHECK(" H5Tset_offset_f", error, total_error) + PRECISION = 20 + CALL H5Tset_precision_f(datatype,PRECISION, error) + CALL CHECK(" H5Tset_precision_f", error, total_error) + + CALL H5Tset_size_f(datatype, 4_size_t, error) + CALL CHECK(" H5Tset_size_f", error, total_error) + + CALL H5Tset_ebias_f(datatype, 31_size_t, error) + CALL CHECK(" H5Tset_ebias_f", error, total_error) + + ! Create the data space + CALL H5Screate_simple_f(2, dims, space, error) + CALL CHECK(" H5Screate_simple_f", error, total_error) + + ! USE nbit filter + CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dc, error) + CALL CHECK(" H5Pcreate_f", error, total_error) + + CALL H5Pset_chunk_f(dc, 2, chunk_dim, error) + CALL CHECK(" H5Pset_chunk_f", error, total_error) + CALL H5Pset_nbit_f(dc, error) + CALL CHECK(" H5Pset_nbit_f", error, total_error) + + ! Create the dataset + CALL H5Dcreate_f(file, "nbit_real", datatype, & + space, dataset, error, dc) + CALL CHECK(" H5Dcreate_f", error, total_error) + + !---------------------------------------------------------------------- + ! STEP 1: Test nbit by setting up a chunked dataset and writing + ! to it. + !---------------------------------------------------------------------- + ! + mem_type_id = h5kind_to_type(wp,H5_REAL_KIND) + + f_ptr = C_LOC(orig_data(1,1)) + CALL H5Dwrite_f(dataset, mem_type_id, f_ptr, error) + CALL CHECK(" H5Dwrite_f", error, total_error) + + !---------------------------------------------------------------------- + ! STEP 2: Try to read the data we just wrote. + !---------------------------------------------------------------------- + ! + f_ptr = C_LOC(new_data(1,1)) + CALL H5Dread_f(dataset, mem_type_id, f_ptr, error) + CALL CHECK(" H5Dread_f", error, total_error) + + ! Check that the values read are the same as the values written + ! Assume size of long long = size of double + ! + i_loop: DO i = 1, dims(1) + j_loop: DO j = 1, dims(2) + IF(.NOT.(orig_data(i,j).EQ.orig_data(i,j))) CYCLE ! skip IF value is NaN + IF(new_data(i,j) .NE. orig_data(i,j))THEN + total_error = total_error + 1 + WRITE(*,'(" Read different values than written.")') + WRITE(*,'(" At index ", 2(1X,I0))') i, j + EXIT i_loop + END IF + ENDDO j_loop + ENDDO i_loop + + !---------------------------------------------------------------------- + ! Cleanup + !---------------------------------------------------------------------- + ! + CALL H5Tclose_f(datatype, error) + CALL CHECK(" H5Tclose_f", error, total_error) + CALL H5Pclose_f(dc, error) + CALL CHECK(" H5Pclose_f", error, total_error) + CALL H5Sclose_f(space, error) + CALL CHECK(" H5Sclose_f", error, total_error) + CALL H5Dclose_f(dataset, error) + CALL CHECK(" H5Dclose_f", error, total_error) + CALL H5Fclose_f(file, error) + CALL CHECK(" H5Fclose_f", error, total_error) + +END SUBROUTINE test_nbit + diff --git a/fortran/testpar/hyper.f90 b/fortran/testpar/hyper.f90 index 1d65ae1..1a580ca 100644 --- a/fortran/testpar/hyper.f90 +++ b/fortran/testpar/hyper.f90 @@ -50,6 +50,7 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) INTEGER :: icount ! number of elements in array CHARACTER(len=80) :: filename ! filename INTEGER :: i + INTEGER :: actual_io_mode ! The type of I/O performed by this process !////////////////////////////////////////////////////////// ! initialize the array data between the processes (3) @@ -180,6 +181,24 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5dwrite_f", hdferror, nerrors) + ! Check h5pget_mpio_actual_io_mode_f function + CALL h5pget_mpio_actual_io_mode_f(dxpl_id, actual_io_mode, hdferror) + CALL check("h5pget_mpio_actual_io_mode_f", hdferror, nerrors) + + IF(do_collective.AND.do_chunk)THEN + IF(actual_io_mode.NE.H5D_MPIO_CHUNK_COLLECTIVE_F)THEN + CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors) + ENDIF + ELSEIF(.NOT.do_collective)THEN + IF(actual_io_mode.NE.H5D_MPIO_NO_COLLECTIVE_F)THEN + CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors) + ENDIF + ELSEIF( do_collective.AND.(.NOT.do_chunk))THEN + IF(actual_io_mode.NE.H5D_MPIO_CONTIG_COLLECTIVE_F)THEN + CALL check("h5pget_mpio_actual_io_mode_f", -1, nerrors) + ENDIF + ENDIF + !////////////////////////////////////////////////////////// ! close HDF5 I/O !////////////////////////////////////////////////////////// diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 40f1770..7943459 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -458,7 +458,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 = 121 +LT_VERS_REVISION = 127 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 500fdc0..be84073 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -474,7 +474,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 = 121 +LT_VERS_REVISION = 127 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/src/H5TB.c b/hl/src/H5TB.c index 0013e67..0b6305b 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -1301,7 +1301,6 @@ herr_t H5TBdelete_record( hid_t loc_id, hsize_t start, hsize_t nrecords ) { - hsize_t nfields; hsize_t ntotal_records; hsize_t read_start; @@ -1316,8 +1315,8 @@ herr_t H5TBdelete_record( hid_t loc_id, hsize_t mem_size[1]; unsigned char *tmp_buf=NULL; size_t src_size; - size_t *src_offset; - size_t *src_sizes; + size_t *src_offset = NULL; + size_t *src_sizes = NULL; hsize_t dims[1]; /*------------------------------------------------------------------------- @@ -1327,23 +1326,20 @@ herr_t H5TBdelete_record( hid_t loc_id, /* get the number of records and fields */ if (H5TBget_table_info ( loc_id, dset_name, &nfields, &ntotal_records ) < 0) - return -1; - - src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)); - src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)); + goto out; - if (src_offset == NULL ) - return -1; - if (src_sizes == NULL ) - return -1; + if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + goto out; + if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + goto out; /* get field info */ if (H5TBget_field_info( loc_id, dset_name, NULL, src_sizes, src_offset, &src_size ) < 0) - return -1; + goto out; /* open the dataset. */ if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - return -1; + goto out; /*------------------------------------------------------------------------- * read the records after the deleted one(s) @@ -1355,14 +1351,12 @@ herr_t H5TBdelete_record( hid_t loc_id, if ( read_nrecords ) { - tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size ); - - if (tmp_buf == NULL ) - return -1; + if(NULL == (tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size ))) + goto out; /* read the records after the deleted one(s) */ if (H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0) - return -1; + goto out; /*------------------------------------------------------------------------- * write the records in another position @@ -1418,31 +1412,34 @@ herr_t H5TBdelete_record( hid_t loc_id, /* close dataset */ if (H5Dclose( did ) < 0) - return -1; - - if (tmp_buf !=NULL) - free( tmp_buf ); - free( src_offset ); - free( src_sizes ); + goto out; + if(tmp_buf) + free(tmp_buf); + if(src_offset) + free(src_offset); + if(src_sizes) + free(src_sizes); return 0; /* error zone */ out: - - if (tmp_buf !=NULL ) - free( tmp_buf ); + if(tmp_buf) + free(tmp_buf); + if(src_offset) + free(src_offset); + if(src_sizes) + free(src_sizes); H5E_BEGIN_TRY { H5Tclose(mem_type_id); H5Dclose(did); H5Tclose(tid); H5Sclose(sid); + H5Sclose(m_sid); } H5E_END_TRY; return -1; - - } /*------------------------------------------------------------------------- @@ -1641,10 +1638,10 @@ herr_t H5TBadd_records_from( hid_t loc_id, hsize_t mem_size[1]; hsize_t nfields; hsize_t ntotal_records; - unsigned char *tmp_buf; + unsigned char *tmp_buf = NULL; size_t src_size; - size_t *src_offset; - size_t *src_sizes; + size_t *src_offset = NULL; + size_t *src_sizes = NULL; /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk @@ -1653,17 +1650,16 @@ herr_t H5TBadd_records_from( hid_t loc_id, /* get the number of records and fields */ if (H5TBget_table_info ( loc_id, dset_name1, &nfields, &ntotal_records ) < 0) - return -1; - - src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)); - src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)); + goto out; - if (src_offset == NULL ) - return -1; + if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + goto out; + if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + goto out; /* get field info */ if (H5TBget_field_info( loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0) - return -1; + goto out; /*------------------------------------------------------------------------- * Get information about the first table and read it @@ -1672,7 +1668,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, /* open the 1st dataset. */ if ((did_1 = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0) - return -1; + goto out; /* get the datatype */ if ((tid_1 = H5Dget_type( did_1 )) < 0) @@ -1686,7 +1682,8 @@ herr_t H5TBadd_records_from( hid_t loc_id, if (( type_size1 = H5Tget_size( tid_1 )) == 0 ) goto out; - tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 ); + if(NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 ))) + goto out; /* define a hyperslab in the dataset of the size of the records */ offset[0] = start1; @@ -1719,18 +1716,27 @@ herr_t H5TBadd_records_from( hid_t loc_id, if (H5Sclose( sid_1 ) < 0) goto out; if (H5Tclose( tid_1 ) < 0) - return -1; + goto out; if (H5Dclose( did_1 ) < 0) - return -1; + goto out; - free( tmp_buf ); - free( src_offset ); - free( src_sizes ); + if(tmp_buf) + free(tmp_buf); + if(src_offset) + free(src_offset); + if(src_sizes) + free(src_sizes); return 0; /* error zone */ out: + if(tmp_buf) + free(tmp_buf); + if(src_offset) + free(src_offset); + if(src_sizes) + free(src_sizes); H5E_BEGIN_TRY { H5Dclose(did_1); @@ -3379,7 +3385,7 @@ int H5TB_find_field( const char *field, const char *field_list ) { ptrdiff_t count = end - start; - if(HDstrncmp(start, field, count) == 0 && count == HDstrlen(field) ) + if(HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field) ) return 1; start = end + 1; } diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 03e5e2f..9fb86a5 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -457,7 +457,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 = 121 +LT_VERS_REVISION = 127 LT_VERS_AGE = 0 # This library is our main target. diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 4cef1b4..a4a10e4 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -676,7 +676,7 @@ static int test_generate(void) goto out; /* Indicate success */ - retval = 0; + return 0; /* error zone, gracefully close */ out: diff --git a/perform/Makefile.am b/perform/Makefile.am index 5d0e11d..988ec63 100644 --- a/perform/Makefile.am +++ b/perform/Makefile.am @@ -37,8 +37,9 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # Some programs are not built or run by default, but can be built by hand or by # specifying --enable-build-all at configure time. # Also, some of these programs should only be built in parallel. +# Currently there is no such program. if BUILD_PARALLEL_CONDITIONAL - PARA_BUILD_ALL=benchpar + PARA_BUILD_ALL= endif if BUILD_ALL_CONDITIONAL BUILD_ALL_PROGS=$(PARA_BUILD_ALL) diff --git a/perform/Makefile.in b/perform/Makefile.in index 139d1ea..230469c 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -90,21 +90,17 @@ CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" -@BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_1 = benchpar$(EXEEXT) +am__EXEEXT_1 = @BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = $(am__EXEEXT_1) PROGRAMS = $(bin_PROGRAMS) -benchpar_SOURCES = benchpar.c -benchpar_OBJECTS = benchpar.$(OBJEXT) -benchpar_LDADD = $(LDADD) -benchpar_DEPENDENCIES = $(LIBHDF5) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = chunk_SOURCES = chunk.c chunk_OBJECTS = chunk.$(OBJEXT) chunk_LDADD = $(LDADD) chunk_DEPENDENCIES = $(LIBHDF5) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = am_h5perf_OBJECTS = pio_perf.$(OBJEXT) pio_engine.$(OBJEXT) \ pio_timer.$(OBJEXT) h5perf_OBJECTS = $(am_h5perf_OBJECTS) @@ -169,12 +165,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = benchpar.c chunk.c $(h5perf_SOURCES) \ - $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \ - perf_meta.c zip_perf.c -DIST_SOURCES = benchpar.c chunk.c $(h5perf_SOURCES) \ - $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \ - perf_meta.c zip_perf.c +SOURCES = chunk.c $(h5perf_SOURCES) $(h5perf_serial_SOURCES) iopipe.c \ + overhead.c perf.c perf_meta.c zip_perf.c +DIST_SOURCES = chunk.c $(h5perf_SOURCES) $(h5perf_serial_SOURCES) \ + iopipe.c overhead.c perf.c perf_meta.c zip_perf.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -477,7 +471,8 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # Some programs are not built or run by default, but can be built by hand or by # specifying --enable-build-all at configure time. # Also, some of these programs should only be built in parallel. -@BUILD_PARALLEL_CONDITIONAL_TRUE@PARA_BUILD_ALL = benchpar +# Currently there is no such program. +@BUILD_PARALLEL_CONDITIONAL_TRUE@PARA_BUILD_ALL = @BUILD_ALL_CONDITIONAL_TRUE@BUILD_ALL_PROGS = $(PARA_BUILD_ALL) # Define programs that will be run in 'make check' @@ -612,9 +607,6 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -benchpar$(EXEEXT): $(benchpar_OBJECTS) $(benchpar_DEPENDENCIES) $(EXTRA_benchpar_DEPENDENCIES) - @rm -f benchpar$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(benchpar_OBJECTS) $(benchpar_LDADD) $(LIBS) chunk$(EXEEXT): $(chunk_OBJECTS) $(chunk_DEPENDENCIES) $(EXTRA_chunk_DEPENDENCIES) @rm -f chunk$(EXEEXT) $(AM_V_CCLD)$(LINK) $(chunk_OBJECTS) $(chunk_LDADD) $(LIBS) @@ -646,7 +638,6 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchpar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iopipe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overhead.Po@am__quote@ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 5ac0aa2..4742542 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.131-FA_a5 currently under development +HDF5 version 1.9.137-FA_a5 currently under development INTRODUCTION @@ -29,7 +29,9 @@ CONTENTS - New Features - Support for new platforms and languages - Bug Fixes since HDF5-1.8.0 -- Platforms Tested +- Supported Platforms +- Tested Configuration Features Summary +- More Tested Platforms - Known Problems @@ -38,6 +40,9 @@ New Features Configuration: ------------- + - Fixed AIX Fortran compiler flags to use appropriate settings for + debugging, profiling, optimization situations. HDFFV-8069. (AKC + 2012/09/27) - Updated to latest autotools and changed all hard *.sh scripts to configure managed *.sh.in files. Removed overloading of autotools TESTS variable by examples and tests. Renamed configure.in to @@ -96,6 +101,9 @@ New Features Library: -------- + - The library now supports the data conversion from enumeration to numeric + (integer and floating-point number) datatypes. See Issue 8221. + (SLU - 2012/10/23) - The data sieve buffer size was for all the datasets in the file. It could waste memory if any dataset size is smaller than the sieve buffer size. Now the library picks the smaller one between the dataset size @@ -184,6 +192,8 @@ New Features Fortran Library: ---------------- + - Added parallel routine H5Pget_mpio_actual_io_mode_f (MSB - 2012/09/27) + - Added for the C API the Fortran wrapper: h5ocopy_f (MSB - 2012/03/22) @@ -229,6 +239,7 @@ New Features (MSB - 2009/04/17) + C++ Library: ------------ - New member functions @@ -697,6 +708,9 @@ Bug Fixes since HDF5-1.8.0 release Performance ------------- + - Removed program perform/benchpar from the enable-build-all list. The + program will be retired or moved to another location. HDFFV-8156 + (AKC 2012/10/01) - Retired program perform/mpi-perf. Its purpose has been incorporated into h5perf before. (AKC 2012/09/20) - ifdefs added to tests around include unistd.h and function to simulate @@ -711,8 +725,28 @@ Bug Fixes since HDF5-1.8.0 release with other Fortran functions; cleaned the code from debug statements. (EIP - 2012/06/23) + - Fixed problem writing/reading control characters to a dataset; writing + a string containing: alerts, backspace, carriage_return, form_feed, + horizontal_tab, vertical_tab, new_line is now tested and working. + (MSB - 2012/09/01) + + - Corrected the integer type of H5S_UNLIMITED_F to HSIZE_T (MSB - 2012/09/01) + + - Corrected the number of continuation lines in the src files + to be less then 32 lines for F95 compliance. (MSB - 2012/10/01) + Tools ----- + - h5diff: Improved speed when comparing HDF5 files with lots of + attributes. Much slower performance was identified with release version + from 1.8.7 to 1.8.10 compared to 1.8.6. (JKM 2012/10/19) + - h5repack: "h5repack -f NONE file1.h5 out.h5" command failed if + source file contains chunked dataset and a chunk dim is bigger than + the dataset dim. Another issue is that the command changed max dims + if chunk dim is smaller than the dataset dim. + These issue occurred when dataset size is smaller than 64k (compact + size limit) Fixed both. + HDFFV-8012 (JKM 2012/09/24) - h5diff: Fixed not to accumulate attribute difference to dataset difference in verbose mode (-v, -r), which caused incorrect difference between dataset and group/datatype object if attribute @@ -933,6 +967,13 @@ Bug Fixes since HDF5-1.8.0 release High-Level APIs: ------ + + - Fixed problem with H5TBdelete_record destroying all data following the deletion + of a row. (MSB- 2012/7/26) + + - Fixed H5LTget_attribute_string not closing an object identifier when an + error occurs. (MSB- 2012/7/21) + - Fixed the H5LTdtype_to_text function. It had some memory problems when dealing with some complicated data types. HDFFVI-7701 (SLU - 2011/10/19) @@ -1012,150 +1053,241 @@ Bug Fixes since HDF5-1.8.0 release -Platforms Tested -================ - +Supported Platforms +=================== AIX 5.3 xlc 10.1.0.5 (NASA G-ADA) xlC 10.1.0.5 xlf90 12.1.0.6 - FreeBSD 8.2-STABLE i386 gcc 4.2.1 [FreeBSD] 20070719 - (loyalty) g++ 4.2.1 [FreeBSD] 20070719 - gcc 4.6.1 20110422 - g++ 4.6.1 20110422 - gfortran 4.6.1 20110422 - - FreeBSD 8.2-STABLE amd64 gcc 4.2.1 [FreeBSD] 20070719 - (freedom) g++ 4.2.1 [FreeBSD] 20070719 - gcc 4.6.1 20110422 - g++ 4.6.1 20110422 - gfortran 4.6.1 20110422 - - Linux 2.6.18-194.3.1.el5PAE gcc (GCC) 4.1.2 and 4.4.2 - #1 SMP i686 i686 i386 GNU Fortran (GCC) 4.1.2 20080704 - (jam) (Red Hat 4.1.2-48) and 4.4.2 - PGI C, Fortran, C++ 10.4-0 32-bit - PGI C, Fortran, C++ 10.6-0 32-bit - Intel(R) C Compiler for 32-bit - applications, Version 11.1 - Intel(R) C++ Compiler for 32-bit - applications, Version 11.1 - Intel(R) Fortran Compiler for 32-bit - applications, Version 11.1 - MPICH mpich2-1.3.1 compiled with + Linux 2.6.18-308.13.1.el5PAE GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP i686 i686 i386 compilers for 32-bit applications; + (jam) Version 4.1.2 20080704 (Red Hat 4.1.2-52) + Version 4.6.3 + PGI C, Fortran, C++ Compilers for 32-bit + applications; + Version 11.9-0 + Intel(R) C, C++, Fortran Compiler for 32-bit + applications; + Version 12.1 + MPICH mpich2-1.4.1p1 compiled with gcc 4.1.2 and gfortran 4.1.2 - Linux 2.6.18-238.12.1.el5 gcc 4.1.2 and 4.4.2 - #1 SMP x86_64 GNU/Linux GNU Fortran (GCC) 4.1.2 20080704 - (koala) (Red Hat 4.1.2-46) and 4.4.2 - tested for both 32- and 64-bit binaries - Intel(R) C, C++, Fortran Compilers for - applications running on Intel(R) 64, - Version 11.1. - PGI C, Fortran, C++ Version 9.0-4 - for 64-bit target on x86-64 - MPICH mpich2-1.3.1 compiled with + Linux 2.6.18-308.16.1.el5 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers for 32-bit applications; + (koala) Version 4.1.2 20080704 (Red Hat 4.1.2-52) + Version 4.6.3 + PGI C, Fortran, C++ for 64-bit target on + x86-64; + Version 11.9-0 + Version 12.5-0 + Intel(R) C, C++, Fortran Compilers for + applications running on Intel(R) 64; + Version 12.1 (Build 20110811) + Version 12.1 (Build 20120212) + MPICH mpich2-1.4.1p1 compiled with gcc 4.1.2 and gfortran 4.1.2 - SGI ProPack 7 Linux Intel(R) C++ Version 11.1 20100806 - 2.6.32.19-0.3.1.1982.0.PTF- Intel(R) Fortran Version 11.1 20100806 - default #1 SMP SGI MPT 2.01 - SGI Altix UV - (NCSA ember) + Linux 2.6.32-220.7.1.el6.ppc64 gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4) + #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4) + (ostrich) GNU Fortran (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4) + + Linux 2.6.32-220.23.1.1chaos Intel C, C++, Fortran Compilers + ch5.x86_64 GNU/Linux Version 12.1.5.339 + (LLNL Aztec) + + IBM Blue Gene/P XL C for Blue Gene/P, bgxlc V9.0 + (LLNL uDawn) XL C++ for Blue Gene/P, bgxlC V9.0 + XL Fortran for Blue Gene/P, bgxlf90 V11.1 SunOS 5.10 32- and 64-bit Sun C 5.9 Sun OS_sparc Patch 124867-16 - (linew) Sun Fortran 95 8.3 Sun OS_sparc Patch -127000-13 - Sun C++ 5.9 Sun OS_sparc Patch 124863-62 - Sun C 5.10 SunOS_sparc Patch 141861-07 - Sun Fortran 95 8.4 SunOS_sparc Patch -128231-06 - Sun C++ 5.10 SunOS_sparc 128228-11 + (linew) Sun Fortran 95 8.3 Sun OS_sparc Patch 127000-13 + Sun C++ 5.9 Sun OS_sparc Patch 124863-26 + Sun C 5.11 SunOS_sparc + Sun Fortran 95 8.5 SunOS_sparc + Sun C++ 5.11 SunOS_sparc + + Windows XP Visual Studio 2008 w/ Intel Fortran 10.1 (project files) + + Windows XP x64 Visual Studio 2008 w/ Intel Fortran 10.1 (project files) Windows 7 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) - Cygwin(1.7.9 native gcc(4.5.3) compiler and gfortran) + Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) + (cmake and autotools) Windows 7 x64 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) - Cygwin(1.7.9 native gcc(4.5.3) compiler and gfortran) + Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) + (cmake and autotools) + + Mac OS X Snow Leopard 10.6.8 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 3.2.6 + Darwin Kernel Version 10.8.0 g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 3.2.6 + (fred) gfortran GNU Fortran (GCC) 4.6.2 + Intel C (icc), Fortran (ifort), C++ (icpc) + 12.1.0.038 Build 20110811 + + Mac OS X Snow Leopard 10.6.8 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 3.2.6 + Darwin Kernel Version 10.8.0 g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 3.2.6 + Intel 32-bit gfortran GNU Fortran (GCC) 4.6.1 + (tejeda) Intel C (icc), Fortran (ifort), C++ (icpc) + 12.1.0.038 Build 20110811 - MAC OS 10.5 (Intel) gcc i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 - G95 (GCC 4.0.3 (g95 0.91!) Nov 21 2006) - GNU Fortran (GCC) 4.3.0 20070810 - Alpha Open VMS 7.3 + Mac OS X Lion 10.7.3 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.2.1 + 32- and 64-bit g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.2.1 + (duck) gfortran GNU Fortran (GCC) 4.6.2 + Mac OS X Mountain Lion 10.8.1 cc Apple clang version 4.0 from Xcode 4.5.1 + (owl) c++ Apple clang version 4.0 from Xcode 4.5.1 + gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.5.1 + g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.5.1 + gfortran GNU Fortran (GCC) 4.6.2 -Supported Configuration Features Summary -======================================== + +Tested Configuration Features Summary +===================================== In the tables below - y = tested and supported - n = not supported or not tested in this release + y = tested + n = not tested in this release + C = Cluster + W = Workstation x = not working in this release + dna = does not apply ( ) = footnote appears below second table - = testing incomplete on this feature or platform - W or C indicates workstation or cluster, respectively. - -Platform C F90 F90 C++ zlib SZIP - parallel parallel -SunOS5.10 64-bit n y n y y y -SunOS5.10 32-bit n y n y y y -Windows 7 y y n y y y -Windows 7 x64 y y n y y y -Mac OS X 10.5 Intel n y n y y y -FreeBSD 8.2 32- and 64-bit n x n x y y -RedHat EL4 2.6.9 i686 GNU W y(2) y(4) y(2) y y y -RedHat EL4 2.6.9 i686 Intel W n y n y y n -RedHat EL4 2.6.9 i686 PGI W n y n y y n -SuSe Linux 2.6.16 x86_64 GNU (5) W y(2) y n y y y -SuSe Linux 2.6.16 x86_64 Int (5) W n y n y n n -SuSe Linux 2.6.16 x86_64 PGI (5) W n y n y n n -RHL9 Linux 2.4 Xeon Lustre Intel C n y n y y n -RHEL3 Linux 2.4 Xeon Intel W n y n n y n -RHEL4 Linux 2.6 Xeon Lustre Int C n y n y y n -SuSE Linux 2.4 ia64 Intel C y(1) y y y y y -SuSe Linux 2.6.5 - SGI Altix ia64 Intel C n y n y n y -Alpha OpenVMS 7.3.2 n y n y n n - - - -Platform Shared Shared Shared static- Thread- - C libs F90 libs C++ libs exec safe -SunOS 5.10 32-bit y y y x y -SunOS 5.10 64-bit y y y x y -Windows XP y y(3) y y n -Windows XP x64 y y(3) y y n -Windows Vista y y(3) y y y -Windows Vista x64 y y(3) y y y -Mac OS X 10.5 Intel y y y x n -FreeBSD 8.2 32- and 64-bit y x x y y -RHEL4 2.6.9 i686 GNU W y y(4) y x y -RHEL4 2.6.9 i686 Intel W y y y x n -RHEL4 2.6.9 i686 PGI W y y y x n -SuSE Linux 2.6.16 x86_64 GNU (5) W y y y x y -SuSE Linux 2.6.16 x86_64 Intel(5) W y y y x n -SuSE Linux 2.6.16 x86_64 PGI(5) W y y y x n -RHL9 Linux 2.4 Xeon Lustre Intel C y y y x n -RHEL3 Linux 2.4 Xeon Intel W y n n x n -RHEL4 Linux 2.6 Xeon Lustre Intel C y y y x n -SuSE Linux 2.4 ia64 Intel C y y y x n -SuSe Linux 2.6.5 - SGI Altix ia64 Intel C n n n x n - - Notes: (1) Using mpich 1.2.6. - (2) Using mpich2 1.0.6. - (3) Using Visual Studio 2008 (Cygwin shared libraries are not supported) - (4) With PGI and Absoft compilers. - (5) AMD Opteron x86_64 - Compiler versions for each platform are listed in the preceding - "Platforms Tested" table. + = testing incomplete on this feature or platform + +Platform C F90/ F90 C++ zlib SZIP + parallel F2003 parallel +Solaris2.10 32-bit n y/y n y y y +Solaris2.10 64-bit n y/n n y y y +Windows 7 y y/n n y y y +Windows 7 x64 y y/n n y y y +Mac OS X Snow Leopard 10.6.8 32-bit n y/y n y y n +Mac OS X Snow Leopard 10.6.8 64-bit n y/y n y y y +Mac OS X Lion 10.7.3 32-bit n y/y n y y n +Mac OS X Lion 10.7.3 64-bit n y/y n y y y +Mac OS X Mountain Lion 10.8.1 64-bit n y/n n y y n +AIX 5.3 32- and 64-bit y y/n y y y y +CentOS 5.5 Linux 2.6.18-308 i686 GNU y y/y y y y y +CentOS 5.5 Linux 2.6.18-308 i686 Intel n y/y n y y y +CentOS 5.5 Linux 2.6.18-308 i686 PGI n y/y n y y y +CentOS 5.5 Linux 2.6.18 x86_64 GNU y y/y y y y y +CentOS 5.5 Linux 2.6.18 x86_64 Intel n y/y n y y y +CentOS 5.5 Linux 2.6.18 x86_64 PGI n y/y n y y y +Linux 2.6.32-220.7.1.el6.ppc64 n y/n n y y y + + +Platform Shared Shared Shared Thread- + C libs F90 libs C++ libs safe +Solaris2.10 32-bit y y y y +Solaris2.10 64-bit n n n n +Windows 7 y y y y +Windows 7 x64 y y y y +Mac OS X Snow Leopard 10.6.8 32-bit y n y n +Mac OS X Snow Leopard 10.6.8 64-bit y n y n +Mac OS X Lion 10.7.3 32-bit y n y y +Mac OS X Lion 10.7.3 64-bit y n y y +Mac OS X Mountain Lion 10.8.1 64-bit y n y y +AIX 5.3 32- and 64-bit n n n y +CentOS 5.5 Linux 2.6.18-308 i686 GNU y y y y +CentOS 5.5 Linux 2.6.18-308 i686 Intel y y y n +CentOS 5.5 Linux 2.6.18-308 i686 PGI y y y n +CentOS 5.5 Linux 2.6.18 x86_64 GNU y y y y +CentOS 5.5 Linux 2.6.18 x86_64 Intel y y y n +CentOS 5.5 Linux 2.6.18 x86_64 PGI y y y n +Linux 2.6.32-220.7.1.el6.ppc64 y y y n + +Compiler versions for each platform are listed in the preceding +"Supported Platforms" table. + + +More Tested Platforms +===================== +The following platforms are not supported but have been tested for this release. + FreeBSD 8.2-STABLE i386 gcc 4.2.1 [FreeBSD] 20070719 + (loyalty) gcc 4.6.1 20110422 + g++ 4.6.1 20110422 + gfortran 4.6.1 20110422 + + FreeBSD 8.2-STABLE amd64 gcc 4.2.1 [FreeBSD] 20070719 + (freedom) gcc 4.6.1 20110422 + g++ 4.6.1 20110422 + gfortran 4.6.1 20110422 + + Debian6.0.3 2.6.32-5-686 #1 SMP i686 GNU/Linux + gcc (Debian 4.4.5-8) 4.4.5 + GNU Fortran (Debian 4.4.5-8) 4.4.5 + (cmake and autotools) + + Debian6.0.3 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux + gcc (Debian 4.4.5-8) 4.4.5 + GNU Fortran (Debian 4.4.5-8) 4.4.5 + (cmake and autotools) + + Fedora17 3.5.2-1.fc17.i6866 #1 SMP i686 i686 i386 GNU/Linux + gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + (cmake and autotools) + + Fedora17 3.5.2-1.fc17.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux + gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + (cmake and autotools) + + SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux + gcc (SUSE Linux) 4.7.1 + GNU Fortran (SUSE Linux) 4.7.1 + (cmake and autotools) + + SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux + gcc (SUSE Linux) 4.7.1 + GNU Fortran (SUSE Linux) 4.7.1 + (cmake and autotools) + + Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP i686 GNU/Linux + gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + (cmake and autotools) + + Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP x86_64 GNU/Linux + gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + (cmake and autotools) + (Use optimization level -O1) + + Cray Linux Environment (CLE) PrgEnv-pgi/4.0.46 + hopper.nersc.gov pgcc 12.5-0 64-bit target on x86-64 Linux -tp shanghai + pgf90 12.5-0 64-bit target on x86-64 Linux -tp shanghai + pgCC 12.5-0 64-bit target on x86-64 Linux -tp shanghai Known Problems ============== +* The 5.9 C++ compiler on Sun failed to compile a C++ test ttypes.cpp. It + complains with this message: + "/home/hdf5/src/H5Vprivate.h", line 130: Error: __func__ is not defined. + + The reason is that __func__ is a predefined identifier in C99 standard. The + HDF5 C library uses it in H5private.h. The test ttypes.cpp includes + H5private.h (H5Tpkg.h<-H5Fprivate.h<-H5Vprivate.h<-H5private.h). Sun's 5.9 + C++ compiler doesn't support __func__, thus fails to compile the C++ test. + But 5.11 C++ compiler does. To check whether your Sun C++ compiler knows this + identifier, try to compile the following simple C++ program: + #include + + int main(void) + { + printf("%s\n", __func__); + return 0; + } + (SLU - 2012/11/5) + +* The C++ and FORTRAN bindings are not currently working on FreeBSD with the + native release 8.2 compilers (4.2.1), but are working with gcc 4.6 from the + ports (and probably gcc releases after that). + (QAK - 2012/10/19) + * The data conversion test dt_arith.c has failures (segmentation fault) from "long double" to other datatypes during hard conversion when the library is built with the default GCC 4.2.1 on Mac Lion system. It only happens diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 65a575b..3cbfe7e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -470,6 +470,7 @@ SET (H5P_SRCS ${HDF5_SRC_DIR}/H5Pdcpl.c ${HDF5_SRC_DIR}/H5Pdeprec.c ${HDF5_SRC_DIR}/H5Pdxpl.c + ${HDF5_SRC_DIR}/H5Pencdec.c ${HDF5_SRC_DIR}/H5Pfapl.c ${HDF5_SRC_DIR}/H5Pfcpl.c ${HDF5_SRC_DIR}/H5Pfmpl.c diff --git a/src/H5AC.c b/src/H5AC.c index abbacce..18289e7 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -129,7 +129,7 @@ static herr_t H5AC_ext_config_2_int_config(H5AC_cache_config_t * ext_conf_ptr, H5C_auto_size_ctl_t * int_conf_ptr); #if H5AC_DO_TAGGING_SANITY_CHECKS -static herr_t H5AC_verify_tag(hid_t dxpl_id, H5AC_class_t * type); +static herr_t H5AC_verify_tag(hid_t dxpl_id, const H5AC_class_t * type); #endif /* H5AC_DO_TAGGING_SANITY_CHECKS */ #ifdef H5_HAVE_PARALLEL @@ -286,11 +286,13 @@ H5AC_init_interface(void) /* Insert 'block before metadata write' property */ block_before_meta_write=1; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Set the transfer mode */ @@ -308,11 +310,13 @@ H5AC_init_interface(void) /* Insert 'block before metadata write' property */ block_before_meta_write=0; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Set the transfer mode */ @@ -330,11 +334,13 @@ H5AC_init_interface(void) /* Insert 'block before metadata write' property */ block_before_meta_write=0; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal, + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") /* Set the transfer mode */ @@ -5408,7 +5414,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC_verify_tag(hid_t dxpl_id, H5AC_class_t * type) +H5AC_verify_tag(hid_t dxpl_id, const H5AC_class_t * type) { H5C_tag_t tag; H5P_genplist_t * dxpl; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 6bf7bd7..16a28f9 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -241,27 +241,27 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* hbool_t evictions_enabled = */ TRUE, \ /* hbool_t set_initial_size = */ TRUE, \ /* size_t initial_size = */ ( 2 * 1024 * 1024), \ - /* double min_clean_fraction = */ 0.3, \ + /* double min_clean_fraction = */ 0.3f, \ /* size_t max_size = */ (32 * 1024 * 1024), \ /* size_t min_size = */ (1 * 1024 * 1024), \ /* long int epoch_length = */ 50000, \ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \ - /* double lower_hr_threshold = */ 0.9, \ - /* double increment = */ 2.0, \ + /* double lower_hr_threshold = */ 0.9f, \ + /* double increment = */ 2.0f, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ /* enum H5C_cache_flash_incr_mode */ \ /* flash_incr_mode = */ H5C_flash_incr__add_space, \ - /* double flash_multiple = */ 1.0, \ - /* double flash_threshold = */ 0.25, \ + /* double flash_multiple = */ 1.0f, \ + /* double flash_threshold = */ 0.25f, \ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \ - /* double upper_hr_threshold = */ 0.999, \ - /* double decrement = */ 0.9, \ + /* double upper_hr_threshold = */ 0.999f, \ + /* double decrement = */ 0.9f, \ /* hbool_t apply_max_decrement = */ TRUE, \ /* size_t max_decrement = */ (1 * 1024 * 1024), \ /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ - /* double empty_reserve = */ 0.1, \ + /* double empty_reserve = */ 0.1f, \ /* int dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ @@ -277,27 +277,27 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* hbool_t evictions_enabled = */ TRUE, \ /* hbool_t set_initial_size = */ TRUE, \ /* size_t initial_size = */ ( 2 * 1024 * 1024), \ - /* double min_clean_fraction = */ 0.01, \ + /* double min_clean_fraction = */ 0.01f, \ /* size_t max_size = */ (32 * 1024 * 1024), \ /* size_t min_size = */ ( 1 * 1024 * 1024), \ /* long int epoch_length = */ 50000, \ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \ - /* double lower_hr_threshold = */ 0.9, \ - /* double increment = */ 2.0, \ + /* double lower_hr_threshold = */ 0.9f, \ + /* double increment = */ 2.0f, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ /* enum H5C_cache_flash_incr_mode */ \ /* flash_incr_mode = */ H5C_flash_incr__add_space, \ - /* double flash_multiple = */ 1.4, \ - /* double flash_threshold = */ 0.25, \ + /* double flash_multiple = */ 1.4f, \ + /* double flash_threshold = */ 0.25f, \ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\ - /* double upper_hr_threshold = */ 0.999, \ - /* double decrement = */ 0.9, \ + /* double upper_hr_threshold = */ 0.999f, \ + /* double decrement = */ 0.9f, \ /* hbool_t apply_max_decrement = */ TRUE, \ /* size_t max_decrement = */ (1 * 1024 * 1024), \ /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ - /* double empty_reserve = */ 0.1, \ + /* double empty_reserve = */ 0.1f, \ /* int dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 1bfe10a..dacce43 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -105,10 +105,9 @@ static herr_t H5D__chunk_collective_io(H5D_io_info_t *io_info, static herr_t H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, H5P_genplist_t *dx_plist); -static herr_t H5D__multi_chunk_collective_io_no_opt(H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, H5P_genplist_t *dx_plist); static herr_t H5D__link_chunk_collective_io(H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, int sum_chunk); + const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, int sum_chunk, + H5P_genplist_t *dx_plist); static herr_t H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5S_t *file_space, const H5S_t *mem_space); @@ -586,6 +585,12 @@ done: * Programmer: Muqun Yang * Monday, Feb. 13th, 2006 * + * Modification: + * - Refctore to remove multi-chunk-without-opimization feature and update for + * multi-chunk-io accordingly + * Programmer: Jonathan Kim + * Date: 2012-10-10 + * *------------------------------------------------------------------------- */ static herr_t @@ -594,8 +599,6 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf { H5P_genplist_t *dx_plist; /* Pointer to DXPL */ H5FD_mpio_chunk_opt_t chunk_opt_mode; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode; - H5D_mpio_actual_io_mode_t actual_io_mode; int io_option = H5D_MULTI_CHUNK_IO_MORE_OPT; int sum_chunk = -1; #ifdef H5_HAVE_INSTRUMENTED_LIBRARY @@ -617,10 +620,12 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf /* Check the optional property list on what to do with collective chunk IO. */ chunk_opt_mode = (H5FD_mpio_chunk_opt_t)H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME); - if(chunk_opt_mode == H5FD_MPIO_CHUNK_ONE_IO) + if(H5FD_MPIO_CHUNK_ONE_IO == chunk_opt_mode) io_option = H5D_ONE_LINK_CHUNK_IO; /*no opt*/ - else if(chunk_opt_mode == H5FD_MPIO_CHUNK_MULTI_IO) - io_option = H5D_MULTI_CHUNK_IO; /*no opt */ + /* direct request to multi-chunk-io */ + else if(H5FD_MPIO_CHUNK_MULTI_IO == chunk_opt_mode) + io_option = H5D_MULTI_CHUNK_IO; + /* via default path. branch by num threshold */ else { unsigned one_link_chunk_io_threshold; /* Threshhold to use single collective I/O for all chunks */ int mpi_size; /* Number of processes in MPI job */ @@ -649,7 +654,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf /*** Test collective chunk user-input optimization APIs. ***/ check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME); if(check_prop > 0) { - if(io_option == H5D_ONE_LINK_CHUNK_IO) { + if(H5D_ONE_LINK_CHUNK_IO == io_option) { new_value = 0; if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, &new_value) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value") @@ -657,7 +662,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf } /* end if */ check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME); if(check_prop > 0) { - if(io_option == H5D_MULTI_CHUNK_IO) { + if(H5D_MULTI_CHUNK_IO == io_option) { new_value = 0; if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, &new_value) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value") @@ -665,7 +670,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf } /* end if */ check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME); if(check_prop > 0) { - if(io_option == H5D_ONE_LINK_CHUNK_IO_MORE_OPT) { + if(H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) { new_value = 0; if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, &new_value) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value") @@ -682,39 +687,16 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf #endif /* step 2: Go ahead to do IO.*/ - if(io_option == H5D_ONE_LINK_CHUNK_IO || io_option == H5D_ONE_LINK_CHUNK_IO_MORE_OPT) { - /* set the actual io mode properties to the correct values for link chunk io. - * Link chunk I/O does not break to independent, so we can set the actual_io mode - * as well as the optimisation mode. */ - actual_chunk_opt_mode = H5D_MPIO_LINK_CHUNK; - actual_io_mode = H5D_MPIO_CHUNK_COLLECTIVE; - - /* Set the actual chunk opt mode property. */ - if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property") - - if(H5D__link_chunk_collective_io(io_info, type_info, fm, sum_chunk) < 0) + if(H5D_ONE_LINK_CHUNK_IO == io_option || H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) { + if(H5D__link_chunk_collective_io(io_info, type_info, fm, sum_chunk, dx_plist) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish linked chunk MPI-IO") - - /* Set the actual io mode property. */ - if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_IO_MODE_NAME, &actual_io_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual io mode property") } /* end if */ - else - if(io_option == H5D_MULTI_CHUNK_IO) { - /* Set the actual chunk opt mode property */ - actual_chunk_opt_mode = H5D_MPIO_MULTI_CHUNK_NO_OPT; - if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property") - - if(H5D__multi_chunk_collective_io_no_opt(io_info, type_info, fm, dx_plist) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish multiple chunk MPI-IO") + /* direct request to multi-chunk-io */ + else if(H5D_MULTI_CHUNK_IO == io_option) { + if(H5D__multi_chunk_collective_io(io_info, type_info, fm, dx_plist) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple chunk MPI-IO") } /* end if */ - else { /*multiple chunk IOs with opt */ - actual_chunk_opt_mode = H5D_MPIO_MULTI_CHUNK; - if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property") - + else { /* multiple chunk IO via threshold */ if(H5D__multi_chunk_collective_io(io_info, type_info, fm, dx_plist) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple chunk MPI-IO") } /* end else */ @@ -801,11 +783,16 @@ done: * Programmer: Muqun Yang * Monday, Feb. 13th, 2006 * + * Modification: + * - Set H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME and H5D_MPIO_ACTUAL_IO_MODE_NAME + * dxpl in this. + * Programmer: Jonathan Kim + * Date: 2012-10-10 *------------------------------------------------------------------------- */ static herr_t H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm, int sum_chunk) + H5D_chunk_map_t *fm, int sum_chunk, H5P_genplist_t *dx_plist) { H5D_chunk_addr_info_t *chunk_addr_info_array = NULL; MPI_Datatype chunk_final_mtype; /* Final memory MPI datatype for all chunks with seletion */ @@ -824,10 +811,21 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ int *chunk_mpi_file_counts = NULL; /* Count of MPI file datatype for each chunk */ int *chunk_mpi_mem_counts = NULL; /* Count of MPI memory datatype for each chunk */ int mpi_code; /* MPI return code */ + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode = H5D_MPIO_LINK_CHUNK; + H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CHUNK_COLLECTIVE; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + /* Set the actual-chunk-opt-mode property. */ + if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property") + + /* Set the actual-io-mode property. + * Link chunk I/O does not break to independent, so can set right away */ + if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_IO_MODE_NAME, &actual_io_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual io mode property") + /* Get the sum # of chunks, if not already available */ if(sum_chunk < 0) { if(H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0) @@ -1075,6 +1073,12 @@ if(H5DEBUG(D)) * Programmer: Muqun Yang * Monday, Feb. 13th, 2006 * + * Modification: + * - Set H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME dxpl in this to go along with + * setting H5D_MPIO_ACTUAL_IO_MODE_NAME dxpl at the bottom. + * Programmer: Jonathan Kim + * Date: 2012-10-10 + * *------------------------------------------------------------------------- */ static herr_t @@ -1096,11 +1100,16 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty int mpi_rank; #endif size_t u; /* Local index variable */ + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode = H5D_MPIO_MULTI_CHUNK; /* actual chunk optimization mode */ H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_NO_COLLECTIVE; /* Local variable for tracking the I/O mode used. */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + /* Set the actual chunk opt mode property */ + if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, &actual_chunk_opt_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual chunk opt mode property") + #ifdef H5Dmpio_DEBUG mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file); #endif @@ -1264,212 +1273,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__multi_chunk_collective_io_no_opt - * - * Purpose: To do collective IO without any optimization per chunk base - * The internal independent IO inside HDF5 cannot handle - * non-contiguous(or with holes) storage efficiently. - * Under this case, the one independent IO call may consist of - * many small disk IOs. So we may use independent IO with derived datatype - * to replace the independent IO when we find this chunk is not good to - * do collective IO. However, according to our performance study, - * this approach may not overcome the overhead caused by MPI gather/scatter. - * So we decide to leave the original collective IO per chunk approach as - * an option for users. NO MPI gather/scatter calls are used. - * HDF5 will try to collective IO if possible. - * If users choose to use - * H5Pset_dxpl_mpio_chunk_opt(dxpl_id,H5FD_MPIO_OPT_MULTI_IO), - * this function will be called. - * The HDF5 library won't do any IO management but leave it to MPI-IO to figure - * out. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__multi_chunk_collective_io_no_opt(H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, H5P_genplist_t *dx_plist) -{ - H5SL_node_t *chunk_node; /* Current node in chunk skip list */ - H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */ - H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ - H5D_io_info_t cpt_io_info; /* Compact I/O info object */ - H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */ - hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */ - int min_chunk = -1; /* Minimum # of chunks all processes will operate on */ - int count_chunk; /* How many chunks have we operated on? */ - H5D_storage_t store; /* union of EFL and chunk pointer in file space */ - H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_NO_COLLECTIVE; /*Local variable for tracking the I/O modes used. */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_STATIC - -#ifdef H5D_DEBUG -if(H5DEBUG(D)) { - int mpi_rank; - - mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file); - HDfprintf(H5DEBUG(D), "Rank %d: coming to multi_chunk_collective_io_no_opt\n", mpi_rank); -} -#endif - - /* Set up contiguous I/O info object */ - HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); - ctg_io_info.store = &ctg_store; - ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; - - /* Initialize temporary contiguous storage info */ - ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size; - - /* Set up compact I/O info object */ - HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); - cpt_io_info.store = &cpt_store; - cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; - - /* Initialize temporary compact storage info */ - cpt_store.compact.dirty = &cpt_dirty; - - /* Set dataset storage for I/O info */ - io_info->store = &store; - - /* Get the min. # of chunks */ - if(H5D__mpio_get_min_chunk(io_info, fm, &min_chunk) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get minimum number of chunk") - HDassert(min_chunk >= 0); - - /* Get first node in chunk skip list */ - chunk_node = H5SL_first(fm->sel_chunks); - count_chunk = 0; - - /* Iterate through chunks to be operated on */ - while(chunk_node) { - H5D_chunk_info_t *chunk_info; /* chunk information */ - H5D_chunk_ud_t udata; /* B-tree pass-through */ - hbool_t make_ind, make_coll; /* Flags to indicate that the MPI mode should change */ - - /* Get the actual chunk information from the skip list node */ - chunk_info = H5SL_item(chunk_node); - - /* Pass in chunk's coordinates in a union. */ - store.chunk.offset = chunk_info->coords; - store.chunk.index = chunk_info->index; - - /* Reset flags for changing parallel I/O mode */ - make_ind = make_coll = FALSE; - - count_chunk++; - - /* If the number of chunk is greater than minimum number of chunk, - * Do independent read. - */ - if(count_chunk > min_chunk) - /* Switch to independent I/O (permanently) */ - make_ind = TRUE; - - /* Retrieve the chunk's address */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, - chunk_info->index, &udata) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list") - - /* Independent I/O */ - if(make_ind) { - void *chunk; /* Pointer to the data chunk in cache */ - H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ - uint32_t accessed_bytes = 0; /* Total accessed size in a chunk */ - htri_t cacheable; /* Whether the chunk is cacheable */ - - /* Switch to independent I/O */ - if(H5D__ioinfo_xfer_mode(io_info, dx_plist, H5FD_MPIO_INDEPENDENT) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't switch to independent I/O") - - /* Update the local variable tracking the dxpl's actual io mode */ - actual_io_mode = actual_io_mode | H5D_MPIO_CHUNK_INDEPENDENT; - - /* Load the chunk into cache and lock it. */ - if((cacheable = H5D__chunk_cacheable(io_info, udata.addr, - io_info->op_type == H5D_IO_OP_WRITE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") - if(cacheable) { - hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ - - /* Compute # of bytes accessed in chunk */ - accessed_bytes = chunk_info->chunk_points * type_info->src_type_size; - - /* Determine if we will access all the data in the chunk */ - if(((io_info->op_type == H5D_IO_OP_WRITE) && (accessed_bytes != ctg_store.contig.dset_size)) - || (io_info->op_type != H5D_IO_OP_WRITE)) - entire_chunk = FALSE; - - /* Lock the chunk into the cache */ - if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE))) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") - - /* Set up the storage buffer information for this chunk */ - cpt_store.compact.buf = chunk; - - /* Point I/O info at contiguous I/O info for this chunk */ - chk_io_info = &cpt_io_info; - } /* end if */ - else { - /* Set up the storage address information for this chunk */ - ctg_store.contig.dset_addr = udata.addr; - - /* No chunk cached */ - chunk = NULL; - - /* Point I/O info at temporary I/O info for this chunk */ - chk_io_info = &ctg_io_info; - } /* end else */ - - if(io_info->op_type == H5D_IO_OP_WRITE) { - if((io_info->io_ops.single_write)(chk_io_info, type_info, - (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "optimized write failed") - } /* end if */ - else { - if((io_info->io_ops.single_read)(chk_io_info, type_info, - (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "optimized read failed") - } /* end ese */ - - /* Release the cache lock on the chunk. */ - if(chunk) - if(H5D__chunk_unlock(io_info, &udata, (io_info->op_type == H5D_IO_OP_WRITE), chunk, accessed_bytes) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") - } /* end if */ - else { /*collective I/O */ - /* Set up the storage address information for this chunk */ - ctg_store.contig.dset_addr = udata.addr; - - /* Update the local variable tracking the dxpl's actual io Mode. */ - actual_io_mode = actual_io_mode | H5D_MPIO_CHUNK_COLLECTIVE; - - if(H5D__inter_collective_io(&ctg_io_info, type_info, chunk_info->fspace, chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL,"couldn't finish shared collective MPI-IO") - } /* end else */ - - if(make_coll) - if(H5D__ioinfo_xfer_mode(io_info, dx_plist, H5FD_MPIO_COLLECTIVE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't switch to independent I/O") - - /* Get the next chunk node in the skip list */ - chunk_node = H5SL_next(chunk_node); - } /* end while */ - - /* Write the local value of actual io mode to the DXPL. */ - if(H5P_set(dx_plist, H5D_MPIO_ACTUAL_IO_MODE_NAME, &actual_io_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "couldn't set actual io mode property") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__multi_chunk_collective_io_no_opt */ - - -/*------------------------------------------------------------------------- * Function: H5D__inter_collective_io * * Purpose: Routine for the shared part of collective IO between multiple chunk @@ -1794,7 +1597,6 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, { int total_chunks; unsigned percent_nproc_per_chunk, threshold_nproc_per_chunk; - H5FD_mpio_chunk_opt_t chunk_opt_mode; uint8_t* io_mode_info = NULL; uint8_t* recv_io_mode_info = NULL; uint8_t* mergebuf = NULL; @@ -1827,8 +1629,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, /* Setup parameters */ H5_ASSIGN_OVERFLOW(total_chunks, fm->layout->u.chunk.nchunks, hsize_t, int); percent_nproc_per_chunk = H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME); - chunk_opt_mode = (H5FD_mpio_chunk_opt_t)H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME); - if((chunk_opt_mode == H5FD_MPIO_CHUNK_MULTI_IO) || (percent_nproc_per_chunk == 0)) { + /* if ratio is 0, perform collective io */ + if(0 == percent_nproc_per_chunk) { if(H5D__chunk_addrmap(io_info, chunk_addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address"); for(ic = 0; ic < total_chunks; ic++) diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index c933ab1..ae55c44 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -66,7 +66,6 @@ #define H5D_XFER_VFL_ID_NAME "vfl_id" /* File driver ID */ #define H5D_XFER_VFL_INFO_NAME "vfl_info" /* File driver info */ #define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size" /* Hyperslab vector size */ -#ifdef H5_HAVE_PARALLEL #define H5D_XFER_IO_XFER_MODE_NAME "io_xfer_mode" /* I/O transfer mode */ #define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME "mpio_collective_opt" /* Optimization of MPI-IO transfer mode */ #define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME "mpio_chunk_opt_hard" @@ -76,7 +75,6 @@ #define H5D_MPIO_ACTUAL_IO_MODE_NAME "actual_io_mode" #define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause" /* cause of broken collective I/O in each process */ #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME "global_no_collective_cause" /* cause of broken collective I/O in all processes */ -#endif /* H5_HAVE_PARALLEL */ #define H5D_XFER_EDC_NAME "err_detect" /* EDC */ #define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ #define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ @@ -89,8 +87,6 @@ #define H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME "coll_chunk_link_false" #define H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME "coll_chunk_multi_coll" #define H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME "coll_chunk_multi_ind" -#define H5D_XFER_COLL_CHUNK_LINK_TO_MULTI "coll_chunk_link_mul"/* Internal transferring from link to multiple chunk */ -#define H5D_XFER_COLL_CHUNK_LINK_TO_MULTI_OPT "coll_chunk_link_mul_opt"/* Internal transferring from link opt to multiple chunk opt*/ /* Definitions for all collective chunk instrumentation properties */ #define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned) diff --git a/src/H5Edefin.h b/src/H5Edefin.h index ee284c4..2ae79e5 100644 --- a/src/H5Edefin.h +++ b/src/H5Edefin.h @@ -22,7 +22,7 @@ /* Major error IDs */ hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ -hid_t H5E_FILE_g = FAIL; /* File accessability */ +hid_t H5E_FILE_g = FAIL; /* File accessibilty */ hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */ hid_t H5E_SYM_g = FAIL; /* Symbol table */ hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */ @@ -131,7 +131,7 @@ hid_t H5E_PATH_g = FAIL; /* Problem with path to object */ /* No error */ hid_t H5E_NONE_MINOR_g = FAIL; /* No error */ -/* File accessability errors */ +/* File accessibilty errors */ hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */ hid_t H5E_FILEOPEN_g = FAIL; /* File already open */ hid_t H5E_CANTCREATE_g = FAIL; /* Unable to create file */ diff --git a/src/H5Einit.h b/src/H5Einit.h index 6881e48..a2eb02f 100644 --- a/src/H5Einit.h +++ b/src/H5Einit.h @@ -30,7 +30,7 @@ if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_FILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessability"))==NULL) +if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibilty"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") @@ -477,7 +477,7 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "No error"))==NULL) if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -/* File accessability errors */ +/* File accessibilty errors */ assert(H5E_FILEEXISTS_g==(-1)); if((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") diff --git a/src/H5Eint.c b/src/H5Eint.c index 76eaaf5..88dfdee 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -380,6 +380,10 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) * they might be different. */ cls_ptr = (H5E_cls_t *)H5I_object_verify(err_desc->cls_id, H5I_ERROR_CLASS); + /* Check for bad pointer(s), but can't issue error, just leave */ + if(!cls_ptr) + HGOTO_DONE(FAIL) + /* Print error class header if new class */ if(eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name)) { /* update to the new class information */ diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h index 967b248..ddfb1d3 100644 --- a/src/H5Epubgen.h +++ b/src/H5Epubgen.h @@ -57,7 +57,7 @@ #define H5E_ERROR (H5OPEN H5E_ERROR_g) #define H5E_CACHE (H5OPEN H5E_CACHE_g) H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ -H5_DLLVAR hid_t H5E_FILE_g; /* File accessability */ +H5_DLLVAR hid_t H5E_FILE_g; /* File accessibilty */ H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */ H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */ @@ -221,7 +221,7 @@ H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */ #define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g) H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */ -/* File accessability errors */ +/* File accessibilty errors */ #define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) #define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g) #define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g) diff --git a/src/H5Eterm.h b/src/H5Eterm.h index 5edcd34..6c621bc 100644 --- a/src/H5Eterm.h +++ b/src/H5Eterm.h @@ -133,7 +133,7 @@ H5E_PATH_g= /* No error */ H5E_NONE_MINOR_g= -/* File accessability errors */ +/* File accessibilty errors */ H5E_FILEEXISTS_g= H5E_FILEOPEN_g= H5E_CANTCREATE_g= diff --git a/src/H5FDcore.c b/src/H5FDcore.c index decdbf0..9b4aadc 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -484,7 +484,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, * default value. But if the file access property list was zero then use * the default value instead. */ - file->increment = (fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT; + file->increment = (fa->increment > 0) ? fa->increment : H5FD_CORE_INCREMENT; /* If save data in backing store. */ file->backing_store = fa->backing_store; diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 1108e05..7dbabf5 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -536,7 +536,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = H5P_get_driver_info(plist); + if(NULL == (fa = (H5FD_direct_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") file->fd = fd; H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,h5_stat_size_t,haddr_t); @@ -565,9 +566,9 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd * is to handle correctly the case that the file is in a different file system * than the one where the program is running. */ - buf1 = (int*)HDmalloc(sizeof(int)); - if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") + buf1 = (int *)HDmalloc(sizeof(int)); + if(HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") if(o_flags & O_CREAT) { if(write(file->fd, (void*)buf1, sizeof(int))<0) { diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index f051269..dc535a2 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -675,8 +675,8 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist); - HDassert(fa); + if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") /* Check for new family file size. It's used by h5repart only. */ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) { diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 1c21666..89a0a28 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -535,8 +535,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist); - HDassert(fa); + if(NULL == (fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") #ifdef H5_HAVE_GETTIMEOFDAY if(fa->flags & H5FD_LOG_TIME_OPEN) @@ -650,9 +650,9 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags & H5FD_LOG_TIME_OPEN) - HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0)); + HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0f)); if(file->fa.flags & H5FD_LOG_TIME_STAT) - HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0)); + HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0f)); #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ @@ -744,7 +744,7 @@ H5FD_log_close(H5FD_t *_file) timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0)); + HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f)); } /* end if */ #endif /* H5_HAVE_GETTIMEOFDAY */ @@ -1211,7 +1211,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total seek time */ @@ -1300,7 +1300,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total read time */ @@ -1417,7 +1417,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total seek time */ @@ -1503,7 +1503,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total write time */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index cac101b..2db77c9 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1013,8 +1013,8 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; } else { - fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist); - assert(fa); + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") } /* Duplicate communicator and Info object for use by this file. */ diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 35f52c3..88a5886 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -603,8 +603,8 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, fa = &_fa; } /* end if */ else { - fa = H5P_get_driver_info(plist); - HDassert(fa); + if(NULL == (fa = (const H5FD_mpiposix_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") } /* end else */ /* Duplicate the communicator for use by this file. */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ee89bde..9dbbba4 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -27,6 +27,7 @@ #include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ +#include "H5Vprivate.h" /* Vectors and arrays */ /****************************/ @@ -114,6 +115,35 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; /* (Assumes that the high bits of the integer are zero) */ # define UINT64ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint64_t, n, l) +/* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */ +/* (Assumes that the high bits of the integer are zero) */ +# define UINT64ENCODE_VARLEN(p, n) { \ + uint64_t __n = (uint64_t)(n); \ + unsigned _s = H5V_limit_enc_size(__n); \ + \ + *(p)++ = (uint8_t)_s; \ + UINT64ENCODE_VAR(p, __n, _s); \ +} + +# define H5_ENCODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32ENCODE(p, n) \ +} + +/* Assumes the endianness of uint64_t is the same as double */ +# define H5_ENCODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + uint8_t *_p = (uint8_t*)(p); \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + HDmemcpy(&_n, &n, sizeof(double)); \ + for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t *)(p) + 8; \ +} + /* DECODE converts little endian bytes pointed by p to integer values and store * it in i. For signed values, need to do sign-extension when converting * the last byte which carries the sign bit. @@ -134,11 +164,11 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; } # define INT32DECODE(p, i) { \ - (i) = ( *(p) & 0xff); (p)++; \ - (i) |= ((int32_t)(*(p) & 0xff) << 8); (p)++; \ - (i) |= ((int32_t)(*(p) & 0xff) << 16); (p)++; \ - (i) |= ((int32_t)(((*(p) & 0xff) << 24) | \ - ((*(p) & 0x80) ? ~0xffffffff : 0x0))); (p)++; \ + (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ + (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ + (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ + ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \ } # define UINT32DECODE(p, i) { \ @@ -190,6 +220,34 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; /* (Assumes that the high bits of the integer will be zero) */ # define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) +/* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */ +/* (Assumes that the high bits of the integer will be zero) */ +# define UINT64DECODE_VARLEN(p, n) { \ + unsigned _s = *(p)++; \ + \ + UINT64DECODE_VAR(p, n, _s); \ +} + +# define H5_DECODE_UNSIGNED(p, n) { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32DECODE(p, n) \ +} + +/* Assumes the endianness of uint64_t is the same as double */ +# define H5_DECODE_DOUBLE(p, n) { \ + uint64_t _n; \ + size_t _u; \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + _n = 0; \ + (p) += 8; \ + for(_u = 0; _u < sizeof(uint64_t); _u++) \ + _n = (_n << 8) | *(--p); \ + HDmemcpy(&(n), &_n, sizeof(double)); \ + (p) += 8; \ +} + /* Address-related macros */ #define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ HADDR_UNDEF==(X)+(haddr_t)(Z) || \ @@ -580,7 +638,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); /* Shared file list related routines */ -H5_DLL herr_t H5F_sfile_assert_num(unsigned n); +H5_DLL void H5F_sfile_assert_num(unsigned n); /* Routines for creating & destroying "fake" file structures */ H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size); diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index 95e5ad2..a1c6976 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -46,16 +46,14 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL; * * Purpose: Sanity checking that shared file list is empty * - * Return: SUCCEED/FAIL + * Return: none (void) * * Programmer: Quincey Koziol * Monday, July 25, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ -herr_t +void H5F_sfile_assert_num(unsigned n) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -83,7 +81,7 @@ H5F_sfile_assert_num(unsigned n) HDassert(count == n); } /* end else */ - FUNC_LEAVE_NOAPI(SUCCEED) + FUNC_LEAVE_NOAPI_VOID } /* H5F_sfile_assert_num() */ diff --git a/src/H5P.c b/src/H5P.c index c7ed30b..9489e49 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -462,7 +462,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, /* Create the new property list class */ orig_pclass = pclass; - if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) + if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class") /* Check if the property class changed and needs to be substituted in the ID */ @@ -645,7 +645,8 @@ H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default") /* Create the new property list class */ - if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) + if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, + NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist") done: @@ -838,6 +839,89 @@ done: /*-------------------------------------------------------------------------- NAME + H5Pencode + PURPOSE + Routine to convert the property values in a property list into a binary buffer + USAGE + herr_t H5Pencode(plist_id, buf, nalloc) + hid_t plist_id; IN: Identifier to property list to encode + void *buf: OUT: buffer to gold the encoded plist + size_t *nalloc; IN/OUT: size of buffer needed to encode plist + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Encodes a property list into a binary buffer. If the buffer is NULL, then + the call will set the size needed to encode the plist in nalloc. Otherwise + the routine will encode the plist in buf. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Pencode(hid_t plist_id, void *buf, size_t *nalloc) +{ + H5P_genplist_t *plist; /* Property list to query */ + hid_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*x*z", plist_id, buf, nalloc); + + /* Check arguments. */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + + /* Call the internal encode routine */ + if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list"); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pencode() */ + + +/*-------------------------------------------------------------------------- + NAME + H5Pdecode + PURPOSE + API routine to decode a property list from a binary buffer. + USAGE + hid_t H5Pdecode(buf) + void *buf; IN: buffer that holds the encoded plist + RETURNS + Returns non-negative ID of new property list object on success, negative + on failure. + DESCRIPTION + Decodes a property list from a binary buffer. The contents of the buffer + contain the values for the correponding properties of the plist. The decode + callback of a certain property decodes its value from the buffer and sets it + in the property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Properties in the property list that are not encoded in the serialized + form retain their default value. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hid_t +H5Pdecode(const void *buf) +{ + hid_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("i", "*x", buf); + + /* Call the internal decode routine */ + if((ret_value = H5P__decode(buf)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "unable to decode property list"); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pdecode() */ + + +/*-------------------------------------------------------------------------- + NAME H5Pget_class PURPOSE Routine to query the class of a generic property list diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index d21cdbf..5239fba 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -49,13 +49,18 @@ /* Definitions for size of raw data chunk cache(slots) */ #define H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t) #define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF H5D_CHUNK_CACHE_NSLOTS_DEFAULT +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_size_t +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_size_t /* Definition for size of raw data chunk cache(bytes) */ #define H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) #define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF H5D_CHUNK_CACHE_NBYTES_DEFAULT +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_size_t +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t /* Definition for preemption read chunks first */ #define H5D_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) #define H5D_ACS_PREEMPT_READ_CHUNKS_DEF H5D_CHUNK_CACHE_W0_DEFAULT - +#define H5D_ACS_PREEMPT_READ_CHUNKS_ENC H5P__encode_double +#define H5D_ACS_PREEMPT_READ_CHUNKS_DEC H5P__decode_double /******************/ /* Local Typedefs */ @@ -130,15 +135,18 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, + NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, + NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, + NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 9cb87fd..8a15863 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -43,6 +43,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppkg.h" /* Property lists */ #include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5Tprivate.h" /* Datatypes */ #include "H5Zpkg.h" /* Data filters */ @@ -77,18 +78,26 @@ /* Definitions for storage layout property */ #define H5D_CRT_LAYOUT_SIZE sizeof(H5O_layout_t) #define H5D_CRT_LAYOUT_DEF H5D_DEF_LAYOUT_CONTIG +#define H5D_CRT_LAYOUT_ENC H5P__dcrt_layout_enc +#define H5D_CRT_LAYOUT_DEC H5P__dcrt_layout_dec #define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp /* Definitions for fill value. size=0 means fill value will be 0 as * library default; size=-1 means fill value is undefined. */ #define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) #define H5D_CRT_FILL_VALUE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_FILL_VERSION_2, NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, FALSE} +#define H5D_CRT_FILL_VALUE_ENC H5P__fill_value_enc +#define H5D_CRT_FILL_VALUE_DEC H5P__fill_value_dec #define H5D_CRT_FILL_VALUE_CMP H5P_fill_value_cmp /* Definitions for space allocation time state */ #define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned) #define H5D_CRT_ALLOC_TIME_STATE_DEF 1 +#define H5D_CRT_ALLOC_TIME_STATE_ENC H5P__encode_unsigned +#define H5D_CRT_ALLOC_TIME_STATE_DEC H5P__decode_unsigned /* Definitions for external file list */ #define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) #define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} +#define H5D_CRT_EXT_FILE_LIST_ENC H5P__dcrt_ext_file_list_enc +#define H5D_CRT_EXT_FILE_LIST_DEC H5P__dcrt_ext_file_list_dec #define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp @@ -118,7 +127,13 @@ static herr_t H5P__dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_da static herr_t H5P__dcrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ +static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_layout_dec(const void **pp, void *value); static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__fill_value_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__fill_value_dec(const void **pp, void *value); +static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_ext_file_list_dec(const void **pp, void *value); static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); @@ -150,6 +165,17 @@ const H5P_libclass_t H5P_CLS_DCRT[1] = {{ /* Declare extern the free list to manage blocks of type conversion data */ H5FL_BLK_EXTERN(type_conv); + +/***************************/ +/* Local Private Variables */ +/***************************/ + +/* Property value defaults */ +static const H5O_layout_t H5D_def_layout_g = H5D_CRT_LAYOUT_DEF; /* Default storage layout */ +static const H5O_fill_t H5D_def_fill_g = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */ +static const unsigned H5D_def_alloc_time_state_g = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */ +static const H5O_efl_t H5D_def_efl_g = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */ + /* Defaults for each type of layout */ #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER static const H5O_layout_t H5D_def_layout_compact_g = H5D_DEF_LAYOUT_COMPACT; @@ -178,28 +204,32 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass) { - H5O_layout_t layout = H5D_CRT_LAYOUT_DEF; /* Default storage layout */ - H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */ - unsigned alloc_time_state = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */ - H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register the storage layout property */ - if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, + NULL, NULL, NULL, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, + NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the fill value property */ - if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, + NULL, NULL, NULL, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, + NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the space allocation time state property */ - if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g, + NULL, NULL, NULL, H5D_CRT_ALLOC_TIME_STATE_ENC, H5D_CRT_ALLOC_TIME_STATE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file list property */ - if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, + NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, + NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -370,6 +400,150 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_layout_enc + * + * Purpose: Callback routine which is called whenever the layout + * property in the dataset creation property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) +{ + const H5O_layout_t *layout = (const H5O_layout_t *)value; /* Create local aliases for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(layout); + HDassert(size); + + if(NULL != *pp) { + /* Encode layout type */ + *(*pp)++ = (uint8_t)layout->type; + + /* If layout is chunked, encode chunking structure */ + if(H5D_CHUNKED == layout->type) { + unsigned u; /* Local index variable */ + + /* Encode rank */ + *(*pp)++ = (uint8_t)layout->u.chunk.ndims; + + /* Encode chunk dims */ + HDcompile_assert(sizeof(uint32_t) == sizeof(layout->u.chunk.dim[0])); + for(u = 0; u < layout->u.chunk.ndims; u++) + UINT32ENCODE(*pp, layout->u.chunk.dim[u]) + } /* end if */ + } /* end if */ + + /* Size of layout type */ + *size += sizeof(uint8_t); + + /* Size of chunk info encoding */ + if(H5D_CHUNKED == layout->type) { + *size += sizeof(uint8_t); + *size += layout->u.chunk.ndims * sizeof(uint32_t); + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dcrt_layout_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_layout_dec + * + * Purpose: Callback routine which is called whenever the layout + * property in the dataset creation property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_layout_dec(const void **_pp, void *value) +{ + const H5O_layout_t *layout; /* Storage layout */ + H5O_layout_t chunk_layout; /* Layout structure for chunk info */ + H5D_layout_t type; /* Layout type */ + const uint8_t **pp = (const uint8_t **)_pp; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode layout type */ + type = (H5D_layout_t)*(*pp)++; + + /* set default layout in case the type is compact or contiguous, otherwise + * decode the chunked structure and set chunked layout */ + switch(type) { + case H5D_COMPACT: + layout = &H5D_def_layout_compact_g; + break; + + case H5D_CONTIGUOUS: + layout = &H5D_def_layout_contig_g; + break; + + case H5D_CHUNKED: + { + unsigned ndims; /* Number of chunk dimensions */ + + /* Decode the number of chunk dimensions */ + ndims = *(*pp)++; + + /* default chunk layout */ + if(0 == ndims) + layout = &H5D_def_layout_chunk_g; + else { /* chunk layout structure is encoded*/ + unsigned u; /* Local index variable */ + + /* Initialize to default values */ + chunk_layout = H5D_def_layout_chunk_g; + + /* Set rank & dimensions */ + chunk_layout.u.chunk.ndims = (unsigned)ndims; + for(u = 0; u < ndims; u++) + UINT32DECODE(*pp, chunk_layout.u.chunk.dim[u]) + + /* Point at the newly set up struct */ + layout = &chunk_layout; + } /* end else */ + } + break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + default: + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad layout type") + } /* end switch */ + + /* Set the value */ + HDmemcpy(value, layout, sizeof(H5O_layout_t)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_layout_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dcrt_layout_cmp * * Purpose: Callback routine which is called whenever the layout @@ -441,6 +615,168 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__fill_value_enc + * + * Purpose: Callback routine which is called whenever the fill value + * property in the dataset creation property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fill_value_enc(const void *value, void **_pp, size_t *size) +{ + const H5O_fill_t *fill = (const H5O_fill_t *)value; /* Create local aliases for values */ + size_t dt_size = 0; /* Size of encoded datatype */ + herr_t ret_value = SUCCEED; /* Return value */ + uint8_t **pp = (uint8_t **)_pp; + uint64_t enc_value; + unsigned enc_size; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDcompile_assert(sizeof(ssize_t) <= sizeof(int64_t)); + HDassert(fill); + HDassert(size); + + if(NULL != *pp) { + /* Encode alloc and fill time */ + *(*pp)++ = (uint8_t)fill->alloc_time; + *(*pp)++ = (uint8_t)fill->fill_time; + + /* Encode size of fill value */ + INT64ENCODE(*pp, fill->size) + + /* Encode the fill value & datatype */ + if(fill->size > 0) { + /* Encode the fill value itself */ + HDmemcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size); + *pp += fill->size; + + /* Encode fill value datatype */ + HDassert(fill->type); + + if(H5T_encode(fill->type, NULL, &dt_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + + /* Encode the size of a size_t */ + enc_value = (uint64_t)dt_size; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + + /* Encode the size */ + *(*pp)++ = (uint8_t)enc_size; + + /* Encode the size of the encoded datatype */ + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + if(H5T_encode(fill->type, *pp, &dt_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + *pp += dt_size; + } /* end if */ + } /* end if */ + + /* Calculate size needed for encoding */ + *size += 2; + *size += sizeof(int64_t); + if(fill->size > 0) { + /* The size of the fill value buffer */ + *size += (size_t)fill->size; + + /* calculate those if they were not calculated earlier */ + if(NULL == *pp) { + /* Get the size of the encoded datatype */ + HDassert(fill->type); + if(H5T_encode(fill->type, NULL, &dt_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + enc_value = (uint64_t)dt_size; + enc_size = H5V_limit_enc_size(enc_value); + } + *size += (1 + enc_size); + *size += dt_size; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__fill_value_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__fill_value_dec + * + * Purpose: Callback routine which is called whenever the fill value + * property in the dataset creation property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fill_value_dec(const void **_pp, void *_value) +{ + H5O_fill_t *fill = (H5O_fill_t *)_value; /* Fill value */ + const uint8_t **pp = (const uint8_t **)_pp; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDcompile_assert(sizeof(ssize_t) <= sizeof(int64_t)); + + /* Set property to default value */ + *fill = H5D_def_fill_g; + + /* Decode alloc and fill time */ + fill->alloc_time = (H5D_alloc_time_t)*(*pp)++; + fill->fill_time = (H5D_fill_time_t)*(*pp)++; + + /* Decode fill size */ + INT64DECODE(*pp, fill->size) + + /* Check if there's a fill value */ + if(fill->size > 0) { + size_t dt_size = 0; + uint64_t enc_value; + unsigned enc_size; + + /* Allocate fill buffer and copy the contents in it */ + if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for fill value buffer") + HDmemcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size); + *pp += fill->size; + + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the size of encoded datatype */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + dt_size = (size_t)enc_value; + + /* Decode type */ + if(NULL == (fill->type = H5T_decode(*pp))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode fill value datatype") + *pp += dt_size; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__fill_value_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5P_fill_value_cmp * * Purpose: Callback routine which is called whenever the fill value @@ -502,6 +838,181 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_enc + * + * Purpose: Callback routine which is called whenever the efl + * property in the dataset creation property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) +{ + const H5O_efl_t *efl = (const H5O_efl_t *)value; /* Create local aliases for values */ + size_t len = 0; /* String length of slot name */ + size_t u; /* Local index variable */ + uint8_t **pp = (uint8_t **)_pp; + unsigned enc_size; + uint64_t enc_value; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(efl); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t)); + HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); + HDassert(size); + + if(NULL != *pp) { + /* Encode number of slots used */ + enc_value = (uint64_t)efl->nused; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* Encode file list */ + for(u = 0; u < efl->nused; u++) { + /* Calculate length of slot name and encode it */ + len = HDstrlen(efl->slot[u].name) + 1; + enc_value = (uint64_t)len; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* Encode name */ + HDmemcpy(*pp, (uint8_t *)(efl->slot[u].name), len); + *pp += len; + + /* Encode offset */ + enc_value = (uint64_t)efl->slot[u].offset; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode size */ + enc_value = (uint64_t)efl->slot[u].size; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + } /* end for */ + } /* end if */ + + /* Calculate size needed for encoding */ + *size += (1 + H5V_limit_enc_size((uint64_t)efl->nused)); + for(u = 0; u < efl->nused; u++) { + len = HDstrlen(efl->slot[u].name) + 1; + *size += (1 + H5V_limit_enc_size((uint64_t)len)); + *size += len; + *size += (1 + H5V_limit_enc_size((uint64_t)efl->slot[u].offset)); + *size += (1 + H5V_limit_enc_size((uint64_t)efl->slot[u].size)); + } /* end for */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dcrt_ext_file_list_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_dec + * + * Purpose: Callback routine which is called whenever the efl + * property in the dataset creation property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value) +{ + H5O_efl_t *efl = (H5O_efl_t *)_value; /* External file list */ + const uint8_t **pp = (const uint8_t **)_pp; + size_t u, nused; + unsigned enc_size; + uint64_t enc_value; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(pp); + HDassert(*pp); + HDassert(efl); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t)); + HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); + + /* Set property to default value */ + *efl = H5D_def_efl_g; + + /* Decode number of slots used */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + nused = (size_t)enc_value; + + /* Decode information for each slot */ + for(u = 0; u < nused; u++) { + size_t len; + if(efl->nused >= efl->nalloc) { + size_t na = efl->nalloc + H5O_EFL_ALLOC; + H5O_efl_entry_t *x = (H5O_efl_entry_t *)H5MM_realloc(efl->slot, + na * sizeof(H5O_efl_entry_t)); + if(!x) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed") + + efl->nalloc = na; + efl->slot = x; + } /* end if */ + + /* Decode length of slot name */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + len = (size_t)enc_value; + + /* Allocate name buffer and decode the name into it */ + efl->slot[u].name = H5MM_xstrdup((const char *)(*pp)); + *pp += len; + + /* decode offset */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + efl->slot[u].offset = (off_t)enc_value; + + /* decode size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + efl->slot[u].size = (hsize_t)enc_value; + + efl->slot[u].name_offset = 0; /*not entered into heap yet*/ + efl->nused++; + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dcrt_ext_file_list_cmp * * Purpose: Callback routine which is called whenever the external file @@ -1538,7 +2049,7 @@ done: * Function: H5Pset_fill_value * * Purpose: Set the fill value for a dataset creation property list. The - * VALUE is interpretted as being of type TYPE, which need not + * VALUE is interpreted as being of type TYPE, which need not * be the same type as the dataset but the library must be able * to convert VALUE to the dataset type when the dataset is * created. If VALUE is NULL, it will be interpreted as @@ -1549,13 +2060,6 @@ done: * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 8d1d75f..cb5e10f 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -267,7 +267,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, /* Create the new property list class */ orig_pclass = pclass; - if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, NULL, prp_close)) < 0) + if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); /* Check if the property class changed and needs to be substituted in the ID */ @@ -450,7 +450,8 @@ H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default") /* Create the new property list class */ - if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, prp_delete, prp_copy, NULL, prp_close)) < 0) + if((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, + NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist") done: diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index d94ee7f..ec7def8 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -38,6 +38,7 @@ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Ppkg.h" /* Property lists */ @@ -49,6 +50,8 @@ /* Definitions for maximum temp buffer size property */ #define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t) #define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE +#define H5D_XFER_MAX_TEMP_BUF_ENC H5P__encode_size_t +#define H5D_XFER_MAX_TEMP_BUF_DEC H5P__decode_size_t /* Definitions for type conversion buffer property */ #define H5D_XFER_TCONV_BUF_SIZE sizeof(void *) #define H5D_XFER_TCONV_BUF_DEF NULL @@ -58,12 +61,16 @@ /* Definitions for background buffer type property */ #define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t) #define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO +#define H5D_XFER_BKGR_BUF_TYPE_ENC H5P__dxfr_bkgr_buf_type_enc +#define H5D_XFER_BKGR_BUF_TYPE_DEC H5P__dxfr_bkgr_buf_type_dec /* Definitions for B-tree node splitting ratio property */ /* (These default B-tree node splitting ratios are also used for splitting * group's B-trees as well as chunked dataset's B-trees - QAK) */ #define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3]) -#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9} +#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1f, 0.5f, 0.9f} +#define H5D_XFER_BTREE_SPLIT_RATIO_ENC H5P__dxfr_btree_split_ratio_enc +#define H5D_XFER_BTREE_SPLIT_RATIO_DEC H5P__dxfr_btree_split_ratio_dec /* Definitions for vlen allocation function property */ #define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t) #define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC @@ -82,20 +89,37 @@ */ #define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t) #define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE +#define H5D_XFER_HYPER_VECTOR_SIZE_ENC H5P__encode_size_t +#define H5D_XFER_HYPER_VECTOR_SIZE_DEC H5P__decode_size_t + +/* Parallel I/O properties */ +/* Note: Some of these are registered with the DXPL class even when parallel + * is disabled, so that property list comparisons of encoded property + * lists (between parallel & non-parallel builds) work properly. -QAK + */ -#ifdef H5_HAVE_PARALLEL /* Definitions for I/O transfer mode property */ #define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t) #define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT +#define H5D_XFER_IO_XFER_MODE_ENC H5P__dxfr_io_xfer_mode_enc +#define H5D_XFER_IO_XFER_MODE_DEC H5P__dxfr_io_xfer_mode_dec /* Definitions for optimization of MPI-IO transfer mode property */ #define H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE sizeof(H5FD_mpio_collective_opt_t) #define H5D_XFER_MPIO_COLLECTIVE_OPT_DEF H5FD_MPIO_COLLECTIVE_IO +#define H5D_XFER_MPIO_COLLECTIVE_OPT_ENC H5P__dxfr_mpio_collective_opt_enc +#define H5D_XFER_MPIO_COLLECTIVE_OPT_DEC H5P__dxfr_mpio_collective_opt_dec #define H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE sizeof(H5FD_mpio_chunk_opt_t) #define H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF H5FD_MPIO_CHUNK_DEFAULT +#define H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC H5P__dxfr_mpio_chunk_opt_hard_enc +#define H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC H5P__dxfr_mpio_chunk_opt_hard_dec #define H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE sizeof(unsigned) #define H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF H5D_ONE_LINK_CHUNK_IO_THRESHOLD +#define H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC H5P__encode_unsigned +#define H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC H5P__decode_unsigned #define H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE sizeof(unsigned) #define H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF H5D_MULTI_CHUNK_IO_COL_THRESHOLD +#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC H5P__encode_unsigned +#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC H5P__decode_unsigned /* Definitions for chunk opt mode property. */ #define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE sizeof(H5D_mpio_actual_chunk_opt_mode_t) #define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_DEF H5D_MPIO_NO_CHUNK_OPTIMIZATION @@ -105,6 +129,7 @@ /* Definitions for cause of broken collective io property */ #define H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE sizeof(uint32_t) #define H5D_MPIO_NO_COLLECTIVE_CAUSE_DEF H5D_MPIO_COLLECTIVE +#ifdef H5_HAVE_PARALLEL /* Definitions for memory MPI type property */ #define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype) #define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL @@ -116,6 +141,8 @@ /* Definitions for EDC property */ #define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t) #define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC +#define H5D_XFER_EDC_ENC H5P__dxfr_edc_enc +#define H5D_XFER_EDC_DEC H5P__dxfr_edc_dec /* Definitions for filter callback function property */ #define H5D_XFER_FILTER_CB_SIZE sizeof(H5Z_cb_t) #define H5D_XFER_FILTER_CB_DEF {NULL,NULL} @@ -125,6 +152,8 @@ /* Definitions for data transform property */ #define H5D_XFER_XFORM_SIZE sizeof(void *) #define H5D_XFER_XFORM_DEF NULL +#define H5D_XFER_XFORM_ENC H5P__dxfr_xform_enc +#define H5D_XFER_XFORM_DEC H5P__dxfr_xform_dec #define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del #define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy #define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp @@ -148,6 +177,20 @@ static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ +static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_bkgr_buf_type_dec(const void **pp, void *value); +static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_btree_split_ratio_dec(const void **pp, void *value); +static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_io_xfer_mode_dec(const void **pp, void *value); +static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_mpio_collective_opt_dec(const void **pp, void *value); +static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_mpio_chunk_opt_hard_dec(const void **pp, void *value); +static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_edc_dec(const void **pp, void *value); +static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_xform_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value); static int H5P__dxfr_xform_cmp(const void *value1, const void *value2, size_t size); @@ -180,6 +223,39 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{ /*****************************/ +/***************************/ +/* Local Private Variables */ +/***************************/ + +/* Property value defaults */ +static const size_t H5D_def_max_temp_buf_g = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */ +static const void *H5D_def_tconv_buf_g = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */ +static const void *H5D_def_bkgr_buf_g = H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */ +static const H5T_bkg_t H5D_def_bkgr_buf_type_g = H5D_XFER_BKGR_BUF_TYPE_DEF; +static const double H5D_def_btree_split_ratio_g[3] = H5D_XFER_BTREE_SPLIT_RATIO_DEF; /* Default value for B-tree node split ratios */ +static const H5MM_allocate_t H5D_def_vlen_alloc_g = H5D_XFER_VLEN_ALLOC_DEF; /* Default value for vlen allocation function */ +static const void *H5D_def_vlen_alloc_info_g = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */ +static const H5MM_free_t H5D_def_vlen_free_g = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */ +static const void *H5D_def_vlen_free_info_g = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */ +static const size_t H5D_def_hyp_vec_size_g = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */ +static const H5FD_mpio_xfer_t H5D_def_io_xfer_mode_g = H5D_XFER_IO_XFER_MODE_DEF; /* Default value for I/O transfer mode */ +static const H5FD_mpio_chunk_opt_t H5D_def_mpio_chunk_opt_mode_g = H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF; +static const H5FD_mpio_collective_opt_t H5D_def_mpio_collective_opt_mode_g = H5D_XFER_MPIO_COLLECTIVE_OPT_DEF; +static const unsigned H5D_def_mpio_chunk_opt_num_g = H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF; +static const unsigned H5D_def_mpio_chunk_opt_ratio_g = H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF; +static const H5D_mpio_actual_chunk_opt_mode_t H5D_def_mpio_actual_chunk_opt_mode_g = H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_DEF; +static const H5D_mpio_actual_io_mode_t H5D_def_mpio_actual_io_mode_g = H5D_MPIO_ACTUAL_IO_MODE_DEF; +static const H5D_mpio_no_collective_cause_t H5D_def_mpio_no_collective_cause_g = H5D_MPIO_NO_COLLECTIVE_CAUSE_DEF; +#ifdef H5_HAVE_PARALLEL +static const MPI_Datatype H5D_def_btype_g = H5FD_MPI_XFER_MEM_MPI_TYPE_DEF; /* Default value for MPI buffer type */ +static const MPI_Datatype H5D_def_ftype_g = H5FD_MPI_XFER_FILE_MPI_TYPE_DEF; /* Default value for MPI file type */ +#endif /* H5_HAVE_PARALLEL */ +static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* Default value for EDC property */ +static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */ +static const H5T_conv_cb_t H5D_def_conv_cb_g = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */ +static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ + + /*------------------------------------------------------------------------- * Function: H5P__dxfr_reg_prop @@ -195,135 +271,157 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{ static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass) { - size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */ - void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */ - void *def_bkgr_buf = H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */ - H5T_bkg_t def_bkgr_buf_type = H5D_XFER_BKGR_BUF_TYPE_DEF; - double def_btree_split_ratio[3] = H5D_XFER_BTREE_SPLIT_RATIO_DEF; /* Default value for B-tree node split ratios */ - H5MM_allocate_t def_vlen_alloc = H5D_XFER_VLEN_ALLOC_DEF; /* Default value for vlen allocation function */ - void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */ - H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */ - void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */ - size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */ H5C_tag_t tag = H5C_TAG_DEF; /* Default value for cache entry tag */ -#ifdef H5_HAVE_PARALLEL - H5FD_mpio_xfer_t def_io_xfer_mode = H5D_XFER_IO_XFER_MODE_DEF; /* Default value for I/O transfer mode */ - H5FD_mpio_chunk_opt_t def_mpio_chunk_opt_mode = H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF; - H5FD_mpio_collective_opt_t def_mpio_collective_opt_mode = H5D_XFER_MPIO_COLLECTIVE_OPT_DEF; - unsigned def_mpio_chunk_opt_num = H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF; - unsigned def_mpio_chunk_opt_ratio = H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF; - H5D_mpio_actual_chunk_opt_mode_t def_mpio_actual_chunk_opt_mode = H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_DEF; - H5D_mpio_actual_io_mode_t def_mpio_actual_io_mode = H5D_MPIO_ACTUAL_IO_MODE_DEF; - H5D_mpio_no_collective_cause_t def_mpio_no_collective_cause = H5D_MPIO_NO_COLLECTIVE_CAUSE_DEF; - MPI_Datatype btype = H5FD_MPI_XFER_MEM_MPI_TYPE_DEF; /* Default value for MPI buffer type */ - MPI_Datatype ftype = H5FD_MPI_XFER_FILE_MPI_TYPE_DEF; /* Default value for MPI file type */ -#endif /* H5_HAVE_PARALLEL */ - H5Z_EDC_t enable_edc = H5D_XFER_EDC_DEF; /* Default value for EDC property */ - H5Z_cb_t filter_cb = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */ - H5T_conv_cb_t conv_cb = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */ - void *def_xfer_xform = H5D_XFER_XFORM_DEF; /* Default value for data transform */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register the max. temp buffer size property */ - if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g, + NULL, NULL, NULL, H5D_XFER_MAX_TEMP_BUF_ENC, H5D_XFER_MAX_TEMP_BUF_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the cache tag property */ - if(H5P_register_real(pclass, H5C_TAG_NAME, H5C_TAG_SIZE, &tag, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5C_TAG_NAME, H5C_TAG_SIZE, &tag, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion buffer property */ - if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &def_tconv_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer property */ - if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &def_bkgr_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer type property */ - if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &def_bkgr_buf_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g, + NULL, NULL, NULL, H5D_XFER_BKGR_BUF_TYPE_ENC, H5D_XFER_BKGR_BUF_TYPE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the B-Tree node splitting ratios property */ - if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, def_btree_split_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g, + NULL, NULL, NULL, H5D_XFER_BTREE_SPLIT_RATIO_ENC, H5D_XFER_BTREE_SPLIT_RATIO_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation function property */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &def_vlen_alloc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation information property */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &def_vlen_alloc_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free function property */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &def_vlen_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free information property */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vector size property */ - if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g, + NULL, NULL, NULL, H5D_XFER_HYPER_VECTOR_SIZE_ENC, H5D_XFER_HYPER_VECTOR_SIZE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") -#ifdef H5_HAVE_PARALLEL /* Register the I/O transfer mode properties */ - if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &def_io_xfer_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g, + NULL, NULL, NULL, H5D_XFER_IO_XFER_MODE_ENC, H5D_XFER_IO_XFER_MODE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &def_mpio_collective_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g, + NULL, NULL, NULL, H5D_XFER_MPIO_COLLECTIVE_OPT_ENC, H5D_XFER_MPIO_COLLECTIVE_OPT_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &def_mpio_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g, + NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC, H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &def_mpio_chunk_opt_num, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g, + NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC, H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &def_mpio_chunk_opt_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g, + NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC, H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the chunk optimization mode property. */ - if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &def_mpio_actual_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the actual I/O mode property. */ - if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &def_mpio_actual_io_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the local cause of broken collective I/O */ - if(H5P_register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &def_mpio_no_collective_cause, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the global cause of broken collective I/O */ - if(H5P_register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &def_mpio_no_collective_cause, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#ifdef H5_HAVE_PARALLEL /* Register the MPI memory type property */ - if(H5P_register_real(pclass, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE, - &btype, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE, &H5D_def_btype_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the MPI file type property */ - if(H5P_register_real(pclass, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE, - &ftype, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE, &H5D_def_ftype_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ /* Register the EDC property */ - if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &enable_edc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g, + NULL, NULL, NULL, H5D_XFER_EDC_ENC, H5D_XFER_EDC_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the filter callback property */ - if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &filter_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion callback property */ - if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &conv_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data transform property */ - if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &def_xfer_xform, NULL, NULL, NULL, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) + if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, + NULL, NULL, NULL, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, + H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -331,10 +429,300 @@ done: } /* end H5P__dxfr_reg_prop() */ +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_bkgr_buf_type_enc + * + * Purpose: Callback routine which is called whenever the background + * buffer type property in the dataset transfer property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size) +{ + const H5T_bkg_t *bkgr_buf_type = (const H5T_bkg_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(bkgr_buf_type); + HDassert(size); + + if(NULL != *pp) + /* Encode background buffer type */ + *(*pp)++ = (uint8_t)*bkgr_buf_type; + + /* Size of background buffer type */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_bkgr_buf_type_enc() */ /*------------------------------------------------------------------------- - * Function: H5P_dxfr_xform_del + * Function: H5P__dxfr_bkgr_buf_type_dec + * + * Purpose: Callback routine which is called whenever the background + * buffer type property in the dataset transfer property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_bkgr_buf_type_dec(const void **_pp, void *_value) +{ + H5T_bkg_t *bkgr_buf_type = (H5T_bkg_t *)_value; /* Background buffer type */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(bkgr_buf_type); + + /* Decode background buffer type */ + *bkgr_buf_type = (H5T_bkg_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_bkgr_buf_type_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_btree_split_ratio_enc + * + * Purpose: Callback routine which is called whenever the B-tree split + * ratio property in the dataset transfer property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size) +{ + const double *btree_split_ratio = (const double *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(btree_split_ratio); + HDassert(size); + + if(NULL != *pp) { + /* Encode the size of a double*/ + *(*pp)++ = (uint8_t)sizeof(double); + + /* Encode the left split value */ + H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio) + btree_split_ratio++; + + /* Encode the middle split value */ + H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio) + btree_split_ratio++; + + /* Encode the right split value */ + H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio) + } /* end if */ + + /* Size of B-tree split ratio values */ + *size += 1 + (3 * sizeof(double)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_btree_split_ratio_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_btree_split_ratio_dec + * + * Purpose: Callback routine which is called whenever the B-tree split + * ratio property in the dataset transfer property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_btree_split_ratio_dec(const void **_pp, void *_value) +{ + double *btree_split_ratio = (double *)_value; /* B-tree split ratio */ + unsigned enc_size; /* Size of encoded property */ + const uint8_t **pp = (const uint8_t **)_pp; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(btree_split_ratio); + + /* Decode the size */ + enc_size = *(*pp)++; + if(enc_size != sizeof(double)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded") + + /* Decode the left, middle & left B-tree split ratios */ + H5_DECODE_DOUBLE(*pp, btree_split_ratio[0]) + H5_DECODE_DOUBLE(*pp, btree_split_ratio[1]) + H5_DECODE_DOUBLE(*pp, btree_split_ratio[2]) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_btree_split_ratio_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_enc + * + * Purpose: Callback routine which is called whenever the data transform + * property in the dataset transfer property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, August 6, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) +{ + const H5Z_data_xform_t *data_xform_prop = *(const H5Z_data_xform_t * const *)value; /* Create local alias for values */ + const char *pexp = NULL; /* Pointer to transform expression */ + size_t len = 0; /* Length of transform expression */ + uint8_t **pp = (uint8_t **)_pp; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(size); + + /* Check for data transform set */ + if(NULL != data_xform_prop) { + /* Get the transform expression */ + if(NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression") + + /* Get the transform string expression size */ + len = HDstrlen(pexp) + 1; + } /* end if */ + + if(NULL != *pp) { + uint64_t enc_value; + unsigned enc_size; + + /* encode the length of the prefix */ + enc_value = (uint64_t)len; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + if(NULL != data_xform_prop) { + /* Sanity check */ + HDassert(pexp); + + /* Copy the expression into the buffer */ + HDmemcpy(*pp, (const uint8_t *)pexp, len); + *pp += len; + *pp[0] = '\0'; + } /* end if */ + } /* end if */ + + /* Size of encoded data transform */ + *size += (1 + H5V_limit_enc_size((uint64_t)len)); + if(NULL != pexp) + *size += len; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_xform_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_dec + * + * Purpose: Callback routine which is called whenever the data transform + * property in the dataset transfer property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, August 6, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_xform_dec(const void **_pp, void *_value) +{ + H5Z_data_xform_t **data_xform_prop = (H5Z_data_xform_t **)_value; /* New data xform property */ + size_t len; /* Length of encoded string */ + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; + uint64_t enc_value; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(data_xform_prop); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Decode the length of xform expression */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + len = (size_t)enc_value; + + if(0 != len) { + if(NULL == (*data_xform_prop = H5Z_xform_create((const char *)*pp))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create data transform info") + *pp += len; + } /* end if */ + else + *data_xform_prop = H5D_XFER_XFORM_DEF; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_xform_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_del * * Purpose: Frees memory allocated by H5P_dxfr_xform_set * @@ -1301,6 +1689,225 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_hyper_vector_size() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_io_xfer_mode_enc + * + * Purpose: Callback routine which is called whenever the I/O transfer + * mode property in the dataset transfer property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size) +{ + const H5FD_mpio_xfer_t *xfer_mode = (const H5FD_mpio_xfer_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(xfer_mode); + HDassert(size); + + if(NULL != *pp) + /* Encode I/O transfer mode */ + *(*pp)++ = (uint8_t)*xfer_mode; + + /* Size of I/O transfer mode */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_io_xfer_mode_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_io_xfer_mode_dec + * + * Purpose: Callback routine which is called whenever the I/O transfer + * mode property in the dataset transfer property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_io_xfer_mode_dec(const void **_pp, void *_value) +{ + H5FD_mpio_xfer_t *xfer_mode = (H5FD_mpio_xfer_t *)_value; /* I/O transfer mode */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(xfer_mode); + + /* Decode I/O transfer mode */ + *xfer_mode = (H5FD_mpio_xfer_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_io_xfer_mode_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_mpio_collective_opt_enc + * + * Purpose: Callback routine which is called whenever the MPI-I/O + * collective optimization property in the dataset transfer + * property list is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size) +{ + const H5FD_mpio_collective_opt_t *coll_opt = (const H5FD_mpio_collective_opt_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(coll_opt); + HDassert(size); + + if(NULL != *pp) + /* Encode MPI-I/O collective optimization property */ + *(*pp)++ = (uint8_t)*coll_opt; + + /* Size of MPI-I/O collective optimization property */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_mpio_collective_opt_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_mpio_collective_opt_dec + * + * Purpose: Callback routine which is called whenever the MPI-I/O + * collective optimization property in the dataset transfer + * property list is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_mpio_collective_opt_dec(const void **_pp, void *_value) +{ + H5FD_mpio_collective_opt_t *coll_opt = (H5FD_mpio_collective_opt_t *)_value; /* MPI-I/O collective optimization mode */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(coll_opt); + + /* Decode MPI-I/O collective optimization mode */ + *coll_opt = (H5FD_mpio_collective_opt_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_mpio_collective_opt_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_mpio_chunk_opt_hard_enc + * + * Purpose: Callback routine which is called whenever the MPI-I/O + * chunk optimization property in the dataset transfer + * property list is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size) +{ + const H5FD_mpio_chunk_opt_t *chunk_opt = (const H5FD_mpio_chunk_opt_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(chunk_opt); + HDassert(size); + + if(NULL != *pp) + /* Encode MPI-I/O chunk optimization property */ + *(*pp)++ = (uint8_t)*chunk_opt; + + /* Size of MPI-I/O chunk optimization property */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_mpio_chunk_opt_hard_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_mpio_chunk_opt_hard_enc + * + * Purpose: Callback routine which is called whenever the MPI-I/O + * chunk collective optimization property in the dataset transfer + * property list is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_mpio_chunk_opt_hard_dec(const void **_pp, void *_value) +{ + H5FD_mpio_chunk_opt_t *chunk_opt = (H5FD_mpio_chunk_opt_t *)_value; /* MPI-I/O chunk optimization mode */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(chunk_opt); + + /* Decode MPI-I/O chunk optimization mode */ + *chunk_opt = (H5FD_mpio_chunk_opt_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_mpio_chunk_opt_hard_dec() */ + #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- @@ -1391,7 +1998,7 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Dn*Dn", plist_id, local_no_collective_cause, + H5TRACE3("e", "i*Iu*Iu", plist_id, local_no_collective_cause, global_no_collective_cause); /* Get the plist structure */ @@ -1413,3 +2020,76 @@ done: #endif /* H5_HAVE_PARALLEL */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_edc_enc + * + * Purpose: Callback routine which is called whenever the error detect + * property in the dataset transfer property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size) +{ + const H5Z_EDC_t *check = (const H5Z_EDC_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(check); + HDassert(size); + + if(NULL != *pp) + /* Encode EDC property */ + *(*pp)++ = (uint8_t)*check; + + /* Size of EDC property */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_edc_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_edc_dec + * + * Purpose: Callback routine which is called whenever the error detect + * property in the dataset transfer property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 3, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_edc_dec(const void **_pp, void *_value) +{ + H5Z_EDC_t *check = (H5Z_EDC_t *)_value; /* EDC property */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(check); + + /* Decode EDC property */ + *check = (H5Z_EDC_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_edc_dec() */ + diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c new file mode 100644 index 0000000..ff148b0 --- /dev/null +++ b/src/H5Pencdec.c @@ -0,0 +1,813 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol + * + * Purpose: Generic Property Functions + */ + +/****************/ +/* Module Setup */ +/****************/ + +#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +/* Interface initialization */ +#define H5_INTERFACE_INIT_FUNC H5P_init_encdec_interface + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppkg.h" /* Property lists */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* Version # of encoded property lists */ +#define H5P_ENCODE_VERS 0 + + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Typedef for iterator when encoding a property list */ +typedef struct { + hbool_t encode; /* Whether the property list should be encoded */ + size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ + void **pp; /* Pointer to encoding buffer pointer */ +} H5P_enc_iter_ud_t; + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*-------------------------------------------------------------------------- +NAME + H5P_init_encdec_interface -- Initialize interface-specific information +USAGE + herr_t H5P_init_encdec_interface() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Initializes any interface-specific data or routines. (Just calls + H5P_init() currently). + +--------------------------------------------------------------------------*/ +static herr_t +H5P_init_encdec_interface(void) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + FUNC_LEAVE_NOAPI(H5P_init()) +} /* H5P_init_encdec_interface() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_size_t + * + * Purpose: Generic encoding callback routine for 'size_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Sunday, July 29, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_size_t(const void *value, void **_pp, size_t *size) +{ + uint64_t enc_value = (uint64_t)*(const size_t *)value; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; + unsigned enc_size = H5V_limit_enc_size(enc_value); /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(enc_size < 256); + HDassert(size); + + if(NULL != *pp) { + /* Encode the size */ + *(*pp)++ = (uint8_t)enc_size; + + /* Encode the value */ + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + } /* end if */ + + /* Set size needed for encoding */ + *size += (1 + enc_size); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_size_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_hsize_t + * + * Purpose: Generic encoding callback routine for 'hsize_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 07, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) +{ + uint64_t enc_value = (uint64_t)*(const hsize_t *)value; /* Property value to encode */ + unsigned enc_size = H5V_limit_enc_size(enc_value); /* Size of encoded property */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); + HDassert(enc_size < 256); + HDassert(size); + + if(NULL != *pp) { + *(*pp)++ = (uint8_t)enc_size; + + /* Encode the value */ + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + } /* end if */ + + /* Set size needed for encoding */ + *size += (1 + enc_size); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_hsize_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_unsigned + * + * Purpose: Generic encoding callback routine for 'unsigned' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Sunday, July 29, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_unsigned(const void *value, void **_pp, size_t *size) +{ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(value); + HDassert(size); + + if(NULL != *pp) { + /* Encode the size */ + *(*pp)++ = (uint8_t)sizeof(unsigned); + + /* Encode the value */ + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)value) + } /* end if */ + + /* Set size needed for encoding */ + *size += (1 + sizeof(unsigned)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_unsigned() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_uint8_t + * + * Purpose: Generic encoding callback routine for 'uint8_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 07, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) +{ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(value); + HDassert(size); + + if(NULL != *pp) { + /* Encode the value */ + *(*pp)++ = *(const uint8_t *)value; + } /* end if */ + + /* Set size needed for encoding */ + *size += 1; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_uint8_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_hbool_t + * + * Purpose: Generic encoding callback routine for 'hbool_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * August 15, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) +{ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(value); + HDassert(size); + + if(NULL != *pp) + /* Encode the value */ + *(*pp)++ = (uint8_t)*(const hbool_t *)value; + + /* Set size needed for encoding */ + *size += 1; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_hbool_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_double + * + * Purpose: Generic encoding callback routine for 'double' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Sunday, July 29, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_double(const void *value, void **_pp, size_t *size) +{ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(value); + HDassert(size); + + if(NULL != *pp) { + /* Encode the size */ + *(*pp)++ = (uint8_t)sizeof(double); + + /* Encode the value */ + H5_ENCODE_DOUBLE(*pp, *(const double *)value) + } /* end if */ + + /* Set size needed for encoding */ + *size += (1 + sizeof(double)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_double() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__encode_cb + PURPOSE + Internal callback routine when iterating over properties while encoding + a property list. + USAGE + int H5P__encode_cb(item, key, udata) + H5P_genprop_t *prop; IN: Pointer to the property + void *udata; IN/OUT: Pointer to iteration data from user + RETURNS + Success: H5_ITER_CONT + Fail: H5_ITER_ERROR + DESCRIPTION + This routine encodes a property in a property list + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static int +H5P__encode_cb(H5P_genprop_t *prop, void *_udata) +{ + H5P_enc_iter_ud_t *udata = (H5P_enc_iter_ud_t *)_udata; /* Pointer to user data */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(prop); + HDassert(udata); + + /* Check if this property can be encoded */ + if(prop->encode) { + size_t prop_name_len; /* Length of property's name */ + size_t prop_value_len; /* Encoded size of property's value */ + + /* Encode (or not, if the 'encode' flag is off) the property's name */ + prop_name_len = HDstrlen(prop->name) + 1; + if(udata->encode) { + HDstrncpy((char *)*(udata->pp), prop->name, prop_name_len); + *(uint8_t **)(udata->pp) += prop_name_len; + } /* end if */ + *(udata->enc_size_ptr) += prop_name_len; + + /* Encode (or not, if *(udata->pp) is NULL) the property value */ + prop_value_len = 0; + if((prop->encode)(prop->value, udata->pp, &prop_value_len) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed") + *(udata->enc_size_ptr) += prop_value_len; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__encode_cb() */ + + +/*------------------------------------------------------------------------- + NAME + H5P__encode + PURPOSE + Internal routine to encode a property list into a binary buffer. + USAGE + herr_t H5P__encode(plist, enc_all_prop, buf, nalloc) + const H5P_genplist_t *plist; IN: Property list to encode + hbool_t enc_all_prop; IN: Whether to encode all properties (TRUE), + or just non-default (i.e. changed) properties (FALSE). + uint8_t *buf; OUT: buffer to hold the encoded plist + size_t *nalloc; IN/OUT: size of buffer needed to encode plist + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Encodes a property list into a binary buffer. If the buffer is NULL, then + the call will set the size needed to encode the plist in nalloc. Otherwise + the routine will encode the plist in buf. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, + size_t *nalloc) +{ + H5P_enc_iter_ud_t udata; /* User data for property iteration callback */ + uint8_t *p = (uint8_t *)buf; /* Temporary pointer to encoding buffer */ + int idx; /* Index of property to start at */ + size_t encode_size = 0; /* Size of buffer needed to encode properties */ + hbool_t encode = TRUE; /* Whether the property list should be encoded */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + if(NULL == nalloc) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad allocation size pointer") + + /* If the buffer is NULL, then this call to H5P__encode will return how much + * space is needed to encode a property. + */ + if(NULL == p) + encode = FALSE; + + /* Encode property list description info */ + if(encode) { + /* Version # of property list encoding */ + *p++ = (uint8_t)H5P_ENCODE_VERS; + + /* Type of property list */ + *p++ = (uint8_t)plist->pclass->type; + } /* end if */ + encode_size += 2; + + /* Initialize user data for iteration callback */ + udata.encode = encode; + udata.enc_size_ptr = &encode_size; + udata.pp = (void **)&p; + + /* Iterate over all properties in property list, encoding them */ + idx = 0; + if(H5P_iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_BADITER, FAIL, "can't iterate over properties") + + /* Encode a terminator for list of properties */ + if(encode) + *p++ = 0; + encode_size++; + + /* Set the size of the buffer needed/used to encode the property list */ + *nalloc = encode_size; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_size_t + * + * Purpose: Generic decoding callback routine for 'size_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, August 2, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_size_t(const void **_pp, void *_value) +{ + size_t *value = (size_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + H5_ASSIGN_OVERFLOW(*value, enc_value, uint64_t, size_t); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_size_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_hsize_t + * + * Purpose: Generic decoding callback routine for 'hsize_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 07, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_hsize_t(const void **_pp, void *_value) +{ + hsize_t *value = (hsize_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + H5_ASSIGN_OVERFLOW(*value, enc_value, uint64_t, hsize_t); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_hsize_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_unsigned + * + * Purpose: Generic decoding callback routine for 'unsigned' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, August 2, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_unsigned(const void **_pp, void *_value) +{ + unsigned *value = (unsigned *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + + H5_DECODE_UNSIGNED(*pp, *value) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__decode_unsigned() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_uint8_t + * + * Purpose: Generic decoding callback routine for 'uint8_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, August 2, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_uint8_t(const void **_pp, void *_value) +{ + uint8_t *value = (uint8_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the value */ + *value = *(*pp)++; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__decode_uint8_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_hbool_t + * + * Purpose: Generic decoding callback routine for 'hbool_t' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_hbool_t(const void **_pp, void *_value) +{ + hbool_t *value = (hbool_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the value */ + *value = (hbool_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__decode_hbool_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_double + * + * Purpose: Generic decoding callback routine for 'double' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, August 2, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_double(const void **_pp, void *_value) +{ + double *value = (double *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + if(enc_size != sizeof(double)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded") + + H5_DECODE_DOUBLE(*pp, *value) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__decode_double() */ + + +/*------------------------------------------------------------------------- + NAME + H5P__decode + PURPOSE + Internal routine to decode a property list from a binary buffer. + USAGE + H5P_genplist_t *H5P__decode(buf) + const void *buf; IN: buffer that holds the encoded plist + RETURNS + Returns non-negative ID of new property list object on success, negative + on failure. + DESCRIPTION + Decodes a property list from a binary buffer. The contents of the buffer + contain the values for the correponding properties of the plist. The decode + callback of a certain property decodes its value from the buffer and sets it + in the property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Properties in the property list that are not encoded in the serialized + form retain their default value. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +hid_t +H5P__decode(const void *buf) +{ + H5P_genplist_t *plist; /* Property list to decode into */ + void *value_buf = NULL; /* Pointer to buffer to use when decoding values */ + const uint8_t *p = (const uint8_t *)buf; /* Current pointer into buffer */ + H5P_plist_type_t type; /* Type of encoded property list */ + hid_t plist_id = -1; /* ID of new property list */ + size_t value_buf_size = 0; /* Size of current value buffer */ + uint8_t vers; /* Version of encoded property list */ + hid_t ret_value; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + if(NULL == p) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "decode buffer is NULL") + + /* Get the version number of the encoded property list */ + vers = (uint8_t)*p++; + if((uint8_t)H5P_ENCODE_VERS != vers) + HGOTO_ERROR(H5E_PLIST, H5E_VERSION, FAIL, "bad version # of encoded information, expected %u, got %u", (unsigned)H5P_ENCODE_VERS, (unsigned)vers) + + /* Get the type of the property list */ + type = (H5P_plist_type_t)*p++; + if(type <= H5P_TYPE_USER || type > H5P_TYPE_LINK_ACCESS) + HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "bad type of encoded information: %u", (unsigned)type) + + /* Create new property list of the specified type */ + if((plist_id = H5P__new_plist_of_type(type)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_VERSION, FAIL, "can't create property list of type: %u\n", (unsigned)type); + + /* Get the property list object */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class") + + /* Loop over encoded properties, deserializing their values */ + while(p) { + H5P_genprop_t *prop; /* Pointer to property with same name */ + const char *name; /* Pointer to property list name */ + + /* Check for end of serialized list of properties */ + if(0 == *p) + break; + + /* Get property list name */ + name = (const char *)p; + p += HDstrlen(name) + 1; + + /* Find property with name */ + if(NULL == (prop = H5P__find_prop_plist(plist, name))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist: '%s'", name) + + /* Check if we should increase the size of the value buffer */ + if(prop->size > value_buf_size) { + if(NULL == (value_buf = H5MM_realloc(value_buf, prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "decoding buffer allocation failed") + value_buf_size = prop->size; + } /* end if */ + + /* Decode serialized value */ + if(prop->decode) { + if((prop->decode)((const void **)&p, value_buf) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "property decoding routine failed, property: '%s'", name) + } /* end if */ + else + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s', name") + + /* Set the value for the property */ + if(H5P_set(plist, name, value_buf) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value for property: '%s'", name) + } /* end while */ + + /* Set return value */ + ret_value = plist_id; + +done: + /* Release resources */ + if(value_buf) + value_buf = H5MM_xfree(value_buf); + + /* Cleanup on error */ + if(ret_value < 0) { + if(plist_id > 0 && H5I_dec_ref(plist_id) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close partially initialized property list") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__decode() */ + diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 889cdc6..4faed4f 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -59,36 +59,57 @@ /* Definitions for the initial metadata cache resize configuration */ #define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) #define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG +#define H5F_ACS_META_CACHE_INIT_CONFIG_ENC H5P__facc_cache_config_enc +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEC H5P__facc_cache_config_dec +#define H5F_ACS_META_CACHE_INIT_CONFIG_CMP H5P__facc_cache_config_cmp /* Definitions for size of raw data chunk cache(slots) */ #define H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t) #define H5F_ACS_DATA_CACHE_NUM_SLOTS_DEF 521 +#define H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_size_t +#define H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_size_t /* Definition for size of raw data chunk cache(bytes) */ #define H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) #define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF (1024*1024) +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_size_t +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t /* Definition for preemption read chunks first */ #define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) #define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75f +#define H5F_ACS_PREEMPT_READ_CHUNKS_ENC H5P__encode_double +#define H5F_ACS_PREEMPT_READ_CHUNKS_DEC H5P__decode_double /* Definition for threshold for alignment */ #define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t) #define H5F_ACS_ALIGN_THRHD_DEF 1 +#define H5F_ACS_ALIGN_THRHD_ENC H5P__encode_hsize_t +#define H5F_ACS_ALIGN_THRHD_DEC H5P__decode_hsize_t /* Definition for alignment */ #define H5F_ACS_ALIGN_SIZE sizeof(hsize_t) #define H5F_ACS_ALIGN_DEF 1 +#define H5F_ACS_ALIGN_ENC H5P__encode_hsize_t +#define H5F_ACS_ALIGN_DEC H5P__decode_hsize_t /* Definition for minimum metadata allocation block size (when aggregating metadata allocations. */ #define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(hsize_t) #define H5F_ACS_META_BLOCK_SIZE_DEF 2048 +#define H5F_ACS_META_BLOCK_SIZE_ENC H5P__encode_hsize_t +#define H5F_ACS_META_BLOCK_SIZE_DEC H5P__decode_hsize_t /* Definition for maximum sieve buffer size (when data sieving is allowed by file driver */ #define H5F_ACS_SIEVE_BUF_SIZE_SIZE sizeof(size_t) #define H5F_ACS_SIEVE_BUF_SIZE_DEF (64*1024) +#define H5F_ACS_SIEVE_BUF_SIZE_ENC H5P__encode_size_t +#define H5F_ACS_SIEVE_BUF_SIZE_DEC H5P__decode_size_t /* Definition for minimum "small data" allocation block size (when aggregating "small" raw data allocations. */ #define H5F_ACS_SDATA_BLOCK_SIZE_SIZE sizeof(hsize_t) #define H5F_ACS_SDATA_BLOCK_SIZE_DEF 2048 +#define H5F_ACS_SDATA_BLOCK_SIZE_ENC H5P__encode_hsize_t +#define H5F_ACS_SDATA_BLOCK_SIZE_DEC H5P__decode_hsize_t /* Definition for garbage-collect references */ #define H5F_ACS_GARBG_COLCT_REF_SIZE sizeof(unsigned) #define H5F_ACS_GARBG_COLCT_REF_DEF 0 +#define H5F_ACS_GARBG_COLCT_REF_ENC H5P__encode_unsigned +#define H5F_ACS_GARBG_COLCT_REF_DEC H5P__decode_unsigned /* Definition for file driver ID */ #define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t) #define H5F_ACS_FILE_DRV_ID_DEF H5_DEFAULT_VFD @@ -98,9 +119,13 @@ /* Definition for file close degree */ #define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) #define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT +#define H5F_CLOSE_DEGREE_ENC H5P__facc_fclose_degree_enc +#define H5F_CLOSE_DEGREE_DEC H5P__facc_fclose_degree_dec /* Definition for offset position in file for family file driver */ #define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t) #define H5F_ACS_FAMILY_OFFSET_DEF 0 +#define H5F_ACS_FAMILY_OFFSET_ENC H5P__encode_hsize_t +#define H5F_ACS_FAMILY_OFFSET_DEC H5P__decode_hsize_t /* Definition for new member size of family driver. It's private * property only used by h5repart */ #define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t) @@ -112,9 +137,13 @@ /* Definition for data type in multi file driver */ #define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t) #define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT +#define H5F_ACS_MULTI_TYPE_ENC H5P__facc_multi_type_enc +#define H5F_ACS_MULTI_TYPE_DEC H5P__facc_multi_type_dec /* Definition for 'use latest format version' flag */ #define H5F_ACS_LATEST_FORMAT_SIZE sizeof(hbool_t) #define H5F_ACS_LATEST_FORMAT_DEF FALSE +#define H5F_ACS_LATEST_FORMAT_ENC H5P__encode_hbool_t +#define H5F_ACS_LATEST_FORMAT_DEC H5P__decode_hbool_t /* Definition for whether to query the file descriptor from the core VFD * instead of the memory address. (Private to library) */ @@ -123,6 +152,8 @@ /* Definition for external file cache size */ #define H5F_ACS_EFC_SIZE_SIZE sizeof(unsigned) #define H5F_ACS_EFC_SIZE_DEF 0 +#define H5F_ACS_EFC_SIZE_ENC H5P__encode_unsigned +#define H5F_ACS_EFC_SIZE_DEC H5P__decode_unsigned /* Definition of pointer to initial file image info */ #define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t) #define H5F_ACS_FILE_IMAGE_INFO_DEF H5FD_DEFAULT_FILE_IMAGE_INFO @@ -155,6 +186,15 @@ static herr_t H5P_file_image_info_del(hid_t prop_id, const char *name, size_t si static herr_t H5P_file_image_info_copy(const char *name, size_t size, void *value); static herr_t H5P_file_image_info_close(const char *name, size_t size, void *value); +/* encode & decode callbacks */ +static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_cache_config_dec(const void **_pp, void *value); +static int H5P__facc_cache_config_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value); +static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value); + /*********************/ /* Package Variables */ @@ -186,6 +226,28 @@ const H5P_libclass_t H5P_CLS_FACC[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const H5AC_cache_config_t H5F_def_mdc_initCacheCfg_g = H5F_ACS_META_CACHE_INIT_CONFIG_DEF; /* Default metadata cache settings */ +static const size_t H5F_def_rdcc_nslots_g = H5F_ACS_DATA_CACHE_NUM_SLOTS_DEF; /* Default raw data chunk cache # of slots */ +static const size_t H5F_def_rdcc_nbytes_g = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */ +static const double H5F_def_rdcc_w0_g = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */ +static const hsize_t H5F_def_threshold_g = H5F_ACS_ALIGN_THRHD_DEF; /* Default allocation alignment threshold */ +static const hsize_t H5F_def_alignment_g = H5F_ACS_ALIGN_DEF; /* Default allocation alignment value */ +static const hsize_t H5F_def_meta_block_size_g = H5F_ACS_META_BLOCK_SIZE_DEF; /* Default metadata allocation block size */ +static const size_t H5F_def_sieve_buf_size_g = H5F_ACS_SIEVE_BUF_SIZE_DEF; /* Default raw data I/O sieve buffer size */ +static const hsize_t H5F_def_sdata_block_size_g = H5F_ACS_SDATA_BLOCK_SIZE_DEF; /* Default small data allocation block size */ +static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF; /* Default garbage collection for references setting */ +static const void *H5F_def_driver_info_g = H5F_ACS_FILE_DRV_INFO_DEF; /* Default VFL driver info */ +static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */ +static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */ +static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */ +static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */ +static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */ +static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */ +static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */ +static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */ +static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ + /*------------------------------------------------------------------------- @@ -202,114 +264,137 @@ const H5P_libclass_t H5P_CLS_FACC[1] = {{ static herr_t H5P_facc_reg_prop(H5P_genclass_t *pclass) { - H5AC_cache_config_t mdc_initCacheCfg = H5F_ACS_META_CACHE_INIT_CONFIG_DEF; /* Default metadata cache settings */ - size_t rdcc_nslots = H5F_ACS_DATA_CACHE_NUM_SLOTS_DEF; /* Default raw data chunk cache # of slots */ - size_t rdcc_nbytes = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */ - double rdcc_w0 = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */ - hsize_t threshold = H5F_ACS_ALIGN_THRHD_DEF; /* Default allocation alignment threshold */ - hsize_t alignment = H5F_ACS_ALIGN_DEF; /* Default allocation alignment value */ - hsize_t meta_block_size = H5F_ACS_META_BLOCK_SIZE_DEF; /* Default metadata allocation block size */ - size_t sieve_buf_size = H5F_ACS_SIEVE_BUF_SIZE_DEF; /* Default raw data I/O sieve buffer size */ - hsize_t sdata_block_size = H5F_ACS_SDATA_BLOCK_SIZE_DEF; /* Default small data allocation block size */ - unsigned gc_ref = H5F_ACS_GARBG_COLCT_REF_DEF; /* Default garbage collection for references setting */ - hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID */ - void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF; /* Default VFL driver info */ - H5F_close_degree_t close_degree = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */ - hsize_t family_offset = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */ - hsize_t family_newsize = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */ - hbool_t family_to_sec2 = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */ - H5FD_mem_t mem_type = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */ - hbool_t latest_format = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */ - hbool_t want_posix_fd = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */ - unsigned efc_size = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */ - H5FD_file_image_info_t file_image_info = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ + const hid_t def_driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Register the initial metadata cache resize configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, + NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, + NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, + NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, + NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &alignment, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, + NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, + NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, + NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, + NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, + NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &driver_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &def_driver_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver info */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &H5F_def_driver_info_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ - if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &close_degree, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, + NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, + NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of new family file size. It's used by h5repart only. */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &mem_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, + NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'use the latest version of the format' flag */ - if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g, + NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ - if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &want_posix_fd, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file cache size */ - if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &efc_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, + NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the initial file image info */ - if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &file_image_info, NULL, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, NULL, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, + NULL, NULL, NULL, NULL, NULL, + H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, NULL, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -2347,3 +2432,551 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_file_image_info_close() */ + +/*------------------------------------------------------------------------- + * Function: H5P__facc_cache_config_cmp + * + * Purpose: Compare two cache configurations. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * + * Programmer: Mohamad Chaarawi + * September 24, 2012 + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_cache_config_cmp(const void *_config1, const void *_config2, size_t UNUSED size) +{ + const H5AC_cache_config_t *config1 = (const H5AC_cache_config_t *)_config1; /* Create local aliases for values */ + const H5AC_cache_config_t *config2 = (const H5AC_cache_config_t *)_config2; /* Create local aliases for values */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Check for a property being set */ + if(config1 == NULL && config2 != NULL) HGOTO_DONE(-1); + if(config1 != NULL && config2 == NULL) HGOTO_DONE(1); + + if(config1->version < config2->version) HGOTO_DONE(-1); + if(config1->version > config2->version) HGOTO_DONE(1); + + if(config1->rpt_fcn_enabled < config2->rpt_fcn_enabled) HGOTO_DONE(-1); + if(config1->rpt_fcn_enabled > config2->rpt_fcn_enabled) HGOTO_DONE(1); + + if(config1->open_trace_file < config2->open_trace_file) HGOTO_DONE(-1); + if(config1->open_trace_file > config2->open_trace_file) HGOTO_DONE(1); + + if(config1->close_trace_file < config2->close_trace_file) HGOTO_DONE(-1); + if(config1->close_trace_file > config2->close_trace_file) HGOTO_DONE(1); + + if((ret_value = HDstrncmp(config1->trace_file_name, config2->trace_file_name, + H5AC__MAX_TRACE_FILE_NAME_LEN + 1)) != 0) + HGOTO_DONE(ret_value); + + if(config1->evictions_enabled < config2->evictions_enabled) HGOTO_DONE(-1); + if(config1->evictions_enabled > config2->evictions_enabled) HGOTO_DONE(1); + + if(config1->set_initial_size < config2->set_initial_size) HGOTO_DONE(-1); + if(config1->set_initial_size > config2->set_initial_size) HGOTO_DONE(1); + + if(config1->initial_size < config2->initial_size) HGOTO_DONE(-1); + if(config1->initial_size > config2->initial_size) HGOTO_DONE(1); + + if(config1->min_clean_fraction < config2->min_clean_fraction) HGOTO_DONE(-1); + if(config1->min_clean_fraction > config2->min_clean_fraction) HGOTO_DONE(1); + + if(config1->max_size < config2->max_size) HGOTO_DONE(-1); + if(config1->max_size > config2->max_size) HGOTO_DONE(1); + + if(config1->min_size < config2->min_size) HGOTO_DONE(-1); + if(config1->min_size > config2->min_size) HGOTO_DONE(1); + + if(config1->epoch_length < config2->epoch_length) HGOTO_DONE(-1); + if(config1->epoch_length > config2->epoch_length) HGOTO_DONE(1); + + if(config1->incr_mode < config2->incr_mode) HGOTO_DONE(-1); + if(config1->incr_mode > config2->incr_mode) HGOTO_DONE(1); + + if(config1->lower_hr_threshold < config2->lower_hr_threshold) HGOTO_DONE(-1); + if(config1->lower_hr_threshold > config2->lower_hr_threshold) HGOTO_DONE(1); + + if(config1->increment < config2->increment) HGOTO_DONE(-1); + if(config1->increment > config2->increment) HGOTO_DONE(1); + + if(config1->apply_max_increment < config2->apply_max_increment) HGOTO_DONE(-1); + if(config1->apply_max_increment > config2->apply_max_increment) HGOTO_DONE(1); + + if(config1->max_increment < config2->max_increment) HGOTO_DONE(-1); + if(config1->max_increment > config2->max_increment) HGOTO_DONE(1); + + if(config1->flash_incr_mode < config2->flash_incr_mode) HGOTO_DONE(-1); + if(config1->flash_incr_mode > config2->flash_incr_mode) HGOTO_DONE(1); + + if(config1->flash_multiple < config2->flash_multiple) HGOTO_DONE(-1); + if(config1->flash_multiple > config2->flash_multiple) HGOTO_DONE(1); + + if(config1->flash_threshold < config2->flash_threshold) HGOTO_DONE(-1); + if(config1->flash_threshold > config2->flash_threshold) HGOTO_DONE(1); + + if(config1->decr_mode < config2->decr_mode) HGOTO_DONE(-1); + if(config1->decr_mode > config2->decr_mode) HGOTO_DONE(1); + + if(config1->upper_hr_threshold < config2->upper_hr_threshold) HGOTO_DONE(-1); + if(config1->upper_hr_threshold > config2->upper_hr_threshold) HGOTO_DONE(1); + + if(config1->decrement < config2->decrement) HGOTO_DONE(-1); + if(config1->decrement > config2->decrement) HGOTO_DONE(1); + + if(config1->apply_max_decrement < config2->apply_max_decrement) HGOTO_DONE(-1); + if(config1->apply_max_decrement > config2->apply_max_decrement) HGOTO_DONE(1); + + if(config1->max_decrement < config2->max_decrement) HGOTO_DONE(-1); + if(config1->max_decrement > config2->max_decrement) HGOTO_DONE(1); + + if(config1->epochs_before_eviction < config2->epochs_before_eviction) HGOTO_DONE(-1); + if(config1->epochs_before_eviction > config2->epochs_before_eviction) HGOTO_DONE(1); + + if(config1->apply_empty_reserve < config2->apply_empty_reserve) HGOTO_DONE(-1); + if(config1->apply_empty_reserve > config2->apply_empty_reserve) HGOTO_DONE(1); + + if(config1->empty_reserve < config2->empty_reserve) HGOTO_DONE(-1); + if(config1->empty_reserve > config2->empty_reserve) HGOTO_DONE(1); + + if(config1->dirty_bytes_threshold < config2->dirty_bytes_threshold) HGOTO_DONE(-1); + if(config1->dirty_bytes_threshold > config2->dirty_bytes_threshold) HGOTO_DONE(1); + + if(config1->metadata_write_strategy < config2->metadata_write_strategy) HGOTO_DONE(-1); + if(config1->metadata_write_strategy > config2->metadata_write_strategy) HGOTO_DONE(1); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_cache_config_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_cache_config_enc + * + * Purpose: Callback routine which is called whenever the default + * cache config property in the file creation property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 09, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) +{ + const H5AC_cache_config_t *config = (const H5AC_cache_config_t *)value; /* Create local aliases for values */ + uint8_t **pp = (uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + uint64_t enc_value; /* Property to encode */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + if(NULL != *pp) { + /* Encode type sizes (as a safety check) */ + *(*pp)++ = (uint8_t)sizeof(unsigned); + *(*pp)++ = (uint8_t)sizeof(double); + + /* int */ + INT32ENCODE(*pp, (int32_t)config->version); + + H5_ENCODE_UNSIGNED(*pp, config->rpt_fcn_enabled); + + H5_ENCODE_UNSIGNED(*pp, config->open_trace_file); + + H5_ENCODE_UNSIGNED(*pp, config->close_trace_file); + + HDmemcpy(*pp, (const uint8_t *)(config->trace_file_name), H5AC__MAX_TRACE_FILE_NAME_LEN + 1); + *pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1; + + H5_ENCODE_UNSIGNED(*pp, config->evictions_enabled); + + H5_ENCODE_UNSIGNED(*pp, config->set_initial_size); + + enc_value = (uint64_t)config->initial_size; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + H5_ENCODE_DOUBLE(*pp, config->min_clean_fraction); + + enc_value = (uint64_t)config->max_size; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + enc_value = (uint64_t)config->min_size; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* long int */ + INT64ENCODE(*pp, (int64_t)config->epoch_length); + + /* enum */ + *(*pp)++ = (uint8_t)config->incr_mode; + + H5_ENCODE_DOUBLE(*pp, config->lower_hr_threshold); + + H5_ENCODE_DOUBLE(*pp, config->increment); + + H5_ENCODE_UNSIGNED(*pp, config->apply_max_increment); + + enc_value = (uint64_t)config->max_increment; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* enum */ + *(*pp)++ = (uint8_t)config->flash_incr_mode; + + H5_ENCODE_DOUBLE(*pp, config->flash_multiple); + + H5_ENCODE_DOUBLE(*pp, config->flash_threshold); + + /* enum */ + *(*pp)++ = (uint8_t)config->decr_mode; + + H5_ENCODE_DOUBLE(*pp, config->upper_hr_threshold); + + H5_ENCODE_DOUBLE(*pp, config->decrement); + + H5_ENCODE_UNSIGNED(*pp, config->apply_max_decrement); + + enc_value = (uint64_t)config->max_decrement; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* int */ + INT32ENCODE(*pp, (int32_t)config->epochs_before_eviction); + + H5_ENCODE_UNSIGNED(*pp, config->apply_empty_reserve); + + H5_ENCODE_DOUBLE(*pp, config->empty_reserve); + + /* int */ + INT32ENCODE(*pp, (int32_t)config->dirty_bytes_threshold); + + /* int */ + INT32ENCODE(*pp, (int32_t)config->metadata_write_strategy); + } /* end if */ + + /* Compute encoded size of variably-encoded values */ + enc_value = (uint64_t)config->initial_size; + *size += 1 + H5V_limit_enc_size(enc_value); + enc_value = (uint64_t)config->max_size; + *size += 1 + H5V_limit_enc_size(enc_value); + enc_value = (uint64_t)config->min_size; + *size += 1 + H5V_limit_enc_size(enc_value); + enc_value = (uint64_t)config->max_increment; + *size += 1 + H5V_limit_enc_size(enc_value); + enc_value = (uint64_t)config->max_decrement; + *size += 1 + H5V_limit_enc_size(enc_value); + + /* Compute encoded size of fixed-size values */ + *size += (5 + (sizeof(unsigned) * 8) + (sizeof(double) * 8) + + (sizeof(int32_t) * 4) + sizeof(int64_t) + + H5AC__MAX_TRACE_FILE_NAME_LEN + 1); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__facc_cache_config_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_cache_config_dec + * + * Purpose: Callback routine which is called whenever the default + * cache config property in the file creation property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 09, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_cache_config_dec(const void **_pp, void *_value) +{ + H5AC_cache_config_t *config = (H5AC_cache_config_t *)_value; + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; + uint64_t enc_value; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(config); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Set property to default value */ + HDmemcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t)); + + /* Decode type sizes */ + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + enc_size = *(*pp)++; + if(enc_size != sizeof(double)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded") + + /* int */ + INT32DECODE(*pp, config->version); + + H5_DECODE_UNSIGNED(*pp, config->rpt_fcn_enabled); + + H5_DECODE_UNSIGNED(*pp, config->open_trace_file); + + H5_DECODE_UNSIGNED(*pp, config->close_trace_file); + + HDstrcpy(config->trace_file_name, (const char *)(*pp)); + *pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1; + + H5_DECODE_UNSIGNED(*pp, config->evictions_enabled); + + H5_DECODE_UNSIGNED(*pp, config->set_initial_size); + + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + config->initial_size = (size_t)enc_value; + + H5_DECODE_DOUBLE(*pp, config->min_clean_fraction); + + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + config->max_size = (size_t)enc_value; + + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + config->min_size = (size_t)enc_value; + + /* long int */ + { + int64_t temp; + INT64DECODE(*pp, temp); + config->epoch_length = (long int)temp; + } + /* enum */ + config->incr_mode = (enum H5C_cache_incr_mode)*(*pp)++; + + H5_DECODE_DOUBLE(*pp, config->lower_hr_threshold); + + H5_DECODE_DOUBLE(*pp, config->increment); + + H5_DECODE_UNSIGNED(*pp, config->apply_max_increment); + + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + config->max_increment = (size_t)enc_value; + + /* enum */ + config->flash_incr_mode = (enum H5C_cache_flash_incr_mode)*(*pp)++; + + H5_DECODE_DOUBLE(*pp, config->flash_multiple); + + H5_DECODE_DOUBLE(*pp, config->flash_threshold); + + /* enum */ + config->decr_mode = (enum H5C_cache_decr_mode)*(*pp)++; + + H5_DECODE_DOUBLE(*pp, config->upper_hr_threshold); + + H5_DECODE_DOUBLE(*pp, config->decrement); + + H5_DECODE_UNSIGNED(*pp, config->apply_max_decrement); + + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + config->max_decrement = (size_t)enc_value; + + /* int */ + INT32DECODE(*pp, config->epochs_before_eviction); + + H5_DECODE_UNSIGNED(*pp, config->apply_empty_reserve); + + H5_DECODE_DOUBLE(*pp, config->empty_reserve); + + /* int */ + INT32DECODE(*pp, config->dirty_bytes_threshold); + + /* int */ + INT32DECODE(*pp, config->metadata_write_strategy); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_cache_config_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_fclose_degree_enc + * + * Purpose: Callback routine which is called whenever the file close + * degree property in the file access property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) +{ + const H5F_close_degree_t *fclose_degree = (const H5F_close_degree_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(fclose_degree); + HDassert(size); + + if(NULL != *pp) + /* Encode file close degree */ + *(*pp)++ = (uint8_t)*fclose_degree; + + /* Size of file close degree */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__facc_fclose_degree_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_fclose_degree_dec + * + * Purpose: Callback routine which is called whenever the file close + * degree property in the file access property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_fclose_degree_dec(const void **_pp, void *_value) +{ + H5F_close_degree_t *fclose_degree = (H5F_close_degree_t *)_value; /* File close degree */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(fclose_degree); + + /* Decode file close degree */ + *fclose_degree = (H5F_close_degree_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__facc_fclose_degree_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_multi_type_enc + * + * Purpose: Callback routine which is called whenever the multi VFD + * memory type property in the file access property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) +{ + const H5FD_mem_t *type = (const H5FD_mem_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(type); + HDassert(size); + + if(NULL != *pp) + /* Encode file close degree */ + *(*pp)++ = (uint8_t)*type; + + /* Size of multi VFD memory type */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__facc_multi_type_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_multi_type_dec + * + * Purpose: Callback routine which is called whenever the multi VFD + * memory type property in the file access property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_multi_type_dec(const void **_pp, void *_value) +{ + H5FD_mem_t *type = (H5FD_mem_t *)_value; /* File close degree */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(type); + + /* Decode multi VFD memory type */ + *type = (H5FD_mem_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__facc_multi_type_dec() */ + diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 21d45df..3eb9c5b 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -49,37 +49,61 @@ /* Definitions for the size of the file user block in bytes */ #define H5F_CRT_USER_BLOCK_SIZE sizeof(hsize_t) #define H5F_CRT_USER_BLOCK_DEF 0 +#define H5F_CRT_USER_BLOCK_ENC H5P__encode_hsize_t +#define H5F_CRT_USER_BLOCK_DEC H5P__decode_hsize_t /* Definitions for the 1/2 rank for symbol table leaf nodes */ #define H5F_CRT_SYM_LEAF_SIZE sizeof(unsigned) +#define H5F_CRT_SYM_LEAF_ENC H5P__encode_unsigned +#define H5F_CRT_SYM_LEAF_DEC H5P__decode_unsigned /* Definitions for the 1/2 rank for btree internal nodes */ #define H5F_CRT_BTREE_RANK_SIZE sizeof(unsigned[H5B_NUM_BTREE_ID]) #define H5F_CRT_BTREE_RANK_DEF {HDF5_BTREE_SNODE_IK_DEF,HDF5_BTREE_CHUNK_IK_DEF} +#define H5F_CRT_BTREE_RANK_ENC H5P__fcrt_btree_rank_enc +#define H5F_CRT_BTREE_RANK_DEC H5P__fcrt_btree_rank_dec /* Definitions for byte number in an address */ #define H5F_CRT_ADDR_BYTE_NUM_SIZE sizeof(uint8_t) #define H5F_CRT_ADDR_BYTE_NUM_DEF H5F_OBJ_ADDR_SIZE +#define H5F_CRT_ADDR_BYTE_NUM_ENC H5P__encode_uint8_t +#define H5F_CRT_ADDR_BYTE_NUM_DEC H5P__decode_uint8_t /* Definitions for byte number for object size */ #define H5F_CRT_OBJ_BYTE_NUM_SIZE sizeof(uint8_t) #define H5F_CRT_OBJ_BYTE_NUM_DEF H5F_OBJ_SIZE_SIZE +#define H5F_CRT_OBJ_BYTE_NUM_ENC H5P__encode_uint8_t +#define H5F_CRT_OBJ_BYTE_NUM_DEC H5P__decode_uint8_t /* Definitions for version number of the superblock */ #define H5F_CRT_SUPER_VERS_SIZE sizeof(unsigned) #define H5F_CRT_SUPER_VERS_DEF HDF5_SUPERBLOCK_VERSION_DEF /* Definitions for shared object header messages */ #define H5F_CRT_SHMSG_NINDEXES_SIZE sizeof(unsigned) #define H5F_CRT_SHMSG_NINDEXES_DEF (0) +#define H5F_CRT_SHMSG_NINDEXES_ENC H5P__encode_unsigned +#define H5F_CRT_SHMSG_NINDEXES_DEC H5P__decode_unsigned #define H5F_CRT_SHMSG_INDEX_TYPES_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES]) #define H5F_CRT_SHMSG_INDEX_TYPES_DEF {0,0,0,0,0,0} +#define H5F_CRT_SHMSG_INDEX_TYPES_ENC H5P__fcrt_shmsg_index_types_enc +#define H5F_CRT_SHMSG_INDEX_TYPES_DEC H5P__fcrt_shmsg_index_types_dec #define H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES]) #define H5F_CRT_SHMSG_INDEX_MINSIZE_DEF {250,250,250,250,250,250} +#define H5F_CRT_SHMSG_INDEX_MINSIZE_ENC H5P__fcrt_shmsg_index_minsize_enc +#define H5F_CRT_SHMSG_INDEX_MINSIZE_DEC H5P__fcrt_shmsg_index_minsize_dec /* Definitions for shared object header list/btree phase change cutoffs */ #define H5F_CRT_SHMSG_LIST_MAX_SIZE sizeof(unsigned) #define H5F_CRT_SHMSG_LIST_MAX_DEF (50) +#define H5F_CRT_SHMSG_LIST_MAX_ENC H5P__encode_unsigned +#define H5F_CRT_SHMSG_LIST_MAX_DEC H5P__decode_unsigned #define H5F_CRT_SHMSG_BTREE_MIN_SIZE sizeof(unsigned) #define H5F_CRT_SHMSG_BTREE_MIN_DEF (40) +#define H5F_CRT_SHMSG_BTREE_MIN_ENC H5P__encode_unsigned +#define H5F_CRT_SHMSG_BTREE_MIN_DEC H5P__decode_unsigned /* Definitions for file space handling strategy */ #define H5F_CRT_FILE_SPACE_STRATEGY_SIZE sizeof(unsigned) #define H5F_CRT_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_STRATEGY_DEF +#define H5F_CRT_FILE_SPACE_STRATEGY_ENC H5P__encode_unsigned +#define H5F_CRT_FILE_SPACE_STRATEGY_DEC H5P__decode_unsigned #define H5F_CRT_FREE_SPACE_THRESHOLD_SIZE sizeof(hsize_t) #define H5F_CRT_FREE_SPACE_THRESHOLD_DEF H5F_FREE_SPACE_THRESHOLD_DEF +#define H5F_CRT_FREE_SPACE_THRESHOLD_ENC H5P__encode_hsize_t +#define H5F_CRT_FREE_SPACE_THRESHOLD_DEC H5P__decode_hsize_t /******************/ @@ -99,6 +123,14 @@ /* Property class callbacks */ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); +/* property callbacks */ +static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_btree_rank_dec(const void **_pp, void *value); +static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *value); +static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *value); + /*********************/ /* Package Variables */ @@ -130,6 +162,21 @@ const H5P_libclass_t H5P_CLS_FCRT[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const hsize_t H5F_def_userblock_size_g = H5F_CRT_USER_BLOCK_DEF; /* Default userblock size */ +static const unsigned H5F_def_sym_leaf_k_g = H5F_CRT_SYM_LEAF_DEF; /* Default size for symbol table leaf nodes */ +static const unsigned H5F_def_btree_k_g[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; /* Default 'K' values for B-trees in file */ +static const uint8_t H5F_def_sizeof_addr_g = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */ +static const uint8_t H5F_def_sizeof_size_g = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */ +static const unsigned H5F_def_superblock_ver_g = H5F_CRT_SUPER_VERS_DEF; /* Default superblock version # */ +static const unsigned H5F_def_num_sohm_indexes_g = H5F_CRT_SHMSG_NINDEXES_DEF; +static const unsigned H5F_def_sohm_index_flags_g[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF; +static const unsigned H5F_def_sohm_index_minsizes_g[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF; +static const unsigned H5F_def_sohm_list_max_g = H5F_CRT_SHMSG_LIST_MAX_DEF; +static const unsigned H5F_def_sohm_btree_min_g = H5F_CRT_SHMSG_BTREE_MIN_DEF; +static const unsigned H5F_def_file_space_strategy_g = H5F_CRT_FILE_SPACE_STRATEGY_DEF; +static const hsize_t H5F_def_free_space_threshold_g = H5F_CRT_FREE_SPACE_THRESHOLD_DEF; + /*------------------------------------------------------------------------- @@ -146,67 +193,80 @@ const H5P_libclass_t H5P_CLS_FCRT[1] = {{ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass) { - hsize_t userblock_size = H5F_CRT_USER_BLOCK_DEF; /* Default userblock size */ - unsigned sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; /* Default size for symbol table leaf nodes */ - unsigned btree_k[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; /* Default 'K' values for B-trees in file */ - uint8_t sizeof_addr = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */ - uint8_t sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */ - unsigned superblock_ver = H5F_CRT_SUPER_VERS_DEF; /* Default superblock version # */ - unsigned num_sohm_indexes = H5F_CRT_SHMSG_NINDEXES_DEF; - unsigned sohm_index_flags[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF; - unsigned sohm_index_minsizes[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF; - unsigned sohm_list_max = H5F_CRT_SHMSG_LIST_MAX_DEF; - unsigned sohm_btree_min = H5F_CRT_SHMSG_BTREE_MIN_DEF; - unsigned file_space_strategy = H5F_CRT_FILE_SPACE_STRATEGY_DEF; - hsize_t free_space_threshold = H5F_CRT_FREE_SPACE_THRESHOLD_DEF; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Register the user block size */ - if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &userblock_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, + NULL, NULL, NULL, H5F_CRT_USER_BLOCK_ENC, H5F_CRT_USER_BLOCK_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for symbol table leaf nodes */ - if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g, + NULL, NULL, NULL, H5F_CRT_SYM_LEAF_ENC, H5F_CRT_SYM_LEAF_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for btree internal nodes */ - if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, btree_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g, + NULL, NULL, NULL, H5F_CRT_BTREE_RANK_ENC, H5F_CRT_BTREE_RANK_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for an address */ - if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g, + NULL, NULL, NULL, H5F_CRT_ADDR_BYTE_NUM_ENC, H5F_CRT_ADDR_BYTE_NUM_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for object size */ - if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &sizeof_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g, + NULL, NULL, NULL, H5F_CRT_OBJ_BYTE_NUM_ENC, H5F_CRT_OBJ_BYTE_NUM_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the superblock version number */ - if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &superblock_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH message information */ - if(H5P_register_real(pclass,H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &num_sohm_indexes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g, + NULL, NULL, NULL, H5F_CRT_SHMSG_NINDEXES_ENC, H5F_CRT_SHMSG_NINDEXES_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &sohm_index_flags,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g, + NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_TYPES_ENC, H5F_CRT_SHMSG_INDEX_TYPES_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &sohm_index_minsizes,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g, + NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_MINSIZE_ENC, H5F_CRT_SHMSG_INDEX_MINSIZE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH cutoff size information */ - if(H5P_register_real(pclass,H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &sohm_list_max,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g, + NULL, NULL, NULL, H5F_CRT_SHMSG_LIST_MAX_ENC, H5F_CRT_SHMSG_LIST_MAX_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass,H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &sohm_btree_min,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) + if(H5P_register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g, + NULL, NULL, NULL, H5F_CRT_SHMSG_BTREE_MIN_ENC, H5F_CRT_SHMSG_BTREE_MIN_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file space handling strategy */ - if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &file_space_strategy, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g, + NULL, NULL, NULL, H5F_CRT_FILE_SPACE_STRATEGY_ENC, H5F_CRT_FILE_SPACE_STRATEGY_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the free space section threshold */ - if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &free_space_threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g, + NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -615,6 +675,97 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__fcrt_btree_rank_enc + * + * Purpose: Callback routine which is called whenever the index storage + * btree in file creation property list is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 7, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size) +{ + const unsigned *btree_k = (const unsigned *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(btree_k); + HDassert(size); + + if(NULL != *pp) { + unsigned u; /* Local index variable */ + + /* Encode the size of an unsigned*/ + *(*pp)++ = (uint8_t)sizeof(unsigned); + + /* Encode all the btree */ + for(u = 0 ; u < H5B_NUM_BTREE_ID; u++) { + /* Encode the left split value */ + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)btree_k) + btree_k++; + } /* end for */ + } /* end if */ + + /* Size of type flags values */ + *size += 1 + (H5B_NUM_BTREE_ID * sizeof(unsigned)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__fcrt_btree_rank_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__fcrt_btree_rank_dec + * + * Purpose: Callback routine which is called whenever the index storage + * btree in file creation property list is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 7, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fcrt_btree_rank_dec(const void **_pp, void *_value) +{ + unsigned *btree_k = (unsigned *)_value; + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(btree_k); + + /* Decode the size */ + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + + /* Decode all the type flags */ + for(u = 0 ; u < H5B_NUM_BTREE_ID; u++) + H5_DECODE_UNSIGNED(*pp, btree_k[u]) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__fcrt_btree_rank_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_shared_mesg_nindexes * * Purpose: Set the number of Shared Object Header Message (SOHM) @@ -814,6 +965,192 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__fcrt_shmsg_index_types_enc + * + * Purpose: Callback routine which is called whenever the shared + * message indec types in file creation property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 7, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size) +{ + const unsigned *type_flags = (const unsigned *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(type_flags); + HDassert(size); + + if(NULL != *pp) { + unsigned u; /* Local index variable */ + + /* Encode the size of a double*/ + *(*pp)++ = (uint8_t)sizeof(unsigned); + + /* Encode all the type flags */ + for(u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) { + /* Encode the left split value */ + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)type_flags) + type_flags++; + } /* end for */ + } /* end if */ + + /* Size of type flags values */ + *size += 1 + (H5O_SHMESG_MAX_NINDEXES * sizeof(unsigned)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__fcrt_shmsg_index_types_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__fcrt_shmsg_index_types_dec + * + * Purpose: Callback routine which is called whenever the shared + * message indec types in file creation property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 7, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *_value) +{ + unsigned *type_flags = (unsigned *)_value; + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(type_flags); + + /* Decode the size */ + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + + /* Decode all the type flags */ + for(u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) + H5_DECODE_UNSIGNED(*pp, type_flags[u]) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__fcrt_shmsg_index_types_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__fcrt_shmsg_index_minsize_enc + * + * Purpose: Callback routine which is called whenever the shared + * message index minsize in file creation property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 7, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size) +{ + const unsigned *minsizes = (const unsigned *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(minsizes); + HDassert(size); + + if(NULL != *pp) { + unsigned u; /* Local index variable */ + + /* Encode the size of a double*/ + *(*pp)++ = (uint8_t)sizeof(unsigned); + + /* Encode all the minsize values */ + for(u = 0 ; u < H5O_SHMESG_MAX_NINDEXES; u++) { + /* Encode the left split value */ + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)minsizes) + minsizes++; + } /* end for */ + } /* end if */ + + /* Size of type flags values */ + *size += 1 + (H5O_SHMESG_MAX_NINDEXES * sizeof(unsigned)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__fcrt_shmsg_index_minsize_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__fcrt_shmsg_index_minsize_dec + * + * Purpose: Callback routine which is called whenever the shared + * message indec minsize in file creation property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 7, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *_value) +{ + unsigned *minsizes = (unsigned *)_value; + const uint8_t **pp = (const uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(minsizes); + + /* Decode the size */ + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + + /* Decode all the minsize values */ + for(u = 0 ; u < H5O_SHMESG_MAX_NINDEXES; u++) + H5_DECODE_UNSIGNED(*pp, minsizes[u]) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__fcrt_shmsg_index_minsize_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_shared_mesg_phase_change * * Purpose: Sets the cutoff values for indexes storing shared object diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index 0158bf1..1c4d3f4 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -93,6 +93,14 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{ /*****************************/ +/*******************/ +/* Local Variables */ +/*******************/ + +/* Property value defaults */ +static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlinks are local to file */ + + /*------------------------------------------------------------------------- * Function: H5P_fmnt_reg_prop @@ -108,14 +116,14 @@ const H5P_libclass_t H5P_CLS_FMNT[1] = {{ static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass) { - hbool_t local = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlinks are local to file */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Register property of whether symlinks is local to file */ - if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &local, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 394cf8b..0210700 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -42,6 +42,12 @@ /* Local Macros */ /****************/ +/* ========= Group Creation properties ============ */ +#define H5G_CRT_GROUP_INFO_ENC H5P__gcrt_group_info_enc +#define H5G_CRT_GROUP_INFO_DEC H5P__gcrt_group_info_dec +#define H5G_CRT_LINK_INFO_ENC H5P__gcrt_link_info_enc +#define H5G_CRT_LINK_INFO_DEC H5P__gcrt_link_info_dec + /******************/ /* Local Typedefs */ @@ -60,6 +66,12 @@ /* Property class callbacks */ static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass); +/* Property callbacks */ +static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__gcrt_group_info_dec(const void **_pp, void *value); +static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__gcrt_link_info_dec(const void **_pp, void *value); + /*********************/ /* Package Variables */ @@ -91,6 +103,10 @@ const H5P_libclass_t H5P_CLS_GCRT[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const H5O_ginfo_t H5G_def_ginfo_g = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */ +static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Default link info settings */ + /*------------------------------------------------------------------------- @@ -107,18 +123,20 @@ const H5P_libclass_t H5P_CLS_GCRT[1] = {{ static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass) { - H5O_ginfo_t ginfo = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */ - H5O_linfo_t linfo = H5G_CRT_LINK_INFO_DEF; /* Default link info settings */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register group info property */ - if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &ginfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, + NULL, NULL, NULL, H5G_CRT_GROUP_INFO_ENC, H5G_CRT_GROUP_INFO_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register link info property */ - if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &linfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, + NULL, NULL, NULL, H5G_CRT_LINK_INFO_ENC, H5G_CRT_LINK_INFO_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -506,3 +524,176 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_link_creation_order() */ + +/*------------------------------------------------------------------------- + * Function: H5P__gcrt_group_info_enc + * + * Purpose: Callback routine which is called whenever the group + * property in the dataset access property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size) +{ + const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)value; /* Create local aliases for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + if(NULL != *pp) { + UINT32ENCODE(*pp, ginfo->lheap_size_hint) + UINT16ENCODE(*pp, ginfo->max_compact) + UINT16ENCODE(*pp, ginfo->min_dense) + UINT16ENCODE(*pp, ginfo->est_num_entries) + UINT16ENCODE(*pp, ginfo->est_name_len) + } /* end if */ + + *size += sizeof(uint16_t) * 4 + sizeof(uint32_t); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__gcrt_group_info_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__gcrt_group_info_dec + * + * Purpose: Callback routine which is called whenever the group info + * property in the dataset access property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__gcrt_group_info_dec(const void **_pp, void *_value) +{ + H5O_ginfo_t *ginfo = (H5O_ginfo_t *)_value; /* Group info settings */ + const uint8_t **pp = (const uint8_t **)_pp; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Set property to default value */ + *ginfo = H5G_def_ginfo_g; + + UINT32DECODE(*pp, ginfo->lheap_size_hint) + UINT16DECODE(*pp, ginfo->max_compact) + UINT16DECODE(*pp, ginfo->min_dense) + UINT16DECODE(*pp, ginfo->est_num_entries) + UINT16DECODE(*pp, ginfo->est_name_len) + + /* Update fields */ + if(ginfo->max_compact != H5G_CRT_GINFO_MAX_COMPACT || + ginfo->min_dense != H5G_CRT_GINFO_MIN_DENSE) + ginfo->store_link_phase_change = TRUE; + else + ginfo->store_link_phase_change = FALSE; + + if(ginfo->est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES || + ginfo->est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) + ginfo->store_est_entry_info = TRUE; + else + ginfo->store_est_entry_info = FALSE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__gcrt_group_info_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__gcrt_link_info_enc + * + * Purpose: Callback routine which is called whenever the link + * property in the dataset access property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size) +{ + const H5O_linfo_t *linfo = (const H5O_linfo_t *)value; /* Create local aliases for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + if(NULL != *pp) { + unsigned crt_order_flags = 0; + + crt_order_flags |= linfo->track_corder ? H5P_CRT_ORDER_TRACKED : 0; + crt_order_flags |= linfo->index_corder ? H5P_CRT_ORDER_INDEXED : 0; + + /* Encode the size of unsigned*/ + *(*pp)++ = (uint8_t)sizeof(unsigned); + + /* Encode the value */ + H5_ENCODE_UNSIGNED(*pp, crt_order_flags) + } /* end if */ + + *size += (1 + sizeof(unsigned)); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__gcrt_link_info_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__gcrt_link_info_dec + * + * Purpose: Callback routine which is called whenever the link info + * property in the dataset access property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__gcrt_link_info_dec(const void **_pp, void *_value) +{ + H5O_linfo_t *linfo = (H5O_linfo_t *)_value; /* Link info settings */ + const uint8_t **pp = (const uint8_t **)_pp; + unsigned crt_order_flags; + unsigned enc_size; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + + /* Set property to default value */ + *linfo = H5G_def_linfo_g; + + H5_DECODE_UNSIGNED(*pp, crt_order_flags) + + /* Update fields */ + linfo->track_corder = (hbool_t)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? TRUE : FALSE); + linfo->index_corder = (hbool_t)((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? TRUE : FALSE); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__gcrt_link_info_dec() */ + diff --git a/src/H5Pint.c b/src/H5Pint.c index 57fe001..88c3247 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -970,7 +970,7 @@ done: Internal routine to create a new property USAGE H5P_genprop_t *H5P_create_prop(name,size,type,value,prp_create,prp_set, - prp_get,prp_delete,prp_close) + prp_get,prp_delete,prp_close, prp_encode, prp_decode) const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes H5P_prop_within_t type; IN: Type of object the property will be inserted into @@ -979,6 +979,8 @@ done: creation callback H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback + H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode + H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback @@ -996,9 +998,10 @@ done: --------------------------------------------------------------------------*/ static H5P_genprop_t * H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, - const void *value, - H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + const void *value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { @@ -1034,6 +1037,8 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, prop->create = prp_create; prop->set = prp_set; prop->get = prp_get; + prop->encode = prp_encode; + prop->decode = prp_decode; prop->del = prp_delete; prop->copy = prp_copy; /* Use custom comparison routine if available, otherwise default to memcmp() */ @@ -1782,7 +1787,8 @@ done: PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register_real(class, name, size, default, prp_create, prp_set, prp_get, prp_close) + herr_t H5P_register_real(class, name, size, default, prp_create, prp_set, + prp_get, prp_close, prp_encode, prp_decode) H5P_genclass_t *class; IN: Property list class to modify const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes @@ -1792,6 +1798,8 @@ done: creation callback H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback + H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode + H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback @@ -1911,6 +1919,33 @@ done: 'close' routine returns a negative value, the property list close routine returns an error value but the property list is still closed. + The 'encode' callback is called when a property list with this + property is being encoded. H5P_prp_encode_func_t is defined as: + typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size, + void *value, void *plist, uint8_t **buf); + where the parameters to the callback function are: + void *f; IN: A fake file structure used to encode. + size_t *size; IN/OUT: The size of the buffer to encode the property. + void *value; IN: The value of the property being encoded. + void *plist; IN: The property list structure. + uint8_t **buf; OUT: The buffer that holds the encoded property; + The 'encode' routine returns the size needed to encode the property value + if the buffer passed in is NULL or the size is zero. Otherwise it encodes + the property value into binary in buf. + + The 'decode' callback is called when a property list with this + property is being decoded. H5P_prp_encode_func_t is defined as: + typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size, + void *value, void *plist, uint8_t **buf); + where the parameters to the callback function are: + void *f; IN: A fake file structure used to decode. + size_t *size; IN: UNUSED + void *value; IN: UNUSED + void *plist; IN: The property list structure. + uint8_t **buf; IN: The buffer that holds the binary encoded property; + The 'decode' routine decodes the binary buffer passed in and transforms it into + corresponding property values that are set in the property list passed in. + GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS The 'set' callback function may be useful to range check the value being @@ -1932,8 +1967,10 @@ done: --------------------------------------------------------------------------*/ herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, - const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + const void *def_value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { @@ -1953,7 +1990,9 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close))) + if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS, + def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode, + prp_delete, prp_copy, prp_cmp, prp_close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") /* Insert property into property list class */ @@ -1991,6 +2030,8 @@ done: creation callback H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback + H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode + H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback @@ -2056,6 +2097,33 @@ done: negative value, the property value is returned and the property list get routine returns an error value. + The 'encode' callback is called when a property list with this + property is being encoded. H5P_prp_encode_func_t is defined as: + typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size, + void *value, void *plist, uint8_t **buf); + where the parameters to the callback function are: + void *f; IN: A fake file structure used to encode. + size_t *size; IN/OUT: The size of the buffer to encode the property. + void *value; IN: The value of the property being encoded. + void *plist; IN: The property list structure. + uint8_t **buf; OUT: The buffer that holds the encoded property; + The 'encode' routine returns the size needed to encode the property value + if the buffer passed in is NULL or the size is zero. Otherwise it encodes + the property value into binary in buf. + + The 'decode' callback is called when a property list with this + property is being decoded. H5P_prp_encode_func_t is defined as: + typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size, + void *value, void *plist, uint8_t **buf); + where the parameters to the callback function are: + void *f; IN: A fake file structure used to decode. + size_t *size; IN: UNUSED + void *value; IN: UNUSED + void *plist; IN: The property list structure. + uint8_t **buf; IN: The buffer that holds the binary encoded property; + The 'decode' routine decodes the binary buffer passed in and transforms it into + corresponding property values that are set in the property list passed in. + The 'delete' callback is called when a property is deleted from a property list. H5P_prp_del_func_t is defined as: typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name, @@ -2131,8 +2199,10 @@ done: --------------------------------------------------------------------------*/ herr_t H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, - const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + const void *def_value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { @@ -2186,7 +2256,8 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, } /* end if */ /* Really register the property in the class */ - if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close) < 0) + if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, + prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property") /* Update pointer to pointer to class, if a new one was generated */ @@ -2208,13 +2279,16 @@ done: PURPOSE Internal routine to insert a new property in a property list. USAGE - herr_t H5P_insert(plist, name, size, value, prp_set, prp_get, prp_close) + herr_t H5P_insert(plist, name, size, value, prp_set, prp_get, prp_close, + prp_encode, prp_decode) H5P_genplist_t *plist; IN: Property list to add property to const char *name; IN: Name of property to add size_t size; IN: Size of property in bytes void *value; IN: Pointer to the value for the property H5P_prp_set_func_t prp_set; IN: Function pointer to property set callback H5P_prp_get_func_t prp_get; IN: Function pointer to property get callback + H5P_prp_encode_func_t prp_encode; IN: Function pointer to property encode + H5P_prp_decode_func_t prp_decode; IN: Function pointer to property decode H5P_prp_delete_func_t prp_delete; IN: Function pointer to property delete callback H5P_prp_copy_func_t prp_copy; IN: Function pointer to property copy callback H5P_prp_compare_func_t prp_cmp; IN: Function pointer to property compare callback @@ -2264,6 +2338,33 @@ done: negative value, the property value is returned and the property list get routine returns an error value. + The 'encode' callback is called when a property list with this + property is being encoded. H5P_prp_encode_func_t is defined as: + typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size, + void *value, void *plist, uint8_t **buf); + where the parameters to the callback function are: + void *f; IN: A fake file structure used to encode. + size_t *size; IN/OUT: The size of the buffer to encode the property. + void *value; IN: The value of the property being encoded. + void *plist; IN: The property list structure. + uint8_t **buf; OUT: The buffer that holds the encoded property; + The 'encode' routine returns the size needed to encode the property value + if the buffer passed in is NULL or the size is zero. Otherwise it encodes + the property value into binary in buf. + + The 'decode' callback is called when a property list with this + property is being decoded. H5P_prp_encode_func_t is defined as: + typedef herr_t (*H5P_prp_encode_func_t)(void *f, size_t *size, + void *value, void *plist, uint8_t **buf); + where the parameters to the callback function are: + void *f; IN: A fake file structure used to decode. + size_t *size; IN: UNUSED + void *value; IN: UNUSED + void *plist; IN: The property list structure. + uint8_t **buf; IN: The buffer that holds the binary encoded property; + The 'decode' routine decodes the binary buffer passed in and transforms it into + corresponding property values that are set in the property list passed in. + The 'delete' callback is called when a property is deleted from a property list. H5P_prp_del_func_t is defined as: typedef herr_t (*H5P_prp_del_func_t)(hid_t prop_id, const char *name, @@ -2344,6 +2445,7 @@ done: herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { @@ -2391,7 +2493,9 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, /* Ok to add to property list */ /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, prp_set, prp_get, prp_delete, prp_copy, prp_cmp, prp_close))) + if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, + prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, + prp_cmp, prp_close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property") /* Insert property into property list class */ @@ -2950,6 +3054,16 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) if(prop1->get != NULL && prop2->get == NULL) HGOTO_DONE(1); if(prop1->get != prop2->get) HGOTO_DONE(-1); + /* Check if they both have the same 'encode' callback */ + if(prop1->encode == NULL && prop2->encode != NULL) HGOTO_DONE(-1); + if(prop1->encode != NULL && prop2->encode == NULL) HGOTO_DONE(1); + if(prop1->encode != prop2->encode) HGOTO_DONE(-1); + + /* Check if they both have the same 'decode' callback */ + if(prop1->decode == NULL && prop2->decode != NULL) HGOTO_DONE(-1); + if(prop1->decode != NULL && prop2->decode == NULL) HGOTO_DONE(1); + if(prop1->decode != prop2->decode) HGOTO_DONE(-1); + /* Check if they both have the same 'delete' callback */ if(prop1->del == NULL && prop2->del != NULL) HGOTO_DONE(-1); if(prop1->del != NULL && prop2->del == NULL) HGOTO_DONE(1); @@ -4270,7 +4384,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) /* Create property object from parameters */ if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, - prop->create, prop->set, prop->get, + prop->create, prop->set, prop->get, prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") @@ -4362,7 +4476,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) /* Register the property into the destination */ orig_dst_pclass = dst_pclass; if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, - prop->del, prop->copy, prop->cmp, prop->close) < 0) + prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") /* Check if the property class changed and needs to be substituted in the ID */ @@ -4871,3 +4985,121 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5P_close_class() */ + +/*------------------------------------------------------------------------- + * Function: H5P__new_plist_of_type + * + * Purpose: Create a new property list, of a given type + * + * Return: Success: ID of new property list + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, August 2, 2012 + * + *------------------------------------------------------------------------- + */ +hid_t +H5P__new_plist_of_type(H5P_plist_type_t type) +{ + H5P_genclass_t *pclass; /* Class of property list to create */ + hid_t class_id; /* ID of class to create */ + hid_t ret_value; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + HDcompile_assert(H5P_TYPE_LINK_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); + + /* Check arguments */ + if(type == H5P_TYPE_USER) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't create user property list"); + if(type == H5P_TYPE_ROOT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "shouldn't be creating root class property list"); + + /* Instantiate a property list of the proper type */ + switch(type) { + case H5P_TYPE_OBJECT_CREATE: + class_id = H5P_CLS_OBJECT_CREATE_g; + break; + + case H5P_TYPE_FILE_CREATE: + class_id = H5P_CLS_FILE_CREATE_g; + break; + + case H5P_TYPE_FILE_ACCESS: + class_id = H5P_CLS_FILE_ACCESS_g; + break; + + case H5P_TYPE_DATASET_CREATE: + class_id = H5P_CLS_DATASET_CREATE_g; + break; + + case H5P_TYPE_DATASET_ACCESS: + class_id = H5P_CLS_DATASET_ACCESS_g; + break; + + case H5P_TYPE_DATASET_XFER: + class_id = H5P_CLS_DATASET_XFER_g; + break; + + case H5P_TYPE_FILE_MOUNT: + class_id = H5P_CLS_FILE_MOUNT_g; + break; + + case H5P_TYPE_GROUP_CREATE: + class_id = H5P_CLS_GROUP_CREATE_g; + break; + + case H5P_TYPE_GROUP_ACCESS: + class_id = H5P_CLS_GROUP_ACCESS_g; + break; + + case H5P_TYPE_DATATYPE_CREATE: + class_id = H5P_CLS_DATATYPE_CREATE_g; + break; + + case H5P_TYPE_DATATYPE_ACCESS: + class_id = H5P_CLS_DATATYPE_ACCESS_g; + break; + + case H5P_TYPE_STRING_CREATE: + class_id = H5P_CLS_STRING_CREATE_g; + break; + + case H5P_TYPE_ATTRIBUTE_CREATE: + class_id = H5P_CLS_ATTRIBUTE_CREATE_g; + break; + + case H5P_TYPE_OBJECT_COPY: + class_id = H5P_CLS_OBJECT_COPY_g; + break; + + case H5P_TYPE_LINK_CREATE: + class_id = H5P_CLS_LINK_CREATE_g; + break; + + case H5P_TYPE_LINK_ACCESS: + class_id = H5P_CLS_LINK_ACCESS_g; + break; + + case H5P_TYPE_USER: /* shut compiler warnings up */ + case H5P_TYPE_ROOT: + case H5P_TYPE_MAX_TYPE: + default: + HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid property list type: %u\n", (unsigned)type); + } /* end switch */ + + /* Get the class object */ + if(NULL == (pclass = (H5P_genclass_t *)H5I_object(class_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class") + + /* Create the new property list */ + if((ret_value = H5P_create_id(pclass, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__new_plist_of_type() */ + diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 0697130..aa02546 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -48,10 +48,15 @@ /* Definitions for number of soft links to traverse */ #define H5L_ACS_NLINKS_SIZE sizeof(size_t) #define H5L_ACS_NLINKS_DEF H5L_NUM_LINKS /*max symlinks to follow per lookup */ +#define H5L_ACS_NLINKS_ENC H5P__encode_size_t +#define H5L_ACS_NLINKS_DEC H5P__decode_size_t + /* Definitions for external link prefix */ #define H5L_ACS_ELINK_PREFIX_SIZE sizeof(char *) #define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */ +#define H5L_ACS_ELINK_PREFIX_ENC H5P_lacc_elink_pref_enc +#define H5L_ACS_ELINK_PREFIX_DEC H5P_lacc_elink_pref_dec #define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del #define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy #define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp @@ -60,6 +65,8 @@ /* Definitions for setting fapl of external link access */ #define H5L_ACS_ELINK_FAPL_SIZE sizeof(hid_t) #define H5L_ACS_ELINK_FAPL_DEF H5P_DEFAULT +#define H5L_ACS_ELINK_FAPL_ENC H5P_lacc_elink_fapl_enc +#define H5L_ACS_ELINK_FAPL_DEC H5P_lacc_elink_fapl_dec #define H5L_ACS_ELINK_FAPL_DEL H5P_lacc_elink_fapl_del #define H5L_ACS_ELINK_FAPL_COPY H5P_lacc_elink_fapl_copy #define H5L_ACS_ELINK_FAPL_CMP H5P_lacc_elink_fapl_cmp @@ -68,6 +75,8 @@ /* Definitions for file access flags for external link traversal */ #define H5L_ACS_ELINK_FLAGS_SIZE sizeof(unsigned) #define H5L_ACS_ELINK_FLAGS_DEF H5F_ACC_DEFAULT +#define H5L_ACS_ELINK_FLAGS_ENC H5P__encode_unsigned +#define H5L_ACS_ELINK_FLAGS_DEC H5P__decode_unsigned /* Definitions for callback function for external link traversal */ #define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t) @@ -92,10 +101,14 @@ static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ +static herr_t H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P_lacc_elink_pref_dec(const void **_pp, void *value); static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value); static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value); +static herr_t H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P_lacc_elink_fapl_dec(const void **_pp, void *value); static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value); static int H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t size); @@ -132,6 +145,13 @@ const H5P_libclass_t H5P_CLS_LACC[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const size_t H5L_def_nlinks_g = H5L_ACS_NLINKS_DEF; /* Default number of soft links to traverse */ +static const char *H5L_def_elink_prefix_g = H5L_ACS_ELINK_PREFIX_DEF; /* Default external link prefix string */ +static const hid_t H5L_def_fapl_id_g = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */ +static const unsigned H5L_def_elink_flags_g = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */ +static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */ + /*------------------------------------------------------------------------- @@ -153,34 +173,38 @@ const H5P_libclass_t H5P_CLS_LACC[1] = {{ static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass) { - size_t nlinks = H5L_ACS_NLINKS_DEF; /* Default number of soft links to traverse */ - char *elink_prefix = H5L_ACS_ELINK_PREFIX_DEF; /* Default external link prefix string */ - hid_t def_fapl_id = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */ - unsigned elink_flags = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */ - H5L_elink_cb_t elink_cb = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */ - herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Register property for number of links traversed */ - if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &nlinks, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, + NULL, NULL, NULL, H5L_ACS_NLINKS_ENC, H5L_ACS_NLINKS_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link prefix */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, + NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, + H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &def_fapl_id, NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, + NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, + H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file access flags */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &elink_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g, + NULL, NULL, NULL, H5L_ACS_ELINK_FLAGS_ENC, H5L_ACS_ELINK_FLAGS_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file traversal callback */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &elink_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -188,6 +212,120 @@ done: } /* end H5P_lacc_reg_prop() */ +/*------------------------------------------------------------------------- + * Function: H5P_lacc_elink_fapl_enc + * + * Purpose: Callback routine which is called whenever the elink FAPL + * property in the dataset access property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) +{ + const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ + uint8_t **pp = (uint8_t **)_pp; + H5P_genplist_t *fapl_plist; /* Pointer to property list */ + hbool_t non_default_fapl = FALSE; /* Whether the FAPL is non-default */ + size_t enc_size = 0; /* FAPL's encoded size */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check for non-default FAPL */ + if(*elink_fapl != H5P_DEFAULT) { + if(NULL == (fapl_plist = (H5P_genplist_t *)H5P_object_verify(*elink_fapl, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list") + non_default_fapl = TRUE; + } /* end if */ + + if(NULL != *pp) { + /* Store whether the FAPL is non-default */ + *(*pp)++ = (uint8_t)non_default_fapl; + } /* end if */ + + /* Encode the property list, if non-default */ + /* (if *pp == NULL, will only compute the size) */ + if(non_default_fapl) { + if(H5P__encode(fapl_plist, TRUE, *pp, &enc_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") + if(*pp) + *pp += enc_size; + } /* end if */ + + *size += (1 + enc_size); /* Non-default flag, plus encoded property list size */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_lacc_elink_fapl_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_lacc_elink_fapl_dec + * + * Purpose: Callback routine which is called whenever the elink FAPL + * property in the dataset access property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_lacc_elink_fapl_dec(const void **_pp, void *_value) +{ + hid_t *elink_fapl = (hid_t *)_value; /* The elink FAPL value */ + const uint8_t **pp = (const uint8_t **)_pp; + hbool_t non_default_fapl; /* Whether the FAPL is non-default */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(pp); + HDassert(*pp); + HDassert(elink_fapl); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Determine if the FAPL is non-default */ + non_default_fapl = (hbool_t)*(*pp)++; + + if(non_default_fapl) { + H5P_genplist_t *fapl_plist; /* Pointer to property list */ + size_t enc_size = 0; /* Encoded size of property list */ + + /* Decode the property list */ + if((*elink_fapl = H5P__decode(*pp)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode property") + + /* Get the property list object */ + if(NULL == (fapl_plist = (H5P_genplist_t *)H5P_object_verify(*elink_fapl, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list") + + /* Compute the encoded size of the property list */ + if(H5P__encode(fapl_plist, TRUE, NULL, &enc_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't compute encoded property list size") + + *pp += enc_size; + } /* end if */ + else + *elink_fapl = H5P_DEFAULT; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_lacc_elink_fapl_dec() */ + + /*-------------------------------------------------------------------------- * Function: H5P_lacc_elink_fapl_del * @@ -344,6 +482,119 @@ done: /*------------------------------------------------------------------------- + * Function: H5P_lacc_elink_pref_enc + * + * Purpose: Callback routine which is called whenever the elink flags + * property in the dataset access property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) +{ + const char *elink_pref = *(const char * const *)value; + uint8_t **pp = (uint8_t **)_pp; + size_t len = 0; + uint64_t enc_value; + unsigned enc_size; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* calculate prefix length */ + if(NULL != elink_pref) + len = HDstrlen(elink_pref); + + enc_value = (uint64_t)len; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* encode the length of the prefix */ + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode the prefix */ + if(NULL != elink_pref) { + HDmemcpy(*(char **)pp, elink_pref, len); + *pp += len; + } /* end if */ + } /* end if */ + + *size += (1 + enc_size); + if(NULL != elink_pref) + *size += len; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P_lacc_elink_pref_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_lacc_elink_pref_dec + * + * Purpose: Callback routine which is called whenever the elink prefix + * property in the dataset access property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_lacc_elink_pref_dec(const void **_pp, void *_value) +{ + char **elink_pref = (char **)_value; + const uint8_t **pp = (const uint8_t **)_pp; + size_t len; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(pp); + HDassert(*pp); + HDassert(elink_pref); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + len = enc_value; + + if(0 != len) { + /* Make a copy of the user's prefix string */ + if(NULL == (*elink_pref = (char *)H5MM_malloc(len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HDstrncpy(*elink_pref, *(const char **)pp, len); + (*elink_pref)[len] = '\0'; + + *pp += len; + } /* end if */ + else + *elink_pref = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_lacc_elink_pref_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5P_lacc_elink_pref_del * * Purpose: Frees memory used to store the external link prefix string diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index b327df9..d81d55c 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -48,7 +48,8 @@ /* Definitions for create intermediate groups flag */ #define H5L_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned) #define H5L_CRT_INTERMEDIATE_GROUP_DEF 0 - +#define H5L_CRT_INTERMEDIATE_GROUP_ENC H5P__encode_unsigned +#define H5L_CRT_INTERMEDIATE_GROUP_DEC H5P__decode_unsigned /******************/ /* Local Typedefs */ @@ -98,6 +99,9 @@ const H5P_libclass_t H5P_CLS_LCRT[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; /* Default setting for creating intermediate groups */ + /*------------------------------------------------------------------------- @@ -114,13 +118,14 @@ const H5P_libclass_t H5P_CLS_LCRT[1] = {{ herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass) { - unsigned intmd_group = H5L_CRT_INTERMEDIATE_GROUP_DEF; /* Default setting for creating intermediate groups */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Register create intermediate groups property */ - if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, + NULL, NULL, NULL, H5L_CRT_INTERMEDIATE_GROUP_ENC, H5L_CRT_INTERMEDIATE_GROUP_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 5eba335..d8ddfee 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -37,6 +37,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Ppkg.h" /* Property lists */ @@ -48,12 +49,20 @@ /* ========= Object Creation properties ============ */ /* Definitions for the max. # of attributes to store compactly */ #define H5O_CRT_ATTR_MAX_COMPACT_SIZE sizeof(unsigned) +#define H5O_CRT_ATTR_MAX_COMPACT_ENC H5P__encode_unsigned +#define H5O_CRT_ATTR_MAX_COMPACT_DEC H5P__decode_unsigned /* Definitions for the min. # of attributes to store densely */ #define H5O_CRT_ATTR_MIN_DENSE_SIZE sizeof(unsigned) +#define H5O_CRT_ATTR_MIN_DENSE_ENC H5P__encode_unsigned +#define H5O_CRT_ATTR_MIN_DENSE_DEC H5P__decode_unsigned /* Definitions for object header flags */ #define H5O_CRT_OHDR_FLAGS_SIZE sizeof(uint8_t) +#define H5O_CRT_OHDR_FLAGS_ENC H5P__encode_uint8_t +#define H5O_CRT_OHDR_FLAGS_DEC H5P__decode_uint8_t /* Definitions for filter pipeline */ #define H5O_CRT_PIPELINE_SIZE sizeof(H5O_pline_t) +#define H5O_CRT_PIPELINE_ENC H5P__ocrt_pipeline_enc +#define H5O_CRT_PIPELINE_DEC H5P__ocrt_pipeline_dec #define H5O_CRT_PIPELINE_CMP H5P__ocrt_pipeline_cmp @@ -77,6 +86,8 @@ static herr_t H5P__ocrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_da static herr_t H5P__ocrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ +static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *value); static int H5P__ocrt_pipeline_cmp(const void *value1, const void *value2, size_t size); @@ -111,6 +122,12 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const unsigned H5O_def_attr_max_compact_g = H5O_CRT_ATTR_MAX_COMPACT_DEF; /* Default max. compact attribute storage settings */ +static const unsigned H5O_def_attr_min_dense_g = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */ +static const uint8_t H5O_def_ohdr_flags_g = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */ +static const H5O_pline_t H5O_def_pline_g = H5O_CRT_PIPELINE_DEF; /* Default I/O pipeline setting */ + /*------------------------------------------------------------------------- @@ -128,28 +145,32 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ static herr_t H5P__ocrt_reg_prop(H5P_genclass_t *pclass) { - unsigned attr_max_compact = H5O_CRT_ATTR_MAX_COMPACT_DEF; /* Default max. compact attribute storage settings */ - unsigned attr_min_dense = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */ - uint8_t ohdr_flags = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */ - H5O_pline_t pline = H5O_CRT_PIPELINE_DEF; /* Default I/O pipeline setting */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register max. compact attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, + NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register min. dense attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, + NULL, NULL, NULL, H5O_CRT_ATTR_MIN_DENSE_ENC, H5O_CRT_ATTR_MIN_DENSE_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object header flags property */ - if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, + NULL, NULL, NULL, H5O_CRT_OHDR_FLAGS_ENC, H5O_CRT_OHDR_FLAGS_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the pipeline property */ - if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, + NULL, NULL, NULL, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, + NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -1330,6 +1351,191 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, /*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_enc + * + * Purpose: Callback routine which is called whenever the pipeline + * property in the dataset access property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) +{ + const H5O_pline_t *pline = (const H5O_pline_t *)value; + uint8_t **pp = (uint8_t **)_pp; + size_t u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + HDassert(pline); + HDassert(size); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + if(NULL != *pp) { + unsigned enc_size; + uint64_t enc_value; + + /* Encode size of unsigned */ + *(*pp)++ = (uint8_t)sizeof(unsigned); + + /* encode nused value */ + enc_value = (uint64_t)pline->nused; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode each pipeline */ + for(u = 0; u < pline->nused; u++) { + unsigned v; /* Local index variable */ + + /* encode filter ID */ + INT32ENCODE(*pp, pline->filter[u].id) + + /* encode filter flags */ + H5_ENCODE_UNSIGNED(*pp, pline->filter[u].flags) + + /* encode filter name if it exists */ + if(NULL != pline->filter[u].name) { + /* encode TRUE indicating that it exits */ + *(*pp)++ = (uint8_t)TRUE; + + /* encode filter name */ + HDmemcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN); + *pp += H5Z_COMMON_NAME_LEN; + } /* end if */ + else + /* encode FALSE indicating that it does not exist */ + *(*pp)++ = (uint8_t)FALSE; + + /* encode cd_nelmts */ + enc_value = (uint64_t)pline->filter[u].cd_nelmts; + enc_size = H5V_limit_enc_size(enc_value); + HDassert(enc_size < 256); + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode all values */ + for(v = 0; v < pline->filter[u].cd_nelmts; v++) + H5_ENCODE_UNSIGNED(*pp, pline->filter[u].cd_values[v]) + } /* end for */ + } /* end if */ + + /* calculate size required for encoding */ + *size += 1; + *size += (1 + H5V_limit_enc_size((uint64_t)pline->nused)); + for(u = 0; u < pline->nused; u++) { + *size += (sizeof(int32_t) + sizeof(unsigned) + 1); + if(NULL != pline->filter[u].name) + *size += H5Z_COMMON_NAME_LEN; + *size += (1 + H5V_limit_enc_size((uint64_t)pline->filter[u].cd_nelmts)); + *size += pline->filter[u].cd_nelmts * sizeof(unsigned); + } /* end for */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__ocrt_pipeline_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_dec + * + * Purpose: Callback routine which is called whenever the pipeline + * property in the dataset access property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Monday, October 10, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_dec(const void **_pp, void *_value) +{ + H5O_pline_t *pline = (H5O_pline_t *)_value; /* Property to set */ + const uint8_t **pp = (const uint8_t **)_pp; + size_t nused; /* Number of filters used for pipeline */ + unsigned enc_size; /* Size of encoded value (in bytes) */ + uint64_t enc_value; /* Value to encode */ + size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Decode the size of size_t */ + enc_size = *(*pp)++; + if(enc_size != sizeof(unsigned)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + + /* decode nused */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + nused = (size_t)enc_value; + + /* Set property default value */ + *pline = H5O_def_pline_g; + + for(u = 0; u < nused; u++) { + H5Z_filter_info_t filter; /* Filter info, for pipeline */ + uint8_t has_name; /* Flag to indicate whether filter has a name */ + unsigned v; /* Local index variable */ + + /* decode filter id */ + INT32DECODE(*pp, filter.id) + + /* decode filter flags */ + H5_DECODE_UNSIGNED(*pp, filter.flags) + + /* decode value indicating if the name is encoded */ + has_name = *(*pp)++; + if(has_name) { + /* decode name */ + filter.name = H5MM_xstrdup((const char *)(*pp)); + *pp += H5Z_COMMON_NAME_LEN; + } /* end if */ + else + filter.name = NULL; + + /* decode num elements */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + UINT64DECODE_VAR(*pp, enc_value, enc_size); + filter.cd_nelmts = (size_t)enc_value; + + if(filter.cd_nelmts) { + if(NULL == (filter.cd_values = (unsigned *)H5MM_malloc(sizeof(unsigned) * filter.cd_nelmts))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for cd_values") + } /* end if */ + else + filter.cd_values = NULL; + + /* decode values */ + for(v = 0; v < filter.cd_nelmts; v++) + H5_DECODE_UNSIGNED(*pp, filter.cd_values[v]) + + /* Add the filter to the I/O pipeline */ + if(H5Z_append(pline, filter.id, filter.flags, filter.cd_nelmts, filter.cd_values) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__ocrt_pipeline_dec() */ + + +/*------------------------------------------------------------------------- * Function: H5P__ocrt_pipeline_cmp * * Purpose: Callback routine which is called whenever a filter pipeline diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 0ba5625..e5e5f51 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -49,9 +49,13 @@ /* Definitions for copy options */ #define H5O_CPY_OPTION_SIZE sizeof(unsigned) #define H5O_CPY_OPTION_DEF 0 +#define H5O_CPY_OPTION_ENC H5P__encode_unsigned +#define H5O_CPY_OPTION_DEC H5P__decode_unsigned /* Definitions for merge committed dtype list */ #define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(char *) #define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL +#define H5O_CPY_MERGE_COMM_DT_LIST_ENC H5P__ocpy_merge_comm_dt_list_enc +#define H5O_CPY_MERGE_COMM_DT_LIST_DEC H5P__ocpy_merge_comm_dt_list_dec #define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy #define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp #define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close @@ -81,6 +85,8 @@ static H5O_copy_dtype_merge_list_t *H5P__free_merge_comm_dtype_list(H5O_copy_dty static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ +static herr_t H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *value); static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char* name, size_t size, void* value); static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size, void* value); @@ -116,6 +122,11 @@ const H5P_libclass_t H5P_CLS_OCPY[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const unsigned H5O_def_ocpy_option_g = H5O_CPY_OPTION_DEF; /* Default object copy flags */ +static const H5O_copy_dtype_merge_list_t *H5O_def_merge_comm_dtype_list_g = H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */ +static const H5O_mcdt_cb_info_t H5O_def_mcdt_cb_g = H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at destination */ + /* Declare a free list to manage the H5O_copy_dtype_merge_list_t struct */ H5FL_DEFINE(H5O_copy_dtype_merge_list_t); @@ -135,23 +146,26 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t); static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass) { - unsigned ocpy_option = H5O_CPY_OPTION_DEF; /* Default object copy flags */ - H5O_copy_dtype_merge_list_t *merge_comm_dtype_list = H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */ - H5O_mcdt_cb_info_t mcdt_cb = H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at destination */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register copy options property */ - if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, + NULL, NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register merge named dtype list property */ - if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) + if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, + NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC, + NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ - if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &mcdt_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -189,6 +203,137 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) } /* H5P__free_merge_comm_dtype_list */ +/*------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_enc + * + * Purpose: Callback routine which is called whenever the common + * datatype property in the object copy property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size) +{ + const H5O_copy_dtype_merge_list_t * const *dt_list_ptr = (const H5O_copy_dtype_merge_list_t * const *)value; + uint8_t **pp = (uint8_t **)_pp; + const H5O_copy_dtype_merge_list_t *dt_list; /* Pointer to merge named datatype list */ + size_t len; /* Length of path component */ + + FUNC_ENTER_STATIC_NOERR + + HDassert(dt_list_ptr); + HDassert(size); + + /* Iterate over merge committed dtype list */ + dt_list = *dt_list_ptr; + while(dt_list) { + /* Get length of encoded path */ + len = HDstrlen(dt_list->path) + 1; + + /* Encode merge committed dtype list */ + if(*pp) { + HDmemcpy(*(char **)pp, dt_list->path, len); + *pp += len; + } /* end if */ + + /* Increment the size of the buffer */ + *size += len; + + /* Advance to the next node */ + dt_list = dt_list->next; + } /* end while */ + + /* Encode the terminator for the string sequence */ + if(*pp) + *(*pp)++ = (uint8_t)'\0'; + + /* Account for the string sequence terminator */ + *size += 1; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__ocpy_merge_comm_dt_list_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_dec + * + * Purpose: Callback routine which is called whenever the common + * datatype property in the dataset access property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) +{ + H5O_copy_dtype_merge_list_t **dt_list = (H5O_copy_dtype_merge_list_t **)_value; /* Pointer to merge named datatype list */ + const uint8_t **pp = (const uint8_t **)_pp; + H5O_copy_dtype_merge_list_t *dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */ + size_t len; /* Length of path component */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(pp); + HDassert(*pp); + HDassert(dt_list); + + /* Decode the string sequence */ + len = HDstrlen(*(const char **)pp); + while(len > 0) { + /* Create new node & duplicate string */ + if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + if(NULL == (tmp_dt_list->path = H5MM_strdup(*(const char **)pp))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + *pp += len + 1; + HDassert(len == HDstrlen(tmp_dt_list->path)); + + /* Add copied node to dtype list */ + if(dt_list_tail) { + dt_list_tail->next = tmp_dt_list; + dt_list_tail = tmp_dt_list; + } /* end if */ + else { + *dt_list = tmp_dt_list; + dt_list_tail = tmp_dt_list; + } /* end else */ + tmp_dt_list = NULL; + + /* Compute length of next string */ + len = HDstrlen(*(const char **)pp); + } /* end while */ + + /* Advance past terminator for string sequence */ + *pp += 1; + +done: + if(ret_value < 0) { + *dt_list = H5P__free_merge_comm_dtype_list(*dt_list); + if(tmp_dt_list) { + tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path); + tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__ocpy_merge_comm_dt_list_dec() */ + + /*-------------------------------------------------------------------------- * Function: H5P__ocpy_merge_comm_dt_list_copy * diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index c877d1b..835b766 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -75,6 +75,8 @@ typedef struct H5P_genprop_t { H5P_prp_create_func_t create; /* Function to call when a property is created */ H5P_prp_set_func_t set; /* Function to call when a property value is set */ H5P_prp_get_func_t get; /* Function to call when a property value is retrieved */ + H5P_prp_encode_func_t encode; /* Function to call when a property is encoded */ + H5P_prp_decode_func_t decode; /* Function to call when a property is decoded */ H5P_prp_delete_func_t del; /* Function to call when a property is deleted */ H5P_prp_copy_func_t copy; /* Function to call when a property is copied */ H5P_prp_compare_func_t cmp; /* Function to call when a property is compared */ @@ -159,13 +161,17 @@ H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, H5P_cls_close_func_t cls_close, void *close_data); H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass); H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, - const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + const void *def_value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t size, - const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, + const void *def_value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); @@ -195,6 +201,24 @@ H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name); +H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type); + +/* Encode/decode routines */ +H5_DLL herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, + void *buf, size_t *nalloc); +H5_DLL hid_t H5P__decode(const void *buf); +H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__decode_hsize_t(const void **_pp, void *value); +H5_DLL herr_t H5P__decode_size_t(const void **_pp, void *value); +H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value); +H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value); +H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value); +H5_DLL herr_t H5P__decode_double(const void **_pp, void *value); /* Testing functions */ #ifdef H5P_TESTING diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index c750070..6560064 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -84,6 +84,7 @@ H5_DLL herr_t H5P_get(const H5P_genplist_t *plist, const char *name, void *value H5_DLL herr_t H5P_set(H5P_genplist_t *plist, const char *name, const void *value); H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 1085d75..efcba65 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -113,6 +113,8 @@ typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, vo typedef H5P_prp_cb1_t H5P_prp_create_func_t; typedef H5P_prp_cb2_t H5P_prp_set_func_t; typedef H5P_prp_cb2_t H5P_prp_get_func_t; +typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size); +typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); typedef H5P_prp_cb2_t H5P_prp_delete_func_t; typedef H5P_prp_cb1_t H5P_prp_copy_func_t; typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); @@ -129,8 +131,7 @@ typedef enum H5D_mpio_actual_chunk_opt_mode_t { */ H5D_MPIO_NO_CHUNK_OPTIMIZATION = 0, H5D_MPIO_LINK_CHUNK, - H5D_MPIO_MULTI_CHUNK, - H5D_MPIO_MULTI_CHUNK_NO_OPT + H5D_MPIO_MULTI_CHUNK } H5D_mpio_actual_chunk_opt_mode_t; typedef enum H5D_mpio_actual_io_mode_t { @@ -229,6 +230,8 @@ H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, void *value); H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); +H5_DLL herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc); +H5_DLL hid_t H5Pdecode(const void *buf); H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size); H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops); H5_DLL hid_t H5Pget_class(hid_t plist_id); diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 505e35f..bedacb0 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -46,6 +46,8 @@ /* Definitions for character set encoding property */ #define H5P_STRCRT_CHAR_ENCODING_SIZE sizeof(H5T_cset_t) #define H5P_STRCRT_CHAR_ENCODING_DEF H5F_DEFAULT_CSET +#define H5P_STRCRT_CHAR_ENCODING_ENC H5P__strcrt_char_encoding_enc +#define H5P_STRCRT_CHAR_ENCODING_DEC H5P__strcrt_char_encoding_dec /******************/ @@ -65,6 +67,10 @@ /* Property class callbacks */ static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass); +/* encode & decode callbacks */ +static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__strcrt_char_encoding_dec(const void **_pp, void *value); + /*********************/ /* Package Variables */ @@ -96,6 +102,9 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const H5T_cset_t H5P_def_char_encoding_g = H5P_STRCRT_CHAR_ENCODING_DEF; /* Default character set encoding */ + /*------------------------------------------------------------------------- @@ -112,13 +121,14 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass) { - H5T_cset_t char_encoding = H5P_STRCRT_CHAR_ENCODING_DEF; /* Default character set encoding */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register character encoding */ - if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &char_encoding, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g, + NULL, NULL, NULL, H5P_STRCRT_CHAR_ENCODING_ENC, H5P_STRCRT_CHAR_ENCODING_DEC, + NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -196,3 +206,76 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_char_encoding() */ + +/*------------------------------------------------------------------------- + * Function: H5P__strcrt_char_encoding_enc + * + * Purpose: Callback routine which is called whenever the character + * set encoding property in the string create property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size) +{ + const H5T_cset_t *encoding = (const H5T_cset_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(encoding); + HDassert(size); + + if(NULL != *pp) + /* Encode character set encoding */ + *(*pp)++ = (uint8_t)*encoding; + + /* Size of character set encoding */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__strcrt_char_encoding_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__strcrt_char_encoding_dec + * + * Purpose: Callback routine which is called whenever the character + * set encoding property in the string create property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__strcrt_char_encoding_dec(const void **_pp, void *_value) +{ + H5T_cset_t *encoding = (H5T_cset_t *)_value; /* Character set encoding */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(encoding); + + /* Decode character set encoding */ + *encoding = (H5T_cset_t)*(*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__strcrt_char_encoding_dec() */ + diff --git a/src/H5T.c b/src/H5T.c index f6514f0..9006b49 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -292,8 +292,6 @@ static herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func, hid_t dxpl_id, hbool_t api_call); static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst); -static herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); -static H5T_t *H5T_decode(const unsigned char *buf); static herr_t H5T_set_size(H5T_t *dt, size_t size); @@ -1062,6 +1060,8 @@ H5T_init_interface(void) status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); @@ -2897,7 +2897,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) { size_t buf_size; /* Encoded size of datatype */ @@ -2954,7 +2954,7 @@ done: * *------------------------------------------------------------------------- */ -static H5T_t * +H5T_t * H5T_decode(const unsigned char *buf) { H5F_t *f = NULL; /* Fake file structure*/ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 983922f..5ecf864 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2889,6 +2889,86 @@ done: /*------------------------------------------------------------------------- + * Function: H5T__conv_enum_numeric + * + * Purpose: Converts enumerated data to a numeric type (integer or + * floating-point number). This function is registered into + * the conversion table twice in H5T_init_interface in H5T.c. + * Once for enum-integer conversion. Once for enum-float conversion. + * + * Return: Success: Non-negative + * + * Failure: negative + * + * Programmer: Raymond Lu + * 12 October 2012 + *------------------------------------------------------------------------- + */ +herr_t +H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t UNUSED bkg_stride, void *_buf, + void UNUSED *bkg, hid_t UNUSED dxpl_id) +{ + H5T_t *src, *dst; /*src and dst datatypes */ + H5T_t *src_parent; /*parent type for src */ + hid_t src_parent_id = -1; /*ID for parent of the source */ + H5T_path_t *tpath; /* Conversion information */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + switch(cdata->command) { + case H5T_CONV_INIT: + /* + * Determine if this conversion function applies to the conversion + * path SRC_ID->DST_ID. If not, return failure. + */ + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_ENUM != src->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "source type is not a H5T_ENUM datatype") + if(H5T_INTEGER != dst->shared->type && H5T_FLOAT != dst->shared->type) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "destination is not an integer type") + + cdata->need_bkg = H5T_BKG_NO; + break; + + case H5T_CONV_FREE: + break; + + case H5T_CONV_CONV: + if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + + src_parent = src->shared->parent; + + if(NULL == (tpath = H5T_path_find(src_parent, dst, NULL, NULL, dxpl_id, FALSE))) { + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") + } else if(!H5T_path_noop(tpath)) { + if((src_parent_id = H5I_register(H5I_DATATYPE, H5T_copy(src_parent, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + + /* Convert the data */ + if(H5T_convert(tpath, src_parent_id, dst_id, nelmts, buf_stride, bkg_stride, _buf, bkg, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + } + break; + + default: + /* Some other command we don't know about yet.*/ + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + } /* end switch */ + +done: + /* Release the temporary datatype IDs used */ + if(src_parent_id >= 0) + H5I_dec_ref(src_parent_id); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__conv_enum_numeric() */ + + +/*------------------------------------------------------------------------- * Function: H5T__conv_vlen * * Purpose: Converts between VL datatypes in memory and on disk. diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index b9364d6..8323e15 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -544,6 +544,10 @@ H5_DLL herr_t H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); +H5_DLL herr_t H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, + size_t nelmts, size_t buf_stride, + size_t bkg_stride, void *buf, void *bkg, + hid_t dset_xfer_plist); H5_DLL herr_t H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 345924c..558afaf 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -114,6 +114,8 @@ H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); H5_DLL size_t H5T_get_size(const H5T_t *dt); H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset); +H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); +H5_DLL H5T_t *H5T_decode(const unsigned char *buf); H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt); diff --git a/src/H5detect.c b/src/H5detect.c index 87a4fd5..d6f6a3b 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -120,7 +120,7 @@ static void print_results(int nd, detected_t *d, int na, malign_t *m); static void iprint(detected_t *); static int byte_cmp(int, const void *, const void *); static int bit_cmp(int, int *, volatile void *, volatile void *); -static void fix_order(int, int, int, int *, const char **); +static void fix_order(int, int, int *, const char **); static int imp_bit(int, int *, volatile void *, volatile void *); static unsigned long find_bias(int, int, int *, void *); static void precision (detected_t*); @@ -293,7 +293,7 @@ precision (detected_t *d) #define DETECT_F(TYPE,VAR,INFO) { \ volatile TYPE _v1, _v2, _v3; \ unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \ - int _i, _j, _first = (-1), _last = (-1); \ + int _i, _j, _last = (-1); \ char *_mesg; \ \ memset(&INFO, 0, sizeof(INFO)); \ @@ -315,15 +315,11 @@ precision (detected_t *d) memcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ _j = byte_cmp(sizeof(TYPE), &_buf3, &_buf1); \ if(_j >= 0) { \ - if(0 == _i || INFO.perm[_i - 1] != _j) { \ - INFO.perm[_i] = _j; \ - _last = _i; \ - if(_first < 0) \ - _first = _i; \ - } \ + INFO.perm[_i] = _j; \ + _last = _i; \ } \ } \ - fix_order(sizeof(TYPE), _first, _last, INFO.perm, (const char**)&_mesg); \ + fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \ \ if(!strcmp(_mesg, "VAX")) \ INFO.is_vax = TRUE; \ @@ -973,11 +969,11 @@ bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b) *------------------------------------------------------------------------- */ static void -fix_order(int n, int first, int last, int *perm, const char **mesg) +fix_order(int n, int last, int *perm, const char **mesg) { int i; - if (first + 1 < last) { + if (last > 1) { /* * We have at least three points to consider. */ @@ -998,6 +994,9 @@ fix_order(int n, int first, int last, int *perm, const char **mesg) } else { /* * Bi-endian machines like VAX. + * (NOTE: This is not an actual determination of the VAX-endianess. + * It could have some other endianess and fall into this + * case - JKM & QAK) */ assert(0 == n % 2); if (mesg) *mesg = "VAX"; diff --git a/src/H5err.txt b/src/H5err.txt index b4cb28b..ab3277f 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -48,7 +48,7 @@ MAJOR, H5E_ARGS, Invalid arguments to routine MAJOR, H5E_RESOURCE, Resource unavailable MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail) -MAJOR, H5E_FILE, File accessability +MAJOR, H5E_FILE, File accessibilty MAJOR, H5E_IO, Low-level I/O MAJOR, H5E_FUNC, Function entry/exit MAJOR, H5E_ATOM, Object atom @@ -81,7 +81,7 @@ MAJOR, H5E_NONE_MAJOR, No error # Sections (for grouping minor errors) SECTION, ARGS, Argument errors SECTION, RESOURCE, Resource errors -SECTION, FILEACC, File accessability errors +SECTION, FILEACC, File accessibilty errors SECTION, FILE, Generic low-level file I/O errors SECTION, FUNC, Function entry/exit interface errors SECTION, ATOM, Object atom related errors @@ -121,7 +121,7 @@ MINOR, RESOURCE, H5E_CANTGC, Unable to garbage collect MINOR, RESOURCE, H5E_CANTGETSIZE, Unable to compute size MINOR, RESOURCE, H5E_OBJOPEN, Object is already open -# File accessability errors +# File accessibilty errors MINOR, FILEACC, H5E_FILEEXISTS, File already exists MINOR, FILEACC, H5E_FILEOPEN, File already open MINOR, FILEACC, H5E_CANTCREATE, Unable to create file diff --git a/src/H5public.h b/src/H5public.h index fcba406..54cd0b6 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 131 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 137 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a5" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.131-FA_a5" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.137-FA_a5" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5trace.c b/src/H5trace.c index 2dab8ec..92736d4 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -612,10 +612,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "H5D_MPIO_MULTI_CHUNK"); break; - case H5D_MPIO_MULTI_CHUNK_NO_OPT: - fprintf(out, "H5D_MPIO_MULTI_CHUNK_NO_OPT"); - break; - default: fprintf(out, "%ld", (long)chunk_opt_mode); break; diff --git a/src/Makefile.am b/src/Makefile.am index c426581..4ec1015 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -90,7 +90,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Ostorage.c \ H5Otest.c H5Ounknown.c \ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ - H5Pdeprec.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ + H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ + H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ H5Pgcpl.c H5Pint.c \ H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ H5R.c H5Rdeprec.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 0b4f0b2..1393026 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -161,10 +161,10 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5Orefcount.lo H5Osdspace.lo H5Oshared.lo H5Oshmesg.lo \ H5Ostab.lo H5Ostorage.lo H5Otest.lo H5Ounknown.lo H5P.lo \ H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo \ - H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo \ - H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo \ - H5Ptest.lo H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo H5S.lo \ - H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \ + H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo \ + H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo \ + H5Pstrcpl.lo H5Ptest.lo H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo \ + H5S.lo H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \ H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo \ H5SMbtree2.lo H5SMcache.lo H5SMmessage.lo H5SMtest.lo H5ST.lo \ H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo \ @@ -525,7 +525,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 = 121 +LT_VERS_REVISION = 127 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) @@ -590,7 +590,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Ostorage.c \ H5Otest.c H5Ounknown.c \ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ - H5Pdeprec.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ + H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ + H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ H5Pgcpl.c H5Pint.c \ H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ H5R.c H5Rdeprec.c \ @@ -959,6 +960,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdcpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdeprec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdxpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pencdec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfapl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfcpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfmpl.Plo@am__quote@ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8e63326..5551fa3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -78,6 +78,47 @@ FOREACH (ref_file ${HDF5_REFERENCE_FILES}) ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES}) # -------------------------------------------------------------------- +# Copy test files from test/testfiles/plist_files dir to test dir +# -------------------------------------------------------------------- +SET (HDF5_REFERENCE_PLIST_FILES + acpl_be + acpl_le + dapl_be + dapl_le + dcpl_be + dcpl_le + dxpl_be + dxpl_le + fapl_be + fapl_le + fcpl_be + fcpl_le + gcpl_be + gcpl_le + lapl_be + lapl_le + lcpl_be + lcpl_le + ocpl_be + ocpl_le + ocpypl_be + ocpypl_le + strcpl_be + strcpl_le +) + +FOREACH (plistfile ${HDF5_REFERENCE_PLIST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${plistfile}") + #MESSAGE (STATUS " Copying ${plistfile} to ${dset}") + ADD_CUSTOM_COMMAND ( + TARGET ${HDF5_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest} + ) +ENDFOREACH (plistfile ${HDF5_REFERENCE_PLIST_FILES}) + +# -------------------------------------------------------------------- #-- Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- SET (HDF5_REFERENCE_TEST_FILES @@ -314,6 +355,8 @@ SET (H5_TESTS testmeta #links_env file_image + enc_dec_plist + enc_dec_plist_with_endianess ) FOREACH (test ${H5_TESTS}) @@ -638,6 +681,7 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) gen_specmetaread gen_sizes_lheap gen_file_image + gen_plist ) FOREACH (gen ${H5_GENERATORS}) diff --git a/test/Makefile.am b/test/Makefile.am index 244bb28..a522f9d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -41,7 +41,7 @@ TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ - set_extent ttsafe \ + set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ getname vfd ntypes dangle dtransform reserved cross_read \ freespace mf farray earray btree2 fheap file_image @@ -68,7 +68,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta links_ BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_idx gen_new_array \ gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \ gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \ - gen_sizes_lheap gen_file_image + gen_sizes_lheap gen_file_image gen_plist if BUILD_ALL_CONDITIONAL noinst_PROGRAMS=$(BUILD_ALL_PROGS) diff --git a/test/Makefile.in b/test/Makefile.in index 721bc87..13b07ba 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -115,11 +115,12 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \ mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \ app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ - ttsafe$(EXEEXT) getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) \ - dangle$(EXEEXT) dtransform$(EXEEXT) reserved$(EXEEXT) \ - cross_read$(EXEEXT) freespace$(EXEEXT) mf$(EXEEXT) \ - farray$(EXEEXT) earray$(EXEEXT) btree2$(EXEEXT) fheap$(EXEEXT) \ - file_image$(EXEEXT) + ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \ + enc_dec_plist_with_endianess$(EXEEXT) getname$(EXEEXT) \ + vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ + dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \ + freespace$(EXEEXT) mf$(EXEEXT) farray$(EXEEXT) earray$(EXEEXT) \ + btree2$(EXEEXT) fheap$(EXEEXT) file_image$(EXEEXT) am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \ gen_cross$(EXEEXT) gen_deflate$(EXEEXT) gen_filters$(EXEEXT) \ gen_idx$(EXEEXT) gen_new_array$(EXEEXT) gen_new_fill$(EXEEXT) \ @@ -128,7 +129,7 @@ am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \ gen_nullspace$(EXEEXT) gen_udlinks$(EXEEXT) \ space_overflow$(EXEEXT) gen_filespace$(EXEEXT) \ gen_specmetaread$(EXEEXT) gen_sizes_lheap$(EXEEXT) \ - gen_file_image$(EXEEXT) + gen_file_image$(EXEEXT) gen_plist$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) accum_SOURCES = accum.c accum_OBJECTS = accum.$(OBJEXT) @@ -198,6 +199,15 @@ efc_SOURCES = efc.c efc_OBJECTS = efc.$(OBJEXT) efc_LDADD = $(LDADD) efc_DEPENDENCIES = libh5test.la $(LIBHDF5) +enc_dec_plist_SOURCES = enc_dec_plist.c +enc_dec_plist_OBJECTS = enc_dec_plist.$(OBJEXT) +enc_dec_plist_LDADD = $(LDADD) +enc_dec_plist_DEPENDENCIES = libh5test.la $(LIBHDF5) +enc_dec_plist_with_endianess_SOURCES = enc_dec_plist_with_endianess.c +enc_dec_plist_with_endianess_OBJECTS = \ + enc_dec_plist_with_endianess.$(OBJEXT) +enc_dec_plist_with_endianess_LDADD = $(LDADD) +enc_dec_plist_with_endianess_DEPENDENCIES = libh5test.la $(LIBHDF5) enum_SOURCES = enum.c enum_OBJECTS = enum.$(OBJEXT) enum_LDADD = $(LDADD) @@ -314,6 +324,10 @@ gen_nullspace_SOURCES = gen_nullspace.c gen_nullspace_OBJECTS = gen_nullspace.$(OBJEXT) gen_nullspace_LDADD = $(LDADD) gen_nullspace_DEPENDENCIES = libh5test.la $(LIBHDF5) +gen_plist_SOURCES = gen_plist.c +gen_plist_OBJECTS = gen_plist.$(OBJEXT) +gen_plist_LDADD = $(LDADD) +gen_plist_DEPENDENCIES = libh5test.la $(LIBHDF5) gen_sizes_lheap_SOURCES = gen_sizes_lheap.c gen_sizes_lheap_OBJECTS = gen_sizes_lheap.$(OBJEXT) gen_sizes_lheap_LDADD = $(LDADD) @@ -501,40 +515,42 @@ am__v_CCLD_1 = SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \ cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \ - earray.c efc.c enum.c err_compat.c error_test.c extend.c \ - external.c farray.c fheap.c file_image.c fillval.c \ - filter_fail.c flush1.c flush2.c flushrefresh.c freespace.c \ - gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \ - gen_file_image.c gen_filespace.c gen_filters.c gen_idx.c \ - gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \ - gen_new_super.c gen_noencoder.c gen_nullspace.c \ - gen_sizes_lheap.c gen_specmetaread.c gen_udlinks.c getname.c \ - gheap.c hyperslab.c istore.c lheap.c links.c links_env.c mf.c \ - mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \ - set_extent.c space_overflow.c stab.c swmr_addrem_writer.c \ - swmr_generator.c swmr_reader.c swmr_remove_reader.c \ - swmr_remove_writer.c swmr_sparse_reader.c swmr_sparse_writer.c \ - swmr_writer.c tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ + earray.c efc.c enc_dec_plist.c enc_dec_plist_with_endianess.c \ + enum.c err_compat.c error_test.c extend.c external.c farray.c \ + fheap.c file_image.c fillval.c filter_fail.c flush1.c flush2.c \ + flushrefresh.c freespace.c gen_bad_ohdr.c gen_bogus.c \ + gen_cross.c gen_deflate.c gen_file_image.c gen_filespace.c \ + gen_filters.c gen_idx.c gen_new_array.c gen_new_fill.c \ + gen_new_group.c gen_new_mtime.c gen_new_super.c \ + gen_noencoder.c gen_nullspace.c gen_plist.c gen_sizes_lheap.c \ + gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \ + istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \ + ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \ + space_overflow.c stab.c swmr_addrem_writer.c swmr_generator.c \ + swmr_reader.c swmr_remove_reader.c swmr_remove_writer.c \ + swmr_sparse_reader.c swmr_sparse_writer.c swmr_writer.c \ + tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ $(ttsafe_SOURCES) unlink.c vfd.c DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \ bittests.c btree2.c cache.c cache_api.c cache_tagging.c \ cmpd_dset.c cross_read.c dangle.c dsets.c dt_arith.c \ - dtransform.c dtypes.c earray.c efc.c enum.c err_compat.c \ + dtransform.c dtypes.c earray.c efc.c enc_dec_plist.c \ + enc_dec_plist_with_endianess.c enum.c err_compat.c \ error_test.c extend.c external.c farray.c fheap.c file_image.c \ fillval.c filter_fail.c flush1.c flush2.c flushrefresh.c \ freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \ gen_deflate.c gen_file_image.c gen_filespace.c gen_filters.c \ gen_idx.c gen_new_array.c gen_new_fill.c gen_new_group.c \ gen_new_mtime.c gen_new_super.c gen_noencoder.c \ - gen_nullspace.c gen_sizes_lheap.c gen_specmetaread.c \ - gen_udlinks.c getname.c gheap.c hyperslab.c istore.c lheap.c \ - links.c links_env.c mf.c mount.c mtime.c ntypes.c objcopy.c \ - ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c \ - swmr_addrem_writer.c swmr_generator.c swmr_reader.c \ - swmr_remove_reader.c swmr_remove_writer.c swmr_sparse_reader.c \ - swmr_sparse_writer.c swmr_writer.c tcheck_version.c \ - $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ - vfd.c + gen_nullspace.c gen_plist.c gen_sizes_lheap.c \ + gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \ + istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \ + ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \ + space_overflow.c stab.c swmr_addrem_writer.c swmr_generator.c \ + swmr_reader.c swmr_remove_reader.c swmr_remove_writer.c \ + swmr_sparse_reader.c swmr_sparse_writer.c swmr_writer.c \ + tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ + $(ttsafe_SOURCES) unlink.c vfd.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -880,7 +896,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ - set_extent ttsafe \ + set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ getname vfd ntypes dangle dtransform reserved cross_read \ freespace mf farray earray btree2 fheap file_image @@ -895,7 +911,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ BUILD_ALL_PROGS = gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_idx gen_new_array \ gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \ gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \ - gen_sizes_lheap gen_file_image + gen_sizes_lheap gen_file_image gen_plist # The libh5test library provides common support code for the tests. @@ -1118,6 +1134,12 @@ earray$(EXEEXT): $(earray_OBJECTS) $(earray_DEPENDENCIES) $(EXTRA_earray_DEPENDE efc$(EXEEXT): $(efc_OBJECTS) $(efc_DEPENDENCIES) $(EXTRA_efc_DEPENDENCIES) @rm -f efc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(efc_OBJECTS) $(efc_LDADD) $(LIBS) +enc_dec_plist$(EXEEXT): $(enc_dec_plist_OBJECTS) $(enc_dec_plist_DEPENDENCIES) $(EXTRA_enc_dec_plist_DEPENDENCIES) + @rm -f enc_dec_plist$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(enc_dec_plist_OBJECTS) $(enc_dec_plist_LDADD) $(LIBS) +enc_dec_plist_with_endianess$(EXEEXT): $(enc_dec_plist_with_endianess_OBJECTS) $(enc_dec_plist_with_endianess_DEPENDENCIES) $(EXTRA_enc_dec_plist_with_endianess_DEPENDENCIES) + @rm -f enc_dec_plist_with_endianess$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(enc_dec_plist_with_endianess_OBJECTS) $(enc_dec_plist_with_endianess_LDADD) $(LIBS) enum$(EXEEXT): $(enum_OBJECTS) $(enum_DEPENDENCIES) $(EXTRA_enum_DEPENDENCIES) @rm -f enum$(EXEEXT) $(AM_V_CCLD)$(LINK) $(enum_OBJECTS) $(enum_LDADD) $(LIBS) @@ -1205,6 +1227,9 @@ gen_noencoder$(EXEEXT): $(gen_noencoder_OBJECTS) $(gen_noencoder_DEPENDENCIES) $ gen_nullspace$(EXEEXT): $(gen_nullspace_OBJECTS) $(gen_nullspace_DEPENDENCIES) $(EXTRA_gen_nullspace_DEPENDENCIES) @rm -f gen_nullspace$(EXEEXT) $(AM_V_CCLD)$(LINK) $(gen_nullspace_OBJECTS) $(gen_nullspace_LDADD) $(LIBS) +gen_plist$(EXEEXT): $(gen_plist_OBJECTS) $(gen_plist_DEPENDENCIES) $(EXTRA_gen_plist_DEPENDENCIES) + @rm -f gen_plist$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(gen_plist_OBJECTS) $(gen_plist_LDADD) $(LIBS) gen_sizes_lheap$(EXEEXT): $(gen_sizes_lheap_OBJECTS) $(gen_sizes_lheap_DEPENDENCIES) $(EXTRA_gen_sizes_lheap_DEPENDENCIES) @rm -f gen_sizes_lheap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(gen_sizes_lheap_OBJECTS) $(gen_sizes_lheap_LDADD) $(LIBS) @@ -1335,6 +1360,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtypes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist_with_endianess.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err_compat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error_test.Po@am__quote@ @@ -1364,6 +1391,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_new_super.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_noencoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_nullspace.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_plist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_sizes_lheap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_specmetaread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_udlinks.Po@am__quote@ diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c new file mode 100644 index 0000000..26bfb84 --- /dev/null +++ b/test/enc_dec_plist.c @@ -0,0 +1,480 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Serial tests for encoding/decoding plists + */ + +#include "h5test.h" +#include "H5Pprivate.h" + +static int +test_encode_decode(hid_t orig_pl) +{ + hid_t pl = (-1); /* Decoded property list */ + void *temp_buf = NULL; /* Pointer to encoding buffer */ + size_t temp_size = 0; /* Size of encoding buffer */ + + /* first call to encode returns only the size of the buffer needed */ + if(H5Pencode(orig_pl, NULL, &temp_size) < 0) + STACK_ERROR + + if(NULL == (temp_buf = (void *)HDmalloc(temp_size))) + TEST_ERROR + + if(H5Pencode(orig_pl, temp_buf, &temp_size) < 0) + STACK_ERROR + + if((pl = H5Pdecode(temp_buf)) < 0) + STACK_ERROR + + if(!H5Pequal(orig_pl, pl)) + PUTS_ERROR("encoding-decoding cycle failed\n") + + if((H5Pclose(pl)) < 0) + STACK_ERROR + + HDfree(temp_buf); + + /* Success */ + return(0); + +error: + if(pl > 0) + H5Pclose(pl); + if(temp_buf) + HDfree(temp_buf); + + return(-1); +} /* end test_encode_decode() */ + +int +main(void) +{ + hid_t dcpl; /* dataset create prop. list */ + hid_t dapl; /* dataset access prop. list */ + hid_t dxpl; /* dataset xfer prop. list */ + hid_t gcpl; /* group create prop. list */ + hid_t ocpypl; /* object copy prop. list */ + hid_t ocpl; /* object create prop. list */ + hid_t lcpl; /* link create prop. list */ + hid_t lapl; /* link access prop. list */ + hid_t fapl; /* file access prop. list */ + hid_t fcpl; /* file create prop. list */ + hid_t strcpl; /* string create prop. list */ + hid_t acpl; /* attribute create prop. list */ + + hsize_t chunk_size[2] = {16384, 4}; /* chunk size */ + double fill = 2.7f; /* Fill value */ + hsize_t max_size[1]; /* data space maximum size */ + size_t nslots = 521 * 2; + size_t nbytes = 1048576 * 10; + double w0 = 0.5f; + unsigned max_compact; + unsigned min_dense; + const char* c_to_f = "x+32"; + H5AC_cache_config_t my_cache_config = { + H5AC__CURR_CACHE_CONFIG_VERSION, + TRUE, + FALSE, + FALSE, + "temp", + TRUE, + FALSE, + ( 2 * 2048 * 1024), + 0.3f, + (64 * 1024 * 1024), + (4 * 1024 * 1024), + 60000, + H5C_incr__threshold, + 0.8f, + 3.0f, + TRUE, + (8 * 1024 * 1024), + H5C_flash_incr__add_space, + 2.0f, + 0.25f, + H5C_decr__age_out_with_threshold, + 0.997f, + 0.8f, + TRUE, + (3 * 1024 * 1024), + 3, + FALSE, + 0.2f, + (256 * 2048), + H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; + + if(VERBOSE_MED) + printf("Encode/Decode DCPLs\n"); + + /******* ENCODE/DECODE DCPLS *****/ + TESTING("DCPL Encoding/Decoding"); + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_chunk(dcpl, 2, &chunk_size)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0) + FAIL_STACK_ERROR + + max_size[0] = 100; + if((H5Pset_external(dcpl, "ext1.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + FAIL_STACK_ERROR + if((H5Pset_external(dcpl, "ext2.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + FAIL_STACK_ERROR + if((H5Pset_external(dcpl, "ext3.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + FAIL_STACK_ERROR + if((H5Pset_external(dcpl, "ext4.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(dcpl) < 0) + FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(dcpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE DAPLS *****/ + TESTING("DAPL Encoding/Decoding"); + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(dapl) < 0) + FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(dapl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE OCPLS *****/ + TESTING("OCPL Encoding/Decoding"); + if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) + FAIL_STACK_ERROR + + if((H5Pset_attr_phase_change (ocpl, 110, 105)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_filter (ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(ocpl) < 0) + FAIL_PUTS_ERROR("OCPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(ocpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE DXPLS *****/ + TESTING("DXPL Encoding/Decoding"); + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0) + FAIL_STACK_ERROR + if((H5Pset_hyper_vector_size(dxpl, 5)) < 0) + FAIL_STACK_ERROR +#ifdef H5_HAVE_PARALLEL + if((H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE)) < 0) + FAIL_STACK_ERROR + if((H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO)) < 0) + FAIL_STACK_ERROR + if((H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO)) < 0) + FAIL_STACK_ERROR + if((H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30)) < 0) + FAIL_STACK_ERROR + if((H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40)) < 0) + FAIL_STACK_ERROR +#endif/* H5_HAVE_PARALLEL */ + if((H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)) < 0) + FAIL_STACK_ERROR + if((H5Pset_data_transform(dxpl, c_to_f)) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(dxpl) < 0) + FAIL_PUTS_ERROR("DXPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(dxpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE GCPLS *****/ + TESTING("GCPL Encoding/Decoding"); + if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_link_phase_change(gcpl, 2, 2)) < 0) + FAIL_STACK_ERROR + + /* Query the group creation properties */ + if((H5Pget_link_phase_change(gcpl, &max_compact, &min_dense)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_est_link_info(gcpl, 3, 9)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(gcpl) < 0) + FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(gcpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE LCPLS *****/ + TESTING("LCPL Encoding/Decoding"); + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(lcpl) < 0) + FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(lcpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE LAPLS *****/ + TESTING("LAPL Encoding/Decoding"); + if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_nlinks(lapl, (size_t)134)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_elink_prefix(lapl, "/tmpasodiasod")) < 0) + FAIL_STACK_ERROR + + /* Create FAPL for the elink FAPL */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + FAIL_STACK_ERROR + if((H5Pset_alignment(fapl, 2, 1024)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_elink_fapl(lapl, fapl)) < 0) + FAIL_STACK_ERROR + + /* Close the elink's FAPL */ + if((H5Pclose(fapl)) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(lapl) < 0) + FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(lapl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE OCPYPLS *****/ + TESTING("OCPYPL Encoding/Decoding"); + if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0) + FAIL_STACK_ERROR + + if((H5Padd_merge_committed_dtype_path(ocpypl, "foo")) < 0) + FAIL_STACK_ERROR + if((H5Padd_merge_committed_dtype_path(ocpypl, "bar")) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(ocpypl) < 0) + FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(ocpypl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE FAPLS *****/ + TESTING("FAPL Encoding/Decoding"); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_family_offset(fapl, 1024)) < 0) + FAIL_STACK_ERROR + if((H5Pset_meta_block_size(fapl, 2098452)) < 0) + FAIL_STACK_ERROR + if((H5Pset_sieve_buf_size(fapl, 1048576)) < 0) + FAIL_STACK_ERROR + if((H5Pset_alignment(fapl, 2, 1024)) < 0) + FAIL_STACK_ERROR + if((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0) + FAIL_STACK_ERROR + if((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0) + FAIL_STACK_ERROR + if((H5Pset_gc_references(fapl, 1)) < 0) + FAIL_STACK_ERROR + if((H5Pset_small_data_block_size(fapl, 2048)) < 0) + FAIL_STACK_ERROR + if((H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0) + FAIL_STACK_ERROR + if((H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK)) < 0) + FAIL_STACK_ERROR + if((H5Pset_multi_type(fapl, H5FD_MEM_GHEAP)) < 0) + FAIL_STACK_ERROR + if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(fapl) < 0) + FAIL_PUTS_ERROR("FAPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(fapl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE FCPLS *****/ + TESTING("FCPL Encoding/Decoding"); + + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_userblock(fcpl, 1024) < 0)) + FAIL_STACK_ERROR + + if((H5Pset_istore_k(fcpl, 3) < 0)) + FAIL_STACK_ERROR + + if((H5Pset_sym_k(fcpl, 4, 5) < 0)) + FAIL_STACK_ERROR + + if((H5Pset_shared_mesg_nindexes(fcpl, 8) < 0)) + FAIL_STACK_ERROR + + if((H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0)) + FAIL_STACK_ERROR + + if((H5Pset_shared_mesg_phase_change(fcpl, 60, 20) < 0)) + FAIL_STACK_ERROR + + if((H5Pset_sizes(fcpl, 8, 4) < 0)) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(fcpl) < 0) + FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(fcpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE STRCPLS *****/ + TESTING("STRCPL Encoding/Decoding"); + + if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0)) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(strcpl) < 0) + FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(strcpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + /******* ENCODE/DECODE ACPLS *****/ + TESTING("ACPL Encoding/Decoding"); + + if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0) + FAIL_STACK_ERROR + + if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)) + FAIL_STACK_ERROR + + /* Test encoding & decoding property list */ + if(test_encode_decode(acpl) < 0) + FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n") + + /* release resource */ + if((H5Pclose(acpl)) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + return 0; + +error: + printf("***** Plist Encode/Decode tests FAILED! *****\n"); + return 1; +} + diff --git a/test/enc_dec_plist_with_endianess.c b/test/enc_dec_plist_with_endianess.c new file mode 100644 index 0000000..4469604 --- /dev/null +++ b/test/enc_dec_plist_with_endianess.c @@ -0,0 +1,160 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Serial tests for encoding/decoding plists + */ + +#include "h5test.h" +#include "H5srcdir.h" + +static int test_plists(const char *filename1, const char *filename2); + +int +main(void) +{ + if(VERBOSE_MED) + printf("Encode/Decode property list endianess\n"); + + /******* ENCODE/DECODE DCPLS *****/ + TESTING("DCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE DAPLS *****/ + TESTING("DAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE DXPLS *****/ + TESTING("DXPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE GCPLS *****/ + TESTING("GCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE LCPLS *****/ + TESTING("LCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE LAPLS *****/ + TESTING("LAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE OCPLS *****/ + TESTING("OCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE OCPYPLS *****/ + TESTING("OCPYPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE FCPLS *****/ + TESTING("FCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE FAPLS *****/ + TESTING("FAPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE STRCPLS *****/ + TESTING("STRCPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + /******* ENCODE/DECODE ACPLS *****/ + TESTING("ACPL Encoding/Decoding"); + if(test_plists("testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be") < 0) + FAIL_STACK_ERROR + PASSED(); + + return 0; + +error: + return 1; +} + +static int +test_plists(const char *filename1, const char *filename2) +{ + int fd_le, fd_be; + size_t size_le = 0, size_be = 0; + void *buf_le = NULL, *buf_be = NULL; + hid_t plist_le, plist_be; /* dataset create prop. list */ + const char *testfile; + + testfile = H5_get_srcdir_filename(filename1); + if((fd_le = HDopen(testfile, O_RDONLY, 0666)) < 0) + TEST_ERROR + size_le = HDlseek(fd_le, (HDoff_t)0, SEEK_END); + HDlseek(fd_le, (HDoff_t)0, SEEK_SET); + buf_le = (void *)HDmalloc(size_le); + if(HDread(fd_le, buf_le, size_le) < 0) + TEST_ERROR + HDclose(fd_le); + + testfile = H5_get_srcdir_filename(filename2); + if((fd_be = HDopen(testfile, O_RDONLY, 0666)) < 0) + TEST_ERROR + size_be = HDlseek(fd_be, (HDoff_t)0, SEEK_END); + HDlseek(fd_be, (HDoff_t)0, SEEK_SET); + buf_be = (void *)HDmalloc(size_be); + if(HDread(fd_be, buf_be, size_be) < 0) + TEST_ERROR + HDclose(fd_be); + + if((plist_le = H5Pdecode(buf_le)) < 0) + FAIL_STACK_ERROR + if((plist_be = H5Pdecode(buf_be)) < 0) + FAIL_STACK_ERROR + + if(!H5Pequal(plist_le, plist_be)) + FAIL_PUTS_ERROR("PLIST encoding/decoding comparison failed\n") + + if((H5Pclose(plist_le)) < 0) + FAIL_STACK_ERROR + if((H5Pclose(plist_be)) < 0) + FAIL_STACK_ERROR + + HDfree(buf_le); + HDfree(buf_be); + + return 1; + +error: + printf("***** Plist Encode/Decode tests FAILED! *****\n"); + return -1; +} + diff --git a/test/enum.c b/test/enum.c index 3684102..29b702d 100644 --- a/test/enum.c +++ b/test/enum.c @@ -109,9 +109,9 @@ test_named(hid_t file) /*------------------------------------------------------------------------- - * Function: test_noconv + * Function: test_conv * - * Purpose: Tests creation of datasets when no conversion is present. + * Purpose: Tests writing and read data * * Return: Success: 0 * @@ -119,24 +119,32 @@ test_named(hid_t file) * * Programmer: Robb Matzke * Monday, January 4, 1999 + * + * Raymond Lu + * 12 October 2012 + * I added tests for enum-integer and enum-float conversions *------------------------------------------------------------------------- */ static int -test_noconv(hid_t file) +test_conv(hid_t file) { hid_t cwg=-1, type=-1, space=-1, dset=-1; c_e1 val; + /* Some values are out of range for testing. The library should accept them */ static c_e1 data1[]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED, E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE, - E1_RED, E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE}; + E1_RED, E1_WHITE, (c_e1)0, (c_e1)-1, (c_e1)-2}; c_e1 data2[NELMTS(data1)]; + short data_short[NELMTS(data1)]; + int data_int[NELMTS(data1)]; + double data_double[NELMTS(data1)]; hsize_t ds_size[1]={NELMTS(data1)}; size_t i; - TESTING("no-conversion datasets"); + TESTING("enumeration conversions"); - if((cwg = H5Gcreate2(file, "test_noconv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((cwg = H5Gcreate2(file, "test_conv", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR if(H5Tenum_insert(type, "RED", CPTR(val, E1_RED )) < 0) FAIL_STACK_ERROR @@ -146,20 +154,96 @@ test_noconv(hid_t file) if(H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK)) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(cwg, "color_table", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /*************************************** + * Dataset of enumeration type + ***************************************/ + /* Create a dataset of enum type and write enum data to it */ + if((dset = H5Dcreate2(cwg, "color_table1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR + + /* Test reading back the data with no conversion */ if(H5Dread(dset, type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR for(i = 0; i < (size_t)ds_size[0]; i++) if(data1[i] != data2[i]) { H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + printf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; } /* end if */ + /* Test converting the data to integer. Read enum data back as integer */ + if(H5Dread(dset, H5T_NATIVE_SHORT, space, space, H5P_DEFAULT, data_short) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if((short)data1[i] != data_short[i]) { + H5_FAILED(); + printf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data_short[i])); + goto error; + } /* end if */ + + /* Test converting the data to floating number. Read enum data back as floating number */ + if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if((int)data1[i] != (int)data_double[i]) { + H5_FAILED(); + printf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data_double[i])); + goto error; + } /* end if */ + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + + /*************************************** + * Dataset of integer type + ***************************************/ + /* Create a dataset of native integer and write enum data to it */ + if((dset = H5Dcreate2(cwg, "color_table2", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR + + /* Test reading back the data with no conversion */ + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, data_int) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if((int)data1[i] != data_int[i]) { + H5_FAILED(); + printf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data_int[i])); + goto error; + } /* end if */ + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + + /*************************************** + * Dataset of double type + ***************************************/ + /* Create a dataset of native double and write enum data to it */ + if((dset = H5Dcreate2(cwg, "color_table3", H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + if(H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR + + /* Test reading back the data with no conversion */ + if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, data_double) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if((int)data1[i] != (int)data_double[i]) { + H5_FAILED(); + printf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data_double[i])); + goto error; + } /* end if */ + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR if(H5Tclose(type) < 0) FAIL_STACK_ERROR if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR @@ -572,7 +656,7 @@ main(void) /* Tests */ nerrors += test_named(file); - nerrors += test_noconv(file); + nerrors += test_conv(file); nerrors += test_tr1(file); nerrors += test_tr2(file); nerrors += test_value_dsnt_exist(); diff --git a/test/gen_plist.c b/test/gen_plist.c new file mode 100644 index 0000000..b4da261 --- /dev/null +++ b/test/gen_plist.c @@ -0,0 +1,435 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * generate plist file + */ + +#include +#include +#include +#include +#include +#include "H5private.h" +#include "hdf5.h" + +static int encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be); + +int +main(void) +{ + hid_t dcpl1; /* dataset create prop. list */ + hid_t dapl1; /* dataset access prop. list */ + hid_t dxpl1; /* dataset xfer prop. list */ + hid_t gcpl1; /* group create prop. list */ + hid_t ocpypl1; /* object copy prop. list */ + hid_t ocpl1; /* object create prop. list */ + hid_t lcpl1; /* link create prop. list */ + hid_t lapl1; /* link access prop. list */ + hid_t fapl1; /* file access prop. list */ + hid_t fcpl1; /* file create prop. list */ + hid_t strcpl1; /* string create prop. list */ + hid_t acpl1; /* attribute create prop. list */ + + herr_t ret = 0; + hsize_t chunk_size = 16384; /* chunk size */ + int fill = 2; /* Fill value */ + hsize_t max_size[1]; /* data space maximum size */ + size_t nslots = 521 * 2; + size_t nbytes = 1048576 * 10; + double w0 = 0.5f; + unsigned max_compact; + unsigned min_dense; + const char* c_to_f = "x+32"; + int little_endian; + H5AC_cache_config_t my_cache_config = { + H5AC__CURR_CACHE_CONFIG_VERSION, + 1 /*TRUE*/, + 0 /*FALSE*/, + 0 /*FALSE*/, + "temp", + 1 /*TRUE*/, + 0 /*FALSE*/, + ( 2 * 2048 * 1024), + 0.3f, + (64 * 1024 * 1024), + (4 * 1024 * 1024), + 60000, + H5C_incr__threshold, + 0.8f, + 3.0f, + 1 /*TRUE*/, + (8 * 1024 * 1024), + H5C_flash_incr__add_space, + 2.0f, + 0.25f, + H5C_decr__age_out_with_threshold, + 0.997f, + 0.8f, + 1 /*TRUE*/, + (3 * 1024 * 1024), + 3, + 0 /*FALSE*/, + 0.2f, + (256 * 2048), + H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY}; + + /* check endianess */ + { + short int word = 0x0001; + char *byte = (char *) &word; + + if(byte[0] == 1) + /* little endian */ + little_endian = 1; + else + /* big endian */ + little_endian = 0; + } + + /* Explicitly initialize the library, since we are including the private header file */ + H5open(); + + /******* ENCODE/DECODE DCPLS *****/ + if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) + assert(dcpl1 > 0); + + if((ret = H5Pset_chunk(dcpl1, 1, &chunk_size)) < 0) + assert(ret > 0); + + if((ret = H5Pset_alloc_time(dcpl1, H5D_ALLOC_TIME_LATE)) < 0) + assert(ret > 0); + + ret = H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32BE, (size_t)1, &fill, NULL, H5P_DEFAULT); + assert(ret >= 0); + if((ret = H5Pset_fill_value(dcpl1, H5T_STD_I32BE, &fill)) < 0) + assert(ret > 0); + + max_size[0] = 100; + if((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + assert(ret > 0); + if((ret = H5Pset_external(dcpl1, "ext2.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + assert(ret > 0); + if((ret = H5Pset_external(dcpl1, "ext3.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + assert(ret > 0); + if((ret = H5Pset_external(dcpl1, "ext4.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) + assert(ret > 0); + + if((ret = encode_plist(dcpl1, little_endian, "testfiles/plist_files/dcpl_le", "testfiles/plist_files/dcpl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(dcpl1)) < 0) + assert(ret > 0); + + + /******* ENCODE/DECODE DAPLS *****/ + if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + assert(dapl1 > 0); + + if((ret = H5Pset_chunk_cache(dapl1, nslots, nbytes, w0)) < 0) + assert(ret > 0); + + if((ret = encode_plist(dapl1, little_endian, "testfiles/plist_files/dapl_le", "testfiles/plist_files/dapl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(dapl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE DXPLS *****/ + if((dxpl1 = H5Pcreate(H5P_DATASET_XFER)) < 0) + assert(dxpl1 > 0); + if((ret = H5Pset_btree_ratios(dxpl1, 0.2f, 0.6f, 0.2f)) < 0) + assert(ret > 0); + if((ret = H5Pset_hyper_vector_size(dxpl1, 5)) < 0) + assert(ret > 0); +#ifdef H5_HAVE_PARALLEL + if((ret = H5Pset_dxpl_mpio(dxpl1, H5FD_MPIO_COLLECTIVE)) < 0) + assert(ret > 0); + if((ret = H5Pset_dxpl_mpio_collective_opt(dxpl1, H5FD_MPIO_INDIVIDUAL_IO)) < 0) + assert(ret > 0); + if((ret = H5Pset_dxpl_mpio_chunk_opt(dxpl1, H5FD_MPIO_CHUNK_MULTI_IO)) < 0) + assert(ret > 0); + if((ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl1, 30)) < 0) + assert(ret > 0); + if((ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl1, 40)) < 0) + assert(ret > 0); +#endif/* H5_HAVE_PARALLEL */ + if((ret = H5Pset_edc_check(dxpl1, H5Z_DISABLE_EDC)) < 0) + assert(ret > 0); + if((ret = H5Pset_data_transform(dxpl1, c_to_f)) < 0) + assert(ret > 0); + + if((ret = encode_plist(dxpl1, little_endian, "testfiles/plist_files/dxpl_le", "testfiles/plist_files/dxpl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(dxpl1)) < 0) + assert(ret > 0); + + + /******* ENCODE/DECODE GCPLS *****/ + if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) + assert(gcpl1 > 0); + + if((ret = H5Pset_local_heap_size_hint(gcpl1, 256)) < 0) + assert(ret > 0); + + if((ret = H5Pset_link_phase_change(gcpl1, 2, 2)) < 0) + assert(ret > 0); + + /* Query the group creation properties */ + if((ret = H5Pget_link_phase_change(gcpl1, &max_compact, &min_dense)) < 0) + assert(ret > 0); + + if((ret = H5Pset_est_link_info(gcpl1, 3, 9)) < 0) + assert(ret > 0); + + if((ret = H5Pset_link_creation_order(gcpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) + assert(ret > 0); + + if((ret = encode_plist(gcpl1, little_endian, "testfiles/plist_files/gcpl_le", "testfiles/plist_files/gcpl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(gcpl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE LCPLS *****/ + if((lcpl1 = H5Pcreate(H5P_LINK_CREATE)) < 0) + assert(lcpl1 > 0); + + if((ret = H5Pset_create_intermediate_group(lcpl1, 1 /*TRUE*/)) < 0) + assert(ret > 0); + + if((ret = encode_plist(lcpl1, little_endian, "testfiles/plist_files/lcpl_le", "testfiles/plist_files/lcpl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(lcpl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE OCPYLS *****/ + if((ocpypl1 = H5Pcreate(H5P_OBJECT_COPY)) < 0) + assert(ocpypl1 > 0); + + ret = H5Pset_copy_object(ocpypl1, H5O_COPY_EXPAND_EXT_LINK_FLAG); + assert(ret >= 0); + + ret = H5Padd_merge_committed_dtype_path(ocpypl1, "foo"); + assert(ret >= 0); + + ret = H5Padd_merge_committed_dtype_path(ocpypl1, "bar"); + assert(ret >= 0); + + if((ret = encode_plist(ocpypl1, little_endian, "testfiles/plist_files/ocpypl_le", "testfiles/plist_files/ocpypl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(ocpypl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE OCPLS *****/ + if((ocpl1 = H5Pcreate(H5P_OBJECT_CREATE)) < 0) + assert(ocpl1 > 0); + + if((ret = H5Pset_attr_creation_order(ocpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) + assert(ret > 0); + + if((ret = H5Pset_attr_phase_change (ocpl1, 110, 105)) < 0) + assert(ret > 0); + + if((ret = H5Pset_filter (ocpl1, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0) + assert(ret > 0); + + if((ret = encode_plist(ocpl1, little_endian, "testfiles/plist_files/ocpl_le", "testfiles/plist_files/ocpl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(ocpl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE LAPLS *****/ + if((lapl1 = H5Pcreate(H5P_LINK_ACCESS)) < 0) + assert(lapl1 > 0); + + if((ret = H5Pset_nlinks(lapl1, (size_t)134)) < 0) + assert(ret > 0); + + if((ret = H5Pset_elink_acc_flags(lapl1, H5F_ACC_RDONLY)) < 0) + assert(ret > 0); + + if((ret = H5Pset_elink_prefix(lapl1, "/tmpasodiasod")) < 0) + assert(ret > 0); + + /* Create FAPL for the elink FAPL */ + if((fapl1 = ret = H5Pcreate(ret = H5P_FILE_ACCESS)) < 0) + assert(ret > 0); + if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0) + assert(ret > 0); + + if((ret = H5Pset_elink_fapl(lapl1, fapl1)) < 0) + assert(ret > 0); + + /* Close the elink's FAPL */ + if((ret = H5Pclose(fapl1)) < 0) + assert(ret > 0); + + if((ret = encode_plist(lapl1, little_endian, "testfiles/plist_files/lapl_le", "testfiles/plist_files/lapl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(lapl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE FAPLS *****/ + if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) + assert(fapl1 > 0); + + if((ret = H5Pset_family_offset(fapl1, 1024)) < 0) + assert(ret > 0); + if((ret = H5Pset_meta_block_size(fapl1, 2098452)) < 0) + assert(ret > 0); + if((ret = H5Pset_sieve_buf_size(fapl1, 1048576)) < 0) + assert(ret > 0); + if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0) + assert(ret > 0); + if((ret = H5Pset_cache(fapl1, 1024, 128, 10485760, 0.3f)) < 0) + assert(ret > 0); + if((ret = H5Pset_elink_file_cache_size(fapl1, 10485760)) < 0) + assert(ret > 0); + if((ret = H5Pset_gc_references(fapl1, 1)) < 0) + assert(ret > 0); + if((ret = H5Pset_small_data_block_size(fapl1, 2048)) < 0) + assert(ret > 0); + if((ret = H5Pset_libver_bounds(fapl1, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0) + assert(ret > 0); + if((ret = H5Pset_fclose_degree(fapl1, H5F_CLOSE_WEAK)) < 0) + assert(ret > 0); + if((ret = H5Pset_multi_type(fapl1, H5FD_MEM_GHEAP)) < 0) + assert(ret > 0); + if((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0) + assert(ret > 0); + + if((ret = encode_plist(fapl1, little_endian, "testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(fapl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE FCPLS *****/ + if((fcpl1 = H5Pcreate(H5P_FILE_CREATE)) < 0) + assert(fcpl1 > 0); + + if((ret = H5Pset_userblock(fcpl1, 1024) < 0)) + assert(ret > 0); + + if((ret = H5Pset_istore_k(fcpl1, 3) < 0)) + assert(ret > 0); + + if((ret = H5Pset_sym_k(fcpl1, 4, 5) < 0)) + assert(ret > 0); + + if((ret = H5Pset_shared_mesg_nindexes(fcpl1, 8) < 0)) + assert(ret > 0); + + if((ret = H5Pset_shared_mesg_index(fcpl1, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0)) + assert(ret > 0); + + if((ret = H5Pset_shared_mesg_phase_change(fcpl1, 60, 20) < 0)) + assert(ret > 0); + + if((ret = H5Pset_sizes(fcpl1, 8, 4) < 0)) + assert(ret > 0); + + if((ret = encode_plist(fcpl1, little_endian, "testfiles/plist_files/fcpl_le", "testfiles/plist_files/fcpl_be")) < 0) + assert(ret > 0); + + /* release resource */ + if((ret = H5Pclose(fcpl1)) < 0) + assert(ret > 0); + + /******* ENCODE/DECODE STRCPLS *****/ + strcpl1 = H5Pcreate(H5P_STRING_CREATE); + assert(strcpl1 > 0); + + ret = H5Pset_char_encoding(strcpl1, H5T_CSET_UTF8); + assert(ret >= 0); + + ret = encode_plist(strcpl1, little_endian, "testfiles/plist_files/strcpl_le", "testfiles/plist_files/strcpl_be"); + assert(ret > 0); + + /* release resource */ + ret = H5Pclose(strcpl1); + assert(ret >= 0); + + /******* ENCODE/DECODE ACPLS *****/ + acpl1 = H5Pcreate(H5P_ATTRIBUTE_CREATE); + assert(acpl1 > 0); + + ret = H5Pset_char_encoding(acpl1, H5T_CSET_UTF8); + assert(ret >= 0); + + ret = encode_plist(acpl1, little_endian, "testfiles/plist_files/acpl_le", "testfiles/plist_files/acpl_be"); + assert(ret > 0); + + /* release resource */ + ret = H5Pclose(acpl1); + assert(ret >= 0); + + return 0; +} + +static int +encode_plist(hid_t plist_id, int little_endian, const char *filename_le, const char *filename_be) +{ + int fd = 0; /* file descriptor */ + herr_t ret = 0; + void *temp_buf = NULL; + size_t temp_size = 0; + ssize_t write_size; + + /* first call to encode returns only the size of the buffer needed */ + if((ret = H5Pencode(plist_id, NULL, &temp_size)) < 0) + assert(ret > 0); + + temp_buf = (void *)HDmalloc(temp_size); + assert(temp_buf); + + if((ret = H5Pencode(plist_id, temp_buf, &temp_size)) < 0) + assert(ret > 0); + + if(little_endian) + fd = HDopen(filename_le, O_RDWR | O_CREAT | O_TRUNC, 0666); + else + fd = HDopen(filename_be, O_RDWR | O_CREAT | O_TRUNC, 0666); + assert(fd > 0); + + write_size = HDwrite(fd, temp_buf, temp_size); + assert(write_size == (ssize_t)temp_size); + + HDclose(fd); + + HDfree(temp_buf); + + return 1; +} + diff --git a/test/h5test.h b/test/h5test.h index 0c52bd1..7813b51 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -104,6 +104,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #define H5_FAILED() {puts("*FAILED*");fflush(stdout);} #define H5_WARNING() {puts("*WARNING*");fflush(stdout);} #define SKIPPED() {puts(" -SKIP-");fflush(stdout);} +#define PUTS_ERROR(s) {puts(s); AT(); goto error;} #define TEST_ERROR {H5_FAILED(); AT(); goto error;} #define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;} #define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \ diff --git a/test/links.c b/test/links.c index ee635ff..91920d3 100644 --- a/test/links.c +++ b/test/links.c @@ -1884,7 +1884,7 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Open first file again with read-only access and check on objects created */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -1908,7 +1908,7 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Verify that new objects can't be created through a read-only external * link. @@ -1925,7 +1925,7 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -6823,8 +6823,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that only 1 file is open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Open and close the target of the external link */ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) @@ -6833,16 +6832,14 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that both files are now open */ - if(H5F_sfile_assert_num(2) < 0) - TEST_ERROR + H5F_sfile_assert_num(2); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* @@ -6864,8 +6861,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that only 1 file is open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Open and close the target of the external link */ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) @@ -6874,24 +6870,21 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that both files are now open */ - if(H5F_sfile_assert_num(2) < 0) - TEST_ERROR + H5F_sfile_assert_num(2); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only the parent file is now open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* @@ -6927,8 +6920,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that only 1 file is open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) @@ -6937,8 +6929,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that files 2 and 3 are now open */ - if(H5F_sfile_assert_num(3) < 0) - TEST_ERROR + H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) @@ -6947,16 +6938,14 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that all files are now open */ - if(H5F_sfile_assert_num(4) < 0) - TEST_ERROR + H5F_sfile_assert_num(4); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* @@ -6992,8 +6981,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that only 1 file is open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) @@ -7002,8 +6990,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that files 2 and 3 are now open */ - if(H5F_sfile_assert_num(3) < 0) - TEST_ERROR + H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) @@ -7012,24 +6999,21 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that all files are now open */ - if(H5F_sfile_assert_num(4) < 0) - TEST_ERROR + H5F_sfile_assert_num(4); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); #ifndef H5_CANNOT_OPEN_TWICE /* @@ -7061,8 +7045,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that only 1 file is open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Open and close one complete cycle */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) @@ -7071,16 +7054,14 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that all files are now open */ - if(H5F_sfile_assert_num(3) < 0) - TEST_ERROR + H5F_sfile_assert_num(3); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* @@ -7112,8 +7093,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that only 1 file is open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Open and close one complete cycle */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) @@ -7122,24 +7102,21 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that all files are now open */ - if(H5F_sfile_assert_num(3) < 0) - TEST_ERROR + H5F_sfile_assert_num(3); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ - if(H5F_sfile_assert_num(1) < 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); #endif /* H5_CANNOT_OPEN_TWICE */ /* Close fapl */ @@ -7234,8 +7211,7 @@ external_open_twice(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that both files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* @@ -7281,8 +7257,7 @@ external_open_twice(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that both files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* @@ -7332,8 +7307,7 @@ external_open_twice(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that both files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* @@ -7381,8 +7355,7 @@ external_open_twice(hid_t fapl, hbool_t new_format) TEST_ERROR /* Verify that both files are now closed */ - if(H5F_sfile_assert_num(0) < 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); diff --git a/test/mount.c b/test/mount.c index b7180fa..2502bbe 100644 --- a/test/mount.c +++ b/test/mount.c @@ -1181,7 +1181,7 @@ test_close(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Build the virtual file again */ if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || @@ -1198,7 +1198,7 @@ test_close(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Shut down */ PASSED(); @@ -1810,8 +1810,7 @@ test_missing_unmount(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -1946,8 +1945,7 @@ test_hold_open_file(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -2103,8 +2101,7 @@ test_hold_open_group(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -2249,8 +2246,7 @@ test_fcdegree_same(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -2391,8 +2387,7 @@ test_fcdegree_semi(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -2530,8 +2525,7 @@ test_fcdegree_strong(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -2733,8 +2727,7 @@ test_acc_perm(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -2957,8 +2950,7 @@ test_mult_mount(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -3179,8 +3171,7 @@ test_nested_survive(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -3295,8 +3286,7 @@ test_close_parent(hid_t fapl) TEST_ERROR /* Both underlying shared files should be open still */ - if(H5F_sfile_assert_num(2) != 0) - TEST_ERROR + H5F_sfile_assert_num(2); /* Check the name of "M" is still defined */ *name = '\0'; @@ -3317,16 +3307,14 @@ test_close_parent(hid_t fapl) TEST_ERROR /* Just file #2's underlying shared file should be open still */ - if(H5F_sfile_assert_num(1) != 0) - TEST_ERROR + H5F_sfile_assert_num(1); /* Close group in file #2, letting file #2 close */ if(H5Gclose(gidM) < 0) TEST_ERROR /* All underlying shared file structs should be closed */ - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -3703,16 +3691,14 @@ test_cut_graph(hid_t fapl) TEST_ERROR /* Check that all seven underlying files are still opened */ - if(H5F_sfile_assert_num(7) != 0) - TEST_ERROR + H5F_sfile_assert_num(7); /* Close "M" in file #5, which should close files 2, 4 & 5 */ if(H5Gclose(gidM) < 0) TEST_ERROR /* Check that only four underlying files are still opened */ - if(H5F_sfile_assert_num(4) != 0) - TEST_ERROR + H5F_sfile_assert_num(4); /* Unmount file #3 from file #1, cutting the graph */ if(H5Funmount(gidQ, "/B") < 0) @@ -3720,8 +3706,7 @@ test_cut_graph(hid_t fapl) /* Check that only three underlying files are still opened */ /* (File #1 should close after being cut off from the graph) */ - if(H5F_sfile_assert_num(3) != 0) - TEST_ERROR + H5F_sfile_assert_num(3); /* Check the name of "Q" is defined in its file */ *name = '\0'; @@ -3749,8 +3734,7 @@ test_cut_graph(hid_t fapl) TEST_ERROR /* Verify that all underlying shared files have been closed now */ - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -3917,16 +3901,14 @@ test_symlink(hid_t fapl) TEST_ERROR /* Verify that all 3 underlying shared files are still open */ - if(H5F_sfile_assert_num(3) != 0) - TEST_ERROR + H5F_sfile_assert_num(3); /* Close object opened through soft link */ if(H5Gclose(gidL) < 0) TEST_ERROR /* Verify that all underlying shared files have been closed now */ - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -4036,8 +4018,7 @@ test_sharedacc(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -4129,16 +4110,14 @@ test_sharedclose(hid_t fapl) TEST_ERROR /* Check that file #3 is still open */ - if(H5F_sfile_assert_num(3) != 0) - TEST_ERROR + H5F_sfile_assert_num(3); /* Close group B/C in file #1b. This should close file #1b and #3. */ if(H5Gclose(gid3) < 0) TEST_ERROR /* Check that file #3 has been closed */ - if(H5F_sfile_assert_num(2) != 0) - TEST_ERROR + H5F_sfile_assert_num(2); /* Unmount file 2 and close the rest of the handles */ if(H5Funmount(fid1a, "A") < 0) @@ -4153,8 +4132,7 @@ test_sharedclose(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); /* Create file #1 & its group */ if((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -4197,8 +4175,7 @@ test_sharedclose(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; @@ -4324,7 +4301,7 @@ test_multisharedclose(hid_t fapl) /* Check that all file IDs have been closed */ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - if(H5F_sfile_assert_num(0) < 0) TEST_ERROR + H5F_sfile_assert_num(0); PASSED(); return 0; diff --git a/test/testfiles/plist_files/acpl_be b/test/testfiles/plist_files/acpl_be new file mode 100644 index 0000000..ba342d9 Binary files /dev/null and b/test/testfiles/plist_files/acpl_be differ diff --git a/test/testfiles/plist_files/acpl_le b/test/testfiles/plist_files/acpl_le new file mode 100644 index 0000000..ba342d9 Binary files /dev/null and b/test/testfiles/plist_files/acpl_le differ diff --git a/test/testfiles/plist_files/dapl_be b/test/testfiles/plist_files/dapl_be new file mode 100644 index 0000000..4df4e7f Binary files /dev/null and b/test/testfiles/plist_files/dapl_be differ diff --git a/test/testfiles/plist_files/dapl_le b/test/testfiles/plist_files/dapl_le new file mode 100644 index 0000000..4df4e7f Binary files /dev/null and b/test/testfiles/plist_files/dapl_le differ diff --git a/test/testfiles/plist_files/dcpl_be b/test/testfiles/plist_files/dcpl_be new file mode 100644 index 0000000..667c67f Binary files /dev/null and b/test/testfiles/plist_files/dcpl_be differ diff --git a/test/testfiles/plist_files/dcpl_le b/test/testfiles/plist_files/dcpl_le new file mode 100644 index 0000000..667c67f Binary files /dev/null and b/test/testfiles/plist_files/dcpl_le differ diff --git a/test/testfiles/plist_files/dxpl_be b/test/testfiles/plist_files/dxpl_be new file mode 100644 index 0000000..5ff2ea0 Binary files /dev/null and b/test/testfiles/plist_files/dxpl_be differ diff --git a/test/testfiles/plist_files/dxpl_le b/test/testfiles/plist_files/dxpl_le new file mode 100644 index 0000000..5ff2ea0 Binary files /dev/null and b/test/testfiles/plist_files/dxpl_le differ diff --git a/test/testfiles/plist_files/fapl_be b/test/testfiles/plist_files/fapl_be new file mode 100644 index 0000000..8fcefa2 Binary files /dev/null and b/test/testfiles/plist_files/fapl_be differ diff --git a/test/testfiles/plist_files/fapl_le b/test/testfiles/plist_files/fapl_le new file mode 100644 index 0000000..8fcefa2 Binary files /dev/null and b/test/testfiles/plist_files/fapl_le differ diff --git a/test/testfiles/plist_files/fcpl_be b/test/testfiles/plist_files/fcpl_be new file mode 100644 index 0000000..ffa5242 Binary files /dev/null and b/test/testfiles/plist_files/fcpl_be differ diff --git a/test/testfiles/plist_files/fcpl_le b/test/testfiles/plist_files/fcpl_le new file mode 100644 index 0000000..ffa5242 Binary files /dev/null and b/test/testfiles/plist_files/fcpl_le differ diff --git a/test/testfiles/plist_files/gcpl_be b/test/testfiles/plist_files/gcpl_be new file mode 100644 index 0000000..1eec32c Binary files /dev/null and b/test/testfiles/plist_files/gcpl_be differ diff --git a/test/testfiles/plist_files/gcpl_le b/test/testfiles/plist_files/gcpl_le new file mode 100644 index 0000000..1eec32c Binary files /dev/null and b/test/testfiles/plist_files/gcpl_le differ diff --git a/test/testfiles/plist_files/lapl_be b/test/testfiles/plist_files/lapl_be new file mode 100644 index 0000000..30f52a4 Binary files /dev/null and b/test/testfiles/plist_files/lapl_be differ diff --git a/test/testfiles/plist_files/lapl_le b/test/testfiles/plist_files/lapl_le new file mode 100644 index 0000000..30f52a4 Binary files /dev/null and b/test/testfiles/plist_files/lapl_le differ diff --git a/test/testfiles/plist_files/lcpl_be b/test/testfiles/plist_files/lcpl_be new file mode 100644 index 0000000..4584e5c Binary files /dev/null and b/test/testfiles/plist_files/lcpl_be differ diff --git a/test/testfiles/plist_files/lcpl_le b/test/testfiles/plist_files/lcpl_le new file mode 100644 index 0000000..4584e5c Binary files /dev/null and b/test/testfiles/plist_files/lcpl_le differ diff --git a/test/testfiles/plist_files/ocpl_be b/test/testfiles/plist_files/ocpl_be new file mode 100644 index 0000000..bc46636 Binary files /dev/null and b/test/testfiles/plist_files/ocpl_be differ diff --git a/test/testfiles/plist_files/ocpl_le b/test/testfiles/plist_files/ocpl_le new file mode 100644 index 0000000..bc46636 Binary files /dev/null and b/test/testfiles/plist_files/ocpl_le differ diff --git a/test/testfiles/plist_files/ocpypl_be b/test/testfiles/plist_files/ocpypl_be new file mode 100644 index 0000000..a0d826d Binary files /dev/null and b/test/testfiles/plist_files/ocpypl_be differ diff --git a/test/testfiles/plist_files/ocpypl_le b/test/testfiles/plist_files/ocpypl_le new file mode 100644 index 0000000..a0d826d Binary files /dev/null and b/test/testfiles/plist_files/ocpypl_le differ diff --git a/test/testfiles/plist_files/strcpl_be b/test/testfiles/plist_files/strcpl_be new file mode 100644 index 0000000..4190a63 Binary files /dev/null and b/test/testfiles/plist_files/strcpl_be differ diff --git a/test/testfiles/plist_files/strcpl_le b/test/testfiles/plist_files/strcpl_le new file mode 100644 index 0000000..4190a63 Binary files /dev/null and b/test/testfiles/plist_files/strcpl_le differ diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 5d594a6..88c47f5 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -23,6 +23,7 @@ SET (testphdf5_SRCS ${HDF5_TEST_PAR_SOURCE_DIR}/t_span_tree.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c + ${HDF5_TEST_PAR_SOURCE_DIR}/t_prop.c ) #-- Adding test for testhdf5 diff --git a/testpar/Makefile.am b/testpar/Makefile.am index b2fb97c..e934f08 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -32,7 +32,8 @@ check_PROGRAMS = $(TEST_PROG_PARA) check_SCRIPTS= $(TEST_SCRIPT) testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \ - t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c + t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ + t_prop.c # The tests all depend on the hdf5 library and the test library LDADD = $(LIBH5TEST) $(LIBHDF5) diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 5b44e6e..394b3b1 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -117,7 +117,7 @@ am_testphdf5_OBJECTS = testphdf5.$(OBJEXT) t_dset.$(OBJEXT) \ t_file.$(OBJEXT) t_file_image.$(OBJEXT) t_mdset.$(OBJEXT) \ t_ph5basic.$(OBJEXT) t_coll_chunk.$(OBJEXT) \ t_span_tree.$(OBJEXT) t_chunk_alloc.$(OBJEXT) \ - t_filter_read.$(OBJEXT) + t_filter_read.$(OBJEXT) t_prop.$(OBJEXT) testphdf5_OBJECTS = $(am_testphdf5_OBJECTS) testphdf5_LDADD = $(LDADD) testphdf5_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) @@ -463,7 +463,8 @@ TEST_PROG_PARA = t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 t TEST_SCRIPT_PARA = testph5.sh check_SCRIPTS = $(TEST_SCRIPT) testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \ - t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c + t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ + t_prop.c # The tests all depend on the hdf5 library and the test library @@ -576,6 +577,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_pflush2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ph5basic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_posix_compliant.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_prop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_shapesame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_span_tree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testphdf5.Po@am__quote@ diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 61e7bfd..73e7f09 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -258,8 +258,10 @@ coll_chunk5(void) /*------------------------------------------------------------------------- * Function: coll_chunk6 * - * Purpose: Wrapper to test the collective chunk IO for regular JOINT - selection with at least number of 2*mpi_size chunks + * Purpose: Test direct request for multi-chunk-io. + * Wrapper to test the collective chunk IO for regular JOINT + * selection with at least number of 2*mpi_size chunks + * Test for direct to Multi Chunk I/O. * * Return: Success: 0 * @@ -489,6 +491,12 @@ coll_chunk10(void) * * Failure: -1 * + * Modifications: + * Remove invalid temporary property checkings for API_LINK_HARD and + * API_LINK_TRUE cases. + * Programmer: Jonathan Kim + * Date: 2012-10-10 + * * Programmer: Unknown * July 12th, 2004 * @@ -634,11 +642,6 @@ coll_chunktest(const char* filename, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - prop_value = H5D_XFER_COLL_CHUNK_FIX; - status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_TO_MULTI, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, - NULL, NULL, NULL, NULL, NULL, NULL); - VRFY((status >= 0),"testing property list inserted succeeded"); - break; case API_MULTI_HARD: @@ -654,11 +657,6 @@ coll_chunktest(const char* filename, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - prop_value = H5D_XFER_COLL_CHUNK_FIX; - status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_TO_MULTI_OPT, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, - NULL, NULL, NULL, NULL, NULL, NULL); - VRFY((status >= 0),"testing property list inserted succeeded"); - break; case API_LINK_FALSE: @@ -699,25 +697,17 @@ coll_chunktest(const char* filename, case API_LINK_HARD: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_HARD_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); - if(prop_value !=0){/*double check if the option is switched to multiple chunk internally.*/ - status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_TO_MULTI, &prop_value); - VRFY((status >= 0),"testing property list get succeeded"); - VRFY((prop_value == 1),"API to set LINK COLLECTIVE IO without optimization succeeded"); - } + VRFY((prop_value == 0),"API to set LINK COLLECTIVE IO directly succeeded"); break; case API_MULTI_HARD: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); - VRFY((prop_value == 0),"API to set MULTI-CHUNK COLLECTIVE IO without optimization succeeded"); + VRFY((prop_value == 0),"API to set MULTI-CHUNK COLLECTIVE IO optimization succeeded"); break; case API_LINK_TRUE: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); - if(prop_value !=0){/*double check if the option is switched to multiple chunk internally.*/ - status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_TO_MULTI_OPT, &prop_value); - VRFY((status >= 0),"testing property list get succeeded"); - VRFY((prop_value == 1),"API to set LINK COLLECTIVE IO without optimization succeeded"); - } + VRFY((prop_value == 0),"API to set LINK COLLECTIVE IO succeeded"); break; case API_LINK_FALSE: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME,&prop_value); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 311d4be..1410824 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -2541,12 +2541,12 @@ none_selection_chunk(void) * H5D_mpi_chunk_collective_io, processes disagree. The root reports * collective, the rest report independent I/O * - * TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_COL: - * H5D_mpi_chunk_collective_io_no_opt, each process reports collective I/O - * - * TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE: - * H5D_mpi_chunk_collective_io_no_opt, processes disagree - * (collective and mixed I/O) + * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: + * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND. + * Set directly go to multi-chunk-io without num threshold calc. + * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: + * Same test TEST_ACTUAL_IO_MULTI_CHUNK_COL. + * Set directly go to multi-chunk-io without num threshold calc. * * TEST_ACTUAL_IO_LINK_CHUNK: * H5D_link_chunk_collective_io, processes report linked chunk I/O @@ -2565,10 +2565,17 @@ none_selection_chunk(void) * (The most complex case that works on all builds) and then performs * an independent read and write with the same dxpls. * - * It may seem like TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_IND and - * TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX have been accidentally - * left out. This is intentional; the other test cases sufficiently - * cover all cases for Multi Chunk No Opt I/O. + * Note: DIRECT_MULTI_CHUNK_MIX and DIRECT_MULTI_CHUNK_MIX_DISAGREE + * is not needed as they are covered by DIRECT_CHUNK_MIX and + * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing + * path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO insted of num-threshold. + * + * Modification: + * - Refctore to remove multi-chunk-without-opimization test and update for + * testing direct to multi-chunk-io + * Programmer: Jonathan Kim + * Date: 2012-10-10 + * * * Programmer: Jacob Gruber * Date: 2011-04-06 @@ -2583,8 +2590,8 @@ test_actual_io_mode(int selection_mode) { H5D_mpio_actual_io_mode_t actual_io_mode_expected = -1; const char * filename; const char * test_name; - hbool_t multi_chunk_no_opt; - hbool_t multi_chunk_with_opt; + hbool_t direct_multi_chunk_io; + hbool_t multi_chunk_io; hbool_t is_chunked; hbool_t is_collective; int mpi_size = -1; @@ -2611,18 +2618,18 @@ test_actual_io_mode(int selection_mode) { hsize_t count[RANK]; hsize_t block[RANK]; hbool_t use_gpfs = FALSE; + char message[256]; herr_t ret; /* Set up some flags to make some future if statements slightly more readable */ - multi_chunk_no_opt = ( - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_IND || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_COL || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE ); + direct_multi_chunk_io = ( + selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND || + selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL ); /* Note: RESET performs the same tests as MULTI_CHUNK_MIX_DISAGREE and then * tests independent I/O */ - multi_chunk_with_opt = ( + multi_chunk_io = ( selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_IND || selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_COL || selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX || @@ -2691,6 +2698,7 @@ test_actual_io_mode(int selection_mode) { /* Independent I/O with optimization */ case TEST_ACTUAL_IO_MULTI_CHUNK_IND: + case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: /* Since the dataset is chunked by row and each process selects a row, * each process writes to a different chunk. This forces all I/O to be * independent. @@ -2704,6 +2712,7 @@ test_actual_io_mode(int selection_mode) { /* Collective I/O with optimization */ case TEST_ACTUAL_IO_MULTI_CHUNK_COL: + case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: /* The dataset is chunked by rows, so each process takes a column which * spans all chunks. Since the processes write non-overlapping regular * selections to each chunk, the operation is purely collective. @@ -2797,39 +2806,6 @@ test_actual_io_mode(int selection_mode) { break; - /* Collective I/O without optimization */ - case TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_COL: - /* The dataset is chunked by rows, so when each process takes a column, its - * selection spans all chunks. Since no process writes more chunks than any - * other, colective I/O is never broken. */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - test_name = "Multi Chunk No Opt - Collective"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK_NO_OPT; - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - break; - - - /* Mixed I/O without optimization with disagreement */ - case TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE: - /* Each process takes a column, but the root's column is shortened so that - * it only reads the first chunk. Since all the other processes are writing - * to more chunks, they will break collective after the first chunk. - */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - if(mpi_rank == 0) - block[0] = block[0] / mpi_size; - - test_name = "Multi Chunk No Opt - Mixed (Disagreement)"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK_NO_OPT; - - if(mpi_rank == 0) - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - else - actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED; - - break; - /* Linked Chunk I/O */ case TEST_ACTUAL_IO_LINK_CHUNK: /* Nothing special; link chunk I/O is forced in the dxpl settings. */ @@ -2905,20 +2881,25 @@ test_actual_io_mode(int selection_mode) { ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - /* Set the threshold number of processes per chunk for link chunk I/O - * to twice mpi_size. This will prevent the threshold from ever being - * met, thus forcing multi chunk io instead of link chunk io. + /* Set the threshold number of processes per chunk to twice mpi_size. + * This will prevent the threshold from ever being met, thus forcing + * multi chunk io instead of link chunk io. + * This is via deault. */ - if(multi_chunk_with_opt) { + if(multi_chunk_io) { + /* force multi-chunk-io by threshold */ ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl_write, (unsigned) mpi_size*2); VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_num succeeded"); + /* set this to manipulate testing senario about allocating processes + * to chunks */ ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl_write, (unsigned) 99); VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_ratio succeeded"); } - /* Request multi chunk I/O without optimization */ - if(multi_chunk_no_opt) { + /* Set directly go to multi-chunk-io without threshold calc. */ + if(direct_multi_chunk_io) { + /* set for multi chunk io by property*/ ret = H5Pset_dxpl_mpio_chunk_opt(dxpl_write, H5FD_MPIO_CHUNK_MULTI_IO); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); } @@ -2961,7 +2942,6 @@ test_actual_io_mode(int selection_mode) { /* Test values */ if(actual_chunk_opt_mode_expected != (unsigned) -1 && actual_io_mode_expected != (unsigned) -1) { - char message[100]; sprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n",test_name); VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); sprintf(message, "Actual IO Mode has the correct value for %s.\n",test_name); @@ -3045,6 +3025,9 @@ actual_io_mode_tests(void) { test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); + /* + * Test multi-chunk-io via proc_num threshold + */ test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_COL); @@ -3056,8 +3039,11 @@ actual_io_mode_tests(void) { test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_COL); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE); + /* + * Test multi-chunk-io via setting direct property + */ + test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); + test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); diff --git a/testpar/t_prop.c b/testpar/t_prop.c new file mode 100644 index 0000000..4601316 --- /dev/null +++ b/testpar/t_prop.c @@ -0,0 +1,452 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Parallel tests for encoding/decoding plists sent between processes + */ + +#include "testphdf5.h" +#include "H5Pprivate.h" + +static int +test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc) +{ + MPI_Request req[2]; + MPI_Status status; + hid_t pl; /* Decoded property list */ + void *buf = NULL; + size_t buf_size = 0; + herr_t ret; /* Generic return value */ + + if(mpi_rank == 0) { + /* first call to encode returns only the size of the buffer needed */ + ret = H5Pencode(orig_pl, NULL, &buf_size); + VRFY((ret >= 0), "H5Pencode succeeded"); + + buf = (uint8_t *)HDmalloc(buf_size); + + ret = H5Pencode(orig_pl, buf, &buf_size); + VRFY((ret >= 0), "H5Pencode succeeded"); + + MPI_Isend(&buf_size, 1, MPI_INT, recv_proc, 123, MPI_COMM_WORLD, &req[0]); + MPI_Isend(buf, (int)buf_size, MPI_BYTE, recv_proc, 124, MPI_COMM_WORLD, &req[1]); + } /* end if */ + if(mpi_rank == recv_proc) { + MPI_Recv(&buf_size, 1, MPI_INT, 0, 123, MPI_COMM_WORLD, &status); + buf = (uint8_t *)HDmalloc(buf_size); + MPI_Recv(buf, (int)buf_size, MPI_BYTE, 0, 124, MPI_COMM_WORLD, &status); + + pl = H5Pdecode(buf); + VRFY((pl >= 0), "H5Pdecode succeeded"); + + VRFY(H5Pequal(orig_pl, pl), "Property List Equal Succeeded"); + + ret = H5Pclose(pl); + VRFY((ret >= 0), "H5Pclose succeeded"); + } /* end if */ + + if(0 == mpi_rank) + MPI_Waitall(2, req, MPI_STATUSES_IGNORE); + + if(NULL != buf) + HDfree(buf); + + MPI_Barrier(MPI_COMM_WORLD); + + return(0); +} + + + +void +test_plist_ed(void) +{ + hid_t dcpl; /* dataset create prop. list */ + hid_t dapl; /* dataset access prop. list */ + hid_t dxpl; /* dataset transfer prop. list */ + hid_t gcpl; /* group create prop. list */ + hid_t lcpl; /* link create prop. list */ + hid_t lapl; /* link access prop. list */ + hid_t ocpypl; /* object copy prop. list */ + hid_t ocpl; /* object create prop. list */ + hid_t fapl; /* file access prop. list */ + hid_t fcpl; /* file create prop. list */ + hid_t strcpl; /* string create prop. list */ + hid_t acpl; /* attribute create prop. list */ + + int mpi_size, mpi_rank, recv_proc; + + hsize_t chunk_size = 16384; /* chunk size */ + double fill = 2.7f; /* Fill value */ + size_t nslots = 521*2; + size_t nbytes = 1048576 * 10; + double w0 = 0.5f; + unsigned max_compact; + unsigned min_dense; + hsize_t max_size[1]; /*data space maximum size */ + const char* c_to_f = "x+32"; + H5AC_cache_config_t my_cache_config = { + H5AC__CURR_CACHE_CONFIG_VERSION, + TRUE, + FALSE, + FALSE, + "temp", + TRUE, + FALSE, + ( 2 * 2048 * 1024), + 0.3f, + (64 * 1024 * 1024), + (4 * 1024 * 1024), + 60000, + H5C_incr__threshold, + 0.8f, + 3.0f, + TRUE, + (8 * 1024 * 1024), + H5C_flash_incr__add_space, + 2.0f, + 0.25f, + H5C_decr__age_out_with_threshold, + 0.997f, + 0.8f, + TRUE, + (3 * 1024 * 1024), + 3, + FALSE, + 0.2f, + (256 * 2048), + H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; + + herr_t ret; /* Generic return value */ + + + if(VERBOSE_MED) + printf("Encode/Decode DCPLs\n"); + + /* set up MPI parameters */ + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + if(mpi_size == 1) + recv_proc = 0; + else + recv_proc = 1; + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + VRFY((dcpl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_chunk(dcpl, 1, &chunk_size); + VRFY((ret >= 0), "H5Pset_chunk succeeded"); + + ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); + VRFY((ret >= 0), "H5Pset_alloc_time succeeded"); + + ret = H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill); + VRFY((ret>=0), "set fill-value succeeded"); + + max_size[0] = 100; + ret = H5Pset_external(dcpl, "ext1.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4)); + VRFY((ret>=0), "set external succeeded"); + ret = H5Pset_external(dcpl, "ext2.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4)); + VRFY((ret>=0), "set external succeeded"); + ret = H5Pset_external(dcpl, "ext3.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4)); + VRFY((ret>=0), "set external succeeded"); + ret = H5Pset_external(dcpl, "ext4.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int)/4)); + VRFY((ret>=0), "set external succeeded"); + + ret = test_encode_decode(dcpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(dcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE DAPLS *****/ + dapl = H5Pcreate(H5P_DATASET_ACCESS); + VRFY((dapl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_chunk_cache(dapl, nslots, nbytes, w0); + VRFY((ret >= 0), "H5Pset_chunk_cache succeeded"); + + ret = test_encode_decode(dapl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(dapl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE OCPLS *****/ + ocpl = H5Pcreate(H5P_OBJECT_CREATE); + VRFY((ocpl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); + VRFY((ret >= 0), "H5Pset_attr_creation_order succeeded"); + + ret = H5Pset_attr_phase_change(ocpl, 110, 105); + VRFY((ret >= 0), "H5Pset_attr_phase_change succeeded"); + + ret = H5Pset_filter(ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL); + VRFY((ret >= 0), "H5Pset_filter succeeded"); + + ret = test_encode_decode(ocpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(ocpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE DXPLS *****/ + dxpl = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f); + VRFY((ret >= 0), "H5Pset_btree_ratios succeeded"); + + ret = H5Pset_hyper_vector_size(dxpl, 5); + VRFY((ret >= 0), "H5Pset_hyper_vector_size succeeded"); + + ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + + ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret >= 0), "H5Pset_dxpl_mpio_collective_opt succeeded"); + + ret = H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO); + VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt succeeded"); + + ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30); + VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_ratio succeeded"); + + ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40); + VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_num succeeded"); + + ret = H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC); + VRFY((ret >= 0), "H5Pset_edc_check succeeded"); + + ret = H5Pset_data_transform(dxpl, c_to_f); + VRFY((ret >= 0), "H5Pset_data_transform succeeded"); + + ret = test_encode_decode(dxpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(dxpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE GCPLS *****/ + gcpl = H5Pcreate(H5P_GROUP_CREATE); + VRFY((gcpl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_local_heap_size_hint(gcpl, 256); + VRFY((ret >= 0), "H5Pset_local_heap_size_hint succeeded"); + + ret = H5Pset_link_phase_change(gcpl, 2, 2); + VRFY((ret >= 0), "H5Pset_link_phase_change succeeded"); + + /* Query the group creation properties */ + ret = H5Pget_link_phase_change(gcpl, &max_compact, &min_dense); + VRFY((ret >= 0), "H5Pget_est_link_info succeeded"); + + ret = H5Pset_est_link_info(gcpl, 3, 9); + VRFY((ret >= 0), "H5Pset_est_link_info succeeded"); + + ret = H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); + VRFY((ret >= 0), "H5Pset_link_creation_order succeeded"); + + ret = test_encode_decode(gcpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(gcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE LCPLS *****/ + lcpl = H5Pcreate(H5P_LINK_CREATE); + VRFY((lcpl >= 0), "H5Pcreate succeeded"); + + ret= H5Pset_create_intermediate_group(lcpl, TRUE); + VRFY((ret >= 0), "H5Pset_create_intermediate_group succeeded"); + + ret = test_encode_decode(lcpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(lcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE LAPLS *****/ + lapl = H5Pcreate(H5P_LINK_ACCESS); + VRFY((lapl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_nlinks(lapl, (size_t)134); + VRFY((ret >= 0), "H5Pset_nlinks succeeded"); + + ret = H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY); + VRFY((ret >= 0), "H5Pset_elink_acc_flags succeeded"); + + ret = H5Pset_elink_prefix(lapl, "/tmpasodiasod"); + VRFY((ret >= 0), "H5Pset_nlinks succeeded"); + + /* Create FAPL for the elink FAPL */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl >= 0), "H5Pcreate succeeded"); + ret = H5Pset_alignment(fapl, 2, 1024); + VRFY((ret >= 0), "H5Pset_alignment succeeded"); + + ret = H5Pset_elink_fapl(lapl, fapl); + VRFY((ret >= 0), "H5Pset_elink_fapl succeeded"); + + /* Close the elink's FAPL */ + ret = H5Pclose(fapl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + ret = test_encode_decode(lapl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(lapl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE OCPYPLS *****/ + ocpypl = H5Pcreate(H5P_OBJECT_COPY); + VRFY((ocpypl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG); + VRFY((ret >= 0), "H5Pset_copy_object succeeded"); + + ret = H5Padd_merge_committed_dtype_path(ocpypl, "foo"); + VRFY((ret >= 0), "H5Padd_merge_committed_dtype_path succeeded"); + + ret = H5Padd_merge_committed_dtype_path(ocpypl, "bar"); + VRFY((ret >= 0), "H5Padd_merge_committed_dtype_path succeeded"); + + ret = test_encode_decode(ocpypl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(ocpypl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE FAPLS *****/ + fapl = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_family_offset(fapl, 1024); + VRFY((ret >= 0), "H5Pset_family_offset succeeded"); + + ret = H5Pset_meta_block_size(fapl, 2098452); + VRFY((ret >= 0), "H5Pset_meta_block_size succeeded"); + + ret = H5Pset_sieve_buf_size(fapl, 1048576); + VRFY((ret >= 0), "H5Pset_sieve_buf_size succeeded"); + + ret = H5Pset_alignment(fapl, 2, 1024); + VRFY((ret >= 0), "H5Pset_alignment succeeded"); + + ret = H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f); + VRFY((ret >= 0), "H5Pset_cache succeeded"); + + ret = H5Pset_elink_file_cache_size(fapl, 10485760); + VRFY((ret >= 0), "H5Pset_elink_file_cache_size succeeded"); + + ret = H5Pset_gc_references(fapl, 1); + VRFY((ret >= 0), "H5Pset_gc_references succeeded"); + + ret = H5Pset_small_data_block_size(fapl, 2048); + VRFY((ret >= 0), "H5Pset_small_data_block_size succeeded"); + + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + VRFY((ret >= 0), "H5Pset_libver_bounds succeeded"); + + ret = H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK); + VRFY((ret >= 0), "H5Pset_fclose_degree succeeded"); + + ret = H5Pset_multi_type(fapl, H5FD_MEM_GHEAP); + VRFY((ret >= 0), "H5Pset_multi_type succeeded"); + + ret = H5Pset_mdc_config(fapl, &my_cache_config); + VRFY((ret >= 0), "H5Pset_mdc_config succeeded"); + + ret = test_encode_decode(fapl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(fapl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE FCPLS *****/ + fcpl = H5Pcreate(H5P_FILE_CREATE); + VRFY((fcpl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_userblock(fcpl, 1024); + VRFY((ret >= 0), "H5Pset_userblock succeeded"); + + ret = H5Pset_istore_k(fcpl, 3); + VRFY((ret >= 0), "H5Pset_istore_k succeeded"); + + ret = H5Pset_sym_k(fcpl, 4, 5); + VRFY((ret >= 0), "H5Pset_sym_k succeeded"); + + ret = H5Pset_shared_mesg_nindexes(fcpl, 8); + VRFY((ret >= 0), "H5Pset_shared_mesg_nindexes succeeded"); + + ret = H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32); + VRFY((ret >= 0), "H5Pset_shared_mesg_index succeeded"); + + ret = H5Pset_shared_mesg_phase_change(fcpl, 60, 20); + VRFY((ret >= 0), "H5Pset_shared_mesg_phase_change succeeded"); + + ret = H5Pset_sizes(fcpl, 8, 4); + VRFY((ret >= 0), "H5Pset_sizes succeeded"); + + ret = test_encode_decode(fcpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(fcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE STRCPLS *****/ + strcpl = H5Pcreate(H5P_STRING_CREATE); + VRFY((strcpl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_char_encoding(strcpl, H5T_CSET_UTF8); + VRFY((ret >= 0), "H5Pset_char_encoding succeeded"); + + ret = test_encode_decode(strcpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(strcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + + + /******* ENCODE/DECODE ACPLS *****/ + acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE); + VRFY((acpl >= 0), "H5Pcreate succeeded"); + + ret = H5Pset_char_encoding(acpl, H5T_CSET_UTF8); + VRFY((ret >= 0), "H5Pset_char_encoding succeeded"); + + ret = test_encode_decode(acpl, mpi_rank, recv_proc); + VRFY((ret >= 0), "test_encode_decode succeeded"); + + ret = H5Pclose(acpl); + VRFY((ret >= 0), "H5Pclose succeeded"); +} + diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index a4df46e..784892a 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -440,7 +440,7 @@ int main(int argc, char **argv) "linked chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6", coll_chunk6,NULL, - "multi-chunk collective IO without optimization",PARATESTFILE); + "multi-chunk collective IO with direct request",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7", coll_chunk7,NULL, "linked chunk collective IO with optimization",PARATESTFILE); @@ -510,6 +510,9 @@ int main(int argc, char **argv) "test cause for broken collective io", PARATESTFILE); + AddTest("edpl", test_plist_ed, NULL, + "encode/decode Property Lists", NULL); + if((mpi_size < 2) && MAINPROCESS) { printf("File Image Ops daisy chain test needs at least 2 processes.\n"); printf("File Image Ops daisy chain test will be skipped \n"); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 29ad411..fa83697 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -169,11 +169,10 @@ enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD, #define TEST_ACTUAL_IO_MULTI_CHUNK_COL 3 #define TEST_ACTUAL_IO_MULTI_CHUNK_MIX 4 #define TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE 5 -#define TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_IND 6 -#define TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_COL 7 -#define TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE 8 -#define TEST_ACTUAL_IO_LINK_CHUNK 9 -#define TEST_ACTUAL_IO_CONTIGUOUS 10 +#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND 6 +#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL 7 +#define TEST_ACTUAL_IO_LINK_CHUNK 8 +#define TEST_ACTUAL_IO_CONTIGUOUS 9 /* Definitions of the selection mode for the no_collective_cause_tests function. */ #define TEST_COLLECTIVE 0x001 @@ -234,6 +233,7 @@ extern int facc_type; /*Test file access type */ extern int dxfer_coll_type; /* Test program prototypes */ +void test_plist_ed(void); void multiple_dset_write(void); void multiple_group_write(void); void multiple_group_read(void); diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c index ee98d7e..8fc7144 100644 --- a/tools/h5copy/h5copygentest.c +++ b/tools/h5copy/h5copygentest.c @@ -287,14 +287,14 @@ static void gent_nested_vl(hid_t loc_id) /* allocate and initialize VL dataset to write */ buf[0].len = 1; buf[0].p = malloc( 1 * sizeof(hvl_t)); - tvl = buf[0].p; + tvl = (hvl_t *)buf[0].p; tvl->p = malloc( 1 * sizeof(int) ); tvl->len = 1; ((int *)tvl->p)[0]=1; buf[1].len = 1; buf[1].p = malloc( 1 * sizeof(hvl_t)); - tvl = buf[1].p; + tvl = (hvl_t *)buf[1].p; tvl->p = malloc( 2 * sizeof(int) ); tvl->len = 2; ((int *)tvl->p)[0]=2; @@ -645,7 +645,7 @@ out: * Purpose: Testing with various objects * *------------------------------------------------------------------------*/ -static void Test_Obj_Copy() +static void Test_Obj_Copy(void) { hid_t fid = (-1); /* File id */ hid_t fapl_new = (-1); /* File access property id */ @@ -699,7 +699,7 @@ out: * Purpose: Testing with various references * *------------------------------------------------------------------------*/ -static void Test_Ref_Copy() +static void Test_Ref_Copy(void) { hid_t fid=0; herr_t status; @@ -865,7 +865,7 @@ out: * Purpose: gerenate external link files * *------------------------------------------------------------------------*/ -static void Test_Extlink_Copy() +static void Test_Extlink_Copy(void) { hid_t fid1=0; hid_t fid2=0; diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 8bd684e..e1ade89 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -160,6 +160,7 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tscaleoffset.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tshuffle.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink-1.ddl @@ -263,6 +264,7 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-m.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-r.h5 @@ -1023,6 +1025,8 @@ IF (BUILD_TESTING) tscalarintsize.out.err tscalarattrintsize.out tscalarattrintsize.out.err + tscalarstring.out + tscalarstring.out.err tscaleoffset.out tscaleoffset.out.err tshuffle.out @@ -1094,6 +1098,8 @@ IF (BUILD_TESTING) ADD_H5_TEST (tcmpdattrintsize 0 --enable-error-stack tcmpdattrintsize.h5) # test for signed/unsigned scalar attributes ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5) + # test for string scalar dataset and attribute + ADD_H5_TEST (tscalarstring 0 --enable-error-stack tscalarstring.h5) # test for displaying groups ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 2921fb9..34b8bc4 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -932,7 +932,7 @@ parse_mask_list(const char *h_list) static void free_handler(struct handler_t *hand, int len) { - register int i; + int i; if(hand) { for (i = 0; i < len; i++) { @@ -997,7 +997,7 @@ parse_command_line(int argc, const char *argv[]) /* this will be plenty big enough to hold the info */ if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) { - goto error; + goto error; } /* parse command line options */ @@ -1054,7 +1054,7 @@ parse_start: break; case 'w': h5tools_nCols = HDatoi(opt_arg); - if (h5tools_nCols==0) { + if (h5tools_nCols <= 0) { h5tools_nCols = 65535; } last_was_dset = FALSE; @@ -1293,7 +1293,7 @@ parse_start: if (s->count.data) { HDfree(s->count.data); s->count.data = NULL; - } + } parse_hsize_list(opt_arg, &s->count); break; case 'k': @@ -1356,6 +1356,7 @@ error: return hand; } + /*------------------------------------------------------------------------- * Function: main @@ -1423,6 +1424,7 @@ 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); @@ -1449,28 +1451,28 @@ main(int argc, const char *argv[]) "to display selected objects"); h5tools_setstatus(EXIT_FAILURE); goto done; - } + } else if (display_bb) { error_msg("option \"%s\" not available for XML\n", "--boot-block"); h5tools_setstatus(EXIT_FAILURE); goto done; - } + } else if (display_oid == 1) { error_msg("option \"%s\" not available for XML\n", "--object-ids"); h5tools_setstatus(EXIT_FAILURE); goto done; - } + } else if (display_char == TRUE) { error_msg("option \"%s\" not available for XML\n", "--string"); h5tools_setstatus(EXIT_FAILURE); goto done; - } + } else if (usingdasho) { error_msg("option \"%s\" not available for XML\n", "--output"); h5tools_setstatus(EXIT_FAILURE); goto done; } - } + } else { if (xml_dtd_uri) { warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri); diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 1a29659..28264e7 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -3761,7 +3761,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) /* Print information about storage layout */ if (H5D_CHUNKED == H5Pget_layout(dcpl)) { maxdims = H5Sget_simple_extent_ndims(space); - chsize = (hsize_t *) HDmalloc(maxdims * sizeof(hsize_t)); + HDassert(maxdims >= 0); + chsize = (hsize_t *)HDmalloc((size_t)maxdims * sizeof(hsize_t)); ctx.indent_level++; dump_indent += COL; diff --git a/tools/h5dump/h5dump_xml.h b/tools/h5dump/h5dump_xml.h index 04d02c9..d4c8365 100644 --- a/tools/h5dump/h5dump_xml.h +++ b/tools/h5dump/h5dump_xml.h @@ -103,14 +103,6 @@ static h5tool_format_t xml_dataformat = { extern "C" { #endif -/* internal functions used by XML option */ -static void xml_print_datatype(hid_t, unsigned); -static void xml_print_enum(hid_t); -static int xml_print_refs(hid_t, int); -static int xml_print_strs(hid_t, int); -static char *xml_escape_the_string(const char *, int); -static char *xml_escape_the_name(const char *); - /* The dump functions of the dump_function_table */ /* XML format: same interface, alternative output */ diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 28fb4a4..d56fed5 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -105,6 +105,7 @@ #define FILE72 "tnestedcmpddt.h5" #define FILE73 "tscalarintsize.h5" #define FILE74 "tscalarattrintsize.h5" +#define FILE75 "tscalarstring.h5" /*------------------------------------------------------------------------- * prototypes @@ -8210,7 +8211,7 @@ static void gent_nested_compound_dt(void) { /* test nested data type */ /*------------------------------------------------------------------------- * Function: gent_intscalars * - * Purpose: Generate a file to be used in the h5dump tests. + * Purpose: Generate a file to be used in the h5dump scalar tests. * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created. * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created. * Fill them with raw data such that no bit will be all zero in a dataset. @@ -8390,7 +8391,7 @@ gent_intscalars(void) /* Double Dummy set for failure tests */ dims[0] = F73_XDIM; dims[1] = F73_YDIM8; space = H5Screate(H5S_SCALAR); - tid = H5Tarray_create2(H5T_IEEE_F64BE, F73_ARRAY_RANK, dims); + tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims); dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < dims[0]; i++) @@ -8405,9 +8406,9 @@ gent_intscalars(void) } /*------------------------------------------------------------------------- - * Function: gent_attr_packedbits + * Function: gent_attr_intscalars * - * Purpose: Generate a file to be used in the h5dump packed bits tests. + * Purpose: Generate a file to be used in the h5dump attribute scalar tests. * Four attributes of 1, 2, 4 and 8 bytes of unsigned int types are created. * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created. * Fill them with raw data such that no bit will be all zero in a dataset. @@ -8589,7 +8590,7 @@ gent_attr_intscalars(void) /* Double Dummy set for failure tests */ dims[0] = F73_XDIM; dims[1] = F73_YDIM8; space = H5Screate(H5S_SCALAR); - tid = H5Tarray_create2(H5T_IEEE_F64BE, F73_ARRAY_RANK, dims); + tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims); attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < dims[0]; i++) @@ -8606,6 +8607,58 @@ gent_attr_intscalars(void) } /*------------------------------------------------------------------------- + * Function: gent_string_scalars + * + * Purpose: Generate a file to be used in the h5dump string scalar tests. + * A dataset of string types are created. + * An attribute of string types are created. + * Fill them with raw data such that no bit will be all zero in a dataset. + *------------------------------------------------------------------------- + */ +static void +gent_string_scalars(void) +{ + hid_t fid, attr, dataset, space, tid, root; + hsize_t dims[2]; + char string[F73_XDIM][F73_YDIM8]; + unsigned int i, j; + + fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + root = H5Gopen2(fid, "/", H5P_DEFAULT); + + /* string scalar */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM8; + space = H5Screate(H5S_SCALAR); + tid = H5Tcopy(H5T_C_S1); + H5Tset_size(tid, F73_XDIM * F73_YDIM8); + + memset(string, ' ', F73_XDIM * F73_YDIM8); + for(i = 0; i < dims[0]; i++) { + string[i][0] = 'A' + i; + for(j = 1; j < dims[1]; j++) { + string[i][j] = string[i][j-1] + 1; + } + } + string[dims[0]-1][dims[1]-1] = 0; + + /* Dataset of string scalar */ + dataset = H5Dcreate2(fid, "the_str", tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, string); + H5Dclose(dataset); + + /* attribute of string scalar */ + attr = H5Acreate2(root, "attr_str", tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, string); + + H5Sclose(space); + H5Aclose(attr); + + H5Gclose(root); + H5Fclose(fid); +} + +/*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- @@ -8690,6 +8743,7 @@ int main(void) gent_nested_compound_dt(); gent_intscalars(); gent_attr_intscalars(); + gent_string_scalars(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index c90c364..8a2483b 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -145,6 +145,7 @@ $SRC_H5DUMP_TESTFILES/tordergr.h5 $SRC_H5DUMP_TESTFILES/tsaf.h5 $SRC_H5DUMP_TESTFILES/tscalarintsize.h5 $SRC_H5DUMP_TESTFILES/tscalarattrintsize.h5 +$SRC_H5DUMP_TESTFILES/tscalarstring.h5 $SRC_H5DUMP_TESTFILES/tslink.h5 $SRC_H5DUMP_TESTFILES/tsplit_file-m.h5 $SRC_H5DUMP_TESTFILES/tsplit_file-r.h5 @@ -281,6 +282,7 @@ $SRC_H5DUMP_TESTFILES/treference.ddl $SRC_H5DUMP_TESTFILES/tsaf.ddl $SRC_H5DUMP_TESTFILES/tscalarintsize.ddl $SRC_H5DUMP_TESTFILES/tscalarattrintsize.ddl +$SRC_H5DUMP_TESTFILES/tscalarstring.ddl $SRC_H5DUMP_TESTFILES/tscaleoffset.ddl $SRC_H5DUMP_TESTFILES/tshuffle.ddl $SRC_H5DUMP_TESTFILES/tslink-1.ddl @@ -690,6 +692,8 @@ TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5 TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5 # test for signed/unsigned scalar attributes TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5 +# test for string scalar dataset attribute +TOOLTEST tscalarstring.ddl --enable-error-stack tscalarstring.h5 # test for displaying groups TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5 # test for displaying the selected groups diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 34870fb..9497e58 100644 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -32,6 +32,43 @@ #define READ_OPEN_FLAGS "r" #endif +/* Local function declarations */ +static int gtoken(char *s); +static int process(struct Options *opt); +static int processConfigurationFile(char *infile, struct Input *in); +static int mapKeywordToIndex(char *key); +static int parsePathInfo(struct path_info *path, char *strm); +static int parseDimensions(struct Input *in, char *strm); +static int getInputSize(struct Input *in, int ival); +static int getInputClass(struct Input *in, char * strm); +static int getInputClassType(struct Input *in, char * strm); +static int InputClassStrToInt(char *temp); +static int getRank(struct Input *in, FILE *strm); +static int getDimensionSizes(struct Input *in, FILE *strm); +static int getOutputSize(struct Input *in, FILE *strm); +static int getOutputClass(struct Input *in, FILE *strm); +static int OutputClassStrToInt(char *temp); +static int getOutputArchitecture(struct Input *in, FILE *strm); +static int OutputArchStrToInt(const char *temp); +static int getOutputByteOrder(struct Input *in, FILE *strm); +static int OutputByteOrderStrToInt(const char *temp); +static int getChunkedDimensionSizes(struct Input *in, FILE *strm); +static int getCompressionType(struct Input *in, FILE *strm); +static int CompressionTypeStrToInt(char *temp); +static int getCompressionParameter(struct Input *in, FILE *strm); +static int getExternalFilename(struct Input *in, FILE *strm); +static int getMaximumDimensionSizes(struct Input *in, FILE *strm); +static int processDataFile(char *infile, struct Input *in, hid_t file_id); +static int readIntegerData(FILE *strm, struct Input *in); +static int readFloatData(FILE *strm, struct Input *in); +static int allocateIntegerStorage(struct Input *in); +static int allocateFloatStorage(struct Input *in); +static int readUIntegerData(FILE *strm, struct Input *in); +static int allocateUIntegerStorage(struct Input *in); +static int validateConfigurationParameters(struct Input *in); +static int processStrData(FILE *strm, struct Input *in, hid_t file_id); +static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id); + int main(int argc, char *argv[]) { struct Options opt; @@ -301,7 +338,7 @@ static int gtoken(char *s) static int processDataFile(char *infile, struct Input *in, hid_t file_id) { - FILE *strm; + FILE *strm = NULL; const char *err1 = "Unable to open the input file %s for reading.\n"; const char *err2 = "Error in allocating integer data storage.\n"; const char *err3 = "Error in allocating floating-point data storage.\n"; @@ -311,6 +348,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) const char *err7 = "Error in reading unsigned integer data.\n"; const char *err10 = "Unrecognized input class type.\n"; const char *err11 = "Error in reading string data.\n"; + int retval = -1; /*------------------------------------------------------------------------- * special case for opening binary classes in H5_HAVE_WIN32_API @@ -323,7 +361,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) if ((strm = HDfopen(infile, READ_OPEN_FLAGS)) == NULL) { (void) HDfprintf(stderr, err1, infile); - return (-1); + goto error; } } /*------------------------------------------------------------------------- @@ -333,7 +371,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) else { if ((strm = HDfopen(infile, "r")) == NULL) { (void) HDfprintf(stderr, err1, infile); - return (-1); + goto error; } } @@ -342,14 +380,12 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) case 4: /* IN */ if (allocateIntegerStorage(in) == -1) { (void) HDfprintf(stderr, err2, infile); - HDfclose(strm); - return (-1); + goto error; } if (readIntegerData(strm, in) == -1) { (void) HDfprintf(stderr, err4, infile); - HDfclose(strm); - return (-1); + goto error; } break; @@ -358,15 +394,13 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) case 3: /* FP */ if (allocateFloatStorage(in) == -1) { (void) HDfprintf(stderr, err3, infile); - HDfclose(strm); - return (-1); + goto error; } if (readFloatData(strm, in) == -1) { (void) HDfprintf(stderr, err5, infile); - HDfclose(strm); - return (-1); + goto error; } break; @@ -374,15 +408,13 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) if (in->h5dumpInput) { if (processStrHDFData(strm, in, file_id) == -1) { (void) HDfprintf(stderr, err11, infile); - HDfclose(strm); - return (-1); + goto error; } } else { if (processStrData(strm, in, file_id) == -1) { (void) HDfprintf(stderr, err11, infile); - HDfclose(strm); - return (-1); + goto error; } } @@ -392,23 +424,26 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) case 7: /* UIN */ if (allocateUIntegerStorage(in) == -1) { (void) HDfprintf(stderr, err6, infile); - HDfclose(strm); - return (-1); + goto error; } if (readUIntegerData(strm, in) == -1) { (void) HDfprintf(stderr, err7, infile); - HDfclose(strm); - return (-1); + goto error; } break; default: (void) HDfprintf(stderr, "%s", err10); - HDfclose(strm); - return (-1); + goto error; } - HDfclose(strm); - return (0); + + /* Set success return value */ + retval = 0; + +error: + if(strm) + HDfclose(strm); + return(retval); } static int readIntegerData(FILE *strm, struct Input *in) @@ -1251,12 +1286,13 @@ static int allocateFloatStorage(struct Input *in) static int processConfigurationFile(char *infile, struct Input *in) { - FILE *strm; + FILE *strm = NULL; char key[255]; int kindex; char temp[255]; int ival; int scanret; + int retval = -1; const char *err1 = "Unable to open the configuration file: %s for reading.\n"; const char *err2 = "Unknown keyword in configuration file: %s\n"; @@ -1303,7 +1339,7 @@ static int processConfigurationFile(char *infile, struct Input *in) if ((strm = HDfopen(infile, "r")) == NULL) { (void) HDfprintf(stderr, err1, infile); - return (-1); + goto error; } scanret = fscanf(strm, "%s", key); @@ -1323,21 +1359,18 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (in->configOptionVector[PATH] == 1) { (void) HDfprintf(stderr, err3a, infile); - HDfclose(strm); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASET %s found\n", temp); #endif if (parsePathInfo(&in->path, temp) == -1) { (void) HDfprintf(stderr, err3b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[PATH] = 1; scanret = fscanf(strm, "%s", temp); /* start bracket */ @@ -1351,22 +1384,19 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (in->configOptionVector[INPUT_CLASS] == 1) { (void) HDfprintf(stderr, err4a, infile); - HDfclose(strm); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE %s found\n", temp); #endif if ((kindex = getInputClassType(in, temp)) == -1) { (void) HDfprintf(stderr, err4b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE type %d inputClass\n", in->inputClass); @@ -1396,23 +1426,20 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE STRING %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* string properties */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } while (get_next_prop) { if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */ if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err19); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE STRING STRSIZE %s found\n", temp); @@ -1422,8 +1449,7 @@ static int processConfigurationFile(char *infile, struct Input *in) ival = HDstrtol(more, &more, 10); if (getInputSize(in, ival) == -1) { (void) HDfprintf(stderr, err5b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize); @@ -1433,8 +1459,7 @@ static int processConfigurationFile(char *infile, struct Input *in) else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */ if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE STRING STRPAD %s found\n", temp); @@ -1443,8 +1468,7 @@ static int processConfigurationFile(char *infile, struct Input *in) else if(!HDstrcmp("CSET", key)) { /* CSET */ if (fscanf(strm, "%s", temp) != 1) { /* CSET type */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE STRING CSET %s found\n", temp); @@ -1454,8 +1478,7 @@ static int processConfigurationFile(char *infile, struct Input *in) else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */ if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE STRING CTYPE %s found\n", temp); @@ -1463,8 +1486,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("CSET", key)) */ if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATATYPE STRING %s found\n", temp); @@ -1483,16 +1505,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } if(!HDstrcmp("SCALAR", temp)) { /* SCALAR */ in->rank = 0; } /* if(!HDstrcmp("SCALAR", key)) */ else if(!HDstrcmp("NULL", temp)) { /* NULL */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } /* else if(!HDstrcmp("NULL", key)) */ else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */ int icount = 0; @@ -1501,16 +1521,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); @@ -1521,8 +1539,7 @@ static int processConfigurationFile(char *infile, struct Input *in) if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); @@ -1532,8 +1549,7 @@ static int processConfigurationFile(char *infile, struct Input *in) temp_dims[icount] = HDstrtoull(more, &more, 10); if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); @@ -1547,15 +1563,13 @@ static int processConfigurationFile(char *infile, struct Input *in) icount++; if (icount > MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); - HDfclose(strm); - return (-1); + goto error; } } } /* while (get_next_dim) */ if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { - (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %d rank\n", in->rank); @@ -1574,26 +1588,22 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("(", key)) start paren */ else { (void) HDfprintf(stderr, err5b, infile); - HDfclose(strm); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp("/", temp)) { /* / max dims */ if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { - (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); @@ -1607,8 +1617,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */ (void) HDfprintf(stderr, err16c, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); @@ -1627,8 +1636,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */ (void) HDfprintf(stderr, err16c, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump DATASPACE SIMPLE %s found\n", temp); @@ -1640,8 +1648,7 @@ static int processConfigurationFile(char *infile, struct Input *in) i++; if (i > MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); - HDfclose(strm); - return (-1); + goto error; } } } /* while (get_next_dim) */ @@ -1656,8 +1663,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("(", key)) start paren */ else { (void) HDfprintf(stderr, err16c, infile); - HDfclose(strm); - return (-1); + goto error; } scanret = fscanf(strm, "%s", temp); /* end bracket */ #ifdef H5DEBUGIMPORT @@ -1667,8 +1673,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* else if(!HDstrcmp("SIMPLE", key)) */ else { (void) HDfprintf(stderr, err5b, infile); - HDfclose(strm); - return (-1); + goto error; } } /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */ else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */ @@ -1677,16 +1682,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT %s found\n", temp); @@ -1694,12 +1697,11 @@ static int processConfigurationFile(char *infile, struct Input *in) if(!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */ if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); @@ -1710,8 +1712,7 @@ static int processConfigurationFile(char *infile, struct Input *in) if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); @@ -1721,8 +1722,7 @@ static int processConfigurationFile(char *infile, struct Input *in) in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10); if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); @@ -1735,8 +1735,7 @@ static int processConfigurationFile(char *infile, struct Input *in) icount++; if (icount > MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); - HDfclose(strm); - return (-1); + goto error; } } } /* while (get_next_dim) */ @@ -1751,13 +1750,11 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("(", key)) start paren */ else { (void) HDfprintf(stderr, err5b, infile); - HDfclose(strm); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { /* SIZE */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); @@ -1765,8 +1762,7 @@ static int processConfigurationFile(char *infile, struct Input *in) if(!HDstrcmp("SIZE", temp)) { /* SIZE */ if (fscanf(strm, "%d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival); @@ -1775,8 +1771,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (HDstrcmp("}", temp)) { if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); @@ -1791,16 +1786,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS %s found\n", temp); @@ -1811,32 +1804,28 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif if (fscanf(strm, "%d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); @@ -1844,8 +1833,7 @@ static int processConfigurationFile(char *infile, struct Input *in) in->compressionParam = ival; if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS COMPRESSION %s found\n", temp); @@ -1867,8 +1855,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } #ifdef H5DEBUGIMPORT printf("h5dump FILTERS %s found\n", temp); @@ -1909,25 +1896,21 @@ static int processConfigurationFile(char *infile, struct Input *in) while (scanret == 1) { if ((kindex = mapKeywordToIndex(key)) == -1) { (void) HDfprintf(stderr, err2, infile); - HDfclose(strm); - return (-1); + goto error; } switch (kindex) { case 0: /* PATH */ if (in->configOptionVector[PATH] == 1) { (void) HDfprintf(stderr, err3a, infile); - HDfclose(strm); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } if (parsePathInfo(&in->path, temp) == -1) { (void) HDfprintf(stderr, err3b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[PATH] = 1; break; @@ -1935,19 +1918,16 @@ static int processConfigurationFile(char *infile, struct Input *in) case 1: /* INPUT-CLASS */ if (in->configOptionVector[INPUT_CLASS] == 1) { (void) HDfprintf(stderr, err4a, infile); - HDfclose(strm); - return (-1); + goto error; } if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); - HDfclose(strm); - return (-1); + goto error; } if (getInputClass(in, temp) == -1) { (void) HDfprintf(stderr, err4b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[INPUT_CLASS] = 1; @@ -1967,18 +1947,15 @@ static int processConfigurationFile(char *infile, struct Input *in) case 2: /* INPUT-SIZE */ if (in->configOptionVector[INPUT_SIZE] == 1) { (void) HDfprintf(stderr, err5a, infile); - HDfclose(strm); - return (-1); + goto error; } if (fscanf(strm, "%d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); - HDfclose(strm); - return (-1); + goto error; } if (getInputSize(in, ival) == -1) { (void) HDfprintf(stderr, err5b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[INPUT_SIZE] = 1; @@ -1990,14 +1967,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 3: /* RANK */ if (in->configOptionVector[RANK] == 1) { (void) HDfprintf(stderr, err6a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getRank(in, strm) == -1) { (void) HDfprintf(stderr, err6b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[RANK] = 1; break; @@ -2005,19 +1980,16 @@ static int processConfigurationFile(char *infile, struct Input *in) case 4: /* DIMENSION-SIZES */ if (in->configOptionVector[DIM] == 1) { (void) HDfprintf(stderr, err7a, infile); - HDfclose(strm); - return (-1); + goto error; } if (in->configOptionVector[RANK] == 0) { (void) HDfprintf(stderr, err7b, infile); - HDfclose(strm); - return (-1); + goto error; } if (getDimensionSizes(in, strm) == -1) { (void) HDfprintf(stderr, err7c, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[DIM] = 1; break; @@ -2025,14 +1997,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 5: /* OUTPUT-CLASS */ if (in->configOptionVector[OUTPUT_CLASS] == 1) { (void) HDfprintf(stderr, err8a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getOutputClass(in, strm) == -1) { (void) HDfprintf(stderr, err8b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[OUTPUT_CLASS] = 1; break; @@ -2040,14 +2010,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 6: /* OUTPUT-SIZE */ if (in->configOptionVector[OUTPUT_SIZE] == 1) { (void) HDfprintf(stderr, err9a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getOutputSize(in, strm) == -1) { (void) HDfprintf(stderr, err9b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[OUTPUT_SIZE] = 1; break; @@ -2055,14 +2023,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 7: /* OUTPUT-ARCHITECTURE */ if (in->configOptionVector[OUTPUT_ARCH] == 1) { (void) HDfprintf(stderr, err10a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getOutputArchitecture(in, strm) == -1) { (void) HDfprintf(stderr, err10b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[OUTPUT_ARCH] = 1; break; @@ -2070,14 +2036,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 8: /* OUTPUT-BYTE-ORDER */ if (in->configOptionVector[OUTPUT_B_ORDER] == 1) { (void) HDfprintf(stderr, err11a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getOutputByteOrder(in, strm) == -1) { (void) HDfprintf(stderr, err11b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[OUTPUT_B_ORDER] = 1; break; @@ -2085,20 +2049,17 @@ static int processConfigurationFile(char *infile, struct Input *in) case 9: /* CHUNKED-DIMENSION-SIZES */ if (in->configOptionVector[CHUNK] == 1) { (void) HDfprintf(stderr, err12a, infile); - HDfclose(strm); - return (-1); + goto error; } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { (void) HDfprintf(stderr, err12b, infile); - HDfclose(strm); - return (-1); + goto error; } if (getChunkedDimensionSizes(in, strm) == -1) { (void) HDfprintf(stderr, err12c, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[CHUNK] = 1; break; @@ -2106,14 +2067,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 10: /* COMPRESSION-TYPE */ if (in->configOptionVector[COMPRESS] == 1) { (void) HDfprintf(stderr, err13a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getCompressionType(in, strm) == -1) { (void) HDfprintf(stderr, err13b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[COMPRESS] = 1; @@ -2126,14 +2085,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 11: /* COMPRESSION-PARAM */ if (in->configOptionVector[COMPRESS_PARAM] == 1) { (void) HDfprintf(stderr, err14a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getCompressionParameter(in, strm) == -1) { (void) HDfprintf(stderr, err14b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[COMPRESS_PARAM] = 1; @@ -2146,14 +2103,12 @@ static int processConfigurationFile(char *infile, struct Input *in) case 12: /* EXTERNAL-STORAGE */ if (in->configOptionVector[EXTERNALSTORE] == 1) { (void) HDfprintf(stderr, err15a, infile); - HDfclose(strm); - return (-1); + goto error; } if (getExternalFilename(in, strm) == -1) { (void) HDfprintf(stderr, err15b, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[EXTERNALSTORE] = 1; break; @@ -2161,19 +2116,16 @@ static int processConfigurationFile(char *infile, struct Input *in) case 13: /* MAXIMUM-DIMENSIONS */ if (in->configOptionVector[EXTEND] == 1) { (void) HDfprintf(stderr, err16a, infile); - HDfclose(strm); - return (-1); + goto error; } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { (void) HDfprintf(stderr, err16b, infile); - HDfclose(strm); - return (-1); + goto error; } if (getMaximumDimensionSizes(in, strm) == -1) { (void) HDfprintf(stderr, err16c, infile); - HDfclose(strm); - return (-1); + goto error; } in->configOptionVector[EXTEND] = 1; break; @@ -2192,11 +2144,16 @@ static int processConfigurationFile(char *infile, struct Input *in) if (validateConfigurationParameters(in) == -1) { (void) HDfprintf(stderr, err17, infile); - HDfclose(strm); - return (-1); + goto error; } - HDfclose(strm); - return (0); + + /* Set success return value */ + retval = 0; + +error: + if(strm) + HDfclose(strm); + return(retval); } static int validateConfigurationParameters(struct Input *in) @@ -3279,7 +3236,7 @@ static int getOutputArchitecture(struct Input *in, FILE *strm) return (0); } -static int OutputArchStrToInt(char *temp) +static int OutputArchStrToInt(const char *temp) { int i; char outputArchKeywordTable[8][15] = { "NATIVE", "STD", "IEEE", "INTEL", @@ -3311,7 +3268,7 @@ static int getOutputByteOrder(struct Input *in, FILE *strm) return (0); } -static int OutputByteOrderStrToInt(char *temp) +static int OutputByteOrderStrToInt(const char *temp) { int i; char outputByteOrderKeywordTable[2][15] = { "BE", "LE" }; @@ -3716,6 +3673,10 @@ hid_t createInputDataType(struct Input *in) case 64: new_type = H5Tcopy(H5T_NATIVE_LLONG); break; + + default: + (void) HDfprintf(stderr, "%s", err1); + return (-1); } break; @@ -3730,6 +3691,10 @@ hid_t createInputDataType(struct Input *in) case 64: new_type = H5Tcopy(H5T_NATIVE_DOUBLE); break; + + default: + (void) HDfprintf(stderr, "%s", err1); + return (-1); } break; @@ -3754,6 +3719,10 @@ hid_t createInputDataType(struct Input *in) case 64: new_type = H5Tcopy(H5T_NATIVE_ULLONG); break; + + default: + (void) HDfprintf(stderr, "%s", err1); + return (-1); } break; diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index c686624..c242483 100644 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h @@ -191,43 +191,8 @@ void usage(char *); void setDefaultValues(struct Input *in, int count); void help(char *); -static int gtoken(char *s); -static int process(struct Options *opt); -static int processConfigurationFile(char *infile, struct Input *in); -static int mapKeywordToIndex(char *key); -static int parsePathInfo(struct path_info *path, char *strm); -static int parseDimensions(struct Input *in, char *strm); -static int getInputSize(struct Input *in, int ival); -static int getInputClass(struct Input *in, char * strm); -static int getInputClassType(struct Input *in, char * strm); -static int InputClassStrToInt(char *temp); -static int getRank(struct Input *in, FILE *strm); -static int getDimensionSizes(struct Input *in, FILE *strm); -static int getOutputSize(struct Input *in, FILE *strm); -static int getOutputClass(struct Input *in, FILE *strm); -static int OutputClassStrToInt(char *temp); -static int getOutputArchitecture(struct Input *in, FILE *strm); -static int OutputArchStrToInt(char *temp); -static int getOutputByteOrder(struct Input *in, FILE *strm); -static int OutputByteOrderStrToInt(char *temp); -static int getChunkedDimensionSizes(struct Input *in, FILE *strm); -static int getCompressionType(struct Input *in, FILE *strm); -static int CompressionTypeStrToInt(char *temp); -static int getCompressionParameter(struct Input *in, FILE *strm); -static int getExternalFilename(struct Input *in, FILE *strm); -static int getMaximumDimensionSizes(struct Input *in, FILE *strm); -static int processDataFile(char *infile, struct Input *in, hid_t file_id); -static int readIntegerData(FILE *strm, struct Input *in); -static int readFloatData(FILE *strm, struct Input *in); -static int allocateIntegerStorage(struct Input *in); -static int allocateFloatStorage(struct Input *in); hid_t createOutputDataType(struct Input *in); hid_t createInputDataType(struct Input *in); -static int readUIntegerData(FILE *strm, struct Input *in); -static int allocateUIntegerStorage(struct Input *in); -static int validateConfigurationParameters(struct Input *in); -static int processStrData(FILE *strm, struct Input *in, hid_t file_id); -static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id); #endif /* H5IMPORT_H__ */ diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 3ee1cba..7351fd5 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -800,6 +800,28 @@ ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONT ADD_H5_TEST (chunk2compa "TEST" h5repack_layout3.h5 -l chunk_unlimit1:COMPA) ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK) +#-------------------------------------------------------------------------- +# Test -f for some specific cases. Chunked dataset with unlimited max dims. +# (HDFFV-8012) +#-------------------------------------------------------------------------- +# - should not fail +# - should not change max dims from unlimit + +# chunk dim is bigger than dataset dim. ( dset size < 64k ) +ADD_H5_TEST (error1 "TEST" h5repack_layout3.h5 -f chunk_unlimit1:NONE) +ADD_H5_VERIFY_TEST (error1 "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED) + +# chunk dim is bigger than dataset dim. ( dset size > 64k ) +ADD_H5_TEST (error2 "TEST" h5repack_layout3.h5 -f chunk_unlimit2:NONE) +ADD_H5_VERIFY_TEST (error2 "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED) + +# chunk dims are smaller than dataset dims. ( dset size < 64k ) +ADD_H5_TEST (error3 "TEST" h5repack_layout3.h5 -f chunk_unlimit3:NONE) +ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED) + +# file input - should not fail +ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE) + # Native option # Do not use FILE1, as the named dtype will be converted to native, and h5diff will # report a difference. diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 42472b56..dda81cf 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -96,6 +96,7 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, options->min_comp = 1024; options->verbose = verbose; options->latest = latest; + options->layout_g = H5D_LAYOUT_ERROR; for ( n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 2614dd6..a732ffb 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -818,6 +818,27 @@ VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CONTI TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:COMPA VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CHUNK +#-------------------------------------------------------------------------- +# Test -f for some specific cases. Chunked dataset with unlimited max dims. +# (HDFFV-8012) +#-------------------------------------------------------------------------- +# - should not fail +# - should not change max dims from unlimit + +# chunk dim is bigger than dataset dim. ( dset size < 64k ) +TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit1:NONE +VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED +# chunk dim is bigger than dataset dim. ( dset size > 64k ) +TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit2:NONE +VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED + +# chunk dims are smaller than dataset dims. ( dset size < 64k ) +TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit3:NONE +VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED + +# file input - should not fail +TOOLTEST h5repack_layout3.h5 -f NONE + # Native option # Do not use FILE1, as the named dtype will be converted to native, and h5diff will # report a difference. diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index cf55d7f..02337fd 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -773,6 +773,7 @@ int do_copy_objects(hid_t fidin, void *hslab_buf=NULL; /* hyperslab buffer for raw data */ int has_filter; /* current object has a filter */ int req_filter; /* there was a request for a filter */ + int req_obj_layout=0; /* request layout to current object */ unsigned crt_order_flags; /* group creation order flag */ unsigned i; unsigned u; @@ -904,6 +905,22 @@ int do_copy_objects(hid_t fidin, } } + /* check if layout change requested individual object */ + if (options->layout_g != H5D_LAYOUT_ERROR) + { + pack_info_t *pckinfo; + /* any dataset is specified */ + if (options->op_tbl->nelems > 0) + { + /* check if object exist */ + pckinfo = options_get_object (travt->objs[i].name, options->op_tbl); + if (pckinfo) + { + req_obj_layout = 1; + } + } + } + /* early detection of references */ if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; @@ -1023,6 +1040,9 @@ int do_copy_objects(hid_t fidin, goto error; } + /* only if layout change requested for entire file or + * individual obj */ + if (options->all_layout > 0 || req_obj_layout == 1) /*------------------------------------------------- * Unset the unlimited max dims if convert to other * than chunk layouts, because unlimited max dims diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 3926744..cc4e063 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -3153,65 +3153,119 @@ out: */ #define DIM1_L3 300 #define DIM2_L3 200 +/* small size */ +#define SDIM1_L3 4 +#define SDIM2_L3 50 static int make_layout3(hid_t loc_id) { - hid_t dcpl=-1; /* dataset creation property list */ - hid_t sid=-1; /* dataspace ID */ - hsize_t dims[RANK]={DIM1_L3,DIM2_L3}; + hid_t dcpl1=-1; /* dataset creation property list */ + hid_t dcpl2=-1; /* dataset creation property list */ + hid_t dcpl3=-1; /* dataset creation property list */ + hid_t sid1=-1; /* dataspace ID */ + hid_t sid2=-1; /* dataspace ID */ + hsize_t dims1[RANK]={DIM1_L3,DIM2_L3}; + hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3}; hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[RANK]={DIM1_L3*2,5}; - int buf[DIM1_L3][DIM2_L3]; + hsize_t chunk_dims1[RANK]={DIM1_L3*2,5}; + hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2}; + hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2}; + int buf1[DIM1_L3][DIM2_L3]; + int buf2[SDIM1_L3][SDIM2_L3]; int i, j, n; + /* init buf1 */ for (i=n=0; i$actual 2>$actual_err - cat $actual_err >> $actual + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -176,7 +186,7 @@ TOOLTEST() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 144159a..130a0d8 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -207,6 +207,12 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_lp->nattrs_only2++; curr2++; } + + /* close for next turn */ + H5Aclose(attr1_id); + attr1_id = -1; + H5Aclose(attr2_id); + attr2_id = -1; } /* end while */ /* list1 did not end */ @@ -225,6 +231,10 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_attr_mark_exist(infile, name1, table_lp); table_lp->nattrs_only1++; curr1++; + + /* close for next turn */ + H5Aclose(attr1_id); + attr1_id = -1; } /* list2 did not end */ @@ -243,6 +253,9 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_attr_mark_exist(infile, name2, table_lp); table_lp->nattrs_only2++; curr2++; + + /* close for next turn */ + H5Aclose(attr2_id); } /*------------------------------------------------------ @@ -272,6 +285,11 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t return 0; error: + if (0 < attr1_id) + H5Aclose(attr1_id); + if (0 < attr2_id) + H5Aclose(attr2_id); + return -1; } diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 15e4e00..1a2b81c 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -443,7 +443,7 @@ typedef struct h5tool_format_t { * indentlevel: a string that shows how far to indent if extra spacing * is needed. dumper uses it. */ - int line_ncols; /*columns of output */ + unsigned line_ncols; /*columns of output */ size_t line_per_line; /*max elements per line */ const char *line_pre; /*prefix at front of each line */ const char *line_1st; /*alternate pre. on first line */ diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 2e6a99d..33fef3c 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -30,10 +30,6 @@ #include "h5tools_utils.h" #include "H5private.h" -#define SANITY_CHECK - -#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z)) - h5tool_format_t h5tools_dataformat = { 0, /*raw */ @@ -215,6 +211,12 @@ hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, hsize_t *curr_pos/*total data element position*/, size_t ncols, hsize_t region_elmt_counter/*element counter*/, hsize_t elmt_counter); + +void h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims); + +void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, struct subset_t *sset, int dims); + void h5tools_dump_init(void) { @@ -628,7 +630,11 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); +{ + HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + HGOTO_DONE(dimension_break); + //HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); +} H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) @@ -689,7 +695,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); - h5tools_print_dataspace(stream, buffer, info, ctx, region_space); + h5tools_print_dataspace(buffer, region_space); if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); @@ -1008,7 +1014,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, ctx->need_prefix = TRUE; h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); - h5tools_print_dataspace(stream, buffer, info, ctx, region_space); + h5tools_print_dataspace(buffer, region_space); if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); @@ -2215,7 +2221,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ /* Check C variable-length string first. Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { h5tools_str_append(buffer, "H5T_C_S1;"); - goto done; + goto found_string_type; } /* Change the endianness and see if they're equal. */ @@ -2227,7 +2233,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ if (H5Tequal(tmp_type, str_type)) { h5tools_str_append(buffer, "H5T_C_S1;"); - goto done; + goto found_string_type; } /* If not equal to C variable-length string, check Fortran type. */ @@ -2242,7 +2248,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ /* Are the two types equal? */ if (H5Tequal(tmp_type, str_type)) { h5tools_str_append(buffer, "H5T_FORTRAN_S1;"); - goto done; + goto found_string_type; } /* Change the endianness and see if they're equal. */ @@ -2254,13 +2260,13 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ if (H5Tequal(tmp_type, str_type)) { h5tools_str_append(buffer, "H5T_FORTRAN_S1;"); - goto done; + goto found_string_type; } /* Type doesn't match any of above. */ h5tools_str_append(buffer, "unknown_one_character_type;"); - done: + found_string_type: h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); ctx->indent_level--; @@ -2311,7 +2317,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); ctx->indent_level++; { - char *ttag = H5Tget_tag(type); + char *ttag; + + if(NULL == (ttag = H5Tget_tag(type))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, 0, 0); @@ -2320,8 +2329,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); - if (ttag) - HDfree(ttag); + HDfree(ttag); } ctx->indent_level--; @@ -2482,8 +2490,7 @@ CATCH *------------------------------------------------------------------------- */ int -h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t space) +h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) { HERR_INIT(int, SUCCEED) hsize_t size[H5TOOLS_DUMP_MAX_RANK]; @@ -2773,7 +2780,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s ", h5tools_dump_header_format->dataspacebegin); - h5tools_print_dataspace(stream, &buffer, info, ctx, type); + h5tools_print_dataspace(&buffer, type); if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceblockend); @@ -2845,7 +2852,6 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t { size_t size; hid_t n_type; - hsize_t nelmts = 1; void *buf = NULL; n_type = h5tools_get_native_type(type_id); @@ -3567,7 +3573,8 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims) for (i = 0; i < dims; i++) { h5tools_str_append(buffer, HSIZE_T_FORMAT, s[i]); - if (i + 1 != dims) h5tools_str_append(buffer, ", "); + if (i + 1 != dims) + h5tools_str_append(buffer, ", "); } } @@ -3870,7 +3877,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, buf = HDmalloc((size_t)alloc_size); HDassert(buf); - if (H5Aread(obj_id, p_type, buf) >= 0) + if (H5Aread(obj_id, p_type, buf) >= 0) { if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { /* * Print 1-byte integer data as an ASCII character string @@ -3899,6 +3906,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } else datactx.need_prefix = TRUE; + } status = h5tools_dump_mem(stream, info, &datactx, obj_id, p_type, space, buf); if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h index 55e046b..86f9f99 100644 --- a/tools/lib/h5tools_dump.h +++ b/tools/lib/h5tools_dump.h @@ -67,8 +67,7 @@ H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t type, int object_search); -H5TOOLS_DLL int h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer/*in,out*/, - const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, +H5TOOLS_DLL int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/, hid_t space); H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, diff --git a/tools/misc/talign.c b/tools/misc/talign.c index b77d846..017eb55 100644 --- a/tools/misc/talign.c +++ b/tools/misc/talign.c @@ -23,6 +23,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" const char *fname = "talign.h5"; const char *setname = "align"; @@ -46,8 +47,8 @@ int main(void) hsize_t cdim[4]; char string5[5]; - float fok[2] = {1234., 2341.}; - float fnok[2] = {5678., 6785.}; + float fok[2] = {1234.0f, 2341.0f}; + float fnok[2] = {5678.0f, 6785.0f}; float *fptr; char *data = NULL; @@ -125,7 +126,7 @@ int main(void) H5Dclose(set); /* Now open the set, and read it back in */ - data = malloc(H5Tget_size(fix)); + data = (char *)malloc(H5Tget_size(fix)); if(!data) { perror("malloc() failed"); @@ -159,8 +160,8 @@ out: "%14s (%2d) %6f = %f\n" " %6f = %f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1), - fok[0], fptr[0], - fok[1], fptr[1]); + (double)fok[0], (double)fptr[0], + (double)fok[1], (double)fptr[1]); if(mname) free(mname); @@ -169,8 +170,8 @@ out: printf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2), - fnok[0], fptr[0], - fnok[1], fptr[1]); + (double)fnok[0], (double)fptr[0], + (double)fnok[1], (double)fptr[1]); if(mname) free(mname); @@ -181,10 +182,10 @@ out: " %6f = %f\n" " %6f = %f\n" " %6f = %f\n", - fok[0], fptr[0], - fok[1], fptr[1], - fnok[0], fptr[2], - fnok[1], fptr[3]); + (double)fok[0], (double)fptr[0], + (double)fok[1], (double)fptr[1], + (double)fnok[0], (double)fptr[2], + (double)fnok[1], (double)fptr[3]); puts("*FAILED - compound type alignmnent problem*"); } else { puts(" PASSED"); diff --git a/tools/testfiles/tscalarattrintsize.ddl b/tools/testfiles/tscalarattrintsize.ddl index 4157859..46f3cef 100644 --- a/tools/testfiles/tscalarattrintsize.ddl +++ b/tools/testfiles/tscalarattrintsize.ddl @@ -113,17 +113,17 @@ GROUP "/" { } } ATTRIBUTE "DummyDBL" { - DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64BE } + DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64LE } DATASPACE SCALAR DATA { - (0): [ 0, 1.17284e-90, 1.17284e-90, 1.05571e+165, 1.17284e-90, -3.23633e+292, 1.05571e+165, -3.55182e+37, - 3.03865e-319, 3.71772e+239, -5.54961e+165, 8.81586e+91, -8.11368e+22, 1.28325e-51, -1.9407e-125, 2.0391e-194, - 3.16202e-322, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247, - 1.04347e-320, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247, - 2.05531e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31, - 2.56124e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31, - 3.06716e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31, - 3.57308e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31 ] + (0): [ 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 ] } } } diff --git a/tools/testfiles/tscalarattrintsize.h5 b/tools/testfiles/tscalarattrintsize.h5 index acf87e8..df91f54 100644 Binary files a/tools/testfiles/tscalarattrintsize.h5 and b/tools/testfiles/tscalarattrintsize.h5 differ diff --git a/tools/testfiles/tscalarintsize.ddl b/tools/testfiles/tscalarintsize.ddl index b4d9c02..4b06a74 100644 --- a/tools/testfiles/tscalarintsize.ddl +++ b/tools/testfiles/tscalarintsize.ddl @@ -113,17 +113,17 @@ GROUP "/" { } } DATASET "DummyDBL" { - DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64BE } + DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64LE } DATASPACE SCALAR DATA { - (0): [ 0, 1.17284e-90, 1.17284e-90, 1.05571e+165, 1.17284e-90, -3.23633e+292, 1.05571e+165, -3.55182e+37, - 3.03865e-319, 3.71772e+239, -5.54961e+165, 8.81586e+91, -8.11368e+22, 1.28325e-51, -1.9407e-125, 2.0391e-194, - 3.16202e-322, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247, - 1.04347e-320, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247, - 2.05531e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31, - 2.56124e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31, - 3.06716e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31, - 3.57308e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31 ] + (0): [ 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 ] } } } diff --git a/tools/testfiles/tscalarintsize.h5 b/tools/testfiles/tscalarintsize.h5 index 9433401..5a82378 100644 Binary files a/tools/testfiles/tscalarintsize.h5 and b/tools/testfiles/tscalarintsize.h5 differ diff --git a/tools/testfiles/tscalarstring.ddl b/tools/testfiles/tscalarstring.ddl new file mode 100644 index 0000000..4ba7093 --- /dev/null +++ b/tools/testfiles/tscalarstring.ddl @@ -0,0 +1,28 @@ +HDF5 "tscalarstring.h5" { +GROUP "/" { + ATTRIBUTE "attr_str" { + DATATYPE H5T_STRING { + STRSIZE 64; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } + DATASPACE SCALAR + DATA { + (0): "ABCDEFGHBCDEFGHICDEFGHIJDEFGHIJKEFGHIJKLFGHIJKLMGHIJKLMNHIJKLMNO" + } + } + DATASET "the_str" { + DATATYPE H5T_STRING { + STRSIZE 64; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } + DATASPACE SCALAR + DATA { + (0): "ABCDEFGHBCDEFGHICDEFGHIJDEFGHIJKEFGHIJKLFGHIJKLMGHIJKLMNHIJKLMNO" + } + } +} +} diff --git a/tools/testfiles/tscalarstring.h5 b/tools/testfiles/tscalarstring.h5 new file mode 100644 index 0000000..b0993ef Binary files /dev/null and b/tools/testfiles/tscalarstring.h5 differ diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 3d1d770..d7c2119 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -502,7 +502,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.131-FA_a5" +#define H5_PACKAGE_STRING "HDF5 1.9.137-FA_a5" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -511,7 +511,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.131-FA_a5" +#define H5_PACKAGE_VERSION "1.9.137-FA_a5" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -674,7 +674,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.131-FA_a5" +#define H5_VERSION "1.9.137-FA_a5" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12