diff options
author | Elena Pourmal <epourmal@hdfgroup.org> | 2008-05-03 23:39:37 (GMT) |
---|---|---|
committer | Elena Pourmal <epourmal@hdfgroup.org> | 2008-05-03 23:39:37 (GMT) |
commit | dcad778b42d371c5429b913c65ec5c32f658d94e (patch) | |
tree | 3aa9f6ad4ef79064db548aa0ff692d2d1c6bbb51 /fortran/src/H5Rf.c | |
parent | 8090e1c6035e784402f8185434f291b63fe1d7c2 (diff) | |
download | hdf5-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/H5Rf.c')
-rw-r--r-- | fortran/src/H5Rf.c | 99 |
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; +} |