summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c83
-rw-r--r--tools/h5dump/h5dumpgentest.c103
-rw-r--r--tools/h5dump/testh5dump.sh.in30
-rw-r--r--tools/lib/h5tools.h5
-rw-r--r--tools/lib/h5tools_str.c40
-rw-r--r--tools/testfiles/tallfilters.ddl30
-rw-r--r--tools/testfiles/tchunked.ddl7
-rw-r--r--tools/testfiles/tcompact.ddl3
-rw-r--r--tools/testfiles/tcontents.ddl12
-rw-r--r--tools/testfiles/tdeflate.ddl7
-rw-r--r--tools/testfiles/texternal.ddl9
-rw-r--r--tools/testfiles/tfillalloc.ddl18
-rw-r--r--tools/testfiles/tfillearly.ddl13
-rw-r--r--tools/testfiles/tfillifset.ddl13
-rw-r--r--tools/testfiles/tfillincr.ddl18
-rw-r--r--tools/testfiles/tfilllate.ddl18
-rw-r--r--tools/testfiles/tfillnever.ddl13
-rw-r--r--tools/testfiles/tfilters.h5bin48928 -> 61200 bytes
-rw-r--r--tools/testfiles/tfletcher32.ddl7
-rw-r--r--tools/testfiles/tindicesno.ddl32
-rw-r--r--tools/testfiles/tindicesyes.ddl32
-rw-r--r--tools/testfiles/tnofilename.ddl3
-rw-r--r--tools/testfiles/treference.ddl6
-rw-r--r--tools/testfiles/tshuffle.ddl7
-rw-r--r--tools/testfiles/tstring.ddl12
-rw-r--r--tools/testfiles/tstringe.ddl17
-rw-r--r--tools/testfiles/tszip.ddl7
-rw-r--r--tools/testfiles/tuserfilter.ddl19
28 files changed, 432 insertions, 132 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 9c50fbf..7ae01c4 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -47,13 +47,13 @@ static int display_all = TRUE;
static int display_oid = FALSE;
static int display_data = TRUE;
static int display_attr_data = TRUE;
-static int display_char = FALSE; /*print 1-byte numbers as ASCII? */
+static int display_char = FALSE; /*print 1-byte numbers as ASCII? */
static int usingdasho = FALSE;
static int display_bb = FALSE; /*superblock */
static int display_dcpl = FALSE; /*dcpl */
static int display_fi = FALSE; /*file index */
static int display_ai = TRUE; /*array index */
-static int display_lf = FALSE; /*do CR/LF */
+static int display_escape = FALSE; /*escape non printable characters */
@@ -154,7 +154,7 @@ static h5dump_t dataformat = {
"%s", /*dset_ptformat_pre */
"%s", /*dset_ptformat */
1 , /*array indices */
- 1 /*interpret CR/LF information */
+ 1 /*escape non printable characters */
};
@@ -239,7 +239,7 @@ static h5dump_t xml_dataformat = {
"%s", /*dset_ptformat_pre */
"%s", /*dset_ptformat */
0 , /*array indices */
- 0 /*interpret CR/LF information */
+ 0 /*escape non printable characters */
};
/** XML **/
@@ -341,25 +341,12 @@ 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.
*/
-#if 0
- /* binary: not implemented yet */
-static const char *s_opts = "hbBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A";
-#else
-static const char *s_opts = "hnpeBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A";
-#endif /* 0 */
+static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "hel", no_arg, 'h' },
{ "contents", no_arg, 'n' },
{ "properties", no_arg, 'p' },
-#if 0
- /* binary: not implemented yet */
- { "binary", no_arg, 'b' },
- { "binar", no_arg, 'b' },
- { "bina", no_arg, 'b' },
- { "bin", no_arg, 'b' },
- { "bi", no_arg, 'b' },
-#endif /* 0 */
{ "boot-block", no_arg, 'B' },
{ "boot-bloc", no_arg, 'B' },
{ "boot-blo", no_arg, 'B' },
@@ -593,10 +580,11 @@ usage(const char *prog)
fprintf(stdout, " -A Print the header and value of attributes; data of datasets is not displayed\n");
fprintf(stdout, " -i, --object-ids Print the object ids\n");
fprintf(stdout, " -r, --string Print 1-byte integer datasets as ASCII\n");
- fprintf(stdout, " -e, Interpret carriage return (\\n) as new line\n");
+ fprintf(stdout, " -e, Escape non printing characters\n");
fprintf(stdout, " -V, --version Print version number and exit\n");
fprintf(stdout, " -a P, --attribute=P Print the specified attribute\n");
fprintf(stdout, " -d P, --dataset=P Print the specified dataset\n");
+ fprintf(stdout, " -y Do not print array indices with the data\n");
fprintf(stdout, " -p, --properties Print dataset filters, storage layout and fill value\n");
fprintf(stdout, " -f D, --filedriver=D Specify which driver to open the file with\n");
fprintf(stdout, " -g P, --group=P Print the specified group and all members\n");
@@ -648,6 +636,7 @@ usage(const char *prog)
fprintf(stdout, "\n");
}
+
/*-------------------------------------------------------------------------
* Function: print_datatype
*
@@ -1888,6 +1877,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
int stdindent = COL; /* should be 3 */
outputformat->line_ncols = nCols;
+ outputformat->do_escape=display_escape;
indent += COL;
@@ -1960,10 +1950,6 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
depth=0;
}
- /*interpret CR/LF information */
- outputformat->do_lf=display_lf;
-
-
status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth);
H5Tclose(f_type);
} else {
@@ -2148,6 +2134,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
storage_size=H5Dget_storage_size(obj_id);
ioffset=H5Dget_offset(obj_id);
next=H5Pget_external_count(dcpl_id);
+ strcpy(f_name,"\0");
/*-------------------------------------------------------------------------
@@ -2155,20 +2142,21 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
*-------------------------------------------------------------------------
*/
indentation(indent + COL);
- printf("%s ", STORAGE_LAYOUT);
+ printf("%s %s\n", STORAGE_LAYOUT, BEGIN);
if (H5D_CHUNKED == H5Pget_layout(dcpl_id))
{
- printf("%s %s\n", CHUNKED, BEGIN);
/*start indent */
indent += COL;
indentation(indent + COL);
- HDfprintf(stdout, "SIZE %Hu ", storage_size);
+ printf("%s ", CHUNKED);
rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize);
HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]);
for ( i=1; i<rank; i++)
HDfprintf(stdout, ", %Hu", chsize[i]);
printf(" %s\n", dump_header_format->dataspacedimend);
+ indentation(indent + COL);
+ HDfprintf(stdout, "SIZE %Hu\n ", storage_size);
/*end indent */
indent -= COL;
indentation(indent + COL);
@@ -2176,10 +2164,11 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
}
else if (H5D_COMPACT == H5Pget_layout(dcpl_id))
{
- printf("%s %s\n", COMPACT, BEGIN);
/*start indent */
indent += COL;
indentation(indent + COL);
+ printf("%s\n", COMPACT);
+ indentation(indent + COL);
HDfprintf(stdout, "SIZE %Hu\n", storage_size);
/*end indent */
indent -= COL;
@@ -2194,10 +2183,14 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
*/
if (next)
{
- printf("%s %s %s\n", CONTIGUOUS, EXTERNAL, BEGIN);
- /*start indent */
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("%s\n", CONTIGUOUS);
+ indentation(indent + COL);
+ printf("%s %s\n", EXTERNAL, BEGIN);
+ /*start indent */
indent += COL;
-
for ( i=0; i<next; i++) {
H5Pget_external(dcpl_id,i,sizeof(name),name,&offset,&size);
indentation(indent + COL);
@@ -2207,15 +2200,22 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
indent -= COL;
indentation(indent + COL);
printf("%s\n",END);
+ /*end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
}
else
{
- printf("%s %s\n", CONTIGUOUS, BEGIN);
/*start indent */
indent += COL;
indentation(indent + COL);
- HDfprintf(stdout,"SIZE %Hu OFFSET %Hu\n", storage_size, ioffset);
+ printf("%s\n", CONTIGUOUS);
+ indentation(indent + COL);
+ HDfprintf(stdout,"SIZE %Hu\n", storage_size);
+ indentation(indent + COL);
+ HDfprintf(stdout,"OFFSET %Hu\n", ioffset);
/*end indent */
indent -= COL;
indentation(indent + COL);
@@ -2309,8 +2309,20 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
break;
default:
indentation(indent + COL);
- printf("%s %d %s", UNKNOWN_FILTER, filtn, cd_nelmts? "" : "\n" );
+ if (H5Zfilter_avail(filtn))
+ printf("%s %s\n", "USER_REGISTERED_FILTER", BEGIN);
+ else
+ printf("%s %s\n", "UNKNOWN_FILTER", BEGIN);
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("FILTER_ID %d\n", filtn);
+ if (f_name[0]!='\0') {
+ indentation(indent + COL);
+ printf("COMMENT %s\n", f_name);
+ }
if (cd_nelmts) {
+ indentation(indent + COL);
printf("%s %s ","PARAMS", BEGIN);
for (j=0; j<cd_nelmts; j++) {
printf("%d ", cd_values[j]);
@@ -3062,8 +3074,11 @@ parse_start:
case 'p':
display_dcpl = TRUE;
break;
+ case 'y':
+ display_ai = FALSE;
+ break;
case 'e':
- display_lf = TRUE;
+ display_escape = TRUE;
break;
case 'H':
display_data = FALSE;
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index ffe24b1..9c3d20b 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -4433,6 +4433,7 @@ make_external(hid_t fid)
+
/*-------------------------------------------------------------------------
* Function: gent_filters
*
@@ -4449,6 +4450,7 @@ static void gent_filters()
hid_t sid1; /* dataspace ID */
hid_t tid; /* datatype ID */
hid_t did; /* dataset ID */
+ hid_t gid; /* group ID */
#if defined (H5_HAVE_FILTER_SZIP)
unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block=4;
@@ -4459,22 +4461,20 @@ static void gent_filters()
hsize_t dims2[1]={2};
hvl_t buf2[2];
hsize_t dims3[1]={1};
- char buf3[]={"this is\n a string \twith three\n newline\n escape \tcharacters"};
+ char buf3[]={"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"};
hsize_t dims4[1]={6};
char buf4[6]={"abcdef"};
- hobj_ref_t buf5[5];
- hsize_t dims5[1]={5};
+ hobj_ref_t buf5[1];
+ hsize_t dims5[1]={1};
int i, j, n, ret, val;
int fillval = -99;
-
typedef enum
{
E_RED,
E_GREEN
} e_t;
-
for (i=n=0; i<DIM1; i++){
for (j=0; j<DIM2; j++){
buf1[i][j]=n++;
@@ -4661,7 +4661,7 @@ static void gent_filters()
#endif
assert(ret>=0);
- H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL);
+ ret=H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL);
assert(ret>=0);
ret=make_dset(fid,"myfilter",sid,dcpl,buf1);
@@ -4671,43 +4671,96 @@ static void gent_filters()
ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL);
assert(ret>=0);
+
+
/*-------------------------------------------------------------------------
* make an external dataset
*-------------------------------------------------------------------------
*/
make_external(fid);
- /*-------------------------------------------------------------------------
+/*-------------------------------------------------------------------------
* make datasets with fill value combinations
+ * H5D_FILL_TIME_IFSET
*-------------------------------------------------------------------------
*/
+ ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET);
+ assert(ret>=0);
-
- ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
+ ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
+ assert(ret>=0);
+
+ ret=make_dset(fid,"fill_time_ifset",sid,dcpl,buf1);
assert(ret>=0);
+/*-------------------------------------------------------------------------
+ * H5D_FILL_TIME_ALLOC
+ *-------------------------------------------------------------------------
+ */
ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC);
assert(ret>=0);
ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
assert(ret>=0);
-
- ret=make_dset(fid,"fill_early",sid,dcpl,buf1);
+
+ ret=make_dset(fid,"fill_time_alloc",sid,dcpl,buf1);
assert(ret>=0);
+/*-------------------------------------------------------------------------
+ * H5D_FILL_TIME_NEVER
+ *-------------------------------------------------------------------------
+ */
ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER);
assert(ret>=0);
- ret=make_dset(fid,"fill_never",sid,dcpl,buf1);
+ ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
+ assert(ret>=0);
+
+ ret=make_dset(fid,"fill_time_never",sid,dcpl,buf1);
assert(ret>=0);
+/*-------------------------------------------------------------------------
+ * H5D_ALLOC_TIME_EARLY
+ *-------------------------------------------------------------------------
+ */
+
ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET);
assert(ret>=0);
- ret=make_dset(fid,"fill_ifset",sid,dcpl,buf1);
+ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
assert(ret>=0);
+ ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
+ assert(ret>=0);
+ ret=make_dset(fid,"alloc_time_early",sid,dcpl,buf1);
+ assert(ret>=0);
+
+/*-------------------------------------------------------------------------
+ * H5D_ALLOC_TIME_INCR
+ *-------------------------------------------------------------------------
+ */
+ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR);
+ assert(ret>=0);
+
+ ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
+ assert(ret>=0);
+
+ ret=make_dset(fid,"alloc_time_incr",sid,dcpl,buf1);
+ assert(ret>=0);
+
+/*-------------------------------------------------------------------------
+ * H5D_ALLOC_TIME_LATE
+ *-------------------------------------------------------------------------
+ */
+ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE);
+ assert(ret>=0);
+
+ ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval);
+ assert(ret>=0);
+
+ ret=make_dset(fid,"alloc_time_late",sid,dcpl,buf1);
+ assert(ret>=0);
/*-------------------------------------------------------------------------
* commit a H5G_TYPE type with a comment
@@ -4770,7 +4823,7 @@ static void gent_filters()
assert(ret>=0);
/*-------------------------------------------------------------------------
- * string
+ * string with escaped characters
*-------------------------------------------------------------------------
*/
@@ -4778,6 +4831,7 @@ static void gent_filters()
ret=H5Tset_size(tid, sizeof(buf3));
assert(ret>=0);
write_dset(fid,1,dims3,"string",tid,buf3);
+ assert(ret>=0);
ret=H5Tclose(tid);
assert(ret>=0);
@@ -4788,21 +4842,22 @@ static void gent_filters()
write_dset(fid,1,dims4,"char",H5T_NATIVE_CHAR,buf4);
/*-------------------------------------------------------------------------
- * reference
+ * a group and a link
*-------------------------------------------------------------------------
*/
- ret=H5Rcreate(&buf5[0],fid,"compact",H5R_OBJECT,-1);
- assert(ret>=0);
- ret=H5Rcreate(&buf5[1],fid,"myvlen",H5R_OBJECT,-1);
- assert(ret>=0);
- ret=H5Rcreate(&buf5[2],fid,"compact",H5R_OBJECT,-1);
+ gid = H5Gcreate(fid,"g1",0);
+ H5Glink (gid, H5G_LINK_SOFT, "somevalue", "slink");
+ write_dset(gid,1,dims4,"mydset",H5T_NATIVE_CHAR,buf4);
+ ret = H5Gclose(gid);
assert(ret>=0);
- ret=H5Rcreate(&buf5[3],fid,"myvlen",H5R_OBJECT,-1);
- assert(ret>=0);
- ret=H5Rcreate(&buf5[4],fid,"contiguous",H5R_OBJECT,-1);
+
+/*-------------------------------------------------------------------------
+ * reference
+ *-------------------------------------------------------------------------
+ */
+ ret=H5Rcreate(&buf5[0],fid,"g1/mydset",H5R_OBJECT,-1);
assert(ret>=0);
write_dset(fid,1,dims5,"reference",H5T_STD_REF_OBJ,buf5);
-
/*-------------------------------------------------------------------------
* close
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 19aa89a..cb9d398 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -211,13 +211,15 @@ TOOLTEST tchar1.ddl -r tchar.h5
# Missing file name
TOOLTEST tnofilename.ddl
+
+
+
# test for super block
TOOLTEST tboot.ddl -H -B -d compact tfilters.h5
# test for file contents
TOOLTEST tcontents.ddl -n tfilters.h5
-
# tests for storage layout
# compact
TOOLTEST tcompact.ddl -H -p -d compact tfilters.h5
@@ -229,16 +231,23 @@ TOOLTEST tchunked.ddl -H -p -d chunked tfilters.h5
TOOLTEST texternal.ddl -H -p -d external tfilters.h5
# Fill values
-TOOLTEST tfillearly.ddl -H -p -d fill_early tfilters.h5
-TOOLTEST tfillnever.ddl -H -p -d fill_never tfilters.h5
-TOOLTEST tfillifset.ddl -H -p -d fill_ifset tfilters.h5
+TOOLTEST tfillifset.ddl -H -p -d fill_time_ifset tfilters.h5
+TOOLTEST tfillalloc.ddl -H -p -d fill_time_alloc tfilters.h5
+TOOLTEST tfillnever.ddl -H -p -d fill_time_never tfilters.h5
+TOOLTEST tfillearly.ddl -H -p -d alloc_time_early tfilters.h5
+TOOLTEST tfillincr.ddl -H -p -d alloc_time_incr tfilters.h5
+TOOLTEST tfilllate.ddl -H -p -d alloc_time_late tfilters.h5
# references , print path
TOOLTEST treference.ddl -d reference tfilters.h5
-# string , print new lines
-TOOLTEST tstring.ddl -e -d string tfilters.h5
+# escape/not escape non printable characters
+TOOLTEST tstringe.ddl -e -d string tfilters.h5
+TOOLTEST tstring.ddl -d string tfilters.h5
+# array indices print/not print
+TOOLTEST tindicesyes.ddl -d compact tfilters.h5
+TOOLTEST tindicesno.ddl -y -d compact tfilters.h5
# tests for filters
# SZIP
@@ -269,8 +278,15 @@ if test $USE_FILTER_FLETCHER32 != "yes"; then
else
TOOLTEST tfletcher32.ddl $option
fi
+# all
+option="-H -p -d all tfilters.h5"
+if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SHUFFLE != "yes" ; then
+ SKIP $option
+else
+ TOOLTEST tallfilters.ddl $option
+fi
# user defined
-TOOLTEST tuserfilter.ddl -H -d myfilter tfilters.h5
+TOOLTEST tuserfilter.ddl -H -p -d myfilter tfilters.h5
# test for displaying dataset and attribute of null space
TOOLTEST tnullspace.ddl tnullspace.h5
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index d561a94..7837a5e 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -318,8 +318,8 @@ typedef struct h5dump_t {
/*print array indices in output matrix */
int pindex;
- /*interpret CR/LF information */
- int do_lf;
+ /*escape non printable characters */
+ int do_escape;
} h5dump_t;
@@ -480,7 +480,6 @@ extern FILE *rawdatastream; /*output stream for raw data */
#define SHUFFLE "PREPROCESSING SHUFFLE"
#define FLETCHER32 "CHECKSUM FLETCHER32"
#define SZIP "COMPRESSION SZIP"
-#define UNKNOWN_FILTER "UNKNOWN_FILTER"
#define STORAGE_LAYOUT "STORAGE_LAYOUT"
#define CONTIGUOUS "CONTIGUOUS"
#define COMPACT "COMPACT"
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 9faba55..9214b89 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -475,33 +475,50 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
} else {
switch (ch) {
case '"':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\"");
+ else
h5tools_str_append(str, "\\\"");
break;
case '\\':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\\");
+ else
h5tools_str_append(str, "\\\\");
break;
case '\b':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\b");
+ else
h5tools_str_append(str, "\\b");
break;
case '\f':
- h5tools_str_append(str, "\\f");
+ if (!info->do_escape)
+ h5tools_str_append(str, "\f");
+ else
+ h5tools_str_append(str, "\\f");
break;
case '\n':
- if (info->do_lf) {
- h5tools_str_append(str, "\n");
- h5tools_str_append(str, " ");
- }
- else
- h5tools_str_append(str, "\\n");
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\n");
+ h5tools_str_append(str, " ");
+ }
+ else
+ h5tools_str_append(str, "\\n");
break;
case '\r':
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\r");
+ h5tools_str_append(str, " ");
+ }
+ else
h5tools_str_append(str, "\\r");
break;
case '\t':
- if (info->do_lf)
- h5tools_str_append(str, "\t");
- else
- h5tools_str_append(str, "\\t");
+ if (!info->do_escape)
+ h5tools_str_append(str, "\t");
+ else
+ h5tools_str_append(str, "\\t");
break;
default:
if (isprint(ch))
@@ -514,6 +531,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
}
}
+
/*-------------------------------------------------------------------------
* Function: h5tools_str_sprint
*
diff --git a/tools/testfiles/tallfilters.ddl b/tools/testfiles/tallfilters.ddl
new file mode 100644
index 0000000..3d5833f
--- /dev/null
+++ b/tools/testfiles/tallfilters.ddl
@@ -0,0 +1,30 @@
+#############################
+Expected output for 'h5dump -H -p -d all tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "all" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 458
+ }
+ FILTERS {
+ PREPROCESSING SHUFFLE
+ COMPRESSION SZIP {
+ PIXELS_PER_BLOCK 4
+ MODE HARDWARE
+ CODING ENTROPY
+ BYTE_ORDER LSB
+ HEADER RAW
+ }
+ COMPRESSION DEFLATE { LEVEL 5 }
+ CHECKSUM FLETCHER32
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tchunked.ddl b/tools/testfiles/tchunked.ddl
index 5d4571b..d5b5a33 100644
--- a/tools/testfiles/tchunked.ddl
+++ b/tools/testfiles/tchunked.ddl
@@ -6,9 +6,10 @@ DATASET "chunked" {
COMMENT "This is a dataset with chunked storage"
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 800 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
FILLVALUE {
FILL_TIME IFSET
ALLOC_TIME INCR
diff --git a/tools/testfiles/tcompact.ddl b/tools/testfiles/tcompact.ddl
index ae4f3e7..cbf499f 100644
--- a/tools/testfiles/tcompact.ddl
+++ b/tools/testfiles/tcompact.ddl
@@ -6,7 +6,8 @@ DATASET "compact" {
COMMENT "This is a dataset with compact storage"
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT COMPACT {
+ STORAGE_LAYOUT {
+ COMPACT
SIZE 800
}
FILLVALUE {
diff --git a/tools/testfiles/tcontents.ddl b/tools/testfiles/tcontents.ddl
index 5e5b683..825e29b 100644
--- a/tools/testfiles/tcontents.ddl
+++ b/tools/testfiles/tcontents.ddl
@@ -4,6 +4,9 @@ Expected output for 'h5dump -n tfilters.h5'
HDF5 "tfilters.h5" {
FILE_CONTENTS {
dataset /all
+ dataset /alloc_time_early
+ dataset /alloc_time_incr
+ dataset /alloc_time_late
dataset /bitfield
dataset /char
dataset /chunked
@@ -12,10 +15,13 @@ FILE_CONTENTS {
dataset /deflate
dataset /enum
dataset /external
- dataset /fill_early
- dataset /fill_ifset
- dataset /fill_never
+ dataset /fill_time_alloc
+ dataset /fill_time_ifset
+ dataset /fill_time_never
dataset /fletcher32
+ group /g1
+ dataset /g1/mydset
+ link /g1/slink
dataset /myfilter
datatype /mytype
datatype /myvlen
diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl
index 8cc5b3a..bf36454 100644
--- a/tools/testfiles/tdeflate.ddl
+++ b/tools/testfiles/tdeflate.ddl
@@ -5,9 +5,10 @@ HDF5 "tfilters.h5" {
DATASET "deflate" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 385 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 385
+ }
FILTERS {
COMPRESSION DEFLATE { LEVEL 9 }
}
diff --git a/tools/testfiles/texternal.ddl b/tools/testfiles/texternal.ddl
index 511bd4f..60eb0a8 100644
--- a/tools/testfiles/texternal.ddl
+++ b/tools/testfiles/texternal.ddl
@@ -5,9 +5,12 @@ HDF5 "tfilters.h5" {
DATASET "external" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 100 ) / ( 100 ) }
- STORAGE_LAYOUT CONTIGUOUS EXTERNAL {
- FILENAME ext1.bin SIZE 200 OFFSET 0
- FILENAME ext2.bin SIZE 200 OFFSET 0
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ EXTERNAL {
+ FILENAME ext1.bin SIZE 200 OFFSET 0
+ FILENAME ext2.bin SIZE 200 OFFSET 0
+ }
}
FILLVALUE {
FILL_TIME IFSET
diff --git a/tools/testfiles/tfillalloc.ddl b/tools/testfiles/tfillalloc.ddl
new file mode 100644
index 0000000..82fe21a
--- /dev/null
+++ b/tools/testfiles/tfillalloc.ddl
@@ -0,0 +1,18 @@
+#############################
+Expected output for 'h5dump -H -p -d fill_time_alloc tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "fill_time_alloc" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
+ FILLVALUE {
+ FILL_TIME ALLOC
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tfillearly.ddl b/tools/testfiles/tfillearly.ddl
index b48d64f..3f9217e 100644
--- a/tools/testfiles/tfillearly.ddl
+++ b/tools/testfiles/tfillearly.ddl
@@ -1,15 +1,16 @@
#############################
-Expected output for 'h5dump -H -p -d fill_early tfilters.h5'
+Expected output for 'h5dump -H -p -d alloc_time_early tfilters.h5'
#############################
HDF5 "tfilters.h5" {
-DATASET "fill_early" {
+DATASET "alloc_time_early" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 800 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
FILLVALUE {
- FILL_TIME ALLOC
+ FILL_TIME IFSET
ALLOC_TIME EARLY
VALUE -99
}
diff --git a/tools/testfiles/tfillifset.ddl b/tools/testfiles/tfillifset.ddl
index b67f5c7..1cb9527 100644
--- a/tools/testfiles/tfillifset.ddl
+++ b/tools/testfiles/tfillifset.ddl
@@ -1,16 +1,17 @@
#############################
-Expected output for 'h5dump -H -p -d fill_ifset tfilters.h5'
+Expected output for 'h5dump -H -p -d fill_time_ifset tfilters.h5'
#############################
HDF5 "tfilters.h5" {
-DATASET "fill_ifset" {
+DATASET "fill_time_ifset" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 800 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
FILLVALUE {
FILL_TIME IFSET
- ALLOC_TIME EARLY
+ ALLOC_TIME INCR
VALUE -99
}
}
diff --git a/tools/testfiles/tfillincr.ddl b/tools/testfiles/tfillincr.ddl
new file mode 100644
index 0000000..f8df5a9
--- /dev/null
+++ b/tools/testfiles/tfillincr.ddl
@@ -0,0 +1,18 @@
+#############################
+Expected output for 'h5dump -H -p -d alloc_time_incr tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "alloc_time_incr" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tfilllate.ddl b/tools/testfiles/tfilllate.ddl
new file mode 100644
index 0000000..6f8eafc
--- /dev/null
+++ b/tools/testfiles/tfilllate.ddl
@@ -0,0 +1,18 @@
+#############################
+Expected output for 'h5dump -H -p -d alloc_time_late tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "alloc_time_late" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME LATE
+ VALUE -99
+ }
+}
+}
diff --git a/tools/testfiles/tfillnever.ddl b/tools/testfiles/tfillnever.ddl
index 92f19bc..9b1f4b9 100644
--- a/tools/testfiles/tfillnever.ddl
+++ b/tools/testfiles/tfillnever.ddl
@@ -1,16 +1,17 @@
#############################
-Expected output for 'h5dump -H -p -d fill_never tfilters.h5'
+Expected output for 'h5dump -H -p -d fill_time_never tfilters.h5'
#############################
HDF5 "tfilters.h5" {
-DATASET "fill_never" {
+DATASET "fill_time_never" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 800 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
FILLVALUE {
FILL_TIME NEVER
- ALLOC_TIME EARLY
+ ALLOC_TIME INCR
VALUE -99
}
}
diff --git a/tools/testfiles/tfilters.h5 b/tools/testfiles/tfilters.h5
index 7f19ad4..39eac41 100644
--- a/tools/testfiles/tfilters.h5
+++ b/tools/testfiles/tfilters.h5
Binary files differ
diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl
index 4e44439..b269eed 100644
--- a/tools/testfiles/tfletcher32.ddl
+++ b/tools/testfiles/tfletcher32.ddl
@@ -5,9 +5,10 @@ HDF5 "tfilters.h5" {
DATASET "fletcher32" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 816 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 816
+ }
FILTERS {
CHECKSUM FLETCHER32
}
diff --git a/tools/testfiles/tindicesno.ddl b/tools/testfiles/tindicesno.ddl
new file mode 100644
index 0000000..4b8ff7d
--- /dev/null
+++ b/tools/testfiles/tindicesno.ddl
@@ -0,0 +1,32 @@
+#############################
+Expected output for 'h5dump -y -d compact tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "compact" {
+COMMENT "This is a dataset with compact storage"
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ DATA {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
+ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
+ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199
+ }
+}
+}
diff --git a/tools/testfiles/tindicesyes.ddl b/tools/testfiles/tindicesyes.ddl
new file mode 100644
index 0000000..41d1c88
--- /dev/null
+++ b/tools/testfiles/tindicesyes.ddl
@@ -0,0 +1,32 @@
+#############################
+Expected output for 'h5dump -d compact tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "compact" {
+COMMENT "This is a dataset with compact storage"
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
+ DATA {
+ (0,0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ (1,0) 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ (2,0) 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ (3,0) 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ (4,0) 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ (5,0) 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ (6,0) 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ (7,0) 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ (8,0) 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+ (9,0) 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ (10,0) 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ (11,0) 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ (12,0) 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+ (13,0) 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
+ (14,0) 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ (15,0) 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+ (16,0) 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
+ (17,0) 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ (18,0) 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
+ (19,0) 190, 191, 192, 193, 194, 195, 196, 197, 198, 199
+ }
+}
+}
diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl
index 56dd4b9..36cbcad 100644
--- a/tools/testfiles/tnofilename.ddl
+++ b/tools/testfiles/tnofilename.ddl
@@ -10,10 +10,11 @@ usage: h5dump [OPTIONS] file
-A Print the header and value of attributes; data of datasets is not displayed
-i, --object-ids Print the object ids
-r, --string Print 1-byte integer datasets as ASCII
- -e, Interpret carriage return (\n) as new line
+ -e, 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 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
diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl
index 951f213..2ebfeef 100644
--- a/tools/testfiles/treference.ddl
+++ b/tools/testfiles/treference.ddl
@@ -4,11 +4,9 @@ Expected output for 'h5dump -d reference tfilters.h5'
HDF5 "tfilters.h5" {
DATASET "reference" {
DATATYPE H5T_REFERENCE
- DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
DATA {
- (0) DATASET 976 /compact , DATATYPE 4008 /myvlen ,
- (2) DATASET 976 /compact , DATATYPE 4008 /myvlen ,
- (4) DATASET 2376 /contiguous
+ (0) DATASET 60656 /g1/mydset
}
}
}
diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl
index c68668c..d3995dc 100644
--- a/tools/testfiles/tshuffle.ddl
+++ b/tools/testfiles/tshuffle.ddl
@@ -5,9 +5,10 @@ HDF5 "tfilters.h5" {
DATASET "shuffle" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 800 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
FILTERS {
PREPROCESSING SHUFFLE
}
diff --git a/tools/testfiles/tstring.ddl b/tools/testfiles/tstring.ddl
index 241f04e..2a60e1d 100644
--- a/tools/testfiles/tstring.ddl
+++ b/tools/testfiles/tstring.ddl
@@ -1,20 +1,20 @@
#############################
-Expected output for 'h5dump -e -d string tfilters.h5'
+Expected output for 'h5dump -d string tfilters.h5'
#############################
HDF5 "tfilters.h5" {
DATASET "string" {
DATATYPE H5T_STRING {
- STRSIZE 59;
+ STRSIZE 73;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
DATA {
- (0) "this is
- a string with three
- newline
- escape characters"
+ (0) "quote " backspace form feed new line
+ tab new line
+ carriage return
+ "
}
}
}
diff --git a/tools/testfiles/tstringe.ddl b/tools/testfiles/tstringe.ddl
new file mode 100644
index 0000000..4e97359
--- /dev/null
+++ b/tools/testfiles/tstringe.ddl
@@ -0,0 +1,17 @@
+#############################
+Expected output for 'h5dump -e -d string tfilters.h5'
+#############################
+HDF5 "tfilters.h5" {
+DATASET "string" {
+ DATATYPE H5T_STRING {
+ STRSIZE 73;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ (0) "quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"
+ }
+}
+}
diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl
index 99ed2c9..d7812c3 100644
--- a/tools/testfiles/tszip.ddl
+++ b/tools/testfiles/tszip.ddl
@@ -5,9 +5,10 @@ HDF5 "tfilters.h5" {
DATASET "szip" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
- STORAGE_LAYOUT CHUNKED {
- SIZE 372 ( 10, 5 )
- }
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 372
+ }
FILTERS {
COMPRESSION SZIP {
PIXELS_PER_BLOCK 4
diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl
index c262fb6..5ec981a 100644
--- a/tools/testfiles/tuserfilter.ddl
+++ b/tools/testfiles/tuserfilter.ddl
@@ -1,9 +1,24 @@
#############################
-Expected output for 'h5dump -H -d myfilter tfilters.h5'
+Expected output for 'h5dump -H -p -d myfilter tfilters.h5'
#############################
HDF5 "tfilters.h5" {
DATASET "myfilter" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
-}
+ STORAGE_LAYOUT {
+ CHUNKED ( 10, 5 )
+ SIZE 800
+ }
+ FILTERS {
+ UNKNOWN_FILTER {
+ FILTER_ID 405
+ COMMENT myfilter
+ PARAMS { 5 6 }
+ }
+ FILLVALUE {
+ FILL_TIME IFSET
+ ALLOC_TIME INCR
+ VALUE -99
+ }
+ }
}