summaryrefslogtreecommitdiffstats
path: root/hl/fortran/src/H5LTff.f90
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2012-03-16 00:53:56 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2012-03-16 00:53:56 (GMT)
commit29e7e2890bf51bce3120090f740ce1f336c0d6c4 (patch)
treee01d91aa98559f61a99a0c5a1c777bd495e2a18b /hl/fortran/src/H5LTff.f90
parentf261344af96dc2d41cce61d888cfa3efd8a1c36c (diff)
downloadhdf5-29e7e2890bf51bce3120090f740ce1f336c0d6c4.zip
hdf5-29e7e2890bf51bce3120090f740ce1f336c0d6c4.tar.gz
hdf5-29e7e2890bf51bce3120090f740ce1f336c0d6c4.tar.bz2
[svn-r22078] New API: H5ltpath_valid
REF: HDFFV-1233 A high-level "H5LTpath_valid" routine for checking if a path is correct Both Fortran and C version. Tested: jam (gnu and intel)
Diffstat (limited to 'hl/fortran/src/H5LTff.f90')
-rwxr-xr-xhl/fortran/src/H5LTff.f9067
1 files changed, 67 insertions, 0 deletions
diff --git a/hl/fortran/src/H5LTff.f90 b/hl/fortran/src/H5LTff.f90
index cbc9b96..7d53ab7 100755
--- a/hl/fortran/src/H5LTff.f90
+++ b/hl/fortran/src/H5LTff.f90
@@ -6308,6 +6308,73 @@ CONTAINS
errcode = h5ltget_attribute_info_c(loc_id,namelen,dset_name,attrlen,attr_name,dims,type_class,type_size)
END SUBROUTINE h5ltget_attribute_info_f
+
+ !-------------------------------------------------------------------------
+ ! Function: h5ltpath_valid_f
+ !
+ ! Purpose: Validates a path
+ !
+ ! Return: Success: 0, Failure: -1
+ !
+ ! Programmer: M. Scot Breitenfeld
+ !
+ ! Date: February 18, 2012
+ !
+ ! Comments:
+ !
+ ! Modifications:
+ !
+ !-------------------------------------------------------------------------
+
+ SUBROUTINE h5ltpath_valid_f(loc_id, path, check_object_valid, path_valid, errcode)
+
+ IMPLICIT NONE
+ !
+ !This definition is needed for Windows DLLs
+ !DEC$if defined(BUILD_HDF5_DLL)
+ !DEC$attributes dllexport :: h5ltpath_valid_f
+ !DEC$endif
+ !
+ INTEGER(hid_t) , INTENT(IN) :: loc_id ! File or group identifier.
+ CHARACTER(LEN=*), INTENT(IN) :: path ! Path to the object to check, relative to loc_id.
+ LOGICAL , INTENT(IN) :: check_object_valid ! Indicates whether to check if the final component
+ ! of the path resolves to a valid object
+ LOGICAL , INTENT(OUT) :: path_valid ! Object status
+ INTEGER , INTENT(OUT) :: errcode ! Error code: 0 on success and -1 on failure
+
+ INTEGER :: pathlen
+ INTEGER :: check_object_valid_c
+ INTEGER :: status
+
+ INTERFACE
+ INTEGER FUNCTION h5ltpath_valid_c(loc_id, path, pathlen, check_object_valid_c)
+ USE h5global
+ !DEC$IF DEFINED(HDF5F90_WINDOWS)
+ !DEC$ATTRIBUTES C,reference,decorate,alias:'H5LTPATH_VALID_C'::h5ltpath_valid_c
+ !DEC$ENDIF
+ !DEC$ATTRIBUTES reference :: path
+ INTEGER(hid_t), INTENT(in) :: loc_id
+ CHARACTER(len=*), INTENT(in) :: path
+ INTEGER :: pathlen
+ INTEGER :: check_object_valid_c
+ END FUNCTION h5ltpath_valid_c
+ END INTERFACE
+
+ check_object_valid_c = 0
+ IF(check_object_valid) check_object_valid_c = 1
+
+ pathlen = LEN(path)
+ status = h5ltpath_valid_c(loc_id, path, pathlen, check_object_valid_c)
+
+ path_valid = .FALSE.
+ errcode = 0
+ IF(status.EQ.1)THEN
+ path_valid = .TRUE.
+ ELSE IF(status.LT.0)THEN
+ errcode = -1
+ ENDIF
+
+ END SUBROUTINE h5ltpath_valid_f
! end
!
END MODULE H5LT