19 #define MIN_ATTRLIST_SIZE ( ( 7 * sizeof( int ) ) + \
20 ( 2 * sizeof( void * ) ) )
49 assert( attributePtr == NULL || \
54 if( attributePtr == NULL )
70 if( prevPtr == NULL || prevGroupID != groupID )
76 attributePtr = prevPtr;
78 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
80 return( (
void * ) attributePtr );
90 assert( attributePtr == NULL || \
95 if( attributePtr == NULL )
112 if( nextPtr == NULL || nextGroupID != groupID )
118 attributePtr = nextPtr;
120 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
122 return( (
void * ) attributePtr );
128 void *attributeFind(
IN_OPT const void *attributePtr,
135 assert( attributePtr == NULL || \
142 if( attributePtr == NULL )
150 for( iterationCount = 0;
151 attributePtr != NULL && currAttributeID != attributeID && \
156 &currAttributeID, NULL,
159 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
161 return( (
void * ) attributePtr );
170 void *attributeFindEx(
IN_OPT const void *attributePtr,
182 assert( attributePtr == NULL || \
202 if( attributePtr == NULL )
214 for( iterationCount = 0;
215 attributePtr != NULL && currGroupID != groupID && \
222 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
224 return( (
void * ) attributePtr );
232 for( iterationCount = 0;
233 attributePtr != NULL && currAttributeID != attributeID && \
238 &currAttributeID, NULL,
241 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
242 if( attributePtr == NULL )
250 for( iterationCount = 0;
251 attributePtr != NULL && currAttributeID == attributeID && \
255 if( currInstanceID == instanceID )
256 return( (
void * ) attributePtr );
258 &currAttributeID, &currInstanceID,
261 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
271 void *attributeFindNextInstance(
IN_OPT const void *attributePtr,
278 assert( attributePtr == NULL || \
283 if( attributePtr == NULL )
294 if( attributePtr == NULL )
303 for( iterationCount = 0; \
304 attributePtr != NULL && currGroupID == groupID && \
308 if( currAttributeID == attributeID )
309 return( (
void * ) attributePtr );
311 &currAttributeID, NULL,
314 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
335 static
const void *moveCursorByGroup(
const void *currentCursor,
342 const void *newCursor = currentCursor, *lastCursor = NULL;
352 for( iterationCount = 0; \
353 count-- > 0 && newCursor != NULL && \
357 lastCursor = newCursor;
363 newCursor = attributeFindStart( newCursor, getAttrFunction );
364 if( newCursor != NULL )
367 if( newCursor != NULL )
368 newCursor = attributeFindStart( newCursor, getAttrFunction );
377 newCursor = attributeFindEnd( newCursor, getAttrFunction );
378 if( newCursor != NULL )
383 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
388 if( newCursor == NULL )
396 attributeFindStart( lastCursor, getAttrFunction ) : NULL );
416 static
const void *moveCursorByAttribute(
const void *currentCursor,
425 const void *newCursor = currentCursor;
443 const void *prevCursor;
447 for( iterationCount = 0; \
448 count-- > 0 && prevCursor != NULL && prevGroupID == groupID && \
452 newCursor = prevCursor;
457 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
462 const void *nextCursor;
469 for( iterationCount = 0; \
470 count-- > 0 && nextCursor != NULL && nextGroupID == groupID && \
474 newCursor = nextCursor;
479 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
482 if( !absMove && !cursorMoved )
488 static
const void *moveCursorByInstance(
const void *currentCursor,
497 const void *newCursor = currentCursor;
516 const void *prevCursor;
519 &prevAttrID, &prevInstID,
521 for( iterationCount = 0; \
522 count-- > 0 && prevCursor != NULL && prevGroupID == groupID && \
523 prevAttrID == attributeID && prevInstID == instanceID && \
527 newCursor = prevCursor;
529 &prevAttrID, &prevInstID,
533 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
538 const void *nextCursor;
544 &nextAttrID, &nextInstID,
546 for( iterationCount = 0; \
547 count-- > 0 && nextCursor != NULL && nextGroupID == groupID && \
548 nextAttrID == attributeID && nextInstID == instanceID && \
552 newCursor = nextCursor;
554 &nextAttrID, &nextInstID,
558 ENSURES_N( iterationCount < FAILSAFE_ITERATIONS_MAX );
561 if( !absMove && !cursorMoved )
569 const
void *attributeMoveCursor(
IN_OPT const void *currentCursor,
575 const int cursorMoveType )
581 static const MOVECODE_MAP_INFO moveCodeMap[] = {
594 assert( currentCursor == NULL || \
605 if( currentCursor == NULL )
612 moveCodeMap[ i ].moveCode != cursorMoveType && \
613 moveCodeMap[ i ].moveCode != 0 && \
617 ENSURES_N( moveCodeMap[ i ].moveCode != 0 );
618 moveType = moveCodeMap[ i ].cursorMoveType;
626 switch( attributeMoveType )
629 return( moveCursorByGroup( currentCursor, getAttrFunction,
630 moveType, count, absMove ) );
633 return( moveCursorByAttribute( currentCursor, getAttrFunction,
634 moveType, count, absMove ) );
637 return( moveCursorByInstance( currentCursor, getAttrFunction,
638 moveType, count, absMove ) );