summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Tf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fortran/src/H5Tf.c')
-rw-r--r--fortran/src/H5Tf.c72
1 files changed, 58 insertions, 14 deletions
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index ca9c30f..878119f 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -1738,21 +1738,23 @@ nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id)
/****if* H5Tf/h5tenum_insert_c
* NAME
- * h5tenum_insert_c
+ * h5tenum_insert_c
* PURPOSE
- * Call H5Tenum_insert to insert a new enumeration datatype member.
+ * Call H5Tenum_insert to insert a new enumeration datatype member.
* INPUTS
- * type_id - identifier of the datatype
- * name - Name of the new member
- * namelen - length of the name
- * value - value of the new member
+ * type_id - identifier of the datatype
+ * name - Name of the new member
+ * namelen - length of the name
+ * value - value of the new member
* RETURNS
- * 0 on success, -1 on failure
+ * 0 on success, -1 on failure
* AUTHOR
* XIANGYANG SU
- * Thursday, February 3, 2000
+ * Thursday, February 3, 2000
* HISTORY
- *
+ * 'value' is no longer cast into an int. If the user passes in an 8 byte integer then
+ * it should not be cast to an int (which might be 4 bytes). Instead the value
+ * is written as the size of an int_f.
* SOURCE
*/
@@ -1761,19 +1763,18 @@ nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value)
/******/
{
int ret_value = -1;
- hid_t c_type_id;
char* c_name;
size_t c_namelen;
- int_f c_value;
herr_t error;
+ int_f c_value;
c_namelen = *namelen;
c_name = (char *)HD5f2cstring(name, c_namelen);
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);
+ c_value = *value;
+ error = H5Tenum_insert((hid_t)*type_id, c_name, &c_value);
+
HDfree(c_name);
if(error < 0) return ret_value;
@@ -2421,3 +2422,46 @@ h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, void *buf, void
return ret_value;
}
+/****if* H5Tf/h5tenum_insert_ptr_c
+ * NAME
+ * /h5tenum_insert_ptr_c
+ * PURPOSE
+ * Calls H5Tenum_insert
+ * INPUTS
+ * type_id - Datatype identifier for the enumeration datatype.
+ * name - Datatype identifier.
+ * value - Pointer to the value of the new member.
+ *
+ * OUTPUTS
+ *
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * M. Scot Breitenfeld
+ * February 6, 2015
+ *
+ * SOURCE
+*/
+int_f
+h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value)
+/******/
+{
+ int ret_value = -1;
+ hid_t status;
+ char *c_name;
+ size_t c_namelen;
+
+ /*
+ * Convert FORTRAN name to C name
+ */
+ c_namelen = *namelen;
+ c_name = (char *)HD5f2cstring(name, c_namelen);
+ if (c_name == NULL) return ret_value;
+
+ status = H5Tenum_insert( (hid_t)*type_id, c_name, value);
+ if ( status < 0 ) return ret_value;
+ ret_value = 0;
+ return ret_value;
+}
+
+