.\"##
.\" $XConsortium: p038,v 5.3 94/04/17 20:54:39 hersh Exp $
.\"##
.\"## 
$XMCOPY
.\"## Copyright (c) 1990, 1991 by Sun Microsystems, Inc. 
.\"## 
.\"##                         All Rights Reserved
.\"## 
.\"## Permission to use, copy, modify, and distribute this software and its 
.\"## documentation for any purpose and without fee is hereby granted, 
.\"## provided that the above copyright notice appear in all copies and that
.\"## both that copyright notice and this permission notice appear in 
.\"## supporting documentation, and that the name of Sun Microsystems,
.\"## not be used in advertising or publicity 
.\"## pertaining to distribution of the software without specific, written 
.\"## prior permission.  
.\"## 
.\"## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
.\"## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
.\"## EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
.\"## CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
.\"## USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
.\"## OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\"## PERFORMANCE OF THIS SOFTWARE.
.TH "ELEMENT SEARCH" 3P "29 February 1991"
.SH NAME
ELEMENT SEARCH \- search for next matching element in specified structure
.IX "Searching" "ELEMENT SEARCH"
.SH SYNOPSIS
.SS C Syntax
.ft B
.ta 1.25i 3i
.nf
void
pelem_search  (  struct_id, start_el, dir, incl, excl, error_ind, status, found_el  )
Pint	struct_id;	\fIstructure identifier\fP
Pint	start_el;	\fIstarting element pointer\fP
Psearch_dir	dir;	\fIsearch direction\fP
Pelem_type_list	*incl;	\fIelement incl. list\fP
Pelem_type_list	*excl;	\fIelement excl. list\fP
Pint	*error_ind;	\fI\s-2OUT\s+2 error indicator\fP
Psearch_status	*status;	\fI\s-2OUT\s+2 search status\fP
Pint	*found_el;	\fI\s-2OUT\s+2 found element pointer\fP
.fi
.ft R
.SS Required PHIGS Operating States
(PHOP, *, *, *)
.SH DESCRIPTION
.SS Purpose
\s-2ELEMENT SEARCH\s+2
searches the specified structure
for the next element matching the search criteria.
The search starts at the specified element (or the limit of the structure)
and proceeds in the direction specified.
The search terminates if an element is found,
or if the opposite limit of the structure is reached.
.LP
The search criteria is based on element types.
An element satisfies the criteria if
its element type is in the inclusion set,
and \fInot\fP  in the exclusion set.
.SS C Input Parameters
.IP \fIstruct_id\fP
Identifier of the structure 
to search.
.IP \fIstart_el\fP
Position in the specified structure of the first element 
tested against the search criteria.
.IP \fIdir\fP
Search direction.
Psearch_dir is an enumerated type defined in phigs.h to have the following 
values:
.nf
.ta .5i
.sp
	PDIR_BACKWARD
 	PDIR_FORWARD
.fi
.IP \fIincl\fP
A pointer to a Pelem_type_list structure containing
the list of element types in the inclusion set.
.IP
The Pelem_type_list structure and its sub-types are defined in phigs.h as:
.sp .4
.ta .5i +\w'Pelem_type_list 'u +\w'num_elem_types;    'u
.nf
typedef struct {
.sp .2
	Pint    	num_elem_types;	/* number of element types */
	Pelem_type	*elem_types;	/* list of element types */
.sp .2
} Pelem_type_list;
.fi
.IP
The Pelem_type enumeration lists all the supported element types. 
It is enumerated in phigs.h as follows:
.sp .4
.nf
.ta .5i
typedef enum {
.sp .2
    PELEM_ALL,
    PELEM_NIL,
    PELEM_POLYLINE3,
    PELEM_POLYLINE,
    PELEM_POLYMARKER3,
    PELEM_POLYMARKER,
    PELEM_TEXT3,
    PELEM_TEXT,
    PELEM_ANNO_TEXT_REL3,
    PELEM_ANNO_TEXT_REL,
    PELEM_FILL_AREA3,
    PELEM_FILL_AREA,
    PELEM_FILL_AREA_SET3,
    PELEM_FILL_AREA_SET,
    PELEM_CELL_ARRAY3,
    PELEM_CELL_ARRAY,
    PELEM_GDP3,
    PELEM_GDP,
    PELEM_LINE_IND,
    PELEM_MARKER_IND,
    PELEM_TEXT_IND,
    PELEM_INT_IND,
    PELEM_EDGE_IND,
    PELEM_LINETYPE,
    PELEM_LINEWIDTH,
    PELEM_LINE_COLR_IND,
    PELEM_MARKER_TYPE,
    PELEM_MARKER_SIZE,
    PELEM_MARKER_COLR_IND,
    PELEM_TEXT_FONT,
    PELEM_TEXT_PREC,
    PELEM_CHAR_EXPAN,
    PELEM_CHAR_SPACE,
    PELEM_TEXT_COLR_IND,
    PELEM_CHAR_HT,
    PELEM_CHAR_UP_VEC,
    PELEM_TEXT_PATH,
    PELEM_TEXT_ALIGN,
    PELEM_ANNO_CHAR_HT,
    PELEM_ANNO_CHAR_UP_VEC,
    PELEM_ANNO_PATH,
    PELEM_ANNO_ALIGN,
    PELEM_ANNO_STYLE,
    PELEM_INT_STYLE,
    PELEM_INT_STYLE_IND,
    PELEM_INT_COLR_IND,
    PELEM_EDGE_FLAG,
    PELEM_EDGETYPE,
    PELEM_EDGEWIDTH,
    PELEM_EDGE_COLR_IND,
    PELEM_PAT_SIZE,
    PELEM_PAT_REF_POINT_VECS,
    PELEM_PAT_REF_POINT,
    PELEM_ADD_NAMES_SET,
    PELEM_REMOVE_NAMES_SET,
    PELEM_INDIV_ASF,
    PELEM_HLHSR_ID,
    PELEM_LOCAL_MODEL_TRAN3,
    PELEM_LOCAL_MODEL_TRAN,
    PELEM_GLOBAL_MODEL_TRAN3,
    PELEM_GLOBAL_MODEL_TRAN,
    PELEM_MODEL_CLIP_VOL3,
    PELEM_MODEL_CLIP_VOL,
    PELEM_MODEL_CLIP_IND,
    PELEM_RESTORE_MODEL_CLIP_VOL,
    PELEM_VIEW_IND,
    PELEM_EXEC_STRUCT,
    PELEM_LABEL,
    PELEM_APPL_DATA,
    PELEM_GSE,
    PELEM_PICK_ID,
    PELEM_POLYLINE_SET3_DATA,
    PELEM_FILL_AREA_SET3_DATA,
    PELEM_TRI_STRIP3_DATA,
    PELEM_QUAD_MESH3_DATA,
    PELEM_SET_OF_FILL_AREA_SET3_DATA,
    PELEM_NUNI_BSP_CURVE,
    PELEM_NUNI_BSP_SURF,
    PELEM_CELL_ARRAY3_PLUS,
    PELEM_TEXT_COLR,
    PELEM_MARKER_COLR,
    PELEM_EDGE_COLR,
    PELEM_LINE_COLR,
    PELEM_CURVE_APPROX_CRIT,
    PELEM_LINE_SHAD_METH,
    PELEM_INT_COLR,
    PELEM_BACK_INT_COLR,
    PELEM_BACK_INT_STYLE,
    PELEM_BACK_INT_STYLE_IND,
    PELEM_REFL_PROPS,
    PELEM_BACK_REFL_PROPS,
    PELEM_INT_SHAD_METH,
    PELEM_BACK_INT_SHAD_METH,
    PELEM_INT_REFL_EQN,
    PELEM_BACK_INT_REFL_EQN,
    PELEM_SURF_APPROX_CRIT,
    PELEM_FACE_DISTING_MODE,
    PELEM_FACE_CULL_MODE,
    PELEM_LIGHT_SRC_STATE,
    PELEM_DCUE_IND,
    PEL_COLR_MAPPING_IND,
    PELEM_RENDERING_COLR_MODEL,
    PELEM_NUM_EL_TYPES
.sp .2
} Pelem_type;
.fi
.IP \fIexcl\fP
A pointer to a \fIPelem_type_list\fP structure containing
the list of element types in the exclusion set.  Pelem_type_list
is defined above. 
Excluding all element types will result in failure to find matching elements.
.SS C Output Parameters
.IP \fIerror_ind\fP
A pointer to the location to store the error number of any error
detected by this function.
.IP \fIstatus\fP
A pointer to the location to store the search status.
Psearch_status is an enumerated type defined in phigs.h to have
the following values:
.nf
.ta .5i
.sp
	PSEARCH_STATUS_FAILURE
	PSEARCH_STATUS_SUCCESS
.fi
.IP \fIfound_el\fP
A pointer to the location to store the position of the element found.
If status is \s-2PSEARCH_STATUS_FAILURE\s+2, \fIfound_el\fP is undefined.
.SS Execution
If the start element position is less than zero,
the search begins at element position zero,
whose element type is considered \s-2NIL\s+2.
If the start element position is greater than
the number of elements in the structure,
the search begins at the last element in the open structure.
Otherwise, the search starts at the specified element.
.LP
If this element satisfies the search criteria,
the element position is returned along with a status indicator of success.
Otherwise the next element in the direction specified is considered.
The search will continue until either an element fulfills the search
criteria or the far end of the structure is reached.  If the search is 
unsuccessful, then a status indicator of failure is returned.
.LP
The current element pointer and currently open structure (if any)
are not used, and are unaffected.
.SH ERRORS
.IP 002
Ignoring function, function requires state (\s-2PHOP, *, *, *\s+2)
.IP 201
Ignoring function, the specified structure does not exist
.SH SEE ALSO
.nf
.IP
.ta 0.5i
.SM "LABEL (3P)"
.SM "INQUIRE ELEMENT POINTER (3P)"
.SM "INCREMENTAL SPATIAL SEARCH (3P)"
.fi
