summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorNat Furrer <nfurrer@ncsa.uiuc.edu>2004-06-28 19:46:03 (GMT)
committerNat Furrer <nfurrer@ncsa.uiuc.edu>2004-06-28 19:46:03 (GMT)
commit6d682a5a28f1ad599db5ad77e135b25a2efe7ae7 (patch)
tree678b86bf8d678460c0db11fa9cb9e09f40206775 /fortran
parent903580837a2e43d2b72c39206746a20d840c54e8 (diff)
downloadhdf5-6d682a5a28f1ad599db5ad77e135b25a2efe7ae7.zip
hdf5-6d682a5a28f1ad599db5ad77e135b25a2efe7ae7.tar.gz
hdf5-6d682a5a28f1ad599db5ad77e135b25a2efe7ae7.tar.bz2
[svn-r8753]
Purpose: Handled SZIP without the encoder present. Description: It is now an error for a user to try to create, extend, or write to a dataset without the encoder present in their SZIP library. Added H5Zget_filter_info to provide users with a way to query HDF5 about the presence (or lack thereof) of the SZIP encoder. Platforms tested: Windows Verbena Arabica Copper Misc. update:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Zf.c26
-rw-r--r--fortran/src/H5Zff.f9062
-rw-r--r--fortran/src/H5_f.c2
-rw-r--r--fortran/src/H5f90global.f906
-rw-r--r--fortran/src/H5f90proto.h4
-rw-r--r--fortran/test/tH5Z.f9031
6 files changed, 128 insertions, 3 deletions
diff --git a/fortran/src/H5Zf.c b/fortran/src/H5Zf.c
index 70e0dee..8c2b6b6 100644
--- a/fortran/src/H5Zf.c
+++ b/fortran/src/H5Zf.c
@@ -67,3 +67,29 @@ nh5zfilter_avail_c ( int_f *filter , int_f *flag )
if ( status < 0 ) ret_value = -1;
return ret_value;
}
+
+/*----------------------------------------------------------------------------
+ * Name: h5zget_filter_info_c
+ * Purpose: Call H5Zget_filter_info to find if filter has its encoder
+ * and/or its decoder available
+ * Inputs: filter - filter identifier
+ * Outputs: flag - status flag
+ * Returns: 0 on success, -1 on failure
+ * Programmer: Nat Furrer and James Laird
+ * Wednesday, June 16, 2004
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5zget_filter_info_c ( int_f *filter , int_f *flag )
+{
+ int ret_value = 0;
+ H5Z_filter_t c_filter;
+ unsigned int c_flag;
+
+ c_filter = (H5Z_filter_t)*filter;
+ ret_value = H5Zget_filter_info(c_filter, &c_flag);
+ *flag = (int_f)c_flag;
+
+ return ret_value;
+}
diff --git a/fortran/src/H5Zff.f90 b/fortran/src/H5Zff.f90
index 839ab6f..2d0afde 100644
--- a/fortran/src/H5Zff.f90
+++ b/fortran/src/H5Zff.f90
@@ -130,6 +130,68 @@
END SUBROUTINE h5zfilter_avail_f
+!----------------------------------------------------------------------
+! Name: h5zget_filter_info_f
+!
+! Purpose: Queries if filter has its encoder and/or decoder
+! available
+!
+! Inputs:
+! filter - filter
+! Outputs:
+! config_flags - Bit vector possibly containing the
+! following values:
+! H5Z_FILTER_ENCODE_ENABLED_F
+! H5Z_FILTER_DECODE_ENABLED_F
+! hdferr: - error code
+! Success: 0
+! Failure: -1
+! Optional parameters:
+! NONE
+!
+! Programmer: Nat Furrer and James Laird
+! June 16, 2004
+!
+! Modifications:
+!
+!----------------------------------------------------------------------
+ SUBROUTINE h5zget_filter_info_f(filter, config_flags, hdferr)
+!
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5zget_filter_info_f
+!DEC$endif
+!
+
+ IMPLICIT NONE
+ INTEGER, INTENT(IN) :: filter ! Filter; may be one of the following:
+ ! H5Z_FILTER_DEFLATE_F
+ ! H5Z_FILTER_SHUFFLE_F
+ ! H5Z_FILTER_FLETCHER32_F
+ ! H5Z_FILTER_SZIP_F
+ INTEGER, INTENT(OUT) :: config_flags! Flag, indicates if filter
+ ! has its encoder and/or decoder
+ ! available
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+
+! INTEGER, EXTERNAL :: h5zget_filter_info_c
+! MS FORTRAN needs explicit interface for C functions called here.
+!
+ INTERFACE
+ INTEGER FUNCTION h5zget_filter_info_c(filter, config_flags)
+ USE H5GLOBAL
+ !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+ !MS$ATTRIBUTES C,reference,alias:'_H5ZGET_FILTER_INFO_C'::h5zget_filter_info_c
+ !DEC$ ENDIF
+ INTEGER, INTENT(IN) :: filter
+ INTEGER, INTENT(OUT) :: config_flags
+ END FUNCTION h5zget_filter_info_c
+ END INTERFACE
+
+ hdferr = h5zget_filter_info_c(filter, config_flags)
+
+ END SUBROUTINE h5zget_filter_info_f
+
END MODULE H5Z
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index db35319..ad8d6aa 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -396,6 +396,8 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5e_flags, int_f *h5f_flags,
h5z_flags[8] = H5Z_NO_EDC;
h5z_flags[9] = H5Z_FILTER_SZIP;
h5z_flags[10] = H5Z_FLAG_OPTIONAL;
+ h5z_flags[11] = H5Z_FILTER_CONFIG_ENCODE_ENABLED;
+ h5z_flags[12] = H5Z_FILTER_CONFIG_DECODE_ENABLED;
ret_value = 0;
return ret_value;
diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90
index 54fac81..5f6f91e 100644
--- a/fortran/src/H5f90global.f90
+++ b/fortran/src/H5f90global.f90
@@ -572,7 +572,7 @@
!
! H5Z flags declaration
!
- INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 11
+ INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 13
INTEGER H5Z_flags(H5Z_FLAGS_LEN)
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$ ATTRIBUTES DLLEXPORT :: /H5Z_FLAGS/
@@ -590,6 +590,8 @@
INTEGER :: H5Z_ENABLE_EDC_F
INTEGER :: H5Z_NO_EDC_F
INTEGER :: H5Z_FLAG_OPTIONAL_F
+ INTEGER :: H5Z_FILTER_ENCODE_ENABLED_F
+ INTEGER :: H5Z_FILTER_DECODE_ENABLED_F
EQUIVALENCE(H5Z_flags(1), H5Z_FILTER_ERROR_F)
EQUIVALENCE(H5Z_flags(2), H5Z_FILTER_NONE_F)
@@ -602,6 +604,8 @@
EQUIVALENCE(H5Z_flags(9), H5Z_NO_EDC_F)
EQUIVALENCE(H5Z_flags(10), H5Z_FILTER_SZIP_F)
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)
!
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index d4d9be2..243a73d 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -1245,14 +1245,16 @@ H5_DLL int_f nh5dont_atexit_c(void);
#ifdef DF_CAPFNAMES
# define nh5zunregister_c FNAME(H5ZUNREGISTER_C)
# define nh5zfilter_avail_c FNAME(H5ZFILTER_AVAIL_C)
+# define nh5zget_filter_info_c FNAME(H5ZGET_FILTER_INFO_C)
#else
# define nh5zunregister_c FNAME(h5zunregister_c)
# define nh5zfilter_avail_c FNAME(h5zfilter_avail_c)
+# define nh5zget_filter_info_c FNAME(h5zget_filter_info_c)
#endif
#endif
H5_DLL int_f nh5zunregister_c (int_f *filter);
H5_DLL int_f nh5zfilter_avail_c ( int_f *filter , int_f *flag );
-
+H5_DLL int_f nh5zget_filter_info_c (int_f *filter, int_f *flag );
#endif /* _H5f90proto_H */
diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90
index 91a3bc7..4216d1b 100644
--- a/fortran/test/tH5Z.f90
+++ b/fortran/test/tH5Z.f90
@@ -137,7 +137,36 @@
INTEGER :: filter_flag = -1
INTEGER(SIZE_T) :: cd_nelemnts = 4
INTEGER(SIZE_T) :: filter_name_len = 4
- INTEGER, DIMENSION(4) :: cd_values
+ INTEGER, DIMENSION(4) :: cd_values
+ INTEGER :: config_flag = 0
+
+ !
+ ! Make sure that Szip has an encoder available
+ !
+ CALL h5zget_filter_info_f(H5Z_FILTER_SZIP_F, config_flag, error)
+ CALL check("h5zget_filter_info", error, total_error)
+ if ( IAND(config_flag, H5Z_FILTER_ENCODE_ENABLED_F) .EQ. 0 ) then
+ szip_flag = .FALSE.
+ total_error = -1
+ return
+ endif
+ CALL h5zfilter_avail_f(H5Z_FILTER_SZIP_F, flag, error)
+ CALL check("h5zfilter_avail", error, total_error)
+
+ !
+ ! Make sure h5zget_filter_info_f returns the right flag
+ !
+ if( flag ) then
+ if ( config_flag .NE. IOR( H5Z_FILTER_ENCODE_ENABLED_F, H5Z_FILTER_DECODE_ENABLED_F) ) then
+ error = -1
+ CALL check("h5zget_filter_info config_flag", error, total_error)
+ endif
+ else
+ if ( config_flag .NE. 0 ) then
+ error = -1
+ CALL check("h5zget_filter_info config_flag", error, total_error)
+ endif
+ endif
options_mask = H5_SZIP_NN_OM_F + H5_SZIP_CHIP_OM_F
pix_per_block = 32