From 2423411a647cff2bc2c37789fc9973ed4a683348 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Mon, 20 Jul 1998 16:01:32 -0500 Subject: [svn-r522] Changes since 19980720 ---------------------- ./src/H5Gpublic.h ./src/H5Gprivate.h ./src/H5G.c ./test/dsets.c ./doc/html/Groups.html Added the H5Gset_comment() and H5Gget_comment() functions described in an earlier e-mail. ./src/H5.c Fixed a bug in the tracing code that caused certain data space enum types to not be printed. Nested case statements can get confusing to the eyes! ./tools/h5ls.c Prints the first 50 bytes or so of object comments. --- doc/html/Groups.html | 28 ++++- src/H5.c | 104 +++++++++--------- src/H5G.c | 179 +++++++++++++++++++++++++++++++ src/H5Gprivate.h | 3 + src/H5Gpublic.h | 3 + test/.distdep | 294 +++++++++++++++++++++++++-------------------------- test/dsets.c | 6 ++ tools/h5ls.c | 7 +- 8 files changed, 423 insertions(+), 201 deletions(-) diff --git a/doc/html/Groups.html b/doc/html/Groups.html index b1be2f1..5becb8b 100644 --- a/doc/html/Groups.html +++ b/doc/html/Groups.html @@ -278,11 +278,37 @@ API. +

6. Comments

+ +

Objects can have a comment associated with them. The comment + is set and queried with these two functions: + +

+
herr_t H5Gset_comment (hid_t loc_id, const + char *name, const char *comment) +
The previous comment (if any) for the specified object is + replace with a new comment. If the comment argument + is the empty string or a null pointer then the comment message + is removed from the object. Comments should be relatively + short, null-terminated, ASCII strings. + +

+
herr_t H5Gget_comment (hid_t loc_id, const + char *name, size_t bufsize, char + *comment) +
The comment string for an object is returned through the + comment buffer. At most bufsize characters + including the null terminator are copied, and the result is + not null terminated if the comment is longer than the supplied + buffer. If an object doesn't have a comment then the empty + string is returned. +
+
Robb Matzke
-Last modified: Tue Mar 24 15:52:14 EST 1998 +Last modified: Mon Jul 20 16:45:40 EDT 1998 diff --git a/src/H5.c b/src/H5.c index 9b52dfa..3cb6aed 100644 --- a/src/H5.c +++ b/src/H5.c @@ -1386,6 +1386,58 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) } break; + case 'S': + switch (type[1]) { + case 'c': + if (ptr) { + fprintf(out, "0x%lx", (unsigned long)vp); + } else { + H5S_class_t cls = va_arg(ap, H5S_class_t); + switch (cls) { + case H5S_NO_CLASS: + fprintf(out, "H5S_NO_CLASS"); + break; + case H5S_SCALAR: + fprintf(out, "H5S_SCALAR"); + break; + case H5S_SIMPLE: + fprintf(out, "H5S_SIMPLE"); + break; + case H5S_COMPLEX: + fprintf(out, "H5S_COMPLEX"); + break; + default: + fprintf(out, "%ld", (long)cls); + break; + } + } + break; + + case 's': + if (ptr) { + fprintf(out, "0x%lx", (unsigned long)vp); + } else { + H5S_seloper_t so = va_arg(ap, H5S_seloper_t); + switch (so) { + case H5S_NOOP: + fprintf(out, "H5S_NOOP"); + break; + case H5S_SELECT_SET: + fprintf(out, "H5S_SELECT_SET"); + break; + default: + fprintf(out, "%ld", (long)so); + break; + } + } + break; + + default: + fprintf(out, "BADTYPE(S%c)", type[1]); + goto error; + } + break; + case 's': if (ptr) { fprintf (out, "0x%lx", (unsigned long)vp); @@ -1516,58 +1568,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) } break; - case 'S': - switch (type[1]) { - case 'c': - if (ptr) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - H5S_class_t cls = va_arg(ap, H5S_class_t); - switch (cls) { - case H5S_NO_CLASS: - fprintf(out, "H5S_NO_CLASS"); - break; - case H5S_SCALAR: - fprintf(out, "H5S_SCALAR"); - break; - case H5S_SIMPLE: - fprintf(out, "H5S_SIMPLE"); - break; - case H5S_COMPLEX: - fprintf(out, "H5S_COMPLEX"); - break; - default: - fprintf(out, "%ld", (long)cls); - break; - } - } - break; - - case 's': - if (ptr) { - fprintf(out, "0x%lx", (unsigned long)vp); - } else { - H5S_seloper_t so = va_arg(ap, H5S_seloper_t); - switch (so) { - case H5S_NOOP: - fprintf(out, "H5S_NOOP"); - break; - case H5S_SELECT_SET: - fprintf(out, "H5S_SELECT_SET"); - break; - default: - fprintf(out, "%ld", (long)so); - break; - } - } - break; - - default: - fprintf(out, "BADTYPE(F%c)", type[1]); - goto error; - } - break; - case 't': if (ptr) { fprintf (out, "0x%lx", (unsigned long)vp); diff --git a/src/H5G.c b/src/H5G.c index 7e279a5..7e73dbe 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -716,6 +716,96 @@ H5Gget_linkval (hid_t loc_id, const char *name, size_t size, char *buf/*out*/) FUNC_LEAVE (SUCCEED); } + +/*------------------------------------------------------------------------- + * 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: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Gset_comment (hid_t loc_id, const char *name, const char *comment) +{ + H5G_t *loc = NULL; + + FUNC_ENTER(H5Gset_comment, FAIL); + H5TRACE3("e","iss",loc_id,name,comment); + + if (NULL==(loc=H5G_loc(loc_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); + } + if (!name || !*name) { + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); + } + + if (H5G_set_comment(loc, name, comment)<0) { + HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, + "unable to set comment value"); + } + + FUNC_LEAVE(SUCCEED); +} + + +/*------------------------------------------------------------------------- + * 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 the empty string is returned. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Gget_comment (hid_t loc_id, const char *name, size_t bufsize, char *buf) +{ + H5G_t *loc = NULL; + + FUNC_ENTER(H5Gget_comment, FAIL); + H5TRACE4("e","iszs",loc_id,name,bufsize,buf); + + if (NULL==(loc=H5G_loc(loc_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); + } + if (!name || !*name) { + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); + } + if (bufsize<1 || !buf) { + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified"); + } + + if (H5G_get_comment(loc, name, bufsize, buf)<0) { + HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, + "unable to set comment value"); + } + + FUNC_LEAVE(SUCCEED); +} + /* *------------------------------------------------------------------------- *------------------------------------------------------------------------- @@ -1988,4 +2078,93 @@ H5G_linkval (H5G_t *loc, const char *name, size_t size, char *buf/*out*/) FUNC_LEAVE (SUCCEED); } + +/*------------------------------------------------------------------------- + * Function: H5G_set_comment + * + * Purpose: (Re)sets the comment for an object. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_set_comment(H5G_t *loc, const char *name, const char *buf) +{ + H5G_entry_t obj_ent; + H5O_name_t comment; + + FUNC_ENTER(H5G_set_comment, FAIL); + + /* Get the symbol table entry for the object */ + if (H5G_namei(H5G_entof(loc), name, NULL, NULL, &obj_ent/*out*/, + TRUE, NULL)<0) { + HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); + } + + /* Remove the previous comment message if any */ + if (H5O_remove(&obj_ent, H5O_NAME, 0)<0) H5E_clear(); + + /* Add the new message */ + if (buf && *buf) { + comment.s = H5MM_xstrdup(buf); + if (H5O_modify(&obj_ent, H5O_NAME, H5O_NEW_MESG, 0, &comment)<0) { + HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, + "unable to set comment object header message"); + } + H5O_reset(H5O_NAME, &comment); + } + + FUNC_LEAVE(SUCCEED); +} + + +/*------------------------------------------------------------------------- + * Function: H5G_get_comment + * + * Purpose: Get the comment value for an object. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_get_comment(H5G_t *loc, const char *name, size_t bufsize, char *buf) +{ + H5O_name_t comment; + H5G_entry_t obj_ent; + + FUNC_ENTER(H5G_get_comment, FAIL); + + /* Get the symbol table entry for the object */ + if (H5G_namei(H5G_entof(loc), name, NULL, NULL, &obj_ent/*out*/, + TRUE, NULL)<0) { + HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); + } + + /* Get the message */ + comment.s = NULL; + if (NULL==H5O_read(&obj_ent, H5O_NAME, 0, &comment)) { + buf[0] = '\0'; + } else { + strncpy(buf, comment.s, bufsize); + H5O_reset(H5O_NAME, &comment); + } + + FUNC_LEAVE(SUCCEED); +} diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 0f8f773..b0ee5e8 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -117,6 +117,9 @@ herr_t H5G_stat (H5G_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); herr_t H5G_linkval (H5G_t *loc, const char *name, size_t size, char *buf/*out*/); +herr_t H5G_set_comment(H5G_t *loc, const char *name, const char *buf); +herr_t H5G_get_comment(H5G_t *loc, const char *name, size_t bufsize, + char *buf); herr_t H5G_insert (H5G_t *cwg, const char *name, H5G_entry_t *ent); herr_t H5G_find (H5G_t *cwg, const char *name, H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/); diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index d70dac7..d801a31 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -69,6 +69,9 @@ herr_t H5Gstat (hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); herr_t H5Gget_linkval (hid_t loc_id, const char *name, size_t size, char *buf/*out*/); +herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment); +herr_t H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, + char *buf); #ifdef __cplusplus } diff --git a/test/.distdep b/test/.distdep index 107ac08..a451de2 100644 --- a/test/.distdep +++ b/test/.distdep @@ -1,33 +1,3 @@ -testhdf5.o: \ - testhdf5.c \ - testhdf5.h \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h -tattr.o: \ - tattr.c \ - testhdf5.h \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ - ../src/H5Ipublic.h \ - ../src/hdf5.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h tfile.o: \ tfile.c \ testhdf5.h \ @@ -100,30 +70,6 @@ tohdr.o: \ ../src/H5Tpublic.h \ ../src/H5Sprivate.h \ ../src/H5Spublic.h -tselect.o: \ - tselect.c \ - testhdf5.h \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ - ../src/H5Ipublic.h \ - ../src/hdf5.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h tstab.o: \ tstab.c \ testhdf5.h \ @@ -154,35 +100,39 @@ tstab.o: \ ../src/H5Tpublic.h \ ../src/H5Sprivate.h \ ../src/H5Spublic.h -th5s.o: \ - th5s.c \ - testhdf5.h \ +hyperslab.o: \ + hyperslab.c \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h +istore.o: \ + istore.c \ ../src/H5private.h \ ../src/H5public.h \ ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ + ../src/H5Iprivate.h \ ../src/H5Ipublic.h \ - ../src/H5Bprivate.h \ - ../src/H5Bpublic.h \ - ../src/H5Fprivate.h \ - ../src/H5Fpublic.h \ + ../src/H5Pprivate.h \ + ../src/H5Ppublic.h \ ../src/H5Dpublic.h \ - ../src/H5Sprivate.h \ - ../src/H5Spublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Fprivate.h \ ../src/H5Gprivate.h \ ../src/H5Gpublic.h \ + ../src/H5Bprivate.h \ + ../src/H5Bpublic.h \ + ../src/H5MMprivate.h \ + ../src/H5MMpublic.h \ ../src/H5Oprivate.h \ ../src/H5Opublic.h \ ../src/H5HGprivate.h \ ../src/H5HGpublic.h \ ../src/H5Tprivate.h \ ../src/H5Tpublic.h \ - ../src/H5Zprivate.h \ - ../src/H5Zpublic.h \ - ../src/H5Pprivate.h -dtypes.o: \ - dtypes.c \ + ../src/H5Sprivate.h +cmpd_dset.o: \ + cmpd_dset.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -201,47 +151,30 @@ dtypes.o: \ ../src/H5Opublic.h \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h \ - ../src/H5Tpkg.h \ - ../src/H5HGprivate.h \ - ../src/H5Fprivate.h \ - ../src/H5private.h \ - ../src/H5Tprivate.h \ - ../src/H5Gprivate.h -hyperslab.o: \ - hyperslab.c \ - ../src/H5private.h \ - ../src/H5public.h \ - ../src/H5config.h -istore.o: \ - istore.c \ - ../src/H5private.h \ + ../src/H5Spublic.h +extend.o: \ + extend.c \ + ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ - ../src/H5Iprivate.h \ ../src/H5Ipublic.h \ - ../src/H5Pprivate.h \ - ../src/H5Ppublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ ../src/H5Fpublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Fprivate.h \ - ../src/H5Gprivate.h \ ../src/H5Gpublic.h \ - ../src/H5Bprivate.h \ - ../src/H5Bpublic.h \ - ../src/H5MMprivate.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ ../src/H5MMpublic.h \ - ../src/H5Oprivate.h \ ../src/H5Opublic.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h \ - ../src/H5Tprivate.h \ - ../src/H5Tpublic.h \ - ../src/H5Sprivate.h -dsets.o: \ - dsets.c \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h +external.o: \ + external.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -262,8 +195,8 @@ dsets.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -cmpd_dset.o: \ - cmpd_dset.c \ +iopipe.o: \ + iopipe.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -282,9 +215,27 @@ cmpd_dset.o: \ ../src/H5Opublic.h \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ - ../src/H5Spublic.h -extend.o: \ - extend.c \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h +gheap.o: \ + gheap.c \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ + ../src/H5Fprivate.h \ + ../src/H5Fpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Gprivate.h \ + ../src/H5Gpublic.h \ + ../src/H5Bprivate.h \ + ../src/H5Bpublic.h \ + ../src/H5HGprivate.h \ + ../src/H5HGpublic.h +shtype.o: \ + shtype.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -304,8 +255,8 @@ extend.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h -external.o: \ - external.c \ +links.o: \ + links.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -326,8 +277,8 @@ external.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -iopipe.o: \ - iopipe.c \ +chunk.o: \ + chunk.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -348,34 +299,37 @@ iopipe.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h -gheap.o: \ - gheap.c \ - ../src/H5private.h \ +bittests.o: \ + bittests.c \ + ../src/H5Tpkg.h \ + ../src/H5HGprivate.h \ + ../src/H5HGpublic.h \ ../src/H5public.h \ ../src/H5config.h \ - ../src/H5Eprivate.h \ - ../src/H5Epublic.h \ - ../src/H5Ipublic.h \ ../src/H5Fprivate.h \ ../src/H5Fpublic.h \ + ../src/H5Ipublic.h \ + ../src/H5private.h \ ../src/H5Dpublic.h \ + ../src/H5Tprivate.h \ + ../src/H5Tpublic.h \ ../src/H5Gprivate.h \ ../src/H5Gpublic.h \ - ../src/H5Bprivate.h \ - ../src/H5Bpublic.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h -shtype.o: \ - shtype.c \ - ../src/hdf5.h \ + ../src/H5Bprivate.h +tattr.o: \ + tattr.c \ + testhdf5.h \ + ../src/H5private.h \ ../src/H5public.h \ ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ ../src/H5Ipublic.h \ + ../src/hdf5.h \ ../src/H5Apublic.h \ ../src/H5ACpublic.h \ ../src/H5Bpublic.h \ ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ ../src/H5Fpublic.h \ ../src/H5Gpublic.h \ ../src/H5HGpublic.h \ @@ -386,6 +340,33 @@ shtype.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h +th5s.o: \ + th5s.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Ipublic.h \ + ../src/H5Bprivate.h \ + ../src/H5Bpublic.h \ + ../src/H5Fprivate.h \ + ../src/H5Fpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Sprivate.h \ + ../src/H5Spublic.h \ + ../src/H5Gprivate.h \ + ../src/H5Gpublic.h \ + ../src/H5Oprivate.h \ + ../src/H5Opublic.h \ + ../src/H5HGprivate.h \ + ../src/H5HGpublic.h \ + ../src/H5Tprivate.h \ + ../src/H5Tpublic.h \ + ../src/H5Zprivate.h \ + ../src/H5Zpublic.h \ + ../src/H5Pprivate.h big.o: \ big.c \ ../src/hdf5.h \ @@ -409,8 +390,8 @@ big.o: \ ../src/H5Spublic.h \ ../src/H5Tpublic.h \ ../src/H5private.h -links.o: \ - links.c \ +dtypes.o: \ + dtypes.c \ ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ @@ -430,18 +411,33 @@ links.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ - ../src/H5Tpublic.h -chunk.o: \ - chunk.c \ - ../src/hdf5.h \ + ../src/H5Tpublic.h \ + ../src/H5Tpkg.h \ + ../src/H5HGprivate.h \ + ../src/H5Fprivate.h \ + ../src/H5private.h \ + ../src/H5Tprivate.h \ + ../src/H5Gprivate.h +testhdf5.o: \ + testhdf5.c \ + testhdf5.h \ + ../src/H5private.h \ + ../src/H5public.h \ + ../src/H5config.h +tselect.o: \ + tselect.c \ + testhdf5.h \ + ../src/H5private.h \ ../src/H5public.h \ ../src/H5config.h \ + ../src/H5Eprivate.h \ + ../src/H5Epublic.h \ ../src/H5Ipublic.h \ + ../src/hdf5.h \ ../src/H5Apublic.h \ ../src/H5ACpublic.h \ ../src/H5Bpublic.h \ ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ ../src/H5Fpublic.h \ ../src/H5Gpublic.h \ ../src/H5HGpublic.h \ @@ -451,22 +447,26 @@ chunk.o: \ ../src/H5Opublic.h \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h -bittests.o: \ - bittests.c \ - ../src/H5Tpkg.h \ - ../src/H5HGprivate.h \ - ../src/H5HGpublic.h \ + ../src/H5Spublic.h +dsets.o: \ + dsets.c \ + ../src/hdf5.h \ ../src/H5public.h \ ../src/H5config.h \ - ../src/H5Fprivate.h \ - ../src/H5Fpublic.h \ ../src/H5Ipublic.h \ - ../src/H5private.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ ../src/H5Dpublic.h \ - ../src/H5Tprivate.h \ - ../src/H5Tpublic.h \ - ../src/H5Gprivate.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ ../src/H5Gpublic.h \ - ../src/H5Bprivate.h + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h diff --git a/test/dsets.c b/test/dsets.c index 4d0477f..6ad7ee0 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -114,6 +114,10 @@ test_create(hid_t file) /* Close the dataset */ if (H5Dclose(dataset) < 0) goto error; + /* Add a comment to the dataset */ + status = H5Gset_comment(file, DSET_DEFAULT_NAME, "This is a dataset"); + if (status<0) goto error; + /* * Try creating a dataset that already exists. This should fail since a * dataset can only be created once. Temporarily turn off error @@ -788,7 +792,9 @@ main(void) /* Cause the library to emit initial messages */ grp = H5Gcreate (file, "emit diagnostics", 0); + H5Gset_comment(grp, ".", "Causes diagnostic messages to be emitted"); H5Gclose (grp); + status = test_create(file); diff --git a/tools/h5ls.c b/tools/h5ls.c index f7e9b76..7a88ac4 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -119,7 +119,7 @@ list (hid_t group, const char *name, void __unused__ *op_data) hid_t (*func)(void*); void *edata; int i; - char buf[512]; + char buf[512], comment[50]; H5G_stat_t statbuf; /* Disable error reporting */ @@ -171,6 +171,11 @@ list (hid_t group, const char *name, void __unused__ *op_data) printf ("Unknown Type\n"); } + /* Display the comment if the object has one */ + H5Gget_comment(group, name, sizeof(comment), comment); + strcpy(comment+sizeof(comment)-4, "..."); + if (comment[0]) printf("%26s%s\n", "", comment); + /* Restore error reporting */ H5Eset_auto (func, edata); return 0; -- cgit v0.12