summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Rf.c
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2008-05-06 19:23:32 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2008-05-06 19:23:32 (GMT)
commit0bfb17bf00b9d4dae00e7f454c437ca98f2a5677 (patch)
tree1d4ef1dd28b642ee28d27fd5fc579c5a10714538 /fortran/src/H5Rf.c
parent464e4619f670006c2477583b7f9d7b0530b0a245 (diff)
downloadhdf5-0bfb17bf00b9d4dae00e7f454c437ca98f2a5677.zip
hdf5-0bfb17bf00b9d4dae00e7f454c437ca98f2a5677.tar.gz
hdf5-0bfb17bf00b9d4dae00e7f454c437ca98f2a5677.tar.bz2
[svn-r14942] Maintenance: Merged new Fortran APIs and tests from trunk into hdf5_1_8 branch
(used svn merge -r 14505:14941 http://svn.hdfgorup.uiuc.edu/hdf5/trunk/fortran command). Updated MANIFEST Disabled -O3 optimization for gcc 4.3 (long due check-in) Platforms tested: kagiso with PGI compilers, smirom with g95 and v16 option, linew
Diffstat (limited to 'fortran/src/H5Rf.c')
-rw-r--r--fortran/src/H5Rf.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c
index 4430e1a..299f6bd 100644
--- a/fortran/src/H5Rf.c
+++ b/fortran/src/H5Rf.c
@@ -239,3 +239,102 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, haddr_t_f *ref, int_f *obj_type)
return ret_value;
}
+/*----------------------------------------------------------------------------
+ * Name: h5rget_name_object_c
+ * Purpose: Call H5Rget_name for an object
+ * Inputs:
+ * loc_id - Identifier for the dataset containing the reference or for the group that dataset is in.
+ * ref - An object or dataset region reference.
+ *
+ * Outputs: name - A name associated with the referenced object or dataset region.
+ * size - The size of the name buffer.
+ *
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * March 31, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+int_f
+nh5rget_name_object_c (hid_t_f *loc_id, haddr_t_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default)
+{
+ hobj_ref_t ref_c;
+ int_f ret_value = -1;
+ ssize_t c_size;
+ size_t c_bufsize;
+ char *c_buf= NULL; /* Buffer to hold C string */
+
+ ref_c = *ref;
+
+ c_bufsize = (size_t)*name_len+1;
+ /*
+ * Allocate buffer to hold name of an attribute
+ */
+ if ((c_buf = HDmalloc(c_bufsize)) == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Rget_name function.
+ */
+ if((c_size=H5Rget_name((hid_t)*loc_id, H5R_OBJECT, &ref_c, c_buf, c_bufsize)) < 0)
+ return ret_value;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(name), c_bufsize-1);
+
+ *size_default = (size_t_f)c_size;
+ ret_value = 0;
+ if(c_buf) HDfree(c_buf);
+
+ return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5rget_name_region_c
+ * Purpose: Call H5Rget_name for a dataset region
+ * Inputs:
+ * loc_id - Identifier for the dataset containing the reference or for the group that dataset is in.
+ * ref - An object or dataset region reference.
+ *
+ * Outputs: name - A name associated with the referenced object or dataset region.
+ * size - The size of the name buffer.
+ *
+ * Returns: 0 on success, -1 on failure
+ * Programmer: M.S. Breitenfeld
+ * March 31, 2008
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+int_f
+nh5rget_name_region_c (hid_t_f *loc_id, int_f *ref, _fcd name, size_t_f *name_len, size_t_f *size_default)
+{
+ hdset_reg_ref_t ref_c;
+ int_f ret_value = -1;
+ ssize_t c_size;
+ size_t c_bufsize;
+ char *c_buf= NULL; /* Buffer to hold C string */
+
+ HDmemcpy (&ref_c, ref, H5R_DSET_REG_REF_BUF_SIZE);
+
+ c_bufsize = (size_t)*name_len+1;
+ /*
+ * Allocate buffer to hold name of an attribute
+ */
+ if ((c_buf = HDmalloc(c_bufsize)) == NULL)
+ return ret_value;
+
+ /*
+ * Call H5Rget_name function.
+ */
+ if((c_size=H5Rget_name((hid_t)*loc_id, H5R_DATASET_REGION, &ref_c, c_buf, c_bufsize)) < 0)
+ return ret_value;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_buf, _fcdtocp(name), c_bufsize-1);
+
+ *size_default = (size_t_f)c_size;
+ ret_value = 0;
+ if(c_buf) HDfree(c_buf);
+
+ return ret_value;
+}