*** empty log message ***
[m17n/m17n-lib-cs.git] / input.cs
index c4305d7..9cc52e7 100644 (file)
--- a/input.cs
+++ b/input.cs
@@ -1,19 +1,51 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Xml;
+using System.Xml.Expression;
 using M17N;
 using M17N.Core;
 using M17N.Input;
+using Xex = System.Xml.Expression.Xexpression;
 
 public class Test
 {
   public static void Main()
   {
+    //M17n.debug = true;
     MDatabase.ApplicationDir = "/usr/local/share/m17n";
-    MInputMethod im = MInputMethod.Get (MSymbol.Of ("vi"),
-                                       MSymbol.Of ("telex"),
-                                       MSymbol.nil);
-    Console.WriteLine (im);
+    MText desc, title;
+    Xex.Variable[] vars;
+    MInputMethod.Command[] cmds;
+
+#if false
+    MDatabase.Tag tag = new MDatabase.Tag ("input-method",
+                                          "t", "nil", "vi-base");
+    MDatabase mdb = MDatabase.Find (tag);
+    XmlNode node = mdb.Load ("map-alnum", "input-method", "map-list", "map");
+
+    Console.WriteLine (node.OuterXml);
+
+#elif false
+    MInputMethod im = MInputMethod.Find ("vi", "telex");
+
+    if (im.Info (out desc, out title, out vars, out cmds))
+      {
+       Console.WriteLine ("{0}, {1}, {2}, {3}", desc, title, vars, cmds);
+       im.Open ();
+      }
+#else
+    MInputMethod[] ims = MInputMethod.List ();
+    foreach (MInputMethod im in ims)
+      {
+
+       Console.Write ("(<{0}, {1}, {2}>", im.Language, im.Name, im.SubName);
+       if (im.Info (out desc, out title, out vars, out cmds))
+         Console.Write (" {0}, {1}, {2}, {3}", desc, title, vars, cmds);
+       if (! im.Open ())
+         Console.Write (" open fail");
+       Console.WriteLine (")");
+      }
+#endif
   }
 }
-