New test.
[mono.git] / mcs / class / corlib / Mono.Globalization.Unicode / CollationDataStructures.txt
1 * Collation Data structure and code
2
3 ** This document is not up to date
4
5         Currently the table generator generates all three kind of files
6         (C header, C# source and binary resources) but only binary resources
7         are used in fact. C# source is useful for debugging. C header is
8         historical.
9
10
11 ** Manual tasks required to maintain the source.
12
13         We should always pay attention to the contants for CodePointIndexer
14         that is likely not be in sync with the constant arrays.
15
16
17 ** collation-tables.h
18
19         Note: the structures are similar in MSCompatUnicodeTable.cs but now
20         it is managed code.
21
22         typedef struct {
23                 ushort lcid;
24                 ushort tailoringIndex;
25                 ushort tailoringCount;
26                 short reverseAccentOrder; /* 1:French sort. 0:Normal */
27         } TailoringInfo;
28
29         Those [*] characters will be compressed using CodePointIndexer
30         whose max value is char.MaxValue+1.
31
32         // Holds sortkey basis.
33         guint8 [*] category;
34         guint8 [*] level1;
35         guint8 [*] level2;
36         guint8 [*] level3;
37         guint8 [*] ignorableFlags; // 1:complete, 2:symbol, 3:nonspace
38         gunichar [*] widthCompat;
39
40         // Holds special arrays for CJK order which is culture dependent.
41         guint16 [*] cjkCHS;
42         guint16 [*] cjkCHT;
43         guint16 [*] cjkJA;
44         guint16 [*] cjkKO;
45         guint8 [*] cjkKOlv2;
46         gunichar [whole_tailoring_count] tailorings;
47         CollationSource [culture_count] collationSources;
48
49         "tailorings" table holds the entire contract mappings and expansion
50         mappings for all cultures.
51         Actually it is not only "culture dependent tailorings" but also
52         contains expansions for Invariant culture.
53         CollationSource.tailoringIndex holds the index of "tailorings" array
54         to point where its tailorings begin.
55         Tailorings for the culture is counted by tailoringCount.
56
57         If tailoringIndex is 0 then there is no tailorings for the specific
58         culture (it should still handle invariant tailorings).
59
60 ** CollationSourceUtil.cs
61         static CodePointIndexer Category;
62         static CodePointIndexer Level1;
63         static CodePointIndexer Level2;
64         static CodePointIndexer Level3;
65         static CodePointIndexer Ignorable;
66         static CodePointIndexer WidthCompat;
67         static CodePointIndexer CjkCHS;
68         static CodePointIndexer Cjk;
69
70 ** CollatorSource.cs
71
72         static byte [*] category;
73         static byte [*] level1;
74         static byte [*] level2;
75         static byte [*] level3;
76         static byte [*] ignorableFlags; // 1:complete, 2:symbol, 3:nonspace
77         static char [*] widthCompat;
78         static char [] tailorings;
79         static ushort [] cjkCHS;
80         static ushort [] cjkCHT;
81         static ushort [] cjkJA;
82         static ushort [] cjkKO;
83         static byte [] cjkKOlv2;
84
85         class TailoringInfo // instantiated for each CultureInfo
86         {
87                 // Primary constants
88                 int tailoringIndex;
89                 int tailoringCount;
90                 bool frenchSort;
91         }
92