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";
return ic.preedit[Position (ic)];
}
- public override string ToString () { return name.Name; }
+ public override string ToString ()
+ {
+ return "<marker>" + name.Name + "</marker>";
+ }
public static Xex.TermValue parser (Xex.Domain domain, XmlNode node)
{
}
// 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;
private MInputMethod (MDatabase.Tag tag)
{
this.tag = tag;
+ domain = new Xex.Domain (tag[1].Name, im_domain, null);
}
// Instance Properties
if (! plist.IsPlist)
throw new Exception ("Invalid cond args: " + plist);
MPlist p = plist.Plist;
- List<Xex.Term> arg = new List<Xex.Term> (parse_actions (p, false));
+ List<Xex.Term> arg = new List<Xex.Term> ();
+ 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);
}
}
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));
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 ();
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;
&& ! 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;
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;
}
public class Domain
{
+ public Symbol name;
public object context;
public int depth = 0;
private Stack<CatchTag> catch_stack = new Stack<CatchTag> ();
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<Symbol, TermType> (parent.termtypes);
functions = new Dictionary<Symbol, Function> (parent.functions);
str += " " + kv.Key;
str += ") (variabls";
foreach (KeyValuePair<Symbol, Variable> kv in variables)
- str += " " + kv.Key;
+ str += " " + kv.Value;
str += ")";
if (bindings != null)
str += " " + bindings;
{
foreach (KeyValuePair<Variable,Term> kv
in (Dictionary<Variable,Term>) 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 ()
{
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;
}
return str + "/>";
str += ">";
if (func is Function.SpecialForm)
- str += "...";
+ str += String.Format ("({0})...", args.Length);
else
foreach (Term e in args)
str += e;