From 79c62f9a25906705735efa9286124c0d3aa9276a Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 10 Feb 2020 14:11:36 -0600 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 INTEGER :: H5F_LIBVER_V112_F INTEGER :: H5F_LIBVER_V114_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 --- fortran/src/H5Pf.c | 40 ---------------- fortran/src/H5Pff.F90 | 95 ++++++++++++++++++++++++++++++-------- fortran/src/H5_f.c | 8 +++- fortran/src/H5_ff.F90 | 10 +++- fortran/src/H5f90global.F90 | 12 +++++ fortran/src/H5f90proto.h | 1 - fortran/src/hdf5_fortrandll.def.in | 1 + fortran/test/tH5P_F03.F90 | 42 ++++++++++++++++- 8 files changed, 144 insertions(+), 65 deletions(-) diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 2cacc8c..a931903 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -4061,46 +4061,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 0c0500d..61d30b8 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 132da7b..ced5049 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -441,7 +441,13 @@ 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; + h5f_flags[23] = (int_f)H5F_LIBVER_V112; + h5f_flags[24] = (int_f)H5F_LIBVER_V114; /* * H5FD flags diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 443be79..7c7c751 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 = 25 INTEGER, DIMENSION(1:H5F_FLAGS_LEN) :: H5F_flags ! ! H5generic flags declaration @@ -343,7 +343,13 @@ 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) + H5F_LIBVER_V112_F = H5F_flags(24) + H5F_LIBVER_V114_F = H5F_flags(25) ! ! H5generic flags ! diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index dabc0bb..6b601e9 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -237,6 +237,12 @@ 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$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_V112_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_V114_F !DEC$endif INTEGER :: H5F_ACC_RDWR_F @@ -258,6 +264,12 @@ 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 + INTEGER :: H5F_LIBVER_V112_F + INTEGER :: H5F_LIBVER_V114_F ! ! H5G flags declaration ! diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index e6f5dd4..fe616d3 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -454,7 +454,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 c792232..9c69e5a 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -288,6 +288,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 b44540b..083c312 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. @@ -205,11 +206,48 @@ SUBROUTINE test_create(total_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) + 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_V112_F, H5F_LIBVER_V112_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_V112_F, total_error) + CALL VERIFY("***ERROR: Returned wrong high libver_bounds", high, H5F_LIBVER_V112_F, total_error) + + CALL h5pset_libver_bounds_f(fapl, H5F_LIBVER_V114_F, H5F_LIBVER_V114_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_V114_F, total_error) + CALL VERIFY("***ERROR: Returned wrong high libver_bounds", high, H5F_LIBVER_V114_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) -- cgit v0.12