summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-09-13 15:44:56 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-09-13 15:44:56 (GMT)
commit579284f422b6ed25b7a5f4a518c19740fff297c8 (patch)
tree564b2a7b4c13854a19ffaf465f94e6abd52d6340 /tools
parent15d118faedd8e61e8ec2a715cf8fcea5b1afab35 (diff)
downloadhdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.zip
hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.gz
hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.bz2
[svn-r14144] Description:
Move H5Gget_objinfo() to deprecated symbols section and retarget internal usage to H5Lget_info()/H5Oget_info(). Misc. other code cleanups... Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) AIX/32 5.3 (copper) Solaris/32 2.10 (linew) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/h5diff_main.c38
-rw-r--r--tools/h5diff/ph5diff_main.c30
-rw-r--r--tools/h5dump/h5dump.c3698
-rw-r--r--tools/h5ls/h5ls.c565
-rw-r--r--tools/h5repack/h5repack_copy.c6
-rw-r--r--tools/h5repack/h5repack_refs.c832
-rw-r--r--tools/lib/h5diff.c1213
-rw-r--r--tools/lib/h5diff.h293
-rw-r--r--tools/lib/h5diff_array.c304
-rw-r--r--tools/lib/h5tools.c252
-rw-r--r--tools/lib/h5tools_ref.c208
-rw-r--r--tools/lib/h5tools_ref.h11
-rw-r--r--tools/lib/h5tools_str.c134
-rw-r--r--tools/lib/h5tools_str.h2
-rw-r--r--tools/lib/h5tools_utils.c73
-rw-r--r--tools/lib/h5trav.c20
-rw-r--r--tools/lib/h5trav.h37
-rw-r--r--tools/lib/ph5diff.h9
-rw-r--r--tools/testfiles/h5copytst.out.ls55
-rw-r--r--tools/testfiles/tall-1.ddl2
-rw-r--r--tools/testfiles/tall-2A.ddl2
-rw-r--r--tools/testfiles/tall-2A.h5.xml4
-rw-r--r--tools/testfiles/tall-2B.ddl2
-rw-r--r--tools/testfiles/tall.h5.xml4
-rw-r--r--tools/testfiles/tattr2.ls1
-rw-r--r--tools/testfiles/tcompound.h5.xml142
-rw-r--r--tools/testfiles/tcompound2.h5.xml142
-rw-r--r--tools/testfiles/tnamed_dtype_attr.h5.xml14
-rw-r--r--tools/testfiles/tnofilename.ddl2
-rw-r--r--tools/testfiles/tobjref.h5.xml54
-rw-r--r--tools/testfiles/tref.h5.xml58
-rw-r--r--tools/testfiles/tsaf.h5.xml578
-rw-r--r--tools/testfiles/tvlstr.h5.xml14
33 files changed, 4193 insertions, 4606 deletions
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 13059f2..c5c447c 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -65,29 +65,29 @@
int main(int argc, const char *argv[])
{
- int ret;
- const char *fname1 = NULL;
- const char *fname2 = NULL;
- const char *objname1 = NULL;
- const char *objname2 = NULL;
- hsize_t nfound=0;
- diff_opt_t options;
+ int ret;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ hsize_t nfound=0;
+ diff_opt_t options;
- parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
- nfound = h5diff(fname1,fname2,objname1,objname2,&options);
+ nfound = h5diff(fname1,fname2,objname1,objname2,&options);
- print_info(&options);
+ print_info(&options);
-/*-------------------------------------------------------------------------
- * exit code
- * >0 if differences, 0 if no differences, <0 if error
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * exit code
+ * >0 if differences, 0 if no differences, <0 if error
+ *-------------------------------------------------------------------------
+ */
- ret= (nfound==0 ? 0 : 1 );
- if (options.err_stat)
- ret=-1;
- return ret;
+ ret = (nfound == 0 ? 0 : 1 );
+ if(options.err_stat)
+ ret = -1;
+ return ret;
}
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index 989a74b..9cbc993 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -72,40 +72,40 @@ int main(int argc, const char *argv[])
if(g_nTasks == 1)
{
- printf("Only 1 task available...doing serial diff\n");
+ printf("Only 1 task available...doing serial diff\n");
- g_Parallel = 0;
+ g_Parallel = 0;
- parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
- nfound = h5diff(fname1,fname2,objname1,objname2,&options);
+ nfound = h5diff(fname1, fname2, objname1, objname2, &options);
- print_info(&options);
+ print_info(&options);
- MPI_Finalize();
+ MPI_Finalize();
- return 0;
+ return 0;
}
/* Have the manager process the command-line */
if(nID == 0)
{
- parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
- nfound = h5diff(fname1,fname2,objname1,objname2,&options);
+ nfound = h5diff(fname1, fname2, objname1, objname2, &options);
- MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Barrier(MPI_COMM_WORLD);
- print_info(&options);
- print_manager_output();
+ print_info(&options);
+ print_manager_output();
- MPI_Finalize();
+ MPI_Finalize();
- return 0;
+ return 0;
}
/* All other tasks become workers and wait for assignments. */
else
- ph5diff_worker(nID);
+ ph5diff_worker(nID);
}
/*-------------------------------------------------------------------------
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 */
-
-
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index c3c89a3..3d8104c 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -66,17 +66,17 @@ static struct dispatch_t {
herr_t (*close)(hid_t obj);
herr_t (*list1)(hid_t obj);
herr_t (*list2)(hid_t obj, const char *name);
-} dispatch_g[H5G_NLIBTYPES];
+} dispatch_g[H5O_TYPE_NTYPES];
-#define DISPATCH(TYPE,NAME,OPEN,CLOSE,LIST1,LIST2) { \
- dispatch_g[TYPE].name = (NAME); \
- dispatch_g[TYPE].open = (OPEN); \
+#define DISPATCH(TYPE, NAME, OPEN, CLOSE, LIST1, LIST2) { \
+ dispatch_g[TYPE].name = (NAME); \
+ dispatch_g[TYPE].open = (OPEN); \
dispatch_g[TYPE].close = (CLOSE); \
dispatch_g[TYPE].list1 = (LIST1); \
dispatch_g[TYPE].list2 = (LIST2); \
}
-static herr_t list (hid_t group, const char *name, const H5L_info_t *linfo, void *cd);
+static herr_t list(hid_t group, const char *name, const H5L_info_t *linfo, void *cd);
static void display_type(hid_t type, int ind);
static char *fix_name(const char *path, const char *base);
@@ -145,30 +145,24 @@ usage: %s [OPTIONS] [OBJECTS...]\n\
*-------------------------------------------------------------------------
*/
static void
-sym_insert(H5G_stat_t *sb, const char *name)
+sym_insert(const H5O_info_t *oi, const char *name)
{
- haddr_t objno; /* Compact form of object's location */
int n;
/* Don't add it if the link count is 1 because such an object can only
* have one name. */
- if (sb->nlink<2) return;
+ if(oi->rc < 2)
+ return;
/* Extend the table */
- if (idtab_g.nobjs>=idtab_g.nalloc) {
+ if(idtab_g.nobjs >= idtab_g.nalloc) {
idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc);
- idtab_g.obj = realloc(idtab_g.obj,
- idtab_g.nalloc*sizeof(idtab_g.obj[0]));
- }
+ idtab_g.obj = realloc(idtab_g.obj, idtab_g.nalloc*sizeof(idtab_g.obj[0]));
+ } /* end if */
/* Insert the entry */
n = idtab_g.nobjs++;
-#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
- objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
-#else
- objno = (haddr_t)sb->objno[0];
-#endif
- idtab_g.obj[n].id = objno;
+ idtab_g.obj[n].id = oi->addr;
idtab_g.obj[n].name = HDstrdup(name);
}
@@ -190,17 +184,18 @@ sym_insert(H5G_stat_t *sb, const char *name)
*-------------------------------------------------------------------------
*/
static char *
-sym_lookup(H5G_stat_t *sb)
+sym_lookup(const H5O_info_t *oi)
{
- haddr_t objno; /* Compact form of object's location */
int n;
- if (sb->nlink<2) return NULL; /*only one name possible*/
- objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
- for (n=0; n<idtab_g.nobjs; n++) {
- if(idtab_g.obj[n].id == objno)
+ /*only one name possible*/
+ if(oi->rc < 2)
+ return NULL;
+
+ for(n = 0; n < idtab_g.nobjs; n++)
+ if(idtab_g.obj[n].id == oi->addr)
return idtab_g.obj[n].name;
- }
+
return NULL;
}
@@ -1173,21 +1168,18 @@ display_type(hid_t type, int ind)
}
/* Shared? If so then print the type's OID */
- if (H5Tcommitted(type)) {
- H5G_stat_t sb;
+ if(H5Tcommitted(type)) {
+ H5O_info_t oi;
- if (H5Gget_objinfo(type, ".", FALSE, &sb)>=0) {
- haddr_t objno; /* Compact form of object's location */
-
- objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
+ if(H5Oget_info(type, ".", &oi, H5P_DEFAULT) >= 0)
printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ",
- sb.fileno[0], objno);
- } else
+ oi.fileno, oi.addr);
+ else
printf("shared ");
- }
+ } /* end if */
/* Print the type */
- if ((!simple_output_g && display_native_type(type, ind)) ||
+ if((!simple_output_g && display_native_type(type, ind)) ||
display_ieee_type(type, ind) ||
display_int_type(type, ind) ||
display_float_type(type, ind) ||
@@ -1709,108 +1701,6 @@ datatype_list2(hid_t type, const char UNUSED *name)
/*-------------------------------------------------------------------------
- * Function: slink_open
- *
- * Purpose: This gets called to open a symbolic link. Since symbolic
- * links don't correspond to actual objects we simply print the
- * link information and return failure.
- *
- * Return: Success: 0 - an invalid object but successful return
- * of this function.
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Thursday, August 27, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static hid_t
-slink_open(hid_t location, const char *name, hid_t UNUSED apl_id)
-{
- H5G_stat_t statbuf;
-
- if(H5Gget_objinfo(location, name, FALSE, &statbuf) < 0)
- return -1;
-
- if(statbuf.type == H5G_LINK) { /* Soft link */
- char *buf = HDmalloc(statbuf.linklen);
-
- if(H5Lget_val(location, name, buf, statbuf.linklen, H5P_DEFAULT) < 0) {
- HDfree(buf);
- return -1;
- }
-
- HDfputs(buf, stdout);
- HDfree(buf);
- }
-
- return 0;
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: udlink_open
- *
- * Purpose: This gets called to open a user-defined link. Since these
- * links don't correspond to actual objects we simply print a message
- * and return failure.
- *
- * Return: Success: 0 - an invalid object but successful return
- * of this function.
- *
- * Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static hid_t
-udlink_open(hid_t location, const char *name, hid_t UNUSED apl_id)
-{
- H5L_info_t linfo;
- char * buf = NULL;
- const char * filename;
- const char * path;
-
- if(H5Lget_info(location, name, &linfo, H5P_DEFAULT) < 0)
- return -1;
-
- switch(linfo.type) {
- /* For external links, try to display info for the object it points to */
- case H5L_TYPE_EXTERNAL:
- if((buf = HDmalloc(linfo.u.val_size)) == NULL)
- goto error;
- if(H5Lget_val(location, name, buf, linfo.u.val_size, H5P_DEFAULT) < 0)
- goto error;
-
- if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &filename, &path) < 0)
- goto error;
- HDfputs("file: ", stdout);
- HDfputs(filename, stdout);
- HDfputs(" path: ", stdout);
- HDfputs(path, stdout);
- break;
-
- default:
- HDfputs("cannot follow UD links", stdout);
- }
-
- return 0;
-
-error:
- if(buf)
- HDfree(buf);
- return -1;
-}
-
-
-/*-------------------------------------------------------------------------
* Function: list
*
* Purpose: Prints the group member name.
@@ -1830,102 +1720,162 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-list(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void *_iter)
+list(hid_t group, const char *name, const H5L_info_t *linfo, void *_iter)
{
- hid_t obj = -1;
- char buf[512], comment[50], *fullname = NULL, *s = NULL;
- H5G_stat_t sb;
- haddr_t objno; /* Compact form of object's location */
- struct tm *tm;
- herr_t status;
iter_t *iter = (iter_t*)_iter;
+ char *fullname = NULL;
int n;
/* Print the object name, either full name or base name */
fullname = fix_name(iter->container, name);
- if (fullname_g) {
+ if(fullname_g)
n = display_string(stdout, fullname, TRUE);
- printf("%*s ", MAX(0, 24-n), "");
- } else {
+ else
n = display_string(stdout, name, TRUE);
- printf("%*s ", MAX(0, 24-n), "");
- }
+ printf("%*s ", MAX(0, (24 - n)), "");
+
+ /* Actions on objects */
+ if(linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oi;
+ char *s;
+ hid_t obj;
+
+ /* Get object information */
+ if(H5Oget_info(group, name, &oi, H5P_DEFAULT) < 0) {
+ puts("**NOT FOUND**");
+ return 0;
+ } else if(oi.type < 0 || oi.type >= H5O_TYPE_NTYPES) {
+ printf("Unknown type(%d)", (int)oi.type);
+ oi.type = H5O_TYPE_UNKNOWN;
+ }
+ if(oi.type >= 0 && dispatch_g[oi.type].name)
+ fputs(dispatch_g[oi.type].name, stdout);
+
+ /* If the object has already been printed then just show the object ID
+ * and return. */
+ if((s = sym_lookup(&oi))) {
+ printf(", same as ");
+ display_string(stdout, s, TRUE);
+ printf("\n");
+ goto done;
+ } /* end if */
+ else
+ sym_insert(&oi, fullname);
+
+ /* Open the object. Not all objects can be opened. If this is the case
+ * then return right away.
+ */
+ if(oi.type >= 0 &&
+ (NULL == dispatch_g[oi.type].open ||
+ (obj = (dispatch_g[oi.type].open)(group, name, H5P_DEFAULT)) < 0)) {
+ printf(" *ERROR*\n");
+ goto done;
+ } /* end if */
- /* Get object information */
- H5E_BEGIN_TRY {
- status = H5Gget_objinfo(group, name, FALSE, &sb);
- } H5E_END_TRY;
- if(status < 0) {
- puts("**NOT FOUND**");
- return 0;
- } else if(sb.type < 0 || sb.type >= H5G_NTYPES) {
- printf("Unknown type(%d)", sb.type);
- sb.type = H5G_UNKNOWN;
- }
- if(sb.type >= 0 && dispatch_g[sb.type].name)
- fputs(dispatch_g[sb.type].name, stdout);
- objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
-
- /* If the object has already been printed then just show the object ID
- * and return. */
- if((s = sym_lookup(&sb))) {
- printf(", same as ");
- display_string(stdout, s, TRUE);
- printf("\n");
- goto done;
- } else {
- sym_insert(&sb, fullname);
- }
+ /* List the first line of information for the object. */
+ if(oi.type >= 0 && dispatch_g[oi.type].list1)
+ (dispatch_g[oi.type].list1)(obj);
+ putchar('\n');
- /* Open the object. Not all objects can be opened. If this is the case
- * then return right away. */
- if(sb.type >= 0 &&
- (NULL == dispatch_g[sb.type].open ||
- (obj = (dispatch_g[sb.type].open)(group, name, H5P_DEFAULT)) < 0)) {
- printf(" *ERROR*\n");
- goto done;
- } /* end if */
+ /* Show detailed information about the object, beginning with information
+ * which is common to all objects. */
+ if(verbose_g > 0) {
+ char comment[50];
+
+ /* Display attributes */
+ if(oi.type >= 0)
+ H5Aiterate(obj, NULL, list_attr, NULL);
+
+ /* Object location & reference count */
+ printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oi.fileno, oi.addr);
+ printf(" %-10s %u\n", "Links:", (unsigned)oi.rc);
+
+ /* Modification time */
+ if(oi.mtime > 0) {
+ char buf[256];
+ struct tm *tm;
+
+ if(simple_output_g)
+ tm = HDgmtime(&(oi.mtime));
+ else
+ tm = HDlocaltime(&(oi.mtime));
+ if(tm) {
+ HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
+ printf(" %-10s %s\n", "Modified:", buf);
+ } /* end if */
+ } /* end if */
- /* List the first line of information for the object. */
- if(sb.type >= 0 && dispatch_g[sb.type].list1)
- (dispatch_g[sb.type].list1)(obj);
- putchar('\n');
-
- /* Show detailed information about the object, beginning with information
- * which is common to all objects. */
- if(verbose_g > 0 && H5G_LINK != sb.type && H5G_UDLINK != sb.type) {
- if(sb.type >= 0)
- H5Aiterate(obj, NULL, list_attr, NULL);
- printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", sb.fileno[0], objno);
- printf(" %-10s %u\n", "Links:", sb.nlink);
- if(sb.mtime > 0) {
- if(simple_output_g)
- tm = HDgmtime(&(sb.mtime));
- else
- tm = HDlocaltime(&(sb.mtime));
- if(tm) {
- HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
- printf(" %-10s %s\n", "Modified:", buf);
+ /* Object comment */
+ comment[0] = '\0';
+ H5Oget_comment(group, name, comment, sizeof(comment), H5P_DEFAULT);
+ HDstrcpy(comment + sizeof(comment) - 4, "...");
+ if(comment[0]) {
+ printf(" %-10s \"", "Comment:");
+ display_string(stdout, comment, FALSE);
+ puts("\"");
} /* end if */
} /* end if */
- comment[0] = '\0';
- H5Oget_comment(group, name, comment, sizeof(comment), H5P_DEFAULT);
- HDstrcpy(comment + sizeof(comment) - 4, "...");
- if(comment[0]) {
- printf(" %-10s \"", "Comment:");
- display_string(stdout, comment, FALSE);
- puts("\"");
- } /* end if */
+
+ /* Detailed list for object */
+ if(oi.type >= 0 && dispatch_g[oi.type].list2)
+ (dispatch_g[oi.type].list2)(obj, fullname);
+
+ /* Close the object. */
+ if(oi.type >= 0 && dispatch_g[oi.type].close)
+ (dispatch_g[oi.type].close)(obj);
} /* end if */
- if(sb.type >= 0 && dispatch_g[sb.type].list2)
- (dispatch_g[sb.type].list2)(obj, fullname);
+ /* Actions on links */
+ else {
+ char *buf;
+
+ HDfputs("-> ", stdout);
+ switch(linfo->type) {
+ case H5L_TYPE_SOFT:
+ if((buf = HDmalloc(linfo->u.val_size)) == NULL)
+ goto done;
+
+ if(H5Lget_val(group, name, buf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ HDfree(buf);
+ goto done;
+ } /* end if */
+
+ HDfputs(buf, stdout);
+ HDfree(buf);
+ break;
-done:
- /* Close the object. */
- if(sb.type >= 0 && obj >= 0 && dispatch_g[sb.type].close)
- (dispatch_g[sb.type].close)(obj);
+ case H5L_TYPE_EXTERNAL:
+ {
+ const char *filename;
+ const char *path;
+
+ if((buf = HDmalloc(linfo->u.val_size)) == NULL)
+ goto done;
+
+ if(H5Lget_val(group, name, buf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ HDfree(buf);
+ goto done;
+ } /* end if */
+ if(H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0) {
+ HDfree(buf);
+ goto done;
+ } /* end if */
+
+ HDfputs("file: ", stdout);
+ HDfputs(filename, stdout);
+ HDfputs(" path: ", stdout);
+ HDfputs(path, stdout);
+ }
+ break;
+
+ default:
+ HDfputs("cannot follow UD links", stdout);
+ break;
+ } /* end switch */
+ HDfputc('\n', stdout);
+ } /* end else */
- if (fullname)
+done:
+ if(fullname)
free(fullname);
return 0;
} /* end list() */
@@ -2104,178 +2054,182 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- hid_t file=-1, root=-1;
- char *fname=NULL, *oname=NULL, *x;
+ hid_t file = -1, root = -1;
+ char *fname = NULL, *oname = NULL, *x;
const char *s = NULL;
- char *rest, *container=NULL;
+ char *rest, *container = NULL;
int argno;
- H5G_stat_t sb;
- iter_t iter;
static char root_name[] = "/";
char drivername[50];
- const char *preferred_driver=NULL;
+ const char *preferred_driver = NULL;
/* Initialize h5tools lib */
h5tools_init();
- /* Build display table */
+ /* Build object display table */
DISPATCH(H5G_DATASET, "Dataset", H5Dopen2, H5Dclose, dataset_list1, dataset_list2);
DISPATCH(H5G_GROUP, "Group", H5Gopen2, H5Gclose, NULL, group_list2);
DISPATCH(H5G_TYPE, "Type", H5Topen2, H5Tclose, NULL, datatype_list2);
- DISPATCH(H5G_LINK, "-> ", slink_open, NULL, NULL, NULL);
- DISPATCH(H5G_UDLINK, "-> ", udlink_open, NULL, NULL, NULL);
-
-#if 0
- /* Name of this program without the path */
- if ((progname=strrchr(argv[0], '/'))) progname++;
- else progname = argv[0];
-#endif
/* Default output width */
width_g = get_width();
/* Switches come before non-switch arguments */
- for (argno=1; argno<argc && '-'==argv[argno][0]; argno++) {
- if (!strcmp(argv[argno], "--")) {
+ for(argno = 1; argno < argc && '-' == argv[argno][0]; argno++) {
+ if(!HDstrcmp(argv[argno], "--")) {
/* Last switch */
argno++;
break;
- } else if (!strcmp(argv[argno], "--help")) {
+ } else if(!HDstrcmp(argv[argno], "--help")) {
usage();
leave(0);
- } else if (!strcmp(argv[argno], "--address")) {
+ } else if(!HDstrcmp(argv[argno], "--address")) {
address_g = TRUE;
- } else if (!strcmp(argv[argno], "--data")) {
+ } else if(!HDstrcmp(argv[argno], "--data")) {
data_g = TRUE;
- } else if (!strcmp(argv[argno], "--errors")) {
+ } else if(!HDstrcmp(argv[argno], "--errors")) {
show_errors_g = TRUE;
- } else if (!strcmp(argv[argno], "--full")) {
+ } else if(!HDstrcmp(argv[argno], "--full")) {
fullname_g = TRUE;
- } else if (!strcmp(argv[argno], "--group")) {
+ } else if(!HDstrcmp(argv[argno], "--group")) {
grp_literal_g = TRUE;
- } else if (!strcmp(argv[argno], "--label")) {
+ } else if(!HDstrcmp(argv[argno], "--label")) {
label_g = TRUE;
- } else if (!strcmp(argv[argno], "--recursive")) {
+ } else if(!HDstrcmp(argv[argno], "--recursive")) {
recursive_g = TRUE;
fullname_g = TRUE;
- } else if (!strcmp(argv[argno], "--simple")) {
+ } else if(!HDstrcmp(argv[argno], "--simple")) {
simple_output_g = TRUE;
- } else if (!strcmp(argv[argno], "--string")) {
+ } else if(!HDstrcmp(argv[argno], "--string")) {
string_g = TRUE;
- } else if (!strncmp(argv[argno], "--vfd=", 6)) {
+ } else if(!HDstrncmp(argv[argno], "--vfd=", 6)) {
preferred_driver = argv[argno]+6;
- } else if (!strncmp(argv[argno], "--width=", 8)) {
- width_g = (int)strtol(argv[argno]+8, &rest, 0);
+ } else if(!HDstrncmp(argv[argno], "--width=", 8)) {
+ width_g = (int)HDstrtol(argv[argno]+8, &rest, 0);
- if (0 == width_g)
+ if(0 == width_g)
no_line_wrap_g = TRUE;
- else if (width_g<0 || *rest) {
+ else if(width_g < 0 || *rest) {
usage();
leave(1);
}
- } else if (!strcmp(argv[argno], "--width")) {
- if (argno+1>=argc) {
+ } else if(!HDstrcmp(argv[argno], "--width")) {
+ if((argno + 1) >= argc) {
usage();
leave(1);
} else {
s = argv[++argno];
}
- width_g = (int)strtol(s, &rest, 0);
- if (width_g<=0 || *rest) {
+ width_g = (int)HDstrtol(s, &rest, 0);
+ if(width_g <= 0 || *rest) {
usage();
leave(1);
}
- } else if (!strcmp(argv[argno], "--verbose")) {
+ } else if(!HDstrcmp(argv[argno], "--verbose")) {
verbose_g++;
- } else if (!strcmp(argv[argno], "--version")) {
+ } else if(!HDstrcmp(argv[argno], "--version")) {
print_version(progname);
leave(0);
- } else if (!strcmp(argv[argno], "--hexdump")) {
+ } else if(!HDstrcmp(argv[argno], "--hexdump")) {
hexdump_g = TRUE;
- } else if (!strncmp(argv[argno], "-w", 2)) {
- if (argv[argno][2]) {
- s = argv[argno]+2;
- } else if (argno+1>=argc) {
+ } else if(!HDstrncmp(argv[argno], "-w", 2)) {
+ if(argv[argno][2]) {
+ s = argv[argno] + 2;
+ } else if((argno + 1) >= argc) {
usage();
leave(1);
} else {
s = argv[++argno];
}
- width_g = (int)strtol(s, &rest, 0);
+ width_g = (int)HDstrtol(s, &rest, 0);
- if (0 == width_g)
+ if(0 == width_g)
no_line_wrap_g = TRUE;
- else if (width_g<0 || *rest) {
+ else if(width_g < 0 || *rest) {
usage();
leave(1);
}
- } else if ('-'!=argv[argno][1]) {
+ } else if('-'!=argv[argno][1]) {
/* Single-letter switches */
- for (s=argv[argno]+1; *s; s++) {
- switch (*s) {
+ for(s = argv[argno] + 1; *s; s++) {
+ switch(*s) {
case '?':
case 'h': /* --help */
usage();
leave(0);
+
case 'a': /* --address */
address_g = TRUE;
break;
+
case 'd': /* --data */
data_g = TRUE;
break;
+
case 'e': /* --errors */
show_errors_g = TRUE;
break;
+
case 'f': /* --full */
fullname_g = TRUE;
break;
+
case 'g': /* --group */
grp_literal_g = TRUE;
break;
+
case 'l': /* --label */
label_g = TRUE;
break;
+
case 'r': /* --recursive */
recursive_g = TRUE;
fullname_g = TRUE;
break;
+
case 'S': /* --simple */
simple_output_g = TRUE;
break;
+
case 's': /* --string */
string_g = TRUE;
break;
+
case 'v': /* --verbose */
verbose_g++;
break;
+
case 'V': /* --version */
print_version(progname);
leave(0);
+
case 'x': /* --hexdump */
hexdump_g = TRUE;
break;
+
default:
usage();
leave(1);
- }
- }
+ } /* end switch */
+ } /* end for */
} else {
usage();
leave(1);
}
- }
+ } /* end for */
/* If no arguments remain then print a usage message (instead of doing
* absolutely nothing ;-) */
- if (argno>=argc) {
+ if(argno >= argc) {
usage();
leave(1);
- }
+ } /* end if */
/* Turn off HDF5's automatic error printing unless you're debugging h5ls */
- if (!show_errors_g) H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ if(!show_errors_g)
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* Each remaining argument is an hdf5 file followed by an optional slash
@@ -2291,42 +2245,67 @@ main (int argc, const char *argv[])
* then there must have been something wrong with the file (perhaps it
* doesn't exist). */
show_file_name_g = (argc-argno > 1); /*show file names if more than one*/
- while (argno<argc) {
+ while(argno < argc) {
+ H5O_info_t oi;
+ H5L_info_t li;
+ iter_t iter;
+
fname = HDstrdup(argv[argno++]);
oname = NULL;
file = -1;
- while (fname && *fname) {
+ while(fname && *fname) {
file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
- if (file>=0) {
- if (verbose_g) {
- printf("Opened \"%s\" with %s driver.\n",
- fname, drivername);
- }
+ if(file >= 0) {
+ if(verbose_g)
+ printf("Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
- }
+ } /* end if */
/* Shorten the file name; lengthen the object name */
x = oname;
oname = strrchr(fname, '/');
- if (x) *x = '/';
- if (!oname) break;
+ if(x)
+ *x = '/';
+ if(!oname)
+ break;
*oname = '\0';
- }
- if (file<0) {
+ } /* end while */
+ if(file < 0) {
fprintf(stderr, "%s: unable to open file\n", argv[argno-1]);
continue;
- }
+ } /* end if */
if(oname)
oname++;
if(!oname || !*oname)
oname = root_name;
+ /* Check for root group as object name */
+ if(HDstrcmp(oname, root_name)) {
+ /* Check the type of link given */
+ if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
+ char *fullname = NULL;
+ int n;
+
+ fullname = fix_name(oname, "/");
+ if(fullname_g)
+ n = display_string(stdout, fullname, TRUE);
+ else
+ n = display_string(stdout, oname, TRUE);
+ printf("%*s \n", MAX(0, (24 - n)), "**NOT FOUND**");
+
+ HDfree(fullname);
+ leave(1);
+ } /* end if */
+ } /* end if */
+ else
+ li.type = H5L_TYPE_HARD;
+
/* Open the object and display it's information */
- if(H5Gget_objinfo(file, oname, TRUE, &sb) >= 0 && H5G_GROUP == sb.type && !grp_literal_g) {
+ if(li.type == H5L_TYPE_HARD && H5Oget_info(file, oname, &oi, H5P_DEFAULT) >= 0 && H5O_TYPE_GROUP == oi.type && !grp_literal_g) {
/* Specified name is a group. List the complete contents of the group. */
- sym_insert(&sb, oname);
+ sym_insert(&oi, oname);
iter.container = container = fix_name((show_file_name_g ? fname : ""), oname);
/* list root attributes */
@@ -2341,21 +2320,21 @@ main (int argc, const char *argv[])
/* list */
H5Literate(file, oname, H5_INDEX_NAME, H5_ITER_INC, NULL, list, &iter, H5P_DEFAULT);
free(container);
-
} else if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0) {
leave(1); /*major problem!*/
-
} else {
/* Specified name is a non-group object -- list that object. The
- * container for the object is everything up to the base name. */
+ * container for the object is everything up to the base name.
+ */
iter.container = show_file_name_g ? fname : "/";
- list(root, oname, NULL, &iter);
+ list(root, oname, &li, &iter);
if(H5Gclose(root) < 0)
leave(1);
}
H5Fclose(file);
free(fname);
- }
+ } /* end while */
+
leave(0);
}
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index c710bce..42dca2a 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -626,12 +626,12 @@ int do_copy_objects(hid_t fidin,
*/
if ( has_filter && apply_s == 0 )
printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n",
- travt->objs[i].name,
- (int)options->threshold);
+ travt->objs[i].name,
+ (int)options->threshold);
if ( has_filter && apply_f == 0 )
printf(" <warning: could not apply the filter to %s>\n",
- travt->objs[i].name);
+ travt->objs[i].name);
} /* verbose */
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 8a549cd..a29ae48 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -30,8 +30,8 @@
*/
static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt);
-static void close_obj(H5G_obj_t1 obj_type, hid_t obj_id);
-static int copy_refs_attr(hid_t loc_in,hid_t loc_out,pack_opt_t *options,trav_table_t *travt,hid_t fidout);
+static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options,
+ trav_table_t *travt, hid_t fidout);
/*-------------------------------------------------------------------------
* Function: do_copy_refobjs
@@ -53,15 +53,15 @@ int do_copy_refobjs(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in=(-1); /* read group ID */
- hid_t grp_out=(-1); /* write group ID */
- hid_t dset_in=(-1); /* read dataset ID */
- hid_t dset_out=(-1); /* write dataset ID */
- hid_t type_in=(-1); /* named type ID */
- hid_t dcpl_id=(-1); /* dataset creation property list ID */
- hid_t space_id=(-1); /* space ID */
- hid_t ftype_id=(-1); /* file data type ID */
- hid_t mtype_id=(-1); /* memory data type ID */
+ hid_t grp_in = (-1); /* read group ID */
+ hid_t grp_out = (-1); /* write group ID */
+ hid_t dset_in = (-1); /* read dataset ID */
+ hid_t dset_out = (-1); /* write dataset ID */
+ hid_t type_in = (-1); /* named type ID */
+ hid_t dcpl_id = (-1); /* dataset creation property list ID */
+ hid_t space_id = (-1); /* space ID */
+ hid_t ftype_id = (-1); /* file data type ID */
+ hid_t mtype_id = (-1); /* memory data type ID */
size_t msize; /* memory size of memory type */
hsize_t nelmts; /* number of elements in dataset */
int rank; /* rank of dataset */
@@ -73,83 +73,75 @@ int do_copy_refobjs(hid_t fidin,
* browse
*-------------------------------------------------------------------------
*/
-
- for ( i = 0; i < travt->nobjs; i++)
- {
- switch ( travt->objs[i].type )
- {
+ for(i = 0; i < travt->nobjs; i++) {
+ switch(travt->objs[i].type) {
/*-------------------------------------------------------------------------
- * H5G_GROUP
+ * H5TRAV_TYPE_GROUP
*-------------------------------------------------------------------------
*/
- case H5G_GROUP:
-
+ case H5TRAV_TYPE_GROUP:
/*-------------------------------------------------------------------------
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
-
- if ((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
- if (copy_refs_attr(grp_in,grp_out,options,travt,fidout) < 0)
+ if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0)
goto error;
- if (H5Gclose(grp_out) < 0)
+ if(H5Gclose(grp_out) < 0)
goto error;
- if (H5Gclose(grp_in) < 0)
+ if(H5Gclose(grp_in) < 0)
goto error;
-
/*-------------------------------------------------------------------------
* check for hard links
*-------------------------------------------------------------------------
*/
-
if(travt->objs[i].nlinks)
for(j = 0; j < travt->objs[i].nlinks; j++)
H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
/*-------------------------------------------------------------------------
- * H5G_DATASET
+ * H5TRAV_TYPE_DATASET
*-------------------------------------------------------------------------
*/
- case H5G_DATASET:
-
- if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
+ case H5TRAV_TYPE_DATASET:
+ if((dset_in = H5Dopen(fidin,travt->objs[i].name)) < 0)
goto error;
- if ((space_id=H5Dget_space(dset_in))<0)
+ if((space_id = H5Dget_space(dset_in)) < 0)
goto error;
- if ((ftype_id=H5Dget_type (dset_in))<0)
+ if((ftype_id = H5Dget_type (dset_in)) < 0)
goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_in))<0)
+ if((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
goto error;
- if ( (rank=H5Sget_simple_extent_ndims(space_id))<0)
+ if((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
goto error;
- if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0)
+ if(H5Sget_simple_extent_dims(space_id,dims,NULL) < 0)
goto error;
- nelmts=1;
- for (k=0; k<rank; k++)
- nelmts*=dims[k];
+ nelmts = 1;
+ for(k = 0; k < rank; k++)
+ nelmts *= dims[k];
- if ((mtype_id=h5tools_get_native_type(ftype_id))<0)
+ if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
goto error;
- if ((msize=H5Tget_size(mtype_id))==0)
+ if((msize = H5Tget_size(mtype_id)) == 0)
goto error;
+
/*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
- *-------------------------------------------------------------------------
- */
- if (h5tools_canreadf((NULL),dcpl_id)==1)
- {
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if(h5tools_canreadf(NULL, dcpl_id) == 1) {
/*-------------------------------------------------------------------------
* test for a valid output dataset
*-------------------------------------------------------------------------
@@ -161,12 +153,10 @@ int do_copy_refobjs(hid_t fidin,
* we cannot just copy the buffers, but instead we recreate the reference
*-------------------------------------------------------------------------
*/
- if (H5Tequal(mtype_id, H5T_STD_REF_OBJ))
- {
- H5G_obj_t1 obj_type;
+ if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
hid_t refobj_id;
- hobj_ref_t *refbuf=NULL; /* buffer for object references */
- hobj_ref_t *buf=NULL;
+ hobj_ref_t *refbuf = NULL; /* buffer for object references */
+ hobj_ref_t *buf = NULL;
const char* refname;
unsigned u;
@@ -174,74 +164,66 @@ int do_copy_refobjs(hid_t fidin,
* read to memory
*-------------------------------------------------------------------------
*/
-
- if (nelmts)
- {
- buf=(void *) HDmalloc((unsigned)(nelmts*msize));
- if ( buf==NULL){
- printf( "cannot read into memory\n" );
+ if(nelmts) {
+ buf = (void *)HDmalloc((unsigned)(nelmts * msize));
+ if(buf==NULL) {
+ printf("cannot read into memory\n" );
goto error;
- }
- if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
+ } /* end if */
+ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
- if ((obj_type = H5Rget_obj_type(dset_in,H5R_OBJECT,buf))<0)
+ refbuf = HDcalloc((unsigned)nelmts, msize);
+ if(refbuf == NULL){
+ printf("cannot allocate memory\n" );
goto error;
- refbuf=HDcalloc((unsigned)nelmts,msize);
- if ( refbuf==NULL){
- printf( "cannot allocate memory\n" );
- goto error;
- }
- for ( u=0; u<nelmts; u++)
- {
+ } /* end if */
+ for(u = 0; u < nelmts; u++) {
H5E_BEGIN_TRY {
- if ((refobj_id = H5Rdereference(dset_in,H5R_OBJECT,&buf[u]))<0)
+ if((refobj_id = H5Rdereference(dset_in, H5R_OBJECT, &buf[u])) < 0)
continue;
} H5E_END_TRY;
- /* get the name. a valid name could only occur in the
- second traversal of the file */
- if ((refname=MapIdToName(refobj_id,travt))!=NULL)
- {
+
+ /* get the name. a valid name could only occur
+ * in the second traversal of the file
+ */
+ if((refname = MapIdToName(refobj_id, travt)) != NULL) {
/* create the reference, -1 parameter for objects */
- if (H5Rcreate(&refbuf[u],fidout,refname,H5R_OBJECT,-1)<0)
+ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, -1) < 0)
goto error;
- if (options->verbose)
+ if(options->verbose)
printf("object <%s> object reference created to <%s>\n",
travt->objs[i].name,
refname);
- }/*refname*/
- close_obj(obj_type,refobj_id);
- }/* u */
- }/*nelmts*/
+ } /*refname*/
+ H5Oclose(refobj_id);
+ } /* u */
+ } /*nelmts*/
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
+ if((dset_out = H5Dcreate(fidout, travt->objs[i].name, mtype_id, space_id, dcpl_id)) < 0)
goto error;
- if (nelmts) {
- if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0)
+ if(nelmts)
+ if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
goto error;
- }
- if (buf)
- free(buf);
- if (refbuf)
- free(refbuf);
-
- }/*H5T_STD_REF_OBJ*/
+ if(buf)
+ HDfree(buf);
+ if(refbuf)
+ HDfree(refbuf);
+ } /*H5T_STD_REF_OBJ*/
/*-------------------------------------------------------------------------
* dataset region references
*-------------------------------------------------------------------------
*/
- else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
- {
- H5G_obj_t1 obj_type;
+ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
hid_t refobj_id;
- hdset_reg_ref_t *refbuf=NULL; /* input buffer for region references */
- hdset_reg_ref_t *buf=NULL; /* output buffer */
+ hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
+ hdset_reg_ref_t *buf = NULL; /* output buffer */
const char* refname;
unsigned u;
@@ -249,91 +231,85 @@ int do_copy_refobjs(hid_t fidin,
* read input to memory
*-------------------------------------------------------------------------
*/
- if (nelmts)
- {
- buf=(void *) HDmalloc((unsigned)(nelmts*msize));
- if ( buf==NULL){
- printf( "cannot read into memory\n" );
- goto error;
- }
- if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
+ if(nelmts) {
+ buf = (void *)HDmalloc((unsigned)(nelmts * msize));
+ if(buf == NULL) {
+ printf("cannot read into memory\n");
goto error;
- if ((obj_type = H5Rget_obj_type(dset_in,H5R_DATASET_REGION,buf))<0)
+ } /* end if */
+ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/*-------------------------------------------------------------------------
* create output
*-------------------------------------------------------------------------
*/
-
- refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */
- if ( refbuf==NULL){
- printf( "cannot allocate memory\n" );
+ refbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
+ if(refbuf == NULL) {
+ printf("cannot allocate memory\n");
goto error;
- }
- for ( u=0; u<nelmts; u++)
- {
+ } /* end if */
+
+ for(u = 0; u < nelmts; u++) {
H5E_BEGIN_TRY {
- if ((refobj_id = H5Rdereference(dset_in,H5R_DATASET_REGION,&buf[u]))<0)
+ if((refobj_id = H5Rdereference(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
continue;
} H5E_END_TRY;
- /* get the name. a valid name could only occur in the
- second traversal of the file */
- if ((refname=MapIdToName(refobj_id,travt))!=NULL)
- {
+ /* get the name. a valid name could only occur
+ * in the second traversal of the file
+ */
+ if((refname = MapIdToName(refobj_id, travt)) != NULL) {
hid_t region_id; /* region id of the referenced dataset */
- if ((region_id = H5Rget_region(dset_in,H5R_DATASET_REGION,&buf[u]))<0)
+
+ if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
goto error;
+
/* create the reference, we need the space_id */
- if (H5Rcreate(&refbuf[u],fidout,refname,H5R_DATASET_REGION,region_id)<0)
+ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0)
goto error;
- if (H5Sclose(region_id)<0)
+ if(H5Sclose(region_id) < 0)
goto error;
- if (options->verbose)
+ if(options->verbose)
printf("object <%s> region reference created to <%s>\n",
travt->objs[i].name,
refname);
- }/*refname*/
- close_obj(obj_type,refobj_id);
- }/* u */
- }/*nelmts*/
+ } /*refname*/
+ H5Oclose(refobj_id);
+ } /* u */
+ } /*nelmts*/
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0)
+ if((dset_out = H5Dcreate(fidout, travt->objs[i].name, mtype_id, space_id, dcpl_id)) < 0)
goto error;
- if (nelmts) {
- if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0)
+ if(nelmts)
+ if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
goto error;
- }
- if (buf)
- free(buf);
- if (refbuf)
- free(refbuf);
+ if(buf)
+ HDfree(buf);
+ if(refbuf)
+ HDfree(refbuf);
} /* H5T_STD_REF_DSETREG */
-
-
/*-------------------------------------------------------------------------
* not references, open previously created object in 1st traversal
*-------------------------------------------------------------------------
*/
- else
- {
- if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0)
+ else {
+ if((dset_out = H5Dopen(fidout,travt->objs[i].name)) < 0)
goto error;
- }
+ } /* end else */
- assert(dset_out!=FAIL);
+ assert(dset_out != FAIL);
/*-------------------------------------------------------------------------
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
- if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0)
+ if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -344,58 +320,49 @@ int do_copy_refobjs(hid_t fidin,
for(j = 0; j < travt->objs[i].nlinks; j++)
H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
- if(H5Dclose(dset_out)<0)
+ if(H5Dclose(dset_out) < 0)
goto error;
-
- }/*can_read*/
+ } /*can_read*/
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
- if (H5Tclose(ftype_id)<0)
+ if(H5Tclose(ftype_id) < 0)
goto error;
- if (H5Tclose(mtype_id)<0)
+ if(H5Tclose(mtype_id) < 0)
goto error;
- if (H5Pclose(dcpl_id)<0)
+ if(H5Pclose(dcpl_id) < 0)
goto error;
- if (H5Sclose(space_id)<0)
+ if(H5Sclose(space_id) < 0)
goto error;
- if (H5Dclose(dset_in)<0)
+ if(H5Dclose(dset_in) < 0)
goto error;
-
break;
/*-------------------------------------------------------------------------
- * H5G_TYPE
+ * H5TRAV_TYPE_NAMED_DATATYPE
*-------------------------------------------------------------------------
*/
- case H5G_TYPE:
-
- if ((type_in = H5Topen (fidin,travt->objs[i].name))<0)
+ case H5TRAV_TYPE_NAMED_DATATYPE:
+ if((type_in = H5Topen(fidin, travt->objs[i].name)) < 0)
goto error;
-
- if (H5Tclose(type_in)<0)
+ if(H5Tclose(type_in) < 0)
goto error;
-
break;
/*-------------------------------------------------------------------------
* H5G_LINK
*-------------------------------------------------------------------------
*/
-
case H5G_LINK:
-
/*nothing to do */
break;
default:
-
break;
- }
- }
+ } /* end switch */
+ } /* end for */
return 0;
@@ -411,6 +378,7 @@ error:
H5Tclose(mtype_id);
H5Tclose(type_in);
} H5E_END_TRY;
+
return -1;
}
@@ -440,285 +408,246 @@ static int copy_refs_attr(hid_t loc_in,
hid_t fidout /* for saving references */
)
{
- hid_t attr_id=-1; /* attr ID */
- hid_t attr_out=-1; /* attr ID */
- hid_t space_id=-1; /* space ID */
- hid_t ftype_id=-1; /* file data type ID */
- hid_t mtype_id=-1; /* memory data type ID */
- size_t msize; /* memory size of type */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- char name[255];
- int n, j;
- unsigned u;
-
- if ((n = H5Aget_num_attrs(loc_in))<0)
- goto error;
-
- for ( u = 0; u < (unsigned)n; u++)
- {
-
-/*-------------------------------------------------------------------------
- * open
- *-------------------------------------------------------------------------
- */
- /* open attribute */
- if ((attr_id = H5Aopen_idx(loc_in, u))<0)
- goto error;
-
- /* get name */
- if (H5Aget_name( attr_id, 255, name )<0)
- goto error;
-
- /* get the file datatype */
- if ((ftype_id = H5Aget_type( attr_id )) < 0 )
- goto error;
-
- /* get the dataspace handle */
- if ((space_id = H5Aget_space( attr_id )) < 0 )
- goto error;
-
- /* get dimensions */
- if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 )
- goto error;
-
-
- /*-------------------------------------------------------------------------
- * elements
- *-------------------------------------------------------------------------
- */
- nelmts=1;
- for (j=0; j<rank; j++)
- nelmts*=dims[j];
+ hid_t attr_id = -1; /* attr ID */
+ hid_t attr_out = -1; /* attr ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file data type ID */
+ hid_t mtype_id = -1; /* memory data type ID */
+ size_t msize; /* memory size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ char name[255];
+ int n, j;
+ unsigned u;
+
+ if((n = H5Aget_num_attrs(loc_in)) < 0)
+ goto error;
- if ((mtype_id=h5tools_get_native_type(ftype_id))<0)
- goto error;
+ for(u = 0; u < (unsigned)n; u++) {
+ /*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ /* open attribute */
+ if((attr_id = H5Aopen_idx(loc_in, u)) < 0)
+ goto error;
+
+ /* get name */
+ if(H5Aget_name(attr_id, 255, name) < 0)
+ goto error;
+
+ /* get the file datatype */
+ if((ftype_id = H5Aget_type(attr_id)) < 0)
+ goto error;
+
+ /* get the dataspace handle */
+ if((space_id = H5Aget_space(attr_id)) < 0)
+ goto error;
+
+ /* get dimensions */
+ if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
+ goto error;
+
+
+ /*-------------------------------------------------------------------------
+ * elements
+ *-------------------------------------------------------------------------
+ */
+ nelmts = 1;
+ for(j = 0; j < rank; j++)
+ nelmts *= dims[j];
+
+ if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
+ goto error;
+
+ if((msize = H5Tget_size(mtype_id)) == 0)
+ goto error;
+
+
+ /*-------------------------------------------------------------------------
+ * object references are a special case
+ * we cannot just copy the buffers, but instead we recreate the reference
+ *-------------------------------------------------------------------------
+ */
+ if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
+ hid_t refobj_id;
+ hobj_ref_t *refbuf = NULL;
+ unsigned k;
+ const char* refname;
+ hobj_ref_t *buf = NULL;
- if ((msize=H5Tget_size(mtype_id))==0)
- goto error;
+ /*-------------------------------------------------------------------------
+ * read input to memory
+ *-------------------------------------------------------------------------
+ */
-
-/*-------------------------------------------------------------------------
- * object references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
- *-------------------------------------------------------------------------
- */
- if (H5Tequal(mtype_id, H5T_STD_REF_OBJ))
- {
- H5G_obj_t1 obj_type;
- hid_t refobj_id;
- hobj_ref_t *refbuf=NULL;
- unsigned k;
- const char* refname;
- hobj_ref_t *buf=NULL;
-
- /*-------------------------------------------------------------------------
- * read input to memory
- *-------------------------------------------------------------------------
- */
+ if (nelmts) {
+ buf = (void *)HDmalloc((unsigned)(nelmts * msize));
+ if(buf == NULL) {
+ printf("cannot read into memory\n");
+ goto error;
+ } /* end if */
+ if(H5Aread(attr_id, mtype_id, buf) < 0)
+ goto error;
- if (nelmts)
- {
- buf=(void *) HDmalloc((unsigned)(nelmts*msize));
- if ( buf==NULL){
- printf( "cannot read into memory\n" );
- goto error;
- }
- if (H5Aread(attr_id,mtype_id,buf)<0)
- goto error;
-
- if ((obj_type = H5Rget_obj_type(attr_id,H5R_OBJECT,buf))<0)
- goto error;
- refbuf=HDcalloc((unsigned)nelmts,msize);
- if ( refbuf==NULL){
- printf( "cannot allocate memory\n" );
- goto error;
- }
- for ( k=0; k<nelmts; k++)
- {
- H5E_BEGIN_TRY {
- if ((refobj_id = H5Rdereference(attr_id,H5R_OBJECT,&buf[k]))<0)
- goto error;
- } H5E_END_TRY;
- /* get the name. a valid name could only occur in the
- second traversal of the file */
- if ((refname=MapIdToName(refobj_id,travt))!=NULL)
- {
- /* create the reference */
- if (H5Rcreate(&refbuf[k],fidout,refname,H5R_OBJECT,-1)<0)
- goto error;
- if (options->verbose)
- printf("object <%s> reference created to <%s>\n",name,refname);
- }
- close_obj(obj_type,refobj_id);
- }/* k */
- }/*nelmts*/
+ refbuf = HDcalloc((unsigned)nelmts, msize);
+ if(refbuf == NULL) {
+ printf( "cannot allocate memory\n" );
+ goto error;
+ } /* end if */
- /*-------------------------------------------------------------------------
- * copy
- *-------------------------------------------------------------------------
- */
+ for(k = 0; k < nelmts; k++) {
+ H5E_BEGIN_TRY {
+ if((refobj_id = H5Rdereference(attr_id, H5R_OBJECT, &buf[k])) < 0)
+ goto error;
+ } H5E_END_TRY;
+
+ /* get the name. a valid name could only occur in the
+ * second traversal of the file
+ */
+ if((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ /* create the reference */
+ if(H5Rcreate(&refbuf[k], fidout, refname, H5R_OBJECT, -1) < 0)
+ goto error;
+ if(options->verbose)
+ printf("object <%s> reference created to <%s>\n", name, refname);
+ }
+ H5Oclose(refobj_id);
+ } /* k */
+ } /*nelmts*/
- if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0)
- goto error;
- if (nelmts)
- {
- if(H5Awrite(attr_out,mtype_id,refbuf)<0)
- goto error;
- }
- if (H5Aclose(attr_out)<0)
- goto error;
+ /*-------------------------------------------------------------------------
+ * copy
+ *-------------------------------------------------------------------------
+ */
+ if((attr_out = H5Acreate(loc_out, name, ftype_id, space_id, H5P_DEFAULT)) < 0)
+ goto error;
+ if(nelmts)
+ if(H5Awrite(attr_out, mtype_id, refbuf) < 0)
+ goto error;
+ if(H5Aclose(attr_out) < 0)
+ goto error;
+
+ if(refbuf)
+ HDfree(refbuf);
+ if(buf)
+ HDfree(buf);
+ }/*H5T_STD_REF_OBJ*/
+
+ /*-------------------------------------------------------------------------
+ * dataset region references
+ *-------------------------------------------------------------------------
+ */
+ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
+ hid_t refobj_id;
+ hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
+ hdset_reg_ref_t *buf = NULL; /* output buffer */
+ const char* refname;
+ unsigned k;
- if (refbuf)
- free(refbuf);
- if (buf)
- free(buf);
+ /*-------------------------------------------------------------------------
+ * read input to memory
+ *-------------------------------------------------------------------------
+ */
+ if(nelmts) {
+ buf = (void *)HDmalloc((unsigned)(nelmts * msize));
+ if(buf == NULL) {
+ printf( "cannot read into memory\n" );
+ goto error;
+ } /* end if */
+ if(H5Aread(attr_id, mtype_id, buf) < 0)
+ goto error;
- }/*H5T_STD_REF_OBJ*/
+ /*-------------------------------------------------------------------------
+ * create output
+ *-------------------------------------------------------------------------
+ */
+ refbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
+ if(refbuf == NULL) {
+ printf( "cannot allocate memory\n" );
+ goto error;
+ } /* end if */
-/*-------------------------------------------------------------------------
- * dataset region references
- *-------------------------------------------------------------------------
- */
- else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
- {
- H5G_obj_t1 obj_type;
- hid_t refobj_id;
- hdset_reg_ref_t *refbuf=NULL; /* input buffer for region references */
- hdset_reg_ref_t *buf=NULL; /* output buffer */
- const char* refname;
- unsigned k;
-
- /*-------------------------------------------------------------------------
- * read input to memory
- *-------------------------------------------------------------------------
- */
+ for(k = 0; k < nelmts; k++) {
+ H5E_BEGIN_TRY {
+ if((refobj_id = H5Rdereference(attr_id, H5R_DATASET_REGION, &buf[k])) < 0)
+ continue;
+ } H5E_END_TRY;
- if (nelmts)
- {
- buf=(void *) HDmalloc((unsigned)(nelmts*msize));
- if ( buf==NULL){
- printf( "cannot read into memory\n" );
- goto error;
- }
- if (H5Aread(attr_id,mtype_id,buf)<0)
- goto error;
- if ((obj_type = H5Rget_obj_type(attr_id,H5R_DATASET_REGION,buf))<0)
- goto error;
+ /* get the name. a valid name could only occur in the
+ * second traversal of the file
+ */
+ if((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ hid_t region_id; /* region id of the referenced dataset */
- /*-------------------------------------------------------------------------
- * create output
- *-------------------------------------------------------------------------
- */
-
- refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */
- if ( refbuf==NULL){
- printf( "cannot allocate memory\n" );
- goto error;
- }
- for ( k=0; k<nelmts; k++)
- {
- H5E_BEGIN_TRY {
- if ((refobj_id = H5Rdereference(attr_id,H5R_DATASET_REGION,&buf[k]))<0)
- continue;
- } H5E_END_TRY;
- /* get the name. a valid name could only occur in the
- second traversal of the file */
- if ((refname=MapIdToName(refobj_id,travt))!=NULL)
- {
- hid_t region_id; /* region id of the referenced dataset */
- if ((region_id = H5Rget_region(attr_id,H5R_DATASET_REGION,&buf[k]))<0)
- goto error;
- /* create the reference, we need the space_id */
- if (H5Rcreate(&refbuf[k],fidout,refname,H5R_DATASET_REGION,region_id)<0)
- goto error;
- if (H5Sclose(region_id)<0)
- goto error;
- if (options->verbose)
- printf("object <%s> region reference created to <%s>\n",name,refname);
- }
- close_obj(obj_type,refobj_id);
- }/* k */
- }/*nelmts */
+ if((region_id = H5Rget_region(attr_id, H5R_DATASET_REGION, &buf[k])) < 0)
+ goto error;
- /*-------------------------------------------------------------------------
- * copy
- *-------------------------------------------------------------------------
- */
-
- if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0)
- goto error;
- if (nelmts) {
- if(H5Awrite(attr_out,mtype_id,refbuf)<0)
- goto error;
- }
- if (H5Aclose(attr_out)<0)
- goto error;
- if (refbuf)
- free(refbuf);
- if (buf)
- free(buf);
- } /* H5T_STD_REF_DSETREG */
+ /* create the reference, we need the space_id */
+ if(H5Rcreate(&refbuf[k], fidout, refname, H5R_DATASET_REGION, region_id) < 0)
+ goto error;
+ if(H5Sclose(region_id) < 0)
+ goto error;
+ if(options->verbose)
+ printf("object <%s> region reference created to <%s>\n", name, refname);
+ } /* end if */
+ H5Oclose(refobj_id);
+ } /* k */
+ } /*nelmts */
-/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * copy
+ *-------------------------------------------------------------------------
+ */
+ if((attr_out = H5Acreate(loc_out, name, ftype_id, space_id, H5P_DEFAULT)) < 0)
+ goto error;
+ if(nelmts)
+ if(H5Awrite(attr_out, mtype_id, refbuf) < 0)
+ goto error;
- if (H5Tclose(ftype_id)<0) goto error;
- if (H5Tclose(mtype_id)<0) goto error;
- if (H5Sclose(space_id)<0) goto error;
- if (H5Aclose(attr_id)<0) goto error;
- } /* u */
+ if(H5Aclose(attr_out) < 0)
+ goto error;
+
+ if(refbuf)
+ HDfree(refbuf);
+ if(buf)
+ HDfree(buf);
+ } /* H5T_STD_REF_DSETREG */
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if(H5Tclose(ftype_id) < 0)
+ goto error;
+ if(H5Tclose(mtype_id) < 0)
+ goto error;
+ if(H5Sclose(space_id) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ } /* u */
- return 0;
+ return 0;
error:
- H5E_BEGIN_TRY {
- H5Tclose(ftype_id);
- H5Tclose(mtype_id);
- H5Sclose(space_id);
- H5Aclose(attr_id);
- H5Aclose(attr_out);
- } H5E_END_TRY;
- return -1;
-}
-
-/*-------------------------------------------------------------------------
- * Function: close_obj
- *
- * Purpose: Auxiliary function to close an object
- *
- *-------------------------------------------------------------------------
- */
+ H5E_BEGIN_TRY {
+ H5Tclose(ftype_id);
+ H5Tclose(mtype_id);
+ H5Sclose(space_id);
+ H5Aclose(attr_id);
+ H5Aclose(attr_out);
+ } H5E_END_TRY;
-static void close_obj(H5G_obj_t1 obj_type, hid_t obj_id)
-{
- H5E_BEGIN_TRY
- {
- switch (obj_type)
- {
- case H5G_GROUP:
- H5Gclose(obj_id);
- break;
- case H5G_DATASET:
- H5Dclose(obj_id);
- break;
- case H5G_TYPE:
- H5Tclose(obj_id);
- break;
- default:
- break;
- }
- } H5E_END_TRY;
+ return -1;
}
/*-------------------------------------------------------------------------
* Function: MapIdToName
*
- * Purpose: map an object ID to a name
+ * Purpose: map a ID from a reference to a dataset name
*
*-------------------------------------------------------------------------
*/
@@ -726,57 +655,22 @@ static void close_obj(H5G_obj_t1 obj_type, hid_t obj_id)
static const char* MapIdToName(hid_t refobj_id,
trav_table_t *travt)
{
- hid_t id;
- hid_t fid;
- H5G_stat_t refstat; /* Stat for the refobj id */
- H5G_stat_t objstat; /* Stat for objects in the file */
- unsigned int i;
-
- /* obtain information to identify the referenced object uniquely */
- if(H5Gget_objinfo(refobj_id, ".", 0, &refstat) <0)
- return NULL;
-
- /* obtains the file ID given an object ID. This ID must be closed */
- if ((fid = H5Iget_file_id(refobj_id))<0)
- {
- return NULL;
- }
-
- /* linear search */
- for ( i=0; i<travt->nobjs; i++)
- {
- switch ( travt->objs[i].type )
- {
- default:
- break;
-
- /*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
-
- case H5G_DATASET:
-
- if ((id = H5Dopen(fid,travt->objs[i].name))<0)
- return NULL;
- if(H5Gget_objinfo(id, ".", 0, &objstat) <0)
- return NULL;
- if (H5Dclose(id)<0)
+ unsigned int i;
+
+ /* linear search */
+ for(i = 0; i < travt->nobjs; i++) {
+ if(travt->objs[i].type == H5O_TYPE_DATASET) {
+ H5O_info_t ref_oinfo; /* Stat for the refobj id */
+
+ /* obtain information to identify the referenced object uniquely */
+ if(H5Oget_info(refobj_id, ".", &ref_oinfo, H5P_DEFAULT) < 0)
+ return NULL;
+
+ if(ref_oinfo.addr == travt->objs[i].objno)
+ return(travt->objs[i].name);
+ } /* end if */
+ } /* i */
+
return NULL;
- if (refstat.fileno[0]==objstat.fileno[0] && refstat.fileno[1]==objstat.fileno[1]
- && refstat.objno[0]==objstat.objno[0] && refstat.objno[1]==objstat.objno[1])
- {
- H5Fclose(fid);
- return travt->objs[i].name;
- }
- break;
- } /* switch */
- } /* i */
-
- if (H5Fclose(fid)<0)
- return NULL;
-
- return NULL;
}
-
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 2d7cc7d..e0174b0 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -192,15 +192,13 @@ hsize_t h5diff(const char *fname1,
char filenames[2][1024];
hsize_t nfound = 0;
- memset(filenames, 0, 1024*2);
+ HDmemset(filenames, 0, 1024 * 2);
- if(options->m_quiet &&
- (options->m_verbose || options->m_report))
- {
+ if(options->m_quiet && (options->m_verbose || options->m_report)) {
printf("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
options->err_stat=1;
return 0;
- }
+ } /* end if */
/*-------------------------------------------------------------------------
* open the files first; if they are not valid, no point in continuing
@@ -208,42 +206,32 @@ hsize_t h5diff(const char *fname1,
*/
/* disable error reporting */
- H5E_BEGIN_TRY
- {
+ H5E_BEGIN_TRY {
/* Open the files */
- if ((file1_id = H5Fopen (fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- {
- printf ("h5diff: <%s>: unable to open file\n", fname1);
+ if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ printf("h5diff: <%s>: unable to open file\n", fname1);
options->err_stat = 1;
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
- {
/* Let tasks know that they won't be needed */
phdiff_dismiss_workers();
- }
#endif
-
goto out;
- }
- if ((file2_id = H5Fopen (fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- {
- printf ("h5diff: <%s>: unable to open file\n", fname2);
+ } /* end if */
+ if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ printf("h5diff: <%s>: unable to open file\n", fname2);
options->err_stat = 1;
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
- {
/* Let tasks know that they won't be needed */
phdiff_dismiss_workers();
- }
#endif
-
goto out;
- }
+ } /* end if */
/* enable error reporting */
- }
- H5E_END_TRY;
+ } H5E_END_TRY;
/*-------------------------------------------------------------------------
* Initialize the info structs
@@ -256,84 +244,69 @@ hsize_t h5diff(const char *fname1,
* get the list of objects in the files
*-------------------------------------------------------------------------
*/
- if(h5trav_getinfo(file1_id, info1) < 0 || h5trav_getinfo(file2_id, info2) < 0)
- {
+ if(h5trav_getinfo(file1_id, info1) < 0 || h5trav_getinfo(file2_id, info2) < 0) {
printf("Error: Could not get file contents\n");
options->err_stat = 1;
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
- {
/* Let tasks know that they won't be needed */
phdiff_dismiss_workers();
- }
#endif
goto out;
- }
+ } /* end if */
/*-------------------------------------------------------------------------
* object name was supplied
*-------------------------------------------------------------------------
*/
-
- if (objname1)
- {
-
+ if(objname1) {
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
- {
/* Let tasks know that they won't be needed */
phdiff_dismiss_workers();
- }
#endif
- assert (objname2);
+ assert(objname2);
options->cmn_objs = 1; /* eliminate warning */
- nfound = diff_compare (file1_id, fname1, objname1, info1,
- file2_id, fname2, objname2, info2,
- options);
- }
+ nfound = diff_compare(file1_id, fname1, objname1, info1,
+ file2_id, fname2, objname2, info2,
+ options);
+ } /* end if */
/*-------------------------------------------------------------------------
* compare all
*-------------------------------------------------------------------------
*/
- else
- {
-
+ else {
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
- {
+ if(g_Parallel) {
int i;
- if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024))
- {
+ if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) {
fprintf(stderr, "The parallel diff only supports path names up to 1024 characters\n");
MPI_Abort(MPI_COMM_WORLD, 0);
- }
+ } /* end if */
HDstrcpy(filenames[0], fname1);
HDstrcpy(filenames[1], fname2);
/* Alert the worker tasks that there's going to be work. */
-
for(i = 1; i < g_nTasks; i++)
- MPI_Send(filenames, 1024 * 2, MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD);
- }
+ MPI_Send(filenames, (1024 * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD);
+ } /* end if */
#endif
nfound = diff_match(file1_id, info1, file2_id, info2, options);
- }
+ } /* end else */
trav_info_free(info1);
trav_info_free(info2);
out:
/* close */
- H5E_BEGIN_TRY
- {
+ H5E_BEGIN_TRY {
H5Fclose(file1_id);
H5Fclose(file2_id);
- }
- H5E_END_TRY;
+ } H5E_END_TRY;
return nfound;
}
@@ -358,411 +331,360 @@ out:
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_match (hid_t file1_id,
+hsize_t diff_match(hid_t file1_id,
trav_info_t * info1,
hid_t file2_id,
trav_info_t * info2,
diff_opt_t * options)
{
- int more_names_exist = (info1->nused > 0 && info2->nused > 0) ? 1 : 0;
- trav_table_t *table = NULL;
- int cmp;
- size_t curr1 = 0;
- size_t curr2 = 0;
- unsigned infile[2];
- char c1, c2;
- hsize_t nfound = 0;
- unsigned i;
-
-/*-------------------------------------------------------------------------
- * build the list
- *-------------------------------------------------------------------------
- */
- trav_table_init (&table);
-
- while (more_names_exist)
- {
- /* criteria is string compare */
- cmp = HDstrcmp(info1->paths[curr1].path, info2->paths[curr2].path);
- if (cmp == 0)
- {
- infile[0] = 1;
- infile[1] = 1;
- trav_table_addflags (infile, info1->paths[curr1].path, info1->paths[curr1].type,
- table);
-
- curr1++;
- curr2++;
- }
- else if (cmp < 0)
- {
- infile[0] = 1;
- infile[1] = 0;
- trav_table_addflags (infile, info1->paths[curr1].path, info1->paths[curr1].type,
- table);
- curr1++;
- }
- else
- {
- infile[0] = 0;
- infile[1] = 1;
- trav_table_addflags (infile, info2->paths[curr2].path, info2->paths[curr2].type,
- table);
- curr2++;
- }
-
- more_names_exist = (curr1 < info1->nused && curr2 < info2->nused) ? 1 : 0;
-
- } /* end while */
-
- /* list1 did not end */
- if (curr1 < info1->nused)
- {
- while (curr1 < info1->nused)
- {
- infile[0] = 1;
- infile[1] = 0;
- trav_table_addflags (infile, info1->paths[curr1].path, info1->paths[curr1].type,
- table);
- curr1++;
- }
- }
+ trav_table_t *table = NULL;
+ size_t curr1, curr2;
+ unsigned infile[2];
+ hsize_t nfound = 0;
+ unsigned i;
- /* list2 did not end */
- if (curr2 < info2->nused)
- {
- while (curr2 < info2->nused)
- {
- infile[0] = 0;
- infile[1] = 1;
- trav_table_addflags (infile, info2->paths[curr2].path, info2->paths[curr2].type,
- table);
- curr2++;
- }
- }
+ /*-------------------------------------------------------------------------
+ * build the list
+ *-------------------------------------------------------------------------
+ */
+ trav_table_init(&table);
+
+ curr1 = 0;
+ curr2 = 0;
+ while(curr1 < info1->nused && curr2 < info2->nused) {
+ /* criteria is string compare */
+ int cmp = HDstrcmp(info1->paths[curr1].path, info2->paths[curr2].path);
+
+ if(cmp == 0) {
+ infile[0] = 1;
+ infile[1] = 1;
+ trav_table_addflags(infile, info1->paths[curr1].path, info1->paths[curr1].type, table);
+
+ curr1++;
+ curr2++;
+ } /* end if */
+ else if(cmp < 0) {
+ infile[0] = 1;
+ infile[1] = 0;
+ trav_table_addflags(infile, info1->paths[curr1].path, info1->paths[curr1].type, table);
+ curr1++;
+ } /* end else-if */
+ else {
+ infile[0] = 0;
+ infile[1] = 1;
+ trav_table_addflags(infile, info2->paths[curr2].path, info2->paths[curr2].type, table);
+ curr2++;
+ } /* end else */
+ } /* end while */
+
+ /* list1 did not end */
+ infile[0] = 1;
+ infile[1] = 0;
+ while(curr1 < info1->nused) {
+ trav_table_addflags(infile, info1->paths[curr1].path, info1->paths[curr1].type, table);
+ curr1++;
+ } /* end while */
+
+ /* list2 did not end */
+ infile[0] = 0;
+ infile[1] = 1;
+ while(curr2 < info2->nused) {
+ trav_table_addflags(infile, info2->paths[curr2].path, info2->paths[curr2].type, table);
+ curr2++;
+ } /* end while */
-/*-------------------------------------------------------------------------
- * print the list
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * print the list
+ *-------------------------------------------------------------------------
+ */
+ if(options->m_verbose) {
+ printf("\n");
+ printf("file1 file2\n");
+ printf("---------------------------------------\n");
+ for(i = 0; i < table->nobjs; i++) {
+ char c1, c2;
- if (options->m_verbose)
- {
- printf ("\n");
- printf ("file1 file2\n");
- printf ("---------------------------------------\n");
- for (i = 0; i < table->nobjs; i++)
- {
- c1 = (table->objs[i].flags[0]) ? 'x' : ' ';
- c2 = (table->objs[i].flags[1]) ? 'x' : ' ';
- printf ("%5c %6c %-15s\n", c1, c2, table->objs[i].name);
- }
- printf ("\n");
- }
+ c1 = (table->objs[i].flags[0]) ? 'x' : ' ';
+ c2 = (table->objs[i].flags[1]) ? 'x' : ' ';
+ printf("%5c %6c %-15s\n", c1, c2, table->objs[i].name);
+ } /* end for */
+ printf ("\n");
+ } /* end if */
-/*-------------------------------------------------------------------------
- * do the diff for common objects
- *-------------------------------------------------------------------------
- */
- {
+ /*-------------------------------------------------------------------------
+ * do the diff for common objects
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_PARALLEL
- char* workerTasks = malloc((g_nTasks-1) * sizeof(char));
- int n;
- int busyTasks=0;
- struct diffs_found nFoundbyWorker;
- struct diff_args args;
- int havePrintToken = 1;
- MPI_Status Status;
-
- /*set all tasks as free */
- memset(workerTasks, 1, g_nTasks-1);
+{
+ char *workerTasks = HDmalloc((g_nTasks - 1) * sizeof(char));
+ int n;
+ int busyTasks = 0;
+ struct diffs_found nFoundbyWorker;
+ struct diff_args args;
+ int havePrintToken = 1;
+ MPI_Status Status;
+
+ /*set all tasks as free */
+ HDmemset(workerTasks, 1, (g_nTasks - 1));
#endif
- for (i = 0; i < table->nobjs; i++)
- {
- if (table->objs[i].flags[0] && table->objs[i].flags[1])
- {
+ for(i = 0; i < table->nobjs; i++) {
+ if(table->objs[i].flags[0] && table->objs[i].flags[1]) {
+ options->cmn_objs = 1;
+ if(!g_Parallel) {
+ nfound += diff(file1_id,
+ table->objs[i].name,
+ file2_id,
+ table->objs[i].name, options, table->objs[i].type);
+ } /* end if */
#ifdef H5_HAVE_PARALLEL
- int workerFound = 0;
+ else {
+ int workerFound = 0;
+
+ h5diffdebug("beginning of big else block\n");
+ /* We're in parallel mode */
+ /* Since the data type of diff value is hsize_t which can
+ * be arbitary large such that there is no MPI type that
+ * matches it, the value is passed between processes as
+ * an array of bytes in order to be portable. But this
+ * may not work in non-homogeneous MPI environments.
+ */
+
+ /*Set up args to pass to worker task. */
+ if(strlen(table->objs[i].name) > 255) {
+ printf("The parallel diff only supports object names up to 255 characters\n");
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ } /* end if */
+
+ HDstrcpy(args.name, table->objs[i].name);
+ args.options = *options;
+ args.type= table->objs[i].type;
+
+ h5diffdebug2("busyTasks=%d\n", busyTasks);
+ /* if there are any outstanding print requests, let's handle one. */
+ if(busyTasks > 0) {
+ int incomingMessage;
+
+ /* check if any tasks freed up, and didn't need to print. */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status);
+
+ /* first block*/
+ if(incomingMessage) {
+ workerTasks[Status.MPI_SOURCE - 1] = 1;
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ } /* end if */
+
+ /* check to see if the print token was returned. */
+ if(!havePrintToken) {
+ /* If we don't have the token, someone is probably sending us output */
+ print_incoming_data();
+
+ /* check incoming queue for token */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+
+ /* incoming token implies free task. */
+ if(incomingMessage) {
+ workerTasks[Status.MPI_SOURCE - 1] = 1;
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ havePrintToken = 1;
+ } /* end if */
+ } /* end if */
+
+ /* check to see if anyone needs the print token. */
+ if(havePrintToken) {
+ /* check incoming queue for print token requests */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status);
+ if(incomingMessage) {
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ havePrintToken = 0;
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+ /* check array of tasks to see which ones are free.
+ * Manager task never does work, so freeTasks[0] is really
+ * worker task 0. */
+ for(n = 1; (n < g_nTasks) && !workerFound; n++) {
+ if(workerTasks[n-1]) {
+ /* send file id's and names to first free worker */
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD);
+
+ /* increment counter for total number of prints. */
+ busyTasks++;
+
+ /* mark worker as busy */
+ workerTasks[n - 1] = 0;
+ workerFound = 1;
+ } /* end if */
+ } /* end for */
+
+ h5diffdebug2("workerfound is %d \n", workerFound);
+ if(!workerFound) {
+ /* if they were all busy, we've got to wait for one free up
+ * before we can move on. If we don't have the token, some
+ * task is currently printing so we'll wait for that task to
+ * return it.
+ */
+
+ if(!havePrintToken) {
+ while(!havePrintToken) {
+ int incomingMessage;
+
+ print_incoming_data();
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+ if(incomingMessage) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ havePrintToken = 1;
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ /* send this task the work unit. */
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ } /* end if */
+ } /* end while */
+ } /* end if */
+ /* if we do have the token, check for task to free up, or wait for a task to request it */
+ else {
+ /* But first print all the data in our incoming queue */
+ print_incoming_data();
+ MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ if(Status.MPI_TAG == MPI_TAG_DONE) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ } /* end if */
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
+ int incomingMessage;
+
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+
+ do {
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+
+ print_incoming_data();
+ } while(!incomingMessage);
+
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ } /* end else-if */
+ else {
+ printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ MPI_Finalize();
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ } /* end else */
#endif /* H5_HAVE_PARALLEL */
- options->cmn_objs = 1;
- if(!g_Parallel)
- {
- nfound += diff (file1_id,
- table->objs[i].name,
- file2_id,
- table->objs[i].name, options, table->objs[i].type);
- }
-#ifdef H5_HAVE_PARALLEL
- else
- {
- h5diffdebug("beginning of big else block\n");
- /* We're in parallel mode */
- /* Since the data type of diff value is hsize_t which can
- * be arbitary large such that there is no MPI type that
- * matches it, the value is passed between processes as
- * an array of bytes in order to be portable. But this
- * may not work in non-homogeneous MPI environments.
- */
-
- /*Set up args to pass to worker task. */
- if(strlen(table->objs[i].name) > 255)
- {
- printf("The parallel diff only supports object names up to 255 characters\n");
- MPI_Abort(MPI_COMM_WORLD, 0);
- }
-
- strcpy(args.name, table->objs[i].name);
- args.options = *options;
- args.type= table->objs[i].type;
-
- h5diffdebug2("busyTasks=%d\n", busyTasks);
- /* if there are any outstanding print requests, let's handle one. */
- if(busyTasks > 0)
- {
- int incomingMessage;
- /* check if any tasks freed up, and didn't need to print. */
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status);
-
- /* first block*/
- if(incomingMessage)
- {
- workerTasks[Status.MPI_SOURCE-1] = 1;
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- }
-
- /* check to see if the print token was returned. */
- if(!havePrintToken)
- {
- /* If we don't have the token, someone is probably sending us output */
- print_incoming_data();
-
- /* check incoming queue for token */
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
-
- /* incoming token implies free task. */
- if(incomingMessage)
- {
- workerTasks[Status.MPI_SOURCE-1] = 1;
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- havePrintToken = 1;
- }
- }
-
- /* check to see if anyone needs the print token. */
- if(havePrintToken)
- {
- /* check incoming queue for print token requests */
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
- MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
- havePrintToken = 0;
- }
- }
- }
-
- /* check array of tasks to see which ones are free.
- * Manager task never does work, so freeTasks[0] is really
- * worker task 0. */
+ } /* end if */
+ } /* end for */
+ h5diffdebug("done with for loop\n");
- for(n=1; (n<g_nTasks) && !workerFound; n++)
- {
- if(workerTasks[n-1])
- {
- /* send file id's and names to first free worker */
- MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD);
-
- /* increment counter for total number of prints. */
- busyTasks++;
+#ifdef H5_HAVE_PARALLEL
+ if(g_Parallel) {
+ /* make sure all tasks are done */
+ while(busyTasks > 0) {
+ MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ if(Status.MPI_TAG == MPI_TAG_DONE) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ } /* end if */
+ else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ havePrintToken = 1;
+ } /* end else-if */
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
+ if(havePrintToken) {
+ int incomingMessage;
+
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+
+ do {
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+
+ print_incoming_data();
+ } while(!incomingMessage);
+
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ } /* end if */
+ /* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */
+ else {
+ int source = Status.MPI_SOURCE;
+ int incomingMessage;
+
+ do {
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+
+ print_incoming_data();
+ } while(!incomingMessage);
+
+
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ } /* end else */
+ } /* end else-if */
+ else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ havePrintToken = 1;
+ } /* end else-if */
+ else if(Status.MPI_TAG == MPI_TAG_PRINT_DATA)
+ {
+ char data[PRINT_DATA_MAX_SIZE + 1];
+ HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1);
- /* mark worker as busy */
- workerTasks[n-1] = 0;
- workerFound = 1;
- }
-
- }
+ MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
+ printf("%s", data);
+ } /* end else-if */
+ else {
+ printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ } /* end else */
+ } /* end while */
- h5diffdebug2("workerfound is %d \n", workerFound);
- if(!workerFound)
- {
- /* if they were all busy, we've got to wait for one free up before we can move on.
- * if we don't have the token, some task is currently printing so we'll wait for that task to return it. */
+ for(i = 1; i < g_nTasks; i++)
+ MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
- if(!havePrintToken)
- {
- while(!havePrintToken) {
- int incomingMessage;
+ /* Print any final data waiting in our queue */
print_incoming_data();
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- havePrintToken = 1;
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- /* send this task the work unit. */
- MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
- }
- }
- }
- /* if we do have the token, check for task to free up, or wait for a task to request it */
- else
- {
- /* But first print all the data in our incoming queue */
- print_incoming_data();
- MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE)
- {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
- }
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
- {
- int incomingMessage;
- MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
-
- do
- {
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
-
- print_incoming_data();
- }
- while(!incomingMessage);
-
-
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
- }
- else
- {
- printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG);
- MPI_Abort(MPI_COMM_WORLD, 0);
- MPI_Finalize();
- }
- }
- }
- }
-#endif /* H5_HAVE_PARALLEL */
- }
- }
- h5diffdebug("done with for loop\n");
-
-#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
- {
- while(busyTasks > 0) /* make sure all tasks are done */
- {
- MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE)
- {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- }
- else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN)
- {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- havePrintToken = 1;
- }
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
- {
- MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- if(havePrintToken)
- {
- int incomingMessage;
- MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
- do
- {
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
-
- print_incoming_data();
- }
- while(!incomingMessage);
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- }
- else /* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */
- {
- int source = Status.MPI_SOURCE;
- int incomingMessage;
- do
- {
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
-
- print_incoming_data();
- }
- while(!incomingMessage);
-
-
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
- }
- }
- else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN)
- {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- havePrintToken = 1;
- }
- else if(Status.MPI_TAG == MPI_TAG_PRINT_DATA)
- {
- char data[PRINT_DATA_MAX_SIZE+1];
- memset(data, 0, PRINT_DATA_MAX_SIZE+1);
-
- MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
-
- printf("%s", data);
- }
- else
- {
- printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG);
- MPI_Abort(MPI_COMM_WORLD, 0);
- }
- }
-
- for(i=1; i<g_nTasks; i++)
- MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
-
- /* Print any final data waiting in our queue */
- print_incoming_data();
+ } /* end if */
+ h5diffdebug("done with if block\n");
- }
- h5diffdebug("done with if block\n");
-
- free(workerTasks);
+ free(workerTasks);
+}
#endif /* H5_HAVE_PARALLEL */
- }
- /* free table */
- trav_table_free (table);
+ /* free table */
+ trav_table_free(table);
- return nfound;
+ return nfound;
}
@@ -856,173 +778,157 @@ hsize_t diff_compare (hid_t file1_id,
*-------------------------------------------------------------------------
*/
-hsize_t diff (hid_t file1_id,
+hsize_t diff(hid_t file1_id,
const char *path1,
hid_t file2_id,
const char *path2,
diff_opt_t * options,
- H5G_obj_t1 type)
+ h5trav_type_t type)
{
- hid_t type1_id=(-1);
- hid_t type2_id=(-1);
- hid_t grp1_id=(-1);
- hid_t grp2_id=(-1);
+ hid_t type1_id = (-1);
+ hid_t type2_id = (-1);
+ hid_t grp1_id = (-1);
+ hid_t grp2_id = (-1);
int ret;
- H5G_stat_t sb1;
- H5G_stat_t sb2;
hsize_t nfound = 0;
- switch (type)
- {
-
- /*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
- case H5G_DATASET:
-
+ switch(type) {
/*-------------------------------------------------------------------------
- * verbose, always print name
+ * H5TRAV_TYPE_DATASET
*-------------------------------------------------------------------------
*/
- if (options->m_verbose)
- {
- if (print_objname(options,(hsize_t)1))
- do_print_objname ("dataset", path1, path2);
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
- print_found(nfound);
+ case H5TRAV_TYPE_DATASET:
+ /*-------------------------------------------------------------------------
+ * verbose, always print name
+ *-------------------------------------------------------------------------
+ */
+ if(options->m_verbose) {
+ if(print_objname(options, (hsize_t)1))
+ do_print_objname("dataset", path1, path2);
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ print_found(nfound);
+ } /* end if */
+ /*-------------------------------------------------------------------------
+ * non verbose, check first if we have differences by enabling quiet mode
+ * so that printing is off, and compare again if differences found,
+ * disabling quite mode
+ *-------------------------------------------------------------------------
+ */
+ else {
+ if(options->m_quiet == 0) {
+ /* shut up temporarily */
+ options->m_quiet = 1;
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+
+ /* print again */
+ options->m_quiet = 0;
+ if(nfound) {
+ if(print_objname(options,nfound))
+ do_print_objname("dataset", path1, path2);
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ print_found(nfound);
+ } /* end if */
+ } /* end if */
+ /* in quiet mode, just count differences */
+ else
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ } /* end else */
+ break;
- }
/*-------------------------------------------------------------------------
- * non verbose, check first if we have differences by enabling quiet mode
- * so that printing is off, and compare again if differences found,
- * disabling quite mode
+ * H5TRAV_TYPE_NAMED_DATATYPE
*-------------------------------------------------------------------------
*/
- else
- {
- if (options->m_quiet==0)
- {
- /* shut up temporarily */
- options->m_quiet=1;
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
- /* print again */
- options->m_quiet=0;
- if (nfound)
- {
- if (print_objname(options,nfound))
- do_print_objname ("dataset", path1, path2);
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
- print_found(nfound);
- }
- }
- /* in quiet mode, just count differences */
- else
- {
- nfound=diff_dataset(file1_id,file2_id,path1,path2,options);
- }
- }
-
- break;
-
- /*-------------------------------------------------------------------------
- * H5G_TYPE
- *-------------------------------------------------------------------------
- */
- case H5G_TYPE:
-
- if ((type1_id = H5Topen(file1_id, path1))<0)
- goto out;
- if ((type2_id = H5Topen(file2_id, path2))<0)
- goto out;
-
- if ((ret = H5Tequal(type1_id,type2_id))<0)
- goto out;
-
- /* if H5Tequal is > 0 then the datatypes refer to the same datatype */
- nfound = (ret>0) ? 0 : 1;
-
- if (print_objname(options,nfound))
- do_print_objname ("datatype", path1, path2);
-
- /* always print the number of differences found in verbose mode */
- if (options->m_verbose)
- print_found(nfound);
-
- /*-------------------------------------------------------------------------
- * compare attributes
- * the if condition refers to cases when the dataset is a referenced object
- *-------------------------------------------------------------------------
- */
- if (path1)
- nfound += diff_attr(type1_id,type2_id,path1,path2,options);
-
- if ( H5Tclose(type1_id)<0)
- goto out;
- if ( H5Tclose(type2_id)<0)
- goto out;
-
- break;
-
- /*-------------------------------------------------------------------------
- * H5G_GROUP
- *-------------------------------------------------------------------------
- */
- case H5G_GROUP:
+ case H5TRAV_TYPE_NAMED_DATATYPE:
+ if((type1_id = H5Topen(file1_id, path1)) < 0)
+ goto out;
+ if((type2_id = H5Topen(file2_id, path2)) < 0)
+ goto out;
+
+ if((ret = H5Tequal(type1_id, type2_id)) < 0)
+ goto out;
+
+ /* if H5Tequal is > 0 then the datatypes refer to the same datatype */
+ nfound = (ret > 0) ? 0 : 1;
+
+ if(print_objname(options,nfound))
+ do_print_objname("datatype", path1, path2);
- ret = HDstrcmp(path1, path2);
-
- /* if "path1" != "path2" then the groups are "different" */
- nfound = (ret != 0) ? 1 : 0;
+ /* always print the number of differences found in verbose mode */
+ if(options->m_verbose)
+ print_found(nfound);
+
+ /*-------------------------------------------------------------------------
+ * compare attributes
+ * the if condition refers to cases when the dataset is a referenced object
+ *-------------------------------------------------------------------------
+ */
+ if(path1)
+ nfound += diff_attr(type1_id, type2_id, path1, path2, options);
+
+ if(H5Tclose(type1_id) < 0)
+ goto out;
+ if(H5Tclose(type2_id) < 0)
+ goto out;
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_GROUP
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_GROUP:
+ ret = HDstrcmp(path1, path2);
- if(print_objname(options, nfound))
- do_print_objname("group", path1, path2);
+ /* if "path1" != "path2" then the groups are "different" */
+ nfound = (ret != 0) ? 1 : 0;
+
+ if(print_objname(options, nfound))
+ do_print_objname("group", path1, path2);
- /* always print the number of differences found in verbose mode */
- if(options->m_verbose)
- print_found(nfound);
-
- if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0)
- goto out;
- if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0)
- goto out;
+ /* always print the number of differences found in verbose mode */
+ if(options->m_verbose)
+ print_found(nfound);
+
+ if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0)
+ goto out;
+ if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0)
+ goto out;
- /*-------------------------------------------------------------------------
- * compare attributes
- * the if condition refers to cases when the dataset is a referenced object
- *-------------------------------------------------------------------------
- */
- if(path1)
- nfound += diff_attr(grp1_id, grp2_id, path1, path2, options);
-
- if(H5Gclose(grp1_id) < 0)
- goto out;
- if(H5Gclose(grp2_id) < 0)
- goto out;
-
- break;
-
-
- /*-------------------------------------------------------------------------
- * H5G_LINK
- *-------------------------------------------------------------------------
- */
- case H5G_LINK:
- {
- char *buf1 = NULL;
- char *buf2 = NULL;
+ /*-------------------------------------------------------------------------
+ * compare attributes
+ * the if condition refers to cases when the dataset is a referenced object
+ *-------------------------------------------------------------------------
+ */
+ if(path1)
+ nfound += diff_attr(grp1_id, grp2_id, path1, path2, options);
+
+ if(H5Gclose(grp1_id) < 0)
+ goto out;
+ if(H5Gclose(grp2_id) < 0)
+ goto out;
+ break;
+
- if(H5Gget_objinfo(file1_id, path1, FALSE, &sb1) < 0)
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_LINK
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_LINK:
+ {
+ H5L_info_t li1, li2;
+ char *buf1, *buf2;
+
+ if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0)
goto out;
- if(H5Gget_objinfo(file1_id, path1, FALSE, &sb2) < 0)
+ if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0)
goto out;
- buf1 = HDmalloc(sb1.linklen);
- buf2 = HDmalloc(sb2.linklen);
+ buf1 = HDmalloc(li1.u.val_size);
+ buf2 = HDmalloc(li2.u.val_size);
- if(H5Lget_val(file1_id, path1, buf1, sb1.linklen, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0)
goto out;
- if(H5Lget_val(file2_id, path2, buf2, sb2.linklen, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0)
goto out;
ret = HDstrcmp(buf1, buf2);
@@ -1039,19 +945,16 @@ hsize_t diff (hid_t file1_id,
HDfree(buf1);
HDfree(buf2);
- }
- break;
-
- /*-------------------------------------------------------------------------
- * H5G_UDLINK
- *-------------------------------------------------------------------------
- */
- case H5G_UDLINK:
- {
- char *buf1 = NULL;
- char *buf2 = NULL;
- H5L_info_t li1;
- H5L_info_t li2;
+ }
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_UDLINK
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_UDLINK:
+ {
+ H5L_info_t li1, li2;
if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0)
goto out;
@@ -1059,36 +962,36 @@ hsize_t diff (hid_t file1_id,
goto out;
/* Only external links will have a query function registered */
- if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL)
- {
- buf1 = HDmalloc (li1.u.val_size);
- buf2 = HDmalloc (li2.u.val_size);
+ if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) {
+ char *buf1, *buf2;
+
+ buf1 = HDmalloc(li1.u.val_size);
+ buf2 = HDmalloc(li2.u.val_size);
- if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0)
- {
- HDfree (buf1); HDfree (buf2);
+ if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) {
+ HDfree(buf1);
+ HDfree(buf2);
goto out;
- }
- if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0)
- {
- HDfree (buf1); HDfree (buf2);
+ } /* end if */
+ if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) {
+ HDfree(buf1);
+ HDfree(buf2);
goto out;
- }
+ } /* end if */
/* If the buffers are the same size, compare them */
- if(li1.u.val_size == li2.u.val_size)
- {
- if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0)
- {
- HDfree (buf1); HDfree (buf2);
+ if(li1.u.val_size == li2.u.val_size) {
+ if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) {
+ HDfree(buf1);
+ HDfree(buf2);
goto out;
- }
- if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0)
- {
- HDfree (buf1); HDfree (buf2);
+ } /* end if */
+ if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) {
+ HDfree(buf1);
+ HDfree(buf2);
goto out;
- }
- ret = HDmemcmp (buf1, buf2, li1.u.val_size);
+ } /* end if */
+ ret = HDmemcmp(buf1, buf2, li1.u.val_size);
}
else
ret = 1;
@@ -1096,18 +999,20 @@ hsize_t diff (hid_t file1_id,
/* if "buf1" != "buf2" then the links are "different" */
nfound = (ret != 0) ? 1 : 0;
- if (print_objname (options, nfound))
- do_print_objname ("external link", path1, path2);
- }
- else
- {
- /* If one or both of these links isn't an external link, we can only
- * compare information from H5Lget_info since we don't have a query
- * function registered for them.
- *
- * If the link classes or the buffer length are not the
- * same, the links are "different"
- */
+ if(print_objname(options, nfound))
+ do_print_objname("external link", path1, path2);
+
+ HDfree(buf1);
+ HDfree(buf2);
+ } /* end if */
+ else {
+ /* If one or both of these links isn't an external link, we can only
+ * compare information from H5Lget_info since we don't have a query
+ * function registered for them.
+ *
+ * If the link classes or the buffer length are not the
+ * same, the links are "different"
+ */
if((li1.type != li2.type) || (li1.u.val_size != li2.u.val_size))
nfound = 1;
else
@@ -1115,47 +1020,37 @@ hsize_t diff (hid_t file1_id,
if (print_objname (options, nfound))
do_print_objname ("user defined link", path1, path2);
- }
+ } /* end else */
/* always print the number of differences found in verbose mode */
- if (options->m_verbose)
+ if(options->m_verbose)
print_found(nfound);
+ }
+ break;
- HDfree (buf1);
- HDfree (buf2);
- }
- break;
-
- default:
- if (options->m_verbose)
- {
- printf("Comparison not supported: <%s> and <%s> are of type %s\n",
- path1, path2, get_type(type) );
- }
- options->not_cmp=1;
- break;
- }
-
+ default:
+ if(options->m_verbose)
+ printf("Comparison not supported: <%s> and <%s> are of type %s\n",
+ path1, path2, get_type(type) );
+ options->not_cmp = 1;
+ break;
+ }
- return nfound;
+ return nfound;
out:
+ options->err_stat = 1;
- options->err_stat=1;
-
- /* close */
- /* disable error reporting */
- H5E_BEGIN_TRY
- {
- H5Tclose (type1_id);
- H5Tclose (type2_id);
- H5Gclose (grp1_id);
- H5Tclose (grp2_id);
- /* enable error reporting */
- }
- H5E_END_TRY;
-
- return nfound;
-}
+ /* close */
+ /* disable error reporting */
+ H5E_BEGIN_TRY {
+ H5Tclose(type1_id);
+ H5Tclose(type2_id);
+ H5Gclose(grp1_id);
+ H5Tclose(grp2_id);
+ /* enable error reporting */
+ } H5E_END_TRY;
+ return nfound;
+}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index e22502f..60e96b2 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -25,18 +25,18 @@
*/
typedef struct {
- int m_quiet; /* quiet mide: no output at all */
- int m_report; /* report mode: print the data */
- int m_verbose; /* verbose mode: print the data, list of objcets, warnings */
- int d; /* delta, absolute value to compare */
- double delta; /* delta value */
- int p; /* relative error to compare*/
- double percent; /* relative error value */
- int n; /* count, compare up to count */
- hsize_t count; /* count value */
- int err_stat; /* an error ocurred (1, error, 0, no error) */
- int cmn_objs; /* do we have comparable objects */
- int not_cmp; /* are the objects comparable */
+ int m_quiet; /* quiet mide: no output at all */
+ int m_report; /* report mode: print the data */
+ int m_verbose; /* verbose mode: print the data, list of objcets, warnings */
+ int d; /* delta, absolute value to compare */
+ double delta; /* delta value */
+ int p; /* relative error to compare*/
+ double percent; /* relative error value */
+ int n; /* count, compare up to count */
+ hsize_t count; /* count value */
+ int err_stat; /* an error ocurred (1, error, 0, no error) */
+ int cmn_objs; /* do we have comparable objects */
+ int not_cmp; /* are the objects comparable */
} diff_opt_t;
@@ -89,7 +89,7 @@ hsize_t diff( hid_t file1_id,
hid_t file2_id,
const char *path2,
diff_opt_t *options,
- H5G_obj_t type );
+ h5trav_type_t type );
hsize_t diff_compare( hid_t file1_id,
const char *file1_name,
@@ -177,161 +177,160 @@ hsize_t diff_datum(void *_mem1,
hsize_t diff_float(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_double(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_schar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_uchar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_short(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_ushort(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_int(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_uint(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_long(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_ulong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_llong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
hsize_t diff_ullong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
#endif /* H5DIFF_H__ */
+
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 45f46ad..f83a36d 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -2178,189 +2178,165 @@ hsize_t diff_region(hid_t obj1_id,
diff_opt_t *options)
{
- hssize_t nblocks1, npoints1;
- hssize_t nblocks2, npoints2;
- H5G_stat_t sb1;
- H5G_stat_t sb2;
- hsize_t alloc_size;
- hsize_t *ptdata1;
- hsize_t *ptdata2;
- int ndims1;
- int ndims2;
- int i, j;
- haddr_t objno1, objno2; /* compact form of object's location */
- hsize_t nfound_b=0; /* block differences found */
- hsize_t nfound_p=0; /* point differences found */
-
- ndims1 = H5Sget_simple_extent_ndims(region1_id);
- ndims2 = H5Sget_simple_extent_ndims(region2_id);
-
- H5Gget_objinfo(obj1_id, ".", FALSE, &sb1);
- H5Gget_objinfo(obj2_id, ".", FALSE, &sb2);
-
- objno1 = (haddr_t)sb1.objno[0] | ((haddr_t)sb1.objno[1] << (8 * sizeof(long)));
- objno2 = (haddr_t)sb2.objno[0] | ((haddr_t)sb2.objno[1] << (8 * sizeof(long)));
-
-/*
- * These two functions fail if the region does not have blocks or points,
- * respectively. They do not currently know how to translate from one to
- * the other.
- */
- H5E_BEGIN_TRY {
- nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
- nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
-
- npoints1 = H5Sget_select_elem_npoints(region1_id);
- npoints2 = H5Sget_select_elem_npoints(region2_id);
- } H5E_END_TRY;
-
- if (nblocks1!=nblocks2 || npoints1!=npoints2 || ndims1!=ndims2)
- {
- options->not_cmp=1;
- return 0;
- }
-
-/*-------------------------------------------------------------------------
- * compare block information
- *-------------------------------------------------------------------------
- */
- if (nblocks1 > 0)
- {
-
- alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]);
- assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
-
- ptdata1 = malloc((size_t)alloc_size);
- H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1);
-
- ptdata2 = malloc((size_t)alloc_size);
- H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2);
-
- for (i = 0; i < nblocks1; i++)
- {
- /* start coordinates and opposite corner */
- for (j = 0; j < ndims1; j++)
- {
- hsize_t start1, start2, end1, end2;
- start1 = ptdata1[i * 2 * ndims1 + j];
- start2 = ptdata2[i * 2 * ndims1 + j];
- end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
- end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
- if (start1 != start2 || end1 != end2)
- {
- nfound_b++;
+ hssize_t nblocks1, npoints1;
+ hssize_t nblocks2, npoints2;
+ hsize_t alloc_size;
+ hsize_t *ptdata1;
+ hsize_t *ptdata2;
+ int ndims1;
+ int ndims2;
+ int i, j;
+ hsize_t nfound_b = 0; /* block differences found */
+ hsize_t nfound_p = 0; /* point differences found */
+
+ ndims1 = H5Sget_simple_extent_ndims(region1_id);
+ ndims2 = H5Sget_simple_extent_ndims(region2_id);
+
+ /*
+ * These two functions fail if the region does not have blocks or points,
+ * respectively. They do not currently know how to translate from one to
+ * the other.
+ */
+ H5E_BEGIN_TRY {
+ nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
+ nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
+
+ npoints1 = H5Sget_select_elem_npoints(region1_id);
+ npoints2 = H5Sget_select_elem_npoints(region2_id);
+ } H5E_END_TRY;
+
+ if(nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
+ options->not_cmp = 1;
+ return 0;
}
- }
- }
+ /*-------------------------------------------------------------------------
+ * compare block information
+ *-------------------------------------------------------------------------
+ */
+ if(nblocks1 > 0) {
+ alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]);
+ assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+
+ ptdata1 = malloc((size_t)alloc_size);
+ H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
+ H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1);
+
+ ptdata2 = malloc((size_t)alloc_size);
+ H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
+ H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2);
+
+ for (i = 0; i < nblocks1; i++) {
+ /* start coordinates and opposite corner */
+ for (j = 0; j < ndims1; j++) {
+ hsize_t start1, start2, end1, end2;
+
+ start1 = ptdata1[i * 2 * ndims1 + j];
+ start2 = ptdata2[i * 2 * ndims1 + j];
+ end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
+ end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
+ if (start1 != start2 || end1 != end2)
+ nfound_b++;
+ }
+ }
- /* print differences if found */
- if (nfound_b && options->m_verbose)
- {
- parallel_print("Referenced dataset %lu %lu\n",
- (unsigned long)objno1,(unsigned long)objno2);
- parallel_print("------------------------------------------------------------\n");
-
- parallel_print("Region blocks\n");
- for (i = 0; i < nblocks1; i++)
- {
- parallel_print("block #%d", i);
- print_region_block(i, ptdata1, ndims1);
- print_region_block(i, ptdata2, ndims1);
- parallel_print("\n");
-
- }
- }
- HDfree(ptdata1);
- HDfree(ptdata2);
- }
+ /* print differences if found */
+ if (nfound_b && options->m_verbose) {
+ H5O_info_t oi1, oi2;
-/*-------------------------------------------------------------------------
- * compare point information
- *-------------------------------------------------------------------------
- */
+ H5Oget_info(obj1_id, ".", &oi1, H5P_DEFAULT);
+ H5Oget_info(obj2_id, ".", &oi2, H5P_DEFAULT);
- if (npoints1 > 0)
- {
- alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]);
- assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
-
- ptdata1 = malloc((size_t)alloc_size);
- H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
- H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1);
+ parallel_print("Referenced dataset %lu %lu\n",
+ (unsigned long)oi1.addr, (unsigned long)oi2.addr);
+ parallel_print("------------------------------------------------------------\n");
- ptdata2 = malloc((size_t)alloc_size);
- H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
- H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2);
+ parallel_print("Region blocks\n");
+ for (i = 0; i < nblocks1; i++) {
+ parallel_print("block #%d", i);
+ print_region_block(i, ptdata1, ndims1);
+ print_region_block(i, ptdata2, ndims1);
+ parallel_print("\n");
+ }
+ }
- for (i = 0; i < npoints1; i++)
- {
- hsize_t pt1, pt2;
+ HDfree(ptdata1);
+ HDfree(ptdata2);
+ }
- for (j = 0; j < ndims1; j++)
- {
- pt1 = ptdata1[i * ndims1 + j];
- pt2 = ptdata2[i * ndims1 + j];
- if (pt1 != pt2)
- nfound_p++;
- }
- }
+ /*-------------------------------------------------------------------------
+ * compare point information
+ *-------------------------------------------------------------------------
+ */
+ if(npoints1 > 0) {
+ alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]);
+ assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+
+ ptdata1 = malloc((size_t)alloc_size);
+ H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
+ H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1);
+
+ ptdata2 = malloc((size_t)alloc_size);
+ H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
+ H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2);
+
+ for(i = 0; i < npoints1; i++) {
+ hsize_t pt1, pt2;
+
+ for(j = 0; j < ndims1; j++) {
+ pt1 = ptdata1[i * ndims1 + j];
+ pt2 = ptdata2[i * ndims1 + j];
+ if(pt1 != pt2)
+ nfound_p++;
+ }
+ }
- if (nfound_p && options->m_verbose)
- {
- parallel_print("Region points\n");
- for (i = 0; i < npoints1; i++)
- {
- hsize_t pt1, pt2;
- int diff_data = 0;
- for (j = 0; j < ndims1; j++)
- {
- pt1 = ptdata1[i * ndims1 + j];
- pt2 = ptdata2[i * ndims1 + j];
- if (pt1 != pt2)
- {
- diff_data = 1;
- break;
- }
- }
- if (diff_data)
- {
- parallel_print("point #%d", i);
- print_points(i, ptdata1, ndims1);
- print_points(i, ptdata2, ndims1);
- parallel_print("\n");
- }
- }
- }
+ if(nfound_p && options->m_verbose) {
+ parallel_print("Region points\n");
+ for(i = 0; i < npoints1; i++) {
+ hsize_t pt1, pt2;
+ int diff_data = 0;
+
+ for(j = 0; j < ndims1; j++) {
+ pt1 = ptdata1[i * ndims1 + j];
+ pt2 = ptdata2[i * ndims1 + j];
+ if(pt1 != pt2) {
+ diff_data = 1;
+ break;
+ }
+ }
+ if(diff_data) {
+ parallel_print("point #%d", i);
+ print_points(i, ptdata1, ndims1);
+ print_points(i, ptdata2, ndims1);
+ parallel_print("\n");
+ }
+ }
+ }
#if defined (H5DIFF_DEBUG)
- for (i = 0; i < npoints1; i++)
- {
- int j;
+ for (i = 0; i < npoints1; i++) {
+ int j;
- parallel_print("%sPt%lu: " ,
- i ? "," : "",
- (unsigned long)i);
+ parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i);
- for (j = 0; j < ndims1; j++)
- parallel_print("%s%lu", j ? "," : "(",
- (unsigned long)(ptdata1[i * ndims1 + j]));
+ for (j = 0; j < ndims1; j++)
+ parallel_print("%s%lu", j ? "," : "(",
+ (unsigned long)(ptdata1[i * ndims1 + j]));
- parallel_print(")");
- }
+ parallel_print(")");
+ }
#endif
- HDfree(ptdata1);
- HDfree(ptdata2);
- }
+ HDfree(ptdata1);
+ HDfree(ptdata2);
+ }
- nfound_b = nfound_b/ndims1;
- nfound_p = nfound_p/ndims1;
- return (nfound_p + nfound_b);
+ nfound_b = nfound_b/ndims1;
+ nfound_p = nfound_p/ndims1;
+ return (nfound_p + nfound_b);
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 50bc6cd..44154cd 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -128,12 +128,12 @@ void
h5tools_close(void)
{
if (h5tools_init_g) {
- if (rawdatastream && rawdatastream != stdout) {
- if (fclose(rawdatastream))
- perror("closing rawdatastream");
- else
- rawdatastream = NULL;
- }
+ if (rawdatastream && rawdatastream != stdout) {
+ if (fclose(rawdatastream))
+ perror("closing rawdatastream");
+ else
+ rawdatastream = NULL;
+ }
/* Clean up the reference path table, if it's been used */
term_ref_path_table();
@@ -141,7 +141,7 @@ h5tools_close(void)
/* Shut down the library */
H5close();
- h5tools_init_g = 0;
+ h5tools_init_g = 0;
}
}
@@ -554,152 +554,150 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
*to the ctx->size_last_dim. */
/* binary dump */
- if (bin_output)
- {
- do_bin_output(stream,nelmts,type,_mem);
- bin_output=0;
- }
- else
- {
- /* Setup */
- memset(&buffer, 0, sizeof(h5tools_str_t));
- size = H5Tget_size(type);
+ if(bin_output) {
+ do_bin_output(stream, nelmts, type, _mem);
+ bin_output = 0;
+ } /* end if */
+ else {
+ /* Setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+ size = H5Tget_size(type);
- if (info->line_ncols > 0)
- ncols = info->line_ncols;
+ if(info->line_ncols > 0)
+ ncols = info->line_ncols;
- /* pass to the prefix in h5tools_simple_prefix the total position
- instead of the current stripmine position i; this is necessary
- to print the array indices */
- curr_pos = ctx->sm_pos;
+ /* pass to the prefix in h5tools_simple_prefix the total position
+ * instead of the current stripmine position i; this is necessary
+ * to print the array indices
+ */
+ curr_pos = ctx->sm_pos;
- h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
+ h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
- for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) {
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_sprint(&buffer, info, container, type, mem + i * size, ctx);
+ for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) {
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_sprint(&buffer, info, container, type, mem + i * size, ctx);
- if (i + 1 < nelmts || (flags & END_OF_DATA) == 0)
- h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ","));
+ if (i + 1 < nelmts || (flags & END_OF_DATA) == 0)
+ h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ","));
- s = h5tools_str_fmt(&buffer, 0, "%s");
+ s = h5tools_str_fmt(&buffer, 0, "%s");
- /*
- * If the element would split on multiple lines if printed at our
- * current location...
- */
- if (info->line_multi_new == 1 &&
- (ctx->cur_column + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) > ncols) {
- if (ctx->prev_multiline) {
- /*
- * ... and the previous element also occupied more than one
- * line, then start this element at the beginning of a line.
- */
- ctx->need_prefix = TRUE;
- } else if ((ctx->prev_prefix_len + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) <= ncols) {
- /*
- * ...but *could* fit on one line otherwise, then we
- * should end the current line and start this element on its
- * own line.
- */
- ctx->need_prefix = TRUE;
+ /*
+ * If the element would split on multiple lines if printed at our
+ * current location...
+ */
+ if (info->line_multi_new == 1 &&
+ (ctx->cur_column + h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
+ strlen(OPT(info->line_suf, ""))) > ncols) {
+ if (ctx->prev_multiline) {
+ /*
+ * ... and the previous element also occupied more than one
+ * line, then start this element at the beginning of a line.
+ */
+ ctx->need_prefix = TRUE;
+ } else if ((ctx->prev_prefix_len + h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
+ strlen(OPT(info->line_suf, ""))) <= ncols) {
+ /*
+ * ...but *could* fit on one line otherwise, then we
+ * should end the current line and start this element on its
+ * own line.
+ */
+ ctx->need_prefix = TRUE;
+ }
}
- }
- /*
- * We need to break after each row of a dimension---> we should
- * break at the end of the each last dimension well that is the
- * way the dumper did it before
- */
- if (info->arr_linebreak && ctx->cur_elmt) {
- if (ctx->size_last_dim && (ctx->cur_elmt % ctx->size_last_dim) == 0)
- ctx->need_prefix = TRUE;
+ /*
+ * We need to break after each row of a dimension---> we should
+ * break at the end of the each last dimension well that is the
+ * way the dumper did it before
+ */
+ if (info->arr_linebreak && ctx->cur_elmt) {
+ if (ctx->size_last_dim && (ctx->cur_elmt % ctx->size_last_dim) == 0)
+ ctx->need_prefix = TRUE;
- if ((hsize_t)elmt_counter == ctx->size_last_dim) {
- ctx->need_prefix = TRUE;
- elmt_counter = 0;
+ if ((hsize_t)elmt_counter == ctx->size_last_dim) {
+ ctx->need_prefix = TRUE;
+ elmt_counter = 0;
+ }
}
- }
-
- /*
- * If the previous element occupied multiple lines and this element
- * is too long to fit on a line then start this element at the
- * beginning of the line.
- */
- if (info->line_multi_new == 1 && ctx->prev_multiline &&
- (ctx->cur_column + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) > ncols)
- ctx->need_prefix = TRUE;
-
- /*
- * If too many elements have already been printed then we need to
- * start a new line.
- */
- if (info->line_per_line > 0 && ctx->cur_elmt >= info->line_per_line)
- ctx->need_prefix = TRUE;
- /*
- * Each OPTIONAL_LINE_BREAK embedded in the rendered string can cause
- * the data to split across multiple lines. We display the sections
- * one-at a time.
- */
- for (secnum = 0, multiline = 0;
- (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK));
- secnum++) {
/*
- * If the current section plus possible suffix and end-of-line
- * information would cause the output to wrap then we need to
- * start a new line.
+ * If the previous element occupied multiple lines and this element
+ * is too long to fit on a line then start this element at the
+ * beginning of the line.
*/
+ if (info->line_multi_new == 1 && ctx->prev_multiline &&
+ (ctx->cur_column + h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
+ strlen(OPT(info->line_suf, ""))) > ncols)
+ ctx->need_prefix = TRUE;
/*
- * Added the info->skip_first because the dumper does not want
- * this check to happen for the first line
+ * If too many elements have already been printed then we need to
+ * start a new line.
*/
- if ((!info->skip_first || i) &&
- (ctx->cur_column + strlen(section) +
- strlen(OPT(info->elmt_suf2, " ")) +
- strlen(OPT(info->line_suf, ""))) > ncols)
- ctx->need_prefix = 1;
+ if (info->line_per_line > 0 && ctx->cur_elmt >= info->line_per_line)
+ ctx->need_prefix = TRUE;
/*
- * Print the prefix or separate the beginning of this element
- * from the previous element.
+ * Each OPTIONAL_LINE_BREAK embedded in the rendered string can cause
+ * the data to split across multiple lines. We display the sections
+ * one-at a time.
*/
- if (ctx->need_prefix) {
- if (secnum)
- multiline++;
-
- /* pass to the prefix in h5tools_simple_prefix the total position
- instead of the current stripmine position i; this is necessary
- to print the array indices */
- curr_pos = ctx->sm_pos + i;
-
- h5tools_simple_prefix(stream, info, ctx, curr_pos, secnum);
- } else if ((i || ctx->continuation) && secnum == 0) {
- fputs(OPT(info->elmt_suf2, " "), stream);
- ctx->cur_column += strlen(OPT(info->elmt_suf2, " "));
- }
+ for (secnum = 0, multiline = 0;
+ (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK));
+ secnum++) {
+ /*
+ * If the current section plus possible suffix and end-of-line
+ * information would cause the output to wrap then we need to
+ * start a new line.
+ */
- /* Print the section */
- fputs(section, stream);
- ctx->cur_column += strlen(section);
- }
+ /*
+ * Added the info->skip_first because the dumper does not want
+ * this check to happen for the first line
+ */
+ if ((!info->skip_first || i) &&
+ (ctx->cur_column + strlen(section) +
+ strlen(OPT(info->elmt_suf2, " ")) +
+ strlen(OPT(info->line_suf, ""))) > ncols)
+ ctx->need_prefix = 1;
- ctx->prev_multiline = multiline;
- }
+ /*
+ * Print the prefix or separate the beginning of this element
+ * from the previous element.
+ */
+ if (ctx->need_prefix) {
+ if (secnum)
+ multiline++;
+
+ /* pass to the prefix in h5tools_simple_prefix the total
+ * position instead of the current stripmine position i;
+ * this is necessary to print the array indices
+ */
+ curr_pos = ctx->sm_pos + i;
+
+ h5tools_simple_prefix(stream, info, ctx, curr_pos, secnum);
+ } else if ((i || ctx->continuation) && secnum == 0) {
+ fputs(OPT(info->elmt_suf2, " "), stream);
+ ctx->cur_column += strlen(OPT(info->elmt_suf2, " "));
+ }
- h5tools_str_close(&buffer);
+ /* Print the section */
+ fputs(section, stream);
+ ctx->cur_column += strlen(section);
+ }
- }/* else bin */
+ ctx->prev_multiline = multiline;
+ }
+ h5tools_str_close(&buffer);
+ }/* else bin */
}
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 0b17b41..715d05e 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -49,49 +49,8 @@ extern int d_status;
static int ref_path_table_put(const char *, haddr_t objno);
static hbool_t ref_path_table_find(haddr_t objno);
-
-/*-------------------------------------------------------------------------
- * Function: init_ref_path_table
- *
- * Purpose: Enter the root group ("/") into the path table
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-int
-init_ref_path_table(hid_t fid)
-{
- H5G_stat_t sb;
- haddr_t objno; /* Compact form of object's location */
- char *root_path;
-
- /* Set file ID for later queries (XXX: this should be fixed) */
- thefile = fid;
-
- /* Create skip list to store reference path information */
- if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16))==NULL)
- return (-1);
-
- if((root_path = HDstrdup("/")) == NULL)
- return (-1);
-
- if(H5Gget_objinfo(fid, "/", TRUE, &sb)<0) {
- /* fatal error? */
- HDfree(root_path);
- return (-1);
- }
- objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
-
- /* Insert into table (takes ownership of path) */
- ref_path_table_put(root_path, objno);
-
- return(0);
-}
+static herr_t fill_ref_path_table_cb(hid_t group, const char *obj_name,
+ const H5L_info_t *linfo, void *op_data);
/*-------------------------------------------------------------------------
* Function: free_ref_path_info
@@ -158,35 +117,31 @@ term_ref_path_table(void)
haddr_t
ref_path_table_lookup(const char *thepath)
{
- H5G_stat_t sb;
- haddr_t objno; /* Compact form of object's location */
-
- /* Check for external link first, so we don't return the OID of an object in another file */
- if(H5Gget_objinfo(thefile, thepath, FALSE, &sb)<0)
- return HADDR_UNDEF;
- if(sb.type == H5G_LINK) {
- /* Get object ID for object at path */
- /* (If the object is not a soft link, we've already retrieved the
- * correct information and don't have to perform this call. -QAK
- */
- if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0)
- /* fatal error ? */
+ H5O_info_t oi;
+
+ /* Allow lookups on the root group, even though it doesn't have any link info */
+ if(HDstrcmp(thepath, "/")) {
+ H5L_info_t li;
+
+ /* Check for external link first, so we don't return the OID of an object in another file */
+ if(H5Lget_info(thefile, thepath, &li, H5P_DEFAULT) < 0)
+ return HADDR_UNDEF;
+
+ /* UD links can't be followed, so they always "dangle" like soft links. */
+ if(li.type >= H5L_TYPE_UD_MIN)
return HADDR_UNDEF;
- } else if(sb.type == H5G_UDLINK)
- {
- /* UD links can't be followed, so they always "dangle" like
- * soft links.
- */
- return HADDR_UNDEF;
} /* end if */
- objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
+ /* Get the object info now */
+ /* (returns failure for dangling soft links) */
+ if(H5Oget_info(thefile, thepath, &oi, H5P_DEFAULT) < 0)
+ return HADDR_UNDEF;
/* All existing objects in the file had better be in the table */
- HDassert(ref_path_table_find(objno));
+ HDassert(ref_path_table_find(oi.addr));
/* Return OID */
- return(objno);
+ return(oi.addr);
}
/*-------------------------------------------------------------------------
@@ -325,6 +280,65 @@ lookup_ref_path(haddr_t ref)
}
/*-------------------------------------------------------------------------
+ * Function: fill_ref_path_table_cb
+ *
+ * Purpose: Called by interator to create references for
+ * all objects and enter them in the table.
+ *
+ * Return: Error status.
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+fill_ref_path_table_cb(hid_t group, const char *obj_name, const H5L_info_t *linfo,
+ void *op_data)
+{
+ if(linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
+
+ H5Oget_info(group, obj_name, &oinfo, H5P_DEFAULT);
+
+ /* Check if the object is already in the path table */
+ if(!ref_path_table_find(oinfo.addr)) {
+ const char *obj_prefix = (const char *)op_data;
+ size_t tmp_len;
+ char *thepath;
+
+ /* Compute length for this object's path */
+ tmp_len = HDstrlen(obj_prefix) + HDstrlen(obj_name) + 2;
+
+ /* Allocate room for the path for this object */
+ if((thepath = (char *)HDmalloc(tmp_len)) == NULL)
+ return FAIL;
+
+ /* Build the name for this object */
+ HDstrcpy(thepath, obj_prefix);
+ HDstrcat(thepath, "/");
+ HDstrcat(thepath, obj_name);
+
+ /* Insert the object into the path table (takes ownership of the path) */
+ ref_path_table_put(thepath, oinfo.addr);
+
+ if(oinfo.type == H5O_TYPE_GROUP) {
+ /* Iterate over objects in this group, using this group's
+ * name as their prefix
+ */
+ if(H5Literate(group, obj_name, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table_cb, thepath, H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to dump group \"%s\"\n", thepath);
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
* Function: fill_ref_path_table
*
* Purpose: Called by interator to create references for
@@ -339,46 +353,32 @@ lookup_ref_path(haddr_t ref)
*-------------------------------------------------------------------------
*/
herr_t
-fill_ref_path_table(hid_t group, const char *obj_name, const H5L_info_t UNUSED *linfo,
- void *op_data)
+fill_ref_path_table(hid_t fid)
{
- const char *obj_prefix = (const char *)op_data;
- H5G_stat_t statbuf;
- haddr_t objno; /* Compact form of object's location */
-
- H5Gget_objinfo(group, obj_name, FALSE, &statbuf);
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
-
- /* Check if the object is in the path table */
- if (!ref_path_table_find(objno)) {
- size_t tmp_len;
- char *thepath;
-
- /* Compute length for this object's path */
- tmp_len = HDstrlen(obj_prefix) + HDstrlen(obj_name) + 2;
-
- /* Allocate room for the path for this object */
- if ((thepath = (char *) HDmalloc(tmp_len)) == NULL)
- return FAIL;
-
- /* Build the name for this object */
- HDstrcpy(thepath, obj_prefix);
- HDstrcat(thepath, "/");
- HDstrcat(thepath, obj_name);
-
- /* Insert the object into the path table */
- ref_path_table_put(thepath, objno);
-
- if(statbuf.type == H5G_GROUP) {
- /* Iterate over objects in this group, using this group's
- * name as their prefix
- */
- if(H5Literate(group, obj_name, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table, thepath, H5P_DEFAULT) < 0) {
- error_msg(progname, "unable to dump group \"%s\"\n", obj_name);
- d_status = EXIT_FAILURE;
- }
- }
- }
+ H5O_info_t oinfo;
+ char *root_path;
+
+ /* Set file ID for later queries (XXX: this should be fixed) */
+ thefile = fid;
+
+ /* Create skip list to store reference path information */
+ if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16))==NULL)
+ return (-1);
+
+ /* Build the name for root group */
+ root_path = HDstrdup("/");
+
+ /* Get info for root group */
+ H5Oget_info(fid, root_path, &oinfo, H5P_DEFAULT);
+
+ /* Insert the root group into the path table (takes ownership of path) */
+ ref_path_table_put(root_path, oinfo.addr);
+
+ /* Iterate over objects in this file */
+ if(H5Literate(fid, root_path, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table_cb, (void *)"", H5P_DEFAULT) < 0) {
+ error_msg(progname, "unable to dump root group\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
return 0;
}
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
index d996114..567ca4b 100644
--- a/tools/lib/h5tools_ref.h
+++ b/tools/lib/h5tools_ref.h
@@ -22,14 +22,13 @@
extern "C" {
#endif
-int init_ref_path_table(hid_t fid);
+herr_t fill_ref_path_table(hid_t fid);
const char *lookup_ref_path(haddr_t ref);
-herr_t fill_ref_path_table(hid_t, const char *, const H5L_info_t *, void *);
int get_next_xid(void);
-haddr_t get_fake_xid (void);
-haddr_t ref_path_table_lookup(const char *);
-haddr_t ref_path_table_gen_fake(const char *);
-int term_ref_path_table(void);
+haddr_t get_fake_xid(void);
+haddr_t ref_path_table_lookup(const char *);
+haddr_t ref_path_table_gen_fake(const char *);
+int term_ref_path_table(void);
#ifdef __cplusplus
}
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 737c68a..f877baa 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -308,12 +308,12 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
*/
char *
h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
- hsize_t elmtno, int ndims, hsize_t min_idx[],
+ hsize_t elmtno, unsigned ndims, hsize_t min_idx[],
hsize_t max_idx[], h5tools_context_t *ctx)
{
hsize_t p_prod[H5S_MAX_RANK];
size_t i = 0;
- hsize_t curr_pos=elmtno;
+ hsize_t curr_pos = elmtno;
h5tools_str_reset(str);
@@ -325,10 +325,9 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
for (i = ndims - 1, p_prod[ndims - 1] = 1; i > 0; --i)
p_prod[i - 1] = (max_idx[i] - min_idx[i]) * p_prod[i];
- for ( i = 0; i < (size_t)ndims; i++)
- {
- ctx->pos[i] = curr_pos/ctx->acc[i];
- curr_pos -= ctx->acc[i]*ctx->pos[i];
+ for ( i = 0; i < (size_t)ndims; i++) {
+ ctx->pos[i] = curr_pos/ctx->acc[i];
+ curr_pos -= ctx->acc[i]*ctx->pos[i];
}
assert( curr_pos == 0 );
@@ -580,31 +579,22 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
char *cp_vp = (char *)vp;
hid_t memb, obj, region;
unsigned nmembs;
- int otype;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
- H5G_stat_t sb;
/*
* some tempvars to store the value before we append it to the string to
* get rid of the memory alignment problem
*/
- double tempdouble;
- float tempfloat;
unsigned long_long tempullong;
long_long templlong;
unsigned long tempulong;
long templong;
unsigned int tempuint;
int tempint;
- unsigned short tempushort;
- short tempshort;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- long double templdouble;
-#endif
/* Build default formats for long long types */
- if (!fmt_llong[0]) {
+ if(!fmt_llong[0]) {
sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
}
@@ -612,29 +602,37 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
/* Append value depending on data type */
start = h5tools_str_len(str);
- if (info->raw) {
+ if(info->raw) {
size_t i;
+
n = H5Tget_size(type);
if (1==n) {
h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]);
} else {
- for (i = 0; i < n; i++) {
- if (i) h5tools_str_append(str, ":");
- h5tools_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]);
+ for(i = 0; i < n; i++) {
+ if(i)
+ h5tools_str_append(str, ":");
+ h5tools_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]);
}
}
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
- memcpy(&tempfloat, vp, sizeof(float));
+ float tempfloat;
+
+ HDmemcpy(&tempfloat, vp, sizeof(float));
h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat);
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
- memcpy(&tempdouble, vp, sizeof(double));
- h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
+ double tempdouble;
+
+ HDmemcpy(&tempdouble, vp, sizeof(double));
+ h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
#if H5_SIZEOF_LONG_DOUBLE !=0
} else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
- memcpy(&templdouble, vp, sizeof(long double));
- h5tools_str_append(str, "%Lf", templdouble);
+ long double templdouble;
+
+ HDmemcpy(&templdouble, vp, sizeof(long double));
+ h5tools_str_append(str, "%Lf", templdouble);
#endif
- } else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
+ } else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
H5Tequal(type, H5T_NATIVE_UCHAR))) {
h5tools_print_char(str, info, (char)(*ucp_vp));
} else if (H5T_STRING == H5Tget_class(type)) {
@@ -713,32 +711,36 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, "\"\"");
} /* end else */
} else if (H5Tequal(type, H5T_NATIVE_INT)) {
- memcpy(&tempint, vp, sizeof(int));
+ HDmemcpy(&tempint, vp, sizeof(int));
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
} else if (H5Tequal(type, H5T_NATIVE_UINT)) {
- memcpy(&tempuint, vp, sizeof(unsigned int));
+ HDmemcpy(&tempuint, vp, sizeof(unsigned int));
h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
} else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
h5tools_str_append(str, OPT(info->fmt_schar, "%d"), *cp_vp);
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp);
} else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
- memcpy(&tempshort, vp, sizeof(short));
+ short tempshort;
+
+ HDmemcpy(&tempshort, vp, sizeof(short));
h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
} else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
- memcpy(&tempushort, vp, sizeof(unsigned short));
+ unsigned short tempushort;
+
+ HDmemcpy(&tempushort, vp, sizeof(unsigned short));
h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
} else if (H5Tequal(type, H5T_NATIVE_LONG)) {
- memcpy(&templong, vp, sizeof(long));
+ HDmemcpy(&templong, vp, sizeof(long));
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
} else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
- memcpy(&tempulong, vp, sizeof(unsigned long));
+ HDmemcpy(&tempulong, vp, sizeof(unsigned long));
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
} else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
- memcpy(&templlong, vp, sizeof(long_long));
+ HDmemcpy(&templlong, vp, sizeof(long_long));
h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
} else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
- memcpy(&tempullong, vp, sizeof(unsigned long_long));
+ HDmemcpy(&tempullong, vp, sizeof(unsigned long_long));
h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
} else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
if (sizeof(hssize_t) == sizeof(int)) {
@@ -849,7 +851,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
obj = H5Rdereference(container, H5R_DATASET_REGION, vp);
region = H5Rget_region(container, H5R_DATASET_REGION, vp);
- H5Gget_objinfo(obj, ".", FALSE, &sb);
/* get name of the dataset the region reference points to using H5Rget_name */
H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*)ref_name, 1024);
@@ -867,47 +868,46 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (h5tools_is_zero(vp, H5Tget_size(type))) {
h5tools_str_append(str, "NULL");
} else {
- haddr_t objno; /* Compact form of object's location */
+ H5O_info_t oi;
const char *path;
- otype = H5Rget_obj_type(container, H5R_OBJECT, vp);
obj = H5Rdereference(container, H5R_OBJECT, vp);
- H5Gget_objinfo(obj, ".", FALSE, &sb);
+ H5Oget_info(obj, ".", &oi, H5P_DEFAULT);
/* Print object type and close object */
- switch (otype) {
- case H5G_GROUP:
+ switch(oi.type) {
+ case H5O_TYPE_GROUP:
h5tools_str_append(str, H5_TOOLS_GROUP);
- H5Gclose(obj);
break;
- case H5G_DATASET:
+
+ case H5O_TYPE_DATASET:
h5tools_str_append(str, H5_TOOLS_DATASET);
- H5Dclose(obj);
break;
- case H5G_TYPE:
+
+ case H5O_TYPE_NAMED_DATATYPE:
h5tools_str_append(str, H5_TOOLS_DATATYPE);
- H5Tclose(obj);
break;
+
default:
- h5tools_str_append(str, "%u-", otype);
+ h5tools_str_append(str, "%u-", (unsigned)oi.type);
break;
- }
+ } /* end switch */
+ H5Oclose(obj);
/* Print OID */
- objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
- if (info->obj_hidefileno)
- h5tools_str_append(str, info->obj_format, objno);
+ if(info->obj_hidefileno)
+ h5tools_str_append(str, info->obj_format, oi.addr);
else
- h5tools_str_append(str, info->obj_format, sb.fileno[0], objno);
+ h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr);
/* Print name */
path = lookup_ref_path(*(haddr_t *)vp);
if (path) {
- h5tools_str_append(str, " ");
- h5tools_str_append(str, path);
- h5tools_str_append(str, " ");
- }
- }
+ h5tools_str_append(str, " ");
+ h5tools_str_append(str, path);
+ h5tools_str_append(str, " ");
+ } /* end if */
+ } /* end else */
} else if (H5Tget_class(type) == H5T_ARRAY) {
int k, ndims;
hsize_t i, dims[H5S_MAX_RANK],temp_nelmts;
@@ -929,25 +929,23 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
/* Print the opening bracket */
h5tools_str_append(str, "%s", OPT(info->arr_pre, "["));
- for (i = 0; i < nelmts; i++) {
- if (i)
+ for(i = 0; i < nelmts; i++) {
+ if(i)
h5tools_str_append(str, "%s",
OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
- if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) {
+ if(info->arr_linebreak && i && i % dims[ndims - 1] == 0) {
int x;
h5tools_str_append(str, "%s", "\n");
- /*need to indent some more here*/
- if (ctx->indent_level >= 0 )
- {
- if (!info->pindex)
- h5tools_str_append(str, "%s", OPT(info->line_pre, ""));
- }
+ /* need to indent some more here*/
+ if(ctx->indent_level >= 0)
+ if(!info->pindex)
+ h5tools_str_append(str, "%s", OPT(info->line_pre, ""));
- for (x = 0; x < ctx->indent_level + 1; x++)
- h5tools_str_append(str,"%s",OPT(info->line_indent,""));
+ for(x = 0; x < ctx->indent_level + 1; x++)
+ h5tools_str_append(str, "%s", OPT(info->line_indent, ""));
} /* end if */
else if(i && info->arr_sep)
h5tools_str_append(str, " ");
@@ -961,7 +959,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
} /* end for */
/* Print the closing bracket */
- h5tools_str_append(str, "%s", OPT(info->arr_suf, "]"));
+ h5tools_str_append(str, "%s", OPT(info->arr_suf, "]"));
H5Tclose(memb);
} else if (H5Tget_class(type) == H5T_VLEN) {
unsigned int i;
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 0964b7b..607d412 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -33,7 +33,7 @@ extern char *h5tools_str_reset(h5tools_str_t *str);
extern char *h5tools_str_trunc(h5tools_str_t *str, size_t size);
extern char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, int ndims, hsize_t min_idx[],
+ hsize_t elmtno, unsigned ndims, hsize_t min_idx[],
hsize_t max_idx[], h5tools_context_t *ctx);
extern int h5tools_str_dump_region(h5tools_str_t *, hid_t, const h5tool_format_t *);
extern char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index b04f3c6..4aabe09 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -483,26 +483,23 @@ build_obj_path_name(const char *prefix, const char *name)
static herr_t
find_objs_cb(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void *op_data)
{
- H5G_stat_t statbuf;
+ H5O_info_t oinfo;
find_objs_t *info = (find_objs_t*)op_data;
herr_t ret_value = 0;
- if(H5Gget_objinfo(group, name, FALSE, &statbuf) < 0)
+ if(H5Oget_info(group, name, &oinfo, H5P_DEFAULT) < 0)
; /* keep going */
else {
- haddr_t objno; /* Compact form of object's location */
-
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- switch (statbuf.type) {
+ switch(oinfo.type) {
char *tmp;
size_t tmp_len;
- case H5G_GROUP:
- if (search_obj(info->group_table, objno) == NULL) {
+ case H5O_TYPE_GROUP:
+ if(search_obj(info->group_table, oinfo.addr) == NULL) {
char *old_prefix;
tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->group_table, objno, tmp, TRUE);
+ add_obj(info->group_table, oinfo.addr, tmp, TRUE);
old_prefix = info->prefix;
tmp_len = HDstrlen(tmp);
@@ -516,44 +513,42 @@ find_objs_cb(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void
} /* end if */
break;
- case H5G_DATASET:
- if (search_obj(info->dset_table, objno) == NULL) {
+ case H5O_TYPE_DATASET:
+ if(search_obj(info->dset_table, oinfo.addr) == NULL) {
hid_t dset;
tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->dset_table, objno, tmp, TRUE);
+ add_obj(info->dset_table, oinfo.addr, tmp, TRUE);
- if ((dset = H5Dopen (group, name)) >= 0) {
+ if((dset = H5Dopen (group, name)) >= 0) {
hid_t type;
type = H5Dget_type(dset);
- if (H5Tcommitted(type) > 0) {
- H5Gget_objinfo(type, ".", TRUE, &statbuf);
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
-
- if (search_obj(info->type_table, objno) == NULL) {
+ if(H5Tcommitted(type) > 0) {
+ H5Oget_info(type, ".", &oinfo, H5P_DEFAULT);
+ if (search_obj(info->type_table, oinfo.addr) == NULL) {
char *type_name = HDstrdup(tmp);
- add_obj(info->type_table, objno, type_name, FALSE);
+ add_obj(info->type_table, oinfo.addr, type_name, FALSE);
} /* end if */
- }
+ } /* end if */
H5Tclose(type);
H5Dclose(dset);
- } else {
+ } /* end if */
+ else
ret_value = FAIL;
- }
} /* end if */
break;
- case H5G_TYPE:
+ case H5O_TYPE_NAMED_DATATYPE:
{
obj_t *found_obj;
tmp = build_obj_path_name(info->prefix, name);
- if ((found_obj = search_obj(info->type_table, objno)) == NULL)
- add_obj(info->type_table, objno, tmp, TRUE);
+ if((found_obj = search_obj(info->type_table, oinfo.addr)) == NULL)
+ add_obj(info->type_table, oinfo.addr, tmp, TRUE);
else {
/* Use latest version of name */
HDfree(found_obj->objname);
@@ -594,6 +589,8 @@ herr_t
init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
table_t **dset_table, table_t **type_table)
{
+ H5O_info_t oinfo;
+
/* Initialize the tables */
init_table(group_table);
init_table(dset_table);
@@ -605,25 +602,15 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
info->type_table = *type_table;
info->dset_table = *dset_table;
- {
- /* add the root group as an object, it may have hard links to it */
-
- H5G_stat_t statbuf;
- haddr_t objno; /* compact form of object's location */
- char* tmp;
-
- if(H5Gget_objinfo(fid, "/", FALSE, &statbuf) < 0)
- return FAIL;
- else
- {
- objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- /* call with an empty string, it appends group separator */
- tmp = build_obj_path_name(info->prefix, "");
- add_obj(info->group_table, objno, tmp, TRUE);
- }
- }
-
+ /* add the root group as an object, it may have hard links to it */
+ if(H5Oget_info(fid, "/", &oinfo, H5P_DEFAULT) < 0)
+ return FAIL;
+ else {
+ /* call with an empty string, it appends '/' group separator */
+ char *tmp = build_obj_path_name(info->prefix, "");
+ add_obj(info->group_table, oinfo.addr, tmp, TRUE);
+ } /* end else */
/* Find all shared objects */
return(H5Literate(fid, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, find_objs_cb, (void *)info, H5P_DEFAULT));
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 65cca66..58d618d 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -171,11 +171,13 @@ traverse_cb(hid_t loc_id, const char *link_name, const H5L_info_t *linfo,
is_group = (oinfo.type == H5O_TYPE_GROUP) ? TRUE : FALSE;
/* Make 'visit object' callback */
- (*udata->visitor->visit_obj)(link_path, &oinfo, already_visited, udata->visitor->udata);
+ if(udata->visitor->visit_obj)
+ (*udata->visitor->visit_obj)(link_path, &oinfo, already_visited, udata->visitor->udata);
} /* end if */
else {
/* Make 'visit link' callback */
- (*udata->visitor->visit_lnk)(link_path, linfo, udata->visitor->udata);
+ if(udata->visitor->visit_lnk)
+ (*udata->visitor->visit_lnk)(link_path, linfo, udata->visitor->udata);
} /* end else */
/* Check for group that we haven't visited yet & recurse */
@@ -267,7 +269,7 @@ traverse(hid_t file_id, const trav_visitor_t *visitor)
*-------------------------------------------------------------------------
*/
static void
-trav_info_add(trav_info_t *info, const char *path, H5G_obj_t obj_type)
+trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
{
size_t idx; /* Index of address to use */
@@ -302,8 +304,8 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
hbool_t UNUSED already_visited, void *udata)
{
/* Add the object to the 'info' struct */
- /* (object types map directly to "group" types) */
- trav_info_add((trav_info_t *)udata, path, (H5G_obj_t)oinfo->type);
+ /* (object types map directly to "traversal" types) */
+ trav_info_add((trav_info_t *)udata, path, (h5trav_type_t)oinfo->type);
return(0);
} /* end trav_info_visit_obj() */
@@ -326,7 +328,7 @@ static int
trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
{
/* Add the link to the 'info' struct */
- trav_info_add((trav_info_t *)udata, path, ((linfo->type == H5L_TYPE_SOFT) ? H5G_LINK : H5G_UDLINK));
+ trav_info_add((trav_info_t *)udata, path, ((linfo->type == H5L_TYPE_SOFT) ? H5TRAV_TYPE_LINK : H5TRAV_TYPE_UDLINK));
return(0);
} /* end trav_info_visit_lnk() */
@@ -647,7 +649,7 @@ trav_table_add(trav_table_t *table,
table->objs[new].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
table->objs[new].flags[0] = table->objs[new].flags[1] = 0;
table->objs[new].name = (char *)HDstrdup(path);
- table->objs[new].type = oinfo ? (H5G_obj_t)oinfo->type : H5G_LINK;
+ table->objs[new].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK;
table->objs[new].nlinks = 0;
table->objs[new].sizelinks = 0;
table->objs[new].links = NULL;
@@ -707,7 +709,7 @@ trav_table_addlink(trav_table_t *table,
void trav_table_addflags(unsigned *flags,
char *name,
- H5G_obj_t type,
+ h5trav_type_t type,
trav_table_t *table)
{
unsigned int new;
@@ -715,7 +717,7 @@ void trav_table_addflags(unsigned *flags,
if(table->nobjs == table->size) {
table->size = MAX(1, table->size * 2);
table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
- }
+ } /* end if */
new = table->nobjs++;
table->objs[new].objno = 0;
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index 4218013..05bc3cb 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -19,22 +19,32 @@
#include "hdf5.h"
/*-------------------------------------------------------------------------
- * public struct to store name and type of an object
+ * public enum to specify type of an object
* the TYPE can be:
- * H5G_UNKNOWN = -1,
- * H5G_GROUP, Object is a group
- * H5G_DATASET, Object is a dataset
- * H5G_TYPE, Object is a named data type
- * H5G_LINK, Object is a symbolic link
+ * H5TRAV_TYPE_UNKNOWN = -1,
+ * H5TRAV_TYPE_GROUP, Object is a group
+ * H5TRAV_TYPE_DATASET, Object is a dataset
+ * H5TRAV_TYPE_TYPE, Object is a named datatype
+ * H5TRAV_TYPE_LINK, Object is a symbolic link
+ * H5TRAV_TYPE_UDLINK, Object is a user-defined link
*-------------------------------------------------------------------------
*/
+typedef enum {
+ H5TRAV_TYPE_UNKNOWN = -1, /* Unknown object type */
+ H5TRAV_TYPE_GROUP, /* Object is a group */
+ H5TRAV_TYPE_DATASET, /* Object is a dataset */
+ H5TRAV_TYPE_NAMED_DATATYPE, /* Object is a named datatype */
+ H5TRAV_TYPE_LINK, /* Object is a symbolic link */
+ H5TRAV_TYPE_UDLINK /* Object is a user-defined link */
+} h5trav_type_t;
-typedef H5G_obj_t H5G_obj_t1;
-
-
+/*-------------------------------------------------------------------------
+ * public struct to store name and type of an object
+ *-------------------------------------------------------------------------
+ */
typedef struct trav_path_t {
char *path;
- H5G_obj_t type;
+ h5trav_type_t type;
} trav_path_t;
typedef struct trav_info_t {
@@ -59,10 +69,10 @@ typedef struct trav_link_t {
*/
typedef struct trav_obj_t {
- haddr_t objno; /* object number from H5Gget_objinfo */
+ haddr_t objno; /* object address */
unsigned flags[2]; /* h5diff.object is present or not in both files*/
char *name; /* name */
- H5G_obj_t type; /* type of object */
+ h5trav_type_t type; /* type of object */
trav_link_t *links; /* array of possible link names */
size_t sizelinks; /* size of links array */
size_t nlinks; /* number of links */
@@ -135,9 +145,8 @@ void trav_table_free(trav_table_t *table);
void trav_table_addflags(unsigned *flags,
char *objname,
- H5G_obj_t type,
+ h5trav_type_t type,
trav_table_t *table);
#endif /* H5TRAV_H__ */
-
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 8ef59bd..d904095 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -16,12 +16,7 @@
#ifndef _PH5DIFF_H__
#define _PH5DIFF_H__
-/* use a larger output buffer for Tflops which does not support vsnprintf. */
-#ifdef __PUMAGON__
#define PRINT_DATA_MAX_SIZE 512
-#else
-#define PRINT_DATA_MAX_SIZE 512
-#endif
#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4)
/* Send from manager to workers */
#define MPI_TAG_ARGS 1
@@ -41,7 +36,7 @@ extern int g_nTasks;
extern unsigned char g_Parallel;
extern char outBuff[];
extern int outBuffOffset;
-extern FILE* overflow_file;
+extern FILE * overflow_file;
struct diff_args
{
@@ -60,5 +55,5 @@ struct diffs_found
#include <mpi.h>
#endif
-
#endif /* _PH5DIFF_H__ */
+
diff --git a/tools/testfiles/h5copytst.out.ls b/tools/testfiles/h5copytst.out.ls
index 378aa0f..c4d1778 100644
--- a/tools/testfiles/h5copytst.out.ls
+++ b/tools/testfiles/h5copytst.out.ls
@@ -11,7 +11,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/A/B1/simple Dataset {6/6}
Location: 1:90216
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/A/B2 Group
@@ -20,7 +19,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/A/B2/simple2 Dataset {6/6}
Location: 1:94456
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/C Group
@@ -32,7 +30,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/C/D/simple Dataset {6/6}
Location: 1:97664
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/E Group
@@ -47,20 +44,17 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/E/F/grp_dsets/chunk Dataset {6/6}
Location: 1:102744
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/E/F/grp_dsets/compact Dataset {6/6}
Location: 1:103200
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/E/F/grp_dsets/compound Dataset {2/2}
Location: 1:103336
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -69,7 +63,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/E/F/grp_dsets/compressed Dataset {6/6}
Location: 1:103552
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Filter-0: deflate-1 OPT {1}
@@ -77,14 +70,12 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/E/F/grp_dsets/named_vl Dataset {2/2}
Location: 1:103768
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: shared-1:103720 variable length of
32-bit little-endian integer
/E/F/grp_dsets/nested_vl Dataset {2/2}
Location: 1:112240
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: variable length of
variable length of
@@ -92,7 +83,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/E/F/grp_dsets/simple Dataset {6/6}
Location: 1:112384
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/E/F/grp_dsets/vl Type
@@ -115,20 +105,17 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/G/H/grp_nested/grp_dsets/chunk Dataset {6/6}
Location: 1:118088
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/G/H/grp_nested/grp_dsets/compact Dataset {6/6}
Location: 1:120688
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/G/H/grp_nested/grp_dsets/compound Dataset {2/2}
Location: 1:120824
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -137,7 +124,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/G/H/grp_nested/grp_dsets/compressed Dataset {6/6}
Location: 1:123136
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Filter-0: deflate-1 OPT {1}
@@ -145,14 +131,12 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/G/H/grp_nested/grp_dsets/named_vl Dataset {2/2}
Location: 1:127448
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: shared-1:123304 variable length of
32-bit little-endian integer
/G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2}
Location: 1:127576
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: variable length of
variable length of
@@ -160,7 +144,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/G/H/grp_nested/grp_dsets/simple Dataset {6/6}
Location: 1:127720
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/G/H/grp_nested/grp_dsets/vl Type
@@ -171,20 +154,17 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/chunk Dataset {6/6}
Location: 1:6216
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/compact Dataset {6/6}
Location: 1:6344
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/compound Dataset {2/2}
Location: 1:8528
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -193,7 +173,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/compressed Dataset {6/6}
Location: 1:12888
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Filter-0: deflate-1 OPT {1}
@@ -204,20 +183,17 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_dsets/chunk Dataset {6/6}
Location: 1:35896
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_dsets/compact Dataset {6/6}
Location: 1:36352
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_dsets/compound Dataset {2/2}
Location: 1:36488
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -226,7 +202,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_dsets/compressed Dataset {6/6}
Location: 1:36704
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Filter-0: deflate-1 OPT {1}
@@ -234,14 +209,12 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_dsets/named_vl Dataset {2/2}
Location: 1:36920
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: shared-1:36872 variable length of
32-bit little-endian integer
/grp_dsets/nested_vl Dataset {2/2}
Location: 1:45392
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: variable length of
variable length of
@@ -249,13 +222,11 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_dsets/simple Dataset {6/6}
Location: 1:45536
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_dsets/simple_group Dataset {6/6}
Location: 1:61744
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_dsets/vl Type
@@ -275,20 +246,17 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_nested/grp_dsets/chunk Dataset {6/6}
Location: 1:49256
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_nested/grp_dsets/compact Dataset {6/6}
Location: 1:51856
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_nested/grp_dsets/compound Dataset {2/2}
Location: 1:51992
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -297,7 +265,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_nested/grp_dsets/compressed Dataset {6/6}
Location: 1:54304
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Filter-0: deflate-1 OPT {1}
@@ -305,14 +272,12 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_nested/grp_dsets/named_vl Dataset {2/2}
Location: 1:58616
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: shared-1:54472 variable length of
32-bit little-endian integer
/grp_nested/grp_dsets/nested_vl Dataset {2/2}
Location: 1:58744
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: variable length of
variable length of
@@ -320,7 +285,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_nested/grp_dsets/simple Dataset {6/6}
Location: 1:58888
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_nested/grp_dsets/vl Type
@@ -334,20 +298,17 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/chunk Dataset {6/6}
Location: 1:65088
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/compact Dataset {6/6}
Location: 1:65544
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/compound Dataset {2/2}
Location: 1:65680
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -356,7 +317,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/compressed Dataset {6/6}
Location: 1:65896
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Filter-0: deflate-1 OPT {1}
@@ -367,20 +327,17 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/grp_dsets/chunk Dataset {6/6}
Location: 1:78072
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/grp_dsets/compact Dataset {6/6}
Location: 1:78528
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/grp_dsets/compound Dataset {2/2}
Location: 1:78664
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -389,7 +346,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/grp_dsets/compressed Dataset {6/6}
Location: 1:78880
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Chunks: {2} 8 bytes
Storage: <details removed for portability>
Filter-0: deflate-1 OPT {1}
@@ -397,14 +353,12 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/grp_dsets/named_vl Dataset {2/2}
Location: 1:79096
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: shared-1:79048 variable length of
32-bit little-endian integer
/grp_rename/grp_dsets/nested_vl Dataset {2/2}
Location: 1:87568
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: variable length of
variable length of
@@ -412,7 +366,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/grp_dsets/simple Dataset {6/6}
Location: 1:87712
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/grp_dsets/vl Type
@@ -423,14 +376,12 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/named_vl Dataset {2/2}
Location: 1:66112
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: shared-1:66064 variable length of
32-bit little-endian integer
/grp_rename/nested_vl Dataset {2/2}
Location: 1:74584
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: variable length of
variable length of
@@ -438,7 +389,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/grp_rename/simple Dataset {6/6}
Location: 1:74728
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/vl Type
@@ -449,14 +399,12 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/named_vl Dataset {2/2}
Location: 1:13104
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: shared-1:13056 variable length of
32-bit little-endian integer
/nested_vl Dataset {2/2}
Location: 1:27392
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: variable length of
variable length of
@@ -464,7 +412,6 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/rename Dataset {2/2}
Location: 1:31760
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: struct {
"str1" +0 20-byte null-terminated ASCII string
@@ -473,12 +420,10 @@ Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
/simple Dataset {6/6}
Location: 1:800
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/simple_top Dataset {6/6}
Location: 1:29584
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: <details removed for portability>
Type: 32-bit little-endian integer
diff --git a/tools/testfiles/tall-1.ddl b/tools/testfiles/tall-1.ddl
index 6069293..cd5f721 100644
--- a/tools/testfiles/tall-1.ddl
+++ b/tools/testfiles/tall-1.ddl
@@ -68,7 +68,7 @@ GROUP "/" {
LINKCLASS 64
TARGETFILE "somefile"
TARGETPATH "somepath"
-}
+ }
GROUP "g1.2.1" {
SOFTLINK "slink" {
LINKTARGET "somevalue"
diff --git a/tools/testfiles/tall-2A.ddl b/tools/testfiles/tall-2A.ddl
index b16feb8..2c56501 100644
--- a/tools/testfiles/tall-2A.ddl
+++ b/tools/testfiles/tall-2A.ddl
@@ -52,7 +52,7 @@ GROUP "/" {
LINKCLASS 64
TARGETFILE "somefile"
TARGETPATH "somepath"
-}
+ }
GROUP "g1.2.1" {
SOFTLINK "slink" {
LINKTARGET "somevalue"
diff --git a/tools/testfiles/tall-2A.h5.xml b/tools/testfiles/tall-2A.h5.xml
index 8a8467c..314ab4e 100644
--- a/tools/testfiles/tall-2A.h5.xml
+++ b/tools/testfiles/tall-2A.h5.xml
@@ -127,10 +127,10 @@ Expected output for 'h5dump --xml -A tall.h5'
</hdf5:Dataset>
</hdf5:Group>
<hdf5:Group Name="g1.2" OBJ-XID="xid_3568" H5Path="/g1/g1.2" Parents="xid_800" H5ParentPaths="/g1" >
+ <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3568" H5ParentPaths="/g1/g1.2" />
<hdf5:Group Name="g1.2.1" OBJ-XID="xid_4272" H5Path="/g1/g1.2/g1.2.1" Parents="xid_3568" H5ParentPaths="/g1/g1.2" >
- <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4272" H5ParentPaths="/g1/g1.2/g1.2.1" />
+ <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4272" H5ParentPaths="/g1/g1.2/g1.2.1" />
</hdf5:Group>
- <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3568" H5ParentPaths="/g1/g1.2" />
</hdf5:Group>
</hdf5:Group>
<hdf5:Group Name="g2" OBJ-XID="xid_1832" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
diff --git a/tools/testfiles/tall-2B.ddl b/tools/testfiles/tall-2B.ddl
index 002156e..ec220e9 100644
--- a/tools/testfiles/tall-2B.ddl
+++ b/tools/testfiles/tall-2B.ddl
@@ -48,7 +48,7 @@ GROUP "/" {
LINKCLASS 64
TARGETFILE "somefile"
TARGETPATH "somepath"
-}
+ }
GROUP "g1.2.1" {
SOFTLINK "slink" {
LINKTARGET "somevalue"
diff --git a/tools/testfiles/tall.h5.xml b/tools/testfiles/tall.h5.xml
index 8f11e54..3747193 100644
--- a/tools/testfiles/tall.h5.xml
+++ b/tools/testfiles/tall.h5.xml
@@ -140,10 +140,10 @@ Expected output for 'h5dump --xml tall.h5'
</hdf5:Dataset>
</hdf5:Group>
<hdf5:Group Name="g1.2" OBJ-XID="xid_3568" H5Path="/g1/g1.2" Parents="xid_800" H5ParentPaths="/g1" >
+ <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3568" H5ParentPaths="/g1/g1.2" />
<hdf5:Group Name="g1.2.1" OBJ-XID="xid_4272" H5Path="/g1/g1.2/g1.2.1" Parents="xid_3568" H5ParentPaths="/g1/g1.2" >
- <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551614" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4272" H5ParentPaths="/g1/g1.2/g1.2.1" />
+ <hdf5:SoftLink LinkName="slink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/g1.2.1/slink" TargetPath="somevalue" Parents="xid_4272" H5ParentPaths="/g1/g1.2/g1.2.1" />
</hdf5:Group>
- <hdf5:ExternalLink LinkName="extlink" OBJ-XID="xid_18446744073709551613" H5SourcePath="/g1/g1.2/extlink" TargetFilename="somefile" TargetPath="somepath" Parents="xid_3568" H5ParentPaths="/g1/g1.2" />
</hdf5:Group>
</hdf5:Group>
<hdf5:Group Name="g2" OBJ-XID="xid_1832" H5Path="/g2" Parents="xid_96" H5ParentPaths="/" >
diff --git a/tools/testfiles/tattr2.ls b/tools/testfiles/tattr2.ls
index 01ad413..e34206e 100644
--- a/tools/testfiles/tattr2.ls
+++ b/tools/testfiles/tattr2.ls
@@ -308,7 +308,6 @@ dset Dataset {2/2}
(2,2,1) 18, 19, 20, 21, 22, 23, 24
Location: 1:976
Links: 1
- Modified: XXXX-XX-XX XX:XX:XX XXX
Storage: 8 logical bytes, 0 allocated bytes
Type: 32-bit little-endian integer
g1 Group
diff --git a/tools/testfiles/tcompound.h5.xml b/tools/testfiles/tcompound.h5.xml
index 1cbbf2e..c6de351 100644
--- a/tools/testfiles/tcompound.h5.xml
+++ b/tools/testfiles/tcompound.h5.xml
@@ -24,57 +24,6 @@ Expected output for 'h5dump --xml tcompound.h5'
</hdf5:CompoundType>
</hdf5:DataType>
</hdf5:NamedDataType>
- <hdf5:NamedDataType Name="type1" OBJ-XID="xid_1424" H5Path="/type1" Parents="xid_696" H5ParentPaths="/">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="int_name">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="float_name">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
- <hdf5:NamedDataType Name="type2" OBJ-XID="xid_2792" H5Path="/type2" Parents="xid_696" H5ParentPaths="/">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="int_array">
- <hdf5:DataType>
- <hdf5:ArrayType Ndims="1">
- <hdf5:ArrayDimension DimSize="4"/>
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:ArrayType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="float_array">
- <hdf5:DataType>
- <hdf5:ArrayType Ndims="2">
- <hdf5:ArrayDimension DimSize="5"/>
- <hdf5:ArrayDimension DimSize="6"/>
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:ArrayType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
<hdf5:Dataset Name="dset1" OBJ-XID="xid_744" H5Path= "/dset1" Parents="xid_696" H5ParentPaths="/">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
@@ -122,26 +71,6 @@ Expected output for 'h5dump --xml tcompound.h5'
</hdf5:Data>
</hdf5:Dataset>
<hdf5:Group Name="group1" OBJ-XID="xid_2104" H5Path="/group1" Parents="xid_696" H5ParentPaths="/" >
- <hdf5:NamedDataType Name="type3" OBJ-XID="xid_5592" H5Path="/group1/type3" Parents="xid_2104" H5ParentPaths="/group1">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="int">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="float">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
<hdf5:Dataset Name="dset2" OBJ-XID="xid_2152" H5Path= "/group1/dset2" Parents="xid_2104" H5ParentPaths="/group1">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
@@ -298,6 +227,26 @@ Expected output for 'h5dump --xml tcompound.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
+ <hdf5:NamedDataType Name="type3" OBJ-XID="xid_5592" H5Path="/group1/type3" Parents="xid_2104" H5ParentPaths="/group1">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="int">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="float">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
</hdf5:Group>
<hdf5:Group Name="group2" OBJ-XID="xid_6584" H5Path="/group2" Parents="xid_696" H5ParentPaths="/" >
<hdf5:Dataset Name="dset5" OBJ-XID="xid_7040" H5Path= "/group2/dset5" Parents="xid_6584" H5ParentPaths="/group2">
@@ -323,5 +272,56 @@ Expected output for 'h5dump --xml tcompound.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
+ <hdf5:NamedDataType Name="type1" OBJ-XID="xid_1424" H5Path="/type1" Parents="xid_696" H5ParentPaths="/">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="int_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="float_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
+ <hdf5:NamedDataType Name="type2" OBJ-XID="xid_2792" H5Path="/type2" Parents="xid_696" H5ParentPaths="/">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="int_array">
+ <hdf5:DataType>
+ <hdf5:ArrayType Ndims="1">
+ <hdf5:ArrayDimension DimSize="4"/>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:ArrayType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="float_array">
+ <hdf5:DataType>
+ <hdf5:ArrayType Ndims="2">
+ <hdf5:ArrayDimension DimSize="5"/>
+ <hdf5:ArrayDimension DimSize="6"/>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:ArrayType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tcompound2.h5.xml b/tools/testfiles/tcompound2.h5.xml
index 2940caa..e0b087c 100644
--- a/tools/testfiles/tcompound2.h5.xml
+++ b/tools/testfiles/tcompound2.h5.xml
@@ -24,57 +24,6 @@ Expected output for 'h5dump --xml tcompound2.h5'
</hdf5:CompoundType>
</hdf5:DataType>
</hdf5:NamedDataType>
- <hdf5:NamedDataType Name="type1" OBJ-XID="xid_3280" H5Path="/type1" Parents="xid_696" H5ParentPaths="/">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="int_name">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="float_name">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
- <hdf5:NamedDataType Name="type2" OBJ-XID="xid_6544" H5Path="/type2" Parents="xid_696" H5ParentPaths="/">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="int_array">
- <hdf5:DataType>
- <hdf5:ArrayType Ndims="1">
- <hdf5:ArrayDimension DimSize="4"/>
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:ArrayType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="float_array">
- <hdf5:DataType>
- <hdf5:ArrayType Ndims="2">
- <hdf5:ArrayDimension DimSize="5"/>
- <hdf5:ArrayDimension DimSize="6"/>
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:ArrayType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
<hdf5:Dataset Name="dset1" OBJ-XID="xid_744" H5Path= "/dset1" Parents="xid_696" H5ParentPaths="/">
<hdf5:StorageLayout>
<hdf5:ChunkedLayout Ndims="1">
@@ -126,26 +75,6 @@ Expected output for 'h5dump --xml tcompound2.h5'
</hdf5:Data>
</hdf5:Dataset>
<hdf5:Group Name="group1" OBJ-XID="xid_3960" H5Path="/group1" Parents="xid_696" H5ParentPaths="/" >
- <hdf5:NamedDataType Name="type3" OBJ-XID="xid_6624" H5Path="/group1/type3" Parents="xid_3960" H5ParentPaths="/group1">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="int">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="float">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
<hdf5:Dataset Name="dset2" OBJ-XID="xid_4008" H5Path= "/group1/dset2" Parents="xid_3960" H5ParentPaths="/group1">
<hdf5:StorageLayout>
<hdf5:ChunkedLayout Ndims="1">
@@ -198,6 +127,26 @@ Expected output for 'h5dump --xml tcompound2.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
+ <hdf5:NamedDataType Name="type3" OBJ-XID="xid_6624" H5Path="/group1/type3" Parents="xid_3960" H5ParentPaths="/group1">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="int">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="float">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
</hdf5:Group>
<hdf5:Group Name="group2" OBJ-XID="xid_9512" H5Path="/group2" Parents="xid_696" H5ParentPaths="/" >
<hdf5:Dataset Name="dset5" OBJ-XID="xid_9968" H5Path= "/group2/dset5" Parents="xid_9512" H5ParentPaths="/group2">
@@ -227,5 +176,56 @@ Expected output for 'h5dump --xml tcompound2.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
+ <hdf5:NamedDataType Name="type1" OBJ-XID="xid_3280" H5Path="/type1" Parents="xid_696" H5ParentPaths="/">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="int_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="float_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
+ <hdf5:NamedDataType Name="type2" OBJ-XID="xid_6544" H5Path="/type2" Parents="xid_696" H5ParentPaths="/">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="int_array">
+ <hdf5:DataType>
+ <hdf5:ArrayType Ndims="1">
+ <hdf5:ArrayDimension DimSize="4"/>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:ArrayType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="float_array">
+ <hdf5:DataType>
+ <hdf5:ArrayType Ndims="2">
+ <hdf5:ArrayDimension DimSize="5"/>
+ <hdf5:ArrayDimension DimSize="6"/>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:ArrayType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tnamed_dtype_attr.h5.xml b/tools/testfiles/tnamed_dtype_attr.h5.xml
index 9d4a0c0..0b9ceae 100644
--- a/tools/testfiles/tnamed_dtype_attr.h5.xml
+++ b/tools/testfiles/tnamed_dtype_attr.h5.xml
@@ -4,13 +4,6 @@ Expected output for 'h5dump --xml tnamed_dtype_attr.h5'
<?xml version="1.0" encoding="UTF-8"?>
<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd">
<hdf5:RootGroup OBJ-XID="xid_96" H5Path="/">
- <hdf5:NamedDataType Name="Datatype" OBJ-XID="xid_792" H5Path="/Datatype" Parents="xid_96" H5ParentPaths="/">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="LE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
<hdf5:Dataset Name="Dataset" OBJ-XID="xid_1264" H5Path= "/Dataset" Parents="xid_96" H5ParentPaths="/">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
@@ -39,6 +32,13 @@ Expected output for 'h5dump --xml tnamed_dtype_attr.h5'
<hdf5:NoData/>
</hdf5:Data>
</hdf5:Dataset>
+ <hdf5:NamedDataType Name="Datatype" OBJ-XID="xid_792" H5Path="/Datatype" Parents="xid_96" H5ParentPaths="/">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="LE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
<hdf5:Group Name="g1" OBJ-XID="xid_1536" H5Path="/g1" Parents="xid_96" H5ParentPaths="/" >
<hdf5:Attribute Name="Attribute">
<hdf5:Dataspace>
diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl
index a516dde..9eb9f88 100644
--- a/tools/testfiles/tnofilename.ddl
+++ b/tools/testfiles/tnofilename.ddl
@@ -25,7 +25,7 @@ usage: h5dump [OPTIONS] file
with -o (output file) and -d (dataset). B can be:
MEMORY for a memory type, FILE for the file type,
LE or BE for pre-existing little or big endian types
- -t P, --datatype=P Print the specified named data type
+ -t P, --datatype=P Print the specified named datatype
-w N, --width=N Set the number of columns of output
-x, --xml Output in XML using Schema
-u, --use-dtd Output in XML using DTD
diff --git a/tools/testfiles/tobjref.h5.xml b/tools/testfiles/tobjref.h5.xml
index 57cb64b..327291e 100644
--- a/tools/testfiles/tobjref.h5.xml
+++ b/tools/testfiles/tobjref.h5.xml
@@ -35,33 +35,6 @@ Expected output for 'h5dump --xml tobjref.h5'
</hdf5:Data>
</hdf5:Dataset>
<hdf5:Group Name="Group1" OBJ-XID="xid_1320" H5Path="/Group1" Parents="xid_696" H5ParentPaths="/" >
- <hdf5:NamedDataType Name="Datatype1" OBJ-XID="xid_2268" H5Path="/Group1/Datatype1" Parents="xid_1320" H5ParentPaths="/Group1">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="a">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="b">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="c">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
<hdf5:Dataset Name="Dataset1" OBJ-XID="xid_1696" H5Path= "/Group1/Dataset1" Parents="xid_1320" H5ParentPaths="/Group1">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
@@ -112,6 +85,33 @@ Expected output for 'h5dump --xml tobjref.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
+ <hdf5:NamedDataType Name="Datatype1" OBJ-XID="xid_2268" H5Path="/Group1/Datatype1" Parents="xid_1320" H5ParentPaths="/Group1">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="a">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="b">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="c">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
</hdf5:Group>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tref.h5.xml b/tools/testfiles/tref.h5.xml
index 5edd4d2..6b093de 100644
--- a/tools/testfiles/tref.h5.xml
+++ b/tools/testfiles/tref.h5.xml
@@ -4,35 +4,6 @@ Expected output for 'h5dump --xml tref.h5'
<?xml version="1.0" encoding="UTF-8"?>
<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/DTDs/HDF5File http://hdfgroup.org/DTDs/HDF5-File.xsd">
<hdf5:RootGroup OBJ-XID="xid_696" H5Path="/">
- <hdf5:Dataset Name="ZZZDataset3" OBJ-XID="xid_2612" H5Path= "/ZZZDataset3" Parents="xid_696" H5ParentPaths="/">
- <hdf5:StorageLayout>
- <hdf5:ContiguousLayout/>
- </hdf5:StorageLayout>
- <hdf5:FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
- <hdf5:FillValue>
- <hdf5:NoFill/>
- </hdf5:FillValue>
- </hdf5:FillValueInfo>
- <hdf5:Dataspace>
- <hdf5:SimpleDataspace Ndims="1">
- <hdf5:Dimension DimSize="3" MaxDimSize="3"/>
- </hdf5:SimpleDataspace>
- </hdf5:Dataspace>
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:ReferenceType>
- <hdf5:ObjectReferenceType />
- </hdf5:ReferenceType>
- </hdf5:AtomicType>
- </hdf5:DataType>
- <hdf5:Data>
- <hdf5:DataFromFile>
- "/Group1/Dataset1"
- "/Group1/Dataset2"
- "/Group1"
- </hdf5:DataFromFile>
- </hdf5:Data>
- </hdf5:Dataset>
<hdf5:Group Name="Group1" OBJ-XID="xid_1344" H5Path="/Group1" Parents="xid_696" H5ParentPaths="/" >
<hdf5:Dataset Name="Dataset1" OBJ-XID="xid_1720" H5Path= "/Group1/Dataset1" Parents="xid_1344" H5ParentPaths="/Group1">
<hdf5:StorageLayout>
@@ -85,5 +56,34 @@ Expected output for 'h5dump --xml tref.h5'
</hdf5:Data>
</hdf5:Dataset>
</hdf5:Group>
+ <hdf5:Dataset Name="ZZZDataset3" OBJ-XID="xid_2612" H5Path= "/ZZZDataset3" Parents="xid_696" H5ParentPaths="/">
+ <hdf5:StorageLayout>
+ <hdf5:ContiguousLayout/>
+ </hdf5:StorageLayout>
+ <hdf5:FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <hdf5:FillValue>
+ <hdf5:NoFill/>
+ </hdf5:FillValue>
+ </hdf5:FillValueInfo>
+ <hdf5:Dataspace>
+ <hdf5:SimpleDataspace Ndims="1">
+ <hdf5:Dimension DimSize="3" MaxDimSize="3"/>
+ </hdf5:SimpleDataspace>
+ </hdf5:Dataspace>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:ReferenceType>
+ <hdf5:ObjectReferenceType />
+ </hdf5:ReferenceType>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ <hdf5:Data>
+ <hdf5:DataFromFile>
+ "/Group1/Dataset1"
+ "/Group1/Dataset2"
+ "/Group1"
+ </hdf5:DataFromFile>
+ </hdf5:Data>
+ </hdf5:Dataset>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tsaf.h5.xml b/tools/testfiles/tsaf.h5.xml
index 8c44bab..3f4ef38 100644
--- a/tools/testfiles/tsaf.h5.xml
+++ b/tools/testfiles/tsaf.h5.xml
@@ -307,6 +307,295 @@ Expected output for 'h5dump --xml tsaf.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
+ <hdf5:Group Name=".attributes" OBJ-XID="xid_5072" H5Path="/.attributes" Parents="xid_696" H5ParentPaths="/" >
+ <hdf5:Group Name="database" OBJ-XID="xid_5728" H5Path="/.attributes/database" Parents="xid_5072" H5ParentPaths="/.attributes" >
+ <hdf5:Dataset Name=".SAF_DbProps" OBJ-XID="xid_6104" H5Path= "/.attributes/database/.SAF_DbProps" Parents="xid_5728" H5ParentPaths="/.attributes/database">
+ <hdf5:StorageLayout>
+ <hdf5:ContiguousLayout/>
+ </hdf5:StorageLayout>
+ <hdf5:FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <hdf5:FillValue>
+ <hdf5:NoFill/>
+ </hdf5:FillValue>
+ </hdf5:FillValueInfo>
+ <hdf5:Dataspace>
+ <hdf5:SimpleDataspace Ndims="1">
+ <hdf5:Dimension DimSize="1" MaxDimSize="1"/>
+ </hdf5:SimpleDataspace>
+ </hdf5:Dataspace>
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="magic">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="SFileDir">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="1024" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="ImportFile">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="1024" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="parallel">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="safapi">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="vmajor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="vminor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="rel">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="annot">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="saflib">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="vmajor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="vminor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="rel">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="annot">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="vbt">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="vmajor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="vminor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="rel">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="annot">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="dsl">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="vmajor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="vminor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="rel">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="annot">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="hdf5">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="vmajor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="vminor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="rel">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="annot">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="mpi">
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="vmajor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="vminor">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="rel">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="annot">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="DoToc">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="ReadOnly">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="Clobber">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="OSModes">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ <!-- Note: format of compound data not specified -->
+ <hdf5:Data>
+ <hdf5:DataFromFile>
+ -604320037 "." "don't import" 1 0 0 0 "none" 0 1 0 "devel" 1 3 0 "" 0 0 0 "none" 1 2 1 "" 1 2 0 "" 1 0 1 0
+ </hdf5:DataFromFile>
+ </hdf5:Data>
+ </hdf5:Dataset>
+ </hdf5:Group>
+ </hdf5:Group>
<hdf5:Dataset Name="Blob" OBJ-XID="xid_17612" H5Path= "/Blob" Parents="xid_696" H5ParentPaths="/">
<hdf5:StorageLayout>
<hdf5:ChunkedLayout Ndims="1">
@@ -2628,294 +2917,5 @@ Expected output for 'h5dump --xml tsaf.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
- <hdf5:Group Name=".attributes" OBJ-XID="xid_5072" H5Path="/.attributes" Parents="xid_696" H5ParentPaths="/" >
- <hdf5:Group Name="database" OBJ-XID="xid_5728" H5Path="/.attributes/database" Parents="xid_5072" H5ParentPaths="/.attributes" >
- <hdf5:Dataset Name=".SAF_DbProps" OBJ-XID="xid_6104" H5Path= "/.attributes/database/.SAF_DbProps" Parents="xid_5728" H5ParentPaths="/.attributes/database">
- <hdf5:StorageLayout>
- <hdf5:ContiguousLayout/>
- </hdf5:StorageLayout>
- <hdf5:FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
- <hdf5:FillValue>
- <hdf5:NoFill/>
- </hdf5:FillValue>
- </hdf5:FillValueInfo>
- <hdf5:Dataspace>
- <hdf5:SimpleDataspace Ndims="1">
- <hdf5:Dimension DimSize="1" MaxDimSize="1"/>
- </hdf5:SimpleDataspace>
- </hdf5:Dataspace>
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="magic">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="SFileDir">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="1024" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="ImportFile">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="1024" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="parallel">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="safapi">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="vmajor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="vminor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="rel">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="annot">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="saflib">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="vmajor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="vminor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="rel">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="annot">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="vbt">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="vmajor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="vminor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="rel">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="annot">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="dsl">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="vmajor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="vminor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="rel">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="annot">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="hdf5">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="vmajor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="vminor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="rel">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="annot">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="mpi">
- <hdf5:DataType>
- <hdf5:CompoundType>
- <hdf5:Field FieldName="vmajor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="vminor">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="rel">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="annot">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="10" StrPad="H5T_STR_NULLTERM"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="DoToc">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="ReadOnly">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="Clobber">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- <hdf5:Field FieldName="OSModes">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:Field>
- </hdf5:CompoundType>
- </hdf5:DataType>
- <!-- Note: format of compound data not specified -->
- <hdf5:Data>
- <hdf5:DataFromFile>
- -604320037 "." "don't import" 1 0 0 0 "none" 0 1 0 "devel" 1 3 0 "" 0 0 0 "none" 1 2 1 "" 1 2 0 "" 1 0 1 0
- </hdf5:DataFromFile>
- </hdf5:Data>
- </hdf5:Dataset>
- </hdf5:Group>
- </hdf5:Group>
</hdf5:RootGroup>
</hdf5:HDF5-File>
diff --git a/tools/testfiles/tvlstr.h5.xml b/tools/testfiles/tvlstr.h5.xml
index 8a0a180..98a3b30 100644
--- a/tools/testfiles/tvlstr.h5.xml
+++ b/tools/testfiles/tvlstr.h5.xml
@@ -15,13 +15,6 @@ Expected output for 'h5dump --xml tvlstr.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Attribute>
- <hdf5:NamedDataType Name="vl_string_type" OBJ-XID="xid_1576" H5Path="/vl_string_type" Parents="xid_928" H5ParentPaths="/">
- <hdf5:DataType>
- <hdf5:AtomicType>
- <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="H5T_VARIABLE" StrPad="H5T_STR_NULLPAD"/>
- </hdf5:AtomicType>
- </hdf5:DataType>
- </hdf5:NamedDataType>
<hdf5:Dataset Name="Dataset1" OBJ-XID="xid_976" H5Path= "/Dataset1" Parents="xid_928" H5ParentPaths="/">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
@@ -53,5 +46,12 @@ Expected output for 'h5dump --xml tvlstr.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
+ <hdf5:NamedDataType Name="vl_string_type" OBJ-XID="xid_1576" H5Path="/vl_string_type" Parents="xid_928" H5ParentPaths="/">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="H5T_VARIABLE" StrPad="H5T_STR_NULLPAD"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:NamedDataType>
</hdf5:RootGroup>
</hdf5:HDF5-File>