2005-09-13 Sureshkumar T <tsureshkumar@novell.com>
[mono.git] / mcs / class / corlib / Mono.Globalization.Unicode / DataStructures.txt
1 !!!NOTE!!!  The implementation had been improved without updating this
2 document, so some part of it is obsolete.
3
4
5 * CharUnicodeInfo internal design
6
7 ** Normalization information structures
8
9         From    DerivedNormalizationProps.txt
10                 NormalizationCorrections.txt
11                 UnicodeData.txt
12         To Normalization.cs
13
14         1) byte [] NormalizationPropIndexes (length = 65536)
15
16         2) int [] NormalizationPropValues (length = property value count)
17
18         A value consists of those flags:
19
20         bit     semantics
21         0       NFD_QC
22         1       NFKD_QC
23         2       NFC_QC : NO
24         3       NFC_QC : Maybe
25         4       NFKC_QC : NO
26         5       NFKC_QC : Maybe
27         6       Expands_On_NFD
28         7       Expands_On_NFC
29         8       Expands_On_NKFD
30         9       Expands_On_NKFC
31         10      Full_Composition_Exclusion
32         11-12   index to NormalizationCorrections
33         16-31   FC_NFKC : short[]
34                 0 : no replacement;
35                 plus - index to SingleNormalization
36                 minus - 0xF0000000 and index to MultiNormalization
37
38         3) char [] SingleNormalization
39                 FIXME: it should consider NormalizationCorrections.txt
40
41         4) char [] MultiNormalization (index for each 4 bytes, zero padded)
42
43         5) int [] canonicalEq
44         6) int [] canonEquiv : index to canonicalEq
45
46
47 ** Default Collation Element Table
48
49         From allkeys.txt from UCA
50         To CollationElementTable.cs
51
52         struct SortKeyValue {
53                 bool Alt;
54                 int Primary;
55                 int Secondary;
56                 int Thirtiary;
57                 int Quartenary;
58         }
59
60         SortKeyValue [] keyValues; of length count of defined values
61
62         struct CollationElementEntry {
63                 short Index;
64                 short Count;
65         }
66
67         int [] collElem; of length char.MaxValue
68         bits:
69          0-15 : index of top entry to keyValues
70         16-31 : count or 0 (count = 1)
71
72         Indexes are computed for compression (eliminating vast zero-arrays).
73         See CollationElementTableUtil.cs for the implementation.
74
75
76 ** Combining class information
77
78         From DerivedCombiningClass.txt
79         To CombiningClass.cs
80
81         It generates one simple GetCombiningClass () method.
82
83 ** Width information
84
85         From EastAsianWidth.txt
86
87         1) WidthType : enum ( : short)
88                 values are: N/A/H/W/F/Na (FIXME: descriptive names!)
89
90
91 ** Case folding information
92
93         FromCaseFolding.txt
94
95         (SpecialCasing.txt is not considered. We could use TextInfo.)
96
97         Common case folding is handled in Char.ToLower(InvariantCulture).
98
99         1) CaseFoldingIndexes : short index to CaseFolding
100
101         2) CaseFoldingDetails : array of CaseFolding structure defined below:
102
103         struct CaseFolding {
104                 char Simple;
105                 char Full1;
106                 char Full2;
107                 char Full3;
108         }
109
110
111 ** Properties which do not consist of tables
112
113         - Hex_Digit, ASCII_Hex_Digit : too few to create tables.
114         - Logical_Order_Exception : too few to create table.
115