summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2012-10-29 18:59:05 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2012-10-29 18:59:05 (GMT)
commit0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d (patch)
tree7f5576b9ed8e414606093b6872ced10dd0f5bf0e /tools/h5dump
parent78b07da7aea98598a74bce25335b9435aa29cdb9 (diff)
downloadhdf5-0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d.zip
hdf5-0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d.tar.gz
hdf5-0cf58a4755eb6f3e7be64b0f05f2bb8ef6f7ad0d.tar.bz2
[svn-r22987] ported revisions from 22742 to 22986 from the trunk
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/CMakeLists.txt14
-rw-r--r--tools/h5dump/h5dump.c20
-rw-r--r--tools/h5dump/h5dump_xml.c3
-rw-r--r--tools/h5dump/h5dump_xml.h8
-rw-r--r--tools/h5dump/h5dumpgentest.c419
-rw-r--r--tools/h5dump/testh5dump.sh.in8
6 files changed, 454 insertions, 18 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 0327949..8766eb6 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -159,6 +159,8 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/tperror.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/treference.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ddl
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.ddl
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tscaleoffset.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tshuffle.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink-1.ddl
@@ -260,6 +262,8 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/torderattr.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tordergr.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.h5
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.h5
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-m.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-r.h5
@@ -1016,6 +1020,10 @@ IF (BUILD_TESTING)
treference.out.err
tsaf.out
tsaf.out.err
+ tscalarintsize.out
+ tscalarintsize.out.err
+ tscalarattrintsize.out
+ tscalarattrintsize.out.err
tscaleoffset.out
tscaleoffset.out.err
tshuffle.out
@@ -1079,10 +1087,16 @@ IF (BUILD_TESTING)
ADD_H5_TEST (packedbits 0 --enable-error-stack packedbits.h5)
# test for compound signed/unsigned datasets
ADD_H5_TEST (tcmpdintsize 0 --enable-error-stack tcmpdintsize.h5)
+ # test for signed/unsigned scalar datasets
+ # TODO: failed on mac with intel compiler. (Allen will work on it)
+ #ADD_H5_TEST (tscalarintsize 0 --enable-error-stack tscalarintsize.h5)
# test for signed/unsigned attributes
ADD_H5_TEST (tattrintsize 0 --enable-error-stack tattrintsize.h5)
# test for compound signed/unsigned attributes
ADD_H5_TEST (tcmpdattrintsize 0 --enable-error-stack tcmpdattrintsize.h5)
+ # test for signed/unsigned scalar attributes
+ # TODO: failed on mac with intel compiler. (Allen will work on it)
+ #ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5)
# test for displaying groups
ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5)
# test for displaying the selected groups
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 2921fb9..34b8bc4 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -932,7 +932,7 @@ parse_mask_list(const char *h_list)
static void
free_handler(struct handler_t *hand, int len)
{
- register int i;
+ int i;
if(hand) {
for (i = 0; i < len; i++) {
@@ -997,7 +997,7 @@ parse_command_line(int argc, const char *argv[])
/* this will be plenty big enough to hold the info */
if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) {
- goto error;
+ goto error;
}
/* parse command line options */
@@ -1054,7 +1054,7 @@ parse_start:
break;
case 'w':
h5tools_nCols = HDatoi(opt_arg);
- if (h5tools_nCols==0) {
+ if (h5tools_nCols <= 0) {
h5tools_nCols = 65535;
}
last_was_dset = FALSE;
@@ -1293,7 +1293,7 @@ parse_start:
if (s->count.data) {
HDfree(s->count.data);
s->count.data = NULL;
- }
+ }
parse_hsize_list(opt_arg, &s->count);
break;
case 'k':
@@ -1356,6 +1356,7 @@ error:
return hand;
}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -1423,6 +1424,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
+
/* Disable tools error reporting */
H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
@@ -1449,28 +1451,28 @@ main(int argc, const char *argv[])
"to display selected objects");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_bb) {
error_msg("option \"%s\" not available for XML\n", "--boot-block");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_oid == 1) {
error_msg("option \"%s\" not available for XML\n", "--object-ids");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_char == TRUE) {
error_msg("option \"%s\" not available for XML\n", "--string");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (usingdasho) {
error_msg("option \"%s\" not available for XML\n", "--output");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- }
+ }
else {
if (xml_dtd_uri) {
warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri);
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index 1a29659..28264e7 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/h5dump/h5dump_xml.c
@@ -3761,7 +3761,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
/* Print information about storage layout */
if (H5D_CHUNKED == H5Pget_layout(dcpl)) {
maxdims = H5Sget_simple_extent_ndims(space);
- chsize = (hsize_t *) HDmalloc(maxdims * sizeof(hsize_t));
+ HDassert(maxdims >= 0);
+ chsize = (hsize_t *)HDmalloc((size_t)maxdims * sizeof(hsize_t));
ctx.indent_level++;
dump_indent += COL;
diff --git a/tools/h5dump/h5dump_xml.h b/tools/h5dump/h5dump_xml.h
index 28485f8..258fd38 100644
--- a/tools/h5dump/h5dump_xml.h
+++ b/tools/h5dump/h5dump_xml.h
@@ -102,14 +102,6 @@ static h5tool_format_t xml_dataformat = {
extern "C" {
#endif
-/* internal functions used by XML option */
-static void xml_print_datatype(hid_t, unsigned);
-static void xml_print_enum(hid_t);
-static int xml_print_refs(hid_t, int);
-static int xml_print_strs(hid_t, int);
-static char *xml_escape_the_string(const char *, int);
-static char *xml_escape_the_name(const char *);
-
/* The dump functions of the dump_function_table */
/* XML format: same interface, alternative output */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 63329f4..1bbb9f9 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -102,6 +102,8 @@
#define FILE70 "tcmpdintsize.h5"
#define FILE71 "tcmpdattrintsize.h5"
#define FILE72 "tnestedcmpddt.h5"
+#define FILE73 "tscalarintsize.h5"
+#define FILE74 "tscalarattrintsize.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -301,6 +303,23 @@ typedef struct s1_t {
/* Name of dataset to create in datafile */
#define F71_DATASETNAME "CompoundAttrIntSize"
+/* "FILE73" macros and for FILE69 */
+#define F73_ARRAY_RANK 2
+#define F73_XDIM 8
+#define F73_DATASETU08 "DU08BITS"
+#define F73_DATASETS08 "DS08BITS"
+#define F73_YDIM8 8
+#define F73_DATASETU16 "DU16BITS"
+#define F73_DATASETS16 "DS16BITS"
+#define F73_YDIM16 16
+#define F73_DATASETU32 "DU32BITS"
+#define F73_DATASETS32 "DS32BITS"
+#define F73_YDIM32 32
+#define F73_DATASETU64 "DU64BITS"
+#define F73_DATASETS64 "DS64BITS"
+#define F73_YDIM64 64
+#define F73_DUMMYDBL "DummyDBL"
+
static void
gent_group(void)
{
@@ -8097,6 +8116,404 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
}
/*-------------------------------------------------------------------------
+ * Function: gent_intscalars
+ *
+ * Purpose: Generate a file to be used in the h5dump tests.
+ * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_intscalars(void)
+{
+ hid_t fid, dataset, space, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE73, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Dataset of 8 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ }
+ valu8bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ }
+ valu16bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ }
+ valu32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ }
+ valu64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 8 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset8[i][j] = dset8[i][j-1] << 1;
+ }
+ val8bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset16[i][j] = dset16[i][j-1] << 1;
+ }
+ val16bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j-1] << 1;
+ }
+ val32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j-1] << 1;
+ }
+ val64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ dsetdbl[i][j] = 0.0001 * j + i;
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_attr_packedbits
+ *
+ * Purpose: Generate a file to be used in the h5dump packed bits tests.
+ * Four attributes of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ * Use file to test Signed/Unsigned datatypes and keep in sync with gent_packedbits()
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_attr_intscalars(void)
+{
+ hid_t fid, attr, space, root, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* Attribute of 8 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ }
+ valu8bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dsetu8);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 16 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ }
+ valu16bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dsetu16);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 32 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ }
+ valu32bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dsetu32);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 64 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ }
+ valu64bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dsetu64);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 8 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset8[i][j] = dset8[i][j-1] << 1;
+ }
+ val8bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dset8);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 16 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset16[i][j] = dset16[i][j-1] << 1;
+ }
+ val16bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dset16);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 32 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j-1] << 1;
+ }
+ val32bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dset32);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 64 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j-1] << 1;
+ }
+ val64bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dset64);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ dsetdbl[i][j] = 0.0001 * j + i;
+
+ H5Awrite(attr, tid, dsetdbl);
+
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
* Function: main
*
*-------------------------------------------------------------------------
@@ -8178,6 +8595,8 @@ int main(void)
gent_compound_attr_intsizes();
gent_nested_compound_dt();
+ gent_intscalars();
+ gent_attr_intscalars();
return 0;
}
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 2373f6f..c90c364 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -143,6 +143,8 @@ $SRC_H5DUMP_TESTFILES/zerodim.h5
$SRC_H5DUMP_TESTFILES/torderattr.h5
$SRC_H5DUMP_TESTFILES/tordergr.h5
$SRC_H5DUMP_TESTFILES/tsaf.h5
+$SRC_H5DUMP_TESTFILES/tscalarintsize.h5
+$SRC_H5DUMP_TESTFILES/tscalarattrintsize.h5
$SRC_H5DUMP_TESTFILES/tslink.h5
$SRC_H5DUMP_TESTFILES/tsplit_file-m.h5
$SRC_H5DUMP_TESTFILES/tsplit_file-r.h5
@@ -277,6 +279,8 @@ $SRC_H5DUMP_TESTFILES/torderlinks2.ddl
$SRC_H5DUMP_TESTFILES/tperror.ddl
$SRC_H5DUMP_TESTFILES/treference.ddl
$SRC_H5DUMP_TESTFILES/tsaf.ddl
+$SRC_H5DUMP_TESTFILES/tscalarintsize.ddl
+$SRC_H5DUMP_TESTFILES/tscalarattrintsize.ddl
$SRC_H5DUMP_TESTFILES/tscaleoffset.ddl
$SRC_H5DUMP_TESTFILES/tshuffle.ddl
$SRC_H5DUMP_TESTFILES/tslink-1.ddl
@@ -678,10 +682,14 @@ TOOLTEST twidedisplay.ddl --enable-error-stack -w0 packedbits.h5
TOOLTEST packedbits.ddl --enable-error-stack packedbits.h5
# test for compound signed/unsigned datasets
TOOLTEST tcmpdintsize.ddl --enable-error-stack tcmpdintsize.h5
+# test for signed/unsigned scalar datasets
+TOOLTEST tscalarintsize.ddl --enable-error-stack tscalarintsize.h5
# test for signed/unsigned attributes
TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5
# test for compound signed/unsigned attributes
TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5
+# test for signed/unsigned scalar attributes
+TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5
# test for displaying groups
TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5
# test for displaying the selected groups