summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Tf.c
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2008-05-03 23:39:37 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2008-05-03 23:39:37 (GMT)
commitdcad778b42d371c5429b913c65ec5c32f658d94e (patch)
tree3aa9f6ad4ef79064db548aa0ff692d2d1c6bbb51 /fortran/src/H5Tf.c
parent8090e1c6035e784402f8185434f291b63fe1d7c2 (diff)
downloadhdf5-dcad778b42d371c5429b913c65ec5c32f658d94e.zip
hdf5-dcad778b42d371c5429b913c65ec5c32f658d94e.tar.gz
hdf5-dcad778b42d371c5429b913c65ec5c32f658d94e.tar.bz2
[svn-r14923] Maintenance: This check-in merges changes from the fortran_1_8 branch back into the trunk (up to revision 14921)
Platforms tested: kagiso with g95 and Intel compilers; more testing will be done after checking in a fresh copy from the trunk. New code itself was tested with all Fortran compilers available at THG
Diffstat (limited to 'fortran/src/H5Tf.c')
-rw-r--r--fortran/src/H5Tf.c214
1 files changed, 210 insertions, 4 deletions
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index 7c3befc..0ad0bc9 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -24,6 +24,7 @@
* Inputs: loc_id - file or group identifier
* name - name of the datatype within file or group
* namelen - name length
+ * tapl_id - datatype access property list identifier
* Outputs: type_id - dataset identifier
* Returns: 0 on success, -1 on failure
* Programmer: Elena Pourmal
@@ -31,7 +32,7 @@
* Modifications:
*---------------------------------------------------------------------------*/
int_f
-nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id)
+nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *tapl_id)
{
char *c_name = NULL;
hid_t c_type_id;
@@ -46,7 +47,7 @@ nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id)
/*
* Call H5Topen2 function.
*/
- if((c_type_id = H5Topen2((hid_t)*loc_id, c_name, H5P_DEFAULT)) < 0)
+ if((c_type_id = H5Topen2((hid_t)*loc_id, c_name, (hid_t)*tapl_id)) < 0)
goto done;
*type_id = (hid_t_f)c_type_id;
@@ -67,13 +68,19 @@ done:
* name - name of the datatype within file or group
* namelen - name length
* type_id - dataset identifier
+ * lcpl_id - Link creation property list
+ * tcpl_id - Datatype creation property list
+ * tapl_id - Datatype access property list
* Returns: 0 on success, -1 on failure
* Programmer: Elena Pourmal
* Saturday, August 14, 1999
* Modifications:
+ * - Added passing optional parameters for version 1.8
+ * M.S. Breitenfeld
*---------------------------------------------------------------------------*/
int_f
-nh5tcommit_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id)
+nh5tcommit_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id,
+ hid_t_f *lcpl_id, hid_t_f *tcpl_id, hid_t_f *tapl_id)
{
char *c_name = NULL;
int ret_value = -1;
@@ -83,7 +90,7 @@ nh5tcommit_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id)
goto done;
/* Call H5Tcommit2 function */
- if(H5Tcommit2((hid_t)*loc_id, c_name, (hid_t)*type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if(H5Tcommit2((hid_t)*loc_id, c_name, (hid_t)*type_id, (hid_t)*lcpl_id, (hid_t)*tcpl_id, (hid_t)*tapl_id) < 0)
goto done;
ret_value = 0;
@@ -1634,3 +1641,202 @@ nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class )
*class = (int_f)c_class;
return ret_value;
}
+
+/*----------------------------------------------------------------------------
+ * Name: h5tcommit_anon_c
+ * Purpose: Call H5Tcommit_anon
+ * Inputs: loc_id - file or group identifier
+ * dtype_id - dataset identifier
+ * tcpl_id - Datatype creation property list
+ * tapl_id - Datatype access property list
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * February 25, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+int_f
+nh5tcommit_anon_c(hid_t_f *loc_id, hid_t_f *dtype_id,
+ hid_t_f *tcpl_id, hid_t_f *tapl_id)
+{
+ int ret_value = -1;
+
+ /* Call H5Tcommit_anon function */
+ if(H5Tcommit_anon((hid_t)*loc_id, (hid_t)*dtype_id, (hid_t)*tcpl_id, (hid_t)*tapl_id) < 0)
+ goto done;
+
+ ret_value = 0;
+
+ done:
+ return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5tcommitted_c
+ * Purpose: Call H5Tcommitted
+ * dtype_id - dataset identifier
+ * Returns: a positive value, for TRUE, if the datatype has been committed,
+ * or 0 (zero), for FALSE, if the datatype has not been committed.
+ * Otherwise returns a negative value.
+ * Programmer: M.S. Breitenfeld
+ * February 25, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+int_f
+nh5tcommitted_c(hid_t_f *dtype_id)
+{
+ int_f ret_value;
+
+ /* Call H5Tcommitted function */
+
+ ret_value=(int_f)H5Tcommitted((hid_t)*dtype_id);
+
+ return ret_value;
+
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5tdecode_c
+ * Purpose: Call H5Tdecode
+ * Inputs:
+ * buf - Buffer for the data space object to be decoded.
+ * Outputs:
+ * obj_id - Object_id (non-negative)
+ *
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * April 9, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5tdecode_c ( _fcd buf, int_f *obj_id )
+{
+ int ret_value = -1;
+ unsigned char *c_buf = NULL; /* Buffer to hold C string */
+ hid_t c_obj_id;
+
+ /*
+ * Call H5Tdecode function.
+ */
+
+ c_buf = (unsigned char*)buf;
+
+ c_obj_id = H5Tdecode(c_buf);
+ if(c_obj_id < 0)
+ return ret_value;
+
+ *obj_id = (int_f)c_obj_id;
+ ret_value = 0;
+
+ return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5tencode_c
+ * Purpose: Call H5Tencode
+ * Inputs:
+ * obj_id - Identifier of the object to be encoded.
+ * buf - Buffer for the object to be encoded into.
+ * nalloc - The size of the allocated buffer.
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * April 9, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5tencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
+{
+ int ret_value = -1;
+ unsigned char *c_buf = NULL; /* Buffer to hold C string */
+ size_t c_size;
+
+ /* return just the size of the allocated buffer;
+ * equivalent to C routine for which 'name' is set equal to NULL
+ */
+
+ if (*nalloc == 0) {
+
+ if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0)
+ return ret_value;
+
+ *nalloc = (size_t_f)c_size;
+
+ ret_value = 0;
+ return ret_value;
+ }
+
+ c_size = (size_t)*nalloc;
+ /*
+ * Allocate buffer
+ */
+ if ((c_buf = HDmalloc(c_size)) == NULL)
+ return ret_value;
+ /*
+ * Call H5Tencode function.
+ */
+ if(H5Tencode((hid_t)*obj_id, c_buf, &c_size) < 0){
+ return ret_value;
+ }
+
+ /* copy the C buffer to the FORTRAN buffer.
+ * Can not use HD5packFstring because we don't want to
+ * eliminate the NUL terminator or pad remaining space
+ * with blanks.
+ */
+
+ HDmemcpy(_fcdtocp(buf),(char *)c_buf,c_size);
+
+ ret_value = 0;
+ if(c_buf) HDfree(c_buf);
+ return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5tget_create_plist_c
+ * Purpose: Call H5Tget_create_plist
+ * Inputs: dtype_id - Datatype identifier
+ * Outputs: dtpl_id - Datatype property list identifier
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * April 9, 2008
+ * Modifications: N/A
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5tget_create_plist_c ( hid_t_f *dtype_id, hid_t_f *dtpl_id)
+{
+ int_f ret_value=-1; /* Return value */
+
+ if ((*dtpl_id = (hid_t_f)H5Tget_create_plist((hid_t)*dtype_id)) < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5tcompiler_conv_c
+ * Purpose: Call H5Tcompiler_conv
+ * Inputs:
+ * src_id - Identifier for the source datatype.
+ * dst_id - Identifier for the destination datatype.
+ * Outputs: c_flag - flag; TRUE for compiler conversion, FALSE for library conversion
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * April 9, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5tcompiler_conv_c ( hid_t_f *src_id, hid_t_f *dst_id, int_f *c_flag)
+{
+ int ret_value = -1;
+ htri_t status;
+
+ status = H5Tcompiler_conv( (hid_t)*src_id , (hid_t)*dst_id);
+ if ( status < 0 ) return ret_value;
+ *c_flag = (int_f)status;
+ ret_value = 0;
+ return ret_value;
+}