From e865f21190c01363f03f4753fce66cac26f0409b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 11 Dec 2003 13:29:25 -0500 Subject: [svn-r7934] Purpose: Add new feature Description: Add FORTRAN wrappers for new H5I routines. Platforms tested: FreeBSD 4.9 (sleipnir) h5committest --- fortran/src/H5If.c | 88 ++++++++++++++++++++++++++++ fortran/src/H5Iff.f90 | 149 ++++++++++++++++++++++++++++++++++++++++++++++- fortran/src/H5f90proto.h | 9 +++ 3 files changed, 243 insertions(+), 3 deletions(-) diff --git a/fortran/src/H5If.c b/fortran/src/H5If.c index 1de90d6..3807778 100644 --- a/fortran/src/H5If.c +++ b/fortran/src/H5If.c @@ -15,6 +15,7 @@ /* This files contains C stubs for H5I Fortran APIs */ #include "H5f90.h" +#include "H5Eprivate.h" /*---------------------------------------------------------------------------- * Name: h5iget_type_c @@ -88,3 +89,90 @@ DONE: HDfree(c_buf); return ret_value; } + +/*---------------------------------------------------------------------------- + * Name: h5iinc_ref_c + * Purpose: Call H5Iinc_ref to increment object's reference count + * Inputs: obj_id - object identifier + * Outputs: ref_count - Reference count of ID + * Returns: current reference count on success, -1 on failure + * Programmer: Quincey Koziol + * Tuesday, December 9, 2003 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5iinc_ref_c(hid_t_f *obj_id, int_f *ref_count) +{ + int ret_value; + + /* + * Call H5Iinc_ref function + */ + if ((ret_value = H5Iinc_ref(*obj_id)) < 0) + HGOTO_DONE(FAIL); + + /* Set output & return values */ + *ref_count=ret_value; + ret_value=0; + +done: + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5idec_ref_c + * Purpose: Call H5Idec_ref to decrement object's reference count + * Inputs: obj_id - object identifier + * Outputs: ref_count - Reference count of ID + * Returns: current reference count on success, -1 on failure + * Programmer: Quincey Koziol + * Tuesday, December 9, 2003 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5idec_ref_c(hid_t_f *obj_id, int_f *ref_count) +{ + int ret_value; + + /* + * Call H5Idec_ref function + */ + if ((ret_value = H5Idec_ref(*obj_id)) < 0) + HGOTO_DONE(FAIL); + + /* Set output & return values */ + *ref_count=ret_value; + ret_value=0; + +done: + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5iget_ref_c + * Purpose: Call H5Iget_ref to retrieve object's reference count + * Inputs: obj_id - object identifier + * Outputs: ref_count - Reference count of ID + * Returns: current reference count on success, -1 on failure + * Programmer: Quincey Koziol + * Tuesday, December 9, 2003 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5iget_ref_c(hid_t_f *obj_id, int_f *ref_count) +{ + int ret_value; + + /* + * Call H5Iget_ref function + */ + if ((ret_value = H5Iget_ref(*obj_id)) < 0) + HGOTO_DONE(FAIL); + + /* Set output & return values */ + *ref_count=ret_value; + ret_value=0; + +done: + return ret_value; +} diff --git a/fortran/src/H5Iff.f90 b/fortran/src/H5Iff.f90 index b277c93..a4bc6f6 100644 --- a/fortran/src/H5Iff.f90 +++ b/fortran/src/H5Iff.f90 @@ -86,6 +86,7 @@ END INTERFACE hdferr = h5iget_type_c(obj_id, type) END SUBROUTINE h5iget_type_f + !---------------------------------------------------------------------- ! Name: h5iget_name_f ! @@ -145,10 +146,152 @@ hdferr = h5iget_name_c(obj_id, buf, buf_size, name_size) END SUBROUTINE h5iget_name_f +!---------------------------------------------------------------------- +! Name: h5iinc_ref_f +! +! Purpose: Increments the reference count of an ID +! +! Inputs: obj_id - object identifier +! Outputs: +! ref_count - Current reference count of the ID +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Optional parameters: +! NONE +! +! Programmer: Quincey Koziol +! December 9, 2003 +! +! Modifications: +! +! Comment: +!---------------------------------------------------------------------- + SUBROUTINE h5iinc_ref_f(obj_id, ref_count, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5iinc_ref_f +!DEC$endif +! + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id !Object identifier + INTEGER, INTENT(OUT) :: ref_count !Current reference count of ID + INTEGER, INTENT(OUT) :: hdferr ! Error code - END MODULE H5I - +! INTEGER, EXTERNAL :: h5iinc_ref_c +! Interface is needed for MS FORTRAN +! + INTERFACE + INTEGER FUNCTION h5iinc_ref_c(obj_id, ref_count) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5IINC_REF_C':: h5iinc_ref_c + !DEC$ ENDIF + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER, INTENT(OUT) :: ref_count + END FUNCTION h5iinc_ref_c + END INTERFACE + hdferr = h5iinc_ref_c(obj_id, ref_count) + END SUBROUTINE h5iinc_ref_f - +!---------------------------------------------------------------------- +! Name: h5idec_ref_f +! +! Purpose: Decrements the reference count of an ID +! +! Inputs: obj_id - object identifier +! Outputs: +! ref_count - Current reference count of the ID +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Optional parameters: +! NONE +! +! Programmer: Quincey Koziol +! December 9, 2003 +! +! Modifications: +! +! Comment: +!---------------------------------------------------------------------- + SUBROUTINE h5idec_ref_f(obj_id, ref_count, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5idec_ref_f +!DEC$endif +! + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id !Object identifier + INTEGER, INTENT(OUT) :: ref_count !Current reference count of ID + INTEGER, INTENT(OUT) :: hdferr ! Error code +! INTEGER, EXTERNAL :: h5idec_ref_c +! Interface is needed for MS FORTRAN +! + INTERFACE + INTEGER FUNCTION h5idec_ref_c(obj_id, ref_count) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5IDEC_REF_C':: h5idec_ref_c + !DEC$ ENDIF + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER, INTENT(OUT) :: ref_count + END FUNCTION h5idec_ref_c + END INTERFACE + hdferr = h5idec_ref_c(obj_id, ref_count) + END SUBROUTINE h5idec_ref_f + +!---------------------------------------------------------------------- +! Name: h5iget_ref_f +! +! Purpose: Retrieves the reference count of an ID +! +! Inputs: obj_id - object identifier +! Outputs: +! ref_count - Current reference count of the ID +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Optional parameters: +! NONE +! +! Programmer: Quincey Koziol +! December 9, 2003 +! +! Modifications: +! +! Comment: +!---------------------------------------------------------------------- + SUBROUTINE h5iget_ref_f(obj_id, ref_count, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5iget_ref_f +!DEC$endif +! + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id !Object identifier + INTEGER, INTENT(OUT) :: ref_count !Current reference count of ID + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5iget_ref_c +! Interface is needed for MS FORTRAN +! + INTERFACE + INTEGER FUNCTION h5iget_ref_c(obj_id, ref_count) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5IGET_REF_C':: h5iget_ref_c + !DEC$ ENDIF + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER, INTENT(OUT) :: ref_count + END FUNCTION h5iget_ref_c + END INTERFACE + hdferr = h5iget_ref_c(obj_id, ref_count) + END SUBROUTINE h5iget_ref_f + + END MODULE H5I diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index ab27ac7..5b7c180 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -1180,14 +1180,23 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type); #ifdef DF_CAPFNAMES # define nh5iget_type_c FNAME(H5IGET_TYPE_C) # define nh5iget_name_c FNAME(H5IGET_NAME_C) +# define nh5iinc_ref_c FNAME(H5IINC_REF_C) +# define nh5idec_ref_c FNAME(H5IDEC_REF_C) +# define nh5iget_ref_c FNAME(H5IGET_REF_C) #else # define nh5iget_type_c FNAME(h5iget_type_c) # define nh5iget_name_c FNAME(h5iget_name_c) +# define nh5iinc_ref_c FNAME(h5iinc_ref_c) +# define nh5idec_ref_c FNAME(h5idec_ref_c) +# define nh5iget_ref_c FNAME(h5iget_ref_c) #endif #endif H5_DLL int_f nh5iget_type_c(hid_t_f *obj_id, int_f *type); H5_DLL int_f nh5iget_name_c(hid_t_f *obj_id, _fcd buf, size_t_f *buf_size, size_t_f *name_size); +H5_DLL int_f nh5iinc_ref_c(hid_t_f *obj_id, int_f *ref_count); +H5_DLL int_f nh5idec_ref_c(hid_t_f *obj_id, int_f *ref_count); +H5_DLL int_f nh5iget_ref_c(hid_t_f *obj_id, int_f *ref_count); #ifndef H5Ef90_FNAMES -- cgit v0.12