summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2015-02-18 16:42:47 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2015-02-18 16:42:47 (GMT)
commita75fd4c9600e3b36ceb67832d50e32ba277c5728 (patch)
treeb208d26fd7543372fb08e7e7135018f8d882b926 /fortran/src
parent546899dcd63b60bda5f52602ea6f799765d2f096 (diff)
downloadhdf5-a75fd4c9600e3b36ceb67832d50e32ba277c5728.zip
hdf5-a75fd4c9600e3b36ceb67832d50e32ba277c5728.tar.gz
hdf5-a75fd4c9600e3b36ceb67832d50e32ba277c5728.tar.bz2
[svn-r26205] Fix for HDFFV-8908:
h5tenum_insert_f does not work with default 8 byte integers (xlf compiler)
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/H5Tf.c46
-rw-r--r--fortran/src/H5Tff.f9051
-rw-r--r--fortran/src/H5Tff_F03.f90100
-rw-r--r--fortran/src/H5Tff_F90.f9053
-rw-r--r--fortran/src/H5_f.c1
-rw-r--r--fortran/src/H5f90proto.h2
6 files changed, 200 insertions, 53 deletions
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index ca9c30f..c406c28 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -1772,7 +1772,7 @@ nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
if (c_name == NULL) return ret_value;
c_type_id = (hid_t)*type_id;
- c_value = (int)*value;
+
error = H5Tenum_insert(c_type_id, c_name, &c_value);
HDfree(c_name);
if(error < 0) return ret_value;
@@ -1781,6 +1781,50 @@ nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
return ret_value;
}
+/****if* H5Tf/h5tenum_insert_ptr_c
+ * NAME
+ * h5tenum_insert_c
+ * PURPOSE
+ * Call H5Tenum_insert to insert a new enumeration datatype member.
+ * INPUTS
+ * type_id - Datatype identifier for the enumeration datatype.
+ * name - Name of the new member.
+ * namelen - length of the name.
+ * value - Pointer to the value of the new member.
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * M. Scot Breitenfeld
+ * September 25, 2014
+ * HISTORY
+ *
+ * SOURCE
+*/
+int_f
+nh5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value)
+/******/
+{
+ int ret_value = -1;
+ hid_t c_type_id;
+ char* c_name;
+ size_t c_namelen;
+ int_f c_value;
+ herr_t error;
+
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL) return ret_value;
+
+ c_type_id = (hid_t)*type_id;
+
+ error = H5Tenum_insert(c_type_id, c_name, value);
+ HDfree(c_name);
+ if(error < 0) return ret_value;
+
+ ret_value = 0;
+ return ret_value;
+}
+
/****if* H5Tf/h5tenum_nameof_c
* NAME
diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90
index 0e1dbb0..4b4c0b6 100644
--- a/fortran/src/H5Tff.f90
+++ b/fortran/src/H5Tff.f90
@@ -2335,57 +2335,6 @@ CONTAINS
hdferr = h5tenum_create_c(parent_id, new_type_id)
END SUBROUTINE h5tenum_create_f
-
-!
-!****s* H5T/h5tenaum_insert_f
-!
-! NAME
-! h5tenaum_insert_f
-!
-! PURPOSE
-! Inserts a new enumeration datatype member.
-!
-! INPUTS
-! type_id - datatype identifier
-! OUTPUTS
-! hdferr - Returns 0 if successful and -1 if fails
-!
-! AUTHOR
-! Elena Pourmal
-! August 12, 1999
-!
-! HISTORY
-! Explicit Fortran interfaces were added for
-! called C functions (it is needed for Windows
-! port). March 7, 2001
-! SOURCE
- SUBROUTINE h5tenum_insert_f(type_id, name, value, hdferr)
- IMPLICIT NONE
- INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier
- CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member
- INTEGER, INTENT(IN) :: value !value of the new member
- INTEGER, INTENT(OUT) :: hdferr ! Error code
-!*****
- INTEGER :: namelen
-
- INTERFACE
- INTEGER FUNCTION h5tenum_insert_c(type_id, name, namelen, value)
- USE H5GLOBAL
- !DEC$IF DEFINED(HDF5F90_WINDOWS)
- !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TENUM_INSERT_C'::h5tenum_insert_c
- !DEC$ENDIF
- !DEC$ATTRIBUTES reference :: name
- INTEGER(HID_T), INTENT(IN) :: type_id
- CHARACTER(LEN=*), INTENT(IN) :: name
- INTEGER, INTENT(IN) :: value
- INTEGER :: namelen
- END FUNCTION h5tenum_insert_c
- END INTERFACE
-
- namelen = LEN(name)
- hdferr = h5tenum_insert_c(type_id, name, namelen, value)
- END SUBROUTINE h5tenum_insert_f
-
!
!****s* H5T/h5tenum_nameof_f
!
diff --git a/fortran/src/H5Tff_F03.f90 b/fortran/src/H5Tff_F03.f90
index 2405837..60a83e9 100644
--- a/fortran/src/H5Tff_F03.f90
+++ b/fortran/src/H5Tff_F03.f90
@@ -47,6 +47,12 @@ MODULE H5T_PROVISIONAL
!*****
+ INTERFACE h5tenum_insert_f
+ MODULE PROCEDURE h5tenum_insert_integer
+ ! Recommended procedure:
+ MODULE PROCEDURE h5tenum_insert_ptr
+ END INTERFACE
+
CONTAINS
!****s* H5T (F03)/H5Tconvert_f_F03
@@ -112,5 +118,99 @@ CONTAINS
END SUBROUTINE h5tconvert_f
+!
+!****s* H5T/h5tenaum_insert_f
+!
+! NAME
+! h5tenaum_insert_f
+!
+! PURPOSE
+! Inserts a new enumeration datatype member.
+!
+! INPUTS
+! type_id - datatype identifier
+! OUTPUTS
+! hdferr - Returns 0 if successful and -1 if fails
+!
+! AUTHOR
+! Elena Pourmal
+! August 12, 1999
+!
+! HISTORY
+! Explicit Fortran interfaces were added for
+! called C functions (it is needed for Windows
+! port). March 7, 2001
+! SOURCE
+ SUBROUTINE h5tenum_insert_integer(type_id, name, value, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier
+ CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member
+ INTEGER, INTENT(IN) :: value ! value of the new member
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+!*****
+ INTEGER(C_INT), TARGET :: c_value
+ TYPE(C_PTR) :: f_ptr
+
+ PRINT*,'b',value
+ ! make sure 'value' is the same type as the C int
+ c_value = INT(value, C_INT)
+ f_ptr = C_LOC(c_value)
+
+
+ PRINT*,value
+ CALL h5tenum_insert_ptr(type_id, name, f_ptr, hdferr)
+ END SUBROUTINE h5tenum_insert_integer
+
+!
+!****s* H5T/h5tenaum_insert_f_F03
+!
+! NAME
+! h5tenaum_insert_f
+!
+! PURPOSE
+! Inserts a new enumeration datatype member.
+!
+! INPUTS
+! type_id - Datatype identifier for the enumeration datatype.
+! name - Name of the new member.
+! value - Pointer to the value of the new member.
+! OUTPUTS
+! hdferr - Returns 0 if successful and -1 if fails
+!
+! AUTHOR
+! M. Scot Breitenfeld
+! September 25, 2014
+!
+! HISTORY
+! SOURCE
+ SUBROUTINE h5tenum_insert_ptr(type_id, name, value, hdferr)
+ USE, INTRINSIC :: ISO_C_BINDING
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: type_id
+ CHARACTER(LEN=*), INTENT(IN) :: name
+ TYPE(C_PTR), INTENT(IN) :: value
+ INTEGER, INTENT(OUT) :: hdferr
+!*****
+ INTEGER :: namelen
+
+ INTERFACE
+ INTEGER FUNCTION h5tenum_insert_ptr_c(type_id, name, namelen, value)
+ USE H5GLOBAL
+ USE, INTRINSIC :: ISO_C_BINDING
+ !DEC$IF DEFINED(HDF5F90_WINDOWS)
+ !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TENUM_INSERT_PTR_C'::h5tenum_insert_ptr_c
+ !DEC$ENDIF
+ !DEC$ATTRIBUTES reference :: name
+ INTEGER(HID_T), INTENT(IN) :: type_id
+ CHARACTER(LEN=*), INTENT(IN) :: name
+ TYPE(C_PTR), VALUE :: value
+ INTEGER :: namelen
+ END FUNCTION h5tenum_insert_ptr_c
+ END INTERFACE
+
+ namelen = LEN(name)
+ hdferr = h5tenum_insert_ptr_c(type_id, name, namelen, value)
+ END SUBROUTINE h5tenum_insert_ptr
+
END MODULE H5T_PROVISIONAL
diff --git a/fortran/src/H5Tff_F90.f90 b/fortran/src/H5Tff_F90.f90
index a95b31f..f2ff543 100644
--- a/fortran/src/H5Tff_F90.f90
+++ b/fortran/src/H5Tff_F90.f90
@@ -36,4 +36,57 @@
MODULE H5T_PROVISIONAL
+ USE H5GLOBAL
+
+CONTAINS
+!
+!****s* H5T/h5tenaum_insert_f
+!
+! NAME
+! h5tenaum_insert_f
+!
+! PURPOSE
+! Inserts a new enumeration datatype member.
+!
+! INPUTS
+! type_id - datatype identifier
+! OUTPUTS
+! hdferr - Returns 0 if successful and -1 if fails
+!
+! AUTHOR
+! Elena Pourmal
+! August 12, 1999
+!
+! HISTORY
+! Explicit Fortran interfaces were added for
+! called C functions (it is needed for Windows
+! port). March 7, 2001
+! SOURCE
+ SUBROUTINE h5tenum_insert_f(type_id, name, value, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier
+ CHARACTER(LEN=*), INTENT(IN) :: name !Name of the new member
+ INTEGER, INTENT(IN) :: value !value of the new member
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+!*****
+ INTEGER :: namelen
+
+ INTERFACE
+ INTEGER FUNCTION h5tenum_insert_c(type_id, name, namelen, value)
+ USE H5GLOBAL
+ !DEC$IF DEFINED(HDF5F90_WINDOWS)
+ !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TENUM_INSERT_C'::h5tenum_insert_c
+ !DEC$ENDIF
+ !DEC$ATTRIBUTES reference :: name
+ INTEGER(HID_T), INTENT(IN) :: type_id
+ CHARACTER(LEN=*), INTENT(IN) :: name
+ INTEGER, INTENT(IN) :: value
+ INTEGER :: namelen
+ END FUNCTION h5tenum_insert_c
+ END INTERFACE
+
+ namelen = LEN(name)
+ hdferr = h5tenum_insert_c(type_id, name, namelen, value)
+ END SUBROUTINE h5tenum_insert_f
+
END MODULE H5T_PROVISIONAL
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index a149109..4a5fcbc 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -227,7 +227,6 @@ nh5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertype
if ((floatingtypes[1] = (hid_t_f)H5Tcopy(H5T_IEEE_F32LE)) < 0) return ret_value;
if ((floatingtypes[2] = (hid_t_f)H5Tcopy(H5T_IEEE_F64BE)) < 0) return ret_value;
if ((floatingtypes[3] = (hid_t_f)H5Tcopy(H5T_IEEE_F64LE)) < 0) return ret_value;
-
if ((integertypes[0] = (hid_t_f)H5Tcopy(H5T_STD_I8BE)) < 0) return ret_value;
if ((integertypes[1] = (hid_t_f)H5Tcopy(H5T_STD_I8LE)) < 0) return ret_value;
if ((integertypes[2] = (hid_t_f)H5Tcopy(H5T_STD_I16BE)) < 0) return ret_value;
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 284ffbd..b4c715f 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -709,6 +709,7 @@ H5_FCDLL int_f nh5arename_c( hid_t_f *loc_id,
#define nh5tinsert_array_c2 H5_FC_FUNC_(h5tinsert_array_c2, H5TINSERT_ARRAY_C2)
#define nh5tenum_create_c H5_FC_FUNC_(h5tenum_create_c, H5TENUM_CREATE_C)
#define nh5tenum_insert_c H5_FC_FUNC_(h5tenum_insert_c, H5TENUM_INSERT_C)
+#define nh5tenum_insert_ptr_c H5_FC_FUNC_(h5tenum_insert_ptr_c, H5TENUM_INSERT_PTR_C)
#define nh5tenum_nameof_c H5_FC_FUNC_(h5tenum_nameof_c, H5TENUM_NAMEOF_C)
#define nh5tenum_valueof_c H5_FC_FUNC_(h5tenum_valueof_c, H5TENUM_VALUEOF_C)
#define nh5tget_member_value_c H5_FC_FUNC_(h5tget_member_value_c, H5TGET_MEMBER_VALUE_C)
@@ -772,6 +773,7 @@ H5_FCDLL int_f nh5tinsert_array_c(hid_t_f * parent_id, _fcd name, int_f* namelen
H5_FCDLL int_f nh5tinsert_array_c2(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id);
H5_FCDLL int_f nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id);
H5_FCDLL int_f nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value);
+H5_FCDLL int_f nh5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value);
H5_FCDLL int_f nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen);
H5_FCDLL int_f nh5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value);
H5_FCDLL int_f nh5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value);