diff options
author | Elena Pourmal <epourmal@hdfgroup.org> | 2004-08-25 03:44:59 (GMT) |
---|---|---|
committer | Elena Pourmal <epourmal@hdfgroup.org> | 2004-08-25 03:44:59 (GMT) |
commit | 0a965d2236a811f66ff42df732031a150e1020ac (patch) | |
tree | 001765c51deca6aaac80cb48763a2d073869e43d /fortran | |
parent | 98623b2787525823f1020a291e534024cbbfe851 (diff) | |
download | hdf5-0a965d2236a811f66ff42df732031a150e1020ac.zip hdf5-0a965d2236a811f66ff42df732031a150e1020ac.tar.gz hdf5-0a965d2236a811f66ff42df732031a150e1020ac.tar.bz2 |
[svn-r9154]
Purpose: Maintenance/bug fixes (OSF1 C++ and missing Fortran APIs)
Description: bringing 1.6 changes to 1.7
Solution:
Platforms tested: OSF1, Solaris 2.8, AIX5.1
Misc. update:
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5If.c | 30 | ||||
-rw-r--r-- | fortran/src/H5Iff.f90 | 46 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 1 | ||||
-rw-r--r-- | fortran/src/H5f90global.f90 | 6 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 3 | ||||
-rw-r--r-- | fortran/test/tH5I.f90 | 19 |
6 files changed, 102 insertions, 3 deletions
diff --git a/fortran/src/H5If.c b/fortran/src/H5If.c index 3807778..e739508 100644 --- a/fortran/src/H5If.c +++ b/fortran/src/H5If.c @@ -176,3 +176,33 @@ nh5iget_ref_c(hid_t_f *obj_id, int_f *ref_count) done: return ret_value; } + +/*---------------------------------------------------------------------------- + * Name: h5iget_file_id_c + * Purpose: Call H5Iget_file_id to obtain file identifier from object identifier + * Inputs: obj_id - object identifier + * Outputs: file_id - file identifier + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Tuesday, August 24, 2004 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5iget_file_id_c(hid_t_f *obj_id, hid_t_f *file_id) +{ + int ret_value; + hid_t c_file_id; + + /* + * Call H5Iget_file_id + */ + if ((c_file_id = H5Iget_file_id(*obj_id)) < 0) + HGOTO_DONE(FAIL); + + /* Set output & return values */ + *file_id=(hid_t_f)c_file_id; + ret_value=0; + +done: + return ret_value; +} diff --git a/fortran/src/H5Iff.f90 b/fortran/src/H5Iff.f90 index a4bc6f6..91bcdae 100644 --- a/fortran/src/H5Iff.f90 +++ b/fortran/src/H5Iff.f90 @@ -293,5 +293,51 @@ hdferr = h5iget_ref_c(obj_id, ref_count) END SUBROUTINE h5iget_ref_f +!---------------------------------------------------------------------- +! Name: h5iget_file_id_f +! +! Purpose: Obtains file identifier from the object identifier +! +! Inputs: obj_id - object identifier +! Outputs: +! file_id - file identifier +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Optional parameters: +! NONE +! +! Programmer: Elena Pourmal +! August 23, 2004 +! +! Modifications: +! +! Comment: +!---------------------------------------------------------------------- + SUBROUTINE h5iget_file_id_f(obj_id, file_id, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5iget_file_id_f +!DEC$endif +! + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + INTEGER(HID_T), INTENT(OUT) :: file_id ! File identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code + + INTERFACE + INTEGER FUNCTION h5iget_file_id_c(obj_id, file_id) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5IGET_FILE_ID_C':: h5iget_file_id_c + !DEC$ ENDIF + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER(HID_T), INTENT(OUT) :: file_id + END FUNCTION h5iget_file_id_c + END INTERFACE + hdferr = h5iget_file_id_c(obj_id, file_id) + END SUBROUTINE h5iget_file_id_f + END MODULE H5I diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 4e0ecbc..9f75ad5 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -371,6 +371,7 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, h5z_flags[10] = H5Z_FLAG_OPTIONAL; h5z_flags[11] = H5Z_FILTER_CONFIG_ENCODE_ENABLED; h5z_flags[12] = H5Z_FILTER_CONFIG_DECODE_ENABLED; + h5z_flags[13] = H5Z_FILTER_ALL; ret_value = 0; diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90 index 2e54c4a..392fd6c 100644 --- a/fortran/src/H5f90global.f90 +++ b/fortran/src/H5f90global.f90 @@ -514,7 +514,7 @@ ! ! H5Z flags declaration ! - INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 13 + INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 14 INTEGER H5Z_flags(H5Z_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) !DEC$ ATTRIBUTES DLLEXPORT :: /H5Z_FLAGS/ @@ -523,7 +523,7 @@ INTEGER :: H5Z_FILTER_ERROR_F INTEGER :: H5Z_FILTER_NONE_F - INTEGER :: H5Z_FILTER_ALL_F + INTEGER :: H5Z_FILTER_ALL_F INTEGER :: H5Z_FILTER_DEFLATE_F INTEGER :: H5Z_FILTER_SHUFFLE_F INTEGER :: H5Z_FILTER_FLETCHER32_F @@ -538,7 +538,6 @@ EQUIVALENCE(H5Z_flags(1), H5Z_FILTER_ERROR_F) EQUIVALENCE(H5Z_flags(2), H5Z_FILTER_NONE_F) - EQUIVALENCE(H5Z_flags(2), H5Z_FILTER_ALL_F) EQUIVALENCE(H5Z_flags(3), H5Z_FILTER_DEFLATE_F) EQUIVALENCE(H5Z_flags(4), H5Z_FILTER_SHUFFLE_F) EQUIVALENCE(H5Z_flags(5), H5Z_FILTER_FLETCHER32_F) @@ -550,6 +549,7 @@ EQUIVALENCE(H5Z_flags(11), H5Z_FLAG_OPTIONAL_F) EQUIVALENCE(H5Z_flags(12), H5Z_FILTER_ENCODE_ENABLED_F) EQUIVALENCE(H5Z_flags(13), H5Z_FILTER_DECODE_ENABLED_F) + EQUIVALENCE(H5Z_flags(14), H5Z_FILTER_ALL_F) ! diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index f6636d6..3a159a1 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -1158,12 +1158,14 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type); # define nh5iinc_ref_c FNAME(H5IINC_REF_C) # define nh5idec_ref_c FNAME(H5IDEC_REF_C) # define nh5iget_ref_c FNAME(H5IGET_REF_C) +# define nh5iget_file_id_c FNAME(H5IGET_FILE_ID_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) +# define nh5iget_file_id_c FNAME(h5iget_file_id_c) #endif #endif @@ -1172,6 +1174,7 @@ H5_FCDLL int_f nh5iget_name_c(hid_t_f *obj_id, _fcd buf, size_t_f *buf_size, siz H5_FCDLL int_f nh5iinc_ref_c(hid_t_f *obj_id, int_f *ref_count); H5_FCDLL int_f nh5idec_ref_c(hid_t_f *obj_id, int_f *ref_count); H5_FCDLL int_f nh5iget_ref_c(hid_t_f *obj_id, int_f *ref_count); +H5_FCDLL int_f nh5iget_file_id_c(hid_t_f *obj_id, hid_t *file_id); #ifndef H5Ef90_FNAMES diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90 index ee9942b..fb526e4 100644 --- a/fortran/test/tH5I.f90 +++ b/fortran/test/tH5I.f90 @@ -31,6 +31,7 @@ INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: new_file_id ! File identifier INTEGER(HID_T) :: group_id ! group identifier INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER(HID_T) :: dspace_id ! Dataspace identifier @@ -52,6 +53,7 @@ INTEGER :: error ! Error flag INTEGER(HSIZE_T), DIMENSION(2) :: data_dims CHARACTER(LEN=80) name_buf + CHARACTER(LEN=280) name_buf1 INTEGER(SIZE_T) buf_size INTEGER(SIZE_T) name_size INTEGER :: ref_count ! Reference count for IDs @@ -86,6 +88,9 @@ CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & dset_id, error) CALL check("h5dcreate_f",error,total_error) + ! + ! Get dataset name from dataset identifier + ! buf_size = 80 CALL h5iget_name_f(dset_id, name_buf, buf_size, name_size, error) CALL check("h5iget_name_f",error,total_error) @@ -98,6 +103,18 @@ total_error = total_error + 1 endif endif + ! + ! Get file identifier from dataset identifier and then get file name + ! + CALL h5iget_file_id_f(dset_id, new_file_id, error) + CALL check("h5iget_file_id_f",error,total_error) + name_size = 80 + CALL h5fget_name_f(new_file_id, name_buf1, name_size, error) + CALL check("h5fget_name_f",error,total_error) + if (name_buf1(1:name_size) .ne. fix_filename(1:name_size)) then + write(*,*) "h5fget_name returned wrong file name" + total_error = total_error + 1 + endif ! ! Write data_in to the dataset @@ -207,6 +224,8 @@ ! CALL h5fclose_f(file_id, error) CALL check("h5fclose_f",error,total_error) + CALL h5fclose_f(new_file_id, error) + CALL check("h5fclose_f",error,total_error) ! ! Basic Test of increment/decrement ID functions |