summaryrefslogtreecommitdiffstats
path: root/src/H5Spoint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-01-21 22:42:51 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-01-21 22:42:51 (GMT)
commita919e43254cfece73ef3683540048399de055ef7 (patch)
treedbfc5c9577a83a64938ddeddc7803bb286f225d1 /src/H5Spoint.c
parent83a7d959c022afd504fd7ce74408278dfcc9d81a (diff)
downloadhdf5-a919e43254cfece73ef3683540048399de055ef7.zip
hdf5-a919e43254cfece73ef3683540048399de055ef7.tar.gz
hdf5-a919e43254cfece73ef3683540048399de055ef7.tar.bz2
[svn-r1944] Added "H5S_SELECT_PREPEND" and "H5S_SELECT_APPEND" operations to point
selections. Also fixed bug which was not allowing the "start_point" parameter to H5Sget_select_elem_pointlist to actually get used. It was always returning a list of points selected which started with the beginning of the list of points.
Diffstat (limited to 'src/H5Spoint.c')
-rw-r--r--src/H5Spoint.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 7e17323..19d991f 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -124,7 +124,7 @@ H5S_point_init (const struct H5O_layout_t UNUSED *layout,
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t H5S_point_add (H5S_t *space, size_t num_elem, const hssize_t **_coord)
+herr_t H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t **_coord)
{
H5S_pnt_node_t *top, *curr, *new; /* Point selection nodes */
const hssize_t *coord=(const hssize_t *)_coord; /* Pointer to the actual coordinates */
@@ -136,6 +136,7 @@ herr_t H5S_point_add (H5S_t *space, size_t num_elem, const hssize_t **_coord)
assert(space);
assert(num_elem>0);
assert(coord);
+ assert(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND);
#ifdef QAK
printf("%s: check 1.0\n",FUNC);
@@ -186,12 +187,24 @@ herr_t H5S_point_add (H5S_t *space, size_t num_elem, const hssize_t **_coord)
printf("%s: check 2.0\n",FUNC);
#endif /* QAK */
- /* Append current list, if there is one */
- if(space->select.sel_info.pnt_lst->head!=NULL)
- curr->next=space->select.sel_info.pnt_lst->head;
+ /* Insert the list of points selected in the proper place */
+ if(op==H5S_SELECT_SET || op==H5S_SELECT_PREPEND) {
+ /* Append current list, if there is one */
+ if(space->select.sel_info.pnt_lst->head!=NULL)
+ curr->next=space->select.sel_info.pnt_lst->head;
- /* Put new list in point selection */
- space->select.sel_info.pnt_lst->head=top;
+ /* Put new list in point selection */
+ space->select.sel_info.pnt_lst->head=top;
+ }
+ else { /* op==H5S_SELECT_APPEND */
+ new=space->select.sel_info.pnt_lst->head;
+ if(new!=NULL)
+ while(new->next!=NULL)
+ new=new->next;
+
+ /* Append new list to point selection */
+ new->next=top;
+ }
/* Add the number of elements in the new selection */
space->select.num_elem+=num_elem;