summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2010-05-07 20:56:54 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2010-05-07 20:56:54 (GMT)
commit7c16aec7e1e7ba08b8845cf148fdc7935e84a211 (patch)
treed9583f35d601ce5dc9736f8b90424930a65dd57a /tools
parentae6f5891b5794325ee5702fec0da55bafdce1afe (diff)
downloadhdf5-7c16aec7e1e7ba08b8845cf148fdc7935e84a211.zip
hdf5-7c16aec7e1e7ba08b8845cf148fdc7935e84a211.tar.gz
hdf5-7c16aec7e1e7ba08b8845cf148fdc7935e84a211.tar.bz2
[svn-r18743] enhancement 1853:
Install packed-bits feature for h5dump. Allen has installed the feature in the NPOESS feature branch. I ported it back to the v1.8 branch for v1.8.5 release. tools/h5dump/testh5dump.sh.in: Added tests for the packed-bits feature. tools/h5dump/h5dump.c tools/h5dump/h5dump.h Added code to parse and handled the packed-bits request. tools/lib/h5tools.h tools/lib/h5tools_str.c tools/lib/h5tools.c Added code to print packed-bits. tools/testfiles/tpackedbits2.ddl tools/testfiles/tnofilename-with-packed-bits.ddl tools/testfiles/tpackedbits.ddl Expected output files for packed-bits feature. Tested: h5committested the NPOESS branch. Tested in the linux VM machine in my Dove.
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c165
-rw-r--r--tools/h5dump/h5dump.h5
-rw-r--r--tools/h5dump/testh5dump.sh.in19
-rw-r--r--tools/lib/h5tools.c5
-rw-r--r--tools/lib/h5tools.h5
-rw-r--r--tools/lib/h5tools_str.c40
-rw-r--r--tools/testfiles/tnofilename-with-packed-bits.ddl89
-rw-r--r--tools/testfiles/tpackedbits.ddl22
-rw-r--r--tools/testfiles/tpackedbits2.ddl35
9 files changed, 381 insertions, 4 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 0b47cf7..66bef67 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -94,11 +94,24 @@ static int display_fi = FALSE; /*file index */
static int display_ai = TRUE; /*array index */
static int display_escape = FALSE; /*escape non printable characters */
static int display_region = FALSE; /*print region reference data */
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+static int display_packed_bits = FALSE; /*print 1-byte numbers as packed bits*/
+#endif
/* sort parameters */
static H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */
static H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | descending] */
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+/* mask list for packed bits */
+static unsigned int packed_mask[8]; /* packed bits are restricted to 1 byte */
+
+/* packed bits display parameters */
+static int packed_offset[8];
+static int packed_length[8];
+#define PACKED_BITS_LOOP_MAX 8
+#endif
+
/**
** Added for XML **
**/
@@ -118,6 +131,9 @@ static int indent; /*how far in to indent the line
/* internal functions */
static hid_t h5_fileaccess(void);
static void dump_oid(hid_t oid);
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+static void dump_packed_bits(unsigned int packed_index);
+#endif
static void print_enum(hid_t type);
static int xml_name_to_XID(const char *, char *, int , int );
static void init_prefix(char **prfx, size_t prfx_len);
@@ -388,7 +404,11 @@ struct handler_t {
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:RM:";
+#else
static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:R";
+#endif
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "hel", no_arg, 'h' },
@@ -501,6 +521,9 @@ static struct long_options l_opts[] = {
{ "sort_order", require_arg, 'z' },
{ "format", require_arg, 'm' },
{ "region", no_arg, 'R' },
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ { "packed-bits", require_arg, 'M' },
+#endif
{ NULL, 0, '\0' }
};
@@ -656,6 +679,10 @@ usage(const char *prog)
fprintf(stdout, " -m T, --format=T Set the floating point output format\n");
fprintf(stdout, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
fprintf(stdout, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ fprintf(stdout, " -M M, --packedbits=M Print packed bits using mask format M for dataset P given\n");
+ fprintf(stdout, " in option d. Where M is (offset,length)[,(offset,length)].\n");
+#endif
fprintf(stdout, " -R, --region Print dataset pointed by region references\n");
fprintf(stdout, " -x, --xml Output in XML using Schema\n");
fprintf(stdout, " -u, --use-dtd Output in XML using DTD\n");
@@ -695,6 +722,10 @@ usage(const char *prog)
fprintf(stdout, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
fprintf(stdout, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
fprintf(stdout, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ fprintf(stdout, " M - is a paired list of integers the first number of which is the offset and the\n");
+ fprintf(stdout, " second number is the length of the its being queried\n");
+#endif
fprintf(stdout, "\n");
fprintf(stdout, " Examples:\n");
fprintf(stdout, "\n");
@@ -2214,6 +2245,10 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
hid_t type, space;
unsigned attr_crt_order_flags;
hid_t dcpl_id; /* dataset creation property list ID */
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ int data_loop = 1;
+ int i;
+#endif
if ((dcpl_id = H5Dget_create_plist(did)) < 0)
@@ -2246,7 +2281,18 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
if(display_dcpl)
dump_dcpl(dcpl_id, type, did);
- if(display_data)
+ if(display_data) {
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(display_packed_bits)
+ data_loop = packed_output;
+ for(i=0;i<data_loop;i++) {
+ if(display_packed_bits) {
+ dump_packed_bits(i);
+ packed_counter = packed_mask[i];
+ packed_normalize = packed_offset[i];
+ }
+#endif
+
switch(H5Tget_class(type)) {
case H5T_TIME:
indentation(indent + COL);
@@ -2269,6 +2315,10 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
default:
break;
} /* end switch */
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ }
+#endif
+ }
indent += COL;
@@ -2634,6 +2684,24 @@ dump_oid(hid_t oid)
printf("%s %s %d %s\n", OBJID, BEGIN, oid, END);
}
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+/*-------------------------------------------------------------------------
+ * Function: dump_packed_bits
+ *
+ * Purpose: Prints the packed bits offset and length
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+dump_packed_bits(unsigned int packed_index)
+{
+ indentation(indent + COL);
+ printf("%s %s=%d %s=%d\n", PACKED_BITS, PACKED_OFFSET, packed_offset[packed_index], PACKED_LENGTH, packed_length[packed_index]);
+}
+#endif
+
/*-------------------------------------------------------------------------
* Function: dump_comment
*
@@ -3518,6 +3586,88 @@ parse_subset_params(char *dset)
return s;
}
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+/*-------------------------------------------------------------------------
+ * Function: parse_mask_list
+ *
+ * Purpose: Parse a list of comma or space separated integers and fill
+ * the packed_bits list and counter. The string being passed into this function
+ * should be at the start of the list you want to parse.
+ *
+ * Return: None
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+parse_mask_list(const char *h_list)
+{
+ const char *ptr;
+ unsigned int size_count = 0, i = 0, last_digit = 0;
+ int offset_value = 0, length_value = 0;
+
+ packed_counter = 0;
+ memset(packed_mask,0,8);
+ memset(packed_offset,0,8);
+ memset(packed_length,0,8);
+
+ if (!h_list || !*h_list || *h_list == ';')
+ return;
+
+ /* count how many integers do we have */
+ for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) {
+ if (isdigit(*ptr)) {
+ if (!last_digit)
+ /* the last read character wasn't a digit */
+ size_count++;
+
+ last_digit = 1;
+ }
+ else {
+ last_digit = 0;
+ }
+ }
+
+ if (size_count == 0)
+ /* there aren't any integers to read */
+ return;
+
+ offset_value = -1;
+ length_value = -1;
+ packed_output = 0;
+ for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) {
+ if(isdigit(*ptr)) {
+ i++;
+ /* we should have an integer now */
+ if(offset_value==-1)
+ offset_value = atoi(ptr);
+ else
+ length_value = atoi(ptr);
+
+ while (isdigit(*ptr))
+ /* scroll to end of integer */
+ ptr++;
+ }
+ if(length_value>=0) {
+ packed_offset[packed_output] = offset_value;
+ packed_length[packed_output] = length_value;
+
+ packed_mask[packed_output] = 1 << offset_value;
+ while(length_value>1) {
+ packed_mask[packed_output] = packed_mask[packed_output] << 1;
+ packed_mask[packed_output] |= 1 << offset_value;
+ length_value--;
+ }
+ packed_output++;
+ offset_value = -1;
+ length_value = -1;
+ }
+ }
+ if(packed_output > PACKED_BITS_LOOP_MAX)
+ packed_output = PACKED_BITS_LOOP_MAX;
+ packed_counter = packed_mask[0];
+}
+#endif
+
/*-------------------------------------------------------------------------
* Function: handle_datasets
*
@@ -4098,6 +4248,19 @@ parse_start:
}
break;
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ case 'M':
+ if (!last_was_dset) {
+ error_msg(progname,
+ "option `-%c' can only be used after --dataset option\n",
+ opt);
+ leave(EXIT_FAILURE);
+ }
+ parse_mask_list(opt_arg);
+ display_packed_bits = TRUE;
+ break;
+#endif
+
/** begin XML parameters **/
case 'x':
/* select XML output */
diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index e16705c..3e34538 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -69,6 +69,11 @@
#define EXTERNAL_FILE "EXTERNAL_FILE"
#define FILLVALUE "FILLVALUE"
#define FILE_CONTENTS "FILE_CONTENTS"
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+#define PACKED_BITS "PACKED_BITS"
+#define PACKED_OFFSET "OFFSET"
+#define PACKED_LENGTH "LENGTH"
+#endif
#define BEGIN "{"
#define END "}"
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index a147b45..7776b62 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -23,6 +23,9 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@"
USE_FILTER_NBIT="@USE_FILTER_NBIT@"
USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@"
+# Determine if H5dump packed bits feature is included
+Have_Packed_Bits="@PACKED_BITS@"
+
TESTNAME=h5dump
EXIT_SUCCESS=0
EXIT_FAILURE=1
@@ -329,7 +332,11 @@ TOOLTEST tchar1.ddl -r tchar.h5
# test failure handling
# Missing file name
-TOOLTEST tnofilename.ddl
+if test "$Have_Packed_Bits" = "yes"; then
+ TOOLTEST tnofilename-with-packed-bits.ddl
+else
+ TOOLTEST tnofilename.ddl
+fi
# rev. 2004
@@ -512,6 +519,16 @@ TOOLTEST textlinksrc.ddl textlinksrc.h5
TOOLTEST textlinkfar.ddl textlinkfar.h5
+# test for dataset packed bits
+if test "$Have_Packed_Bits" = "yes"; then
+ TOOLTEST tpackedbits.ddl -d /dset1 -M 0,2 tdset.h5
+ TOOLTEST tpackedbits2.ddl -d /dset1 -M 0,2,2,1 tdset.h5
+else
+ SKIP tpackedbits.ddl -d /dset1 -M 0,2 tdset.h5
+ SKIP tpackedbits2.ddl -d /dset1 -M 0,2,2,1 tdset.h5
+fi
+
+
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
exit $EXIT_SUCCESS
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index e80c505..654cca9 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -42,6 +42,11 @@ FILE *rawdatastream; /* should initialize to stdout but gcc moans about it
int bin_output; /* binary output */
int bin_form; /* binary form */
int region_output; /* region output */
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+int packed_output; /* number of packed bits to display */
+int packed_normalize; /* number of bits to shift right to display normalized */
+unsigned int packed_counter; /* counter for which packed bits to display */
+#endif
static h5tool_format_t h5tools_dataformat = {
0, /*raw */
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 7d207ba..8c9769e 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -525,6 +525,11 @@ extern FILE *rawdatastream; /* output stream for raw data */
extern int bin_output; /* binary output */
extern int bin_form; /* binary form */
extern int region_output; /* region output */
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+extern int packed_output; /* packed bits output count */
+extern int packed_normalize; /* number of bits to shift right to display normalized */
+extern unsigned int packed_counter; /* counter for which packed bits to display */
+#endif
/* Strings for output */
#define H5_TOOLS_GROUP "GROUP"
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 55596cd..c7fb8a9 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -783,36 +783,72 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
else if (H5Tequal(type, H5T_NATIVE_INT)) {
HDmemcpy(&tempint, vp, sizeof(int));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempint = (tempint & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
}
else if (H5Tequal(type, H5T_NATIVE_UINT)) {
HDmemcpy(&tempuint, vp, sizeof(unsigned int));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempuint = (tempuint & packed_counter)>>packed_normalize;
+#endif
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);
+ char tempchar;
+ HDmemcpy(&tempchar, cp_vp, sizeof(char));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempchar = (tempchar & packed_counter)>>packed_normalize;
+#endif
+ h5tools_str_append(str, OPT(info->fmt_schar, "%d"), tempchar);
}
else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
- h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp);
+ unsigned char tempuchar;
+ HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempuchar = (tempuchar & packed_counter)>>packed_normalize;
+#endif
+ h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar);
}
else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
short tempshort;
HDmemcpy(&tempshort, vp, sizeof(short));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempshort = (tempshort & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
}
else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
unsigned short tempushort;
HDmemcpy(&tempushort, vp, sizeof(unsigned short));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempushort = (tempushort & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
}
else if (H5Tequal(type, H5T_NATIVE_LONG)) {
HDmemcpy(&templong, vp, sizeof(long));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ templong = (templong & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
}
else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
HDmemcpy(&tempulong, vp, sizeof(unsigned long));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempulong = (tempulong & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
}
else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl
new file mode 100644
index 0000000..b33eaf8
--- /dev/null
+++ b/tools/testfiles/tnofilename-with-packed-bits.ddl
@@ -0,0 +1,89 @@
+#############################
+Expected output for 'h5dump '
+#############################
+usage: h5dump [OPTIONS] file
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -n, --contents Print a list of the file contents and exit
+ -B, --superblock Print the content of the super block
+ -H, --header Print the header only; no data is displayed
+ -A, --onlyattr Print the header and value of attributes
+ -i, --object-ids Print the object ids
+ -r, --string Print 1-byte integer datasets as ASCII
+ -e, --escape Escape non printing characters
+ -V, --version Print version number and exit
+ -a P, --attribute=P Print the specified attribute
+ -d P, --dataset=P Print the specified dataset
+ -y, --noindex Do not print array indices with the data
+ -p, --properties Print dataset filters, storage layout and fill value
+ -f D, --filedriver=D Specify which driver to open the file with
+ -g P, --group=P Print the specified group and all members
+ -l P, --soft-link=P Print the value(s) of the specified soft link
+ -o F, --output=F Output raw data into file F
+ -b B, --binary=B Binary file output, of form B
+ -t P, --datatype=P Print the specified named datatype
+ -w N, --width=N Set the number of columns of output. A value of 0 (zero)
+ sets the number of columns to the maximum (65535).
+ Default width is 80 columns.
+ -m T, --format=T Set the floating point output format
+ -q Q, --sort_by=Q Sort groups and attributes by index Q
+ -z Z, --sort_order=Z Sort groups and attributes by order Z
+ -M M, --packedbits=M Print packed bits using mask format M for dataset P given
+ in option d. Where M is (offset,length)[,(offset,length)].
+ -R, --region Print dataset pointed by region references
+ -x, --xml Output in XML using Schema
+ -u, --use-dtd Output in XML using DTD
+ -D U, --xml-dtd=U Use the DTD or schema at U
+ -X S, --xml-ns=S (XML Schema) Use qualified names n the XML
+ ":": no namespace, default: "hdf5:"
+ E.g., to dump a file called `-f', use h5dump -- -f
+
+ Subsetting is available by using the following options with a dataset
+ attribute. Subsetting is done by selecting a hyperslab from the data.
+ Thus, the options mirror those for performing a hyperslab selection.
+ One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+
+ -s START, --start=START Offset of start of subsetting selection
+ -S STRIDE, --stride=STRIDE Hyperslab stride
+ -c COUNT, --count=COUNT Number of blocks to include in selection
+ -k BLOCK, --block=BLOCK Size of block in hyperslab
+ START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the
+ number of dimensions in the dataspace being queried
+
+ D - is the file driver to use in opening the file. Acceptable values
+ are "sec2", "family", "split", "multi", "direct", and "stream". Without
+ the file driver flag, the file will be opened with each driver in
+ turn and in the order specified above until one driver succeeds
+ in opening the file.
+ F - is a filename.
+ P - is the full path from the root group to the object.
+ N - is an integer greater than 1.
+ T - is a string containing the floating point format, e.g '%.3f'
+ U - is a URI reference (as defined in [IETF RFC 2396],
+ updated by [IETF RFC 2732])
+ B - is the form of binary output: NATIVE for a memory type, FILE for the
+ file type, LE or BE for pre-existing little or big endian types.
+ Must be used with -o (output file) and it is recommended that
+ -d (dataset) is used. B is an optional argument, defaults to NATIVE
+ Q - is the sort index type. It can be "creation_order" or "name" (default)
+ Z - is the sort order type. It can be "descending" or "ascending" (default)
+ M - is a paired list of integers the first number of which is the offset and the
+ second number is the length of the its being queried
+
+ Examples:
+
+ 1) Attribute foo of the group /bar_none in file quux.h5
+
+ h5dump -a /bar_none/foo quux.h5
+
+ 2) Selecting a subset from dataset /foo in file quux.h5
+
+ h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5
+
+ 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'
+ using a little-endian type
+
+ h5dump -d /dset -b LE -o out.bin quux.h5
+
diff --git a/tools/testfiles/tpackedbits.ddl b/tools/testfiles/tpackedbits.ddl
new file mode 100644
index 0000000..2f1e9a1
--- /dev/null
+++ b/tools/testfiles/tpackedbits.ddl
@@ -0,0 +1,22 @@
+#############################
+Expected output for 'h5dump -d /dset1 -M 0,2 tdset.h5'
+#############################
+HDF5 "tdset.h5" {
+DATASET "/dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 10, 20 ) / ( 10, 20 ) }
+ PACKED_BITS OFFSET=0 LENGTH=2
+ DATA {
+ (0,0): 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,
+ (1,0): 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0,
+ (2,0): 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1,
+ (3,0): 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2,
+ (4,0): 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,
+ (5,0): 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0,
+ (6,0): 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1,
+ (7,0): 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2,
+ (8,0): 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,
+ (9,0): 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0
+ }
+}
+}
diff --git a/tools/testfiles/tpackedbits2.ddl b/tools/testfiles/tpackedbits2.ddl
new file mode 100644
index 0000000..4f11bbe
--- /dev/null
+++ b/tools/testfiles/tpackedbits2.ddl
@@ -0,0 +1,35 @@
+#############################
+Expected output for 'h5dump -d /dset1 -M 0,2,2,1 tdset.h5'
+#############################
+HDF5 "tdset.h5" {
+DATASET "/dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 10, 20 ) / ( 10, 20 ) }
+ PACKED_BITS OFFSET=0 LENGTH=2
+ DATA {
+ (0,0): 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,
+ (1,0): 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0,
+ (2,0): 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1,
+ (3,0): 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2,
+ (4,0): 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,
+ (5,0): 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0,
+ (6,0): 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1,
+ (7,0): 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2,
+ (8,0): 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,
+ (9,0): 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0
+ }
+ PACKED_BITS OFFSET=2 LENGTH=1
+ DATA {
+ (0,0): 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
+ (1,0): 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1,
+ (2,0): 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1,
+ (3,0): 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,
+ (4,0): 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
+ (5,0): 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
+ (6,0): 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
+ (7,0): 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
+ (8,0): 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
+ (9,0): 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1
+ }
+}
+}