summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r--src/H5Shyper.c354
1 files changed, 181 insertions, 173 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 88c570d..e9354ca 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -18,21 +18,37 @@
* Purpose: Hyperslab selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* ID Functions */
#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+/****************/
/* Local Macros */
+/****************/
+
-/* Local datatypes */
+/******************/
+/* Local Typedefs */
+/******************/
-/* Static function prototypes */
+
+/********************/
+/* Local Prototypes */
+/********************/
static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high,
H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
static herr_t H5S__hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size);
@@ -64,7 +80,6 @@ static herr_t H5S__hyper_generate_spans(H5S_t *space);
static herr_t H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op,
const hsize_t start[], const hsize_t stride[], const hsize_t count[],
const hsize_t block[]);
-/* Needed for use in hyperslab code (H5Shyper.c) */
#ifdef NEW_HYPERSLAB_API
static herr_t H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
#endif /*NEW_HYPERSLAB_API*/
@@ -111,6 +126,15 @@ static hbool_t H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span,
H5S_hyper_dim_t span_slab_info[], unsigned rank);
static hbool_t H5S__hyper_rebuild(H5S_t *space);
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Selection properties for hyperslab selections */
const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S_SEL_HYPERSLABS,
@@ -136,6 +160,11 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S__hyper_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for hyperslab selections */
static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{
H5S_SEL_HYPERSLABS,
@@ -153,16 +182,16 @@ static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{
/* Static variables */
/* Arrays for default stride, block, etc. */
-static const hsize_t H5S_hyper_zeros_g[H5O_LAYOUT_NDIMS] = {
+static const hsize_t H5S_hyper_zeros_g[H5S_MAX_RANK] = {
0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0,
0,0,0,0, 0,0,0,0,
- 0,0,0,0, 0,0,0,0,0};
-static const hsize_t H5S_hyper_ones_g[H5O_LAYOUT_NDIMS] = {
+ 0,0,0,0, 0,0,0,0};
+static const hsize_t H5S_hyper_ones_g[H5S_MAX_RANK] = {
1,1,1,1, 1,1,1,1,
1,1,1,1, 1,1,1,1,
1,1,1,1, 1,1,1,1,
- 1,1,1,1, 1,1,1,1,1};
+ 1,1,1,1, 1,1,1,1};
/* Declare a free list to manage the H5S_hyper_sel_t struct */
H5FL_DEFINE_STATIC(H5S_hyper_sel_t);
@@ -261,9 +290,9 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space)
/*-------------------------------------------------------------------------
* Function: H5S__hyper_iter_init
*
- * Purpose: Initializes iteration information for hyperslab span tree selection.
+ * Purpose: Initializes iteration information for hyperslab selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Saturday, February 24, 2001
@@ -334,7 +363,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Check if the regular selection can be "flattened" */
if(cont_dim > 0) {
hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
- unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */
+ hbool_t last_dim_flattened = TRUE; /* Flag to indicate that the last dimension was flattened */
unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */
unsigned curr_dim; /* Current dimension */
int i; /* Index variable */
@@ -351,7 +380,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
acc *= mem_size[i];
/* Indicate that the dimension was flattened */
- last_dim_flattened = 1;
+ last_dim_flattened = TRUE;
} /* end if */
else {
if(last_dim_flattened) {
@@ -369,7 +398,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * (hssize_t)acc;
/* Reset the "last dim flattened" flag to avoid flattened any further dimensions */
- last_dim_flattened = 0;
+ last_dim_flattened = FALSE;
/* Reset the "accumulator" for possible further dimension flattening */
acc = 1;
@@ -414,10 +443,9 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize irregular region information also (for release) */
iter->u.hyp.spans = NULL;
} /* end if */
- else {
+ else { /* Initialize the information needed for non-regular hyperslab I/O */
H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */
-/* Initialize the information needed for non-regular hyperslab I/O */
HDassert(space->select.sel_info.hslab->span_lst);
/* Make a copy of the span tree to iterate over */
iter->u.hyp.spans = H5S__hyper_copy_span(space->select.sel_info.hslab->span_lst);
@@ -459,7 +487,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
@@ -544,7 +572,7 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
@@ -570,7 +598,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
/* Check for a single "regular" hyperslab */
if(iter->u.hyp.diminfo_valid) {
- /* Compute the end of the block */
+ /* Copy the start and compute the end of the block */
for(u = 0; u < iter->rank; u++) {
start[u] = iter->u.hyp.off[u];
end[u] = (start[u] + iter->u.hyp.diminfo[u].block) - 1;
@@ -595,7 +623,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -631,7 +659,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
{
unsigned u; /* Local index variable */
@@ -689,7 +717,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
unsigned ndims; /* Number of dimensions of dataset */
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned i; /* Counters */
+ unsigned u; /* Counters */
FUNC_ENTER_STATIC_NOERR
@@ -697,19 +725,17 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* (i.e. a regular hyperslab selection */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t iter_offset[H5O_LAYOUT_NDIMS];
- hsize_t iter_count[H5O_LAYOUT_NDIMS];
+ hsize_t iter_offset[H5S_MAX_RANK];
+ hsize_t iter_count[H5S_MAX_RANK];
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -718,14 +744,14 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
tdiminfo = iter->u.hyp.diminfo;
/* Calculate the offset and block count for each dimension */
- for(i = 0; i < ndims; i++) {
- if(tdiminfo[i].count == 1) {
- iter_offset[i] = iter->u.hyp.off[i] - tdiminfo[i].start;
- iter_count[i] = 0;
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ iter_offset[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ iter_count[u] = 0;
} /* end if */
else {
- iter_offset[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) % tdiminfo[i].stride;
- iter_count[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) / tdiminfo[i].stride;
+ iter_offset[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
+ iter_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
} /* end else */
} /* end for */
@@ -750,10 +776,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -776,8 +801,8 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
} /* end while */
/* Translate current iter_offset and iter_count into iterator position */
- for(i = 0; i < ndims; i++)
- iter->u.hyp.off[i] = tdiminfo[i].start + (tdiminfo[i].stride * iter_count[i]) + iter_offset[i];
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = tdiminfo[u].start + (tdiminfo[u].stride * iter_count[u]) + iter_offset[u];
} /* end if */
/* Must be an irregular hyperslab selection */
else {
@@ -821,15 +846,13 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -845,10 +868,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -907,22 +929,20 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
FUNC_ENTER_STATIC_NOERR
/* Check for the special case of just one H5Sselect_hyperslab call made */
- /* (i.e. a regular hyperslab selection */
+ /* (i.e. a regular hyperslab selection) */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hsize_t iter_offset[H5O_LAYOUT_NDIMS];
- hsize_t iter_count[H5O_LAYOUT_NDIMS];
+ hsize_t iter_offset[H5S_MAX_RANK];
+ hsize_t iter_count[H5S_MAX_RANK];
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -945,14 +965,12 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
/* Advance one block */
temp_dim = fast_dim; /* Start with the fastest changing dimension */
while(temp_dim >= 0) {
- if(temp_dim == fast_dim) {
+ if(temp_dim == fast_dim)
/* Move iterator over current block */
iter_offset[temp_dim] += tdiminfo[temp_dim].block;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -1001,19 +1019,16 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
curr_span = ispan[curr_dim];
/* Increment absolute position */
- if(curr_dim == fast_dim) {
+ if(curr_dim == fast_dim)
/* Move the iterator over rest of element in span */
abs_arr[curr_dim] = curr_span->high + 1;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -1029,10 +1044,9 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -1063,7 +1077,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_iter_next() */
+} /* end H5S__hyper_iter_next_block() */
/*--------------------------------------------------------------------------
@@ -1404,6 +1418,7 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans)
FUNC_ENTER_STATIC
+ /* Sanity check */
HDassert(spans);
/* Copy the hyperslab span tree */
@@ -1422,23 +1437,24 @@ done:
NAME
H5S__hyper_cmp_spans
PURPOSE
- Check if two hyperslab slabs are the same
+ Check if two hyperslab span trees are the same
USAGE
hbool_t H5S__hyper_cmp_spans(span1, span2)
- H5S_hyper_span_t *span1; IN: First span tree to compare
- H5S_hyper_span_t *span2; IN: Second span tree to compare
+ H5S_hyper_span_info_t *span_info1; IN: First span tree to compare
+ H5S_hyper_span_info_t *span_info2; IN: Second span tree to compare
RETURNS
TRUE (1) or FALSE (0) on success, can't fail
DESCRIPTION
- Compare two hyperslab slabs to determine if they refer to the same
- selection. If span1 & span2 are both NULL, that counts as equal
+ Compare two hyperslab span trees to determine if they refer to the same
+ selection. If span1 & span2 are both NULL, that counts as equal.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hbool_t
-H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2)
+static H5_ATTR_PURE hbool_t
+H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
+ const H5S_hyper_span_info_t *span_info2)
{
hbool_t ret_value = FALSE; /* Return value */
@@ -1610,9 +1626,10 @@ done:
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S__hyper_copy(dst, src)
+ herr_t H5S__hyper_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -2045,7 +2062,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
HDassert(spans);
HDassert(start);
HDassert(end);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(p && pp);
/* Walk through the list of spans, recursing or outputting them */
@@ -2088,7 +2105,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
*p = pp;
FUNC_LEAVE_NOAPI_VOID
-} /* H5S__hyper_serialize_helper() */
+} /* end H5S__hyper_serialize_helper() */
/*--------------------------------------------------------------------------
@@ -2170,8 +2187,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
/* Check for a "regular" hyperslab selection */
else if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
+ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
unsigned ndims; /* Rank of the dataspace */
unsigned u; /* Local counting variable */
@@ -2261,8 +2278,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
} /* end while */
} /* end if */
else {
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
+ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
/* Encode number of hyperslabs */
block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
@@ -2318,8 +2335,8 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
{
unsigned rank; /* Rank of points */
const uint8_t *pp; /* Local pointer for decoding */
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Hyperslab start information */
- hsize_t block[H5O_LAYOUT_NDIMS]; /* Hyperslab block information */
+ hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */
+ hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */
unsigned u; /* Local counting variable */
herr_t ret_value = FAIL; /* Return value */
@@ -2337,8 +2354,8 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
/* If there is an unlimited dimension, only encode opt_unlim_diminfo */
if(flags & H5S_SELECT_FLAG_UNLIM) {
- hsize_t stride[H5O_LAYOUT_NDIMS]; /* Hyperslab stride information */
- hsize_t count[H5O_LAYOUT_NDIMS]; /* Hyperslab count information */
+ hsize_t stride[H5S_MAX_RANK]; /* Hyperslab stride information */
+ hsize_t count[H5S_MAX_RANK]; /* Hyperslab count information */
/* Sanity checks */
HDassert(H5S_UNLIMITED == HSIZE_UNDEF);
@@ -2360,7 +2377,7 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl
else {
const hsize_t *stride; /* Hyperslab stride information */
const hsize_t *count; /* Hyperslab count information */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Hyperslab end information */
+ hsize_t end[H5S_MAX_RANK]; /* Hyperslab end information */
hsize_t *tstart; /* Temporary hyperslab pointers */
hsize_t *tend; /* Temporary hyperslab pointers */
hsize_t *tblock; /* Temporary hyperslab pointers */
@@ -2447,7 +2464,7 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[],
/* Sanity checks */
HDassert(spans);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(start);
HDassert(end);
HDassert(startblock);
@@ -2551,8 +2568,8 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
+ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */
unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
unsigned ndims; /* Rank of the dataspace */
hbool_t done; /* Whether we are done with the iteration */
@@ -2662,8 +2679,8 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo
} /* end while */
} /* end if */
else {
- hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */
+ hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */
ret_value = H5S__hyper_span_blocklist(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &startblock, &numblocks, &buf);
} /* end else */
@@ -2771,7 +2788,7 @@ H5S_hyper_bounds_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offs
HDassert(spans);
HDassert(offset);
- HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(rank < H5S_MAX_RANK);
HDassert(start);
HDassert(end);
@@ -3075,7 +3092,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_is_contiguous(const H5S_t *space)
{
hbool_t small_contiguous, /* Flag for small contiguous block */
@@ -3145,10 +3162,10 @@ H5S__hyper_is_contiguous(const H5S_t *space)
/*
* For a hyperslab to be contiguous, it must have only one block and
- * (either it's size must be the same as the dataspace extent's in all
- * but the slowest changing dimension
- * OR
- * block size must be 1 in all but the fastest changing dimension).
+ * either it's size must be the same as the dataspace extent's in all
+ * but the slowest changing dimension
+ * OR
+ * block size must be 1 in all but the fastest changing dimension.
*/
/* Initialize flags */
large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */
@@ -3260,7 +3277,7 @@ H5S__hyper_is_contiguous(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_is_single(const H5S_t *space)
{
htri_t ret_value = TRUE; /* return value */
@@ -4242,7 +4259,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
* Purpose: Projects a single element hyperslab selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4305,7 +4322,7 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset)
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a lower rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4352,7 +4369,7 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space)
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a higher rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4442,7 +4459,7 @@ done:
* Purpose: Projects a hyperslab selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -4450,7 +4467,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space,
+ hsize_t *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4939,9 +4957,10 @@ done:
DESCRIPTION
Clip one span tree ('a') against another span tree ('b'). Creates span
trees for the area defined by the 'a' span tree which does not overlap the
- 'b' span tree, the area defined by the overlap of the 'a' hyperslab span
- tree and the 'b' span tree, and the area defined by the 'b' hyperslab span
- tree which does not overlap the 'a' span tree.
+ 'b' span tree ("a not b"), the area defined by the overlap of the 'a'
+ hyperslab span tree and the 'b' span tree ("a and b"), and the area defined
+ by the 'b' hyperslab span tree which does not overlap the 'a' span
+ tree ("b not a").
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -5850,12 +5869,12 @@ H5S__hyper_spans_nelem(const H5S_hyper_span_info_t *spans)
Create a span tree
USAGE
H5S_hyper_span_t *H5S__hyper_make_spans(rank, start, stride, count, block)
- unsigned rank; IN: # of dimensions of the space
- const hsize_t *start; IN: Starting location of the hyperslabs
- const hsize_t *stride; IN: Stride from the beginning of one block to
+ unsigned rank; IN: # of dimensions of the space
+ const hsize_t *start; IN: Starting location of the hyperslabs
+ const hsize_t *stride; IN: Stride from the beginning of one block to
the next
- const hsize_t *count; IN: Number of blocks
- const hsize_t *block; IN: Size of hyperslab block
+ const hsize_t *count; IN: Number of blocks
+ const hsize_t *block; IN: Size of hyperslab block
RETURNS
Pointer to new span tree on success, NULL on failure
DESCRIPTION
@@ -6139,7 +6158,7 @@ done:
static hbool_t
H5S__hyper_rebuild(H5S_t *space)
{
- H5S_hyper_dim_t top_span_slab_info[H5O_LAYOUT_NDIMS];
+ H5S_hyper_dim_t top_span_slab_info[H5S_MAX_RANK];
unsigned rank, curr_dim;
hbool_t ret_value = TRUE; /* Return value */
@@ -6201,12 +6220,12 @@ done:
static herr_t
H5S__hyper_generate_spans(H5S_t *space)
{
- hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
- hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t tmp_start[H5S_MAX_RANK]; /* Temporary start information */
+ hsize_t tmp_stride[H5S_MAX_RANK]; /* Temporary stride information */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary count information */
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block information */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -6247,19 +6266,14 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol (split from HS_select_hyperslab()).
+ * Programmer: Quincey Koziol
* Tuesday, September 12, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hsize_t start[],
- const hsize_t stride[],
- const hsize_t count[],
- const hsize_t block[])
+H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
H5S_hyper_span_info_t *a_not_b = NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
@@ -6291,7 +6305,7 @@ H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op,
space->select.num_elem = H5S__hyper_spans_nelem(new_spans);
/* Indicate that the new_spans are owned */
- new_spans=NULL;
+ new_spans = NULL;
} /* end if */
else {
hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
@@ -6500,9 +6514,9 @@ herr_t
H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block)
{
- hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
- hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
- hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
+ hsize_t int_stride[H5S_MAX_RANK]; /* Internal storage for stride information */
+ hsize_t int_count[H5S_MAX_RANK]; /* Internal storage for count information */
+ hsize_t int_block[H5S_MAX_RANK]; /* Internal storage for block information */
const hsize_t *opt_stride; /* Optimized stride information */
const hsize_t *opt_count; /* Optimized count information */
const hsize_t *opt_block; /* Optimized block information */
@@ -6526,9 +6540,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(block == NULL)
block = H5S_hyper_ones_g;
- /*
- * Check new selection.
- */
+ /* Check new selection */
for(u = 0; u < space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
if(count[u] > 1 && stride[u] < block[u])
@@ -6564,7 +6576,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(unlim_dim >= 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot have more than one unlimited dimension in selection")
else {
- if(count[u] == block[u] /* == H5S_UNLIMITED */)
+ if(count[u] == block[u]) /* Both are H5S_UNLIMITED */
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "count and block cannot both be unlimited")
unlim_dim = (int)u;
} /* end else */
@@ -6793,7 +6805,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
/* Patch count and block to remove unlimited and include the
- * existing selection */
+ * existing selection.
+ */
H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1);
HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g));
HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g));
@@ -7193,9 +7206,9 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
const hsize_t count[],
const hsize_t *block)
{
- hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
- hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
- hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
+ hsize_t int_stride[H5S_MAX_RANK]; /* Internal storage for stride information */
+ hsize_t int_count[H5S_MAX_RANK]; /* Internal storage for count information */
+ hsize_t int_block[H5S_MAX_RANK]; /* Internal storage for block information */
const hsize_t *opt_stride; /* Optimized stride information */
const hsize_t *opt_count; /* Optimized count information */
const hsize_t *opt_block; /* Optimized block information */
@@ -7212,11 +7225,11 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Point to the correct stride values */
- if(stride==NULL)
+ if(stride == NULL)
stride = H5S_hyper_ones_g;
/* Point to the correct block values */
- if(block==NULL)
+ if(block == NULL)
block = H5S_hyper_ones_g;
/* Check for unlimited dimension */
@@ -7236,7 +7249,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
*/
for(u=0; u<space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
- if(count[u]>1 && stride[u]<block[u])
+ if(count[u] > 1 && stride[u] < block[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap")
/* Detect zero-sized hyperslabs in new selection */
@@ -7364,10 +7377,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Convert current "all" selection to "real" hyperslab selection */
/* Then allow operation to proceed */
{
- hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
- hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
+ hsize_t tmp_start[H5S_MAX_RANK]; /* Temporary start information */
+ hsize_t tmp_stride[H5S_MAX_RANK]; /* Temporary stride information */
+ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary count information */
+ hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block information */
/* Fill in temporary information for the dimensions */
for(u=0; u<space->extent.rank; u++) {
@@ -7657,9 +7670,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Chao Mei
- * Wednesday, June 29, 2011
- *
*-------------------------------------------------------------------------
*/
static H5S_t *
@@ -7789,8 +7799,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -7892,7 +7900,7 @@ H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
/* Go refine the first selection */
- if (H5S_select_select(space1, op, space2)<0)
+ if(H5S_select_select(space1, op, space2) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection")
done:
@@ -7938,7 +7946,7 @@ H5S__hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter,
{
H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Cumulative size of each dimension in bytes */
+ hsize_t slab[H5S_MAX_RANK]; /* Cumulative size of each dimension in bytes */
hsize_t acc; /* Accumulator for computing cumulative sizes */
hsize_t loc_off; /* Element offset in the dataspace */
hsize_t last_span_end = 0; /* The offset of the end of the last span */
@@ -8358,13 +8366,13 @@ H5S__hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
hsize_t *off, size_t *len)
{
hsize_t *mem_size; /* Size of the source buffer */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
+ hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */
const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
- hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */
- hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
- hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
+ hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */
+ hsize_t tmp_count[H5S_MAX_RANK];/* Temporary block count */
+ hsize_t tmp_block[H5S_MAX_RANK];/* Temporary block offset */
+ hsize_t wrap[H5S_MAX_RANK]; /* Bytes to wrap around at the end of a row */
+ hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
fast_dim_stride,
@@ -8807,9 +8815,9 @@ H5S__hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter,
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
const hssize_t *sel_off; /* Selection offset in dataspace */
hsize_t *mem_size; /* Size of the source buffer */
- hsize_t base_offset[H5O_LAYOUT_NDIMS]; /* Base coordinate offset in dataspace */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
+ hsize_t base_offset[H5S_MAX_RANK]; /* Base coordinate offset in dataspace */
+ hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */
+ hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */
hsize_t fast_dim_block; /* Local copies of fastest changing dimension info */
hsize_t acc; /* Accumulator */
hsize_t loc; /* Coordinate offset */
@@ -8949,8 +8957,8 @@ H5S__hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter,
offset[skip_dim] += tot_blk_count;
} /* end if */
else {
- hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
+ hsize_t tmp_block[H5S_MAX_RANK];/* Temporary block offset */
+ hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */
int temp_dim; /* Temporary rank holder */
/* Set the starting block location */
@@ -9144,7 +9152,7 @@ H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_s
/* Check if we stopped in the middle of a sequence of elements */
if((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)) {
- hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
+ hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */
hsize_t loc; /* Coordinate offset */
hsize_t acc; /* Accumulator */
size_t leftover; /* The number of elements left over from the last sequence */
@@ -9249,11 +9257,10 @@ H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_s
DESCRIPTION
Projects the intersection of of the selections of src_space and
src_intersect_space within the selection of src_space as a selection
- within the selection of dst_space. The result is placed in the
- selection of proj_space. Note src_space, dst_space, and
- src_intersect_space do not need to use hyperslab selections, but they
- cannot use point selections. The result is always a hyperslab
- selection.
+ within the selection of dst_space. The result is placed in the selection
+ of proj_space. Note src_space, dst_space, and src_intersect_space do not
+ need to use hyperslab selections, but they cannot use point selections.
+ The result is always a hyperslab selection.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
@@ -9312,7 +9319,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(dst_space);
HDassert(src_intersect_space);
HDassert(proj_space);
-
+
/* Assert that src_space and src_intersect_space have same extent and there
* are no point selections */
HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
@@ -9475,7 +9482,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
* selection and advance any sequences we complete */
if(ss_off[ss_i] >= sis_off[sis_i])
int_sel_off = ss_sel_off;
- else
+ else
int_sel_off = sis_off[sis_i] - ss_off[ss_i] + ss_sel_off;
if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) <= (sis_off[sis_i]
+ (hsize_t)sis_len[sis_i])) {
@@ -9599,8 +9606,9 @@ loop_end:
/* Set the number of elements in current selection */
proj_space->select.num_elem = H5S__hyper_spans_nelem(proj_space->select.sel_info.hslab->span_lst);
- /* Attempt to rebuild "optimized" start/stride/count/block information.
- * from resulting hyperslab span tree */
+ /* Attempt to build "optimized" start/stride/count/block information
+ * from resulting hyperslab span tree.
+ */
H5S__hyper_rebuild(proj_space);
} /* end if */
else
@@ -9841,7 +9849,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
hsize_t orig_count; /* Original count in unlimited dimension */
int orig_unlim_dim; /* Original unliminted dimension */
H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -10225,7 +10233,7 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
/* Create output space, copy extent */
if(NULL == (space_out = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "unable to create output dataspace")
- if(H5S_extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
+ if(H5S__extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "unable to copy destination space extent")
/* Select block as defined by start/stride/count/block computed above */
@@ -10352,7 +10360,7 @@ H5Sis_regular_hyperslab(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sis_regular_hyperslab() */
+} /* end H5Sis_regular_hyperslab() */
/*--------------------------------------------------------------------------
@@ -10416,5 +10424,5 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[],
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_regular_hyperslab() */
+} /* end H5Sget_regular_hyperslab() */