At 10:40 AM -0800 1999/03/22, Michael S. Davis wrote:
>So that would mean that the Compare functions would have to have
>a specified parameter format? Where is that format (of the compare
>function) parameters list defined?
Looking up DmQuickSort in the manual says...
"The comparison function, compar, accepts two arguments, elem1
and elem2, each a pointer to an entry in the table. The comparison
function compares each of the pointed-to items (*elem1 and
*elem2), and returns an integer based on the result of the
comparison."
Seems simple enough, but it doesn't fully describe the comparison routine. Huh. Guess
the docs could use a bit more detail...
Looking for DmComparF in DataMgr.h we find:
typedef Int DmComparF (void *, void *, Int other,
SortRecordInfoPtr, SortRecordInfoPtr,
VoidHand appInfoH);
The first two 'void *' params are pointers to the records to be compared.
The 'other' param is an integer value passed from DmQuickSort or DmInsertionSort down
into the comparison function (usually this is used to indicate a sort direction).
The next two 'SortRecordInfoPtr' params are pointers to the sort info of the two
records (structs containing the record's attributes and uniqueID).
The last param 'appInfoH' is the app info handle of the database being sorted.
The comparison function must return -1 if the first 'void *' is less than the second
'void *', 0 if they're both equivalent, or 1 if the second 'void *' is greater than
the first 'void *'.
Hope that helps!
Regards,
Jim Schram
3Com/Palm Computing
Partner Engineering