2 using System.Collections.Generic;
8 using Xex = System.Xml.Xexpression;
12 public static void Main(string[] args)
16 string appdir = "/usr/local/share/m17n";
19 while (argc < args.Length && args[argc][0] == '-')
21 if (args[argc] == "-debug")
23 else if (args[argc] == "-xml")
24 appdir = "/usr/local/share/m17n-xml";
27 if (argc + 2 >= args.Length)
29 Console.WriteLine ("Usage: mono [--debug] input.exe"
30 + " [-debug] [-xml] LANG NAME KEY-SEQUECE");
34 Xex.DebugDepth = debug_depth;
35 MDatabase.ApplicationDir = appdir;
36 MInputMethod im = MInputMethod.Find (args[argc], args[argc + 1]);
37 MText mt = new MText ();
38 MInputMethod.Session session = new MInputMethod.Session (im, mt, 0);
40 MText str = args[argc + 2];
41 for (int i = 0; i < str.Length; i++)
43 MInputMethod.Key key = new MInputMethod.Key (str[i]);
44 session.HandleKey (key);
45 int pos = session.CurrentPos;
46 MText head = mt[0, pos];
47 MText preedit = session.Preedit;
48 MText tail = mt[pos, mt.Length];
49 Console.Write ("{0} -> \"{1}|{2}|{3}\" (",
50 str[i, i + 1], head, preedit, tail);
51 for (int j = 0; j < head.Length; j++)
52 Console.Write ("{0}U+{1:X4}", j == 0 ? "(" : " ", head[j]);
54 for (int j = 0; j < preedit.Length; j++)
55 Console.Write ("{0}U+{1:X4}", j == 0 ? "" : " ", preedit[j]);
57 for (int j = 0; j < tail.Length; j++)
58 Console.Write ("{0}U+{1:X4}", j == 0 ? "" : " ", tail[j]);
59 Console.WriteLine (")");