Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 6 - Script Manager / Script Manager Reference
Routines / Analyzing Characters


FillParseTable

The FillParseTable function helps your application to quickly process a buffer of mixed 1-byte and 2-byte characters. It returns a 256-byte table that distinguishes the character codes of all possible 1-byte characters from the first (high-order) byte values of all possible 2-byte characters in the specified script system.

FUNCTION FillParseTable (VAR table: CharByteTable; 
                         script: ScriptCode): Boolean;
table
A 256-byte table to be filled in by FillParseTable.
script
A value that specifies the script system the parse table belongs to. Constants for all defined script codes are listed on page 6-52. To specify the font script, pass smCurrentScript in this parameter.
DESCRIPTION
Before calling FillParseTable, allocate space for a 256-byte table to pass to the function in the table parameter.

The information returned by FillParseTable is a packed array defined by the CharByteTable data type as follows:

CharByteTable = PACKED ARRAY[0..255] OF SignedByte;
In every script system, 2-byte characters have distinctive high-order (first) bytes that allow them to be distinguished from 1-byte characters. FillParseTable fills a 256-byte table, conceptually equivalent to a 1-byte character-set table, with values that indicate, byte-for-byte, whether the character-code value represented by that byte index is the first byte of a 2-byte character. An entry in the CharByteTable is 0 for a 1-byte character and 1 for the first byte of a 2-byte character.

If your application is processing mixed characters, it can use the table to identify the locations of the 2-byte characters as it makes a single pass through the text, rather than having to call CharacterByteType or CharacterType for each byte of the text buffer in turn. CharacterByteType and CharacterType start anew at the beginning of the text buffer each time they are called, tracking character positions up to the offset of the byte to be analyzed.

SPECIAL CONSIDERATIONS
FillParseTable may move memory; your application should not call this function at interrupt time.

The table defined by CharByteTable is not dynamic; it does not get updated when the current font changes. You need to call it separately for each script run in your text.

The return value from FillParseTable is always TRUE.

If you specify smCurrentScript for the script parameter, the value returned by FillParseTable can be affected by the state of the font force flag. It is unaffected by the international resources selection flag.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996