Important: The information in this document is obsolete and should not be used for new development.
TextOrder
TheTextOrderfunction compares two text strings, taking into account the script and language for each of the strings. It takes both primary and secondary sorting orders into consideration and returns a value that indicates whether the first string is less than, equal to, or greater than the second string.
FUNCTION TextOrder (aPtr, bPtr: Ptr; aLen, bLen: Integer; aScript, bScript: ScriptCode; aLang, bLang: LangCode): Integer;
aPtr- A pointer to the first character of the first text string.
bPtr- A pointer to the first character of the second text string.
aLen- The number of bytes in the first text string.
bLen- The number of bytes in the second text string.
aScript- The script code for the first text string.
bScript- The script code for the second text string.
aLang- The language code for the first text string.
bLang- The language code for the second text string.
DESCRIPTION
TextOrderreturns -1 if the first string is less than the second string, 0 if the first string is equal to the second string, and 1 if the first string is greater than the second string. The ordering of script and language codes, which is based on information in the script-sorting resource, is considered in determining the relationship of the two strings.Script code values and explicit language code values are listed in the chapter "Script Manager"; implicit language codes are listed in Table 5-13 on page 5-55 of this chapter. Most applications specify the language code
scriptCurLangfor both theaLangandbLangvalues.
TextOrderfirst callsScriptOrder; if the result ofScriptOrderis not 0 (that is, if the strings use different scripts),TextOrderreturns the same result.
TextOrdernext callsLanguageOrder; if the result ofLanguageOrderis not 0 (that is, if the strings use different languages),TextOrderreturns the same result.At this point,
TextOrderhas two strings that are in the same script and language, so it compares them by using the sorting rules for that script and language, applying both the primary and secondary sorting orders. If that script is not installed and enabled (as described in the chapter "Script Manager" in this book), it uses the sorting rules specified by the system script or the font script, depending on the state of the international resources selection flag. See the section "Obtaining Resource Information," beginning on page 5-4.The
TextOrderfunction is primarily used to insert text strings in a sorted list; for sorting, rather than using this function, it may be faster to sort first by script and language by using theScriptOrderandLanguageOrderfunctions, and then to call theCompareTextfunction, described on page 5-63, to sort strings within a script or language group.SPECIAL CONSIDERATIONS
TextOrdermay move memory; your application should not call this function at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theTextOrderfunction are
Trap macro Selector _Pack6 $0022