summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-03-12 16:36:34 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-03-12 16:36:34 (GMT)
commitc24cea791f4a7c41a5258a943a4f614ad193948c (patch)
tree514a542eaba372169c0255f80981252c1d4399d4 /tools/h5dump
parent3015df0a5b02dee38264b191997c1949596c2c95 (diff)
downloadhdf5-c24cea791f4a7c41a5258a943a4f614ad193948c.zip
hdf5-c24cea791f4a7c41a5258a943a4f614ad193948c.tar.gz
hdf5-c24cea791f4a7c41a5258a943a4f614ad193948c.tar.bz2
[svn-r13503]
Preparation for making 1.6 and 1.7 h5dump more similar and 1.6 to have 1.7 fixed bugs incorporated
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/binread.c2
-rw-r--r--tools/h5dump/h5dump.c2338
-rw-r--r--tools/h5dump/h5dump.h2
-rw-r--r--tools/h5dump/h5dumpgentest.c14
4 files changed, 1178 insertions, 1178 deletions
diff --git a/tools/h5dump/binread.c b/tools/h5dump/binread.c
index 6a6c920..ab10af0 100644
--- a/tools/h5dump/binread.c
+++ b/tools/h5dump/binread.c
@@ -40,7 +40,7 @@
*
* Return: void
*
- * Programmer: Pedro Vicente Nunes
+ * Programmer: Pedro Vicente Nunes
*
* Modifications:
*
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 4ab68cf..4b22a09 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -99,70 +99,70 @@ static void add_prefix(char **prfx, size_t *prfx_len, const char *name);
static h5tool_format_t dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%d", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- "[ ", /*arr_pre */
- ",", /*arr_sep */
- " ]", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- ",\n", /*cmpd_sep */
- "{\n", /*cmpd_pre */
- "}", /*cmpd_suf */
- "\n", /*cmpd_end */
-
- ", ", /*vlen_sep */
- "(", /*vlen_pre */
- ")", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- ",", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- "", /*idx_n_fmt */
- "", /*idx_sep */
- "", /*idx_fmt */
-
- 80, /*line_ncols *//*standard default columns */
- 0, /*line_per_line */
- "", /*line_pre */
- "%s", /*line_1st */
- "%s", /*line_cont */
- "", /*line_suf */
- "", /*line_sep */
- 1, /*line_multi_new */
- " ", /*line_indent */
-
- 1, /*skip_first */
-
- 1, /*obj_hidefileno */
- " "H5_PRINTF_HADDR_FMT, /*obj_format */
-
- 1, /*dset_hidefileno */
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%d", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "[ ", /*arr_pre */
+ ",", /*arr_sep */
+ " ]", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ ",\n", /*cmpd_sep */
+ "{\n", /*cmpd_pre */
+ "}", /*cmpd_suf */
+ "\n", /*cmpd_end */
+
+ ", ", /*vlen_sep */
+ "(", /*vlen_pre */
+ ")", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ ",", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80, /*line_ncols *//*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ " ", /*line_indent */
+
+ 1, /*skip_first */
+
+ 1, /*obj_hidefileno */
+ " "H5_PRINTF_HADDR_FMT, /*obj_format */
+
+ 1, /*dset_hidefileno */
"DATASET %s ", /*dset_format */
- "%s", /*dset_blockformat_pre */
- "%s", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
1, /*array indices */
1 /*escape non printable characters */
};
@@ -183,70 +183,70 @@ static h5tool_format_t dataformat = {
* This table only affects XML output.
*/
static h5tool_format_t xml_dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%d", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- " ", /*arr_pre */
- "", /*arr_sep */
- "", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- " ", /*cmpd_sep */
- "", /*cmpd_pre */
- "", /*cmpd_suf */
- "", /*cmpd_end */
-
- " ", /*vlen_sep */
- " ", /*vlen_pre */
- "", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- "", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- "", /*idx_n_fmt */
- "", /*idx_sep */
- "", /*idx_fmt */
-
- 80, /*line_ncols *//*standard default columns */
- 0, /*line_per_line */
- "", /*line_pre */
- "%s", /*line_1st */
- "%s", /*line_cont */
- "", /*line_suf */
- "", /*line_sep */
- 1, /*line_multi_new */
- " ", /*line_indent */
-
- 1, /*skip_first */
-
- 1, /*obj_hidefileno */
- " "H5_PRINTF_HADDR_FMT, /*obj_format */
-
- 1, /*dset_hidefileno */
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%d", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ " ", /*arr_pre */
+ "", /*arr_sep */
+ "", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ " ", /*cmpd_sep */
+ "", /*cmpd_pre */
+ "", /*cmpd_suf */
+ "", /*cmpd_end */
+
+ " ", /*vlen_sep */
+ " ", /*vlen_pre */
+ "", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ "", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80, /*line_ncols *//*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ " ", /*line_indent */
+
+ 1, /*skip_first */
+
+ 1, /*obj_hidefileno */
+ " "H5_PRINTF_HADDR_FMT, /*obj_format */
+
+ 1, /*dset_hidefileno */
"DATASET %s ", /*dset_format */
- "%s", /*dset_blockformat_pre */
- "%s", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
0, /*array indices */
0 /*escape non printable characters */
};
@@ -254,70 +254,70 @@ static h5tool_format_t xml_dataformat = {
/** XML **/
static const h5dump_header_t standardformat = {
- "standardformat", /*name */
- "HDF5", /*fileebgin */
- "", /*fileend */
- SUPER_BLOCK, /*bootblockbegin */
- "", /*bootblockend */
- GROUP, /*groupbegin */
- "", /*groupend */
- DATASET, /*datasetbegin */
- "", /*datasetend */
- ATTRIBUTE, /*attributebegin */
- "", /*attributeend */
- DATATYPE, /*datatypebegin */
- "", /*datatypeend */
- DATASPACE, /*dataspacebegin */
- "", /*dataspaceend */
- DATA, /*databegin */
- "", /*dataend */
- SOFTLINK, /*softlinkbegin */
- "", /*softlinkend */
- EXTLINK, /*extlinkbegin */
- "", /*extlinkend */
- UDLINK, /*udlinkbegin */
- "", /*udlinkend */
- SUBSET, /*subsettingbegin */
- "", /*subsettingend */
- START, /*startbegin */
- "", /*startend */
- STRIDE, /*stridebegin */
- "", /*strideend */
- COUNT, /*countbegin */
- "", /*countend */
- BLOCK, /*blockbegin */
- "", /*blockend */
-
- "{", /*fileblockbegin */
- "}", /*fileblockend */
- "{", /*bootblockblockbegin */
- "}", /*bootblockblockend */
- "{", /*groupblockbegin */
- "}", /*groupblockend */
- "{", /*datasetblockbegin */
- "}", /*datasetblockend */
- "{", /*attributeblockbegin */
- "}", /*attributeblockend */
- "", /*datatypeblockbegin */
- "", /*datatypeblockend */
- "", /*dataspaceblockbegin */
- "", /*dataspaceblockend */
- "{", /*datablockbegin */
- "}", /*datablockend */
- "{", /*softlinkblockbegin */
- "}", /*softlinkblockend */
- "{", /*extlinkblockbegin */
- "}", /*extlinkblockend */
- "{", /*udlinkblockbegin */
- "}", /*udlinkblockend */
- "{", /*strblockbegin */
- "}", /*strblockend */
- "{", /*enumblockbegin */
- "}", /*enumblockend */
- "{", /*structblockbegin */
- "}", /*structblockend */
- "{", /*vlenblockbegin */
- "}", /*vlenblockend */
+ "standardformat", /*name */
+ "HDF5", /*fileebgin */
+ "", /*fileend */
+ SUPER_BLOCK, /*bootblockbegin */
+ "", /*bootblockend */
+ GROUP, /*groupbegin */
+ "", /*groupend */
+ DATASET, /*datasetbegin */
+ "", /*datasetend */
+ ATTRIBUTE, /*attributebegin */
+ "", /*attributeend */
+ DATATYPE, /*datatypebegin */
+ "", /*datatypeend */
+ DATASPACE, /*dataspacebegin */
+ "", /*dataspaceend */
+ DATA, /*databegin */
+ "", /*dataend */
+ SOFTLINK, /*softlinkbegin */
+ "", /*softlinkend */
+ EXTLINK, /*extlinkbegin */
+ "", /*extlinkend */
+ UDLINK, /*udlinkbegin */
+ "", /*udlinkend */
+ SUBSET, /*subsettingbegin */
+ "", /*subsettingend */
+ START, /*startbegin */
+ "", /*startend */
+ STRIDE, /*stridebegin */
+ "", /*strideend */
+ COUNT, /*countbegin */
+ "", /*countend */
+ BLOCK, /*blockbegin */
+ "", /*blockend */
+
+ "{", /*fileblockbegin */
+ "}", /*fileblockend */
+ "{", /*bootblockblockbegin */
+ "}", /*bootblockblockend */
+ "{", /*groupblockbegin */
+ "}", /*groupblockend */
+ "{", /*datasetblockbegin */
+ "}", /*datasetblockend */
+ "{", /*attributeblockbegin */
+ "}", /*attributeblockend */
+ "", /*datatypeblockbegin */
+ "", /*datatypeblockend */
+ "", /*dataspaceblockbegin */
+ "", /*dataspaceblockend */
+ "{", /*datablockbegin */
+ "}", /*datablockend */
+ "{", /*softlinkblockbegin */
+ "}", /*softlinkblockend */
+ "{", /*extlinkblockbegin */
+ "}", /*extlinkblockend */
+ "{", /*udlinkblockbegin */
+ "}", /*udlinkblockend */
+ "{", /*strblockbegin */
+ "}", /*strblockend */
+ "{", /*enumblockbegin */
+ "}", /*enumblockend */
+ "{", /*structblockbegin */
+ "}", /*structblockend */
+ "{", /*vlenblockbegin */
+ "}", /*vlenblockend */
"{", /*subsettingblockbegin */
"}", /*subsettingblockend */
"(", /*startblockbegin */
@@ -329,10 +329,10 @@ static const h5dump_header_t standardformat = {
"(", /*blockblockbegin */
");", /*blockblockend */
- "", /*dataspacedescriptionbegin */
- "", /*dataspacedescriptionend */
- "(", /*dataspacedimbegin */
- ")", /*dataspacedimend */
+ "", /*dataspacedescriptionbegin */
+ "", /*dataspacedescriptionend */
+ "(", /*dataspacedimbegin */
+ ")", /*dataspacedimend */
};
/**
@@ -1116,7 +1116,7 @@ dump_datatype(hid_t type)
print_datatype(type,0);
end_obj(dump_header_format->datatypeend,
- dump_header_format->datatypeblockend);
+ dump_header_format->datatypeblockend);
indent -= COL;
}
@@ -1148,50 +1148,50 @@ dump_dataspace(hid_t space)
switch (space_type) {
case H5S_SCALAR:
- /* scalar dataspace */
- HDfprintf(stdout, "%s %s",
- dump_header_format->dataspacedescriptionbegin, S_SCALAR);
+ /* scalar dataspace */
+ HDfprintf(stdout, "%s %s",
+ dump_header_format->dataspacedescriptionbegin, S_SCALAR);
break;
case H5S_SIMPLE:
- /* simple dataspace */
- HDfprintf(stdout, "%s %s { %s %Hu",
- dump_header_format->dataspacedescriptionbegin, S_SIMPLE,
- dump_header_format->dataspacedimbegin, size[0]);
-
- for (i = 1; i < ndims; i++)
- HDfprintf(stdout, ", %Hu", size[i]);
-
- printf(" %s / ", dump_header_format->dataspacedimend);
-
- if (maxsize[0] == H5S_UNLIMITED)
- HDfprintf(stdout, "%s %s",
- dump_header_format->dataspacedimbegin,
- "H5S_UNLIMITED");
- else
- HDfprintf(stdout, "%s %Hu",
+ /* simple dataspace */
+ HDfprintf(stdout, "%s %s { %s %Hu",
+ dump_header_format->dataspacedescriptionbegin, S_SIMPLE,
+ dump_header_format->dataspacedimbegin, size[0]);
+
+ for (i = 1; i < ndims; i++)
+ HDfprintf(stdout, ", %Hu", size[i]);
+
+ printf(" %s / ", dump_header_format->dataspacedimend);
+
+ if (maxsize[0] == H5S_UNLIMITED)
+ HDfprintf(stdout, "%s %s",
+ dump_header_format->dataspacedimbegin,
+ "H5S_UNLIMITED");
+ else
+ HDfprintf(stdout, "%s %Hu",
dump_header_format->dataspacedimbegin, maxsize[0]);
- for (i = 1; i < ndims; i++)
- if (maxsize[i] == H5S_UNLIMITED)
- HDfprintf(stdout, ", %s", "H5S_UNLIMITED");
- else
- HDfprintf(stdout, ", %Hu", maxsize[i]);
+ for (i = 1; i < ndims; i++)
+ if (maxsize[i] == H5S_UNLIMITED)
+ HDfprintf(stdout, ", %s", "H5S_UNLIMITED");
+ else
+ HDfprintf(stdout, ", %Hu", maxsize[i]);
- printf(" %s }", dump_header_format->dataspacedimend);
+ printf(" %s }", dump_header_format->dataspacedimend);
- break;
+ break;
case H5S_NULL:
- /* null dataspace */
- HDfprintf(stdout, "%s %s",
- dump_header_format->dataspacedescriptionbegin, S_NULL);
+ /* null dataspace */
+ HDfprintf(stdout, "%s %s",
+ dump_header_format->dataspacedescriptionbegin, S_NULL);
break;
case H5S_NO_CLASS:
default:
- printf("%s unknown dataspace %s\n", BEGIN, END);
+ printf("%s unknown dataspace %s\n", BEGIN, END);
}
end_obj(dump_header_format->dataspaceend,
- dump_header_format->dataspaceblockend);
+ dump_header_format->dataspaceblockend);
}
/*-------------------------------------------------------------------------
@@ -1217,34 +1217,34 @@ dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data)
indentation(indent);
begin_obj(dump_header_format->attributebegin, attr_name,
- dump_header_format->attributeblockbegin);
+ dump_header_format->attributeblockbegin);
if ((attr_id = H5Aopen_name(attr, attr_name)) < 0) {
- indentation(indent + COL);
+ indentation(indent + COL);
error_msg(progname, "unable to open attribute \"%s\"\n", attr_name);
- indentation(indent);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
- ret = FAIL;
+ indentation(indent);
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
} else {
- type = H5Aget_type(attr_id);
- space = H5Aget_space(attr_id);
- dump_datatype(type);
- dump_dataspace(space);
-
- if (display_oid)
- dump_oid(attr_id);
-
- if (display_data || display_attr_data)
- dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai);
-
- H5Tclose(type);
- H5Sclose(space);
- H5Aclose(attr_id);
- indentation(indent);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
+ dump_datatype(type);
+ dump_dataspace(space);
+
+ if (display_oid)
+ dump_oid(attr_id);
+
+ if (display_data || display_attr_data)
+ dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai);
+
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Aclose(attr_id);
+ indentation(indent);
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
}
return ret;
@@ -1279,11 +1279,11 @@ dump_selected_attr(hid_t loc_id, const char *name)
/* find the last / */
while (name[j] != '/' && j >= 0)
- j--;
+ j--;
/* object name */
if (j == -1) {
- strcpy(obj_name, "/");
+ strcpy(obj_name, "/");
} else {
strncpy(obj_name, name, (size_t)j + 1);
obj_name[j + 1] = '\0';
@@ -1291,101 +1291,101 @@ dump_selected_attr(hid_t loc_id, const char *name)
attr_name = name + j + 1;
begin_obj(dump_header_format->attributebegin, name,
- dump_header_format->attributeblockbegin);
+ dump_header_format->attributeblockbegin);
H5Gget_objinfo(loc_id, obj_name, FALSE, &statbuf);
switch (statbuf.type) {
case H5G_GROUP:
- if ((oid = H5Gopen(loc_id, obj_name)) < 0) {
- indentation(COL);
+ if ((oid = H5Gopen(loc_id, obj_name)) < 0) {
+ indentation(COL);
error_msg(progname, "unable to open group \"%s\"\n", obj_name);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
- return FAIL;
- }
- break;
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ }
+ break;
case H5G_DATASET:
- if ((oid = H5Dopen(loc_id, obj_name)) < 0) {
- indentation(COL);
+ if ((oid = H5Dopen(loc_id, obj_name)) < 0) {
+ indentation(COL);
error_msg(progname, "unable to open dataset \"%s\"\n", obj_name);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
- return FAIL;
- }
- break;
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ }
+ break;
case H5G_TYPE:
- if ((oid = H5Topen(loc_id, obj_name)) < 0) {
- indentation(COL);
+ if ((oid = H5Topen(loc_id, obj_name)) < 0) {
+ indentation(COL);
error_msg(progname, "unable to open datatype \"%s\"\n", obj_name);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
- return FAIL;
- }
- break;
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ }
+ break;
default:
- indentation(COL);
+ indentation(COL);
error_msg(progname, "unable to open unknown \"%s\"\n", obj_name);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
- return FAIL;
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
+ d_status = EXIT_FAILURE;
+ return FAIL;
}
if ((attr_id = H5Aopen_name(oid, attr_name)) >= 0) {
- type = H5Aget_type(attr_id);
- space = H5Aget_space(attr_id);
- dump_datatype(type);
- dump_dataspace(space);
-
- if (display_oid)
- dump_oid(attr_id);
-
- if (display_data || display_attr_data)
- dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai);
-
- H5Tclose(type);
- H5Sclose(space);
- H5Aclose(attr_id);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
+ dump_datatype(type);
+ dump_dataspace(space);
+
+ if (display_oid)
+ dump_oid(attr_id);
+
+ if (display_data || display_attr_data)
+ dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai);
+
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Aclose(attr_id);
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
} else {
- indentation(COL);
+ indentation(COL);
error_msg(progname, "unable to open attribute \"%s\"\n", obj_name);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
+ end_obj(dump_header_format->attributeend,
+ dump_header_format->attributeblockend);
+ d_status = EXIT_FAILURE;
}
switch (statbuf.type) {
case H5G_GROUP:
- if (H5Gclose(oid) < 0) {
- d_status = EXIT_FAILURE;
- return FAIL;
- }
- break;
+ if (H5Gclose(oid) < 0) {
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ }
+ break;
case H5G_DATASET:
- if (H5Dclose(oid) < 0) {
- d_status = EXIT_FAILURE;
- return FAIL;
- }
- break;
+ if (H5Dclose(oid) < 0) {
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ }
+ break;
case H5G_TYPE:
- if (H5Tclose(oid) < 0) {
- d_status = EXIT_FAILURE;
- return FAIL;
- }
- break;
+ if (H5Tclose(oid) < 0) {
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ }
+ break;
default:
- d_status = EXIT_FAILURE;
- return FAIL;
+ d_status = EXIT_FAILURE;
+ return FAIL;
}
free(obj_name);
@@ -1871,7 +1871,7 @@ dump_group(hid_t gid, const char *name)
HDstrcpy(tmp, prefix);
indentation(indent);
begin_obj(dump_header_format->groupbegin, name,
- dump_header_format->groupblockbegin);
+ dump_header_format->groupblockbegin);
indent += COL;
if (display_oid)
@@ -1882,16 +1882,16 @@ dump_group(hid_t gid, const char *name)
if (!HDstrcmp(name, "/") && unamedtype) {
unsigned u; /* Local index variable */
- /* dump unamed type in root group */
- for (u = 0; u < type_table->nobjs; u++)
- if (!type_table->objs[u].recorded) {
- dset = H5Dopen(gid, type_table->objs[u].objname);
- type = H5Dget_type(dset);
- sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ /* dump unamed type in root group */
+ for (u = 0; u < type_table->nobjs; u++)
+ if (!type_table->objs[u].recorded) {
+ dset = H5Dopen(gid, type_table->objs[u].objname);
+ type = H5Dget_type(dset);
+ sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
- H5Tclose(type);
- H5Dclose(dset);
- }
+ H5Tclose(type);
+ H5Dclose(dset);
+ }
} /* end if */
H5Gget_objinfo(gid, ".", TRUE, &statbuf);
@@ -1902,22 +1902,22 @@ dump_group(hid_t gid, const char *name)
found_obj = search_obj(group_table, objno);
- if (found_obj == NULL) {
- indentation(indent);
+ if (found_obj == NULL) {
+ indentation(indent);
error_msg(progname, "internal error (file %s:line %d)\n",
__FILE__, __LINE__);
- d_status = EXIT_FAILURE;
- } else if (found_obj->displayed) {
- indentation(indent);
- printf("%s \"%s\"\n", HARDLINK, found_obj->objname);
- } else {
- found_obj->displayed = TRUE;
- H5Aiterate(gid, NULL, dump_attr, NULL);
- H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
- }
+ d_status = EXIT_FAILURE;
+ } else if (found_obj->displayed) {
+ indentation(indent);
+ printf("%s \"%s\"\n", HARDLINK, found_obj->objname);
+ } else {
+ found_obj->displayed = TRUE;
+ H5Aiterate(gid, NULL, dump_attr, NULL);
+ H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
+ }
} else {
- H5Aiterate(gid, NULL, dump_attr, NULL);
- H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
+ H5Aiterate(gid, NULL, dump_attr, NULL);
+ H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
}
indent -= COL;
@@ -1946,7 +1946,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
indentation(indent);
begin_obj(dump_header_format->datasetbegin, name,
- dump_header_format->datasetblockbegin);
+ dump_header_format->datasetblockbegin);
type = H5Dget_type(did);
space = H5Dget_space(did);
dcpl_id = H5Dget_create_plist(did);
@@ -1962,7 +1962,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
dump_dcpl(dcpl_id, type, did);
if (display_data)
- switch (H5Tget_class(type)) {
+ switch (H5Tget_class(type)) {
case H5T_TIME:
indentation(indent + COL);
printf("DATA{ not yet implemented.}\n");
@@ -1983,7 +1983,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
default:
break;
- }
+ }
indent += COL;
H5Aiterate(did, NULL, dump_attr, NULL);
@@ -1993,7 +1993,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
H5Pclose(dcpl_id);
indentation(indent);
end_obj(dump_header_format->datasetend,
- dump_header_format->datasetblockend);
+ dump_header_format->datasetblockend);
}
/*-------------------------------------------------------------------------
@@ -2094,8 +2094,8 @@ dump_subsetting_header(struct subset_t *sset, int dims)
* Programmer: Ruey-Hsia Li
*
* Modifications: pvn, print the matrix indices
- * Albert Cheng, 2004/11/18
- * Add --string printing for attributes too.
+ * Albert Cheng, 2004/11/18
+ * Add --string printing for attributes too.
*
*-------------------------------------------------------------------------
*/
@@ -2110,7 +2110,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
int ndims, i;
hsize_t size[64], nelmts = 1, alloc_size;
int depth;
- int stdindent = COL; /* should be 3 */
+ int stdindent = COL; /* should be 3 */
outputformat->line_ncols = nCols;
outputformat->do_escape=display_escape;
@@ -2145,7 +2145,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
indentation(indent);
begin_obj(dump_header_format->databegin, (const char *)NULL,
- dump_header_format->datablockbegin);
+ dump_header_format->datablockbegin);
/* Print all the values. */
if (obj_data == DATASET_DATA) {
@@ -2181,7 +2181,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
}
- status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth);
+ status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth);
H5Tclose(f_type);
} else {
/* need to call h5tools_dump_mem for the attribute data */
@@ -2190,8 +2190,8 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) {
status = SUCCEED;
} else {
- char string_prefix[64];
- h5tool_format_t string_dataformat;
+ char string_prefix[64];
+ h5tool_format_t string_dataformat;
type = H5Aget_type(obj_id);
p_type = h5tools_get_native_type(type);
@@ -2208,32 +2208,32 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
assert(buf);
if (H5Aread(obj_id, p_type, buf) >= 0)
- if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
- /*
- * Print 1-byte integer data as an ASCII character string
- * instead of integers if the `-r' or `--string' command-line
- * option was given.
- *
- * We don't want to modify the global dataformat, so make a
- * copy of it instead.
- */
- string_dataformat = *outputformat;
- string_dataformat.idx_fmt = " ";
- string_dataformat.line_multi_new = 1;
- string_dataformat.line_1st = " %s\"";
- string_dataformat.line_pre = " %s";
- string_dataformat.line_cont = " %s";
- string_dataformat.str_repeat = 8;
- string_dataformat.ascii = TRUE;
- string_dataformat.elmt_suf1 = "";
- string_dataformat.elmt_suf2 = "";
- string_dataformat.line_indent = "";
- strcpy(string_prefix, string_dataformat.line_pre);
- strcat(string_prefix, "\"");
- string_dataformat.line_pre = string_prefix;
- string_dataformat.line_suf = "\"";
- outputformat = &string_dataformat;
- }
+ if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
+ /*
+ * Print 1-byte integer data as an ASCII character string
+ * instead of integers if the `-r' or `--string' command-line
+ * option was given.
+ *
+ * We don't want to modify the global dataformat, so make a
+ * copy of it instead.
+ */
+ string_dataformat = *outputformat;
+ string_dataformat.idx_fmt = " ";
+ string_dataformat.line_multi_new = 1;
+ string_dataformat.line_1st = " %s\"";
+ string_dataformat.line_pre = " %s";
+ string_dataformat.line_cont = " %s";
+ string_dataformat.str_repeat = 8;
+ string_dataformat.ascii = TRUE;
+ string_dataformat.elmt_suf1 = "";
+ string_dataformat.elmt_suf2 = "";
+ string_dataformat.line_indent = "";
+ strcpy(string_prefix, string_dataformat.line_pre);
+ strcat(string_prefix, "\"");
+ string_dataformat.line_pre = string_prefix;
+ string_dataformat.line_suf = "\"";
+ outputformat = &string_dataformat;
+ }
status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type,
space, buf, depth);
@@ -2327,7 +2327,7 @@ static void dump_comment(hid_t obj_id)
static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id)
{
- h5tools_context_t ctx; /*print context */
+ h5tools_context_t ctx; /*print context */
size_t size;
void *buf=NULL;
hsize_t nelmts=1;
@@ -2377,9 +2377,9 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
unsigned szip_pixels_per_block;
hsize_t chsize[64]; /* chunk size in elements */
int rank; /* rank */
- char name[256]; /* external file name */
- off_t offset; /* offset of external file */
- hsize_t size; /* size of external file */
+ char name[256]; /* external file name */
+ off_t offset; /* offset of external file */
+ hsize_t size; /* size of external file */
H5D_fill_value_t fvstatus;
H5D_alloc_time_t at;
H5D_fill_time_t ft;
@@ -2683,7 +2683,7 @@ static void
dump_fcpl(hid_t fid)
{
hid_t fcpl; /* file creation property list ID */
- hid_t fapl; /* file access property list ID */
+ hid_t fapl; /* file access property list ID */
hsize_t userblock; /* userblock size retrieved from FCPL */
size_t off_size; /* size of offsets in the file */
size_t len_size; /* size of lengths in the file */
@@ -2756,7 +2756,7 @@ dump_fcpl(hid_t fid)
HDstrcpy(dname,"Unknown driver");
/* Take out this because the driver used can be different from the
- * standard output. */
+ * standard output. */
/*indentation(indent + COL);
printf("%s %s\n","FILE_DRIVER", dname);*/
indentation(indent + COL);
@@ -2813,10 +2813,10 @@ static void dump_fcontents(hid_t fid)
* Function: set_output_file
*
* Purpose: Open fname as the output file for dataset raw data.
- * Set rawdatastream as its file stream.
+ * Set rawdatastream as its file stream.
*
* Return: 0 -- succeeded
- * negative -- failed
+ * negative -- failed
*
* Programmer: Albert Cheng, 2000/09/30
*
@@ -2828,7 +2828,7 @@ static void dump_fcontents(hid_t fid)
static int
set_output_file(const char *fname, int is_bin)
{
- FILE *f; /* temporary holding place for the stream pointer
+ FILE *f; /* temporary holding place for the stream pointer
* so that rawdatastream is changed only when succeeded */
if (rawdatastream && rawdatastream != stdout) {
@@ -2860,13 +2860,13 @@ set_output_file(const char *fname, int is_bin)
/*-------------------------------------------------------------------------
- * Function: set_binary_form
+ * Function: set_binary_form
*
- * Purpose:
+ * Purpose:
*
- * Return:
+ * Return:
*
- * Programmer: Pedro Vicente Nunes
+ * Programmer: Pedro Vicente Nunes
* June 28, 2006
*
* Modifications:
@@ -3556,15 +3556,15 @@ parse_start:
case 'X':
/* specify XML namespace (default="hdf5:"), or none */
/* To Do: check format of this value? */
- if (!useschema) {
+ if (!useschema) {
usage(progname);
leave(EXIT_FAILURE);
- }
- if (strcmp(opt_arg,":") == 0) {
+ }
+ if (strcmp(opt_arg,":") == 0) {
xmlnsprefix = "";
- } else {
+ } else {
xmlnsprefix = opt_arg;
- }
+ }
break;
/** end XML parameters **/
@@ -3740,27 +3740,27 @@ main(int argc, const char *argv[])
/* Check for conflicting options */
if (doxml) {
- if (!display_all) {
+ if (!display_all) {
error_msg(progname, "option \"%s\" not available for XML\n",
- "to display selected objects");
- leave(EXIT_FAILURE);
- } else if (display_bb) {
+ "to display selected objects");
+ leave(EXIT_FAILURE);
+ } else if (display_bb) {
error_msg(progname, "option \"%s\" not available for XML\n",
- "--boot-block");
- leave(EXIT_FAILURE);
- } else if (display_oid == 1) {
+ "--boot-block");
+ leave(EXIT_FAILURE);
+ } else if (display_oid == 1) {
error_msg(progname, "option \"%s\" not available for XML\n",
- "--object-ids");
- leave(EXIT_FAILURE);
+ "--object-ids");
+ leave(EXIT_FAILURE);
} else if (display_char == TRUE) {
error_msg(progname, "option \"%s\" not available for XML\n",
- "--string");
- leave(EXIT_FAILURE);
- } else if (usingdasho) {
+ "--string");
+ leave(EXIT_FAILURE);
+ } else if (usingdasho) {
error_msg(progname, "option \"%s\" not available for XML\n",
- "--output");
- leave(EXIT_FAILURE);
- }
+ "--output");
+ leave(EXIT_FAILURE);
+ }
} else {
if (xml_dtd_uri) {
warn_msg(progname, "option \"%s\" only applies with XML: %s\n",
@@ -3790,25 +3790,25 @@ main(int argc, const char *argv[])
H5Giterate(fid, (const char *)"/", NULL, fill_ref_path_table, (void *)"");
if (doxml) {
- /* initialize XML */
-
- /* reset prefix! */
- HDstrcpy(prefix, "");
-
- /* make sure the URI is initialized to something */
- if (xml_dtd_uri == NULL) {
- if (useschema) {
- xml_dtd_uri = DEFAULT_XSD;
- } else {
- xml_dtd_uri = DEFAULT_DTD;
- xmlnsprefix = "";
- }
- } else {
- if (useschema && strcmp(xmlnsprefix,"")) {
+ /* initialize XML */
+
+ /* reset prefix! */
+ HDstrcpy(prefix, "");
+
+ /* make sure the URI is initialized to something */
+ if (xml_dtd_uri == NULL) {
+ if (useschema) {
+ xml_dtd_uri = DEFAULT_XSD;
+ } else {
+ xml_dtd_uri = DEFAULT_DTD;
+ xmlnsprefix = "";
+ }
+ } else {
+ if (useschema && strcmp(xmlnsprefix,"")) {
error_msg(progname, "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
- leave(EXIT_FAILURE);
- }
- }
+ leave(EXIT_FAILURE);
+ }
+ }
}
/* find all shared objects */
@@ -3832,12 +3832,12 @@ main(int argc, const char *argv[])
/* start to dump - display file header information */
if (!doxml) {
- begin_obj(dump_header_format->filebegin, fname,
- dump_header_format->fileblockbegin);
+ begin_obj(dump_header_format->filebegin, fname,
+ dump_header_format->fileblockbegin);
} else {
- printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- /* alternative first element, depending on schema or DTD. */
+ /* alternative first element, depending on schema or DTD. */
if (useschema) {
if (strcmp(xmlnsprefix,"") == 0) {
printf("<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n",
@@ -3856,11 +3856,11 @@ main(int argc, const char *argv[])
"xsi:schemaLocation=\"http://hdfgroup.org/DTDs/HDF5File "
"http://hdfgroup.org/DTDs/HDF5-File.xsd\">\n",xmlnsprefix,ns);
}
- } else {
+ } else {
printf("<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n",
xml_dtd_uri);
printf("<HDF5-File>\n");
- }
+ }
}
if (!doxml) {
@@ -3879,7 +3879,7 @@ main(int argc, const char *argv[])
error_msg(progname, "unable to open root group\n");
d_status = EXIT_FAILURE;
} else {
- dump_function_table->dump_group_function(gid, "/");
+ dump_function_table->dump_group_function(gid, "/");
}
if (H5Gclose(gid) < 0) {
@@ -3887,13 +3887,13 @@ main(int argc, const char *argv[])
d_status = EXIT_FAILURE;
}
} else {
- if (doxml) {
- /* Note: this option is not supported for XML */
+ if (doxml) {
+ /* Note: this option is not supported for XML */
error_msg(progname, "internal error (file %s:line %d)\n",
__FILE__, __LINE__);
d_status = EXIT_FAILURE;
- goto done;
- }
+ goto done;
+ }
for (i = 0; i < argc; i++)
if (hand[i].func)
@@ -3901,15 +3901,15 @@ main(int argc, const char *argv[])
}
if (!doxml) {
- end_obj(dump_header_format->fileend,
- dump_header_format->fileblockend);
+ end_obj(dump_header_format->fileend,
+ dump_header_format->fileblockend);
} else {
- printf("</%sHDF5-File>\n", xmlnsprefix);
+ printf("</%sHDF5-File>\n", xmlnsprefix);
}
done:
if (H5Fclose(fid) < 0)
- d_status = EXIT_FAILURE;
+ d_status = EXIT_FAILURE;
free_handler(hand, argc);
@@ -3968,15 +3968,15 @@ print_enum(hid_t type)
* 3. raw format
*/
if (H5Tget_size(type) <= sizeof(long_long)) {
- dst_size = sizeof(long_long);
+ dst_size = sizeof(long_long);
- if (H5T_SGN_NONE == H5Tget_sign(type)) {
- native = H5T_NATIVE_ULLONG;
- } else {
- native = H5T_NATIVE_LLONG;
- }
+ if (H5T_SGN_NONE == H5Tget_sign(type)) {
+ native = H5T_NATIVE_ULLONG;
} else {
- dst_size = H5Tget_size(type);
+ native = H5T_NATIVE_LLONG;
+ }
+ } else {
+ dst_size = H5Tget_size(type);
}
/* Get the names and raw values of all members */
@@ -3984,8 +3984,8 @@ print_enum(hid_t type)
value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
- name[i] = H5Tget_member_name(type, i);
- H5Tget_member_value(type, i, value + i * H5Tget_size(type));
+ name[i] = H5Tget_member_name(type, i);
+ H5Tget_member_value(type, i, value + i * H5Tget_size(type));
}
/* Convert values to native data type */
@@ -3999,44 +3999,44 @@ print_enum(hid_t type)
/* Print members */
for (i = 0; i < nmembs; i++) {
- indentation(indent + COL);
- nchars = printf("\"%s\"", name[i]);
- printf("%*s ", MAX(0, 16 - nchars), "");
+ indentation(indent + COL);
+ nchars = printf("\"%s\"", name[i]);
+ printf("%*s ", MAX(0, 16 - nchars), "");
- if (native < 0) {
+ if (native < 0) {
size_t j;
- printf("0x");
-
- for (j = 0; j < dst_size; j++)
- printf("%02x", value[i * dst_size + j]);
- } else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value+i*dst_size;
- HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long_long *)
- ((void *)copy)));
- } else {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value+i*dst_size;
- HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d",
- *((long_long *) ((void *)copy)));
- }
-
- printf(";\n");
+ printf("0x");
+
+ for (j = 0; j < dst_size; j++)
+ printf("%02x", value[i * dst_size + j]);
+ } else if (H5T_SGN_NONE == H5Tget_sign(native)) {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value+i*dst_size;
+ HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long_long *)
+ ((void *)copy)));
+ } else {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value+i*dst_size;
+ HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d",
+ *((long_long *) ((void *)copy)));
+ }
+
+ printf(";\n");
}
/* Release resources */
for (i = 0; i < nmembs; i++)
- free(name[i]);
+ free(name[i]);
free(name);
free(value);
H5Tclose(super);
if (0 == nmembs)
- printf("\n%*s <empty>", indent + 4, "");
+ printf("\n%*s <empty>", indent + 4, "");
}
@@ -4115,30 +4115,30 @@ xml_escape_the_name(const char *str)
char *rcp;
if (!str)
- return NULL;
+ return NULL;
cp = str;
len = strlen(str);
extra = 0;
for (i = 0; i < len; i++) {
- if (*cp == '\"') {
- extra += (strlen(quote) - 1);
- } else if (*cp == '\'') {
- extra += (strlen(apos) - 1);
- } else if (*cp == '<') {
- extra += (strlen(lt) - 1);
- } else if (*cp == '>') {
- extra += (strlen(gt) - 1);
- } else if (*cp == '&') {
- extra += (strlen(amp) - 1);
- }
-
- cp++;
+ if (*cp == '\"') {
+ extra += (strlen(quote) - 1);
+ } else if (*cp == '\'') {
+ extra += (strlen(apos) - 1);
+ } else if (*cp == '<') {
+ extra += (strlen(lt) - 1);
+ } else if (*cp == '>') {
+ extra += (strlen(gt) - 1);
+ } else if (*cp == '&') {
+ extra += (strlen(amp) - 1);
+ }
+
+ cp++;
}
if (extra == 0)
- return HDstrdup(str);
+ return HDstrdup(str);
cp = str;
rcp = ncp = HDmalloc(len + extra + 1);
@@ -4201,66 +4201,66 @@ xml_escape_the_string(const char *str, int slen)
char *rcp;
if (!str)
- return NULL;
+ return NULL;
cp = str;
if (slen < 0)
- len = strlen(str);
+ len = strlen(str);
else
- len = slen;
+ len = slen;
extra = 0;
for (i = 0; i < len; i++) {
- if (*cp == '\\') {
- extra++;
- } else if (*cp == '\"') {
- extra++;
- } else if (*cp == '\'') {
- extra += (strlen(apos) - 1);
- } else if (*cp == '<') {
- extra += (strlen(lt) - 1);
- } else if (*cp == '>') {
- extra += (strlen(gt) - 1);
- } else if (*cp == '&') {
- extra += (strlen(amp) - 1);
- }
- cp++;
+ if (*cp == '\\') {
+ extra++;
+ } else if (*cp == '\"') {
+ extra++;
+ } else if (*cp == '\'') {
+ extra += (strlen(apos) - 1);
+ } else if (*cp == '<') {
+ extra += (strlen(lt) - 1);
+ } else if (*cp == '>') {
+ extra += (strlen(gt) - 1);
+ } else if (*cp == '&') {
+ extra += (strlen(amp) - 1);
+ }
+ cp++;
}
cp = str;
rcp = ncp = calloc((len + extra + 1), sizeof(char));
if (ncp == NULL)
- return NULL; /* ?? */
+ return NULL; /* ?? */
for (i = 0; i < len; i++) {
- if (*cp == '\\') {
- *ncp++ = '\\';
- *ncp++ = *cp++;
- } else if (*cp == '\"') {
- *ncp++ = '\\';
- *ncp++ = *cp++;
- } else if (*cp == '\'') {
- strncpy(ncp, apos, strlen(apos));
- ncp += strlen(apos);
- cp++;
- } else if (*cp == '<') {
- strncpy(ncp, lt, strlen(lt));
- ncp += strlen(lt);
- cp++;
- } else if (*cp == '>') {
- strncpy(ncp, gt, strlen(gt));
- ncp += strlen(gt);
- cp++;
- } else if (*cp == '&') {
- strncpy(ncp, amp, strlen(amp));
- ncp += strlen(amp);
- cp++;
- } else {
- *ncp++ = *cp++;
- }
+ if (*cp == '\\') {
+ *ncp++ = '\\';
+ *ncp++ = *cp++;
+ } else if (*cp == '\"') {
+ *ncp++ = '\\';
+ *ncp++ = *cp++;
+ } else if (*cp == '\'') {
+ strncpy(ncp, apos, strlen(apos));
+ ncp += strlen(apos);
+ cp++;
+ } else if (*cp == '<') {
+ strncpy(ncp, lt, strlen(lt));
+ ncp += strlen(lt);
+ cp++;
+ } else if (*cp == '>') {
+ strncpy(ncp, gt, strlen(gt));
+ ncp += strlen(gt);
+ cp++;
+ } else if (*cp == '&') {
+ strncpy(ncp, amp, strlen(amp));
+ ncp += strlen(amp);
+ cp++;
+ } else {
+ *ncp++ = *cp++;
+ }
}
*ncp = '\0';
@@ -4406,8 +4406,8 @@ xml_print_datatype(hid_t type, unsigned in_group)
printf("BE");
break;
case H5T_ORDER_VAX:
- printf("VAX");
- break;
+ printf("VAX");
+ break;
default:
printf("ERROR_UNKNOWN");
}
@@ -4677,38 +4677,38 @@ xml_dump_datatype(hid_t type)
haddr_t objno; /* Compact form of object's location */
obj_t *found_obj; /* Found object */
- /* Data type is a shared or named data type */
- H5Gget_objinfo(type, ".", TRUE, &statbuf);
+ /* Data type is a shared or named data type */
+ H5Gget_objinfo(type, ".", TRUE, &statbuf);
objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- found_obj = search_obj(type_table, objno);
-
- if (found_obj) {
- /* Shared data type, must be entered as an object */
- /* These 2 cases are the same now, but may change */
- char * dtxid = malloc(100);
- xml_name_to_XID(found_obj->objname,dtxid,100,1);
- if (!found_obj->recorded) {
- /* anonymous stored data type:
- following the dumper's current
- practice:
- use it's object ref as its name
- */
- printf("<%sNamedDataTypePtr OBJ-XID=\"%s\"/>\n",
- xmlnsprefix, dtxid);
-
- } else {
- /* pointer to a named data type already in XML */
+ found_obj = search_obj(type_table, objno);
+
+ if (found_obj) {
+ /* Shared data type, must be entered as an object */
+ /* These 2 cases are the same now, but may change */
+ char * dtxid = malloc(100);
+ xml_name_to_XID(found_obj->objname,dtxid,100,1);
+ if (!found_obj->recorded) {
+ /* anonymous stored data type:
+ following the dumper's current
+ practice:
+ use it's object ref as its name
+ */
+ printf("<%sNamedDataTypePtr OBJ-XID=\"%s\"/>\n",
+ xmlnsprefix, dtxid);
+
+ } else {
+ /* pointer to a named data type already in XML */
char *t_objname = xml_escape_the_name(found_obj->objname);
- printf("<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />\n",
- xmlnsprefix, dtxid,t_objname);
- free(t_objname);
- }
- free(dtxid);
- } else {
- printf("<!-- h5dump error: unknown committed type. -->\n");
- }
- indent -= COL;
- return;
+ printf("<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />\n",
+ xmlnsprefix, dtxid,t_objname);
+ free(t_objname);
+ }
+ free(dtxid);
+ } else {
+ printf("<!-- h5dump error: unknown committed type. -->\n");
+ }
+ indent -= COL;
+ return;
}
printf("<%sDataType>\n",xmlnsprefix);
indent += COL;
@@ -4738,7 +4738,7 @@ xml_dump_dataspace(hid_t space)
hsize_t size[H5DUMP_MAX_RANK];
hsize_t maxsize[H5DUMP_MAX_RANK];
int ndims =
- H5Sget_simple_extent_dims(space, size, maxsize);
+ H5Sget_simple_extent_dims(space, size, maxsize);
H5S_class_t space_type = H5Sget_simple_extent_type(space);
int i;
@@ -4748,47 +4748,47 @@ xml_dump_dataspace(hid_t space)
switch (space_type) {
case H5S_SCALAR:
- /* scalar dataspace (just a tag, no XML attrs. defined */
- printf("<%sScalarDataspace />\n",xmlnsprefix);
+ /* scalar dataspace (just a tag, no XML attrs. defined */
+ printf("<%sScalarDataspace />\n",xmlnsprefix);
break;
case H5S_SIMPLE:
- /* simple dataspace */
- /* <hdf5:SimpleDataspace Ndims="nd"> */
- printf("<%sSimpleDataspace Ndims=\"%d\">\n",xmlnsprefix, ndims);
-
- /* print the <hdf5:Dimension> elements */
- for (i = 0; i < ndims; i++) {
- indentation(indent + COL + COL + COL);
- if (maxsize[i] == H5S_UNLIMITED) {
- HDfprintf(stdout,
- "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"UNLIMITED\"/>\n",
- xmlnsprefix,size[i]);
- } else if (maxsize[i] == (hsize_t) 0) {
- HDfprintf(stdout,
- "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n",
- xmlnsprefix,size[i], size[i]);
- } else {
- HDfprintf(stdout,
- "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n",
- xmlnsprefix, size[i], maxsize[i]);
- }
- }
- indentation(indent + COL + COL);
- printf("</%sSimpleDataspace>\n", xmlnsprefix );
+ /* simple dataspace */
+ /* <hdf5:SimpleDataspace Ndims="nd"> */
+ printf("<%sSimpleDataspace Ndims=\"%d\">\n",xmlnsprefix, ndims);
+
+ /* print the <hdf5:Dimension> elements */
+ for (i = 0; i < ndims; i++) {
+ indentation(indent + COL + COL + COL);
+ if (maxsize[i] == H5S_UNLIMITED) {
+ HDfprintf(stdout,
+ "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"UNLIMITED\"/>\n",
+ xmlnsprefix,size[i]);
+ } else if (maxsize[i] == (hsize_t) 0) {
+ HDfprintf(stdout,
+ "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n",
+ xmlnsprefix,size[i], size[i]);
+ } else {
+ HDfprintf(stdout,
+ "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n",
+ xmlnsprefix, size[i], maxsize[i]);
+ }
+ }
+ indentation(indent + COL + COL);
+ printf("</%sSimpleDataspace>\n", xmlnsprefix );
break;
#ifdef TMP
/* Commented out: wait until the schema is updated first */
case H5S_NULL:
- /* null dataspace (just a tag, no XML attrs. defined */
- printf("<%sNullDataspace />\n",xmlnsprefix);
+ /* null dataspace (just a tag, no XML attrs. defined */
+ printf("<%sNullDataspace />\n",xmlnsprefix);
break;
#endif /* TMP */
case H5S_NO_CLASS:
default:
- printf("<!-- unknown dataspace -->\n");
+ printf("<!-- unknown dataspace -->\n");
}
indentation(indent + COL);
@@ -4820,7 +4820,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU
int ndims, i;
hsize_t size[64], nelmts = 1;
int depth;
- int stdindent = COL; /* should be 3 */
+ int stdindent = COL; /* should be 3 */
outputformat->line_ncols = nCols;
indent += COL;
@@ -4839,60 +4839,60 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU
indentation(indent + COL);
printf("<%sDataFromFile>\n",xmlnsprefix);
if (obj_data == DATASET_DATA) {
- type = H5Dget_type(obj_id);
- if (H5Tget_class(type) == H5T_REFERENCE) {
- status = xml_print_refs(obj_id, DATASET_DATA);
- } else if (H5Tget_class(type) == H5T_STRING) {
- status = xml_print_strs(obj_id, DATASET_DATA);
- } else {
- status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, NULL, depth);
- }
+ type = H5Dget_type(obj_id);
+ if (H5Tget_class(type) == H5T_REFERENCE) {
+ status = xml_print_refs(obj_id, DATASET_DATA);
+ } else if (H5Tget_class(type) == H5T_STRING) {
+ status = xml_print_strs(obj_id, DATASET_DATA);
+ } else {
+ status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, NULL, depth);
+ }
+ } else {
+ /* Attribute data */
+ type = H5Aget_type(obj_id);
+
+ if (H5Tget_class(type) == H5T_REFERENCE) {
+ /* references are done differently than
+ the standard output:
+ XML dumps a path to the object
+ referenced.
+ */
+ status = xml_print_refs(obj_id, ATTRIBUTE_DATA);
+ H5Tclose(type);
+ } else if (H5Tget_class(type) == H5T_STRING) {
+ status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
} else {
- /* Attribute data */
- type = H5Aget_type(obj_id);
-
- if (H5Tget_class(type) == H5T_REFERENCE) {
- /* references are done differently than
- the standard output:
- XML dumps a path to the object
- referenced.
- */
- status = xml_print_refs(obj_id, ATTRIBUTE_DATA);
- H5Tclose(type);
- } else if (H5Tget_class(type) == H5T_STRING) {
- status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
- } else {
- /* all other data */
+ /* all other data */
p_type = h5tools_get_native_type(type);
- H5Tclose(type);
+ H5Tclose(type);
- space = H5Aget_space(obj_id);
+ space = H5Aget_space(obj_id);
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
- for (i = 0; i < ndims; i++)
- nelmts *= size[i];
+ for (i = 0; i < ndims; i++)
+ nelmts *= size[i];
- buf =
- malloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
- assert(buf);
+ buf =
+ malloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
+ assert(buf);
- if (H5Aread(obj_id, p_type, buf) >= 0)
+ if (H5Aread(obj_id, p_type, buf) >= 0)
status = h5tools_dump_mem(stdout, outputformat, obj_id,
p_type, space, buf, depth);
- free(buf);
- H5Tclose(p_type);
- H5Sclose(space);
- H5Tclose(type);
- }
+ free(buf);
+ H5Tclose(p_type);
+ H5Sclose(space);
+ H5Tclose(type);
+ }
}
if (status == FAIL) {
- indentation(indent + COL);
- printf("Unable to print data.\n");
- status = 1;
+ indentation(indent + COL);
+ printf("Unable to print data.\n");
+ status = 1;
}
indentation(indent + COL);
@@ -4927,104 +4927,104 @@ xml_dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data)
free(t_aname);
if ((attr_id = H5Aopen_name(attr, attr_name)) >= 0) {
- type = H5Aget_type(attr_id);
- space = H5Aget_space(attr_id);
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
space_type = H5Sget_simple_extent_type(space);
- dump_function_table->dump_dataspace_function(space);
- dump_function_table->dump_datatype_function(type);
-
- if (display_attr_data && space_type!=H5S_NULL) {
- switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
-
- case H5T_TIME:
- indent += COL;
- indentation(indent);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent);
- printf("<!-- Time data not yet implemented. -->\n");
- indentation(indent);
- printf("<%sNoData/>\n",xmlnsprefix);
- indentation(indent);
- printf("<hdf5:Data>\n");
- printf("</%sData>\n",xmlnsprefix);
- indent -= COL;
- break;
-
- case H5T_COMPOUND:
- indentation(indent);
- printf("<!-- Note: format of compound data not specified -->\n");
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
-
- case H5T_REFERENCE:
- indentation(indent);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent);
+ dump_function_table->dump_dataspace_function(space);
+ dump_function_table->dump_datatype_function(type);
+
+ if (display_attr_data && space_type!=H5S_NULL) {
+ switch (H5Tget_class(type)) {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+
+ case H5T_TIME:
+ indent += COL;
+ indentation(indent);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent);
+ printf("<!-- Time data not yet implemented. -->\n");
+ indentation(indent);
+ printf("<%sNoData/>\n",xmlnsprefix);
+ indentation(indent);
+ printf("<hdf5:Data>\n");
+ printf("</%sData>\n",xmlnsprefix);
+ indent -= COL;
+ break;
+
+ case H5T_COMPOUND:
+ indentation(indent);
+ printf("<!-- Note: format of compound data not specified -->\n");
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+
+ case H5T_REFERENCE:
+ indentation(indent);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent);
if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
printf("<!-- Note: Region references not supported -->\n");
indentation(indent);
printf("<%sNoData />\n",xmlnsprefix);
} else {
- printf("<%sDataFromFile>\n",xmlnsprefix);
- xml_print_refs(attr_id, ATTRIBUTE_DATA);
- indentation(indent);
- printf("</%sDataFromFile>\n",xmlnsprefix);
+ printf("<%sDataFromFile>\n",xmlnsprefix);
+ xml_print_refs(attr_id, ATTRIBUTE_DATA);
+ indentation(indent);
+ printf("</%sDataFromFile>\n",xmlnsprefix);
}
- indentation(indent);
- printf("</%sData>\n",xmlnsprefix);
- break;
-
- case H5T_VLEN:
- printf("<!-- Note: format of VL data not specified -->\n");
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
- default:
- indentation(indent);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent);
- printf("<!-- Unknown datatype: %d -->\n", H5Tget_class(type));
- indentation(indent);
- printf("<%sNoData/>\n",xmlnsprefix);
- indentation(indent);
- printf("</%sData>\n",xmlnsprefix);
- break;
- }
- } else {
- /* The case of an attribute never yet written ??
+ indentation(indent);
+ printf("</%sData>\n",xmlnsprefix);
+ break;
+
+ case H5T_VLEN:
+ printf("<!-- Note: format of VL data not specified -->\n");
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+ default:
+ indentation(indent);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent);
+ printf("<!-- Unknown datatype: %d -->\n", H5Tget_class(type));
+ indentation(indent);
+ printf("<%sNoData/>\n",xmlnsprefix);
+ indentation(indent);
+ printf("</%sData>\n",xmlnsprefix);
+ break;
+ }
+ } else {
+ /* The case of an attribute never yet written ??
* Or dataspace is H5S_NULL. */
- indentation(indent + COL);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent + COL + COL);
- printf("<%sNoData/>\n",xmlnsprefix);
- indentation(indent + COL);
- printf("</%sData>\n",xmlnsprefix);
- }
-
- H5Tclose(type);
- H5Sclose(space);
- H5Aclose(attr_id);
- indentation(indent);
- printf("</%sAttribute>\n", xmlnsprefix );
- return SUCCEED;
+ indentation(indent + COL);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent + COL + COL);
+ printf("<%sNoData/>\n",xmlnsprefix);
+ indentation(indent + COL);
+ printf("</%sData>\n",xmlnsprefix);
+ }
+
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Aclose(attr_id);
+ indentation(indent);
+ printf("</%sAttribute>\n", xmlnsprefix );
+ return SUCCEED;
} else {
- /* ?? failed */
- indentation(indent + COL);
- printf("<!-- h5dump error: unable to open attribute. -->\n");
- indentation(indent);
- printf("</%sAttribute>\n", xmlnsprefix );
- d_status = EXIT_FAILURE;
- return FAIL;
+ /* ?? failed */
+ indentation(indent + COL);
+ printf("<!-- h5dump error: unable to open attribute. -->\n");
+ indentation(indent);
+ printf("</%sAttribute>\n", xmlnsprefix );
+ d_status = EXIT_FAILURE;
+ return FAIL;
}
}
@@ -5065,25 +5065,25 @@ xml_dump_named_datatype(hid_t type, const char *name)
xml_name_to_XID(tmp,dtxid,100,1);
xml_name_to_XID(prefix,parentxid,100,1);
if (strncmp(name, "#", 1) == 0) {
- /* Special: this is an 'anonymous' NDT, deleted but
- still in use.
- We follow the dumper's undocumented practice, and
- use its object id as its name.
- Exactly the same as normal, but a separate case
- in the event we want to do something else in
- the future.
- */
- printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\">\n",
- xmlnsprefix,
- name, dtxid,
- parentxid,(HDstrcmp(prefix, "") ? t_prefix : "/"));
+ /* Special: this is an 'anonymous' NDT, deleted but
+ still in use.
+ We follow the dumper's undocumented practice, and
+ use its object id as its name.
+ Exactly the same as normal, but a separate case
+ in the event we want to do something else in
+ the future.
+ */
+ printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">\n",
+ xmlnsprefix,
+ name, dtxid,
+ parentxid,(HDstrcmp(prefix, "") ? t_prefix : "/"));
} else {
- printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n",
- xmlnsprefix,
- t_name, dtxid,
- t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/"));
+ printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n",
+ xmlnsprefix,
+ t_name, dtxid,
+ t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/"));
}
HDfree(dtxid);
HDfree(parentxid);
@@ -5137,21 +5137,21 @@ xml_dump_group(hid_t gid, const char *name)
char *par_name;
if (HDstrcmp(name, "/") == 0) {
- isRoot = 1;
- tmp = HDmalloc(2);
- HDstrcpy(tmp, "/");
+ isRoot = 1;
+ tmp = HDmalloc(2);
+ HDstrcpy(tmp, "/");
} else {
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
- HDstrcpy(tmp, prefix);
- par = HDstrdup(tmp);
- cp = HDstrrchr(par, '/');
- if (cp != NULL) {
- if ((cp == par) && HDstrlen(par) > 1) {
- *(cp + 1) = '\0';
- } else {
- *cp = '\0';
- }
- }
+ tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
+ par = HDstrdup(tmp);
+ cp = HDstrrchr(par, '/');
+ if (cp != NULL) {
+ if ((cp == par) && HDstrlen(par) > 1) {
+ *(cp + 1) = '\0';
+ } else {
+ *cp = '\0';
+ }
+ }
}
indentation(indent);
@@ -5163,15 +5163,15 @@ xml_dump_group(hid_t gid, const char *name)
if (statbuf.nlink > 1) {
obj_t *found_obj; /* Found object */
- /* Group with more than one link to it... */
- found_obj = search_obj(group_table, objno);
+ /* Group with more than one link to it... */
+ found_obj = search_obj(group_table, objno);
- if (found_obj == NULL) {
- indentation(indent);
+ if (found_obj == NULL) {
+ indentation(indent);
error_msg(progname, "internal error (file %s:line %d)\n",
__FILE__, __LINE__);
- d_status = EXIT_FAILURE;
- } else {
+ d_status = EXIT_FAILURE;
+ } else {
char *t_name = xml_escape_the_name(name);
char *grpxid = malloc(100);
char *parentxid = malloc(100);
@@ -5267,68 +5267,68 @@ xml_dump_group(hid_t gid, const char *name)
}
} else {
- /* only link -- must be first time! */
+ /* only link -- must be first time! */
char *t_name = xml_escape_the_name(name);
- char *grpxid = malloc(100);
- char *parentxid = malloc(100);
- if (isRoot) {
- xml_name_to_XID("/",grpxid,100,1);
- printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n",
- xmlnsprefix,grpxid,"/");
- } else {
- char *t_tmp = xml_escape_the_name(tmp);
- par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp,grpxid,100,1);
- xml_name_to_XID(par,parentxid,100,1);
- printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" >\n",
- xmlnsprefix,t_name, grpxid, t_tmp,
- parentxid, par_name);
- free(t_tmp);
- free(par_name);
- }
+ char *grpxid = malloc(100);
+ char *parentxid = malloc(100);
+ if (isRoot) {
+ xml_name_to_XID("/",grpxid,100,1);
+ printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n",
+ xmlnsprefix,grpxid,"/");
+ } else {
+ char *t_tmp = xml_escape_the_name(tmp);
+ par_name = xml_escape_the_name(par);
+ xml_name_to_XID(tmp,grpxid,100,1);
+ xml_name_to_XID(par,parentxid,100,1);
+ printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >\n",
+ xmlnsprefix,t_name, grpxid, t_tmp,
+ parentxid, par_name);
+ free(t_tmp);
+ free(par_name);
+ }
free(t_name);
- free(grpxid);
- free(parentxid);
+ free(grpxid);
+ free(parentxid);
- /* 1. do all the attributes of the group */
- H5Aiterate(gid, NULL, dump_function_table->dump_attribute_function, NULL);
+ /* 1. do all the attributes of the group */
+ H5Aiterate(gid, NULL, dump_function_table->dump_attribute_function, NULL);
- if (!strcmp(name, "/") && unamedtype) {
+ if (!strcmp(name, "/") && unamedtype) {
unsigned u;
- /* Very special case: dump unamed type in root group */
- for (u = 0; u < type_table->nobjs; u++) {
- if (!type_table->objs[u].recorded) {
- dset = H5Dopen(gid, type_table->objs[u].objname);
- type = H5Dget_type(dset);
+ /* Very special case: dump unamed type in root group */
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded) {
+ dset = H5Dopen(gid, type_table->objs[u].objname);
+ type = H5Dget_type(dset);
sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
- dump_function_table->dump_named_datatype_function(type, type_name);
- H5Tclose(type);
- H5Dclose(dset);
- }
- }
- }
-
- /* iterate through all the members */
- xtype = H5G_TYPE;
- H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
- xtype = H5G_DATASET;
- H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
- xtype = H5G_GROUP;
- 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);
+ dump_function_table->dump_named_datatype_function(type, type_name);
+ H5Tclose(type);
+ H5Dclose(dset);
+ }
+ }
+ }
+
+ /* iterate through all the members */
+ xtype = H5G_TYPE;
+ H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
+ xtype = H5G_DATASET;
+ H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype);
+ xtype = H5G_GROUP;
+ 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;
indentation(indent);
if (isRoot) {
- printf("</%sRootGroup>\n",xmlnsprefix);
+ printf("</%sRootGroup>\n",xmlnsprefix);
} else {
- printf("</%sGroup>\n" ,xmlnsprefix);
+ printf("</%sGroup>\n" ,xmlnsprefix);
}
free(tmp);
}
@@ -5357,53 +5357,53 @@ xml_print_refs(hid_t did, int source)
hsize_t i;
if (source == DATASET_DATA) {
- type = H5Dget_type(did);
+ type = H5Dget_type(did);
} else if (source == ATTRIBUTE_DATA) {
- type = H5Aget_type(did);
+ type = H5Aget_type(did);
} else {
- /* return an error */
- return FAIL;
+ /* return an error */
+ return FAIL;
}
if (H5Tget_class(type) != H5T_REFERENCE) {
- /* return an error */
- return FAIL;
+ /* return an error */
+ return FAIL;
}
if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
- /* region ref not supported yet... */
- /* return an error */
- return FAIL;
+ /* region ref not supported yet... */
+ /* return an error */
+ return FAIL;
}
if (source == DATASET_DATA) {
- space = H5Dget_space(did);
- ssiz = H5Sget_simple_extent_npoints(space);
- ssiz *= H5Tget_size(type);
-
- buf = calloc((size_t)ssiz, sizeof(char));
- if (buf == NULL) {
- return FAIL;
- }
- e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- /* need to check result here */
- if (e < 0) {
- free(buf);
- return FAIL;
- }
+ space = H5Dget_space(did);
+ ssiz = H5Sget_simple_extent_npoints(space);
+ ssiz *= H5Tget_size(type);
+
+ buf = calloc((size_t)ssiz, sizeof(char));
+ if (buf == NULL) {
+ return FAIL;
+ }
+ e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ /* need to check result here */
+ if (e < 0) {
+ free(buf);
+ return FAIL;
+ }
} else if (source == ATTRIBUTE_DATA) {
- space = H5Aget_space(did);
- ssiz = H5Sget_simple_extent_npoints(space);
- ssiz *= H5Tget_size(type);
-
- buf = calloc((size_t)ssiz, sizeof(char));
- if (buf == NULL) {
- free(buf);
- return FAIL;
- }
- e = H5Aread(did, H5T_STD_REF_OBJ, buf);
- /* need to check the result here */
+ space = H5Aget_space(did);
+ ssiz = H5Sget_simple_extent_npoints(space);
+ ssiz *= H5Tget_size(type);
+
+ buf = calloc((size_t)ssiz, sizeof(char));
+ if (buf == NULL) {
+ free(buf);
+ return FAIL;
+ }
+ e = H5Aread(did, H5T_STD_REF_OBJ, buf);
+ /* need to check the result here */
} else {
- /* error */
- return FAIL;
+ /* error */
+ return FAIL;
}
refbuf = (hobj_ref_t *) buf;
@@ -5412,19 +5412,19 @@ xml_print_refs(hid_t did, int source)
for (i = 0; i < ssiz; i++) {
const char *path;
- path = lookup_ref_path(*refbuf);
- indentation(indent + COL);
+ path = lookup_ref_path(*refbuf);
+ indentation(indent + COL);
- if (!path) {
- printf("\"%s\"\n", "NULL");
- } else {
+ if (!path) {
+ printf("\"%s\"\n", "NULL");
+ } else {
char *t_path = xml_escape_the_string(path, -1);
- printf("\"%s\"\n", t_path);
+ printf("\"%s\"\n", t_path);
free(t_path);
- }
+ }
- refbuf++;
+ refbuf++;
}
free(buf);
@@ -5459,54 +5459,54 @@ xml_print_strs(hid_t did, int source)
htri_t is_vlstr;
if (source == DATASET_DATA) {
- type = H5Dget_type(did);
+ type = H5Dget_type(did);
} else if (source == ATTRIBUTE_DATA) {
- type = H5Aget_type(did);
+ type = H5Aget_type(did);
} else {
- /* return an error */
- return FAIL;
+ /* return an error */
+ return FAIL;
}
if (H5Tget_class(type) != H5T_STRING) {
- /* return an error */
- return FAIL;
+ /* return an error */
+ return FAIL;
}
is_vlstr = H5Tis_variable_str(type);
if (source == DATASET_DATA) {
- space = H5Dget_space(did);
- ssiz = H5Sget_simple_extent_npoints(space);
- ssiz *= H5Tget_size(type);
+ space = H5Dget_space(did);
+ ssiz = H5Sget_simple_extent_npoints(space);
+ ssiz *= H5Tget_size(type);
- buf = malloc((size_t)ssiz);
+ buf = malloc((size_t)ssiz);
- if (buf == NULL) {
- return FAIL;
- }
+ if (buf == NULL) {
+ return FAIL;
+ }
- e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (e < 0) {
- free(buf);
- return FAIL;
- }
+ if (e < 0) {
+ free(buf);
+ return FAIL;
+ }
} else if (source == ATTRIBUTE_DATA) {
- space = H5Aget_space(did);
- ssiz = H5Sget_simple_extent_npoints(space);
- ssiz *= H5Tget_size(type);
-
- buf = malloc((size_t)ssiz);
- if (buf == NULL) {
- return FAIL;
- }
-
- e = H5Aread(did, type, buf);
- if (e < 0) {
- free(buf);
- return FAIL;
- }
+ space = H5Aget_space(did);
+ ssiz = H5Sget_simple_extent_npoints(space);
+ ssiz *= H5Tget_size(type);
+
+ buf = malloc((size_t)ssiz);
+ if (buf == NULL) {
+ return FAIL;
+ }
+
+ e = H5Aread(did, type, buf);
+ if (e < 0) {
+ free(buf);
+ return FAIL;
+ }
} else {
- /* error */
- return FAIL;
+ /* error */
+ return FAIL;
}
/* pull out each string... */
@@ -5523,19 +5523,19 @@ xml_print_strs(hid_t did, int source)
if(onestring)
str_size = (size_t)HDstrlen(onestring);
} else {
- HDstrncpy(onestring, bp, tsiz);
+ HDstrncpy(onestring, bp, tsiz);
str_size = tsiz;
}
- indentation(indent + COL);
+ indentation(indent + COL);
- if (!onestring) {
- printf("NULL\n");
- } else {
+ if (!onestring) {
+ printf("NULL\n");
+ } else {
char *t_onestring = xml_escape_the_string(onestring, (int)str_size);
- printf("\"%s\"\n", t_onestring);
+ printf("\"%s\"\n", t_onestring);
free(t_onestring);
- }
+ }
bp += tsiz;
}
@@ -5570,51 +5570,51 @@ check_filters(hid_t dcpl)
nfilt = H5Pget_nfilters(dcpl);
if (nfilt <= 0)
- return;
+ return;
for (i = 0; i < nfilt; i++) {
#ifdef H5_WANT_H5_V1_6_COMPAT
- filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
- (size_t *) &cd_nelmts,
- cd_values, 120, namebuf);
+ filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
+ (size_t *) &cd_nelmts,
+ cd_values, 120, namebuf);
#else
- filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
- (size_t *) &cd_nelmts,
- cd_values, 120, namebuf, NULL);
+ filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
+ (size_t *) &cd_nelmts,
+ cd_values, 120, namebuf, NULL);
#endif /* H5_WANT_H5_V1_6_COMPAT */
- if (filter == H5Z_FILTER_DEFLATE) {
- indentation(indent + COL);
- printf("<%sDeflate Level=\"",xmlnsprefix);
+ if (filter == H5Z_FILTER_DEFLATE) {
+ indentation(indent + COL);
+ printf("<%sDeflate Level=\"",xmlnsprefix);
if (cd_nelmts < 1) {
- /* not sure what this means? */
- printf("6");
+ /* not sure what this means? */
+ printf("6");
} else {
- printf("%d",cd_values[0]);
+ printf("%d",cd_values[0]);
}
- printf("\"/>\n");
- } else if (filter == H5Z_FILTER_FLETCHER32) {
- indentation(indent + COL);
- printf("<%sFletcher32 />",xmlnsprefix);
- } else if (filter == H5Z_FILTER_SHUFFLE) {
- indentation(indent + COL);
- printf("<%sShuffle />",xmlnsprefix);
- } else if (filter == H5Z_FILTER_SZIP) {
-
- indentation(indent + COL);
- printf("<%sSZIP ",xmlnsprefix);
+ printf("\"/>\n");
+ } else if (filter == H5Z_FILTER_FLETCHER32) {
+ indentation(indent + COL);
+ printf("<%sFletcher32 />",xmlnsprefix);
+ } else if (filter == H5Z_FILTER_SHUFFLE) {
+ indentation(indent + COL);
+ printf("<%sShuffle />",xmlnsprefix);
+ } else if (filter == H5Z_FILTER_SZIP) {
+
+ indentation(indent + COL);
+ printf("<%sSZIP ",xmlnsprefix);
if (cd_nelmts < 2) {
- /* no pixels ? */
- printf("Pixels_per_block=\"-1\" ");
+ /* no pixels ? */
+ printf("Pixels_per_block=\"-1\" ");
} else {
- printf("Pixels_per_block=\"%d\" ",cd_values[1]);
+ printf("Pixels_per_block=\"%d\" ",cd_values[1]);
}
- /* analyse the options mask */
- if (cd_values[0] & H5_SZIP_CHIP_OPTION_MASK) {
+ /* analyse the options mask */
+ if (cd_values[0] & H5_SZIP_CHIP_OPTION_MASK) {
printf("Mode =\"Hardware\" ");
} else if (cd_values[0] & H5_SZIP_ALLOW_K13_OPTION_MASK) {
printf("Mode =\"K13\" ");
}
printf("Coding=\"");
- if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) {
+ if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) {
printf("Entropy");
} else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) {
printf("NN");
@@ -5622,20 +5622,20 @@ check_filters(hid_t dcpl)
printf("\" ");
printf("ByteOrder=\"");
- if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) {
+ if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) {
printf("LSB");
} else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) {
printf("MSB");
}
printf("\" ");
- if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) {
+ if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) {
printf("Header=\"Raw\"");
}
- printf("/>\n");
- } else {
- /* unknown option */
- }
+ printf("/>\n");
+ } else {
+ /* unknown option */
+ }
}
}
@@ -5807,7 +5807,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
xml_name_to_XID(tmp, rstr, 100, 1);
xml_name_to_XID(prefix, pstr, 100, 1);
printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n",xmlnsprefix,
- t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/");
+ t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/");
HDfree(t_name);
HDfree(t_tmp);
@@ -5822,66 +5822,66 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
/* Print information about storage layout */
if (H5D_CHUNKED == H5Pget_layout(dcpl)) {
- maxdims = H5Sget_simple_extent_ndims(space);
- chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t));
- indent += COL;
- indentation(indent);
- printf("<%sStorageLayout>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sChunkedLayout ",xmlnsprefix);
- ndims = H5Pget_chunk(dcpl, maxdims, chsize);
- printf("Ndims=\"%d\">\n", ndims);
-
- indent += COL;
-
- for (i = 0; i < ndims; i++) {
- indentation(indent);
- HDfprintf(stdout, "<%sChunkDimension DimSize=\"%Hu\" />\n",
+ maxdims = H5Sget_simple_extent_ndims(space);
+ chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t));
+ indent += COL;
+ indentation(indent);
+ printf("<%sStorageLayout>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sChunkedLayout ",xmlnsprefix);
+ ndims = H5Pget_chunk(dcpl, maxdims, chsize);
+ printf("Ndims=\"%d\">\n", ndims);
+
+ indent += COL;
+
+ for (i = 0; i < ndims; i++) {
+ indentation(indent);
+ HDfprintf(stdout, "<%sChunkDimension DimSize=\"%Hu\" />\n",
xmlnsprefix, chsize[i]);
- }
-
- indentation(indent);
- printf("<%sRequiredFilter>\n",xmlnsprefix);
- indent += COL;
- check_filters(dcpl);
- indent -= COL;
- indentation(indent);
- printf("</%sRequiredFilter>\n",xmlnsprefix);
-
- indent -= COL;
-
- indentation(indent);
- printf("</%sChunkedLayout>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sStorageLayout>\n",xmlnsprefix);
- indent -= COL;
- free(chsize);
+ }
+
+ indentation(indent);
+ printf("<%sRequiredFilter>\n",xmlnsprefix);
+ indent += COL;
+ check_filters(dcpl);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sRequiredFilter>\n",xmlnsprefix);
+
+ indent -= COL;
+
+ indentation(indent);
+ printf("</%sChunkedLayout>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sStorageLayout>\n",xmlnsprefix);
+ indent -= COL;
+ free(chsize);
} else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) {
- indent += COL;
- indentation(indent);
- printf("<%sStorageLayout>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sContiguousLayout/>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sStorageLayout>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
+ indent += COL;
+ indentation(indent);
+ printf("<%sStorageLayout>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sContiguousLayout/>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sStorageLayout>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
} else if (H5D_COMPACT == H5Pget_layout(dcpl)) {
- indent += COL;
- indentation(indent);
- printf("<%sStorageLayout>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sCompactLayout/>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sStorageLayout>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
+ indent += COL;
+ indentation(indent);
+ printf("<%sStorageLayout>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sCompactLayout/>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sStorageLayout>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
}
/* and check for external.... ?? */
@@ -5893,36 +5893,36 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
H5Pget_fill_time(dcpl, &ft);
printf("FillTime=\"");
switch ( ft ) {
- case H5D_FILL_TIME_ALLOC:
+ case H5D_FILL_TIME_ALLOC:
printf("FillOnAlloc");
- break;
- case H5D_FILL_TIME_NEVER:
+ break;
+ case H5D_FILL_TIME_NEVER:
printf("FillNever");
- break;
- case H5D_FILL_TIME_IFSET:
+ break;
+ case H5D_FILL_TIME_IFSET:
printf("FillIfSet");
- break;
- default:
+ break;
+ default:
printf("?");
- break;
+ break;
}
printf("\" ");
H5Pget_alloc_time(dcpl, &at);
printf("AllocationTime=\"");
switch ( at ) {
- case H5D_ALLOC_TIME_EARLY:
+ case H5D_ALLOC_TIME_EARLY:
printf("Early");
- break;
- case H5D_ALLOC_TIME_INCR:
+ break;
+ case H5D_ALLOC_TIME_INCR:
printf("Incremental");
- break;
- case H5D_ALLOC_TIME_LATE:
+ break;
+ case H5D_ALLOC_TIME_LATE:
printf("Late");
- break;
- case H5D_ALLOC_TIME_DEFAULT:
- default:
+ break;
+ case H5D_ALLOC_TIME_DEFAULT:
+ default:
printf("?");
- break;
+ break;
}
printf("\"");
printf(">\n");
@@ -5958,77 +5958,77 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
tempi = H5Dget_storage_size(did);
if (display_data && (tempi > 0)) {
- switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- break;
-
- case H5T_TIME:
- indent += COL;
- indentation(indent);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent);
- printf("<!-- Time data not yet implemented. -->\n");
- indentation(indent);
- printf("<%sNoData />\n",xmlnsprefix);
- indentation(indent);
- printf("<%sData>\n",xmlnsprefix);
- indent -= COL;
- break;
-
- case H5T_COMPOUND:
- indentation(indent);
- printf("<!-- Note: format of compound data not specified -->\n");
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- break;
-
- case H5T_REFERENCE:
- indentation(indent);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent);
+ switch (H5Tget_class(type)) {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ break;
+
+ case H5T_TIME:
+ indent += COL;
+ indentation(indent);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent);
+ printf("<!-- Time data not yet implemented. -->\n");
+ indentation(indent);
+ printf("<%sNoData />\n",xmlnsprefix);
+ indentation(indent);
+ printf("<%sData>\n",xmlnsprefix);
+ indent -= COL;
+ break;
+
+ case H5T_COMPOUND:
+ indentation(indent);
+ printf("<!-- Note: format of compound data not specified -->\n");
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ break;
+
+ case H5T_REFERENCE:
+ indentation(indent);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent);
if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
printf("<!-- Note: Region references not supported -->\n");
indentation(indent);
printf("<%sNoData />\n",xmlnsprefix);
} else {
- printf("<%sDataFromFile>\n",xmlnsprefix);
- xml_print_refs(did, DATASET_DATA);
- indentation(indent);
- printf("</%sDataFromFile>\n",xmlnsprefix);
+ printf("<%sDataFromFile>\n",xmlnsprefix);
+ xml_print_refs(did, DATASET_DATA);
+ indentation(indent);
+ printf("</%sDataFromFile>\n",xmlnsprefix);
}
- indentation(indent);
- printf("</%sData>\n",xmlnsprefix);
- break;
-
- case H5T_VLEN:
- printf("<!-- Note: format of VL data not specified -->\n");
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- break;
- default:
- indentation(indent);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent);
- printf("<!-- Unknown datatype: %d -->\n", H5Tget_class(type));
- indentation(indent);
- printf("<%sNoData/>\n",xmlnsprefix);
- indentation(indent);
- printf("</%sData>\n",xmlnsprefix);
- break;
- }
+ indentation(indent);
+ printf("</%sData>\n",xmlnsprefix);
+ break;
+
+ case H5T_VLEN:
+ printf("<!-- Note: format of VL data not specified -->\n");
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ break;
+ default:
+ indentation(indent);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent);
+ printf("<!-- Unknown datatype: %d -->\n", H5Tget_class(type));
+ indentation(indent);
+ printf("<%sNoData/>\n",xmlnsprefix);
+ indentation(indent);
+ printf("</%sData>\n",xmlnsprefix);
+ break;
+ }
} else {
- /* no data written */
- indentation(indent + COL);
- printf("<%sData>\n",xmlnsprefix);
- indentation(indent + COL + COL);
- printf("<%sNoData/>\n",xmlnsprefix);
- indentation(indent + COL);
- printf("</%sData>\n",xmlnsprefix);
+ /* no data written */
+ indentation(indent + COL);
+ printf("<%sData>\n",xmlnsprefix);
+ indentation(indent + COL + COL);
+ printf("<%sNoData/>\n",xmlnsprefix);
+ indentation(indent + COL);
+ printf("</%sData>\n",xmlnsprefix);
}
H5Tclose(type);
@@ -6055,13 +6055,13 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
static void
xml_print_enum(hid_t type)
{
- char **name = NULL; /*member names */
- unsigned char *value = NULL; /*value array */
- unsigned nmembs; /*number of members */
- hid_t super; /*enum base integer type */
- hid_t native = -1; /*native integer data type */
- size_t dst_size; /*destination value type size */
- unsigned i; /*miscellaneous counters */
+ char **name = NULL; /*member names */
+ unsigned char *value = NULL; /*value array */
+ unsigned nmembs; /*number of members */
+ hid_t super; /*enum base integer type */
+ hid_t native = -1; /*native integer data type */
+ size_t dst_size; /*destination value type size */
+ unsigned i; /*miscellaneous counters */
size_t j;
nmembs = H5Tget_nmembers(type);
@@ -6081,15 +6081,15 @@ xml_print_enum(hid_t type)
* 3. raw format
*/
if (H5Tget_size(type) <= sizeof(long_long)) {
- dst_size = sizeof(long_long);
+ dst_size = sizeof(long_long);
- if (H5T_SGN_NONE == H5Tget_sign(type)) {
- native = H5T_NATIVE_ULLONG;
- } else {
- native = H5T_NATIVE_LLONG;
- }
+ if (H5T_SGN_NONE == H5Tget_sign(type)) {
+ native = H5T_NATIVE_ULLONG;
+ } else {
+ native = H5T_NATIVE_LLONG;
+ }
} else {
- dst_size = H5Tget_size(type);
+ dst_size = H5Tget_size(type);
}
/* Get the names and raw values of all members */
@@ -6097,13 +6097,13 @@ xml_print_enum(hid_t type)
value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
- name[i] = H5Tget_member_name(type, i);
- H5Tget_member_value(type, i, value + i * H5Tget_size(type));
+ name[i] = H5Tget_member_name(type, i);
+ H5Tget_member_value(type, i, value + i * H5Tget_size(type));
}
/* Convert values to native data type */
if (native > 0)
- H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT);
+ H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT);
/* Sort members by increasing value */
/*not implemented yet */
@@ -6113,38 +6113,38 @@ xml_print_enum(hid_t type)
for (i = 0; i < nmembs; i++) {
char *t_name = xml_escape_the_name(name[i]);
- indentation(indent);
- printf("<%sEnumElement>\n",xmlnsprefix);
- indentation(indent + COL);
- printf("%s\n", t_name);
+ indentation(indent);
+ printf("<%sEnumElement>\n",xmlnsprefix);
+ indentation(indent + COL);
+ printf("%s\n", t_name);
free(t_name);
- indentation(indent);
- printf("</%sEnumElement>\n",xmlnsprefix);
- indentation(indent);
- printf("<%sEnumValue>\n",xmlnsprefix);
- indentation(indent + COL);
- if (native < 0) {
- printf("0x");
-
- for (j = 0; j < dst_size; j++)
- printf("%02x", value[i * dst_size + j]);
- } else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long_long *)
- ((void *) (value + i * dst_size))));
- } else {
- HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d",
- *((long_long *) ((void *) (value + i * dst_size))));
- }
- printf("\n");
- indentation(indent);
- printf("</%sEnumValue>\n",xmlnsprefix);
+ indentation(indent);
+ printf("</%sEnumElement>\n",xmlnsprefix);
+ indentation(indent);
+ printf("<%sEnumValue>\n",xmlnsprefix);
+ indentation(indent + COL);
+ if (native < 0) {
+ printf("0x");
+
+ for (j = 0; j < dst_size; j++)
+ printf("%02x", value[i * dst_size + j]);
+ } else if (H5T_SGN_NONE == H5Tget_sign(native)) {
+ HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long_long *)
+ ((void *) (value + i * dst_size))));
+ } else {
+ HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d",
+ *((long_long *) ((void *) (value + i * dst_size))));
+ }
+ printf("\n");
+ indentation(indent);
+ printf("</%sEnumValue>\n",xmlnsprefix);
}
indent -= COL;
/* Release resources */
for (i = 0; i < nmembs; i++)
- free(name[i]);
+ free(name[i]);
free(name);
free(value);
@@ -6153,17 +6153,17 @@ xml_print_enum(hid_t type)
/*-------------------------------------------------------------------------
- * Function: h5_fileaccess
+ * Function: h5_fileaccess
*
- * Purpose: Returns a file access template which is the default template
- * but with a file driver set according to the constant or
- * environment variable HDF5_DRIVER
+ * Purpose: Returns a file access template which is the default template
+ * but with a file driver set according to the constant or
+ * environment variable HDF5_DRIVER
*
- * Return: Success: A file access property list
+ * Return: Success: A file access property list
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, November 19, 1998
*
* Modifications:
@@ -6174,8 +6174,8 @@ static hid_t
h5_fileaccess(void)
{
static const char *multi_letters = "msbrglo";
- const char *val = NULL;
- const char *name;
+ const char *val = NULL;
+ const char *name;
char s[1024];
hid_t fapl = -1;
@@ -6193,54 +6193,54 @@ h5_fileaccess(void)
if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
if (!HDstrcmp(name, "sec2")) {
- /* Unix read() and write() system calls */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
+ /* Unix read() and write() system calls */
+ if (H5Pset_fapl_sec2(fapl)<0) return -1;
} else if (!HDstrcmp(name, "stdio")) {
- /* Standard C fread() and fwrite() system calls */
- if (H5Pset_fapl_stdio(fapl)<0) return -1;
+ /* Standard C fread() and fwrite() system calls */
+ if (H5Pset_fapl_stdio(fapl)<0) return -1;
} else if (!HDstrcmp(name, "core")) {
- /* In-core temporary file with 1MB increment */
- if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
+ /* In-core temporary file with 1MB increment */
+ if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
} else if (!HDstrcmp(name, "split")) {
- /* Split meta data and raw data each using default driver */
- if (H5Pset_fapl_split(fapl,
- "-m.h5", H5P_DEFAULT,
- "-r.h5", H5P_DEFAULT)<0)
- return -1;
+ /* Split meta data and raw data each using default driver */
+ if (H5Pset_fapl_split(fapl,
+ "-m.h5", H5P_DEFAULT,
+ "-r.h5", H5P_DEFAULT)<0)
+ return -1;
} else if (!HDstrcmp(name, "multi")) {
- /* Multi-file driver, general case of the split driver */
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][1024];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- H5FD_mem_t mt;
-
- HDmemset(memb_map, 0, sizeof memb_map);
- HDmemset(memb_fapl, 0, sizeof memb_fapl);
- HDmemset(memb_name, 0, sizeof memb_name);
- HDmemset(memb_addr, 0, sizeof memb_addr);
-
- assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
- memb_fapl[mt] = H5P_DEFAULT;
+ /* Multi-file driver, general case of the split driver */
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][1024];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt;
+
+ HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_fapl, 0, sizeof memb_fapl);
+ HDmemset(memb_name, 0, sizeof memb_name);
+ HDmemset(memb_addr, 0, sizeof memb_addr);
+
+ assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
+ for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ memb_fapl[mt] = H5P_DEFAULT;
memb_map[mt] = mt;
- sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
- memb_name[mt] = sv[mt];
- memb_addr[mt] = MAX(mt-1,0)*(HADDR_MAX/10);
- }
-
- if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE)<0) {
- return -1;
- }
+ sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_name[mt] = sv[mt];
+ memb_addr[mt] = MAX(mt-1,0)*(HADDR_MAX/10);
+ }
+
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
+ memb_addr, FALSE)<0) {
+ return -1;
+ }
} else if (!HDstrcmp(name, "family")) {
hsize_t fam_size = 100*1024*1024; /*100 MB*/
- /* Family of files, each 1MB and using the default driver */
- if ((val=HDstrtok(NULL, " \t\n\r")))
- fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
- if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
+ /* Family of files, each 1MB and using the default driver */
+ if ((val=HDstrtok(NULL, " \t\n\r")))
+ fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
+ if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
return -1;
} else if (!HDstrcmp(name, "log")) {
long log_flags = H5FD_LOG_LOC_IO;
@@ -6250,14 +6250,14 @@ h5_fileaccess(void)
log_flags = HDstrtol(val, NULL, 0);
if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0)
- return -1;
+ return -1;
} else if (!HDstrcmp(name, "direct")) {
/* Substitute Direct I/O driver with sec2 driver temporarily because
- * some output has sec2 driver as the standard. */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
+ * some output has sec2 driver as the standard. */
+ if (H5Pset_fapl_sec2(fapl)<0) return -1;
} else {
- /* Unknown driver */
- return -1;
+ /* Unknown driver */
+ return -1;
}
return fapl;
diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index 6196c3f..414ba93 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -17,7 +17,7 @@
#include "hdf5.h"
-#define H5DUMP_MAX_RANK H5S_MAX_RANK
+#define H5DUMP_MAX_RANK H5S_MAX_RANK
#define ATTRIBUTE_DATA 0
#define DATASET_DATA 1
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index eecae08..78184fd 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -114,9 +114,9 @@ set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t UNUSED sid);
/* This message derives from H5Z */
const H5Z_class_t H5Z_MYFILTER[1] = {{
H5Z_CLASS_T_VERS,
- MYFILTER_ID, /* Filter id number */
+ MYFILTER_ID, /* Filter id number */
1, 1,
- "myfilter", /* Filter name for debugging */
+ "myfilter", /* Filter name for debugging */
NULL, /* The "can apply" callback */
set_local_myfilter, /* The "set local" callback */
myfilter, /* The actual filter function */
@@ -5279,8 +5279,8 @@ static void gent_string(void)
c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
hsize_t dims1[] = {1};
- hsize_t dims2[] = {SPACE1_DIM1};
- hsize_t dims4[1];
+ hsize_t dims2[] = {SPACE1_DIM1};
+ hsize_t dims4[1];
int ret;
dims4[0] = sizeof(buf4);
@@ -5453,9 +5453,9 @@ static void gent_aindices(void)
*/
static void gent_longlinks(void)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
char *objname = NULL; /* Name of object [Long] */
size_t u; /* Local index variable */