1 * Collation Data structure and code
6 I will create a code generator named "collation-builder" (currently
7 create-mscompat-collation-table.cs), which creates collation support
10 - collation-tables.h : C header that holds raw constant arrays
11 - CollationTable.cs : C# source that declares raw constant arrays
13 The latter one is totally optional. It is created just for ease of
14 debugging in pure managed world.
16 CollationSource class is used to represent a culture-specific collation
19 Note that there are many characters whose sortkey cannot be acquired
20 only via those tables. For example, Korean Jamo ((U+1113 - U+115F) has
21 primary keys which is more than 2 bytes.
24 ** Manual tasks required to maintain the source.
26 We should always pay attention to the contants for CodePointIndexer
27 that is likely not be in sync with the constant arrays.
35 ushort tailoringIndex;
36 ushort tailoringCount;
37 short reverseAccentOrder; /* 1:French sort. 0:Normal */
40 Those [*] characters will be compressed using CodePointIndexer
41 whose max value is char.MaxValue+1.
43 // Holds sortkey basis.
48 guint8 [*] ignorableFlags; // 1:complete, 2:symbol, 3:nonspace
49 gunichar [*] widthCompat;
51 // Holds special arrays for CJK order which is culture dependent.
57 gunichar [whole_tailoring_count] tailorings;
58 CollationSource [culture_count] collationSources;
60 "tailorings" table holds the entire contract mappings and expansion
61 mappings for all cultures.
62 Actually it is not only "culture dependent tailorings" but also
63 contains expansions for Invariant culture.
64 CollationSource.tailoringIndex holds the index of "tailorings" array
65 to point where its tailorings begin.
66 Tailorings for the culture is counted by tailoringCount.
68 If tailoringIndex is 0 then there is no tailorings for the specific
69 culture (it should still handle invariant tailorings).
71 ** CollationSourceUtil.cs
72 static CodePointIndexer Category;
73 static CodePointIndexer Level1;
74 static CodePointIndexer Level2;
75 static CodePointIndexer Level3;
76 static CodePointIndexer Ignorable;
77 static CodePointIndexer WidthCompat;
78 static CodePointIndexer CjkCHS;
79 static CodePointIndexer Cjk;
83 static byte [*] category;
84 static byte [*] level1;
85 static byte [*] level2;
86 static byte [*] level3;
87 static byte [*] ignorableFlags; // 1:complete, 2:symbol, 3:nonspace
88 static char [*] widthCompat;
89 static char [] tailorings;
90 static ushort [] cjkCHS;
91 static ushort [] cjkCHT;
92 static ushort [] cjkJA;
93 static ushort [] cjkKO;
94 static byte [] cjkKOlv2;
96 class TailoringInfo // instantiated for each CultureInfo
104 // This array is set according to CJK type, and CJK type
105 // will be hardcoded, being identified from LCID.
107 // For Korean, level2 table is specially treated.