*** empty log message ***
[m17n/m17n-lib-cs.git] / input.cs
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Xml;
5 using System.Xml.Expression;
6 using M17N;
7 using M17N.Core;
8 using M17N.Input;
9 using Xex = System.Xml.Expression.Xexpression;
10
11 public class Test
12 {
13   public static void Main()
14   {
15     //M17n.debug = true;
16     MDatabase.ApplicationDir = "/usr/local/share/m17n";
17     MText desc, title;
18     Xex.Variable[] vars;
19     MInputMethod.Command[] cmds;
20
21 #if false
22     MDatabase.Tag tag = new MDatabase.Tag ("input-method",
23                                            "t", "nil", "vi-base");
24     MDatabase mdb = MDatabase.Find (tag);
25     XmlNode node = mdb.Load ("map-alnum", "input-method", "map-list", "map");
26
27     Console.WriteLine (node.OuterXml);
28
29 #elif false
30     MInputMethod im = MInputMethod.Find ("vi", "telex");
31
32     if (im.Info (out desc, out title, out vars, out cmds))
33       {
34         Console.WriteLine ("{0}, {1}, {2}, {3}", desc, title, vars, cmds);
35         im.Open ();
36       }
37 #else
38     MInputMethod[] ims = MInputMethod.List ();
39     foreach (MInputMethod im in ims)
40       {
41
42         Console.Write ("(<{0}, {1}, {2}>", im.Language, im.Name, im.SubName);
43         if (im.Info (out desc, out title, out vars, out cmds))
44           Console.Write (" {0}, {1}, {2}, {3}", desc, title, vars, cmds);
45         if (! im.Open ())
46           Console.Write (" open fail");
47         Console.WriteLine (")");
48       }
49 #endif
50   }
51 }