New test.
[mono.git] / mcs / class / corlib / Mono.Globalization.Unicode / MSCompatUnicodeTableUtil.cs
1 //
2 // MSCompatUnicodeTable.cs : Utility for MSCompatUnicodeTable class.
3 //
4 // Author:
5 //      Atsushi Enomoto  <atsushi@ximian.com>
6 //
7 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 using System;
29 using System.Globalization;
30 using System.Text;
31
32 namespace Mono.Globalization.Unicode
33 {
34         internal /*static*/ class MSCompatUnicodeTableUtil
35         {
36                 public const byte ResourceVersion = 3;
37
38                 public static readonly CodePointIndexer Ignorable;
39                 public static readonly CodePointIndexer Category;
40                 public static readonly CodePointIndexer Level1;
41                 public static readonly CodePointIndexer Level2;
42                 public static readonly CodePointIndexer Level3;
43 //              public static readonly CodePointIndexer WidthCompat;
44                 public static readonly CodePointIndexer CjkCHS;
45                 public static readonly CodePointIndexer Cjk;
46
47                 static MSCompatUnicodeTableUtil ()
48                 {
49                         // FIXME: those ranges could be more compact, but since
50                         // I haven't filled all the table yet, I keep it safer.
51                         int [] ignoreStarts = new int [] {
52                                 0, 0xA000, 0xF900};
53                         int [] ignoreEnds = new int [] {
54                                 0x3400, 0xA500, 0x10000};
55                         int [] catStarts = new int [] {
56                                 0, 0x1E00, 0x3000, 0x4E00, 0xAC00, 0xF900};
57                         int [] catEnds = new int [] {
58                                 0x1200, 0x2800, 0x3400, 0xA000, 0xD7B0, 0x10000};
59                         int [] lv1Starts = new int [] {
60                                 0, 0x1E00, 0x3000, 0x4E00, 0xAC00, 0xF900};
61                         int [] lv1Ends = new int [] {
62                                 0x1200, 0x2800, 0x3400, 0xA000, 0xD7B0, 0x10000};
63                         int [] lv2Starts = new int [] {0, 0x1E00, 0x3000, 0xFB00};
64                         int [] lv2Ends = new int [] {0xF00, 0x2800, 0x3400, 0x10000};
65                         int [] lv3Starts = new int [] {0, 0x1E00, 0x3000, 0xFB00};
66                         int [] lv3Ends = new int [] {0x1200, 0x2800, 0x3400, 0x10000};
67 //                      int [] widthStarts = new int [] {0, 0x2000, 0x3100, 0xFF00};
68 //                      int [] widthEnds = new int [] {0x300, 0x2200, 0x3200, 0x10000};
69                         int [] chsStarts = new int [] {
70                                 0x3100, 0x4E00, 0xE800}; // FIXME: really?
71                         int [] chsEnds = new int [] {
72                                 0x3400, 0xA000, 0x10000};
73                         int [] cjkStarts = new int [] {0x3100, 0x4E00, 0xF900};
74                         int [] cjkEnds = new int [] {0x3400, 0xA000, 0xFB00};
75
76                         Ignorable = new CodePointIndexer (ignoreStarts, ignoreEnds, -1, -1);
77                         Category = new CodePointIndexer (catStarts, catEnds, 0, 0);
78                         Level1 = new CodePointIndexer (lv1Starts, lv1Ends, 0, 0);
79                         Level2 = new CodePointIndexer (lv2Starts, lv2Ends, 0, 0);
80                         Level3 = new CodePointIndexer (lv3Starts, lv3Ends, 0, 0);
81 //                      WidthCompat = new CodePointIndexer (widthStarts, widthEnds, 0, 0);
82                         CjkCHS = new CodePointIndexer (chsStarts, chsEnds, -1, -1);
83                         Cjk = new CodePointIndexer (cjkStarts, cjkEnds, -1, -1);
84                 }
85         }
86 }