Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Dec 26, 2023
1 parent 8622880 commit 2232514
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data
INTEGER :: i
TYPE(opdata), POINTER :: od
TYPE(opdata), TARGET :: nextod
INTEGER(HSIZE_T) :: idx
INTEGER(HSIZE_T), SAVE :: idx

TYPE(C_PTR) :: ptr2
TYPE(C_FUNPTR) :: funptr

CHARACTER(LEN=10) :: space
INTEGER :: spaces ! Number of whitespaces to prepend to output
INTEGER :: len

PRINT*,"START op_func"
ret_val = 0

name_string(1:10) = " "
Expand All @@ -104,13 +104,12 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data
! The name of the object is passed to this function by
! the Library.
!

CALL H5Oget_info_by_name_f(loc_id, name_string, infobuf, status)

spaces = 2*(od%recurs+1)

WRITE(*,'(A)', ADVANCE='NO') space(1:spaces) ! Format output


IF(infobuf%type.EQ.H5O_TYPE_GROUP_F)THEN

WRITE(*,'("Group: ",A," {")') name_string(1:len)
Expand All @@ -134,14 +133,17 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data
ELSE

nextod%recurs = od%recurs + 1
nextod%prev => od
nextod%prev => od%prev
nextod%token = infobuf%token
idx = 0
ptr2 = C_LOC(nextod%recurs)
ptr2 = C_LOC(nextod) !C_LOC(nextod%recurs)
funptr = C_FUNLOC(op_func)
CALL h5literate_by_name_f(loc_id, name_string, H5_INDEX_NAME_F, H5_ITER_NATIVE_F, idx, &
print*,"before"
CALL h5literate_f(loc_id, H5_INDEX_NAME_F, H5_ITER_NATIVE_F, idx, &
funptr, ptr2, ret_val, status)

print*,"end"
!CALL h5literate_by_name_f(loc_id, name_string, H5_INDEX_NAME_F, H5_ITER_NATIVE_F, idx, &
! funptr, ptr2, ret_val, status)
ENDIF
WRITE(*,'(A)') space(1:spaces)//"}"
RETURN
Expand Down Expand Up @@ -213,6 +215,7 @@ PROGRAM main
INTEGER(hsize_t) :: idx
INTEGER :: ret_value
TYPE(C_FUNPTR) :: funptr
TYPE(opdata), POINTER :: cptr
!
! Initialize FORTRAN interface.
!
Expand All @@ -225,7 +228,8 @@ PROGRAM main
CALL h5oget_info_by_name_f(file, "/", infobuf, status)

od%recurs = 0
od%prev => NULL()
call C_F_POINTER(C_NULL_PTR, cptr)
od%prev => cptr ! C_LOC(C_NULL_PTR) !> NULL()
od%token = infobuf%token
!
! Print the root group and formatting, begin iteration.
Expand Down

0 comments on commit 2232514

Please sign in to comment.