using System; using System.Collections.Generic; using System.IO; using M17N; using M17N.Core; public class Test { public static void Main() { MCharTable tbl = new MCharTable (); tbl[0x100] = MSymbol.Of ("test-100"); tbl[0x101] = MSymbol.Of ("test-101"); tbl[0xFFF] = MSymbol.Of ("test-FFF"); tbl[0x1000] = MSymbol.Of ("test-1000"); tbl[0x2070, 0x4001] = MSymbol.t; tbl[0x3740] = MSymbol.nil; Console.WriteLine ("# Direct access by tbl[CHAR]"); Console.WriteLine ("0x100:{0}, 0x1000:{1}", tbl[0x100], tbl[0x1000]); Console.WriteLine ("0x206F:{0}, 0x2070:{1}, 0x4001:{2}, 0x4002:{3}", tbl[0x206F], tbl[0x2070], tbl[0x4001], tbl[0x4002]); Console.WriteLine ("# Enumerate on tbl"); foreach (MCharRange range in tbl) Console.WriteLine (range); Console.WriteLine ("# Using MCharRange from U+3000 to U+0"); MCharRange r = new MCharRange (0x3000, tbl); do { if (r.Value != null) Console.WriteLine (r); } while (r.Prev ()); Console.WriteLine ("# Using MCharProp of BIDI"); MDatabase.ApplicationDir = "/usr/local/share/m17n"; MCharProp bidi = new MCharProp (MSymbol.Of ("bidirectional-category")); r = new MCharRange (0, bidi); while (r.To < 0x800) { if (r.Value != null) Console.WriteLine (r); r.Next (); } Console.WriteLine ("..."); } }