Up: GEOS SDK TechDocs | Up | Prev: ECVMCheckVMBlockHandle() ... | Next: ElementArrayRemoveReference() ...

ElementArrayDelete()

void	ElementArrayDelete(
        optr	arr,					/* optr to element array */
        word	token);					/* index of element to delete */

This routine deletes an element from an element array regardless of its reference count. The routine is passed the element array's optr and the token for the element to delete.

Note that when an element is removed, it is actually resized down to zero size and added to a list of free elements. That way the index numbers of later elements are preserved.

Include: chunkarr.h

Be Sure To: Lock the block on the global heap before calling (unless it is fixed).

See Also: ElementArrayRemoveReference().

ElementArrayDeleteHandles()

void	ElementArrayDeleteHandles(
        MemHandle		mh,				/* Handle of LMem heap */
        ChunkHandle		ch,				/* Chunk handle of element array */
        word		token);				/* Index of element delete */

This routine is exactly like ElementArrayDelete() above, except that the element array is specified by its global and chunk handles (instead of with an optr).

Include: chunkarr.h

Be Sure To: Lock the block on the global heap before calling (unless it is fixed).

See Also: ElementArrayRemoveReference().

ElementArrayElementChanged()

void	ElementArrayElementChanged(
        optr	arr,				/* optr to element array */
        word	token,				/* Index number of element */
        dword	callbackData,				/* This is passed along to callback */
        Boolean _pascal (*callback)			/* Returns true if elements identical */
        		(void *			elementChanged,
        		 void *			elementToCompare,
        		 dword			valueForCallback));

This routine checks to see if an element is identical to any other elements in the same element array. This is used after an element has changed to see if it now matches another element. If the element matches another, it will be deleted, and the other element will have its reference count incremented.

The routine is passed an optr to the element array, the token of the element which is being checked, a dword of data (which is passed to the callback routine), and a pointer to a callback comparison routine. The callback routine itself is passed pointers to two elements and the callbackData argument passed to ElementArrayElementChanged() . The callback routine should be declared _pascal. If the two elements are identical, the callback should return true (i.e. non-zero); otherwise, it should return false .

If you pass a null function pointer, ElementArrayElementChanged() will do a bytewise comparison of the elements.

Include: chunkarr.h

ElementArrayElementChangedHandles()

void	ElementArrayElementChangedHandles(
        MemHandle		memHandle,				/* Handle of LMem heap's block */
        ChunkHandle		chunkHandle,				/* Chunk handle of element array */
        word		token,				/* Index number of element */
        dword		callbackData,					/* This is passed along to
							 * callback */
        Boolean _pascal (*callback)			/* Returns true if elements identical */
        		(void *			elementChanged,
        		 void *			elementToCompare,
        		 dword			valueForCallback));

This routine is exactly like ElementArrayElementChanged() above, except that the element array is specified by its global and chunk handles (instead of with an optr).

Include: chunkarr.h

ElementArrayGetUsedCount()

word	ElementArrayGetUsedCount(
        optr	arr,			/* optr to element array */
        dword	callbackData,			/* This is passed to callback routine */
        Boolean _pascal (*callback)				/* return true to count this element */
        		(void * element, dword cbData));

This routine counts the number of active elements in an element array; that is, elements which have a reference count of one or greater. It can be instructed to count every element, or every element which matches certain criteria. The routine is passed three parameters: the optr of the chunk array, a dword which is passed to the callback routine, and a callback routine which determines whether the element should be counted. The callback routine,which should be declared _pascal, is passed the dword an a pointer to an element. It should return true if the element should be counted; otherwise, it should return false . To count every element, pass a null callback pointer.

Include: chunkarr.h

See Also: ElementArrayTokenToUsedIndex(), ElementArrayUsedIndexToToken().

ElementArrayGetUsedCountHandles()

void	ElementArrayGetUsedCountHandles(
        MemHandle 		mh,			/* Handle of LMem heap's block */
        ChunkHandle		ch,			/* Chunk handle of element array */
        dword	callbackData,			/* This is passed to callback routine */
        Boolean _pascal (*callback)				/* return true to count this element */
        		(void * element, dword cbData));

This routine is exactly like ElementArrayGetUsedCount() above, except that the element array is specified by its global and chunk handles (instead of with an optr).

Include: chunkarr.h


Up: GEOS SDK TechDocs | Up | Prev: ECVMCheckVMBlockHandle() ... | Next: ElementArrayRemoveReference() ...