From c1d205d282137c93dc8f2cac757045960075ca2c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 1 Sep 2009 09:09:35 -0500 Subject: [svn-r17442] Changed subsetting selection to allow count to be defaulted, and allow trailing semicolons in short form to be left off the command line. Short and long form now behave the same. Tested: local linux --- tools/h5dump/h5dump.c | 37 +++++++++++++++++++------------------ tools/testfiles/tdset-3s.ddl | 21 ++------------------- tools/testfiles/tnofilename.ddl | 18 +++++++++--------- 3 files changed, 30 insertions(+), 46 deletions(-) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 592b427..4b7211c 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -677,14 +677,16 @@ usage(const char *prog) fprintf(stdout, " Subsetting is available by using the following options with a dataset\n"); fprintf(stdout, " attribute. Subsetting is done by selecting a hyperslab from the data.\n"); fprintf(stdout, " Thus, the options mirror those for performing a hyperslab selection.\n"); - fprintf(stdout, " The START and COUNT parameters are mandatory if you do subsetting.\n"); - fprintf(stdout, " The STRIDE and BLOCK parameters are optional and will default to 1 in\n"); - fprintf(stdout, " each dimension.\n"); + fprintf(stdout, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n"); + fprintf(stdout, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); + fprintf(stdout, " each dimension. START is optional and will default to 0 in each dimension.\n"); fprintf(stdout, "\n"); - fprintf(stdout, " -s L, --start=L Offset of start of subsetting selection\n"); - fprintf(stdout, " -S L, --stride=L Hyperslab stride\n"); - fprintf(stdout, " -c L, --count=L Number of blocks to include in selection\n"); - fprintf(stdout, " -k L, --block=L Size of block in hyperslab\n"); + fprintf(stdout, " -s START, --start=START Offset of start of subsetting selection\n"); + fprintf(stdout, " -S STRIDE, --stride=STRIDE Hyperslab stride\n"); + fprintf(stdout, " -c COUNT, --count=COUNT Number of blocks to include in selection\n"); + fprintf(stdout, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n"); + fprintf(stdout, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n"); + fprintf(stdout, " number of dimensions in the dataspace being queried\n"); fprintf(stdout, "\n"); fprintf(stdout, " D - is the file driver to use in opening the file. Acceptable values\n"); fprintf(stdout, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n"); @@ -695,8 +697,6 @@ usage(const char *prog) fprintf(stdout, " P - is the full path from the root group to the object.\n"); fprintf(stdout, " N - is an integer greater than 1.\n"); fprintf(stdout, " T - is a string containing the floating point format, e.g '%%.3f'\n"); - fprintf(stdout, " L - is a list of integers the number of which are equal to the\n"); - fprintf(stdout, " number of dimensions in the dataspace being queried\n"); fprintf(stdout, " U - is a URI reference (as defined in [IETF RFC 2396],\n"); fprintf(stdout, " updated by [IETF RFC 2732])\n"); fprintf(stdout, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n"); @@ -3671,21 +3671,22 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis } if (!sset->count) { - hsize_t dims[H5S_MAX_RANK]; - herr_t status = H5Sget_simple_extent_dims(sid, dims, NULL); +// hsize_t dims[H5S_MAX_RANK]; +// herr_t status = H5Sget_simple_extent_dims(sid, dims, NULL); unsigned int i; - if (status == FAIL) { - error_msg(progname, "unable to get dataset dimensions\n"); - d_status = EXIT_FAILURE; - H5Sclose(sid); - return; - } +// if (status == FAIL) { +// error_msg(progname, "unable to get dataset dimensions\n"); +// d_status = EXIT_FAILURE; +// H5Sclose(sid); +// return; +// } sset->count = calloc(ndims, sizeof(hsize_t)); for (i = 0; i < ndims; i++) - sset->count[i] = dims[i] - sset->start[i]; + sset->count[i] = 1; +// sset->count[i] = dims[i] - sset->start[i]; } if (!sset->block) { diff --git a/tools/testfiles/tdset-3s.ddl b/tools/testfiles/tdset-3s.ddl index d8deced..5963e90 100644 --- a/tools/testfiles/tdset-3s.ddl +++ b/tools/testfiles/tdset-3s.ddl @@ -8,27 +8,10 @@ DATASET "/dset1" { SUBSET { START ( 1, 1 ); STRIDE ( 1, 1 ); - COUNT ( 9, 19 ); + COUNT ( 1, 1 ); BLOCK ( 1, 1 ); DATA { - (1,1): 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - (1,19): 20, - (2,1): 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - (2,18): 20, 21, - (3,1): 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - (3,18): 21, 22, - (4,1): 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - (4,18): 22, 23, - (5,1): 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - (5,18): 23, 24, - (6,1): 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - (6,17): 23, 24, 25, - (7,1): 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - (7,17): 24, 25, 26, - (8,1): 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - (8,17): 25, 26, 27, - (9,1): 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - (9,17): 26, 27, 28 + (1,1): 2 } } } diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl index 41a80a5..b33eaf8 100644 --- a/tools/testfiles/tnofilename.ddl +++ b/tools/testfiles/tnofilename.ddl @@ -41,14 +41,16 @@ usage: h5dump [OPTIONS] file Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. Thus, the options mirror those for performing a hyperslab selection. - The START and COUNT parameters are mandatory if you do subsetting. - The STRIDE and BLOCK parameters are optional and will default to 1 in - each dimension. + One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting. + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. - -s L, --start=L Offset of start of subsetting selection - -S L, --stride=L Hyperslab stride - -c L, --count=L Number of blocks to include in selection - -k L, --block=L Size of block in hyperslab + -s START, --start=START Offset of start of subsetting selection + -S STRIDE, --stride=STRIDE Hyperslab stride + -c COUNT, --count=COUNT Number of blocks to include in selection + -k BLOCK, --block=BLOCK Size of block in hyperslab + START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the + number of dimensions in the dataspace being queried D - is the file driver to use in opening the file. Acceptable values are "sec2", "family", "split", "multi", "direct", and "stream". Without @@ -59,8 +61,6 @@ usage: h5dump [OPTIONS] file P - is the full path from the root group to the object. N - is an integer greater than 1. T - is a string containing the floating point format, e.g '%.3f' - L - is a list of integers the number of which are equal to the - number of dimensions in the dataspace being queried U - is a URI reference (as defined in [IETF RFC 2396], updated by [IETF RFC 2732]) B - is the form of binary output: NATIVE for a memory type, FILE for the -- cgit v0.12