*** empty log message ***
[m17n/m17n-lib-cs.git] / chartab.cs
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using M17N;
5 using M17N.Core;
6
7 public class Test
8 {
9   public static void Main()
10   {
11     MCharTable tbl = new MCharTable ();
12
13     tbl[0x100] = MSymbol.Of ("test-100");
14     tbl[0x101] = MSymbol.Of ("test-101");
15     tbl[0xFFF] = MSymbol.Of ("test-FFF");
16     tbl[0x1000] = MSymbol.Of ("test-1000");
17
18     tbl[0x2070, 0x4001] = MSymbol.t;
19     tbl[0x3740] = MSymbol.nil;
20
21     Console.WriteLine ("# Direct access by tbl[CHAR]");
22     Console.WriteLine ("0x100:{0}, 0x1000:{1}", tbl[0x100], tbl[0x1000]);
23     Console.WriteLine ("0x206F:{0}, 0x2070:{1}, 0x4001:{2}, 0x4002:{3}",
24                        tbl[0x206F], tbl[0x2070], tbl[0x4001], tbl[0x4002]);
25
26     Console.WriteLine ("# Enumerate on tbl");
27     foreach (MCharRange range in tbl)
28       Console.WriteLine (range);
29
30     Console.WriteLine ("# Using MCharRange from U+3000 to U+0");
31     MCharRange r = new MCharRange (0x3000, tbl);
32     do {
33       if (r.Value != null)
34         Console.WriteLine (r);
35     } while (r.Prev ());
36
37     Console.WriteLine ("# Using MCharProp of BIDI");
38     MDatabase.ApplicationDir = "/usr/local/share/m17n";
39     MCharProp bidi = new MCharProp (MSymbol.Of ("bidirectional-category"));
40     r = new MCharRange (0, bidi);
41     while (r.To < 0x800)
42       {
43         if (r.Value != null)
44           Console.WriteLine (r);
45         r.Next ();
46       }
47     Console.WriteLine ("...");
48   }
49 }