summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-12 11:56:10 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-12 11:56:10 (GMT)
commit2355d25955756f689f68bc6d8681116e2a41a5a6 (patch)
tree8a5e09861fa00672fed1a438f3874d44ed48cd4a /src/H5G.c
parentb1c6bb5b982562a872f79f58d003fae65af2a2a4 (diff)
downloadhdf5-2355d25955756f689f68bc6d8681116e2a41a5a6.zip
hdf5-2355d25955756f689f68bc6d8681116e2a41a5a6.tar.gz
hdf5-2355d25955756f689f68bc6d8681116e2a41a5a6.tar.bz2
[svn-r12894] Description:
Add H5Lget_name_by_idx routine & tests Move more H5G routines to deprecated API file Tested on: FreeBSD/32 4.11 (sleipnir) w/threadsafe Linux/32 2.4 (heping) C++ & FORTRAN Linux/64 2.4 (mir) w/build-all & enable_compat1.6 AIX/32 5.? (copper) w/parallel & FORTRAN
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c273
1 files changed, 26 insertions, 247 deletions
diff --git a/src/H5G.c b/src/H5G.c
index bd20833..995498b 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -138,10 +138,6 @@ static herr_t H5G_open_oid(H5G_t *grp, hid_t dxpl_id);
static herr_t H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5G_set_comment(H5G_loc_t *loc, const char *name,
- const char *buf, hid_t dxpl_id);
-static int H5G_get_comment(H5G_loc_t *loc, const char *name,
- size_t bufsize, char *buf, hid_t dxpl_id);
static herr_t H5G_insertion_loc_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -660,52 +656,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gget_objname_by_idx
- *
- * Purpose: Returns the name of objects in the group by giving index.
- * If `name' is non-NULL then write up to `size' bytes into that
- * buffer and always return the length of the entry name.
- * Otherwise `size' is ignored and the function does not store the name,
- * just returning the number of characters required to store the name.
- * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL)
- * is unchanged and the function returns a negative value.
- * If a zero is returned for the name's length, then there is no name
- * associated with the ID.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Raymond Lu
- * Nov 20, 2002
- *
- *-------------------------------------------------------------------------
- */
-ssize_t
-H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
-{
- H5G_loc_t loc; /* Object location */
- ssize_t ret_value;
-
- FUNC_ENTER_API(H5Gget_objname_by_idx, FAIL)
- H5TRACE4("Zs","ihsz",loc_id,idx,name,size);
-
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID")
- if(H5O_obj_type(loc.oloc, H5AC_ind_dxpl_id) != H5G_GROUP)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
-
- /* Call internal function*/
- if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, idx, name, size, H5AC_ind_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_objname_by_idx() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_objtype_by_idx
*
* Purpose: Returns the type of objects in the group by giving index.
@@ -785,88 +735,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Gset_comment
- *
- * Purpose: Gives the specified object a comment. The COMMENT string
- * should be a null terminated string. An object can have only
- * one comment at a time. Passing NULL for the COMMENT argument
- * will remove the comment property from the object.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, July 20, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
-{
- H5G_loc_t loc;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Gset_comment, FAIL)
- H5TRACE3("e","iss",loc_id,name,comment);
-
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
-
- if(H5G_set_comment(&loc, name, comment, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gset_comment() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Gget_comment
- *
- * Purpose: Return at most BUFSIZE characters of the comment for the
- * specified object. If BUFSIZE is large enough to hold the
- * entire comment then the comment string will be null
- * terminated, otherwise it will not. If the object does not
- * have a comment value then no bytes are copied to the BUF
- * buffer.
- *
- * Return: Success: Number of characters in the comment counting
- * the null terminator. The value returned may
- * be larger than the BUFSIZE argument.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Monday, July 20, 1998
- *
- *-------------------------------------------------------------------------
- */
-int
-H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
-{
- H5G_loc_t loc;
- int ret_value;
-
- FUNC_ENTER_API(H5Gget_comment, FAIL)
- H5TRACE4("Is","iszs",loc_id,name,bufsize,buf);
-
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
- if(bufsize > 0 && !buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
-
- if((ret_value = H5G_get_comment(&loc, name, bufsize, buf, H5AC_ind_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get comment value")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_comment() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_create_plist
*
* Purpose: Returns a copy of the group creation property list.
@@ -960,6 +828,32 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5G_init
+ *
+ * Purpose: Initialize the interface from some other package.
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_init(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_init, FAIL)
+ /* FUNC_ENTER() does all the work */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_init() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5G_init_interface
*
* Purpose: Initializes the H5G interface.
@@ -1838,121 +1732,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_set_comment
- *
- * Purpose: (Re)sets the comment for an object.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, July 20, 1998
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G_set_comment(H5G_loc_t *loc, const char *name, const char *buf, hid_t dxpl_id)
-{
- H5G_loc_t obj_loc; /* Object's location */
- H5G_name_t path;
- H5O_loc_t oloc;
- hbool_t loc_valid = FALSE;
- H5O_name_t comment;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5G_set_comment)
-
- /* Get the symbol table entry for the object */
- obj_loc.path = &path;
- obj_loc.oloc = &oloc;
- H5G_loc_reset(&obj_loc);
- if(H5G_loc_find(loc, name, &obj_loc/*out*/, H5P_DEFAULT, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
- loc_valid = TRUE;
-
- /* Remove the previous comment message if any */
- if(H5O_remove(obj_loc.oloc, H5O_NAME_ID, 0, TRUE, dxpl_id) < 0)
- H5E_clear_stack(NULL);
-
- /* Add the new message */
- if(buf && *buf) {
- /* Casting away const OK -QAK */
- comment.s = (char *)buf;
- if(H5O_modify(obj_loc.oloc, H5O_NAME_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &comment, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message")
- } /* end if */
-
-done:
- /* Release obj_loc */
- if(loc_valid) {
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free location")
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_set_comment() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G_get_comment
- *
- * Purpose: Get the comment value for an object.
- *
- * Return: Success: Number of bytes in the comment including the
- * null terminator. Zero if the object has no
- * comment.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Monday, July 20, 1998
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5G_get_comment(H5G_loc_t *loc, const char *name, size_t bufsize, char *buf, hid_t dxpl_id)
-{
- H5O_name_t comment;
- H5G_loc_t obj_loc; /* Object's location */
- H5G_name_t path;
- H5O_loc_t oloc;
- hbool_t loc_valid = FALSE;
- int ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5G_get_comment)
-
- /* Get the symbol table entry for the object */
- obj_loc.path = &path;
- obj_loc.oloc = &oloc;
- H5G_loc_reset(&obj_loc);
- if(H5G_loc_find(loc, name, &obj_loc/*out*/, H5P_DEFAULT, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
- loc_valid = TRUE;
-
- /* Get the message */
- comment.s = NULL;
- if(NULL == H5O_read(obj_loc.oloc, H5O_NAME_ID, 0, &comment, dxpl_id)) {
- if(buf && bufsize > 0)
- buf[0] = '\0';
- ret_value = 0;
- } else {
- if(buf && bufsize)
- HDstrncpy(buf, comment.s, bufsize);
- ret_value = (int)HDstrlen(comment.s);
- H5O_reset(H5O_NAME_ID, &comment);
- } /* end else */
-
-done:
- /* Release obj_loc */
- if(loc_valid) {
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free location")
- }
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_get_comment() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_insertion_loc_cb
*
* Purpose: Callback for finding insertion location. This routine sets the