summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c202
-rw-r--r--tools/h5dump/h5dump.h10
-rw-r--r--tools/h5dump/h5dumpgentest.c151
-rw-r--r--tools/h5dump/testh5dump.sh.in4
-rwxr-xr-xtools/h5dump/testh5dumpxml.sh.in2
5 files changed, 324 insertions, 45 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 4bd388a..7a49950 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -271,6 +271,10 @@ static const h5dump_header_t standardformat = {
"", /*dataend */
SOFTLINK, /*softlinkbegin */
"", /*softlinkend */
+ EXTLINK, /*extlinkbegin */
+ "", /*extlinkend */
+ UDLINK, /*udlinkbegin */
+ "", /*udlinkend */
SUBSET, /*subsettingbegin */
"", /*subsettingend */
START, /*startbegin */
@@ -300,6 +304,10 @@ static const h5dump_header_t standardformat = {
"}", /*datablockend */
"{", /*softlinkblockbegin */
"}", /*softlinkblockend */
+ "{", /*extlinkblockbegin */
+ "}", /*extlinkblockend */
+ "{", /*udlinkblockbegin */
+ "}", /*udlinkblockend */
"{", /*strblockbegin */
"}", /*strblockend */
"{", /*enumblockbegin */
@@ -1398,6 +1406,7 @@ dump_all(hid_t group, const char *name, void * op_data)
hid_t obj;
char *obj_path = NULL; /* Full path of object */
H5G_stat_t statbuf;
+ H5L_linkinfo_t linfo; /* Link information */
herr_t ret = SUCCEED;
/* Stat the object */
@@ -1407,6 +1416,12 @@ dump_all(hid_t group, const char *name, void * op_data)
ret = FAIL;
goto done;
} /* end if */
+ if(H5Lget_linkinfo(group, name, &linfo, H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to get object information\n");
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ goto done;
+ } /* end if */
if (*(int *)op_data != H5G_UNKNOWN && statbuf.type != *(int *) op_data)
goto done;
@@ -1433,7 +1448,7 @@ dump_all(hid_t group, const char *name, void * op_data)
indentation(indent + COL);
}
- if (H5Gget_linkval(group, name, statbuf.linklen, targbuf) < 0) {
+ if (H5Lget_linkval(group, name, statbuf.linklen, targbuf, H5P_DEFAULT) < 0) {
error_msg(progname, "unable to get link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
@@ -1516,7 +1531,128 @@ dump_all(hid_t group, const char *name, void * op_data)
HDfree(targbuf);
break;
}
+ case H5G_UDLINK:
+ {
+ indentation(indent);
+ switch(linfo.linkclass)
+ {
+ case H5L_LINK_EXTERNAL:
+ {
+ char *targbuf;
+ char *filename;
+ char *targname;
+ targbuf = HDmalloc(statbuf.linklen);
+ HDassert(targbuf);
+ if (!doxml) {
+ begin_obj(dump_header_format->extlinkbegin, name,
+ dump_header_format->extlinkblockbegin);
+ }
+ if (H5Lget_linkval(group, name, statbuf.linklen, targbuf, H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to get external link value\n");
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } else {
+ if(H5Lunpack_elink_val(targbuf, &filename, &targname) < 0) {
+ error_msg(progname, "unable to unpack external link value\n");
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } else {
+ if (!doxml) {
+ indentation(indent + COL);
+ printf("LINKCLASS %d\n", linfo.linkclass);
+ indentation(indent + COL);
+ printf("TARGETFILE \"%s\"\n", filename);
+ indentation(indent + COL);
+ printf("TARGETPATH \"%s\"\n", targname);
+ }
+ else /* XML */
+ {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_filename = xml_escape_the_name(filename);
+ char *t_targname = xml_escape_the_name(targname);
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
+
+ printf("<%sExternalLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetFilename=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ filename, /* TargetFilename */
+ targname, /* TargetPath*/
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_filename);
+ HDfree(t_targname);
+ HDfree(t_obj_path);
+ }
+ }
+ }
+ if (!doxml) {
+ end_obj(dump_header_format->extlinkend,
+ dump_header_format->extlinkblockend);
+ }
+ HDfree(targbuf);
+ }
+ break;
+ default:
+ if (!doxml) {
+ begin_obj(dump_header_format->udlinkbegin, name,
+ dump_header_format->udlinkblockbegin);
+ indentation(indent + COL);
+ }
+ if (!doxml) {
+ printf("LINKCLASS %d\n", linfo.linkclass);
+ }
+ else /* XML */
+ {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
+ printf("<%sUserDefined LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "LinkClass=\"%d\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ linfo.linkclass, /* LinkClass */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ }
+ if (!doxml) {
+ indentation(indent);
+ end_obj(dump_header_format->udlinkend,
+ dump_header_format->udlinkblockend);
+ }
+ }
+ break;
+ }
case H5G_GROUP:
if ((obj = H5Gopen(group, name)) < 0) {
error_msg(progname, "unable to dump group \"%s\"\n", name);
@@ -2003,7 +2139,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_ai)
/* Print all the values. */
if (obj_data == DATASET_DATA) {
- hid_t f_type = H5Dget_type(obj_id);
+ hid_t f_type = H5Dget_type(obj_id);
char string_prefix[64];
h5tool_format_t string_dataformat;
@@ -2683,7 +2819,7 @@ set_output_file(const char *fname, int is_bin)
else
rawdatastream = NULL;
}
-
+
/* binary output */
if (is_bin)
{
@@ -2699,7 +2835,7 @@ set_output_file(const char *fname, int is_bin)
return 0;
}
}
-
+
return -1;
}
@@ -3044,7 +3180,7 @@ handle_groups(hid_t fid, char *group, void UNUSED * data)
/*-------------------------------------------------------------------------
* Function: handle_links
*
- * Purpose: Handle the links from the command.
+ * Purpose: Handle soft or UD links from the command.
*
* Return: void
*
@@ -3059,18 +3195,24 @@ static void
handle_links(hid_t fid, char *links, void UNUSED * data)
{
H5G_stat_t statbuf;
+ H5L_linkinfo_t linfo;
+ char * elink_file;
+ char * elink_path;
if (H5Gget_objinfo(fid, links, FALSE, &statbuf) < 0) {
error_msg(progname, "unable to get obj info from \"%s\"\n", links);
d_status = EXIT_FAILURE;
- } else if (statbuf.type == H5G_LINK) {
+ } else if (H5Lget_linkinfo(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to get link info from \"%s\"\n", links);
+ d_status = EXIT_FAILURE;
+ } else if (statbuf.type == H5G_LINK) { /* Soft link */
char *buf = HDmalloc(statbuf.linklen);
begin_obj(dump_header_format->softlinkbegin, links,
dump_header_format->softlinkblockbegin);
indentation(COL);
- if (H5Gget_linkval(fid, links, statbuf.linklen, buf) >= 0) {
+ if (H5Lget_linkval(fid, links, statbuf.linklen, buf, H5P_DEFAULT) >= 0) {
printf("LINKTARGET \"%s\"\n", buf);
} else {
error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
@@ -3080,7 +3222,45 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
end_obj(dump_header_format->softlinkend,
dump_header_format->softlinkblockend);
-
+ HDfree(buf);
+ } else if (statbuf.type == H5G_UDLINK) { /* User-defined link */
+ char *buf = HDmalloc(statbuf.linklen);
+ begin_obj(dump_header_format->udlinkbegin, links,
+ dump_header_format->udlinkblockbegin);
+ indentation(COL);
+ switch(linfo.linkclass) {
+ case H5L_LINK_EXTERNAL:
+ begin_obj(dump_header_format->extlinkbegin, links,
+ dump_header_format->extlinkblockbegin);
+ if (H5Lget_linkval(fid, links, statbuf.linklen, buf, H5P_DEFAULT) >= 0) {
+ if(H5Lunpack_elink_val(buf, &elink_file, &elink_path)>=0) {
+ indentation(COL);
+ printf("LINKCLASS %d\n", linfo.linkclass);
+ indentation(COL);
+ printf("TARGETFILE \"%s\"\n", elink_file);
+ indentation(COL);
+ printf("TARGETPATH \"%s\"\n", elink_path);
+ } else {
+ error_msg(progname, "h5dump error: unable to unpack external link value for \"%s\"\n",
+ links);
+ d_status = EXIT_FAILURE;
+ }
+ } else {
+ error_msg(progname, "h5dump error: unable to get external link value for \"%s\"\n",
+ links);
+ d_status = EXIT_FAILURE;
+ }
+ end_obj(dump_header_format->extlinkend,
+ dump_header_format->extlinkblockend);
+ break;
+ default:
+ begin_obj(dump_header_format->udlinkbegin, links,
+ dump_header_format->udlinkblockbegin);
+ indentation(COL);
+ printf("LINKCLASS %d\n", linfo.linkclass);
+ end_obj(dump_header_format->udlinkend,
+ dump_header_format->udlinkblockend);
+ }
HDfree(buf);
} else {
error_msg(progname, "\"%s\" is not a link\n", links);
@@ -5054,7 +5234,8 @@ xml_dump_group(hid_t gid, const char *name)
H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
xtype = H5G_LINK;
H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
-
+ xtype = H5G_UDLINK;
+ H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
}
free(t_name);
free(grpxid);
@@ -5114,7 +5295,8 @@ xml_dump_group(hid_t gid, const char *name)
H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
xtype = H5G_LINK;
H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
-
+ xtype = H5G_UDLINK;
+ H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
}
indent -= COL;
diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index dbc5de9..08aa527 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -45,6 +45,8 @@
#define S_SIMPLE "SIMPLE"
#define S_NULL "NULL"
#define SOFTLINK "SOFTLINK"
+#define EXTLINK "EXTERNAL_LINK"
+#define UDLINK "USERDEFINED_LINK"
#define STORAGELAYOUT "STORAGELAYOUT"
#define START "START"
#define STRIDE "STRIDE"
@@ -91,6 +93,10 @@ typedef struct h5dump_header_t {
const char *dataend;
const char *softlinkbegin;
const char *softlinkend;
+ const char *extlinkbegin;
+ const char *extlinkend;
+ const char *udlinkbegin;
+ const char *udlinkend;
const char *subsettingbegin;
const char *subsettingend;
const char *startbegin;
@@ -120,6 +126,10 @@ typedef struct h5dump_header_t {
const char *datablockend;
const char *softlinkblockbegin;
const char *softlinkblockend;
+ const char *extlinkblockbegin;
+ const char *extlinkblockend;
+ const char *udlinkblockbegin;
+ const char *udlinkblockend;
const char *strblockbegin;
const char *strblockend;
const char *enumblockbegin;
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 89652f2..3a5272a 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -79,7 +79,8 @@
#define FILE50 "taindices.h5"
#define FILE51 "tlonglinks.h5"
#define FILE52 "tldouble.h5"
-
+#define FILE53 "textlink.h5"
+#define FILE54 "tudlink.h5"
@@ -120,6 +121,27 @@ const H5Z_class_t H5Z_MYFILTER[1] = {{
}};
+/* A UD link traversal function. Shouldn't actually be called. */
+static hid_t UD_traverse(UNUSED const char * link_name, UNUSED hid_t cur_group,
+ UNUSED void * udata, UNUSED size_t udata_size, UNUSED hid_t lapl_id)
+{
+return -1;
+}
+
+#define MY_LINKCLASS 187
+
+const H5L_link_class_t UD_link_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_link_class_t version */
+ MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
+}};
+
#define LENSTR 50
#define LENSTR2 11
@@ -403,8 +425,8 @@ static void gent_softlink(void)
fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen (fid, "/");
- H5Glink (root, H5G_LINK_SOFT, "somevalue", "slink1");
- H5Glink (root, H5G_LINK_SOFT, "linkvalue", "slink2");
+ H5Glink (root, H5L_LINK_SOFT, "somevalue", "slink1");
+ H5Glink (root, H5L_LINK_SOFT, "linkvalue", "slink2");
H5Gclose(root);
H5Fclose(fid);
@@ -441,19 +463,48 @@ static void gent_hardlink(void)
H5Dclose(dataset);
group = H5Gcreate (fid, "/g1", 0);
- H5Glink (group, H5G_LINK_HARD, "/dset1", "dset2");
+ H5Glink (group, H5L_LINK_HARD, "/dset1", "dset2");
H5Gclose(group);
group = H5Gcreate (fid, "/g2", 0);
- H5Glink (group, H5G_LINK_HARD, "/dset1", "dset3");
+ H5Glink (group, H5L_LINK_HARD, "/dset1", "dset3");
H5Gclose(group);
group = H5Gopen(fid, "/g1");
- H5Glink (group, H5G_LINK_HARD, "/g2", "g1.1");
+ H5Glink (group, H5L_LINK_HARD, "/g2", "g1.1");
H5Gclose(group);
H5Fclose(fid);
}
+static void gent_extlink(void)
+{
+ hid_t fid;
+
+ /* This external link will dangle, but that's okay */
+ fid = H5Fcreate(FILE53, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external("filename", "objname", fid, "extlink1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external("anotherfile", "anotherobj", fid, "extlink2", H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+}
+
+static void gent_udlink(void)
+{
+ hid_t fid;
+ char buf[4];
+
+ H5Lregister(UD_link_class);
+
+ /* This ud link will dangle, but that's okay */
+ fid = H5Fcreate(FILE54, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_ud(fid, "udlink1", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ strcpy(buf, "foo");
+ H5Lcreate_ud(fid, "udlink2", MY_LINKCLASS, buf, 4, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+}
+
+
/*
/
/ | \ \
@@ -830,9 +881,9 @@ static void gent_compound_dt2(void) { /* test compound data type */
/ : g1 g2 attr1 attr2
g1 : g1.1 g1.2
g1.1 : dset1.1.1(attr1, attr2) dset1.1.2
-g1.2 : g1.2.1
+g1.2 : g1.2.1 extlink
g1.2.1 : slink
-g2 : dset2.1 dset2.2
+g2 : dset2.1 dset2.2 udlink
*/
@@ -926,9 +977,12 @@ float dset2_1[10], dset2_2[3][5];
H5Gclose(group);
+ /* external link */
+ H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT);
+
/* soft link */
group = H5Gopen (fid, "/g1/g1.2/g1.2.1");
- H5Glink (group, H5G_LINK_SOFT, "somevalue", "slink");
+ H5Glink (group, H5L_LINK_SOFT, "somevalue", "slink");
H5Gclose(group);
group = H5Gopen (fid, "/g2");
@@ -956,6 +1010,10 @@ float dset2_1[10], dset2_2[3][5];
H5Gclose(group);
+ /* user-defined link */
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g2/udlink", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+
H5Fclose(fid);
}
@@ -981,8 +1039,8 @@ hid_t fid, group;
group = H5Gcreate (fid, "/g2", 0);
H5Gclose(group);
- H5Glink(fid, H5G_LINK_HARD, "/g2", "/g1/g1.1");
- H5Glink(fid, H5G_LINK_HARD, "/g1", "/g2/g2.1");
+ H5Glink(fid, H5L_LINK_HARD, "/g2", "/g1/g1.1");
+ H5Glink(fid, H5L_LINK_HARD, "/g1", "/g2/g2.1");
H5Fclose(fid);
}
@@ -1001,10 +1059,10 @@ hid_t fid, group;
H5Gclose(group);
/* create path from object at /g1 to object at /g2 and name it g1.1 */
- H5Glink (fid, H5G_LINK_HARD, "/g2", "/g1/g1.1");
+ H5Glink (fid, H5L_LINK_HARD, "/g2", "/g1/g1.1");
/* create path from object at /g2 to object at /g1 and name it g2.1 */
- H5Glink (fid, H5G_LINK_SOFT, "/g1", "/g2/g2.1");
+ H5Glink (fid, H5L_LINK_SOFT, "/g1", "/g2/g2.1");
H5Fclose(fid);
@@ -1012,13 +1070,13 @@ hid_t fid, group;
/*
/
- | | | \ \ \
- g1 g2 g3 g4 g5 g6
- / \ | | \ \ \
- g1.1 g1.2 slink2 link3 dset2 slink4 dset3
- | | (g1) (dset2) (dset3)
- dset1 link1
- (dset1)
+ | | | \ \ \ \ \
+ g1 g2 g3 g4 g5 g6 g7 g8
+ / \ | | \ \ \ \ \
+ g1.1 g1.2 slink2 link3 dset2 slink4 dset3 slink5 elink
+ | | (g1) (dset2) (dset3) (elink) udlink
+ dset1 link1 slink6
+ (dset1) (udlink)
*/
static void gent_many(void) {
@@ -1043,6 +1101,7 @@ static void gent_many(void) {
hsize_t dim[4];
int idx[4] = {0,1,2,3}; /* normal indicies */
const int perm[4] = {0,1,2,3}; /* the 0'th and the 3'rd indices are permuted */
+ herr_t ret;
fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1150,11 +1209,11 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gcreate (fid, "/g1/g1.2", 0);
- H5Glink (group, H5G_LINK_HARD, "/g1/g1.1/dset1", "link1");
+ H5Glink (group, H5L_LINK_HARD, "/g1/g1.1/dset1", "link1");
H5Gclose(group);
group = H5Gcreate (fid, "/g2", 0);
- H5Glink (group, H5G_LINK_SOFT, "/g1", "slink2");
+ H5Glink (group, H5L_LINK_SOFT, "/g1", "slink2");
H5Gclose(group);
group = H5Gcreate (fid, "/g3", 0);
@@ -1178,7 +1237,7 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gopen(fid, "/g3");
- H5Glink (group, H5G_LINK_HARD, "/g4/dset2", "link3");
+ H5Glink (group, H5L_LINK_HARD, "/g4/dset2", "link3");
H5Gclose(group);
group = H5Gcreate (fid, "/g5", 0);
@@ -1201,10 +1260,26 @@ static void gent_many(void) {
H5Gclose(group);
group = H5Gopen(fid, "/g5");
- H5Glink (group, H5G_LINK_SOFT, "/g6/dset3", "slink4");
+ H5Glink (group, H5L_LINK_SOFT, "/g6/dset3", "slink4");
H5Gclose(group);
H5Pclose(create_plist);
+ group = H5Gcreate (fid, "/g7", 0);
+ H5Gclose(group);
+ group = H5Gcreate (fid, "/g8", 0);
+ H5Gclose(group);
+
+ /* Create dangling external and UD links */
+ H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g8/udlink", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create links to external and UD links */
+ ret= H5Glink (fid, H5L_LINK_SOFT, "/g8/elink", "/g7/slink5");
+ HDassert(ret >= 0);
+ ret= H5Glink (fid, H5L_LINK_SOFT, "/g8/udlink", "/g7/slink6");
+ HDassert(ret >= 0);
+
H5Fclose(fid);
}
@@ -4927,42 +5002,48 @@ static void gent_fcontents(void)
/* hard link to "dset" */
gid1 = H5Gcreate (fid, "/g1", 0);
- H5Glink (gid1, H5G_LINK_HARD, "/dset", "dset1");
+ H5Glink (gid1, H5L_LINK_HARD, "/dset", "dset1");
H5Gclose(gid1);
/* hard link to "dset" */
gid1 = H5Gcreate (fid, "/g2", 0);
- H5Glink (gid1, H5G_LINK_HARD, "/dset", "dset2");
+ H5Glink (gid1, H5L_LINK_HARD, "/dset", "dset2");
H5Gclose(gid1);
/* hard link to "g2" */
gid1 = H5Gopen(fid, "/g1");
- H5Glink (gid1, H5G_LINK_HARD, "/g2", "g1.1");
+ H5Glink (gid1, H5L_LINK_HARD, "/g2", "g1.1");
H5Gclose(gid1);
/* hard link to "dset" */
- ret=H5Glink (fid, H5G_LINK_HARD, "/dset", "dset3");
+ ret=H5Glink (fid, H5L_LINK_HARD, "/dset", "dset3");
assert(ret>=0);
/* hard link to "dset" */
- ret=H5Glink (fid, H5G_LINK_HARD, "/dset", "dset4");
+ ret=H5Glink (fid, H5L_LINK_HARD, "/dset", "dset4");
assert(ret>=0);
/* soft link to itself */
- ret=H5Glink (fid, H5G_LINK_SOFT, "mylink", "mylink");
+ ret=H5Glink (fid, H5L_LINK_SOFT, "mylink", "mylink");
assert(ret>=0);
/* soft link to "dset" */
- ret=H5Glink (fid, H5G_LINK_SOFT, "/dset", "softlink");
+ ret=H5Glink (fid, H5L_LINK_SOFT, "/dset", "softlink");
assert(ret>=0);
+ /* dangling external link */
+ ret=H5Lcreate_external("fname", "oname", fid, "extlink", H5P_DEFAULT, H5P_DEFAULT);
+ assert(ret>=0);
+ /* dangling udlink */
+ ret=H5Lcreate_ud(fid, "udlink", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ assert(ret>=0);
/*-------------------------------------------------------------------------
* datatypes
@@ -5397,11 +5478,11 @@ static void gent_longlinks(void)
objname[F51_MAX_NAME_LEN] = '\0';
/* Create hard link to existing object */
- assert(H5Glink2(fid, "grp1", H5G_LINK_HARD, fid, objname) >= 0);
+ assert(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT) >= 0);
/* Create soft link to existing object */
objname[0] = 'b';
- assert(H5Glink2(fid, "grp1", H5G_LINK_SOFT, fid, objname) >= 0);
+ assert(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT) >= 0);
/* Create group with long name in existing group */
gid2=H5Gcreate(gid, objname, (size_t)0);
@@ -5444,7 +5525,7 @@ static int gent_ldouble(void)
if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE))<0)
goto error;
- if ((size = H5Tget_size(tid))<0)
+ if ((size = H5Tget_size(tid))==0)
goto error;
if ((did = H5Dcreate(fid, "dset", tid, sid, H5P_DEFAULT))<0)
@@ -5483,6 +5564,8 @@ int main(void)
gent_softlink();
gent_dataset();
gent_hardlink();
+ gent_extlink();
+ gent_udlink();
gent_compound_dt();
gent_all();
gent_loop();
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 783634c..3f40976 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -125,10 +125,12 @@ TOOLTEST tattr-3.ddl --header -a /attr2 --attribute=/attr tattr.h5
# test for displaying attributes in shared datatype (also in group and dataset)
TOOLTEST tnamed_dtype_attr.ddl tnamed_dtype_attr.h5
-# test for displaying soft links
+# test for displaying soft links and user-defined links
TOOLTEST tslink-1.ddl tslink.h5
+TOOLTEST tudlink-1.ddl tudlink.h5
# test for displaying the selected link
TOOLTEST tslink-2.ddl -l slink2 tslink.h5
+TOOLTEST tudlink-2.ddl -l udlink2 tudlink.h5
# tests for hard links
TOOLTEST thlink-1.ddl thlink.h5
diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in
index 21db71a..490832e 100755
--- a/tools/h5dump/testh5dumpxml.sh.in
+++ b/tools/h5dump/testh5dumpxml.sh.in
@@ -118,6 +118,8 @@ TOOLTEST tcompound_complex.h5.xml --xml tcompound_complex.h5
TOOLTEST tobjref.h5.xml --xml tobjref.h5
TOOLTEST topaque.h5.xml --xml topaque.h5
TOOLTEST tslink.h5.xml --xml tslink.h5
+TOOLTEST tudlink.h5.xml --xml tudlink.h5
+TOOLTEST textlink.h5.xml --xml textlink.h5
TOOLTEST tstr.h5.xml --xml tstr.h5
TOOLTEST tstr2.h5.xml --xml tstr2.h5
TOOLTEST tref.h5.xml --xml tref.h5