summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-07-11 20:59:52 (GMT)
committerGitHub <noreply@github.com>2022-07-11 20:59:52 (GMT)
commitb9d1d66ab84b492691d3c73e71b1374a7da19e50 (patch)
tree91094aab994ae89fa356bd926726b3909f86d58e /tools/lib
parent663321087a73e760a028517584731eb8ef308ba2 (diff)
downloadhdf5-b9d1d66ab84b492691d3c73e71b1374a7da19e50.zip
hdf5-b9d1d66ab84b492691d3c73e71b1374a7da19e50.tar.gz
hdf5-b9d1d66ab84b492691d3c73e71b1374a7da19e50.tar.bz2
Develop HDFFV-11310 (#1811)
* Rework java vl check in read/write. Handle old refs in h5dump * Committing clang-format changes * Java changes allow default VL reads * Fix JNI utility for old refs * HDFFV-11310 - implement vlen read/write for atomic types. * format check fix * Mostly format fixes * More format issues * Two format changes * Use JNI names for sizeof * format change * fix size typo * Change to older method to initialize list * remove unused var * format fix * switch writeVL functions to use datatype instead of java type * Add VL option to generic read/write check * Correct function name typo * Add JIRA issue * Correct note to match change in code. * HDFFV-11318 add VL references as byte arrays * Add release note and format changes * Another format update * Fix unreleased allocations * Fix format * format correction Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools_str.c82
-rw-r--r--tools/lib/h5tools_str.h1
2 files changed, 83 insertions, 0 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index ff7e233..9a26164 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1202,10 +1202,49 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else if (H5Tequal(type, H5T_STD_REF_DSETREG)) {
/* if(nsize == H5R_DSET_REG_REF_BUF_SIZE) */
H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG");
+ h5tools_str_append(str, H5_TOOLS_DATASET);
+ h5tools_str_sprint_old_reference(str, container, vp);
}
else if (H5Tequal(type, H5T_STD_REF_OBJ)) {
/* if (nsize == H5R_OBJ_REF_BUF_SIZE) */
+ /*
+ * Object references -- show the type and OID of the referenced object.
+ */
+ H5O_info1_t oi;
+
H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_OBJ");
+ obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp);
+ H5Oget_info2(obj, &oi, H5O_INFO_BASIC);
+
+ /* Print object type and close object */
+ switch (oi.type) {
+ case H5O_TYPE_GROUP:
+ h5tools_str_append(str, H5_TOOLS_GROUP);
+ break;
+
+ case H5O_TYPE_DATASET:
+ h5tools_str_append(str, H5_TOOLS_DATASET);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ h5tools_str_append(str, H5_TOOLS_DATATYPE);
+ break;
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ h5tools_str_append(str, "%u-", (unsigned)oi.type);
+ break;
+ } /* end switch */
+ H5Oclose(obj);
+
+ /* Print OID */
+ if (info->obj_hidefileno)
+ h5tools_str_append(str, info->obj_format, oi.addr);
+ else
+ h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr);
+
+ h5tools_str_sprint_old_reference(str, container, vp);
} /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */
}
break;
@@ -1286,6 +1325,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
nelmts = ((hvl_t *)((void *)cp_vp))->len;
for (i = 0; i < nelmts; i++) {
+ H5TOOLS_DEBUG("H5T_VLEN %d of %ld", i, nelmts);
if (i)
h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK));
@@ -1349,6 +1389,48 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
/*-------------------------------------------------------------------------
+ * Function: h5tools_str_sprint_old_reference
+ *
+ * Purpose: Object reference -- show the name of the old referenced object.
+ *
+ * Return: Nothing
+ *-------------------------------------------------------------------------
+ */
+void
+h5tools_str_sprint_old_reference(h5tools_str_t *str, hid_t container, void *vp)
+{
+ hid_t obj = H5I_INVALID_HID;
+ hid_t region = H5I_INVALID_HID;
+ char ref_name[1024];
+
+ H5TOOLS_START_DEBUG(" ");
+
+ h5tools_str_append(str, " \"");
+ obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, vp);
+ if (obj >= 0) {
+ region = H5Rget_region(container, H5R_DATASET_REGION, vp);
+ if (region >= 0) {
+ H5Rget_name(obj, H5R_DATASET_REGION, vp, (char *)ref_name, 1024);
+ h5tools_str_append(str, "%s", ref_name);
+
+ H5Sclose(region);
+ } /* end if (region >= 0) */
+ H5Dclose(obj);
+ } /* end if (obj >= 0) */
+ else {
+ obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp);
+ if (obj >= 0) {
+ H5Rget_name(obj, H5R_OBJECT, vp, (char *)ref_name, 1024);
+ h5tools_str_append(str, "%s", ref_name);
+ H5Dclose(obj);
+ }
+ }
+ h5tools_str_append(str, "\"");
+
+ H5TOOLS_ENDDEBUG(" ");
+}
+
+/*-------------------------------------------------------------------------
* Function: h5tools_str_sprint_reference
*
* Purpose: Object reference -- show the name of the referenced object.
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index f4610f0..3f4fd05 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -41,6 +41,7 @@ H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5t
h5tools_context_t *ctx);
H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
+H5TOOLS_DLL void h5tools_str_sprint_old_reference(h5tools_str_t *str, hid_t container, void *vp);
H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *vp);
H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
hid_t type, void *vp, h5tools_context_t *ctx);