9ed1cc00a360d927eb5ba932aa45a338643da547
[mono.git] / mcs / class / corlib / Mono.Globalization.Unicode / MSCompatUnicodeTableUtil.cs
1 using System;
2 using System.Globalization;
3 using System.Text;
4
5 namespace Mono.Globalization.Unicode
6 {
7 /*
8         // Represents a text element that consists of either contraction or
9         // expansion.
10         internal class TextElementSequence
11         {
12                 public readonly char [] Sources;
13                 public readonly byte [] SortKey;
14
15                 public TextElementSequence (char [] sources, byte [] sortkey)
16                 {
17                         Sources = new char [sources.Length];
18                         Array.Copy (sources, Sources, sources.Length);
19
20                         SortKey = new byte [sortkey.Length];
21                         Array.Copy (sortkey, SortKey, sortkey.Length);
22                 }
23         }
24 */
25         internal /*static*/ class MSCompatUnicodeTableUtil
26         {
27                 public static readonly CodePointIndexer Ignorable;
28                 public static readonly CodePointIndexer Category;
29                 public static readonly CodePointIndexer Level1;
30                 public static readonly CodePointIndexer Level2;
31                 public static readonly CodePointIndexer Level3;
32                 public static readonly CodePointIndexer WidthCompat;
33                 public static readonly CodePointIndexer CjkCHS;
34                 public static readonly CodePointIndexer Cjk;
35
36                 static MSCompatUnicodeTableUtil ()
37                 {
38                         // FIXME: those ranges could be more compact, but since
39                         // I haven't filled all the table yet, I keep it safer.
40                         int [] ignoreStarts = new int [] {
41                                 0, 0xA000, 0xF900};
42                         int [] ignoreEnds = new int [] {
43                                 0x3400, 0xA500, 0x10000};
44                         int [] catStarts = new int [] {
45                                 0, 0xAC00, 0xF900};
46                         int [] catEnds = new int [] {
47                                 0xA000, 0xD7B0, 0x10000};
48                         int [] lv1Starts = new int [] {
49                                 0, 0xAC00, 0xF900};
50                         int [] lv1Ends = new int [] {
51                                 0xA000, 0xD7B0, 0x10000};
52                         int [] lv2Starts = new int [] {0, 0xFB00};
53                         int [] lv2Ends = new int [] {0x3400, 0x10000};
54                         int [] lv3Starts = new int [] {0, 0xFB00};
55                         int [] lv3Ends = new int [] {0x3400, 0x10000};
56                         int [] widthStarts = new int [] {0, 0xFF00};
57                         int [] widthEnds = new int [] {0x3400, 0x10000};
58                         int [] chsStarts = new int [] {
59                                 0x3100, 0x4E00, 0xE800}; // FIXME: really?
60                         int [] chsEnds = new int [] {
61                                 0x3400, 0xA000, 0x10000};
62                         int [] cjkStarts = new int [] {0x4E00};
63                         int [] cjkEnds = new int [] {0xA000};
64
65                         Ignorable = new CodePointIndexer (ignoreStarts, ignoreEnds, -1, -1);
66                         Category = new CodePointIndexer (catStarts, catEnds, 0, 0);
67                         Level1 = new CodePointIndexer (lv1Starts, lv1Ends, 0, 0);
68                         Level2 = new CodePointIndexer (lv2Starts, lv2Ends, 0, 0);
69                         Level3 = new CodePointIndexer (lv3Starts, lv3Ends, 0, 0);
70                         WidthCompat = new CodePointIndexer (widthStarts, widthEnds, 0, 0);
71                         CjkCHS = new CodePointIndexer (chsStarts, chsEnds, -1, -1);
72                         Cjk = new CodePointIndexer (cjkStarts, cjkEnds, -1, -1);
73                 }
74         }
75 }