From 817af161a8d463eaec385d0959e06b546f27ae45 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 26 Aug 2020 09:54:24 -0500 Subject: HDFFV-11018 Add Fortran H5F_LIBVER_V*_F definitions Added ------ New Definitions: INTEGER :: H5F_LIBVER_ERROR_F INTEGER :: H5F_LIBVER_NBOUNDS_F INTEGER :: H5F_LIBVER_V18_F INTEGER :: H5F_LIBVER_V110_F New API: h5pget_libver_bounds_f(fapl_id, low, high, hdferr) Removed: call to C wrapper h5pset_libver_bounds_c in h5pset_libver_bounds_f Updated Release notes. --- fortran/src/H5Pf.c | 40 ---------------- fortran/src/H5Pff.F90 | 93 ++++++++++++++++++++++++++++++-------- fortran/src/H5_f.c | 6 ++- fortran/src/H5_ff.F90 | 8 +++- fortran/src/H5f90global.F90 | 8 ++++ fortran/src/H5f90proto.h | 1 - fortran/src/hdf5_fortrandll.def.in | 1 + fortran/test/tH5P_F03.F90 | 30 ++++++++++-- release_docs/RELEASE.txt | 11 +++++ 9 files changed, 133 insertions(+), 65 deletions(-) diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 8789b69..84ff279 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -4056,46 +4056,6 @@ h5pget_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags) ret_value = 0; return ret_value; } -/****if* H5Pf/h5pset_libver_bounds_c - * NAME - * h5pset_libver_bounds_c - * PURPOSE - * Calls H5Pset_libver_bounds - * - * INPUTS - * - * fapl_id - File access property list identifier - * low - The earliest version of the library that will be used for writing objects. - * high - The latest version of the library that will be used for writing objects. - * OUTPUTS - * - * - * RETURNS - * 0 on success, -1 on failure - * AUTHOR - * M. Scot Breitenfeld - * February 18, 2008 - * HISTORY - * - * SOURCE -*/ -int_f -h5pset_libver_bounds_c(hid_t_f *fapl_id, int_f *low, int_f *high ) -/******/ -{ - int ret_value = -1; - herr_t ret; - - /* - * Call H5Pset_libver_bounds function. - */ - ret = H5Pset_libver_bounds( (hid_t)*fapl_id, (H5F_libver_t)*low, (H5F_libver_t)*high ); - if (ret < 0) return ret_value; - - ret_value = 0; - return ret_value; -} - /****if* H5Pf/h5pset_link_creation_order_c * NAME * h5pset_link_creation_order_c diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index dd5619e..4b13501 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -4754,6 +4754,65 @@ CONTAINS END SUBROUTINE h5pget_attr_creation_order_f +!****s* H5P/H5Pget_libver_bounds_f +! NAME +! H5Pget_libver_bounds_f +! +! PURPOSE +! Retrieves the lower and upper bounds on the HDF5 library release versions that indirectly +! determine the object format versions used when creating objects in the file. +! +! INPUTS +! +! fapl_id - File access property list identifier +! low - The earliest version of the library that will be used for writing objects. +! high - The latest version of the library that will be used for writing objects. +! +! OUTPUTS +! +! hdferr - error code +! Success: 0 +! Failure: -1 +! +! AUTHOR +! M. Scot Breitenfeld +! February 10, 2020 +! +! Fortran Interface: + SUBROUTINE h5pget_libver_bounds_f(fapl_id, low, high, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: fapl_id ! File access property list identifier + INTEGER, INTENT(OUT) :: low ! The earliest version of the library that will be used for writing objects. + INTEGER, INTENT(OUT) :: high ! The latest version of the library that will be used for writing objects. + INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success and -1 on failure +!***** +! Local variables + INTEGER(ENUM_T) :: low_c, high_c + INTEGER(C_INT) :: hdferr_c +! +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER(C_INT) FUNCTION h5pget_libver_bounds(fapl_id, low, high) & + BIND(C,NAME='H5Pget_libver_bounds') + IMPORT :: C_INT, HID_T, ENUM_T + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) , VALUE :: fapl_id + INTEGER(ENUM_T), INTENT(OUT) :: low + INTEGER(ENUM_T), INTENT(OUT) :: high + END FUNCTION h5pget_libver_bounds + END INTERFACE + + hdferr_c = H5Pget_libver_bounds(fapl_id, low_c, high_c) + + low = INT(low_c) + high = INT(high_c) + + hdferr = 0 + IF(hdferr_c.LT.0) hdferr = -1 + + END SUBROUTINE h5pget_libver_bounds_f + !****s* H5P/H5Pset_libver_bounds_f ! NAME ! H5Pset_libver_bounds_f @@ -4781,32 +4840,30 @@ CONTAINS SUBROUTINE h5pset_libver_bounds_f(fapl_id, low, high, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl_id ! File access property list identifier - INTEGER, INTENT(IN) :: low ! The earliest version of the library that will be used for writing objects. - ! Currently, low must be one of two pre-defined values: - ! HDF_LIBVER_EARLIEST_F - ! HDF_LIBVER_LATEST_F - INTEGER, INTENT(IN) :: high ! The latest version of the library that will be used for writing objects. - ! Currently, low must set to the pre-defined value: - ! HDF_LIBVER_LATEST_F - INTEGER, INTENT(OUT) :: hdferr ! Error code - ! 0 on success and -1 on failure + INTEGER, INTENT(IN) :: low ! The earliest version of the library that will be used for writing objects. + INTEGER, INTENT(IN) :: high ! The latest version of the library that will be used for writing objects. + INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success and -1 on failure !***** +! Local variables + INTEGER(C_INT) :: hdferr_c ! ! MS FORTRAN needs explicit interface for C functions called here. ! INTERFACE - INTEGER FUNCTION h5pset_libver_bounds_c(fapl_id, low, high) & - BIND(C,NAME='h5pset_libver_bounds_c') - IMPORT :: HID_T + INTEGER(C_INT) FUNCTION h5pset_libver_bounds(fapl_id, low, high) & + BIND(C,NAME='H5Pset_libver_bounds') + IMPORT :: C_INT, HID_T, ENUM_T IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: fapl_id - INTEGER, INTENT(IN) :: low - INTEGER, INTENT(IN) :: high - - END FUNCTION H5pset_libver_bounds_c + INTEGER(HID_T), INTENT(IN), VALUE :: fapl_id + INTEGER(ENUM_T), INTENT(IN), VALUE :: low + INTEGER(ENUM_T), INTENT(IN), VALUE :: high + END FUNCTION h5pset_libver_bounds END INTERFACE - hdferr = h5pset_libver_bounds_c(fapl_id, low, high) + hdferr_c = h5pset_libver_bounds(fapl_id, INT(low, ENUM_T), INT(high, ENUM_T)) + + hdferr = 0 + IF(hdferr_c.LT.0) hdferr = -1 END SUBROUTINE h5pset_libver_bounds_f diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index b351893..b80d4fd 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -443,7 +443,11 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5f_flags[15] = (int_f)H5F_OBJ_ALL; h5f_flags[16] = (int_f)H5F_LIBVER_EARLIEST; h5f_flags[17] = (int_f)H5F_LIBVER_LATEST; - h5f_flags[18] = (int_f)H5F_UNLIMITED; + h5f_flags[18] = (int_f)H5F_LIBVER_ERROR; + h5f_flags[19] = (int_f)H5F_LIBVER_NBOUNDS; + h5f_flags[20] = (int_f)H5F_UNLIMITED; + h5f_flags[21] = (int_f)H5F_LIBVER_V18; + h5f_flags[22] = (int_f)H5F_LIBVER_V110; /* * H5FD flags diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 5476209..e96dae4 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -46,7 +46,7 @@ MODULE H5LIB ! ! H5F flags declaration ! - INTEGER, PARAMETER :: H5F_FLAGS_LEN = 19 + INTEGER, PARAMETER :: H5F_FLAGS_LEN = 23 INTEGER, DIMENSION(1:H5F_FLAGS_LEN) :: H5F_flags ! ! H5generic flags declaration @@ -343,7 +343,11 @@ CONTAINS H5F_OBJ_ALL_F = H5F_flags(16) H5F_LIBVER_EARLIEST_F = H5F_flags(17) H5F_LIBVER_LATEST_F = H5F_flags(18) - H5F_UNLIMITED_F = H5F_flags(19) + H5F_LIBVER_ERROR_F = H5F_flags(19) + H5F_LIBVER_NBOUNDS_F = H5F_flags(20) + H5F_UNLIMITED_F = H5F_flags(21) + H5F_LIBVER_V18_F = H5F_flags(22) + H5F_LIBVER_V110_F = H5F_flags(23) ! ! H5generic flags ! diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 72b1802..a3c6f74 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -232,6 +232,10 @@ MODULE H5GLOBAL !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_EARLIEST_F !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_LATEST_F !DEC$ATTRIBUTES DLLEXPORT :: H5F_UNLIMITED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_NBOUNDS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_V18_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_V110_F !DEC$endif INTEGER :: H5F_ACC_RDWR_F @@ -253,6 +257,10 @@ MODULE H5GLOBAL INTEGER :: H5F_LIBVER_EARLIEST_F INTEGER :: H5F_LIBVER_LATEST_F INTEGER :: H5F_UNLIMITED_F + INTEGER :: H5F_LIBVER_ERROR_F + INTEGER :: H5F_LIBVER_NBOUNDS_F + INTEGER :: H5F_LIBVER_V18_F + INTEGER :: H5F_LIBVER_V110_F ! ! H5G flags declaration ! diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index d88f1ad..b522680 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -448,7 +448,6 @@ H5_FCDLL int_f h5pset_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_f H5_FCDLL int_f h5pset_shared_mesg_nindexes_c(hid_t_f *plist_id, int_f *nindexes ); H5_FCDLL int_f h5pset_shared_mesg_index_c(hid_t_f *fcpl_id, int_f *index_num, int_f *mesg_type_flags, int_f *min_mesg_size); H5_FCDLL int_f h5pget_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags); -H5_FCDLL int_f h5pset_libver_bounds_c(hid_t_f *fapl_id, int_f *low, int_f *high); H5_FCDLL int_f h5pset_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags); H5_FCDLL int_f h5pget_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dense ); H5_FCDLL int_f h5pget_obj_track_times_c(hid_t_f *plist_id, int_f *flag); diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 8438f2a..a1fe93d 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -285,6 +285,7 @@ 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_H5PGET_LIBVER_BOUNDS_F H5P_mp_H5PSET_LIBVER_BOUNDS_F H5P_mp_H5PSET_LINK_CREATION_ORDER_F H5P_mp_H5PGET_LINK_PHASE_CHANGE_F diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index e11aab4..b7331ce 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -112,6 +112,7 @@ SUBROUTINE test_create(total_error) INTEGER :: ifill REAL :: rfill REAL(KIND=dp) :: dpfill + INTEGER :: low, high ! ! * Create a file. @@ -204,12 +205,35 @@ SUBROUTINE test_create(total_error) CALL h5fclose_f(file,error) CALL check("h5fclose_f", error, total_error) - ! Open the file and get the dataset fill value from each dataset - CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl, error) - CALL check("H5Pcreate_f",error, total_error) + ! Open the file and get the dataset fill value from each dataset + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f",error, total_error) + + CALL h5pset_libver_bounds_f(fapl, H5F_LIBVER_V18_F, H5F_LIBVER_V18_F, error) + CALL check("h5pset_libver_bounds_f",error, total_error) + CALL h5pget_libver_bounds_f(fapl, low, high, error) + CALL check("h5pget_libver_bounds_f",error, total_error) + CALL VERIFY("***ERROR: Returned wrong low libver_bounds", low, H5F_LIBVER_V18_F, total_error) + CALL VERIFY("***ERROR: Returned wrong high libver_bounds", high, H5F_LIBVER_V18_F, total_error) + + CALL h5pset_libver_bounds_f(fapl, H5F_LIBVER_V18_F, H5F_LIBVER_V110_F, error) + CALL check("h5pset_libver_bounds_f",error, total_error) + CALL h5pget_libver_bounds_f(fapl, low, high, error) + CALL check("h5pget_libver_bounds_f",error, total_error) + CALL VERIFY("***ERROR: Returned wrong low libver_bounds", low, H5F_LIBVER_V18_F, total_error) + CALL VERIFY("***ERROR: Returned wrong high libver_bounds", high, H5F_LIBVER_V110_F, total_error) CALL H5Pset_libver_bounds_f(fapl, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error) CALL check("H5Pset_libver_bounds_f",error, total_error) + CALL h5pget_libver_bounds_f(fapl, low, high, error) + CALL check("h5pget_libver_bounds_f",error, total_error) + CALL VERIFY("***ERROR: Returned wrong low libver_bounds", low, H5F_LIBVER_LATEST_F, total_error) + CALL VERIFY("***ERROR: Returned wrong high libver_bounds", high, H5F_LIBVER_LATEST_F, total_error) + IF(H5F_LIBVER_LATEST_F.GE.H5F_LIBVER_NBOUNDS_F)THEN + WRITE(*,'(A,I0,A,I0,A)') & + "***ERROR: H5F_LIBVER_LATEST_F (",H5F_LIBVER_LATEST_F,") .GE. H5F_LIBVER_NBOUNDS_F (",H5F_LIBVER_NBOUNDS_F,")" + total_error = total_error + 1 + ENDIF CALL h5fopen_f (FILENAME, H5F_ACC_RDONLY_F, file, error, fapl) CALL check("h5fopen_f", error, total_error) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b993d5c..0e96ccf 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -283,6 +283,17 @@ New Features (DER - 2020/07/30, HDFFV-11092) + - Added new Fortran parameters: + + H5F_LIBVER_ERROR_F + H5F_LIBVER_NBOUNDS_F + H5F_LIBVER_V18_F + H5F_LIBVER_V110_F + + - Added new Fortran API: h5pget_libver_bounds_f + + (MSB - 2020/02/11, HDFFV-11018) + C++ Library: ------------ - Add wrappers for H5Pset/get_file_locking() API calls -- cgit v0.12