diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2023-11-03 13:02:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-03 13:02:50 (GMT) |
commit | 5e787741cdc991eb0011c9393152c1678ca737a8 (patch) | |
tree | 83b6f4810423d3bafec8ad448946af9f85555c27 /fortran/src | |
parent | 7404b57da68e92bd28c5da2053830e7cbfe032d1 (diff) | |
download | hdf5-5e787741cdc991eb0011c9393152c1678ca737a8.zip hdf5-5e787741cdc991eb0011c9393152c1678ca737a8.tar.gz hdf5-5e787741cdc991eb0011c9393152c1678ca737a8.tar.bz2 |
Removed the use of C wrappers from H5P APIs. (#3824)
* fix seg fault on frontier/cray
* fix seg fault on frontier/cray
* fix seg fault on frontier/cray
* removed the use of h5pclose_c
* removed the use of h5pclose_c
Diffstat (limited to 'fortran/src')
-rw-r--r-- | fortran/src/H5Off.F90 | 2 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 70 | ||||
-rw-r--r-- | fortran/src/H5Pff.F90 | 55 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 4 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def.in | 2 |
5 files changed, 31 insertions, 102 deletions
diff --git a/fortran/src/H5Off.F90 b/fortran/src/H5Off.F90 index b705ba3..9c8b091 100644 --- a/fortran/src/H5Off.F90 +++ b/fortran/src/H5Off.F90 @@ -1263,7 +1263,7 @@ CONTAINS INTERFACE INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, & index_field, order, n, lapl_id_default, object_info, fields) BIND(C, NAME='h5oget_info_by_idx_c') - IMPORT :: c_char, c_ptr, c_funptr + IMPORT :: c_char, c_ptr IMPORT :: HID_T, SIZE_T, HSIZE_T INTEGER(HID_T) , INTENT(IN) :: loc_id CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: group_name diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 3a97d7e..87e6bfb 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -69,30 +69,6 @@ done: return ret_value; } -/****if* H5Pf/h5pclose_c - * NAME - * h5pclose_c - * PURPOSE - * Call H5Pclose to close property lis - * INPUTS - * prp_id - identifier of the property list to be closed - * RETURNS - * 0 on success, -1 on failure - * SOURCE - */ - -int_f -h5pclose_c(hid_t_f *prp_id) -/******/ -{ - int_f ret_value = 0; - - if (H5Pclose((hid_t)*prp_id) < 0) - ret_value = -1; - - return ret_value; -} - /****if* H5Pf/h5pcopy_c * NAME * h5pcopy_c @@ -2252,52 +2228,6 @@ h5pget_hyper_vector_size_c(hid_t_f *prp_id, size_t_f *size) return ret_value; } -/****if* H5Pf/h5pcreate_class_c - * NAME - * h5pcreate_class_c - * PURPOSE - * Call H5Pcreate_class ito create a new property class - * INPUTS - * parent - property list class identifier - * name - name of the new class - * name_len - length of the "name" buffer - * OUTPUTS - * class - new class identifier - * RETURNS - * 0 on success, -1 on failure - * SOURCE - */ -int_f -h5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls, H5P_cls_create_func_t create, - void *create_data, H5P_cls_copy_func_t copy, void *copy_data, H5P_cls_close_func_t close, - void *close_data) -/******/ -{ - int ret_value = -1; - hid_t c_class; - char *c_name; - - c_name = (char *)HD5f2cstring(name, (size_t)*name_len); - if (c_name == NULL) - goto DONE; - - /* - * Call H5Pcreate_class function. - */ - c_class = - H5Pcreate_class((hid_t)*parent, c_name, create, create_data, copy, copy_data, close, close_data); - - if (c_class < 0) - goto DONE; - *cls = (hid_t_f)c_class; - ret_value = 0; - -DONE: - if (c_name != NULL) - free(c_name); - return ret_value; -} - /****if* H5Pf/h5pregister_c * NAME * h5pregister_c diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 5821889..5765095 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -400,15 +400,16 @@ CONTAINS INTEGER(HID_T), INTENT(IN) :: prp_id INTEGER, INTENT(OUT) :: hdferr INTERFACE - INTEGER FUNCTION h5pclose_c(prp_id) & - BIND(C,NAME='h5pclose_c') + INTEGER(C_INT) FUNCTION H5Pclose(prp_id) & + BIND(C,NAME='H5Pclose') + IMPORT :: C_INT IMPORT :: HID_T IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id - END FUNCTION h5pclose_c + INTEGER(HID_T), VALUE :: prp_id + END FUNCTION H5Pclose END INTERFACE - hdferr = h5pclose_c(prp_id) + hdferr = INT(H5Pclose(prp_id)) END SUBROUTINE h5pclose_f !> @@ -5005,31 +5006,32 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) INTEGER , INTENT(OUT) :: hdferr TYPE(C_PTR) , OPTIONAL, INTENT(IN) :: create_data, copy_data, close_data TYPE(C_FUNPTR) , OPTIONAL, INTENT(IN) :: create, copy, close - INTEGER :: name_len - TYPE(C_PTR) :: create_data_default, copy_data_default, close_data_default + TYPE(C_PTR) :: create_data_default, copy_data_default, close_data_default TYPE(C_FUNPTR) :: create_default, copy_default, close_default + + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTERFACE - INTEGER FUNCTION h5pcreate_class_c(parent, name, name_len, class, & + INTEGER(HID_T) FUNCTION H5Pcreate_class(parent, name, & create, create_data, copy, copy_data, close, close_data) & - BIND(C, NAME='h5pcreate_class_c') - IMPORT :: c_char, c_ptr, c_funptr + BIND(C, NAME='H5Pcreate_class') + IMPORT :: C_CHAR, C_PTR, C_FUNPTR IMPORT :: HID_T - INTEGER(HID_T), INTENT(IN) :: parent - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name - INTEGER, INTENT(IN) :: name_len - INTEGER(HID_T), INTENT(OUT) :: class - TYPE(C_PTR), VALUE :: create_data, copy_data, close_data - TYPE(C_FUNPTR), VALUE :: create, copy, close - END FUNCTION h5pcreate_class_c + INTEGER(HID_T), VALUE :: parent + CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name + TYPE(C_PTR), VALUE :: create_data, copy_data, close_data + TYPE(C_FUNPTR), VALUE :: create, copy, close + END FUNCTION H5Pcreate_class END INTERFACE - name_len = LEN(name) - create_default = c_null_funptr !fix:scot - create_data_default = c_null_ptr - copy_default = c_null_funptr !fix:scot - copy_data_default = c_null_ptr - close_default = c_null_funptr !fix:scot - close_data_default = c_null_ptr + c_name = TRIM(name)//C_NULL_CHAR + + create_default = C_NULL_FUNPTR + create_data_default = C_NULL_PTR + copy_default = C_NULL_FUNPTR + copy_data_default = C_NULL_PTR + close_default = C_NULL_FUNPTR + close_data_default = C_NULL_PTR IF(PRESENT(create)) create_default = create IF(PRESENT(create_data)) create_data_default = create_data @@ -5038,11 +5040,14 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) IF(PRESENT(close)) close_default = close IF(PRESENT(close_data)) close_data_default = close_data - hdferr = h5pcreate_class_c(parent, name , name_len, class, & + class = H5Pcreate_class(parent, c_name, & create_default, create_data_default, & copy_default, copy_data_default, & close_default, close_data_default) + hdferr = 0 + IF(class.LT.0) hdferr = -1 + END SUBROUTINE h5pcreate_class_f !> diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 28a4fa6..0fe1b20 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -368,7 +368,6 @@ H5_FCDLL int_f h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, H5O_token_t * Functions from H5Pf.c */ H5_FCDLL int_f h5pcreate_c(hid_t_f *cls, hid_t_f *prp_id); -H5_FCDLL int_f h5pclose_c(hid_t_f *prp_id); H5_FCDLL int_f h5pcopy_c(hid_t_f *prp_id, hid_t_f *new_prp_id); H5_FCDLL int_f h5pequal_c(hid_t_f *plist1_id, hid_t_f *plist2_id, int_f *c_flag); H5_FCDLL int_f h5pget_class_c(hid_t_f *prp_id, hid_t_f *classtype); @@ -451,9 +450,6 @@ H5_FCDLL int_f h5pset_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f h5pget_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f h5pset_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); H5_FCDLL int_f h5pget_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); -H5_FCDLL int_f h5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *cls, - H5P_cls_create_func_t create, void *create_data, H5P_cls_copy_func_t copy, - void *copy_data, H5P_cls_close_func_t close, void *close_data); H5_FCDLL int_f h5pregister_c(hid_t_f *cls, _fcd name, int_f *name_len, size_t_f *size, void *value); H5_FCDLL int_f h5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); H5_FCDLL int_f h5pset_c(hid_t_f *prp_id, _fcd name, int_f *name_len, void *value); diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 2ded002..0080177 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -258,7 +258,6 @@ 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 @@ -331,7 +330,6 @@ H5P_mp_H5PCOPY_PROP_F H5P_mp_H5PREMOVE_F H5P_mp_H5PUNREGISTER_F H5P_mp_H5PCLOSE_CLASS_F -H5P_mp_H5PCREATE_CLASS_F H5P_mp_H5PREGISTER_INTEGER H5P_mp_H5PREGISTER_CHAR H5P_mp_H5PINSERT_CHAR |