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 /
Appendix B - International Resources / Tokens Resource (Type 'itl4')


The Number Parts Table

The number parts table contains standard representations for the components of numbers and numeric strings. The Text Utilities number-formatting routines StringToExtended and ExtendedToString use the number parts table, along with a number-format string created by the StringToFormatRec and FormatRecToString routines, to create number strings in localized formats.

The NumberParts data type defines the number parts table:

TYPE NumberParts = 
   RECORD
      version:       Integer;             {version of this table}
      data:          ARRAY[1..31] OF WideChar;  
                                          {2-byte number parts}
      pePlus:        WideCharArr;         {positive exp. notation}
      peMinus:       WideCharArr;         {negative exp. notation}
      peMinusPlus:   WideCharArr;         {neg. or pos. exp.}
      altNumTable:   WideCharArr;         {alternate digits}
      reserved: PACKED ARRAY[0..19] OF Char;    
                                          {reserved}
   END;
TYPE NumberPartsPtr = ^NumberParts;
version
An integer that specifies which version of the number parts table is being used. A value of 1 specifies the first version.
data
An array of 31 wide characters (2 bytes each), indexed by a set of constants. Each element of the array, accessed by one of the constants, contains 1 or 2 bytes that make up that number part. (If the element contains only one 1-byte character, it is in the low-order byte and the high-order byte contains 0.) Each number part, then, may consist of one or two 1-byte characters, or a single 2-byte character.
Of the 31 allotted spaces, 15 through 31 are reserved for up to 17 unquoted characters--special literals that do not need to be enclosed in quotes in a numeric string. See the discussion of number formatting in the chapter "Text Utilities" in this book for more information.
These are the defined constants for accessing number parts in the data array:
 ConstantValueExplanation
 tokLeftQuote 1Left quote
 tokRightQuote 2Right quote
 tokLeadPlacer 3Spacing leader format marker
 tokLeader 4Spacing leader character
 tokNonLeader 5No leader format marker
 tokZeroLead 6Zero leader format marker
 tokPercent 7Percent
 tokPlusSign 8Plus
 tokMinusSign 9Minus
 tokThousands10Thousands separator
  11(reserved)
 tokSeparator12List separator
 tokEscape13Escape character
 tokDecPoint14Decimal separator
 tokUnquoteds15(first unquoted character)
   (15 through 31 reserved)
 tokMaxSymbols31Maximum symbol (for range check)
IMPORTANT
Note that these constants are unrelated to the token-type constants defined for the IntlTokenize function.
pePlus
An array that specifies how to represent positive exponents for scientific notation. It is a wide character array, an 11-word data structure defined by the WideCharArr data type. It contains up to ten 1-byte or 2-byte number parts for representing positive exponents.
peMinus
An array that specifies how to represent negative exponents for scientific notation. It is a wide character array, an 11-word array defined by the WideCharArr data type. It contains up to ten 1-byte or 2-byte number parts for representing negative exponents.
peMinusPlus
An array that specifies how to represent positive exponents for scientific notation when the format string exponent is negative. Symbols from this array can be used with the input number string to the StringToExtended function; they are not for use with the StringToFormatRec function. The array is a wide character array, an 11-word array defined by the WideCharArr data type. It contains up to ten 1-byte or 2-byte number parts for representing positive exponents.
altNumTable
A wide character array that specifies the alternate representation of numerals. The array contains ten character codes, each of which represents an alternate numeral. If the smsfB0Digits bit of the script-flags word is set, you should substitute the characters in this array for the character codes $30-$39 (regular ASCII numerals) in a string whose token code is tokenAltNum or tokenAltReal. Alternate numerals and the script flags word are described with the list of selectors for script variables in the chapter "Script Manager" in this book.
reserved
(reserved for future expansion)
The wide character (data type WideChar) is a format for representing a character that may be either 1 or 2 bytes long. For a 1-byte character, the high-order (first) byte in the record is 0, and the low-order (second) byte contains the character code. For a 2-byte character, the high-order byte is nonzero.

TYPE
   WideChar = RECORD
   CASE BOOLEAN OF
      TRUE:
         (a: PACKED ARRAY[0..1] OF Char);    {0 = high-order char}
      FALSE:
         (b: INTEGER);
   END;
The wide character array (data type WideCharArr) consists of an integer count followed by a packed array of wide characters.

TYPE
   WideCharArr = RECORD
      size: INTEGER;                         {no. of entries -1}
      data: PACKED ARRAY[0..9] OF WideChar;
   END;
Field Description
size
The number of items in the table minus 1.
data
Up to ten wide characters. If the number part is only a single 1-byte character, that character is in the low-order byte of the word.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996