diff options
-rw-r--r-- | MANIFEST | 17 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 78 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 411 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 66 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 14 | ||||
-rw-r--r-- | tools/lib/Makefile.in | 2 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 3 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.c | 306 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.h | 49 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 21 | ||||
-rw-r--r-- | tools/testfiles/tchunked.ddl | 8 | ||||
-rw-r--r-- | tools/testfiles/tcompact.ddl | 18 | ||||
-rw-r--r-- | tools/testfiles/tcontiguos.ddl | 8 | ||||
-rw-r--r-- | tools/testfiles/tdeflate.ddl | 20 | ||||
-rw-r--r-- | tools/testfiles/texternal.ddl | 18 | ||||
-rw-r--r-- | tools/testfiles/tfillearly.ddl | 8 | ||||
-rw-r--r-- | tools/testfiles/tfillifset.ddl | 8 | ||||
-rw-r--r-- | tools/testfiles/tfillnever.ddl | 8 | ||||
-rw-r--r-- | tools/testfiles/tfletcher32.ddl | 20 | ||||
-rw-r--r-- | tools/testfiles/tnofilename.ddl | 1 | ||||
-rw-r--r-- | tools/testfiles/treference.ddl | 12 | ||||
-rw-r--r-- | tools/testfiles/tshuffle.ddl | 20 | ||||
-rw-r--r-- | tools/testfiles/tstring.ddl | 18 | ||||
-rw-r--r-- | tools/testfiles/tszip.ddl | 8 | ||||
-rw-r--r-- | tools/testfiles/tuserfilter.ddl | 9 |
25 files changed, 1108 insertions, 43 deletions
@@ -1171,6 +1171,8 @@ ./tools/lib/h5tools_str.h ./tools/lib/h5tools_utils.c ./tools/lib/h5tools_utils.h +./tools/lib/h5tools_ref.c +./tools/lib/h5tools_ref.h ./tools/lib/talign.c ./tools/lib/h5diff.c ./tools/lib/h5diff_array.c @@ -1314,6 +1316,21 @@ ./tools/testfiles/tboot.ddl ./tools/testfiles/tcontents.ddl ./tools/testfiles/tfilters.h5 +./tools/testfiles/tchunked.ddl +./tools/testfiles/tcompact.ddl +./tools/testfiles/tcontiguos.ddl +./tools/testfiles/tdeflate.ddl +./tools/testfiles/texternal.ddl +./tools/testfiles/tfillearly.ddl +./tools/testfiles/tfillifset.ddl +./tools/testfiles/tfillnever.ddl +./tools/testfiles/tfletcher32.ddl +./tools/testfiles/treference.ddl +./tools/testfiles/tshuffle.ddl +./tools/testfiles/tstring.ddl +./tools/testfiles/tszip.ddl +./tools/testfiles/tuserfilter.ddl + # Expected output from h5ls tests diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 550527b..b276e25 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -18,11 +18,12 @@ #include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" +#include "h5tools_ref.h" #include "h5trav.h" /* module-scoped variables */ -static const char *progname = "h5dump"; +const char *progname = "h5dump"; /* 3 private values: can't be set, but can be read. Note: these are defined in H5Zprivate, they are @@ -32,11 +33,11 @@ static const char *progname = "h5dump"; #define H5_SZIP_MSB_OPTION_MASK 16 #define H5_SZIP_RAW_OPTION_MASK 128 -static int d_status = EXIT_SUCCESS; +int d_status = EXIT_SUCCESS; static int unamedtype = 0; /* shared data type with no name */ static size_t prefix_len = 1024; static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; -static char *prefix; +char *prefix; static const char *driver = NULL; /* The driver to open the file with. */ static const dump_header *dump_header_format; @@ -52,15 +53,14 @@ 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 */ + /** ** Added for XML ** **/ -/* fill_ref_path_table is called to inialize the object reference paths. */ -static herr_t fill_ref_path_table(hid_t, const char *, void *); - /* module-scoped variables for XML option */ #define DEFAULT_XSD "http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.xsd" #define DEFAULT_DTD "http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.dtd" @@ -69,13 +69,8 @@ static int doxml = 0; static int useschema = 1; static const char *xml_dtd_uri = NULL; static const char *xmlnsprefix="hdf5:"; -static hid_t thefile = -1; -typedef struct ref_path_table_entry { - hid_t obj; - char *apath; - H5G_stat_t statbuf; - struct ref_path_table_entry *next; -} ref_path_table_entry_t; +hid_t thefile = -1; + /** end XML **/ /* internal functions */ @@ -83,14 +78,12 @@ static hid_t h5_fileaccess(void); static void dump_oid(hid_t oid); static void print_enum(hid_t type); static herr_t dump_all(hid_t group, const char *name, void *op_data); -static char *lookup_ref_path(hobj_ref_t ); #ifdef LATER static void check_compression(hid_t); #endif /* LATER */ -static ref_path_table_entry_t *ref_path_table_lookup(const char *); static int xml_name_to_XID(const char *, char *, int , int ); -static int get_next_xid(void); -static haddr_t get_fake_xid (void); + + /* external functions */ extern int print_data(hid_t, hid_t, int); @@ -160,7 +153,8 @@ static h5dump_t dataformat = { "%s", /*dset_blockformat_pre */ "%s", /*dset_ptformat_pre */ "%s", /*dset_ptformat */ - 1 /*array indices */ + 1 , /*array indices */ + 1 /*interpret CR/LF information */ }; @@ -244,7 +238,8 @@ static h5dump_t xml_dataformat = { "%s", /*dset_blockformat_pre */ "%s", /*dset_ptformat_pre */ "%s", /*dset_ptformat */ - 0 /*array indices */ + 0 , /*array indices */ + 0 /*interpret CR/LF information */ }; /** XML **/ @@ -331,8 +326,6 @@ 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 ref_path_table_entry_t *ref_path_table_put(hid_t, const char *); -static ref_path_table_entry_t *ref_path_table_gen_fake(const char *); static char *xml_escape_the_string(const char *, int); static char *xml_escape_the_name(const char *); @@ -352,7 +345,7 @@ struct handler_t { /* 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 = "hnpBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A"; +static const char *s_opts = "hnpeBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:s:S:A"; #endif /* 0 */ static struct long_options l_opts[] = { { "help", no_arg, 'h' }, @@ -600,6 +593,7 @@ 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, " -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"); @@ -1966,6 +1960,9 @@ 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); @@ -2086,18 +2083,24 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id) h5tools_context_t ctx; /*print context */ size_t size; void *buf=NULL; - hsize_t nelmts=1; + int nelmts=1; h5dump_t *outputformat = &dataformat; + herr_t ret; + hid_t n_type; memset(&ctx, 0, sizeof(ctx)); ctx.indent_level=2; size = H5Tget_size(type_id); buf = malloc(size); - H5Pget_fill_value(dcpl, type_id, buf); + n_type = H5Tget_native_type(type_id,H5T_DIR_DEFAULT); + + ret=H5Pget_fill_value(dcpl, n_type, buf); h5tools_dump_simple_data(stdout, outputformat, obj_id, &ctx, - START_OF_DATA | END_OF_DATA, nelmts, type_id, buf); + START_OF_DATA | END_OF_DATA, nelmts, n_type, buf); + + H5Tclose(n_type); if (buf) free (buf); @@ -2160,11 +2163,11 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) /*start indent */ indent += COL; indentation(indent + COL); - printf("SIZE %d ", (int)storage_size); + HDfprintf(stdout, "SIZE %Hu ", storage_size); rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); - printf("%s %d", dump_header_format->dataspacedimbegin, (int)chsize[0]); + HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]); for ( i=1; i<rank; i++) - printf(", %d", (int)chsize[i]); + HDfprintf(stdout, ", %Hu", chsize[i]); printf(" %s\n", dump_header_format->dataspacedimend); /*end indent */ indent -= COL; @@ -2177,7 +2180,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) /*start indent */ indent += COL; indentation(indent + COL); - printf("SIZE %d\n", (int)storage_size); + HDfprintf(stdout, "SIZE %Hu\n", storage_size); /*end indent */ indent -= COL; indentation(indent + COL); @@ -2196,9 +2199,9 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indent += COL; for ( i=0; i<next; i++) { - H5Pget_external(dcpl_id,(unsigned)i,sizeof(name),name,&offset,&size); + H5Pget_external(dcpl_id,i,sizeof(name),name,&offset,&size); indentation(indent + COL); - printf("FILENAME %s SIZE %d OFFSET %d\n",name,(int)size,(int)offset); + HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset); } /*end indent */ indent -= COL; @@ -2212,7 +2215,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) /*start indent */ indent += COL; indentation(indent + COL); - printf("SIZE %d OFFSET %d\n", (int)storage_size, (int)ioffset); + HDfprintf(stdout,"SIZE %Hu OFFSET %Hu\n", storage_size, ioffset); /*end indent */ indent -= COL; indentation(indent + COL); @@ -2340,8 +2343,6 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) H5Pget_fill_time(dcpl_id, &ft); switch ( ft ) { - default: - break; case H5D_FILL_TIME_ALLOC: printf("%s", "ALLOC\n"); break; @@ -3061,6 +3062,9 @@ parse_start: case 'p': display_dcpl = TRUE; break; + case 'e': + display_lf = TRUE; + break; case 'H': display_data = FALSE; display_attr_data = FALSE; @@ -3702,6 +3706,8 @@ print_enum(hid_t type) printf("\n%*s <empty>", indent + 4, ""); } +#if 0 + /* * XML support */ @@ -3879,7 +3885,7 @@ ref_path_table_gen_fake(const char *path) * *------------------------------------------------------------------------- */ -static char * +char * lookup_ref_path(hobj_ref_t ref) { ref_path_table_entry_t *pte = ref_path_table; @@ -3983,6 +3989,8 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) return 0; } +#endif + /* * create a string suitable for and XML NCNAME. Uses the * object reference to create the string. diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 9231b64..cd477da 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -4447,6 +4447,8 @@ make_external(hid_t fid) assert(ret>=0); } + +#if 0 /*------------------------------------------------------------------------- * Function: gent_filters * @@ -4473,10 +4475,11 @@ static void gent_filters(void) hsize_t dims2[1]={2}; hvl_t buf2[2]; hsize_t dims3[1]={1}; - char buf3[]={"string\n new"}; + char buf3[]={"this is\n a string with three\n newline\n escape characters"}; hsize_t dims4[1]={6}; char buf4[6]={"abcdef"}; - hobj_ref_t buf5[2]; + hobj_ref_t buf5[5]; + hsize_t dims5[1]={5}; int i, j, n, ret, fillval, val; typedef enum @@ -4787,14 +4790,412 @@ static void gent_filters(void) * reference *------------------------------------------------------------------------- */ - ret=H5Rcreate(&buf5[0],fid,"char",H5R_OBJECT,-1); + 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); + assert(ret>=0); + ret=H5Rcreate(&buf5[3],fid,"myvlen",H5R_OBJECT,-1); + assert(ret>=0); + ret=H5Rcreate(&buf5[4],fid,"contiguous",H5R_OBJECT,-1); + assert(ret>=0); + write_dset(fid,1,dims5,"reference",H5T_STD_REF_OBJ,buf5); + + + +/*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + ret=H5Sclose(sid1); + assert(ret>=0); + + ret=H5Sclose(sid); + assert(ret>=0); + + ret=H5Pclose(dcpl); + assert(ret>=0); + + ret=H5Fclose(fid); + assert(ret>=0); +} + +#endif + + +/*------------------------------------------------------------------------- + * Function: gent_filters + * + * Purpose: make several datasets with filters, external dataset + * fill value + * + *------------------------------------------------------------------------- + */ +static void gent_filters() +{ + hid_t fid; /* file id */ + hid_t dcpl; /* dataset creation property list */ + hid_t sid; /* dataspace ID */ + hid_t sid1; /* dataspace ID */ + hid_t tid; /* datatype ID */ + hid_t did; /* dataset 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; +#endif + hsize_t dims1[RANK]={DIM1,DIM2}; + hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; + int buf1[DIM1][DIM2]; + hsize_t dims2[1]={2}; + hvl_t buf2[2]; + hsize_t dims3[1]={1}; + char buf3[]={"this is\n a string with three\n newline\n escape characters"}; + hsize_t dims4[1]={6}; + char buf4[6]={"abcdef"}; + hobj_ref_t buf5[5]; + hsize_t dims5[1]={5}; + 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++; + } + } + + /* create a file */ + fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid>=0); + + /* create a space */ + sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); + + /* create a dataset creation property list; the same DCPL is used for all dsets */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval); + assert(ret>=0); + + +/*------------------------------------------------------------------------- + * create a compact and contiguous storage layout dataset + * add a comment to the datasets + *------------------------------------------------------------------------- + */ + ret=H5Pset_layout(dcpl, H5D_COMPACT); + assert(ret>=0); + + ret=make_dset(fid,"compact",sid,dcpl,buf1); + assert(ret>=0); + + ret=H5Gset_comment(fid,"compact", "This is a dataset with compact storage"); + assert(ret>=0); + + ret=H5Pset_layout(dcpl, H5D_CONTIGUOUS); + assert(ret>=0); + + ret=make_dset(fid,"contiguous",sid,dcpl,buf1); + assert(ret>=0); + + ret=H5Gset_comment(fid,"contiguous", "This is a dataset with contiguous storage"); + assert(ret>=0); + + ret=H5Pset_layout(dcpl, H5D_CHUNKED); + assert(ret>=0); + + ret=H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + assert(ret>=0); + + ret=make_dset(fid,"chunked",sid,dcpl,buf1); + assert(ret>=0); + + ret=H5Gset_comment(fid,"chunked", "This is a dataset with chunked storage"); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * make several dataset with filters + *------------------------------------------------------------------------- + */ + + /* set up chunk */ + ret=H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * SZIP + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_SZIP) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set szip data */ + ret=H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); + assert(ret>=0); + + ret=make_dset(fid,"szip",sid,dcpl,buf1); + assert(ret>=0); +#endif + +/*------------------------------------------------------------------------- + * GZIP + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_DEFLATE) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set deflate data */ + ret=H5Pset_deflate(dcpl, 9); assert(ret>=0); - ret=H5Rcreate(&buf5[1],fid,"string",H5R_OBJECT,-1); + + ret=make_dset(fid,"deflate",sid,dcpl,buf1); assert(ret>=0); - write_dset(fid,1,dims2,"reference",H5T_STD_REF_OBJ,buf5); +#endif +/*------------------------------------------------------------------------- + * shuffle + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_SHUFFLE) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set the shuffle filter */ + ret=H5Pset_shuffle(dcpl); + assert(ret>=0); + + ret=make_dset(fid,"shuffle",sid,dcpl,buf1); + assert(ret>=0); +#endif + + +/*------------------------------------------------------------------------- + * checksum + *------------------------------------------------------------------------- + */ +#if defined (H5_HAVE_FILTER_FLETCHER32) + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + + /* set the checksum filter */ + ret=H5Pset_fletcher32(dcpl); + assert(ret>=0); + ret=make_dset(fid,"fletcher32",sid,dcpl,buf1); + assert(ret>=0); +#endif + +/*------------------------------------------------------------------------- + * all filters + *------------------------------------------------------------------------- + */ + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + +#if defined (H5_HAVE_FILTER_SHUFFLE) + /* set the shuffle filter */ + ret=H5Pset_shuffle(dcpl); + assert(ret>=0); +#endif + +#if defined (H5_HAVE_FILTER_SZIP) + szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK; + /* set szip data */ + ret=H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); + assert(ret>=0); +#endif + +#if defined (H5_HAVE_FILTER_DEFLATE) + /* set deflate data */ + ret=H5Pset_deflate(dcpl, 5); + assert(ret>=0); +#endif + +#if defined (H5_HAVE_FILTER_FLETCHER32) + /* set the checksum filter */ + ret=H5Pset_fletcher32(dcpl); + assert(ret>=0); +#endif + + ret=make_dset(fid,"all",sid,dcpl,buf1); + assert(ret>=0); + + +/*------------------------------------------------------------------------- + * user defined filter + *------------------------------------------------------------------------- + */ + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + +#ifdef H5_WANT_H5_V1_4_COMPAT + ret=H5Zregister (MYFILTER_ID, "myfilter", myfilter); +#else + ret=H5Zregister (H5Z_MYFILTER); +#endif + assert(ret>=0); + + H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL); + assert(ret>=0); + + ret=make_dset(fid,"myfilter",sid,dcpl,buf1); + assert(ret>=0); + + /* remove the filters from the dcpl */ + ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * make an external dataset + *------------------------------------------------------------------------- + */ + make_external(fid); + + /*------------------------------------------------------------------------- + * make datasets with fill value combinations + *------------------------------------------------------------------------- + */ + + + ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); + assert(ret>=0); + + 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); + assert(ret>=0); + + ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); + assert(ret>=0); + + ret=make_dset(fid,"fill_never",sid,dcpl,buf1); + assert(ret>=0); + + ret=H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); + assert(ret>=0); + + ret=make_dset(fid,"fill_ifset",sid,dcpl,buf1); + assert(ret>=0); + + + +/*------------------------------------------------------------------------- + * commit a H5G_TYPE type with a comment + *------------------------------------------------------------------------- + */ + tid=H5Tcopy(H5T_STD_B8LE); + ret=H5Tcommit(fid, "mytype", tid); + assert(ret>=0); + + ret=H5Gset_comment(fid,"mytype", "This is a commited datatype"); + assert(ret>=0); + + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * enum type with nonprintable characters in the name + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED 3 \\n", (val = 0, &val)); + write_dset(fid,2,dims1,"enum",tid,0); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * vlen + *------------------------------------------------------------------------- + */ + + buf2[0].len = 1; + buf2[0].p = malloc( 1 * sizeof(int)); + ((int *)buf2[0].p)[0]=1; + buf2[1].len = 2; + buf2[1].p = malloc( 2 * sizeof(int)); + ((int *)buf2[1].p)[0]=2; + ((int *)buf2[1].p)[1]=3; + + sid1=H5Screate_simple(1,dims2,NULL); + tid=H5Tvlen_create(H5T_NATIVE_INT); + did=H5Dcreate(fid,"vlen",tid,sid1,H5P_DEFAULT); + ret=H5Dwrite(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2); + assert(ret>=0); + ret=H5Tcommit(fid,"myvlen",tid); + assert(ret>=0); + ret=H5Dvlen_reclaim(tid,sid1,H5P_DEFAULT,buf2); + assert(ret>=0); + ret=H5Dclose(did); + assert(ret>=0); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * bitfield + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_STD_B8LE); + write_dset(fid,1,dims3,"bitfield",tid,buf3); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * string + *------------------------------------------------------------------------- + */ + + tid=H5Tcopy(H5T_C_S1); + ret=H5Tset_size(tid, sizeof(buf3)); + assert(ret>=0); + write_dset(fid,1,dims3,"string",tid,buf3); + ret=H5Tclose(tid); + assert(ret>=0); + +/*------------------------------------------------------------------------- + * char array + *------------------------------------------------------------------------- + */ + write_dset(fid,1,dims4,"char",H5T_NATIVE_CHAR,buf4); + +/*------------------------------------------------------------------------- + * reference + *------------------------------------------------------------------------- + */ + 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); + assert(ret>=0); + ret=H5Rcreate(&buf5[3],fid,"myvlen",H5R_OBJECT,-1); + assert(ret>=0); + ret=H5Rcreate(&buf5[4],fid,"contiguous",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 ee45788..067d0f0 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -89,6 +89,15 @@ TOOLTEST() { fi } + +# Print a "SKIP" message +SKIP() { + TESTING $DUMPER $@ + echo " -SKIP-" +} + + + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -209,6 +218,63 @@ TOOLTEST tboot.ddl -H -B -d compact tfilters.h5 TOOLTEST tcontents.ddl -n tfilters.h5 +# tests for storage layout +# compact +TOOLTEST tcompact.ddl -H -p -d compact tfilters.h5 +# contiguous +TOOLTEST tcontiguos.ddl -H -p -d contiguos 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 + +# references , print path +TOOLTEST treference.ddl -d reference tfilters.h5 + +# string , print new lines +TOOLTEST tstring.ddl -e -d string tfilters.h5 + + +# tests for filters +# SZIP +option="-H -p -d szip tfilters.h5" +if test $USE_FILTER_SZIP != "yes"; then + SKIP $option +else +TOOLTEST tszip.ddl $option +fi +# deflate +option="-H -p -d deflate tfilters.h5" +if test $USE_FILTER_DEFLATE != "yes"; then + SKIP $option +else + TOOLTEST tdeflate.ddl $option +fi +# shuffle +option="-H -p -d shuffle tfilters.h5" +if test $USE_FILTER_SHUFFLE != "yes"; then + SKIP $option +else + TOOLTEST tshuffle.ddl $option +fi +# fletcher32 +option="-H -p -d fletcher32 tfilters.h5" +if test $USE_FILTER_FLETCHER32 != "yes"; then + SKIP $option +else + TOOLTEST tfletcher32.ddl $option +fi +# user defined +TOOLTEST tuserfilter.ddl -H -d myfilter tfilters.h5 + + + + if test $nerrors -eq 0 ; then echo "All $DUMPER tests passed." fi diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index da0bca1..373d4d0 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -78,6 +78,12 @@ static herr_t list (hid_t group, const char *name, void *cd); static void display_type(hid_t type, int ind); static char *fix_name(const char *path, const char *base); + +hid_t thefile; +char *prefix; +char *progname; +int d_status; + /*------------------------------------------------------------------------- * Function: usage @@ -2258,3 +2264,11 @@ main (int argc, const char *argv[]) } leave(0); } + +/* dummy function */ +char * +lookup_ref_path(hobj_ref_t ref) +{ + return NULL; +} + diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 070bdcc..2fff656 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -41,7 +41,7 @@ PROGS=$(PUB_PROGS) $(TEST_PROGS) ## Source and object files for the library; do not install ## -LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c h5tools_filters.c +LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c h5tools_filters.c h5tools_ref.c LIB_OBJ=$(LIB_SRC:.c=.lo) PUB_LIB= AUX_LIB=$(LIB) diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 545db02..d561a94 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -318,6 +318,9 @@ typedef struct h5dump_t { /*print array indices in output matrix */ int pindex; + /*interpret CR/LF information */ + int do_lf; + } h5dump_t; typedef struct dump_header{ diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c new file mode 100644 index 0000000..7dcccad --- /dev/null +++ b/tools/lib/h5tools_ref.c @@ -0,0 +1,306 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include <stdio.h> +#include <stdlib.h> +#include "h5tools_ref.h" +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" + + +/* + * Table to look up a path name for an object + * reference. + * + * This table stores mappings of reference -> path + * for all objects in the file that may be the target of + * an object reference. + * + * The 'path' is an absolute path by which the object + * can be accessed. When an object has > 1 such path, + * only one will be used in the table, with no particular + * method of selecting which one. + */ + + +extern hid_t thefile; +extern char *prefix; +extern char *progname; +extern int d_status; + + + +ref_path_table_entry_t *ref_path_table = NULL; /* the table */ + +/*------------------------------------------------------------------------- + * Function: ref_path_table_lookup + * + * Purpose: Looks up a table entry given a path name. + * Used during construction of the table. + * + * Return: The table entre (pte) or NULL if not in the + * table. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +ref_path_table_entry_t * +ref_path_table_lookup(const char *thepath) +{ + H5G_stat_t sb; + ref_path_table_entry_t *pte = ref_path_table; + + if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0) { + /* fatal error ? */ + return NULL; + } + + while(pte!=NULL) { + if (sb.objno==pte->statbuf.objno) + return pte; + pte = pte->next; + } + + return NULL; +} + +/*------------------------------------------------------------------------- + * Function: ref_path_table_put + * + * Purpose: Enter the 'obj' with 'path' in the table if + * not already there. + * Create an object reference, pte, and store them + * in the table. + * + * Return: The object reference for the object. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +ref_path_table_entry_t * +ref_path_table_put(hid_t obj, const char *path) +{ + ref_path_table_entry_t *pte; + + /* look up 'obj'. If already in table, return */ + pte = ref_path_table_lookup(path); + if (pte != NULL) + return pte; + + /* if not found, then make new entry */ + + pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); + if (pte == NULL) { + /* fatal error? */ + return NULL; + } + + pte->obj = obj; + + pte->apath = HDstrdup(path); + + if(H5Gget_objinfo(thefile, path, TRUE, &pte->statbuf)<0) { + /* fatal error? */ + free(pte); + return NULL; + } + + pte->next = ref_path_table; + ref_path_table = pte; + + return pte; +} + +/* + * counter used to disambiguate multiple instances of same object. + */ +int xid = 1; + +int get_next_xid() { + return xid++; +} + +/* + * This counter is used to create fake object ID's + * The idea is to set it to the largest possible offest, which + * minimizes the chance of collision with a real object id. + * + */ +haddr_t fake_xid = HADDR_MAX; +haddr_t +get_fake_xid () { + return (fake_xid--); +} + +/* + * for an object that does not have an object id (e.g., soft link), + * create a table entry with a fake object id as the key. + */ + +ref_path_table_entry_t * +ref_path_table_gen_fake(const char *path) +{ + ref_path_table_entry_t *pte; + + /* look up 'obj'. If already in table, return */ + pte = ref_path_table_lookup(path); + if (pte != NULL) { + return pte; + } + + /* if not found, then make new entry */ + + pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); + if (pte == NULL) { + /* fatal error? */ + return NULL; + } + + pte->obj = (hid_t)-1; + + memset(&pte->statbuf,0,sizeof(H5G_stat_t)); + pte->statbuf.objno = get_fake_xid(); + + pte->apath = HDstrdup(path); + + pte->next = ref_path_table; + ref_path_table = pte; + + return pte; +} + +/*------------------------------------------------------------------------- + * Function: lookup_ref_path + * + * Purpose: Lookup the path to the object with refernce 'ref'. + * + * Return: Return a path to the object, or NULL if not found. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +char * +lookup_ref_path(hobj_ref_t ref) +{ + ref_path_table_entry_t *pte = ref_path_table; + + while(pte!=NULL) { + if (ref==pte->statbuf.objno) + return pte->apath; + pte = pte->next; + } + return NULL; +} + +/*------------------------------------------------------------------------- + * Function: fill_ref_path_table + * + * Purpose: Called by interator to create references for + * all objects and enter them in the table. + * + * Return: Error status. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) +{ + hid_t obj; + char *tmp; + H5G_stat_t statbuf; + ref_path_table_entry_t *pte; + char *thepath; + + H5Gget_objinfo(group, name, FALSE, &statbuf); + tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2); + + if (tmp == NULL) + return FAIL; + + thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2); + + if (thepath == NULL) { + free(tmp); + return FAIL; + } + + strcpy(tmp, prefix); + + strcpy(thepath, prefix); + strcat(thepath, "/"); + strcat(thepath, name); + + switch (statbuf.type) { + case H5G_DATASET: + if ((obj = H5Dopen(group, name)) >= 0) { + pte = ref_path_table_lookup(thepath); + if (pte == NULL) { + ref_path_table_put(obj, thepath); + } + H5Dclose(obj); + } else { + error_msg(progname, "unable to get dataset \"%s\"\n", name); + d_status = EXIT_FAILURE; + } + break; + case H5G_GROUP: + if ((obj = H5Gopen(group, name)) >= 0) { + strcat(strcat(prefix, "/"), name); + pte = ref_path_table_lookup(thepath); + if (pte == NULL) { + ref_path_table_put(obj, thepath); + H5Giterate(obj, ".", NULL, fill_ref_path_table, NULL); + strcpy(prefix, tmp); + } + H5Gclose(obj); + } else { + error_msg(progname, "unable to dump group \"%s\"\n", name); + d_status = EXIT_FAILURE; + } + break; + case H5G_TYPE: + if ((obj = H5Topen(group, name)) >= 0) { + pte = ref_path_table_lookup(thepath); + if (pte == NULL) { + ref_path_table_put(obj, thepath); + } + H5Tclose(obj); + } else { + error_msg(progname, "unable to get dataset \"%s\"\n", name); + d_status = EXIT_FAILURE; + } + break; + default: + break; + } + + free(tmp); + free(thepath); + return 0; +} + diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h new file mode 100644 index 0000000..2f5fa83 --- /dev/null +++ b/tools/lib/h5tools_ref.h @@ -0,0 +1,49 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5TOOLS_REF_H__ +#define H5TOOLS_REF_H__ + +#include "hdf5.h" + +typedef struct ref_path_table_entry_t { + hid_t obj; + hobj_ref_t *obj_ref; + char *apath; + H5G_stat_t statbuf; + struct ref_path_table_entry_t *next; +}ref_path_table_entry_t; + +#ifdef __cplusplus +extern "C" { +#endif + + +char* lookup_ref_path(hobj_ref_t ref); +herr_t fill_ref_path_table(hid_t, const char *, void *); +int get_next_xid(void); +haddr_t get_fake_xid (void); +struct ref_path_table_entry_t *ref_path_table_lookup(const char *); +ref_path_table_entry_t *ref_path_table_put(hid_t obj, const char *path); +struct ref_path_table_entry_t *ref_path_table_gen_fake(const char *); + +#ifdef __cplusplus +} +#endif + + + +#endif + + diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 5398d76..fb1d0c2 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -27,6 +27,9 @@ #include "h5tools.h" /*for h5dump_t structure */ #include "h5tools_str.h" /*function prototypes */ +extern char* lookup_ref_path(hobj_ref_t ref); + + /* * If REPEAT_VERBOSE is defined then character strings will be printed so * that repeated character sequences like "AAAAAAAAAA" are displayed as @@ -452,8 +455,13 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch) h5tools_str_append(str, "\\f"); break; case '\n': - h5tools_str_append(str, "\\n"); - break; + if (info->do_lf) { + h5tools_str_append(str, "\n"); + h5tools_str_append(str, " "); + } + else + h5tools_str_append(str, "\\n"); + break; case '\r': h5tools_str_append(str, "\\r"); break; @@ -794,6 +802,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, if (h5tools_is_zero(vp, H5Tget_size(type))) { h5tools_str_append(str, "NULL"); } else { + char *path=NULL; otype = H5Rget_obj_type(container, H5R_OBJECT, vp); obj = H5Rdereference(container, H5R_OBJECT, vp); H5Gget_objinfo(obj, ".", FALSE, &sb); @@ -822,6 +831,14 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, h5tools_str_append(str, info->obj_format, sb.objno); else h5tools_str_append(str, info->obj_format, sb.fileno,sb.objno); + + /* Print name */ + path = lookup_ref_path(*(hobj_ref_t *)vp); + if (path) { + h5tools_str_append(str, " "); + h5tools_str_append(str, path); + h5tools_str_append(str, " "); + } } } else if (H5Tget_class(type) == H5T_ARRAY) { int k, ndims; diff --git a/tools/testfiles/tchunked.ddl b/tools/testfiles/tchunked.ddl new file mode 100644 index 0000000..27cdbf8 --- /dev/null +++ b/tools/testfiles/tchunked.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d chunked tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "chunked" { + } +} +h5dump error: unable to open dataset "chunked" diff --git a/tools/testfiles/tcompact.ddl b/tools/testfiles/tcompact.ddl new file mode 100644 index 0000000..8c47e36 --- /dev/null +++ b/tools/testfiles/tcompact.ddl @@ -0,0 +1,18 @@ +############################# +Expected output for 'h5dump -H -p -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 ) } + STORAGE_LAYOUT COMPACT { + SIZE 800 + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME EARLY + VALUE 0 + } +} +} diff --git a/tools/testfiles/tcontiguos.ddl b/tools/testfiles/tcontiguos.ddl new file mode 100644 index 0000000..7c26099 --- /dev/null +++ b/tools/testfiles/tcontiguos.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d contiguos tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "contiguos" { + } +} +h5dump error: unable to open dataset "contiguos" diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl new file mode 100644 index 0000000..2423c47 --- /dev/null +++ b/tools/testfiles/tdeflate.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5dump -H -p -d deflate tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "deflate" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 385 ( 10, 5 ) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 9 } + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE 0 + } +} +} diff --git a/tools/testfiles/texternal.ddl b/tools/testfiles/texternal.ddl new file mode 100644 index 0000000..511bd4f --- /dev/null +++ b/tools/testfiles/texternal.ddl @@ -0,0 +1,18 @@ +############################# +Expected output for 'h5dump -H -p -d external tfilters.h5' +############################# +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 + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME LATE + VALUE 0 + } +} +} diff --git a/tools/testfiles/tfillearly.ddl b/tools/testfiles/tfillearly.ddl new file mode 100644 index 0000000..95f89ae --- /dev/null +++ b/tools/testfiles/tfillearly.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d fill_early tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fill_early" { + } +} +h5dump error: unable to open dataset "fill_early" diff --git a/tools/testfiles/tfillifset.ddl b/tools/testfiles/tfillifset.ddl new file mode 100644 index 0000000..79e748c --- /dev/null +++ b/tools/testfiles/tfillifset.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d fill_ifset tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fill_ifset" { + } +} +h5dump error: unable to open dataset "fill_ifset" diff --git a/tools/testfiles/tfillnever.ddl b/tools/testfiles/tfillnever.ddl new file mode 100644 index 0000000..38be076 --- /dev/null +++ b/tools/testfiles/tfillnever.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d fill_never tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fill_never" { + } +} +h5dump error: unable to open dataset "fill_never" diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl new file mode 100644 index 0000000..1b128cb --- /dev/null +++ b/tools/testfiles/tfletcher32.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5dump -H -p -d fletcher32 tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "fletcher32" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 816 ( 10, 5 ) + } + FILTERS { + CHECKSUM FLETCHER32 + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE 0 + } +} +} diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl index 5e9dcaa..56dd4b9 100644 --- a/tools/testfiles/tnofilename.ddl +++ b/tools/testfiles/tnofilename.ddl @@ -10,6 +10,7 @@ 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 -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute -d P, --dataset=P Print the specified dataset diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl new file mode 100644 index 0000000..817bbaf --- /dev/null +++ b/tools/testfiles/treference.ddl @@ -0,0 +1,12 @@ +############################# +Expected output for 'h5dump -d reference tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "reference" { + DATATYPE H5T_REFERENCE + DATASPACE SIMPLE { ( 2 ) / ( 2 ) } + DATA { + (0) DATASET 36216 /char , DATASET 35944 /string + } +} +} diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl new file mode 100644 index 0000000..aa80f6f --- /dev/null +++ b/tools/testfiles/tshuffle.ddl @@ -0,0 +1,20 @@ +############################# +Expected output for 'h5dump -H -p -d shuffle tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "shuffle" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 800 ( 10, 5 ) + } + FILTERS { + PREPROCESSING SHUFFLE + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE 0 + } +} +} diff --git a/tools/testfiles/tstring.ddl b/tools/testfiles/tstring.ddl new file mode 100644 index 0000000..9d15f17 --- /dev/null +++ b/tools/testfiles/tstring.ddl @@ -0,0 +1,18 @@ +############################# +Expected output for 'h5dump -e -d string tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "string" { + DATATYPE H5T_STRING { + STRSIZE 12; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + (0) "string + new" + } +} +} diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl new file mode 100644 index 0000000..02a5fd3 --- /dev/null +++ b/tools/testfiles/tszip.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5dump -H -p -d szip tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "szip" { + } +} +h5dump error: unable to open dataset "szip" diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl new file mode 100644 index 0000000..c262fb6 --- /dev/null +++ b/tools/testfiles/tuserfilter.ddl @@ -0,0 +1,9 @@ +############################# +Expected output for 'h5dump -H -d myfilter tfilters.h5' +############################# +HDF5 "tfilters.h5" { +DATASET "myfilter" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } +} +} |