GEOS SDK TechDocs
|
|
ChunkArrayGetCountHandles() ...
|
ClipboardClearQuickTransferNotification() ...
void ChunkArraySort(
optr array, /* optr to chunk array */
word valueForCallback, /* Passed to callback routine */
sword _pascal (*callback) (void *el1,
void * el2,
word valueForCallback))
/* Sign of return value decides order of elements */
This is a general-purpose sort routine for chunk arrays. It does a modified Quicksort on the array, using an insertion sort for subarrays below a certain size.
The sort routine does not compare elements. Rather, it calls a comparison callback routine passed in the
callback
parameter. Whenever it needs to compare two elements, it calls the callback routine, passing the addresses of the elements and the
valueForCallback
word which was passed to
ChunkArraySort()
. The callback routine should be declared _pascal. The callback routine's return value determines which element will come first in the sorted array:
el1
ought to come before
el2
in the sorted array, the callback routine should return a negative integer.
el1
ought to come after
el2
in the sorted array, the callback routine should return a positive integer.
el1
comes before or after
el2
in the sorted array, the callback routine should return zero.Include: chunkarr.h
Tips and Tricks: You may need to sort an array based on different criteria at different times. The simplest way to do this is to write one general-purpose callback routine and have the
valueForCallback
word determine how the sort is done. For example, the same callback routine could sort the array in ascending or descending order, depending on the
valueForCallback
.
Be Sure To: Lock the block on the global heap (unless it is fixed).
Warnings: Do not have the callback routine do anything which might invalidate pointers to the array (such as allocate a new chunk or element).
See Also: ArrayQuickSort().
void ChunkArraySortHandles(
MemHandle memHandle, /* Handle of LMem heap's block */
ChunkHandle chunkHandle, /* Handle chunk array */
word valueForCallback, /* Passed to callback routine */
sword _pascal(*callback)(void *el1, void * el2, word valueForCallback)
/* Sign of return value decides order of elements */
This routine is exactly like
ChunkArraySort()
above, except that the chunk array is specified by its global and chunk handles (instead of by an optr).
Include: chunkarr.h
void ChunkArrayZero(
optr array); /* optr to chunk array */
This routine destroys all the elements in an array. It does not affect the extra-space area between the
ChunkArrayHeader
and the elements. It is guaranteed not to cause heap compaction or resizing; thus, pointers to other chunks remain valid.
Include: chunkarr.h
Be Sure To: Lock the block on the global heap (unless it is fixed).
See Also: ChunkArrayDelete().
void ChunkArrayZeroHandles(
MemHandle mh /* Global handle of LMem heap */
ChunkHandle ch); /* Chunk handle of chunk array */
This routine is exactly like
ChunkArrayZero()
above, except that the chunk array is specified by its global and chunk handles (instead of by an optr).
Include: chunkarr.h
void ClipboardAbortQuickTransfer(void);
This routine cancels a quick-transfer operation in progress. It is typically used when an object involved in a quick-transfer is shutting down or when an error occurs in a quick-transfer. This routine is usually used only by the object or Process which initiated the quick-transfer.
Include: clipbrd.goh
void ClipboardAddToNotificationList(
optr notificationOD);
This routine registers the passed object or process for quick-transfer notification. This routine is typically called from within an object's
MSG_META_INITIALIZE
handler or within a Process object's
MSG_GEN_PROCESS_OPEN_APPLICATION
handler. Pass the optr of the object or the geode handle if the Process object should be registered.
Include: clipbrd.goh
See Also: ClipboardRemoveFromNotificationList().
GEOS SDK TechDocs
|
|
ChunkArrayGetCountHandles() ...
|
ClipboardClearQuickTransferNotification() ...