summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Sf.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/H5Sf.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/H5Sf.c')
-rw-r--r--fortran/src/H5Sf.c124
1 files changed, 124 insertions, 0 deletions
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index 0a4bd40..c33e7e6 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -1027,3 +1027,127 @@ nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsi
return ret_value;
}
+/*----------------------------------------------------------------------------
+ * Name: h5sdecode_c
+ * Purpose: Call H5Sdecode
+ * 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
+ * March 26, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5sdecode_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 H5Sdecode function.
+ */
+
+ c_buf = (unsigned char*)buf;
+
+ c_obj_id = H5Sdecode(c_buf);
+ if(c_obj_id < 0)
+ return ret_value;
+
+ *obj_id = (int_f)c_obj_id;
+ ret_value = 0;
+
+ return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5sencode_c
+ * Purpose: Call H5Sencode
+ * 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
+ * March 26, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5sencode_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(H5Sencode((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 H5Sencode function.
+ */
+ if(H5Sencode((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: h5sextent_equal_c
+ * Purpose: Call H5Sextent_equal
+ * Inputs:
+ * space1_id - First dataspace identifier.
+ * space2_id - Second dataspace identifier.
+ * Outputs:
+ * equal - TRUE if equal, FALSE if unequal.
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * April 4, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5sextent_equal_c ( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal)
+{
+ int ret_value = -1;
+
+ if( (*c_equal = (hid_t_f)H5Sextent_equal((hid_t)*space1_id, (hid_t)*space2_id)) < 0)
+ return ret_value;
+
+ ret_value = 0;
+ return ret_value;
+}
+