From 4ab20c0f4785424513d93f02b82085e1394b3872 Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 14 Oct 2009 08:15:56 +0000 Subject: [PATCH] *** empty log message *** --- MInputMethod.cs | 34 +++++++++++++++++++++------------- XmlExpr.cs | 20 +++++++++++--------- input.cs | 2 +- xex.cs | 1 + xex.xml | 10 ++++------ 5 files changed, 38 insertions(+), 29 deletions(-) diff --git a/MInputMethod.cs b/MInputMethod.cs index d99c609..258c929 100644 --- a/MInputMethod.cs +++ b/MInputMethod.cs @@ -25,7 +25,8 @@ namespace M17N.Input public static Callback GetSurroundingText; public static Callback DeleteSurroundingText; - internal static Xex.Domain im_domain = new Xex.Domain (null); + internal static Xex.Domain im_domain + = new Xex.Domain ("input-method", null); private static MSymbol Minput_method = "input-method"; private static MSymbol Mdescription = "description"; private static MSymbol Mvariable = "variable"; @@ -559,7 +560,10 @@ namespace M17N.Input return ic.preedit[Position (ic)]; } - public override string ToString () { return name.Name; } + public override string ToString () + { + return "" + name.Name + ""; + } public static Xex.TermValue parser (Xex.Domain domain, XmlNode node) { @@ -1207,7 +1211,7 @@ namespace M17N.Input } // Instance members - internal Xex.Domain domain = new Xex.Domain (im_domain, null); + internal Xex.Domain domain; protected LoadStatus load_status = LoadStatus.None; protected MDatabase.Tag tag; @@ -1259,6 +1263,7 @@ namespace M17N.Input private MInputMethod (MDatabase.Tag tag) { this.tag = tag; + domain = new Xex.Domain (tag[1].Name, im_domain, null); } // Instance Properties @@ -1858,7 +1863,10 @@ namespace M17N.Input if (! plist.IsPlist) throw new Exception ("Invalid cond args: " + plist); MPlist p = plist.Plist; - List arg = new List (parse_actions (p, false)); + List arg = new List (); + arg.Add (parse_action (p, true)); + for (p = p.next; ! p.IsEmpty; p = p.next) + arg.Add (parse_action (p, false)); args[i] = new Xex.Term (arg); } return new Xex.Term (domain, Qcond, args); @@ -1995,7 +2003,11 @@ namespace M17N.Input } } else if (plist.IsSymbol) - return new Xex.Term (domain, (Xex.Symbol) plist.Symbol.Name); + { + if (plist.Symbol.Name[0] == '@') + return parse_char_at (plist.Symbol); + return new Xex.Term (domain, (Xex.Symbol) plist.Symbol.Name); + } else if (plist.IsMText) return (as_funarg ? new Xex.Term ((string) plist.Text) : parse_insert (plist)); @@ -2334,15 +2346,11 @@ namespace M17N.Input candidates = null; candidate_show = false; - state = im.initial_state; - prev_state = null; + state = prev_state = null; state_preedit.Del (); - state_key_head = 0; state_var_values = state_initial_var_values; state_pos = 0; - - keymap = im.initial_state.keymap; - keys.keyseq.Clear (); + shift (im.initial_state); preceding_text.Del (); following_text.Del (); @@ -2628,7 +2636,7 @@ namespace M17N.Input prev_state = this.state; } save_state (); - if (this.state.title != state.title) + if (this.state == null || this.state.title != state.title) this.changed |= ChangedStatus.StateTitle; this.state = state; keymap = state.keymap; @@ -2640,7 +2648,7 @@ namespace M17N.Input && ! im.Open ()) throw new Exception ("Openging " + im.tag + " failed"); this.im = im; - domain = new Xex.Domain (im.domain, this); + domain = new Xex.Domain ("context", im.domain, this); state_initial_var_values = domain.SaveValues (); reset (); active = true; diff --git a/XmlExpr.cs b/XmlExpr.cs index 2e143a2..73499af 100644 --- a/XmlExpr.cs +++ b/XmlExpr.cs @@ -568,7 +568,7 @@ namespace System.Xml.Expression internal Bindings UnboundTo (Bindings boundary) { for (Bindings b = this; b != boundary; b = b.next) - b.vari.val = b.old_value; + b.vari.Value = b.old_value; return boundary; } @@ -619,6 +619,7 @@ namespace System.Xml.Expression public class Domain { + public Symbol name; public object context; public int depth = 0; @@ -632,11 +633,12 @@ namespace System.Xml.Expression private Stack catch_stack = new Stack (); private int catch_count = 0; - internal Domain () { } + internal Domain (Symbol name) { this.name = name; } - public Domain (object context) : this (basic, context) { } + public Domain (Symbol name, object context) + : this (name, basic, context) { } - public Domain (Domain parent, object context) + public Domain (Symbol name, Domain parent, object context) : this (name) { termtypes = new Dictionary (parent.termtypes); functions = new Dictionary (parent.functions); @@ -951,7 +953,7 @@ namespace System.Xml.Expression str += " " + kv.Key; str += ") (variabls"; foreach (KeyValuePair kv in variables) - str += " " + kv.Key; + str += " " + kv.Value; str += ")"; if (bindings != null) str += " " + bindings; @@ -988,13 +990,13 @@ namespace System.Xml.Expression { foreach (KeyValuePair kv in (Dictionary) values) - kv.Key.val = kv.Value; + kv.Key.Value = kv.Value; } } public delegate Term Builtin (Domain domain, Variable vari, Term[] args); - private static Domain basic = new Domain (); + private static Domain basic = new Domain ("basic"); static Xexpression () { @@ -1634,7 +1636,7 @@ namespace System.Xml.Expression domain.depth++; Term result = func.Call (domain, vari, args); domain.depth--; - domain.DebugWrite (true, " ==> {0})", result.ToString ()); + domain.DebugWrite (true, " ==> {0}", result.ToString ()); return result; } @@ -1652,7 +1654,7 @@ namespace System.Xml.Expression return str + "/>"; str += ">"; if (func is Function.SpecialForm) - str += "..."; + str += String.Format ("({0})...", args.Length); else foreach (Term e in args) str += e; diff --git a/input.cs b/input.cs index e51dd32..5b3cf20 100644 --- a/input.cs +++ b/input.cs @@ -13,7 +13,7 @@ public class Test public static void Main(string[] args) { //M17n.debug = true; - Xex.debug_level = 4; + Xex.debug_level = 10; MDatabase.ApplicationDir = "/usr/local/share/m17n"; MInputMethod im = MInputMethod.Find ("vi", "telex"); MInputMethod.Context ic = new MInputMethod.Context (im); diff --git a/xex.cs b/xex.cs index a6190f2..204da36 100644 --- a/xex.cs +++ b/xex.cs @@ -8,6 +8,7 @@ public class Test { public static void Main(params string[] args) { + Xex.debug_level = 10; Xex.Domain domain = new Xex.Domain (null); Xex xex = new Xex (domain, "xex.xml"); diff --git a/xex.xml b/xex.xml index 4462666..ef86e97 100644 --- a/xex.xml +++ b/xex.xml @@ -14,12 +14,8 @@ - - - - - - + + @@ -67,5 +63,7 @@ ?a?b 1 + 11 + -- 1.7.10.4