Important: The information in this document is obsolete and should not be used for new development.
FindWordBreaks
TheFindWordBreaksprocedure determines the beginning and ending boundaries of a word in a text string.
PROCEDURE FindWordBreaks(textPtr: Ptr; textLength: Integer; offset: Integer; leadingEdge: Boolean; nbreaks: BreakTablePtr; VAR offsets: OffsetTable; script: ScriptCode);
textPtr- A pointer to the text string to be examined.
textLength- The number of bytes in the text string.
offset- A byte offset into the text. This parameter plus the
leadingEdgeparameter determine the position of the character at which to start
the search.leadingEdge- A flag that specifies which character should be used to start the search. If
leadingEdgeisTRUE, the search starts with the character specified in theoffsetparameter; if it isFALSE, the search starts with the character previous to the offset.nbreaks- A pointer to a word-break table of type
NBreakTableorBreakTable.
If the value of this pointer is 0, the default word-break table of the script system specified by thescriptparameter is used. If the value of
this pointer is -1, the default line-break table of the specified script
system is used.offsets- On output, the values in this table indicate the boundaries of the word that has been found.
script- The script code for the script system whose tables are used to determine where word boundaries occur.
DESCRIPTION
FindWordBreakssearches for a word in a text string. ThetextPtrandtextLengthparameters specify the text string that you want searched. Theoffsetparameter andleadingEdgeparameter together indicate where the search begins.If
leadingEdgeisTRUE, the search starts at the character at theoffset. IfleadingEdgeisFALSE, the search starts at the character preceding theoffsetposition.
FindWordBreakssearches backward through the text string for one of the word boundaries and forward through the text string for its other boundary. It uses the definitions in the table specified bynbreaksto determine what constitutes the boundaries of a word. Each script system's word-break table is part of its string-manipulation ('itl2') resource. The format of theNBreakTablerecord is described in the appendix "International Resources" in this book.
FindWordBreaksreturns its results in anOffsetTablerecord, the format of which is described in the section "The Offset Table Record" on page 5-44.FindWordBreaksuses only the first element of this three-element table. Each element is a pair of integers:offFirstandoffSecond.
FindWordBreaksplaces the offset from the beginning of the text string to just before the leading edge of the character of the word that it finds in theoffFirstfield.
FindWordBreaksplaces the offset from the beginning of the text string to just after the trailing edge of the last character of the word that it finds in theoffSecondfield. For example, if the text "This is it" is passed withoffsetset to 0 andleadingEdgeset toTRUE, thenFindWordBreaksreturns the offset pair (0,4).If
leadingEdgeisTRUEand the value ofoffsetis 0, thenFindWordBreaksreturns the offset pair (0,0). IfleadingEdgeisFALSEand the value ofoffsetequals the value oftextLength, thenFindWordBreaksreturns the offset pair with values (textLength,textLength).ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theFindWordBreaksprocedure are
Trap macro Selector _ScriptUtil $C012 001A