diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-22 15:36:56 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-22 15:36:56 (GMT) |
commit | bb5ed44dd66cf79f972b18ca2a2ae271d1e00801 (patch) | |
tree | 81bb63079b86a87865abd0abe798e959c072c863 | |
parent | ad9a4a2d97a061c7c165379d54c93940f89bd56a (diff) | |
download | hdf5-bb5ed44dd66cf79f972b18ca2a2ae271d1e00801.zip hdf5-bb5ed44dd66cf79f972b18ca2a2ae271d1e00801.tar.gz hdf5-bb5ed44dd66cf79f972b18ca2a2ae271d1e00801.tar.bz2 |
[svn-r8717] Purpose:
h5dump new features
Description:
the storage layout output format had some changes
same for the user defined filter
add an option (-y) for not printing the array indices (default is print indices )
the option for escaping non printable characters covers all characters (default is not escape)
add tests for the new options
Solution:
Platforms tested:
linux
solaris
AIX
Misc. update:
-rw-r--r-- | MANIFEST | 10 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 83 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 102 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 33 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 38 | ||||
-rw-r--r-- | tools/testfiles/tchunked.ddl | 7 | ||||
-rw-r--r-- | tools/testfiles/tcompact.ddl | 3 | ||||
-rw-r--r-- | tools/testfiles/tcontents.ddl | 12 | ||||
-rw-r--r-- | tools/testfiles/tcontiguos.ddl | 18 | ||||
-rw-r--r-- | tools/testfiles/tdeflate.ddl | 7 | ||||
-rw-r--r-- | tools/testfiles/texternal.ddl | 9 | ||||
-rw-r--r-- | tools/testfiles/tfillearly.ddl | 13 | ||||
-rw-r--r-- | tools/testfiles/tfillifset.ddl | 13 | ||||
-rw-r--r-- | tools/testfiles/tfillnever.ddl | 13 | ||||
-rw-r--r-- | tools/testfiles/tfilters.h5 | bin | 48928 -> 61200 bytes | |||
-rw-r--r-- | tools/testfiles/tfletcher32.ddl | 7 | ||||
-rw-r--r-- | tools/testfiles/tnofilename.ddl | 5 | ||||
-rw-r--r-- | tools/testfiles/treference.ddl | 6 | ||||
-rw-r--r-- | tools/testfiles/tshuffle.ddl | 7 | ||||
-rw-r--r-- | tools/testfiles/tstring.ddl | 12 | ||||
-rw-r--r-- | tools/testfiles/tszip.ddl | 7 | ||||
-rw-r--r-- | tools/testfiles/tuserfilter.ddl | 19 |
23 files changed, 295 insertions, 135 deletions
@@ -1358,6 +1358,16 @@ ./tools/testfiles/tstring.ddl ./tools/testfiles/tuserfilter.ddl ./tools/testfiles/tszip.ddl +./tools/testfiles/tallfilters.ddl +./tools/testfiles/tfillalloc.ddl +./tools/testfiles/tfillincr.ddl +./tools/testfiles/tfilllate.ddl +./tools/testfiles/tstringe.ddl +./tools/testfiles/tindicesyes.ddl +./tools/testfiles/tindicesno.ddl + + + # Expected output from h5ls tests diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 5bc3eeb..f608c45 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -54,7 +54,8 @@ 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 */ + /** ** Added for XML ** @@ -145,7 +146,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 */ }; /** @@ -229,7 +230,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 **/ @@ -331,25 +332,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' }, @@ -560,10 +548,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"); @@ -571,7 +560,7 @@ usage(const char *prog) fprintf(stdout, " -o F, --output=F Output raw data into file F\n"); fprintf(stdout, " -t P, --datatype=P Print the specified named data type\n"); fprintf(stdout, " -w N, --width=N Set the number of columns of output\n"); - fprintf(stdout, " -x, --xml Output in XML using Schema (default)\n"); + fprintf(stdout, " -x, --xml Output in XML using Schema\n"); fprintf(stdout, " -u, --use-dtd Output in XML using DTD\n"); fprintf(stdout, " -D U, --xml-dtd=U Use the DTD or schema at U\n"); fprintf(stdout, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n"); @@ -1850,6 +1839,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; @@ -1921,10 +1911,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 { @@ -2103,6 +2089,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"); /*------------------------------------------------------------------------- @@ -2110,20 +2097,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); @@ -2131,10 +2119,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; @@ -2149,10 +2138,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); @@ -2162,15 +2155,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); @@ -2264,8 +2264,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]); @@ -3012,8 +3024,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 60393da..d5c2728 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -4452,6 +4452,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; @@ -4462,22 +4463,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++; @@ -4664,7 +4663,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); @@ -4674,43 +4673,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 @@ -4773,7 +4825,7 @@ static void gent_filters() assert(ret>=0); /*------------------------------------------------------------------------- - * string + * string with escaped characters *------------------------------------------------------------------------- */ @@ -4781,6 +4833,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); @@ -4791,21 +4844,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 064923f..037bbac 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -211,6 +211,9 @@ 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 @@ -221,22 +224,31 @@ TOOLTEST tcontents.ddl -n tfilters.h5 # compact TOOLTEST tcompact.ddl -H -p -d compact tfilters.h5 # contiguous -TOOLTEST tcontiguos.ddl -H -p -d contiguos tfilters.h5 +TOOLTEST tcontiguos.ddl -H -p -d contiguous tfilters.h5 # chunked TOOLTEST tchunked.ddl -H -p -d chunked tfilters.h5 # external 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 @@ -268,8 +280,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 + diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index ad85e3c..d7f0cdf 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -323,8 +323,9 @@ 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; @@ -483,7 +484,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 3198f65..ecebd79 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -473,33 +473,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, " "); - } + if (!info->do_escape) { + h5tools_str_append(str, "\n"); + h5tools_str_append(str, " "); + } else h5tools_str_append(str, "\\n"); - break; + 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)) @@ -512,6 +529,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch) } } + /*------------------------------------------------------------------------- * Function: h5tools_str_sprint * 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/tcontiguos.ddl b/tools/testfiles/tcontiguos.ddl index 7c26099..be2d2ba 100644 --- a/tools/testfiles/tcontiguos.ddl +++ b/tools/testfiles/tcontiguos.ddl @@ -1,8 +1,20 @@ ############################# -Expected output for 'h5dump -H -p -d contiguos tfilters.h5' +Expected output for 'h5dump -H -p -d contiguous tfilters.h5' ############################# HDF5 "tfilters.h5" { -DATASET "contiguos" { +DATASET "contiguous" { +COMMENT "This is a dataset with contiguous storage" + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 800 + OFFSET 4096 } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME LATE + VALUE -99 + } +} } -h5dump error: unable to open dataset "contiguos" 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/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/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 Binary files differindex f79c2fd..70b9b57 100644 --- a/tools/testfiles/tfilters.h5 +++ b/tools/testfiles/tfilters.h5 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/tnofilename.ddl b/tools/testfiles/tnofilename.ddl index 80a4d15..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 @@ -21,7 +22,7 @@ usage: h5dump [OPTIONS] file -o F, --output=F Output raw data into file F -t P, --datatype=P Print the specified named data type -w N, --width=N Set the number of columns of output - -x, --xml Output in XML using Schema (default) + -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 diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl index a470d73..ef63e3b 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 0:976 /compact , DATATYPE 0:4008 /myvlen , - (2) DATASET 0:976 /compact , DATATYPE 0:4008 /myvlen , - (4) DATASET 0:2376 /contiguous + (0) DATASET 0: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/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 + } + } } |