From b1251c915ea777e3c84d0934cd713d9dd0aef38f Mon Sep 17 00:00:00 2001
From: Allen Byrne <byrn@hdfgroup.org>
Date: Mon, 23 Feb 2015 15:23:56 -0500
Subject: [svn-r26287] Rename point and block str functions generically. Add
 info arg to print virtual selection function.

---
 tools/lib/h5tools_dump.c | 16 ++++++++++------
 tools/lib/h5tools_str.c  | 32 ++++++++++++++++----------------
 tools/lib/h5tools_str.h  |  4 ++--
 3 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 921c3b2..72de012 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -225,7 +225,7 @@ void h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims);
 void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info,
         h5tools_context_t *ctx, struct subset_t *sset, int dims);
 
-void h5tools_print_virtual_selection(h5tools_str_t *buffer, hid_t vspace, hid_t dcpl_id, size_t index);
+void h5tools_print_virtual_selection(h5tools_str_t *buffer, const h5tool_format_t *info, hid_t vspace, hid_t dcpl_id, size_t index);
 
 void
 h5tools_dump_init(void)
@@ -2861,7 +2861,7 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info,
  *-------------------------------------------------------------------------
  */
 void
-h5tools_print_virtual_selection(h5tools_str_t *buffer, hid_t vspace, hid_t dcpl_id, size_t index)
+h5tools_print_virtual_selection(h5tools_str_t *buffer, const h5tool_format_t *info, hid_t vspace, hid_t dcpl_id, size_t index)
 {
     h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->virtualselectionbegin);
     switch(H5Sget_select_type(vspace)) {
@@ -2870,12 +2870,16 @@ h5tools_print_virtual_selection(h5tools_str_t *buffer, hid_t vspace, hid_t dcpl_
         break;
     case H5S_SEL_POINTS:    /* Sequence of points selected  */
         h5tools_str_append(buffer, "POINT_SELECTION %s ", h5tools_dump_header_format->virtualselectionblockbegin);
-        //h5tools_print_selection(&buffer, sset->start.data, dims);
+        h5tools_str_append(buffer, "{");
+        h5tools_str_dump_space_points(buffer, vspace, info);
+        h5tools_str_append(buffer, "}");
         h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionblockend);
         break;
     case H5S_SEL_HYPERSLABS:    /* "New-style" hyperslab selection defined  */
         h5tools_str_append(buffer, "HYPERSLAB_SELECTION %s ", h5tools_dump_header_format->virtualselectionblockbegin);
-        //h5tools_print_selection(&buffer, sset->start.data, dims);
+        h5tools_str_append(buffer, "{");
+        h5tools_str_dump_space_blocks(buffer, vspace, info);
+        h5tools_str_append(buffer, "}");
         h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionblockend);
         break;
     case H5S_SEL_ALL:    /* Entire extent selected   */
@@ -3188,7 +3192,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
                 h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
 
                 h5tools_str_reset(&buffer);
-                h5tools_print_virtual_selection(&buffer, virtual_vspace, dcpl_id, next);
+                h5tools_print_virtual_selection(&buffer, info, virtual_vspace, dcpl_id, next);
                 h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
 
                 ssize_out = H5Pget_virtual_filename(dcpl_id, next, NULL, 0);
@@ -3218,7 +3222,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
                 h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
 
                 h5tools_str_reset(&buffer);
-                h5tools_print_virtual_selection(&buffer, virtual_srcspace, dcpl_id, next);
+                h5tools_print_virtual_selection(&buffer, info, virtual_srcspace, dcpl_id, next);
                 h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
             }
             ctx->indent_level--;
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 3160cfa..45424f6 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -416,9 +416,9 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
 }
 
 /*-------------------------------------------------------------------------
- * Function:    h5tools_str_dump_region_blocks
+ * Function:    h5tools_str_dump_space_blocks
  *
- * Purpose: Prints information about a dataspace region by appending
+ * Purpose: Prints information about a dataspace selection by appending
  *          the information to the specified string.
  *
  * Return:  none
@@ -429,19 +429,19 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
  *-------------------------------------------------------------------------
  */
 void
-h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
+h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace,
         const h5tool_format_t *info)
 {
     hssize_t   nblocks;
     hsize_t    alloc_size;
     hsize_t   *ptdata;
-    int        ndims = H5Sget_simple_extent_ndims(region);
+    int        ndims = H5Sget_simple_extent_ndims(rspace);
 
     /*
-     * This function fails if the region does not have blocks.
+     * This function fails if the rspace does not have blocks.
      */
     H5E_BEGIN_TRY {
-        nblocks = H5Sget_select_hyper_nblocks(region);
+        nblocks = H5Sget_select_hyper_nblocks(rspace);
     } H5E_END_TRY;
 
     /* Print block information */
@@ -452,7 +452,7 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
         HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
         ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
         H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
-        H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata);
+        H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, (hsize_t)nblocks, ptdata);
 
         for (i = 0; i < nblocks; i++) {
             int j;
@@ -477,9 +477,9 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
 }
 
 /*-------------------------------------------------------------------------
- * Function:    h5tools_str_dump_region_points
+ * Function:    h5tools_str_dump_space_points
  *
- * Purpose: Prints information about a dataspace region by appending
+ * Purpose: Prints information about a dataspace selection by appending
  *          the information to the specified string.
  *
  * Return:  none
@@ -490,19 +490,19 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
  *-------------------------------------------------------------------------
  */
 void
-h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
+h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace,
         const h5tool_format_t *info)
 {
     hssize_t   npoints;
     hsize_t    alloc_size;
     hsize_t   *ptdata;
-    int        ndims = H5Sget_simple_extent_ndims(region);
+    int        ndims = H5Sget_simple_extent_ndims(rspace);
 
     /*
-     * This function fails if the region does not have points.
+     * This function fails if the rspace does not have points.
      */
     H5E_BEGIN_TRY {
-        npoints = H5Sget_select_elem_npoints(region);
+        npoints = H5Sget_select_elem_npoints(rspace);
     } H5E_END_TRY;
 
     /* Print point information */
@@ -513,7 +513,7 @@ h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
         HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
         ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
         H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
-        H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata);
+        H5Sget_select_elem_pointlist(rspace, (hsize_t)0, (hsize_t)npoints, ptdata);
 
         for (i = 0; i < npoints; i++) {
             int j;
@@ -1241,9 +1241,9 @@ h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
 
             region_type = H5Sget_select_type(region);
             if(region_type==H5S_SEL_POINTS)
-                h5tools_str_dump_region_points(str, region, info);
+                h5tools_str_dump_space_points(str, region, info);
             else
-                h5tools_str_dump_region_blocks(str, region, info);
+                h5tools_str_dump_space_blocks(str, region, info);
 
             h5tools_str_append(str, "}");
 
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 38697c6..8d4c042 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -40,8 +40,8 @@ H5TOOLS_DLL char    *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_
 H5TOOLS_DLL char    *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
                                    hsize_t elmtno, hsize_t *ptdata, unsigned ndims, 
                                    hsize_t max_idx[], h5tools_context_t *ctx);
-H5TOOLS_DLL void     h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
-H5TOOLS_DLL void     h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
+H5TOOLS_DLL void     h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
+H5TOOLS_DLL void     h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
 H5TOOLS_DLL void     h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
                                    void *vp);
 H5TOOLS_DLL char    *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
-- 
cgit v0.12