Important: The information in this document is obsolete and should not be used for new development.
MyMatchFunction
A match function must have the following syntax:
FUNCTION MyMatchFunction (cellDataPtr, searchDataPtr: Ptr; cellDataLen, searchDataLen: Integer) : Integer;
cellDataPtr
A pointer to the data contained in a cell.searchDataPtr
A pointer to the data being searched for.cellDataLen- The number of bytes of data contained in the cell specified by the
cellDataPtrparameter.searchDataLen
The number of bytes of data contained in the cell specified by thesearchDataPtrparameter.DESCRIPTION
A custom match function must compare the data defined by thecellDataPtrandcellDataLenparameters with the data defined by thesearchDataPtrandsearchDataLenparameters. If the cell data matches the search data, your match function should return 0. Otherwise, your match function should return 1.Your match function can use any technique you choose to compare the data. For example, your match function might consider the search data to be equivalent to the cell data if both are the same length. Or, your match function might only report a match if the search data can be found somewhere within the cell data.
The default match function,
IUMagIDString, returns 0 if the search data exactly matches the cell data, butIUMagIDStringconsiders the strings'Rose'and'rosé'to be equivalent. If your application simply needs a match function that works likeIUMagIDStringbut considers'Rose'to be different from'rosé', you do not need to write a custom match function. Instead, your application can simply pass@IUMagStringas the third parameter to theLSearchfunction.SPECIAL CONSIDERATIONS
A custom match function does not execute at interrupt time. Instead, it is called directly by theLSearchfunction. Thus, a match function can allocate memory, and it does not need to adjust the value contained in the A5 register.SEE ALSO
For information on theIUMagIDStringfunction and theIUMagStringfunction, see Inside Macintosh: Operating System Utilities.For examples of match functions, see "Searching a List for a Particular Item" beginning on page 4-34.