summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Rf.c
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2008-04-30 19:23:26 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2008-04-30 19:23:26 (GMT)
commit5773fd34bc5adf59b4530d95ac9f0c0585902803 (patch)
tree456ad239799382e1f083fb7fc74399e43b471912 /fortran/src/H5Rf.c
parent0138995d1ce2068db1f790503435a2121132d3ad (diff)
downloadhdf5-5773fd34bc5adf59b4530d95ac9f0c0585902803.zip
hdf5-5773fd34bc5adf59b4530d95ac9f0c0585902803.tar.gz
hdf5-5773fd34bc5adf59b4530d95ac9f0c0585902803.tar.bz2
[svn-r14902] Merged fortran_1_8 branch changes r14505:14901 into the trunk. New fortran wrappers added.
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;
+}