From b98dea5cf1a6fc0e4ce37621720cf339148d3e3b Mon Sep 17 00:00:00 2001
From: Scot Breitenfeld <brtnfld@hdfgroup.org>
Date: Wed, 18 Jun 2008 14:53:28 -0500
Subject: [svn-r15233] Description:

Added the function h5tget_native_type and associated
requirements.
---
 fortran/src/H5Tf.c          | 26 ++++++++++++++++++++
 fortran/src/H5Tff.f90       | 58 +++++++++++++++++++++++++++++++++++++++++++++
 fortran/src/H5_f.c          |  2 ++
 fortran/src/H5f90global.f90 |  7 ++++--
 fortran/src/H5f90proto.h    |  2 ++
 5 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index 633389b..490d739 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -1840,3 +1840,29 @@ nh5tcompiler_conv_c ( hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag)
   ret_value = 0;
   return ret_value;
 }
+/*----------------------------------------------------------------------------
+ * Name:        h5tget_native_type_c
+ * Purpose:     Call H5Tget_native_type
+ * Inputs:    
+ *              dtype_id         - Datatype identifier for the dataset datatype.
+ *              direction        - Direction of search.
+ * Outputs:     native_dtype_id  - The native datatype identifier for the specified dataset datatype
+ * Returns:     0 on success, -1 on failure
+ * Programmer:  M.S. Breitenfeld
+ *              June 18, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5tget_native_type_c(hid_t_f *dtype_id, int_f *direction, hid_t_f *native_dtype_id)
+{
+  int ret_value = -1;
+  hid_t status;
+
+  status = H5Tget_native_type( (hid_t)*dtype_id, (H5T_direction_t)*direction);
+  if ( status < 0  ) return ret_value;
+  *native_dtype_id = (hid_t_f)status;
+  ret_value = 0;
+  return ret_value;
+}
+
diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90
index 8f12886..7a812ab 100644
--- a/fortran/src/H5Tff.f90
+++ b/fortran/src/H5Tff.f90
@@ -3646,4 +3646,62 @@ CONTAINS
 
   END SUBROUTINE h5tcompiler_conv_f
 
+!----------------------------------------------------------------------
+! Name:		h5tget_native_type_f 
+!
+! Purpose:  	Returns the native datatype of a specified datatype.
+!		
+! Inputs:  
+!		dtype_id   - Datatype identifier for the dataset datatype.
+!                        *
+!               direction  - Direction of search: 
+!                    H5T_DIR_DEFAULT     = 0,    /*default direction is inscendent */
+!                    H5T_DIR_ASCEND      = 1,    /*in inscendent order             */
+!                    H5T_DIR_DESCEND     = 2     /*in descendent order             */
+!               * NOTE: In C it is defined as a structure: H5T_direction_t
+!
+! Outputs:  
+!               native_dtype_id  - The native datatype identifier for the specified dataset datatype
+!		hdferr:          - Error code		
+!				     Success:  0
+!				     Failure: -1   
+! Optional parameters:
+!				NONE			
+!
+! Programmer:	M.S. Breitenfeld
+!		June 18, 2008	
+!
+! Modifications:  N/A
+!
+!----------------------------------------------------------------------
+
+  SUBROUTINE h5tget_native_type_f(dtype_id, direction, native_dtype_id, hdferr) 
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5tget_native_type_f
+!DEC$endif
+    IMPLICIT NONE
+    INTEGER(HID_T), INTENT(IN) :: dtype_id  ! Datatype identifier
+    INTEGER, INTENT(IN) :: direction  ! Direction of search:
+                                      ! H5T_DIR_ASCEND_F      = 1  in inscendent order
+                                      ! H5T_DIR_DESCEND_F     = 2  in descendent order
+    INTEGER(HID_T), INTENT(OUT) :: native_dtype_id  ! The native datatype identifier
+    INTEGER, INTENT(OUT) :: hdferr    ! Error code:
+                                      ! 0 on success and -1 on failure
+    INTERFACE
+       INTEGER FUNCTION h5tget_native_type_c(dtype_id, direction, native_dtype_id)
+         USE H5GLOBAL
+         !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+         !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5TGET_NATIVE_TYPE_C'::h5tget_native_type_c
+         !DEC$ ENDIF
+         INTEGER(HID_T), INTENT(IN) :: dtype_id 
+         INTEGER, INTENT(IN) :: direction
+         INTEGER(HID_T), INTENT(OUT) :: native_dtype_id
+       END FUNCTION h5tget_native_type_c
+    END INTERFACE
+    
+    hdferr = h5tget_native_type_c(dtype_id, direction, native_dtype_id)
+  END SUBROUTINE h5tget_native_type_f
+
+
 END MODULE H5T
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 8df766c..efc478d 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -484,6 +484,8 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
       h5t_flags[28] = (int_f)H5T_STR_ERROR;
       h5t_flags[29] = (int_f)H5T_VLEN;
       h5t_flags[30] = (int_f)H5T_ARRAY;
+      h5t_flags[31] = (int_f)H5T_DIR_ASCEND;
+      h5t_flags[32] = (int_f)H5T_DIR_DESCEND;
 /*
  *  H5Z flags
  */
diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90
index 251e49c..bf2d715 100644
--- a/fortran/src/H5f90global.f90
+++ b/fortran/src/H5f90global.f90
@@ -625,11 +625,10 @@
       EQUIVALENCE(H5S_flags(19), H5S_SEL_HYPERSLABS_F)
       EQUIVALENCE(H5S_flags(20), H5S_SEL_ALL_F)
 
-
 !
 ! H5T flags declaration
 !
-      INTEGER, PARAMETER :: H5T_FLAGS_LEN = 31
+      INTEGER, PARAMETER :: H5T_FLAGS_LEN = 33
       INTEGER H5T_flags(H5T_FLAGS_LEN)
 !DEC$if defined(BUILD_HDF5_DLL)
 !DEC$ ATTRIBUTES DLLEXPORT :: /H5T_FLAGS/
@@ -667,6 +666,8 @@
       INTEGER ::  H5T_STR_NULLPAD_F 
       INTEGER ::  H5T_STR_SPACEPAD_F
       INTEGER ::  H5T_STR_ERROR_F
+      INTEGER ::  H5T_DIR_ASCEND_F
+      INTEGER ::  H5T_DIR_DESCEND_F
        
       EQUIVALENCE(H5T_flags(1), H5T_NO_CLASS_F)
       EQUIVALENCE(H5T_flags(2), H5T_INTEGER_F)
@@ -699,6 +700,8 @@
       EQUIVALENCE(H5T_flags(29), H5T_STR_ERROR_F)
       EQUIVALENCE(H5T_flags(30), H5T_VLEN_F)
       EQUIVALENCE(H5T_flags(31), H5T_ARRAY_F)
+      EQUIVALENCE(H5T_flags(32), H5T_DIR_ASCEND_F)
+      EQUIVALENCE(H5T_flags(33), H5T_DIR_DESCEND_F)
 
 !
 ! H5Z flags declaration
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index b06be58..3f8f361 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -666,6 +666,7 @@ H5_FCDLL int_f nh5arename_c( hid_t_f *loc_id,
 #   define nh5tencode_c    H5_FC_FUNC_(h5tencode_c, H5TENCODE_C)
 #   define nh5tget_create_plist_c H5_FC_FUNC_(h5tget_create_plist_c, H5TGET_CREATE_PLIST_C)
 #   define nh5tcompiler_conv_c H5_FC_FUNC_(h5tcompiler_conv_c, H5TCOMPILER_CONV_C)
+#   define nh5tget_native_type_c H5_FC_FUNC_(h5tget_native_type_c, H5TGET_NATIVE_TYPE_C)
 
 H5_FCDLL int_f nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id);
 H5_FCDLL int_f nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id );
@@ -728,6 +729,7 @@ H5_FCDLL int_f nh5tdecode_c ( _fcd buf, hid_t_f *obj_id );
 H5_FCDLL int_f nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc );
 H5_FCDLL int_f nh5tget_create_plist_c ( hid_t_f *dtype_id,  hid_t_f *dtpl_id);
 H5_FCDLL int_f nh5tcompiler_conv_c ( hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag);
+H5_FCDLL int_f nh5tget_native_type_c(hid_t_f *dtype_id, int_f *direction, hid_t_f *native_dtype_id);
 
 
 /*
-- 
cgit v0.12