summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump/h5dump.c
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-04-18 18:21:18 (GMT)
committerGitHub <noreply@github.com>2023-04-18 18:21:18 (GMT)
commit445fcab52f92bbd03ee0779e753c1cf1c1b3a91b (patch)
tree63c89e344c4b0408f9e647ed14a354569e621857 /tools/src/h5dump/h5dump.c
parent6e516abc29ce608190dec4b09ab9fd6619f22d50 (diff)
downloadhdf5-445fcab52f92bbd03ee0779e753c1cf1c1b3a91b.zip
hdf5-445fcab52f92bbd03ee0779e753c1cf1c1b3a91b.tar.gz
hdf5-445fcab52f92bbd03ee0779e753c1cf1c1b3a91b.tar.bz2
Add no subsets option to h5diff like h5dump #2688 (#2756)
Diffstat (limited to 'tools/src/h5dump/h5dump.c')
-rw-r--r--tools/src/h5dump/h5dump.c117
1 files changed, 5 insertions, 112 deletions
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 1c22124..6c1556a 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -565,114 +565,6 @@ set_sort_order(const char *form)
}
/*-------------------------------------------------------------------------
- * Function: parse_hsize_list
- *
- * Purpose: Parse a list of comma or space separated integers and return
- * them in a list. The string being passed into this function
- * should be at the start of the list you want to parse. You are
- * responsible for freeing the array returned from here.
- *
- * Lists in the so-called "terse" syntax are separated by
- * semicolons (;). The lists themselves can be separated by
- * either commas (,) or white spaces.
- *
- * Return: <none>
- *-------------------------------------------------------------------------
- */
-static void
-parse_hsize_list(const char *h_list, subset_d *d)
-{
- hsize_t *p_list;
- const char *ptr;
- unsigned int size_count = 0;
- unsigned int i = 0;
- unsigned int last_digit = 0;
-
- if (!h_list || !*h_list || *h_list == ';')
- return;
-
- /* count how many integers do we have */
- for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if (HDisdigit(*ptr)) {
- if (!last_digit)
- /* the last read character wasn't a digit */
- size_count++;
-
- last_digit = 1;
- }
- else
- last_digit = 0;
-
- if (size_count == 0)
- /* there aren't any integers to read */
- return;
-
- /* allocate an array for the integers in the list */
- p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t));
-
- for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if (HDisdigit(*ptr)) {
- /* we should have an integer now */
- p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
-
- while (HDisdigit(*ptr))
- /* scroll to end of integer */
- ptr++;
- }
- d->data = p_list;
- d->len = size_count;
-}
-
-/*-------------------------------------------------------------------------
- * Function: parse_subset_params
- *
- * Purpose: Parse the so-called "terse" syntax for specifying subsetting parameters.
- *
- * Return: Success: struct subset_t object
- * Failure: NULL
- *-------------------------------------------------------------------------
- */
-static struct subset_t *
-parse_subset_params(const char *dset)
-{
- struct subset_t *s = NULL;
- char *brace;
-
- if (!dump_opts.disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
- *brace++ = '\0';
-
- s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
- parse_hsize_list(brace, &s->start);
-
- while (*brace && *brace != ';')
- brace++;
-
- if (*brace)
- brace++;
-
- parse_hsize_list(brace, &s->stride);
-
- while (*brace && *brace != ';')
- brace++;
-
- if (*brace)
- brace++;
-
- parse_hsize_list(brace, &s->count);
-
- while (*brace && *brace != ';')
- brace++;
-
- if (*brace)
- brace++;
-
- parse_hsize_list(brace, &s->block);
- }
-
- return s;
-}
-
-/*-------------------------------------------------------------------------
* Function: parse_mask_list
*
* Purpose: Parse a list of comma or space separated integers and fill
@@ -957,10 +849,11 @@ parse_start:
for (i = 0; i < argc; i++)
if (!hand[i].func) {
- hand[i].func = handle_datasets;
- hand[i].obj = HDstrdup(H5_optarg);
- hand[i].subset_info = parse_subset_params(hand[i].obj);
- last_dset = &hand[i];
+ hand[i].func = handle_datasets;
+ hand[i].obj = HDstrdup(H5_optarg);
+ if (!dump_opts.disable_compact_subset)
+ hand[i].subset_info = parse_subset_params(hand[i].obj);
+ last_dset = &hand[i];
break;
}