Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the use of C wrappers from H5P APIs. #3824

Merged
merged 5 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fortran/src/H5Off.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ SUBROUTINE h5oget_info_by_idx_f(loc_id, group_name, index_field, order, n, &
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
Expand Down
70 changes: 0 additions & 70 deletions fortran/src/H5Pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,6 @@ h5pcreate_c(hid_t_f *cls, hid_t_f *prp_id)
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
Expand Down Expand Up @@ -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
Expand Down
55 changes: 30 additions & 25 deletions fortran/src/H5Pff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,16 @@ SUBROUTINE h5pclose_f(prp_id, hdferr)
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

!>
Expand Down Expand Up @@ -5005,31 +5006,32 @@ SUBROUTINE h5pcreate_class_f(parent, name, class, hdferr, create, create_data, &
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
Expand All @@ -5038,11 +5040,14 @@ END FUNCTION h5pcreate_class_c
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

!>
Expand Down
4 changes: 0 additions & 4 deletions fortran/src/H5f90proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions fortran/src/hdf5_fortrandll.def.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion fortran/testpar/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST_PROG_PARA=parallel_test subfiling_test async_test
check_PROGRAMS=$(TEST_PROG_PARA)

# Temporary files
CHECK_CLEANFILES+=parf[12].h5 h5*_tests.h5 subf.h5* test_async_apis.mod
CHECK_CLEANFILES+=parf[12].h5 h5*_tests.h5 subf.h5* *.mod
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some compilers use capital letters.


# Test source files
parallel_test_SOURCES=ptest.F90 hyper.F90 mdset.F90 multidsetrw.F90
Expand Down