Skip to content

Commit

Permalink
Sync Fortran w/ develop (#3296)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Jul 27, 2023
1 parent 0e82707 commit 41a6b58
Show file tree
Hide file tree
Showing 33 changed files with 203 additions and 210 deletions.
20 changes: 10 additions & 10 deletions fortran/src/H5Af.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ h5adelete_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_f
* Convert FORTRAN name to C name
*/
if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Adelete_by_name function.
*/
if (H5Adelete_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order,
(hsize_t)*n, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

done:
if (c_obj_name)
Expand Down Expand Up @@ -289,22 +289,22 @@ h5aget_name_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_
* Convert FORTRAN name to C name
*/
if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Allocate buffer to hold name of an attribute
*/
c_buf_size = (size_t)*size + 1;
if (NULL == (c_buf = (char *)malloc(c_buf_size)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Aget_name_by_idx function.
*/
c_size = H5Aget_name_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order,
(hsize_t)*n, c_buf, c_buf_size, (hid_t)*lapl_id);
if (c_size < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Convert C name to FORTRAN and place it in the given buffer
Expand Down Expand Up @@ -415,14 +415,14 @@ h5aget_info_by_idx_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, int_
* Convert FORTRAN name to C name
*/
if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Ainfo_by_idx function.
*/
if (H5Aget_info_by_idx((hid_t)*loc_id, c_obj_name, (H5_index_t)*idx_type, (H5_iter_order_t)*order,
(hsize_t)*n, &ainfo, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/* Unpack the structure */
*corder_valid = 0;
Expand Down Expand Up @@ -477,15 +477,15 @@ h5aget_info_by_name_c(hid_t_f *loc_id, _fcd obj_name, size_t_f *obj_namelen, _fc
* Convert FORTRAN name to C name
*/
if (NULL == (c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);
if (NULL == (c_attr_name = HD5f2cstring(attr_name, (size_t)*attr_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Ainfo_by_name function.
*/
if (H5Aget_info_by_name((hid_t)*loc_id, c_obj_name, c_attr_name, &ainfo, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/* Unpack the structure */
*corder_valid = 0;
Expand Down
3 changes: 1 addition & 2 deletions fortran/src/H5Aff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@

MODULE H5A

USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_NULL_CHAR, C_LOC, C_INT

USE H5GLOBAL
IMPLICIT NONE

PRIVATE h5awrite_char_scalar, h5awrite_ptr
PRIVATE h5aread_char_scalar, h5aread_ptr
Expand Down
7 changes: 4 additions & 3 deletions fortran/src/H5Dff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@

MODULE H5D

USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR
USE H5GLOBAL
USE H5LIB, ONLY : h5kind_to_type
USE H5S, ONLY : H5Sget_simple_extent_ndims_f, H5Sclose_f
IMPLICIT NONE

PRIVATE h5dread_vl_integer, h5dread_vl_real, h5dread_vl_string
PRIVATE h5dwrite_vl_integer, h5dwrite_vl_real, h5dwrite_vl_string
Expand Down Expand Up @@ -2266,6 +2266,9 @@ SUBROUTINE h5dfill_char(fill_value, space_id, buf, hdferr)
CALL h5dfill_ptr(f_ptr_fill_value, fill_type_id, f_ptr_buf, mem_type_id, space_id, hdferr)

END SUBROUTINE h5dfill_char

#endif

!>
!! \ingroup FH5D
!!
Expand Down Expand Up @@ -2369,8 +2372,6 @@ END FUNCTION H5Dwrite_multi

END SUBROUTINE h5dwrite_multi_f

#endif

END MODULE H5D


1 change: 0 additions & 1 deletion fortran/src/H5ESff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

MODULE H5ES

USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_INT64_T, C_BOOL
USE H5GLOBAL
IMPLICIT NONE

Expand Down
24 changes: 12 additions & 12 deletions fortran/src/H5Ef.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ h5eclear_c(hid_t_f *estack_id)
* Call H5Eclear function.
*/
if (H5Eclear2((hid_t)*estack_id) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

done:
return ret_value;
Expand Down Expand Up @@ -72,19 +72,19 @@ h5eprint_c1(_fcd name, int_f *namelen)
int_f ret_value = 0;

if (NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);
if (NULL == (file = fopen(c_name, "a")))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Eprint2 function.
*/
if (H5Eprint2(H5E_DEFAULT, file) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

done:
if (file)
HDfclose(file);
fclose(file);
if (c_name)
free(c_name);

Expand Down Expand Up @@ -115,7 +115,7 @@ h5eprint_c2(void)
* Call H5Eprint2 function.
*/
if (H5Eprint2(H5E_DEFAULT, NULL) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

done:
return ret_value;
Expand Down Expand Up @@ -147,15 +147,15 @@ h5eget_major_c(int_f *error_no, _fcd name, size_t_f *namelen)
c_name = (char *)malloc(c_namelen + 1);

if (!c_name)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Eget_msg function.
*/
H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen);
HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen);
if (!HDstrcmp(c_name, "Invalid major error number"))
HGOTO_DONE(FAIL)
if (!strcmp(c_name, "Invalid major error number"))
HGOTO_DONE(FAIL);

done:
if (c_name)
Expand Down Expand Up @@ -190,15 +190,15 @@ h5eget_minor_c(int_f *error_no, _fcd name, size_t_f *namelen)
c_name = (char *)malloc(c_namelen + 1);

if (!c_name)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Eget_msg function.
*/
H5Eget_msg((hid_t)*error_no, NULL, c_name, c_namelen);
HD5packFstring((char *)c_name, _fcdtocp(name), c_namelen);
if (!HDstrcmp(c_name, "Invalid minor error number"))
HGOTO_DONE(FAIL)
if (!strcmp(c_name, "Invalid minor error number"))
HGOTO_DONE(FAIL);

done:
if (c_name)
Expand Down
2 changes: 1 addition & 1 deletion fortran/src/H5Eff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

MODULE H5E

USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_FUNPTR, C_CHAR
USE H5GLOBAL
IMPLICIT NONE

INTEGER, PARAMETER :: PRINTON = 1 !< Turn on automatic printing of errors
INTEGER, PARAMETER :: PRINTOFF = 0 !< Turn off automatic printing of errors
Expand Down
2 changes: 1 addition & 1 deletion fortran/src/H5Fff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
!

MODULE H5F
USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_NULL_PTR

USE H5GLOBAL
IMPLICIT NONE

Expand Down
4 changes: 2 additions & 2 deletions fortran/src/H5Gff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
!

MODULE H5G
USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_CHAR, C_INT

USE H5GLOBAL
USE H5P, ONLY : H5Pcreate_f, H5Pset_local_heap_size_hint_f, H5Pclose_f

IMPLICIT NONE

!
! @brief Fortran2003 Derived Type for @ref H5G_info_t
Expand Down
2 changes: 1 addition & 1 deletion fortran/src/H5Iff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

MODULE H5I

USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR
USE H5GLOBAL
IMPLICIT NONE

CONTAINS

Expand Down
22 changes: 11 additions & 11 deletions fortran/src/H5Lf.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ h5lcopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *de
* Convert FORTRAN name to C name
*/
if (NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);
if (NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Lcopy function.
*/
if (H5Lcopy((hid_t)*src_loc_id, c_src_name, (hid_t)*dest_loc_id, c_dest_name, (hid_t)*lcpl_id,
(hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

done:
if (c_src_name)
Expand Down Expand Up @@ -350,16 +350,16 @@ h5lmove_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *de
* Convert FORTRAN name to C name
*/
if (NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);
if (NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Lmove function.
*/
if (H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dest_loc_id, c_dest_name, (hid_t)*lcpl_id,
(hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

done:
if (c_src_name)
Expand Down Expand Up @@ -407,20 +407,20 @@ h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
* Convert FORTRAN name to C name
*/
if (NULL == (c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

c_size = (size_t)*size + 1;

/*
* Allocate buffer to hold name of an attribute
*/
if (NULL == (c_name = (char *)malloc(c_size)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

if ((c_size_link =
H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field,
(H5_iter_order_t)*order, (hsize_t)*n, c_name, c_size, (hid_t)*lapl_id)) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

*size = (size_t_f)c_size_link;

Expand Down Expand Up @@ -625,13 +625,13 @@ h5lget_val_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, size_
* Convert FORTRAN name to C name
*/
if (NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)))
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

/*
* Call H5Lget_val
*/
if (H5Lget_val((hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
HGOTO_DONE(FAIL);

done:
if (c_link_name)
Expand Down
5 changes: 1 addition & 4 deletions fortran/src/H5Lff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@

MODULE H5L

USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_FUNPTR, C_CHAR, C_INT64_T, C_INT
USE H5GLOBAL

IMPLICIT NONE


TYPE, bind(c) :: union_t
TYPE(H5O_TOKEN_T_F) :: token !< Type for object tokens
INTEGER(size_t) :: val_size !< Size of a soft link or user-defined link value
Expand All @@ -57,7 +54,7 @@ MODULE H5L
!< \li H5L_TYPE_SOFT_F Soft link
!< \li H5L_TYPE_EXTERNAL_F External link
!< \li H5L_TYPE_ERROR_F Invalid link type id
! LOGICAL(c_bool) :: corder_valid ! hbool_t corder_valid
! LOGICAL(c_bool) :: corder_valid ! bool corder_valid
INTEGER(c_int64_t) :: corder !< Creation order
INTEGER(c_int) :: cset !< Character set of link name is encoded. Valid values include the following:
!< \li H5T_CSET_ASCII US ASCII
Expand Down
8 changes: 4 additions & 4 deletions fortran/src/H5Of.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info)
object_info->type = (int_f)Oinfo.type;
object_info->rc = (int_f)Oinfo.rc;

ts = HDgmtime(&Oinfo.atime);
ts = gmtime(&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 */
Expand All @@ -49,7 +49,7 @@ fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info)
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);
ts = gmtime(&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 */
Expand All @@ -60,7 +60,7 @@ fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info)
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);
ts = gmtime(&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 */
Expand All @@ -71,7 +71,7 @@ fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info)
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);
ts = gmtime(&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 */
Expand Down
Loading

0 comments on commit 41a6b58

Please sign in to comment.