summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c3698
1 files changed, 1805 insertions, 1893 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 0a2ca3b..5706837 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -56,7 +56,7 @@ const char *progname = "h5dump";
#define H5_SZIP_RAW_OPTION_MASK 128
int d_status = EXIT_SUCCESS;
-static int unamedtype = 0; /* shared data type with no name */
+static int unamedtype = 0; /* shared datatype with no name */
static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
static size_t prefix_len = 1024;
static char *prefix;
@@ -621,7 +621,7 @@ usage(const char *prog)
fprintf(stdout, " with -o (output file) and -d (dataset). B can be:\n");
fprintf(stdout, " MEMORY for a memory type, FILE for the file type,\n");
fprintf(stdout, " LE or BE for pre-existing little or big endian types\n");
- fprintf(stdout, " -t P, --datatype=P Print the specified named data type\n");
+ fprintf(stdout, " -t P, --datatype=P Print the specified named datatype\n");
fprintf(stdout, " -w N, --width=N Set the number of columns of output\n");
fprintf(stdout, " -x, --xml Output in XML using Schema\n");
fprintf(stdout, " -u, --use-dtd Output in XML using DTD\n");
@@ -674,7 +674,7 @@ usage(const char *prog)
/*-------------------------------------------------------------------------
* Function: print_datatype
*
- * Purpose: print the data type.
+ * Purpose: print the datatype.
*
* Return: void
*
@@ -706,16 +706,14 @@ print_datatype(hid_t type,unsigned in_group)
const char *sign_s=NULL; /* sign scheme string */
if (!in_group && H5Tcommitted(type) > 0) {
- H5G_stat_t statbuf;
- haddr_t objno; /* Compact form of object's location */
+ H5O_info_t oinfo;
obj_t *obj; /* Found object */
- H5Gget_objinfo(type, ".", TRUE, &statbuf);
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- obj = search_obj(type_table, objno);
+ H5Oget_info(type, ".", &oinfo, H5P_DEFAULT);
+ obj = search_obj(type_table, oinfo.addr);
- if (obj) {
- if (!obj->recorded)
+ if(obj) {
+ if(!obj->recorded)
HDfprintf(stdout,"\"/#%a\"", obj->objno);
else
printf("\"%s\"", obj->objname);
@@ -724,371 +722,369 @@ print_datatype(hid_t type,unsigned in_group)
d_status = EXIT_FAILURE;
}
} else {
- switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- if (H5Tequal(type, H5T_STD_I8BE)==TRUE) {
- printf("H5T_STD_I8BE");
- } else if (H5Tequal(type, H5T_STD_I8LE)==TRUE) {
- printf("H5T_STD_I8LE");
- } else if (H5Tequal(type, H5T_STD_I16BE)==TRUE) {
- printf("H5T_STD_I16BE");
- } else if (H5Tequal(type, H5T_STD_I16LE)==TRUE) {
- printf("H5T_STD_I16LE");
- } else if (H5Tequal(type, H5T_STD_I32BE)==TRUE) {
- printf("H5T_STD_I32BE");
- } else if (H5Tequal(type, H5T_STD_I32LE)==TRUE) {
- printf("H5T_STD_I32LE");
- } else if (H5Tequal(type, H5T_STD_I64BE)==TRUE) {
- printf("H5T_STD_I64BE");
- } else if (H5Tequal(type, H5T_STD_I64LE)==TRUE) {
- printf("H5T_STD_I64LE");
- } else if (H5Tequal(type, H5T_STD_U8BE)==TRUE) {
- printf("H5T_STD_U8BE");
- } else if (H5Tequal(type, H5T_STD_U8LE)==TRUE) {
- printf("H5T_STD_U8LE");
- } else if (H5Tequal(type, H5T_STD_U16BE)==TRUE) {
- printf("H5T_STD_U16BE");
- } else if (H5Tequal(type, H5T_STD_U16LE)==TRUE) {
- printf("H5T_STD_U16LE");
- } else if (H5Tequal(type, H5T_STD_U32BE)==TRUE) {
- printf("H5T_STD_U32BE");
- } else if (H5Tequal(type, H5T_STD_U32LE)==TRUE) {
- printf("H5T_STD_U32LE");
- } else if (H5Tequal(type, H5T_STD_U64BE)==TRUE) {
- printf("H5T_STD_U64BE");
- } else if (H5Tequal(type, H5T_STD_U64LE)==TRUE) {
- printf("H5T_STD_U64LE");
- } else if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
- printf("H5T_NATIVE_SCHAR");
- } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
- printf("H5T_NATIVE_UCHAR");
- } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
- printf("H5T_NATIVE_SHORT");
- } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
- printf("H5T_NATIVE_USHORT");
- } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {
- printf("H5T_NATIVE_INT");
- } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) {
- printf("H5T_NATIVE_UINT");
- } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) {
- printf("H5T_NATIVE_LONG");
- } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) {
- printf("H5T_NATIVE_ULONG");
- } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) {
- printf("H5T_NATIVE_LLONG");
- } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) {
- printf("H5T_NATIVE_ULLONG");
- } else {
+ switch(H5Tget_class(type)) {
+ case H5T_INTEGER:
+ if(H5Tequal(type, H5T_STD_I8BE) == TRUE) {
+ printf("H5T_STD_I8BE");
+ } else if(H5Tequal(type, H5T_STD_I8LE) == TRUE) {
+ printf("H5T_STD_I8LE");
+ } else if(H5Tequal(type, H5T_STD_I16BE) == TRUE) {
+ printf("H5T_STD_I16BE");
+ } else if(H5Tequal(type, H5T_STD_I16LE) == TRUE) {
+ printf("H5T_STD_I16LE");
+ } else if(H5Tequal(type, H5T_STD_I32BE) == TRUE) {
+ printf("H5T_STD_I32BE");
+ } else if(H5Tequal(type, H5T_STD_I32LE) == TRUE) {
+ printf("H5T_STD_I32LE");
+ } else if(H5Tequal(type, H5T_STD_I64BE) == TRUE) {
+ printf("H5T_STD_I64BE");
+ } else if(H5Tequal(type, H5T_STD_I64LE) == TRUE) {
+ printf("H5T_STD_I64LE");
+ } else if(H5Tequal(type, H5T_STD_U8BE) == TRUE) {
+ printf("H5T_STD_U8BE");
+ } else if(H5Tequal(type, H5T_STD_U8LE) == TRUE) {
+ printf("H5T_STD_U8LE");
+ } else if(H5Tequal(type, H5T_STD_U16BE) == TRUE) {
+ printf("H5T_STD_U16BE");
+ } else if(H5Tequal(type, H5T_STD_U16LE) == TRUE) {
+ printf("H5T_STD_U16LE");
+ } else if(H5Tequal(type, H5T_STD_U32BE) == TRUE) {
+ printf("H5T_STD_U32BE");
+ } else if(H5Tequal(type, H5T_STD_U32LE) == TRUE) {
+ printf("H5T_STD_U32LE");
+ } else if(H5Tequal(type, H5T_STD_U64BE) == TRUE) {
+ printf("H5T_STD_U64BE");
+ } else if(H5Tequal(type, H5T_STD_U64LE) == TRUE) {
+ printf("H5T_STD_U64LE");
+ } else if(H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) {
+ printf("H5T_NATIVE_SCHAR");
+ } else if(H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) {
+ printf("H5T_NATIVE_UCHAR");
+ } else if(H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) {
+ printf("H5T_NATIVE_SHORT");
+ } else if(H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) {
+ printf("H5T_NATIVE_USHORT");
+ } else if(H5Tequal(type, H5T_NATIVE_INT) == TRUE) {
+ printf("H5T_NATIVE_INT");
+ } else if(H5Tequal(type, H5T_NATIVE_UINT) == TRUE) {
+ printf("H5T_NATIVE_UINT");
+ } else if(H5Tequal(type, H5T_NATIVE_LONG) == TRUE) {
+ printf("H5T_NATIVE_LONG");
+ } else if(H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) {
+ printf("H5T_NATIVE_ULONG");
+ } else if(H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) {
+ printf("H5T_NATIVE_LLONG");
+ } else if(H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) {
+ printf("H5T_NATIVE_ULLONG");
+ } else {
- /* byte order */
- if (H5Tget_size(type)>1)
- {
- order = H5Tget_order(type);
- if (H5T_ORDER_LE==order) {
- order_s = " little-endian";
- } else if (H5T_ORDER_BE==order) {
- order_s = " big-endian";
- } else if (H5T_ORDER_VAX==order) {
- order_s = " mixed-endian";
- } else {
- order_s = " unknown-byte-order";
- }
- } else {
- order_s = "";
- }
-
- /* sign */
- if ((sign=H5Tget_sign(type))>=0)
- {
- if (H5T_SGN_NONE==sign) {
- sign_s = " unsigned";
- } else if (H5T_SGN_2==sign) {
- sign_s = "";
- } else {
- sign_s = " unknown-sign";
- }
- } else {
- sign_s = " unknown-sign";
- }
-
- /* print size, order, and sign */
- printf("%lu-bit%s%s integer",
- (unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
- }
- break;
+ /* byte order */
+ if(H5Tget_size(type)>1) {
+ order = H5Tget_order(type);
+ if (H5T_ORDER_LE == order) {
+ order_s = " little-endian";
+ } else if (H5T_ORDER_BE == order) {
+ order_s = " big-endian";
+ } else if (H5T_ORDER_VAX == order) {
+ order_s = " mixed-endian";
+ } else {
+ order_s = " unknown-byte-order";
+ }
+ } else {
+ order_s = "";
+ }
+
+ /* sign */
+ if ((sign=H5Tget_sign(type))>=0)
+ {
+ if (H5T_SGN_NONE == sign) {
+ sign_s = " unsigned";
+ } else if (H5T_SGN_2 == sign) {
+ sign_s = "";
+ } else {
+ sign_s = " unknown-sign";
+ }
+ } else {
+ sign_s = " unknown-sign";
+ }
+
+ /* print size, order, and sign */
+ printf("%lu-bit%s%s integer",
+ (unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
+ }
+ break;
- case H5T_FLOAT:
- if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) {
- printf("H5T_IEEE_F32BE");
- } else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) {
- printf("H5T_IEEE_F32LE");
- } else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) {
- printf("H5T_IEEE_F64BE");
- } else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) {
- printf("H5T_IEEE_F64LE");
- } else if (H5Tequal(type, H5T_VAX_F32)==TRUE) {
- printf("H5T_VAX_F32");
- } else if (H5Tequal(type, H5T_VAX_F64)==TRUE) {
- printf("H5T_VAX_F64");
- } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) {
- printf("H5T_NATIVE_FLOAT");
- } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) {
- printf("H5T_NATIVE_DOUBLE");
+ case H5T_FLOAT:
+ if(H5Tequal(type, H5T_IEEE_F32BE) == TRUE) {
+ printf("H5T_IEEE_F32BE");
+ } else if(H5Tequal(type, H5T_IEEE_F32LE) == TRUE) {
+ printf("H5T_IEEE_F32LE");
+ } else if(H5Tequal(type, H5T_IEEE_F64BE) == TRUE) {
+ printf("H5T_IEEE_F64BE");
+ } else if(H5Tequal(type, H5T_IEEE_F64LE) == TRUE) {
+ printf("H5T_IEEE_F64LE");
+ } else if(H5Tequal(type, H5T_VAX_F32) == TRUE) {
+ printf("H5T_VAX_F32");
+ } else if(H5Tequal(type, H5T_VAX_F64) == TRUE) {
+ printf("H5T_VAX_F64");
+ } else if(H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) {
+ printf("H5T_NATIVE_FLOAT");
+ } else if(H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) {
+ printf("H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
- } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) {
- printf("H5T_NATIVE_LDOUBLE");
+ } else if(H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) {
+ printf("H5T_NATIVE_LDOUBLE");
#endif
- } else {
-
- /* byte order */
- if (H5Tget_size(type)>1)
- {
- order = H5Tget_order(type);
- if (H5T_ORDER_LE==order) {
- order_s = " little-endian";
- } else if (H5T_ORDER_BE==order) {
- order_s = " big-endian";
- } else if (H5T_ORDER_VAX==order) {
- order_s = " mixed-endian";
- } else {
- order_s = " unknown-byte-order";
- }
- } else {
- order_s = "";
- }
-
- /* print size and byte order */
- printf("%lu-bit%s floating-point",
- (unsigned long)(8*H5Tget_size(type)), order_s);
+ } else {
- }
- break;
+ /* byte order */
+ if(H5Tget_size(type)>1) {
+ order = H5Tget_order(type);
+ if (H5T_ORDER_LE == order) {
+ order_s = " little-endian";
+ } else if (H5T_ORDER_BE == order) {
+ order_s = " big-endian";
+ } else if (H5T_ORDER_VAX == order) {
+ order_s = " mixed-endian";
+ } else {
+ order_s = " unknown-byte-order";
+ }
+ } else {
+ order_s = "";
+ }
- case H5T_TIME:
- printf("H5T_TIME: not yet implemented");
- break;
+ /* print size and byte order */
+ printf("%lu-bit%s floating-point",
+ (unsigned long)(8*H5Tget_size(type)), order_s);
- case H5T_STRING:
- /* Make a copy of type in memory in case when TYPE is on disk, the size
- * will be bigger than in memory. This makes it easier to compare
- * types in memory. */
- tmp_type = H5Tcopy(type);
- size = H5Tget_size(tmp_type);
- str_pad = H5Tget_strpad(tmp_type);
- cset = H5Tget_cset(tmp_type);
- is_vlstr = H5Tis_variable_str(tmp_type);
-
- printf("H5T_STRING %s\n", dump_header_format->strblockbegin);
- indent += COL;
+ }
+ break;
- indentation(indent + COL);
- if(is_vlstr)
- printf("%s H5T_VARIABLE;\n", STRSIZE);
- else
- printf("%s %d;\n", STRSIZE, (int) size);
+ case H5T_TIME:
+ printf("H5T_TIME: not yet implemented");
+ break;
- indentation(indent + COL);
- printf("%s ", STRPAD);
- if (str_pad == H5T_STR_NULLTERM)
- printf("H5T_STR_NULLTERM;\n");
- else if (str_pad == H5T_STR_NULLPAD)
- printf("H5T_STR_NULLPAD;\n");
- else if (str_pad == H5T_STR_SPACEPAD)
- printf("H5T_STR_SPACEPAD;\n");
- else
- printf("H5T_STR_ERROR;\n");
+ case H5T_STRING:
+ /* Make a copy of type in memory in case when TYPE is on disk, the size
+ * will be bigger than in memory. This makes it easier to compare
+ * types in memory. */
+ tmp_type = H5Tcopy(type);
+ size = H5Tget_size(tmp_type);
+ str_pad = H5Tget_strpad(tmp_type);
+ cset = H5Tget_cset(tmp_type);
+ is_vlstr = H5Tis_variable_str(tmp_type);
+
+ printf("H5T_STRING %s\n", dump_header_format->strblockbegin);
+ indent += COL;
- indentation(indent + COL);
- printf("%s ", CSET);
+ indentation(indent + COL);
+ if(is_vlstr)
+ printf("%s H5T_VARIABLE;\n", STRSIZE);
+ else
+ printf("%s %d;\n", STRSIZE, (int) size);
- if (cset == H5T_CSET_ASCII)
- printf("H5T_CSET_ASCII;\n");
- else
- printf("unknown_cset;\n");
+ indentation(indent + COL);
+ printf("%s ", STRPAD);
+ if (str_pad == H5T_STR_NULLTERM)
+ printf("H5T_STR_NULLTERM;\n");
+ else if (str_pad == H5T_STR_NULLPAD)
+ printf("H5T_STR_NULLPAD;\n");
+ else if (str_pad == H5T_STR_SPACEPAD)
+ printf("H5T_STR_SPACEPAD;\n");
+ else
+ printf("H5T_STR_ERROR;\n");
- str_type = H5Tcopy(H5T_C_S1);
- if(is_vlstr)
- H5Tset_size(str_type, H5T_VARIABLE);
- else
- H5Tset_size(str_type, size);
- H5Tset_cset(str_type, cset);
- H5Tset_strpad(str_type, str_pad);
+ indentation(indent + COL);
+ printf("%s ", CSET);
- indentation(indent + COL);
- printf("%s ", CTYPE);
+ if (cset == H5T_CSET_ASCII)
+ printf("H5T_CSET_ASCII;\n");
+ else
+ printf("unknown_cset;\n");
- /* Check C variable-length string first. Are the two types equal? */
- if (H5Tequal(tmp_type, str_type)) {
- printf("H5T_C_S1;\n");
- goto done;
- }
+ str_type = H5Tcopy(H5T_C_S1);
+ if(is_vlstr)
+ H5Tset_size(str_type, H5T_VARIABLE);
+ else
+ H5Tset_size(str_type, size);
+ H5Tset_cset(str_type, cset);
+ H5Tset_strpad(str_type, str_pad);
- /* Change the endianness and see if they're equal. */
- order = H5Tget_order(tmp_type);
- if(order==H5T_ORDER_LE)
- H5Tset_order(str_type, H5T_ORDER_LE);
- else if(order==H5T_ORDER_BE)
- H5Tset_order(str_type, H5T_ORDER_BE);
+ indentation(indent + COL);
+ printf("%s ", CTYPE);
- if (H5Tequal(tmp_type, str_type)) {
- printf("H5T_C_S1;\n");
- goto done;
- }
+ /* Check C variable-length string first. Are the two types equal? */
+ if (H5Tequal(tmp_type, str_type)) {
+ printf("H5T_C_S1;\n");
+ goto done;
+ }
- /* If not equal to C variable-length string, check Fortran type. */
- H5Tclose(str_type);
- str_type = H5Tcopy(H5T_FORTRAN_S1);
- H5Tset_cset(str_type, cset);
- H5Tset_size(str_type, size);
- H5Tset_strpad(str_type, str_pad);
-
- /* Are the two types equal? */
- if (H5Tequal(tmp_type, str_type)) {
- printf("H5T_FORTRAN_S1;\n");
- goto done;
- }
+ /* Change the endianness and see if they're equal. */
+ order = H5Tget_order(tmp_type);
+ if(order==H5T_ORDER_LE)
+ H5Tset_order(str_type, H5T_ORDER_LE);
+ else if(order==H5T_ORDER_BE)
+ H5Tset_order(str_type, H5T_ORDER_BE);
- /* Change the endianness and see if they're equal. */
- order = H5Tget_order(tmp_type);
- if(order==H5T_ORDER_LE)
- H5Tset_order(str_type, H5T_ORDER_LE);
- else if(order==H5T_ORDER_BE)
- H5Tset_order(str_type, H5T_ORDER_BE);
+ if (H5Tequal(tmp_type, str_type)) {
+ printf("H5T_C_S1;\n");
+ goto done;
+ }
- if (H5Tequal(tmp_type, str_type)) {
- printf("H5T_FORTRAN_S1;\n");
- goto done;
- }
+ /* If not equal to C variable-length string, check Fortran type. */
+ H5Tclose(str_type);
+ str_type = H5Tcopy(H5T_FORTRAN_S1);
+ H5Tset_cset(str_type, cset);
+ H5Tset_size(str_type, size);
+ H5Tset_strpad(str_type, str_pad);
- /* Type doesn't match any of above. */
- printf("unknown_one_character_type;\n ");
- d_status = EXIT_FAILURE;
+ /* Are the two types equal? */
+ if (H5Tequal(tmp_type, str_type)) {
+ printf("H5T_FORTRAN_S1;\n");
+ goto done;
+ }
-done:
- H5Tclose(str_type);
- H5Tclose(tmp_type);
+ /* Change the endianness and see if they're equal. */
+ order = H5Tget_order(tmp_type);
+ if(order==H5T_ORDER_LE)
+ H5Tset_order(str_type, H5T_ORDER_LE);
+ else if(order==H5T_ORDER_BE)
+ H5Tset_order(str_type, H5T_ORDER_BE);
- indent -= COL;
- indentation(indent + COL);
- printf("%s", dump_header_format->strblockend);
- break;
+ if (H5Tequal(tmp_type, str_type)) {
+ printf("H5T_FORTRAN_S1;\n");
+ goto done;
+ }
- case H5T_BITFIELD:
- if (H5Tequal(type, H5T_STD_B8BE)==TRUE) {
- printf("H5T_STD_B8BE");
- } else if (H5Tequal(type, H5T_STD_B8LE)==TRUE) {
- printf("H5T_STD_B8LE");
- } else if (H5Tequal(type, H5T_STD_B16BE)==TRUE) {
- printf("H5T_STD_B16BE");
- } else if (H5Tequal(type, H5T_STD_B16LE)==TRUE) {
- printf("H5T_STD_B16LE");
- } else if (H5Tequal(type, H5T_STD_B32BE)==TRUE) {
- printf("H5T_STD_B32BE");
- } else if (H5Tequal(type, H5T_STD_B32LE)==TRUE) {
- printf("H5T_STD_B32LE");
- } else if (H5Tequal(type, H5T_STD_B64BE)==TRUE) {
- printf("H5T_STD_B64BE");
- } else if (H5Tequal(type, H5T_STD_B64LE)==TRUE) {
- printf("H5T_STD_B64LE");
- } else {
- printf("undefined bitfield");
+ /* Type doesn't match any of above. */
+ printf("unknown_one_character_type;\n ");
d_status = EXIT_FAILURE;
- }
- break;
- case H5T_OPAQUE:
- printf("\n");
- indentation(indent + COL);
- printf("H5T_OPAQUE;\n");
- indentation(indent + COL);
- printf("OPAQUE_TAG \"%s\";\n", H5Tget_tag(type));
- indentation(indent);
- break;
+ done:
+ H5Tclose(str_type);
+ H5Tclose(tmp_type);
+
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s", dump_header_format->strblockend);
+ break;
- case H5T_COMPOUND:
- nmembers = H5Tget_nmembers(type);
- printf("H5T_COMPOUND %s\n", dump_header_format->structblockbegin);
+ case H5T_BITFIELD:
+ if (H5Tequal(type, H5T_STD_B8BE)==TRUE) {
+ printf("H5T_STD_B8BE");
+ } else if (H5Tequal(type, H5T_STD_B8LE)==TRUE) {
+ printf("H5T_STD_B8LE");
+ } else if (H5Tequal(type, H5T_STD_B16BE)==TRUE) {
+ printf("H5T_STD_B16BE");
+ } else if (H5Tequal(type, H5T_STD_B16LE)==TRUE) {
+ printf("H5T_STD_B16LE");
+ } else if (H5Tequal(type, H5T_STD_B32BE)==TRUE) {
+ printf("H5T_STD_B32BE");
+ } else if (H5Tequal(type, H5T_STD_B32LE)==TRUE) {
+ printf("H5T_STD_B32LE");
+ } else if (H5Tequal(type, H5T_STD_B64BE)==TRUE) {
+ printf("H5T_STD_B64BE");
+ } else if (H5Tequal(type, H5T_STD_B64LE)==TRUE) {
+ printf("H5T_STD_B64LE");
+ } else {
+ printf("undefined bitfield");
+ d_status = EXIT_FAILURE;
+ }
+ break;
- for (i = 0; i < nmembers; i++) {
- mname = H5Tget_member_name(type, i);
- mtype = H5Tget_member_type(type, i);
+ case H5T_OPAQUE:
+ printf("\n");
+ indentation(indent + COL);
+ printf("H5T_OPAQUE;\n");
indentation(indent + COL);
+ printf("OPAQUE_TAG \"%s\";\n", H5Tget_tag(type));
+ indentation(indent);
+ break;
- if (H5Tget_class(mtype) == H5T_COMPOUND)
- indent += COL;
+ case H5T_COMPOUND:
+ nmembers = H5Tget_nmembers(type);
+ printf("H5T_COMPOUND %s\n", dump_header_format->structblockbegin);
- print_datatype(mtype,0);
+ for (i = 0; i < nmembers; i++) {
+ mname = H5Tget_member_name(type, i);
+ mtype = H5Tget_member_type(type, i);
+ indentation(indent + COL);
- if (H5Tget_class(mtype) == H5T_COMPOUND)
- indent -= COL;
+ if (H5Tget_class(mtype) == H5T_COMPOUND)
+ indent += COL;
- printf(" \"%s\";\n", mname);
- free(mname);
- }
+ print_datatype(mtype,0);
- indentation(indent);
- printf("%s", dump_header_format->structblockend);
- break;
+ if (H5Tget_class(mtype) == H5T_COMPOUND)
+ indent -= COL;
- case H5T_REFERENCE:
- printf("H5T_REFERENCE");
- break;
+ printf(" \"%s\";\n", mname);
+ free(mname);
+ }
- case H5T_ENUM:
- printf("H5T_ENUM %s\n", dump_header_format->enumblockbegin);
- indent += COL;
- indentation(indent + COL);
- super = H5Tget_super(type);
- print_datatype(super,0);
- printf(";\n");
- print_enum(type);
- indent -= COL;
- indentation(indent + COL);
- printf("%s", dump_header_format->enumblockend);
- break;
+ indentation(indent);
+ printf("%s", dump_header_format->structblockend);
+ break;
- case H5T_VLEN:
- printf("H5T_VLEN %s ", dump_header_format->vlenblockbegin);
- super = H5Tget_super(type);
- print_datatype(super,0);
- H5Tclose(super);
+ case H5T_REFERENCE:
+ printf("H5T_REFERENCE");
+ break;
- /* Print closing */
- printf("%s", dump_header_format->vlenblockend);
- break;
+ case H5T_ENUM:
+ printf("H5T_ENUM %s\n", dump_header_format->enumblockbegin);
+ indent += COL;
+ indentation(indent + COL);
+ super = H5Tget_super(type);
+ print_datatype(super,0);
+ printf(";\n");
+ print_enum(type);
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s", dump_header_format->enumblockend);
+ break;
- case H5T_ARRAY:
- /* Get array base type */
- super = H5Tget_super(type);
+ case H5T_VLEN:
+ printf("H5T_VLEN %s ", dump_header_format->vlenblockbegin);
+ super = H5Tget_super(type);
+ print_datatype(super,0);
+ H5Tclose(super);
- /* Print lead-in */
- printf("H5T_ARRAY { ");
+ /* Print closing */
+ printf("%s", dump_header_format->vlenblockend);
+ break;
- /* Get array information */
- ndims = H5Tget_array_ndims(type);
- H5Tget_array_dims(type, dims, NULL);
+ case H5T_ARRAY:
+ /* Get array base type */
+ super = H5Tget_super(type);
- /* Print array dimensions */
- for (i = 0; i < ndims; i++)
- printf("[%d]", (int) dims[i]);
+ /* Print lead-in */
+ printf("H5T_ARRAY { ");
- printf(" ");
+ /* Get array information */
+ ndims = H5Tget_array_ndims(type);
+ H5Tget_array_dims(type, dims, NULL);
- /* Print base type */
- print_datatype(super,0);
+ /* Print array dimensions */
+ for (i = 0; i < ndims; i++)
+ printf("[%d]", (int) dims[i]);
- /* Close array base type */
- H5Tclose(super);
+ printf(" ");
- /* Print closing */
- printf(" }");
+ /* Print base type */
+ print_datatype(super,0);
- break;
+ /* Close array base type */
+ H5Tclose(super);
- default:
- printf("unknown data type");
- d_status = EXIT_FAILURE;
- break;
+ /* Print closing */
+ printf(" }");
+
+ break;
+
+ default:
+ printf("unknown datatype");
+ d_status = EXIT_FAILURE;
+ break;
}
} /* end else */
}
@@ -1097,8 +1093,8 @@ done:
/*-------------------------------------------------------------------------
* Function: dump_datatype
*
- * Purpose: Dump the data type. Data type can be HDF5 predefined
- * atomic data type or committed/transient data type.
+ * Purpose: Dump the datatype. Datatype can be HDF5 predefined
+ * atomic datatype or committed/transient datatype.
*
* Return: void
*
@@ -1127,7 +1123,7 @@ dump_datatype(hid_t type)
/*-------------------------------------------------------------------------
* Function: dump_dataspace
*
- * Purpose: Dump the data space. Data space can be named data space,
+ * Purpose: Dump the dataspace. Dataspace can be named dataspace,
* array, or others.
*
* Return: void
@@ -1150,49 +1146,52 @@ dump_dataspace(hid_t space)
indentation(indent + COL);
printf("%s ", dump_header_format->dataspacebegin);
- switch (space_type) {
+ 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]);
+ /* 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]);
+ for(i = 1; i < ndims; i++)
+ HDfprintf(stdout, ", %Hu", size[i]);
- printf(" %s / ", dump_header_format->dataspacedimend);
+ 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]);
+ 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);
+ break;
+ } /* end switch */
end_obj(dump_header_format->dataspaceend,
dump_header_format->dataspaceblockend);
@@ -1214,41 +1213,44 @@ dump_dataspace(hid_t space)
*-------------------------------------------------------------------------
*/
static herr_t
-dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data)
+dump_attr(hid_t oid, const char *attr_name, void UNUSED * op_data)
{
- hid_t attr_id, type, space;
+ hid_t attr_id;
herr_t ret = SUCCEED;
indentation(indent);
begin_obj(dump_header_format->attributebegin, attr_name,
dump_header_format->attributeblockbegin);
- if ((attr_id = H5Aopen_name(attr, attr_name)) < 0) {
- indentation(indent + COL);
+ if((attr_id = H5Aopen_name(oid, attr_name)) < 0) {
+ 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);
+ hid_t type, space;
- if (display_oid)
- dump_oid(attr_id);
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
+ dump_datatype(type);
+ dump_dataspace(space);
- if (display_data || display_attr_data)
- dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai);
+ if(display_oid)
+ dump_oid(attr_id);
- H5Tclose(type);
- H5Sclose(space);
- H5Aclose(attr_id);
- indentation(indent);
- end_obj(dump_header_format->attributeend,
- dump_header_format->attributeblockend);
+ 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;
@@ -1272,72 +1274,42 @@ dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data)
static herr_t
dump_selected_attr(hid_t loc_id, const char *name)
{
- int j;
+ hid_t oid, attr_id;
char *obj_name;
const char *attr_name;
- hid_t oid, attr_id, type, space;
- H5G_stat_t statbuf;
+ int j;
- j = (int)strlen(name) - 1;
- obj_name = malloc((size_t)j + 2);
+ j = (int)HDstrlen(name) - 1;
+ obj_name = HDmalloc((size_t)j + 2);
/* find the last / */
- while (name[j] != '/' && j >= 0)
- j--;
+ while(name[j] != '/' && j >= 0)
+ j--;
/* object name */
- if (j == -1) {
- strcpy(obj_name, "/");
- } else {
- strncpy(obj_name, name, (size_t)j + 1);
+ if(j == -1)
+ HDstrcpy(obj_name, "/");
+ else {
+ HDstrncpy(obj_name, name, (size_t)j + 1);
obj_name[j + 1] = '\0';
- }
+ } /* end else */
attr_name = name + j + 1;
begin_obj(dump_header_format->attributebegin, name,
dump_header_format->attributeblockbegin);
- H5Gget_objinfo(loc_id, obj_name, FALSE, &statbuf);
-
- switch(statbuf.type) {
- case H5G_GROUP:
- if((oid = H5Gopen2(loc_id, obj_name, H5P_DEFAULT)) < 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;
- } /* end if */
- break;
-
- case H5G_DATASET:
- 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;
- } /* end if */
- break;
- case H5G_TYPE:
- 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;
- } /* end if */
- break;
-
- default:
- 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 switch */
+ /* Open the object with the attribute */
+ if((oid = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) {
+ indentation(COL);
+ error_msg(progname, "unable to open object \"%s\"\n", obj_name);
+ end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend);
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ } /* end if */
if((attr_id = H5Aopen_name(oid, attr_name)) >= 0) {
+ hid_t type, space;
+
type = H5Aget_type(attr_id);
space = H5Aget_space(attr_id);
dump_datatype(type);
@@ -1361,34 +1333,13 @@ dump_selected_attr(hid_t loc_id, const char *name)
d_status = EXIT_FAILURE;
}
- switch(statbuf.type) {
- case H5G_GROUP:
- if(H5Gclose(oid) < 0) {
- d_status = EXIT_FAILURE;
- return FAIL;
- } /* end if */
- break;
-
- case H5G_DATASET:
- if(H5Dclose(oid) < 0) {
- d_status = EXIT_FAILURE;
- return FAIL;
- } /* end if */
- break;
-
- case H5G_TYPE:
- if(H5Tclose(oid) < 0) {
- d_status = EXIT_FAILURE;
- return FAIL;
- } /* end if */
- break;
-
- default:
- d_status = EXIT_FAILURE;
- return FAIL;
- } /* end switch */
+ /* Close object */
+ if(H5Oclose(oid) < 0) {
+ d_status = EXIT_FAILURE;
+ return FAIL;
+ } /* end if */
- free(obj_name);
+ HDfree(obj_name);
return SUCCEED;
}
@@ -1411,24 +1362,12 @@ dump_selected_attr(hid_t loc_id, const char *name)
*-------------------------------------------------------------------------
*/
static herr_t
-dump_all(hid_t group, const char *name, const H5L_info_t *linfo, void * op_data)
+dump_all(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED *op_data)
{
hid_t obj;
char *obj_path = NULL; /* Full path of object */
- H5G_stat_t statbuf;
herr_t ret = SUCCEED;
- /* Stat the object */
- if(H5Gget_objinfo(group, name, FALSE, &statbuf) < 0) {
- error_msg(progname, "unable to get object information for \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- ret = FAIL;
- goto done;
- } /* end if */
-
- if (*(int *)op_data != H5G_UNKNOWN && statbuf.type != *(int *) op_data)
- goto done;
-
/* Build the object's path name */
obj_path = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDassert(obj_path);
@@ -1436,356 +1375,359 @@ dump_all(hid_t group, const char *name, const H5L_info_t *linfo, void * op_data)
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
- switch (statbuf.type) {
- case H5G_LINK:
- {
- char *targbuf;
-
- indentation(indent);
- targbuf = HDmalloc(statbuf.linklen);
- HDassert(targbuf);
+ if(linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
- if (!doxml) {
- begin_obj(dump_header_format->softlinkbegin, name,
- dump_header_format->softlinkblockbegin);
- indentation(indent + COL);
- }
+ /* Stat the object */
+ if(H5Oget_info(group, name, &oinfo, H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to get object information for \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ goto done;
+ } /* end if */
- if (H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) {
- error_msg(progname, "unable to get link value\n");
- d_status = EXIT_FAILURE;
- ret = FAIL;
- } else {
- /* print the value of a soft link */
- if (!doxml) {
- /* Standard DDL: no modification */
- printf("LINKTARGET \"%s\"\n", targbuf);
+ switch(oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg(progname, "unable to dump group \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
} else {
- /* XML */
- char linkxid[100];
- char parentxid[100];
- char targetxid[100];
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_targbuf = xml_escape_the_name(targbuf);
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_link_path;
- int res;
+ char *old_prefix; /* Pointer to previous prefix */
- t_link_path = HDmalloc(HDstrlen(prefix) + statbuf.linklen + 1);
- if(targbuf[0] == '/')
- HDstrcpy(t_link_path, targbuf);
- else {
- HDstrcpy(t_link_path, prefix);
- HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
- } /* end else */
+ /* Keep copy of prefix before iterating into group */
+ old_prefix = HDstrdup(prefix);
+ HDassert(old_prefix);
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- /* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0);
- if (res == 0) {
- /* target obj found */
- printf("<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" TargetObj=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- targetxid, /* TargetObj */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- } else {
- /* dangling link -- omit from xml attributes */
- printf("<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- }
-
- HDfree(t_prefix);
- HDfree(t_name);
- HDfree(t_targbuf);
- HDfree(t_obj_path);
- HDfree(t_link_path);
- }
- }
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- if (!doxml) {
- indentation(indent);
- end_obj(dump_header_format->softlinkend,
- dump_header_format->softlinkblockend);
- }
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
- HDfree(targbuf);
- break;
- }
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
- case H5G_UDLINK:
- indentation(indent);
- switch(linfo->type) {
- case H5L_TYPE_EXTERNAL:
- {
- char *targbuf;
+ case H5O_TYPE_DATASET:
+ if((obj = H5Dopen(group, name)) >= 0) {
+ if(oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
- targbuf = HDmalloc(statbuf.linklen);
- HDassert(targbuf);
- if(!doxml)
- begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin);
+ found_obj = search_obj(dset_table, oinfo.addr);
- if(H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) {
- error_msg(progname, "unable to get external link value\n");
- d_status = EXIT_FAILURE;
- ret = FAIL;
- } else {
- const char *filename;
- const char *targname;
+ if(found_obj == NULL) {
+ indentation(indent);
+ begin_obj(dump_header_format->datasetbegin, name,
+ dump_header_format->datasetblockbegin);
+ indentation(indent + COL);
+ error_msg(progname,
+ "internal error (file %s:line %d)\n",
+ __FILE__, __LINE__);
+ indentation(indent);
+ end_obj(dump_header_format->datasetend,
+ dump_header_format->datasetblockend);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ H5Dclose(obj);
+ goto done;
+ } else if(found_obj->displayed) {
+ indentation(indent);
- if(H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &targname) < 0) {
- error_msg(progname, "unable to unpack external link value\n");
- d_status = EXIT_FAILURE;
- ret = FAIL;
- } else {
- if (!doxml) {
+ if(!doxml) {
+ begin_obj(dump_header_format->datasetbegin, name,
+ dump_header_format->datasetblockbegin);
indentation(indent + COL);
- printf("LINKCLASS %d\n", linfo->type);
- indentation(indent + COL);
- printf("TARGETFILE \"%s\"\n", filename);
- indentation(indent + COL);
- printf("TARGETPATH \"%s\"\n", targname);
- }
- /* XML */
- else {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ printf("%s \"%s\"\n", HARDLINK, found_obj->objname);
+ indentation(indent);
+ end_obj(dump_header_format->datasetend,
+ dump_header_format->datasetblockend);
+ } else {
+ /* the XML version */
char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_filename = xml_escape_the_name(filename);
- char *t_targname = xml_escape_the_name(targname);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char dsetxid[100];
+ char parentxid[100];
+ char pointerxid[100];
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
+ xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1);
xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
- printf("<%sExternalLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetFilename=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- filename, /* TargetFilename */
- targname, /* TargetPath*/
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- HDfree(t_prefix);
+ printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
+ "H5Path=\"%s\" Parents=\"%s\" "
+ "H5ParentPaths=\"%s\">\n",
+ xmlnsprefix,
+ t_name, /* Dataset Name */
+ dsetxid, get_next_xid(), /* OBJ-XID */
+ t_obj_path, /* H5Path */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+
+ indentation(indent + COL);
+ xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1);
+ printf("<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n",
+ xmlnsprefix,
+ pointerxid,t_obj_path);
+ indentation(indent);
+ printf("</%sDataset>\n", xmlnsprefix);
+
HDfree(t_name);
- HDfree(t_filename);
- HDfree(t_targname);
HDfree(t_obj_path);
+ HDfree(t_prefix);
}
+
+ H5Dclose(obj);
+ goto done;
+ } else {
+ found_obj->displayed = TRUE;
}
- }
- if (!doxml)
- end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend);
- HDfree(targbuf);
- }
- break;
+ } /* end if */
- default:
- if (!doxml) {
- begin_obj(dump_header_format->udlinkbegin, name, dump_header_format->udlinkblockbegin);
- indentation(indent + COL);
- }
- if (!doxml)
- printf("LINKCLASS %d\n", linfo->type);
- else /* XML */
- {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_obj_path = xml_escape_the_name(obj_path);
-
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
-
- printf("<%sUserDefined LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "LinkClass=\"%d\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- linfo->type, /* LinkClass */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- HDfree(t_prefix);
- HDfree(t_name);
- HDfree(t_obj_path);
- }
- if (!doxml) {
- indentation(indent);
- end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend);
- }
- }
- break;
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ H5Dclose(obj);
+ } else {
+ error_msg(progname, "unable to dump dataset \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ }
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if((obj = H5Topen(group, name)) < 0) {
+ error_msg(progname, "unable to dump datatype \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } else {
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
+ }
+ break;
- case H5G_GROUP:
- if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg(progname, "unable to dump group \"%s\"\n", name);
+ default:
+ error_msg(progname, "unknown object \"%s\"\n", name);
d_status = EXIT_FAILURE;
ret = FAIL;
- } else {
- char *old_prefix; /* Pointer to previous prefix */
+ }
+ } /* end if */
+ else {
+ char *targbuf;
- /* Keep copy of prefix before iterating into group */
- old_prefix = HDstrdup(prefix);
- HDassert(old_prefix);
+ switch(linfo->type) {
+ case H5L_TYPE_SOFT:
+ indentation(indent);
+ targbuf = HDmalloc(linfo->u.val_size);
+ HDassert(targbuf);
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
+ if(!doxml) {
+ begin_obj(dump_header_format->softlinkbegin, name,
+ dump_header_format->softlinkblockbegin);
+ indentation(indent + COL);
+ }
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to get link value\n");
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } else {
+ /* print the value of a soft link */
+ if (!doxml) {
+ /* Standard DDL: no modification */
+ printf("LINKTARGET \"%s\"\n", targbuf);
+ } else {
+ /* XML */
+ char linkxid[100];
+ char parentxid[100];
+ char targetxid[100];
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_targbuf = xml_escape_the_name(targbuf);
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_link_path;
+ int res;
+
+ t_link_path = HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
+ if(targbuf[0] == '/')
+ HDstrcpy(t_link_path, targbuf);
+ else {
+ HDstrcpy(t_link_path, prefix);
+ HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
+ } /* end else */
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
+
+ /* Try to create an OBJ-XID for the object pointed to */
+ res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0);
+ if (res == 0) {
+ /* target obj found */
+ printf("<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" TargetObj=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ targetxid, /* TargetObj */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ } else {
+ /* dangling link -- omit from xml attributes */
+ printf("<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ }
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_targbuf);
+ HDfree(t_obj_path);
+ HDfree(t_link_path);
+ }
+ }
- /* Close group */
- H5Gclose(obj);
- }
- break;
+ if (!doxml) {
+ indentation(indent);
+ end_obj(dump_header_format->softlinkend,
+ dump_header_format->softlinkblockend);
+ }
- case H5G_DATASET:
- if ((obj = H5Dopen(group, name)) >= 0) {
- haddr_t objno; /* Compact form of object's location */
+ HDfree(targbuf);
+ break;
- /* hard link */
- H5Gget_objinfo(obj, ".", TRUE, &statbuf);
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
+ case H5L_TYPE_EXTERNAL:
+ targbuf = HDmalloc(linfo->u.val_size);
+ HDassert(targbuf);
- if (statbuf.nlink > 1) {
- obj_t *found_obj; /* Found object */
+ indentation(indent);
+ if(!doxml)
+ begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin);
- found_obj = search_obj(dset_table, objno);
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to get external link value\n");
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
- if (found_obj == NULL) {
- indentation(indent);
- begin_obj(dump_header_format->datasetbegin, name,
- dump_header_format->datasetblockbegin);
- indentation(indent + COL);
- error_msg(progname,
- "internal error (file %s:line %d)\n",
- __FILE__, __LINE__);
- indentation(indent);
- end_obj(dump_header_format->datasetend,
- dump_header_format->datasetblockend);
+ if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ error_msg(progname, "unable to unpack external link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
- H5Dclose(obj);
- goto done;
- } else if (found_obj->displayed) {
- indentation(indent);
-
- if (!doxml) {
- begin_obj(dump_header_format->datasetbegin, name,
- dump_header_format->datasetblockbegin);
+ } /* end if */
+ else {
+ if(!doxml) {
indentation(indent + COL);
- printf("%s \"%s\"\n", HARDLINK, found_obj->objname);
- indentation(indent);
- end_obj(dump_header_format->datasetend,
- dump_header_format->datasetblockend);
- } else {
- /* the XML version */
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char dsetxid[100];
+ printf("LINKCLASS %d\n", linfo->type);
+ indentation(indent + COL);
+ printf("TARGETFILE \"%s\"\n", filename);
+ indentation(indent + COL);
+ printf("TARGETPATH \"%s\"\n", targname);
+ } /* end if */
+ /* XML */
+ else {
+ char linkxid[100];
char parentxid[100];
- char pointerxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_filename = xml_escape_the_name(filename);
+ char *t_targname = xml_escape_the_name(targname);
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1);
+ xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
- printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
- "H5Path=\"%s\" Parents=\"%s\" "
- "H5ParentPaths=\"%s\">\n",
- xmlnsprefix,
- t_name, /* Dataset Name */
- dsetxid, get_next_xid(), /* OBJ-XID */
- t_obj_path, /* H5Path */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
-
- indentation(indent + COL);
- xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1);
- printf("<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n",
- xmlnsprefix,
- pointerxid,t_obj_path);
- indentation(indent);
- printf("</%sDataset>\n", xmlnsprefix);
-
+ printf("<%sExternalLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetFilename=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ filename, /* TargetFilename */
+ targname, /* TargetPath*/
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ HDfree(t_prefix);
HDfree(t_name);
+ HDfree(t_filename);
+ HDfree(t_targname);
HDfree(t_obj_path);
- HDfree(t_prefix);
- }
-
- H5Dclose(obj);
- goto done;
- } else {
- found_obj->displayed = TRUE;
- }
+ } /* end else */
+ } /* end else */
+ } /* end else */
+ if(!doxml) {
+ indentation(indent);
+ end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend);
} /* end if */
+ HDfree(targbuf);
+ break;
- dump_function_table->dump_dataset_function(obj, name, NULL);
- H5Dclose(obj);
- } else {
- error_msg(progname, "unable to dump dataset \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- ret = FAIL;
- }
- break;
+ default:
+ indentation(indent);
+ if(!doxml) {
+ begin_obj(dump_header_format->udlinkbegin, name, dump_header_format->udlinkblockbegin);
+ indentation(indent + COL);
+ printf("LINKCLASS %d\n", linfo->type);
+ indentation(indent);
+ end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend);
+ } /* end if */
+ /* XML */
+ else {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
- case H5G_TYPE:
- if ((obj = H5Topen(group, name)) < 0) {
- error_msg(progname, "unable to dump data type \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- ret = FAIL;
- } else {
- dump_function_table->dump_named_datatype_function(obj, name);
- H5Tclose(obj);
- }
- break;
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
- default:
- error_msg(progname, "unknown object \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- ret = FAIL;
- }
+ printf("<%sUserDefined LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "LinkClass=\"%d\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ linfo->type, /* LinkClass */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ } /* end else */
+ break;
+ } /* end switch */
+ } /* end else */
done:
if(obj_path)
@@ -1796,7 +1738,7 @@ done:
/*-------------------------------------------------------------------------
* Function: dump_named_datatype
*
- * Purpose: Dump named data type
+ * Purpose: Dump named datatype
*
* Return: void
*
@@ -1810,25 +1752,25 @@ done:
static void
dump_named_datatype(hid_t type, const char *name)
{
- indentation(indent);
- printf("%s \"%s\" %s", dump_header_format->datatypebegin, name,
- dump_header_format->datatypeblockbegin);
-
- if (H5Tget_class(type) == H5T_COMPOUND) {
- print_datatype(type,1);
- } else {
- indentation(indent + COL);
- print_datatype(type,1);
- printf(";\n");
- }
+ indentation(indent);
+ printf("%s \"%s\" %s", dump_header_format->datatypebegin, name,
+ dump_header_format->datatypeblockbegin);
- /* print attributes */
- indent += COL;
- H5Aiterate(type, NULL, dump_attr, NULL);
- indent -= COL;
+ if(H5Tget_class(type) == H5T_COMPOUND)
+ print_datatype(type, 1);
+ else {
+ indentation(indent + COL);
+ print_datatype(type, 1);
+ printf(";\n");
+ } /* end else */
+
+ /* print attributes */
+ indent += COL;
+ H5Aiterate(type, NULL, dump_attr, NULL);
+ indent -= COL;
- end_obj(dump_header_format->datatypeend,
- dump_header_format->datatypeblockend);
+ end_obj(dump_header_format->datatypeend,
+ dump_header_format->datatypeblockend);
}
/*-------------------------------------------------------------------------
@@ -1849,11 +1791,9 @@ dump_named_datatype(hid_t type, const char *name)
static void
dump_group(hid_t gid, const char *name)
{
- H5G_stat_t statbuf;
- haddr_t objno; /* Compact form of object's location */
+ H5O_info_t oinfo;
hid_t dset, type;
char type_name[1024], *tmp;
- int xtype = H5G_UNKNOWN; /* dump all */
tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
@@ -1882,13 +1822,12 @@ dump_group(hid_t gid, const char *name)
}
} /* end if */
- H5Gget_objinfo(gid, ".", TRUE, &statbuf);
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
+ H5Oget_info(gid, ".", &oinfo, H5P_DEFAULT);
- if (statbuf.nlink > 1) {
+ if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(group_table, objno);
+ found_obj = search_obj(group_table, oinfo.addr);
if (found_obj == NULL) {
indentation(indent);
@@ -1901,11 +1840,11 @@ dump_group(hid_t gid, const char *name)
} else {
found_obj->displayed = TRUE;
H5Aiterate(gid, NULL, dump_attr, NULL);
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
+ H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, NULL, H5P_DEFAULT);
}
} else {
H5Aiterate(gid, NULL, dump_attr, NULL);
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
+ H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, NULL, H5P_DEFAULT);
}
indent -= COL;
@@ -1930,27 +1869,32 @@ dump_group(hid_t gid, const char *name)
static void
dump_dataset(hid_t did, const char *name, struct subset_t *sset)
{
- hid_t type, space, dcpl_id;
+ hid_t type, space;
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);
dump_comment(did);
dump_datatype(type);
dump_dataspace(space);
- if (display_oid)
+ if(display_oid)
dump_oid(did);
- if (display_dcpl)
+ if(display_dcpl) {
+ hid_t dcpl_id;
+
+ dcpl_id = H5Dget_create_plist(did);
dump_dcpl(dcpl_id, type, did);
+ H5Pclose(dcpl_id);
+ } /* end if */
- if (display_data)
- switch (H5Tget_class(type)) {
+ if(display_data)
+ switch(H5Tget_class(type)) {
case H5T_TIME:
indentation(indent + COL);
printf("DATA{ not yet implemented.}\n");
@@ -1971,17 +1915,18 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
default:
break;
- }
+ } /* end switch */
indent += COL;
H5Aiterate(did, NULL, dump_attr, NULL);
indent -= COL;
+
H5Tclose(type);
H5Sclose(space);
- H5Pclose(dcpl_id);
+
indentation(indent);
end_obj(dump_header_format->datasetend,
- dump_header_format->datasetblockend);
+ dump_header_format->datasetblockend);
}
/*-------------------------------------------------------------------------
@@ -2136,12 +2081,12 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
dump_header_format->datablockbegin);
/* Print all the values. */
- if (obj_data == DATASET_DATA) {
+ if(obj_data == DATASET_DATA) {
hid_t f_type = H5Dget_type(obj_id);
char string_prefix[64];
h5tool_format_t string_dataformat;
- if (display_char && H5Tget_size(f_type) == 1 && H5Tget_class(f_type) == H5T_INTEGER) {
+ if(display_char && H5Tget_size(f_type) == 1 && H5Tget_class(f_type) == H5T_INTEGER) {
/*
* Print 1-byte integer data as an ASCII character string
* instead of integers if the `-r' or `--string' command-line
@@ -3042,8 +2987,7 @@ parse_subset_params(char *dset)
static void
handle_datasets(hid_t fid, char *dset, void *data)
{
- H5G_stat_t statbuf;
- haddr_t objno; /* Compact form of object's location */
+ H5O_info_t oinfo;
hid_t dsetid;
struct subset_t *sset = (struct subset_t *)data;
@@ -3109,15 +3053,13 @@ handle_datasets(hid_t fid, char *dset, void *data)
}
}
- H5Gget_objinfo(dsetid, ".", TRUE, &statbuf);
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
-
- if (statbuf.nlink > 1) {
+ H5Oget_info(dsetid, ".", &oinfo, H5P_DEFAULT);
+ if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, objno);
+ found_obj = search_obj(dset_table, oinfo.addr);
- if (found_obj) {
+ if(found_obj) {
if (found_obj->displayed) {
begin_obj(dump_header_format->datasetbegin, dset,
dump_header_format->datasetblockbegin);
@@ -3130,14 +3072,14 @@ handle_datasets(hid_t fid, char *dset, void *data)
found_obj->displayed = TRUE;
dump_dataset(dsetid, dset, sset);
}
- } else {
- d_status = EXIT_FAILURE;
}
- } else {
- dump_dataset(dsetid, dset, sset);
+ else
+ d_status = EXIT_FAILURE;
}
+ else
+ dump_dataset(dsetid, dset, sset);
- if (H5Dclose(dsetid) < 0)
+ if(H5Dclose(dsetid) < 0)
d_status = EXIT_FAILURE;
}
@@ -3199,47 +3141,44 @@ handle_groups(hid_t fid, char *group, void UNUSED * data)
static void
handle_links(hid_t fid, char *links, void UNUSED * data)
{
- H5G_stat_t statbuf;
H5L_info_t linfo;
- if(H5Gget_objinfo(fid, links, FALSE, &statbuf) < 0) {
- error_msg(progname, "unable to get obj info from \"%s\"\n", links);
- d_status = EXIT_FAILURE;
- } else if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg(progname, "unable to get link info from \"%s\"\n", links);
d_status = EXIT_FAILURE;
- } else if(statbuf.type == H5G_LINK) { /* Soft link */
- char *buf = HDmalloc(statbuf.linklen);
-
- begin_obj(dump_header_format->softlinkbegin, links,
- dump_header_format->softlinkblockbegin);
- indentation(COL);
-
- if(H5Lget_val(fid, links, buf, statbuf.linklen, H5P_DEFAULT) >= 0) {
- printf("LINKTARGET \"%s\"\n", buf);
- } else {
- error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
- links);
- d_status = EXIT_FAILURE;
- }
+ } else if(linfo.type == H5L_TYPE_HARD) {
+ error_msg(progname, "\"%s\" is a hard link\n", links);
+ d_status = EXIT_FAILURE;
+ } else {
+ char *buf = HDmalloc(linfo.u.val_size);
- end_obj(dump_header_format->softlinkend,
- dump_header_format->softlinkblockend);
- HDfree(buf);
- } else if(statbuf.type == H5G_UDLINK) { /* User-defined link */
- char *buf = HDmalloc(statbuf.linklen);
- begin_obj(dump_header_format->udlinkbegin, links,
- dump_header_format->udlinkblockbegin);
- indentation(COL);
switch(linfo.type) {
+ case H5L_TYPE_SOFT: /* Soft link */
+ begin_obj(dump_header_format->softlinkbegin, links,
+ dump_header_format->softlinkblockbegin);
+ indentation(COL);
+ if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0)
+ printf("LINKTARGET \"%s\"\n", buf);
+ else {
+ error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
+ links);
+ d_status = EXIT_FAILURE;
+ }
+ end_obj(dump_header_format->softlinkend,
+ dump_header_format->softlinkblockend);
+ break;
+
case H5L_TYPE_EXTERNAL:
+ begin_obj(dump_header_format->udlinkbegin, links,
+ dump_header_format->udlinkblockbegin);
+ indentation(COL);
begin_obj(dump_header_format->extlinkbegin, links,
dump_header_format->extlinkblockbegin);
- if(H5Lget_val(fid, links, buf, statbuf.linklen, H5P_DEFAULT) >= 0) {
+ if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
const char *elink_file;
const char *elink_path;
- if(H5Lunpack_elink_val(buf, statbuf.linklen, NULL, &elink_file, &elink_path)>=0) {
+ if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) {
indentation(COL);
printf("LINKCLASS %d\n", linfo.type);
indentation(COL);
@@ -3250,26 +3189,28 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
error_msg(progname, "h5dump error: unable to unpack external link value for \"%s\"\n", links);
d_status = EXIT_FAILURE;
}
- } else {
- error_msg(progname, "h5dump error: unable to get external link value for \"%s\"\n", links);
- d_status = EXIT_FAILURE;
- }
- end_obj(dump_header_format->extlinkend,
- dump_header_format->extlinkblockend);
- break;
- default:
- begin_obj(dump_header_format->udlinkbegin, links,
- dump_header_format->udlinkblockbegin);
- indentation(COL);
- printf("LINKCLASS %d\n", linfo.type);
- end_obj(dump_header_format->udlinkend,
- dump_header_format->udlinkblockend);
- }
+ } else {
+ error_msg(progname, "h5dump error: unable to get external link value for \"%s\"\n", links);
+ d_status = EXIT_FAILURE;
+ }
+ end_obj(dump_header_format->extlinkend,
+ dump_header_format->extlinkblockend);
+ break;
+
+ default:
+ begin_obj(dump_header_format->udlinkbegin, links,
+ dump_header_format->udlinkblockbegin);
+ indentation(COL);
+ begin_obj(dump_header_format->udlinkbegin, links,
+ dump_header_format->udlinkblockbegin);
+ indentation(COL);
+ printf("LINKCLASS %d\n", linfo.type);
+ end_obj(dump_header_format->udlinkend,
+ dump_header_format->udlinkblockend);
+ break;
+ } /* end switch */
HDfree(buf);
- } else {
- error_msg(progname, "\"%s\" is not a link\n", links);
- d_status = EXIT_FAILURE;
- }
+ } /* end else */
}
/*-------------------------------------------------------------------------
@@ -3292,14 +3233,14 @@ handle_datatypes(hid_t fid, char *type, void UNUSED * data)
hid_t type_id;
if ((type_id = H5Topen(fid, type)) < 0) {
- /* check if type is unamed data type */
+ /* check if type is unamed datatype */
unsigned idx = 0;
while (idx < type_table->nobjs ) {
char name[128];
if (!type_table->objs[idx].recorded) {
- /* unamed data type */
+ /* unamed datatype */
sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
if (!HDstrcmp(name, type))
@@ -3733,27 +3674,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",
@@ -3778,9 +3719,8 @@ main(int argc, const char *argv[])
/* allocate and initialize internal data structure */
init_prefix(&prefix, prefix_len);
- /* find all objects that might be targets of a refernce */
- init_ref_path_table(fid); /* Insert the root group into the ref. path table */
- H5Literate(fid, (const char *)"/", H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table, (void *)"", H5P_DEFAULT);
+ /* find all objects that might be targets of a reference */
+ fill_ref_path_table(fid);
if(doxml) {
/* initialize XML */
@@ -3811,7 +3751,7 @@ main(int argc, const char *argv[])
goto done;
}
- /* does there exist unamed committed data type */
+ /* does there exist unamed committed datatype */
for (u = 0; u < type_table->nobjs; u++)
if (!type_table->objs[u].recorded) {
unamedtype = 1;
@@ -3824,12 +3764,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",
@@ -3848,11 +3788,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 {
- printf("<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n",
- xml_dtd_uri);
- printf("<HDF5-File>\n");
- }
+ } else {
+ printf("<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n",
+ xml_dtd_uri);
+ printf("<HDF5-File>\n");
+ }
}
if (!doxml) {
@@ -3942,7 +3882,7 @@ print_enum(hid_t type)
unsigned nmembs; /*number of members */
int nchars; /*number of output characters */
hid_t super; /*enum base integer type */
- hid_t native = -1; /*native integer data type */
+ hid_t native = -1; /*native integer datatype */
size_t dst_size; /*destination value type size */
unsigned i;
@@ -3951,7 +3891,7 @@ print_enum(hid_t type)
super = H5Tget_super(type);
/*
- * Determine what data type to use for the native values. To simplify
+ * Determine what datatype to use for the native values. To simplify
* things we entertain three possibilities:
* 1. long_long -- the largest native signed integer
* 2. unsigned long_long -- the largest native unsigned integer
@@ -3978,7 +3918,7 @@ print_enum(hid_t type)
H5Tget_member_value(type, i, value + i * H5Tget_size(type));
}
- /* Convert values to native data type */
+ /* Convert values to native datatype */
if (native > 0)
H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT);
@@ -4300,32 +4240,32 @@ xml_print_datatype(hid_t type, unsigned in_group)
int nmembs;
htri_t is_vlstr=FALSE;
- if (!in_group && H5Tcommitted(type) > 0) {
- H5G_stat_t statbuf;
- haddr_t objno; /* Compact form of object's location */
+ if(!in_group && H5Tcommitted(type) > 0) {
+ H5O_info_t oinfo;
obj_t *found_obj; /* Found object */
/* detect a shared datatype, output only once */
- 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);
+ H5Oget_info(type, ".", &oinfo, H5P_DEFAULT);
+ found_obj = search_obj(type_table, oinfo.addr);
- if (found_obj) {
+ if(found_obj) {
/* This should be defined somewhere else */
/* These 2 cases are handled the same right now, but
probably will have something different eventually */
char * dtxid = malloc(100);
- xml_name_to_XID(found_obj->objname,dtxid,100,1);
+
+ xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
/* 'anonymous' NDT. Use it's object num.
as it's name. */
printf("<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>\n",
- xmlnsprefix, dtxid);
+ xmlnsprefix, dtxid);
} else {
/* point to the NDT by name */
char *t_objname = xml_escape_the_name(found_obj->objname);
+
printf("<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n",
- xmlnsprefix, dtxid,t_objname);
+ xmlnsprefix, dtxid, t_objname);
free(t_objname);
}
free(dtxid);
@@ -4333,311 +4273,310 @@ xml_print_datatype(hid_t type, unsigned in_group)
printf("<!-- h5dump error: unknown committed type. -->\n");
d_status = EXIT_FAILURE;
}
-
} else {
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
- ord = H5Tget_order(type);
- sgn = H5Tget_sign(type);
- indentation(indent);
- printf("<%sIntegerType ByteOrder=\"",xmlnsprefix);
- switch (ord) {
- case H5T_ORDER_LE:
- printf("LE");
- break;
- case H5T_ORDER_BE:
- printf("BE");
+ case H5T_INTEGER:
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
+ ord = H5Tget_order(type);
+ sgn = H5Tget_sign(type);
+ indentation(indent);
+ printf("<%sIntegerType ByteOrder=\"",xmlnsprefix);
+ switch (ord) {
+ case H5T_ORDER_LE:
+ printf("LE");
+ break;
+ case H5T_ORDER_BE:
+ printf("BE");
+ break;
+ case H5T_ORDER_VAX:
+ default:
+ printf("ERROR_UNKNOWN");
+ }
+ printf("\" Sign=\"");
+ switch (sgn) {
+ case H5T_SGN_NONE:
+ printf("false");
+ break;
+ case H5T_SGN_2:
+ printf("true");
+ break;
+ default:
+ printf("ERROR_UNKNOWN");
+ }
+ printf("\" Size=\"");
+ sz = H5Tget_size(type);
+ printf("%lu", (unsigned long)sz);
+ printf("\" />\n");
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
break;
- case H5T_ORDER_VAX:
- default:
- printf("ERROR_UNKNOWN");
- }
- printf("\" Sign=\"");
- switch (sgn) {
- case H5T_SGN_NONE:
- printf("false");
+
+ case H5T_FLOAT:
+ /* <hdf5:FloatType ByteOrder="bo" Size="bytes"
+ SignBitLocation="bytes"
+ ExponentBits="eb" ExponentLocation="el"
+ MantissaBits="mb" MantissaLocation="ml" /> */
+ ord = H5Tget_order(type);
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sFloatType ByteOrder=\"",xmlnsprefix);
+ switch (ord) {
+ case H5T_ORDER_LE:
+ printf("LE");
+ break;
+ case H5T_ORDER_BE:
+ printf("BE");
+ break;
+ case H5T_ORDER_VAX:
+ printf("VAX");
+ break;
+ default:
+ printf("ERROR_UNKNOWN");
+ }
+ printf("\" Size=\"");
+ sz = H5Tget_size(type);
+ printf("%lu", (unsigned long)sz);
+ H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
+ printf("\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
+ printf("ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
+ printf("MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />\n",
+ (unsigned long)msize, (unsigned long)mpos);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
break;
- case H5T_SGN_2:
- printf("true");
+
+ case H5T_TIME:
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sTimeType />\n",xmlnsprefix);
+ printf("<!-- H5T_TIME: not yet implemented -->");
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
break;
- default:
- printf("ERROR_UNKNOWN");
- }
- printf("\" Size=\"");
- sz = H5Tget_size(type);
- printf("%lu", (unsigned long)sz);
- printf("\" />\n");
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
- case H5T_FLOAT:
- /* <hdf5:FloatType ByteOrder="bo" Size="bytes"
- SignBitLocation="bytes"
- ExponentBits="eb" ExponentLocation="el"
- MantissaBits="mb" MantissaLocation="ml" /> */
- ord = H5Tget_order(type);
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sFloatType ByteOrder=\"",xmlnsprefix);
- switch (ord) {
- case H5T_ORDER_LE:
- printf("LE");
+ case H5T_STRING:
+ /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
+ size = H5Tget_size(type);
+ str_pad = H5Tget_strpad(type);
+ cset = H5Tget_cset(type);
+ is_vlstr = H5Tis_variable_str(type);
+
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sStringType Cset=\"",xmlnsprefix);
+ if (cset == H5T_CSET_ASCII) {
+ printf("H5T_CSET_ASCII\" ");
+ } else {
+ printf("unknown_cset\" ");
+ }
+ if(is_vlstr)
+ printf("StrSize=\"H5T_VARIABLE\" StrPad=\"");
+ else
+ printf("StrSize=\"%d\" StrPad=\"", (int) size);
+ if (str_pad == H5T_STR_NULLTERM) {
+ printf("H5T_STR_NULLTERM\"/>\n");
+ } else if (str_pad == H5T_STR_NULLPAD) {
+ printf("H5T_STR_NULLPAD\"/>\n");
+ } else if (str_pad == H5T_STR_SPACEPAD) {
+ printf("H5T_STR_SPACEPAD\"/>\n");
+ } else {
+ printf("H5T_STR_ERROR\"/>\n");
+ }
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
break;
- case H5T_ORDER_BE:
- printf("BE");
+
+ case H5T_BITFIELD:
+ /* <hdf5:BitfieldType ByteOrder="bo" Size="bytes"/> */
+ ord = H5Tget_order(type);
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sBitfieldType ByteOrder=\"",xmlnsprefix);
+ switch (ord) {
+ case H5T_ORDER_LE:
+ printf("LE");
+ break;
+ case H5T_ORDER_BE:
+ printf("BE");
+ break;
+ case H5T_ORDER_VAX:
+ default:
+ printf("ERROR_UNKNOWN");
+ }
+ size = H5Tget_size(type);
+ printf("\" Size=\"%lu\"/>\n", (unsigned long)size);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
break;
- case H5T_ORDER_VAX:
- printf("VAX");
- break;
- default:
- printf("ERROR_UNKNOWN");
- }
- printf("\" Size=\"");
- sz = H5Tget_size(type);
- printf("%lu", (unsigned long)sz);
- H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
- printf("\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
- printf("ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
- printf("MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />\n",
- (unsigned long)msize, (unsigned long)mpos);
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
- case H5T_TIME:
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sTimeType />\n",xmlnsprefix);
- printf("<!-- H5T_TIME: not yet implemented -->");
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
+ case H5T_OPAQUE:
+ /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, H5Tget_tag(type));
+ size = H5Tget_size(type);
+ printf("Size=\"%lu\"/>\n", (unsigned long)size);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
+ break;
- case H5T_STRING:
- /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
- size = H5Tget_size(type);
- str_pad = H5Tget_strpad(type);
- cset = H5Tget_cset(type);
- is_vlstr = H5Tis_variable_str(type);
+ case H5T_COMPOUND:
+ /* recursively describe the components of a compound datatype */
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sStringType Cset=\"",xmlnsprefix);
- if (cset == H5T_CSET_ASCII) {
- printf("H5T_CSET_ASCII\" ");
- } else {
- printf("unknown_cset\" ");
- }
- if(is_vlstr)
- printf("StrSize=\"H5T_VARIABLE\" StrPad=\"");
- else
- printf("StrSize=\"%d\" StrPad=\"", (int) size);
- if (str_pad == H5T_STR_NULLTERM) {
- printf("H5T_STR_NULLTERM\"/>\n");
- } else if (str_pad == H5T_STR_NULLPAD) {
- printf("H5T_STR_NULLPAD\"/>\n");
- } else if (str_pad == H5T_STR_SPACEPAD) {
- printf("H5T_STR_SPACEPAD\"/>\n");
- } else {
- printf("H5T_STR_ERROR\"/>\n");
- }
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
+ /* type of a dataset */
+ nmembers = H5Tget_nmembers(type);
- case H5T_BITFIELD:
- /* <hdf5:BitfieldType ByteOrder="bo" Size="bytes"/> */
- ord = H5Tget_order(type);
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sBitfieldType ByteOrder=\"",xmlnsprefix);
- switch (ord) {
- case H5T_ORDER_LE:
- printf("LE");
- break;
- case H5T_ORDER_BE:
- printf("BE");
- break;
- case H5T_ORDER_VAX:
- default:
- printf("ERROR_UNKNOWN");
- }
- size = H5Tget_size(type);
- printf("\" Size=\"%lu\"/>\n", (unsigned long)size);
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
+ indentation(indent);
+ printf("<%sCompoundType>\n",xmlnsprefix);
- case H5T_OPAQUE:
- /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, H5Tget_tag(type));
- size = H5Tget_size(type);
- printf("Size=\"%lu\"/>\n", (unsigned long)size);
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
+ /* List each member Field of the type */
+ /* <hdf5:Field FieldName="name" > */
+ /* <hdf5:DataType > */
+ indent += COL;
+ for (i = 0; i < nmembers; i++) {
+ char *t_fname;
- case H5T_COMPOUND:
- /* recursively describe the components of a compound datatype */
+ mname = H5Tget_member_name(type, i);
+ mtype = H5Tget_member_type(type, i);
+ indentation(indent);
+ t_fname = xml_escape_the_name(mname);
+ printf("<%sField FieldName=\"%s\">\n",xmlnsprefix, t_fname);
- /* type of a dataset */
- nmembers = H5Tget_nmembers(type);
+ free(mname);
+ free(t_fname);
+ indent += COL;
+ indentation(indent);
+ printf("<%sDataType>\n",xmlnsprefix);
+ indent += COL;
+ xml_print_datatype(mtype,0);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sDataType>\n",xmlnsprefix);
+ indent -= COL;
- indentation(indent);
- printf("<%sCompoundType>\n",xmlnsprefix);
+ indentation(indent);
+ printf("</%sField>\n",xmlnsprefix);
+ }
+ indent -= COL;
+ indentation(indent);
+ printf("</%sCompoundType>\n",xmlnsprefix);
+ break;
- /* List each member Field of the type */
- /* <hdf5:Field FieldName="name" > */
- /* <hdf5:DataType > */
- indent += COL;
- for (i = 0; i < nmembers; i++) {
- char *t_fname;
+ case H5T_REFERENCE:
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ /* Only Object references supported at this time */
+ printf("<%sReferenceType>\n",xmlnsprefix);
+ indentation(indent + COL);
+ printf("<%sObjectReferenceType />\n",xmlnsprefix);
+ indentation(indent);
+ printf("</%sReferenceType>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
+ break;
- mname = H5Tget_member_name(type, i);
- mtype = H5Tget_member_type(type, i);
+ case H5T_ENUM:
+ /* <hdf5:EnumType Nelems="ne" >
+ list Name, values of enum
+ */
+ nmembs = H5Tget_nmembers(type);
+ indentation(indent);
+ printf("<%sAtomicType>\n",xmlnsprefix);
+ indent += COL;
+ indentation(indent);
+ printf("<%sEnumType Nelems=\"%d\">\n",xmlnsprefix, nmembs);
+ xml_print_enum(type);
indentation(indent);
- t_fname = xml_escape_the_name(mname);
- printf("<%sField FieldName=\"%s\">\n",xmlnsprefix, t_fname);
+ printf("</%sEnumType>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sAtomicType>\n",xmlnsprefix);
+ break;
- free(mname);
- free(t_fname);
+ case H5T_VLEN:
+ indentation(indent);
+ printf("<%sVLType>\n",xmlnsprefix);
+ super = H5Tget_super(type);
indent += COL;
indentation(indent);
printf("<%sDataType>\n",xmlnsprefix);
indent += COL;
- xml_print_datatype(mtype,0);
+ xml_print_datatype(super,0);
indent -= COL;
indentation(indent);
printf("</%sDataType>\n",xmlnsprefix);
indent -= COL;
-
indentation(indent);
- printf("</%sField>\n",xmlnsprefix);
- }
- indent -= COL;
- indentation(indent);
- printf("</%sCompoundType>\n",xmlnsprefix);
- break;
-
- case H5T_REFERENCE:
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- /* Only Object references supported at this time */
- printf("<%sReferenceType>\n",xmlnsprefix);
- indentation(indent + COL);
- printf("<%sObjectReferenceType />\n",xmlnsprefix);
- indentation(indent);
- printf("</%sReferenceType>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
-
- case H5T_ENUM:
- /* <hdf5:EnumType Nelems="ne" >
- list Name, values of enum
- */
- nmembs = H5Tget_nmembers(type);
- indentation(indent);
- printf("<%sAtomicType>\n",xmlnsprefix);
- indent += COL;
- indentation(indent);
- printf("<%sEnumType Nelems=\"%d\">\n",xmlnsprefix, nmembs);
- xml_print_enum(type);
- indentation(indent);
- printf("</%sEnumType>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sAtomicType>\n",xmlnsprefix);
- break;
+ printf("</%sVLType>\n",xmlnsprefix);
+ H5Tclose(super);
- case H5T_VLEN:
- indentation(indent);
- printf("<%sVLType>\n",xmlnsprefix);
- super = H5Tget_super(type);
- indent += COL;
- indentation(indent);
- printf("<%sDataType>\n",xmlnsprefix);
- indent += COL;
- xml_print_datatype(super,0);
- indent -= COL;
- indentation(indent);
- printf("</%sDataType>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sVLType>\n",xmlnsprefix);
- H5Tclose(super);
+ break;
- break;
+ case H5T_ARRAY:
+ /* Get array base type */
+ super = H5Tget_super(type);
- case H5T_ARRAY:
- /* Get array base type */
- super = H5Tget_super(type);
+ /* Print lead-in */
+ indentation(indent);
+ printf("<%sArrayType Ndims=\"",xmlnsprefix);
+ ndims = H5Tget_array_ndims(type);
+ printf("%u\">\n", ndims);
- /* Print lead-in */
- indentation(indent);
- printf("<%sArrayType Ndims=\"",xmlnsprefix);
- ndims = H5Tget_array_ndims(type);
- printf("%u\">\n", ndims);
+ /* Get array information */
+ H5Tget_array_dims(type, dims, NULL);
- /* Get array information */
- H5Tget_array_dims(type, dims, NULL);
+ /* list of dimensions */
+ indent += COL;
+ for (i = 0; i < ndims; i++) {
+ indentation(indent);
+ printf("<%sArrayDimension DimSize=\"%u\"/>\n",
+ xmlnsprefix,
+ (int) dims[i]);
+ }
+ indent -= COL;
- /* list of dimensions */
- indent += COL;
- for (i = 0; i < ndims; i++) {
+ indent += COL;
indentation(indent);
- printf("<%sArrayDimension DimSize=\"%u\"/>\n",
- xmlnsprefix,
- (int) dims[i]);
- }
- indent -= COL;
-
- indent += COL;
- indentation(indent);
- printf("<%sDataType>\n",xmlnsprefix);
- indent += COL;
- xml_print_datatype(super,0);
- indent -= COL;
- indentation(indent);
- printf("</%sDataType>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sArrayType>\n",xmlnsprefix);
- /* Close array base type */
- H5Tclose(super);
- break;
+ printf("<%sDataType>\n",xmlnsprefix);
+ indent += COL;
+ xml_print_datatype(super,0);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sDataType>\n",xmlnsprefix);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sArrayType>\n",xmlnsprefix);
+ /* Close array base type */
+ H5Tclose(super);
+ break;
- default:
- printf("<!-- unknown data type -->");
- d_status = EXIT_FAILURE;
- break;
+ default:
+ printf("<!-- unknown datatype -->");
+ d_status = EXIT_FAILURE;
+ break;
}
} /* end else */
}
@@ -4662,51 +4601,51 @@ xml_dump_datatype(hid_t type)
indent += COL;
indentation(indent);
- if (H5Tcommitted(type) > 0) {
- H5G_stat_t statbuf;
- haddr_t objno; /* Compact form of object's location */
+ if(H5Tcommitted(type) > 0) {
+ H5O_info_t oinfo;
obj_t *found_obj; /* Found object */
- /* 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);
+ /* Datatype is a shared or named datatype */
+ H5Oget_info(type, ".", &oinfo, H5P_DEFAULT);
+ found_obj = search_obj(type_table, oinfo.addr);
- } else {
- /* pointer to a named data type already in XML */
+ if(found_obj) {
+ /* Shared datatype, 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 datatype:
+ 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 datatype 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);
+
+ 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");
}
- free(dtxid);
- } else {
- printf("<!-- h5dump error: unknown committed type. -->\n");
+ indent -= COL;
}
- indent -= COL;
- return;
+ else {
+ printf("<%sDataType>\n", xmlnsprefix);
+ indent += COL;
+ xml_print_datatype(type, 0);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sDataType>\n", xmlnsprefix);
+ indent -= COL;
}
- printf("<%sDataType>\n",xmlnsprefix);
- indent += COL;
- xml_print_datatype(type,0);
- indent -= COL;
- indentation(indent);
- printf("</%sDataType>\n",xmlnsprefix);
- indent -= COL;
}
/*-------------------------------------------------------------------------
@@ -4738,47 +4677,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 );
+ 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 );
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);
@@ -4829,60 +4768,59 @@ 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);
- }
- } 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);
+ 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 {
- /* all other data */
+ /* 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 */
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);
+ 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);
@@ -4917,104 +4855,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;
+ 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_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_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);
- }
- indentation(indent);
- printf("</%sData>\n",xmlnsprefix);
- 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);
+ }
+ 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;
+ 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);
}
- } 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;
+ 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;
}
}
@@ -5047,29 +4985,30 @@ xml_dump_named_datatype(hid_t type, const char *name)
HDstrcat(tmp, name);
indentation(indent);
- /*char **/ dtxid = HDmalloc(100);
- /*char **/ parentxid = HDmalloc(100);
- /*char **/t_tmp = xml_escape_the_name(tmp);
- /*char **/t_prefix = xml_escape_the_name(prefix);
- /*char **/t_name = xml_escape_the_name(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\" "
+ dtxid = HDmalloc(100);
+ parentxid = HDmalloc(100);
+ t_tmp = xml_escape_the_name(tmp);
+ t_prefix = xml_escape_the_name(prefix);
+ t_name = xml_escape_the_name(name);
+
+ xml_name_to_XID(tmp, dtxid, 100, 1);
+ xml_name_to_XID(prefix, parentxid, 100, 1);
+ if(HDstrncmp(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 : "/"));
} else {
- printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
"H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n",
xmlnsprefix,
t_name, dtxid,
@@ -5114,70 +5053,65 @@ xml_dump_named_datatype(hid_t type, const char *name)
static void
xml_dump_group(hid_t gid, const char *name)
{
- H5G_stat_t statbuf;
- haddr_t objno; /* Compact form of object's location */
+ H5O_info_t oinfo;
char *cp;
hid_t dset, type;
char type_name[1024], *tmp = NULL;
char *par = NULL;
int isRoot = 0;
- int xtype;
char *ptrstr;
char *t_objname;
char *par_name;
- if (HDstrcmp(name, "/") == 0) {
- isRoot = 1;
- tmp = HDmalloc(2);
- HDstrcpy(tmp, "/");
+ if(HDstrcmp(name, "/") == 0) {
+ 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) {
+ if((cp == par) && HDstrlen(par) > 1)
+ *(cp + 1) = '\0';
+ else
+ *cp = '\0';
}
}
- }
indentation(indent);
-
indent += COL;
- H5Gget_objinfo(gid, ".", TRUE, &statbuf);
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- if (statbuf.nlink > 1) {
+ H5Oget_info(gid, ".", &oinfo, H5P_DEFAULT);
+ if(oinfo.rc > 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, oinfo.addr);
- 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 == NULL) {
+ indentation(indent);
+ error_msg(progname, "internal error (file %s:line %d)\n",
+ __FILE__, __LINE__);
+ d_status = EXIT_FAILURE;
+ } else {
char *t_name = xml_escape_the_name(name);
char *grpxid = malloc(100);
char *parentxid = malloc(100);
- if (found_obj->displayed) {
+ if(found_obj->displayed) {
/* already seen: enter a groupptr */
- if (isRoot) {
+ if(isRoot) {
/* probably can't happen! */
- xml_name_to_XID("/",grpxid,100,1);
+ xml_name_to_XID("/", grpxid, 100, 1);
printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n",
- xmlnsprefix,grpxid,"/");
+ xmlnsprefix, grpxid, "/");
} else {
t_objname = xml_escape_the_name(found_obj->objname);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp,grpxid,100,1);
- xml_name_to_XID(par,parentxid,100,1);
+ xml_name_to_XID(tmp, grpxid, 100, 1);
+ xml_name_to_XID(par, parentxid, 100, 1);
printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
"Parents=\"%s\" H5ParentPaths=\"%s\">\n",
xmlnsprefix,t_name, grpxid, get_next_xid(),
@@ -5198,22 +5132,22 @@ xml_dump_group(hid_t gid, const char *name)
ptrstr, t_objname, parentxid, par_name);
free(t_objname);
free(par_name);
-
} else {
/* first time this group has been seen -- describe it */
- if (isRoot) {
- xml_name_to_XID("/",grpxid,100,1);
+ if(isRoot) {
+ xml_name_to_XID("/", grpxid, 100, 1);
printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n",
- xmlnsprefix,grpxid,"/");
+ 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);
+ 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);
+ xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name);
free(t_tmp);
free(par_name);
}
@@ -5223,12 +5157,12 @@ xml_dump_group(hid_t gid, const char *name)
H5Aiterate(gid, NULL,
dump_function_table->dump_attribute_function, NULL);
- if (!strcmp(name, "/") && unamedtype) {
+ if(isRoot && 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) {
+ 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);
@@ -5239,17 +5173,8 @@ xml_dump_group(hid_t gid, const char *name)
}
}
- /* iterate through all the members */
- xtype = H5G_TYPE;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_DATASET;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_GROUP;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_LINK;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_UDLINK;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
+ /* iterate through all the links */
+ H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, NULL, H5P_DEFAULT);
}
free(t_name);
free(grpxid);
@@ -5258,41 +5183,43 @@ xml_dump_group(hid_t gid, const char *name)
} else {
/* only link -- must be first time! */
- char *t_name = xml_escape_the_name(name);
+ 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);
+
+ if(isRoot) {
+ xml_name_to_XID("/", grpxid, 100, 1);
printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n",
- xmlnsprefix,grpxid,"/");
+ 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);
+ 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);
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >\n",
+ xmlnsprefix, t_name, grpxid, t_tmp,
+ parentxid, par_name);
free(t_tmp);
free(par_name);
}
- free(t_name);
+ free(t_name);
free(grpxid);
free(parentxid);
/* 1. do all the attributes of the group */
H5Aiterate(gid, NULL, dump_function_table->dump_attribute_function, NULL);
- if (!strcmp(name, "/") && unamedtype) {
+ if(isRoot && 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) {
+ 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);
+ 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);
@@ -5300,26 +5227,16 @@ xml_dump_group(hid_t gid, const char *name)
}
}
- /* iterate through all the members */
- xtype = H5G_TYPE;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_DATASET;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_GROUP;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_LINK;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
- xtype = H5G_UDLINK;
- H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT);
+ /* iterate through all the links */
+ H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, NULL, H5P_DEFAULT);
}
indent -= COL;
indentation(indent);
- if (isRoot) {
- printf("</%sRootGroup>\n",xmlnsprefix);
- } else {
- printf("</%sGroup>\n" ,xmlnsprefix);
- }
+ if(isRoot)
+ printf("</%sRootGroup>\n", xmlnsprefix);
+ else
+ printf("</%sGroup>\n" , xmlnsprefix);
free(tmp);
}
@@ -5347,53 +5264,55 @@ 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;
- }
- if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
- /* 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 an error */
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);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ /* 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;
+ }
} else if (source == ATTRIBUTE_DATA) {
- space = H5Aget_space(did);
- ssiz = H5Sget_simple_extent_npoints(space);
- ssiz *= H5Tget_size(type);
+ 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 */
+ 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 */
+ if(e < 0) {
+ free(buf);
+ return FAIL;
+ }
} else {
- /* error */
- return FAIL;
+ /* error */
+ return FAIL;
}
refbuf = (hobj_ref_t *) buf;
@@ -5402,19 +5321,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);
@@ -5449,54 +5368,50 @@ 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);
-
- buf = malloc((size_t)ssiz);
-
- if (buf == NULL) {
- return FAIL;
- }
+ space = H5Dget_space(did);
+ ssiz = H5Sget_simple_extent_npoints(space);
+ ssiz *= H5Tget_size(type);
- e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ buf = malloc((size_t)ssiz);
+ if(buf == NULL)
+ return FAIL;
- if (e < 0) {
- free(buf);
- return FAIL;
- }
+ e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ 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);
+ space = H5Aget_space(did);
+ ssiz = H5Sget_simple_extent_npoints(space);
+ ssiz *= H5Tget_size(type);
- buf = malloc((size_t)ssiz);
- if (buf == NULL) {
- return FAIL;
- }
+ buf = malloc((size_t)ssiz);
+ if(buf == NULL)
+ return FAIL;
- e = H5Aread(did, type, buf);
- if (e < 0) {
- free(buf);
- 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... */
@@ -5516,16 +5431,16 @@ xml_print_strs(hid_t did, int source)
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;
}
@@ -5560,72 +5475,72 @@ 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,
+ filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
(size_t *) &cd_nelmts,
cd_values, 120, namebuf);
#else
- filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
+ 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) {
+ 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);
+ 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) {
- 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) {
- printf("Entropy");
- } else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) {
- printf("NN");
- }
- printf("\" ");
+ /* 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) {
+ printf("Entropy");
+ } else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) {
+ printf("NN");
+ }
+ printf("\" ");
- printf("ByteOrder=\"");
- if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) {
- printf("LSB");
- } else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) {
- printf("MSB");
- }
- printf("\" ");
+ printf("ByteOrder=\"");
+ 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) {
- printf("Header=\"Raw\"");
- }
+ if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) {
+ printf("Header=\"Raw\"");
+ }
printf("/>\n");
- } else {
- /* unknown option */
- }
+ } else {
+ /* unknown option */
+ }
}
}
@@ -5675,76 +5590,76 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* all other data */
switch (H5Tget_class(type)) {
case H5T_INTEGER:
- indentation(indent);
- printf("<%sDataFromFile>\n",xmlnsprefix);
- indentation(indent);
- printf("\"%d\"\n",*(int *)buf);
- indentation(indent);
- printf("</%sDataFromFile>\n",xmlnsprefix);
- break;
+ indentation(indent);
+ printf("<%sDataFromFile>\n",xmlnsprefix);
+ indentation(indent);
+ printf("\"%d\"\n",*(int *)buf);
+ indentation(indent);
+ printf("</%sDataFromFile>\n",xmlnsprefix);
+ break;
case H5T_FLOAT:
- indentation(indent);
- printf("<%sDataFromFile>\n",xmlnsprefix);
- indentation(indent);
- printf("\"%f\"\n",*(float *)buf);
- indentation(indent);
- printf("</%sDataFromFile>\n",xmlnsprefix);
- break;
+ indentation(indent);
+ printf("<%sDataFromFile>\n",xmlnsprefix);
+ indentation(indent);
+ printf("\"%f\"\n",*(float *)buf);
+ indentation(indent);
+ printf("</%sDataFromFile>\n",xmlnsprefix);
+ break;
case H5T_BITFIELD:
case H5T_OPAQUE:
- indentation(indent);
- printf("<%sDataFromFile>\n",xmlnsprefix);
- sz = H5Tget_size(type);
- indentation(indent);
- printf("\"");
- for (i = 0; i < sz; i++) {
- printf("%x ",*(unsigned int *)buf);
- buf = (char *)buf + sizeof(unsigned int);
- }
- printf("\"\n");
- indentation(indent);
- printf("</%sDataFromFile>\n",xmlnsprefix);
- break;
+ indentation(indent);
+ printf("<%sDataFromFile>\n",xmlnsprefix);
+ sz = H5Tget_size(type);
+ indentation(indent);
+ printf("\"");
+ for (i = 0; i < sz; i++) {
+ printf("%x ",*(unsigned int *)buf);
+ buf = (char *)buf + sizeof(unsigned int);
+ }
+ printf("\"\n");
+ indentation(indent);
+ printf("</%sDataFromFile>\n",xmlnsprefix);
+ break;
case H5T_ENUM:
- indentation(indent);
- printf("<%sDataFromFile>\n",xmlnsprefix);
- name = H5Tget_member_name(type, *(unsigned *)buf);
- indentation(indent);
- printf("\"%s\"\n",name);
- indentation(indent);
- printf("</%sDataFromFile>\n",xmlnsprefix);
- break;
+ indentation(indent);
+ printf("<%sDataFromFile>\n",xmlnsprefix);
+ name = H5Tget_member_name(type, *(unsigned *)buf);
+ indentation(indent);
+ printf("\"%s\"\n",name);
+ indentation(indent);
+ printf("</%sDataFromFile>\n",xmlnsprefix);
+ break;
case H5T_ARRAY:
- indentation(indent);
+ indentation(indent);
printf("<!-- Array fill values not yet implemented. -->\n");
indentation(indent);
printf("<%sNoData />\n",xmlnsprefix);
break;
case H5T_TIME:
- indentation(indent);
+ indentation(indent);
printf("<!-- Time fill not yet implemented. -->\n");
indentation(indent);
printf("<%sNoData />\n",xmlnsprefix);
break;
case H5T_COMPOUND:
- indentation(indent);
+ indentation(indent);
printf("<!-- Compound fill not yet implemented. -->\n");
indentation(indent);
printf("<%sNoData />\n",xmlnsprefix);
break;
- case H5T_VLEN:
- indentation(indent);
+ case H5T_VLEN:
+ indentation(indent);
printf("<!-- VL fill not yet implemented. -->\n");
indentation(indent);
printf("<%sNoData />\n",xmlnsprefix);
break;
- default:
- indentation(indent);
- printf("<!-- Unknown fill datatype: %d -->\n", H5Tget_class(type));
- indentation(indent);
- printf("<%sNoData/>\n",xmlnsprefix);
- break;
- }
+ default:
+ indentation(indent);
+ printf("<!-- Unknown fill datatype: %d -->\n", H5Tget_class(type));
+ indentation(indent);
+ printf("<%sNoData/>\n",xmlnsprefix);
+ break;
+ }
}
free(buf);
indent -= COL;
@@ -5811,67 +5726,67 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
space = H5Dget_space(did);
/* 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);
+ 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;
+ indent += COL;
- for (i = 0; i < ndims; i++) {
- indentation(indent);
- HDfprintf(stdout, "<%sChunkDimension DimSize=\"%Hu\" />\n",
- xmlnsprefix, chsize[i]);
- }
+ 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);
+ indentation(indent);
+ printf("<%sRequiredFilter>\n",xmlnsprefix);
+ indent += COL;
+ check_filters(dcpl);
+ indent -= COL;
+ indentation(indent);
+ printf("</%sRequiredFilter>\n",xmlnsprefix);
- indent -= COL;
+ indent -= COL;
- indentation(indent);
- printf("</%sChunkedLayout>\n",xmlnsprefix);
- indent -= COL;
- indentation(indent);
- printf("</%sStorageLayout>\n",xmlnsprefix);
- indent -= COL;
- free(chsize);
+ 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.... ?? */
@@ -5883,36 +5798,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:
- printf("FillOnAlloc");
- break;
- case H5D_FILL_TIME_NEVER:
- printf("FillNever");
- break;
- case H5D_FILL_TIME_IFSET:
- printf("FillIfSet");
- break;
- default:
- printf("?");
- break;
+ case H5D_FILL_TIME_ALLOC:
+ printf("FillOnAlloc");
+ break;
+ case H5D_FILL_TIME_NEVER:
+ printf("FillNever");
+ break;
+ case H5D_FILL_TIME_IFSET:
+ printf("FillIfSet");
+ break;
+ default:
+ printf("?");
+ break;
}
printf("\" ");
H5Pget_alloc_time(dcpl, &at);
printf("AllocationTime=\"");
switch ( at ) {
- case H5D_ALLOC_TIME_EARLY:
- printf("Early");
- break;
- case H5D_ALLOC_TIME_INCR:
- printf("Incremental");
- break;
- case H5D_ALLOC_TIME_LATE:
- printf("Late");
- break;
- case H5D_ALLOC_TIME_DEFAULT:
- default:
- printf("?");
- break;
+ case H5D_ALLOC_TIME_EARLY:
+ printf("Early");
+ break;
+ case H5D_ALLOC_TIME_INCR:
+ printf("Incremental");
+ break;
+ case H5D_ALLOC_TIME_LATE:
+ printf("Late");
+ break;
+ case H5D_ALLOC_TIME_DEFAULT:
+ default:
+ printf("?");
+ break;
}
printf("\"");
printf(">\n");
@@ -5948,77 +5863,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;
+ 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_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_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");
+ case H5T_REFERENCE:
indentation(indent);
- printf("<%sNoData />\n",xmlnsprefix);
- } else {
- printf("<%sDataFromFile>\n",xmlnsprefix);
- xml_print_refs(did, DATASET_DATA);
- indentation(indent);
- printf("</%sDataFromFile>\n",xmlnsprefix);
- }
- indentation(indent);
- printf("</%sData>\n",xmlnsprefix);
- break;
+ 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);
+ }
+ 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);
+ 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);
- printf("<!-- Unknown datatype: %d -->\n", H5Tget_class(type));
- indentation(indent);
+ indentation(indent + COL + COL);
printf("<%sNoData/>\n",xmlnsprefix);
- indentation(indent);
+ indentation(indent + COL);
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);
}
H5Tclose(type);
@@ -6045,13 +5960,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 */
+ 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 */
+ unsigned nmembs; /*number of members */
+ hid_t super; /*enum base integer type */
+ hid_t native = -1; /*native integer datatype */
+ size_t dst_size; /*destination value type size */
+ unsigned i; /*miscellaneous counters */
size_t j;
nmembs = H5Tget_nmembers(type);
@@ -6064,22 +5979,22 @@ xml_print_enum(hid_t type)
printf("</%sDataType>\n",xmlnsprefix);
/*
- * Determine what data type to use for the native values. To simplify
+ * Determine what datatype to use for the native values. To simplify
* things we entertain three possibilities:
* 1. long_long -- the largest native signed integer
* 2. unsigned long_long -- the largest native unsigned integer
* 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 */
@@ -6087,13 +6002,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 */
+ /* Convert values to native datatype */
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 */
@@ -6103,38 +6018,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);
@@ -6183,55 +6098,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,
+ /* 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;
- 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);
- }
+ /* 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;
- }
+ 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)
- return -1;
+ /* 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;
@@ -6240,14 +6154,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;
+ if (H5Pset_fapl_sec2(fapl)<0) return -1;
} else {
- /* Unknown driver */
- return -1;
+ /* Unknown driver */
+ return -1;
}
return fapl;
@@ -6297,5 +6211,3 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name)
HDstrcat(HDstrcat(*prfx, "/"), name);
} /* end add_prefix */
-
-