From ae5e46f4c6cc2f36d97f068a191d5e6bc10b0dd1 Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 24 Feb 2010 23:40:53 +0000 Subject: [PATCH] *** empty log message *** --- xex.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/xex.js b/xex.js index acae657..5b07325 100644 --- a/xex.js +++ b/xex.js @@ -829,6 +829,15 @@ Xex.LstTerm = function (list) { this.val = list; }; return term; } + function Fset (domain, vari, args) + { + if (! vari) + throw new Xex.ErrTerm (Xex.Error.NoVariableName, + 'No variable name to set'); + vari.SetValue (args[0]); + return args[0]; + } + function Fadd (domain, vari, args) { var n = vari ? vari.val.val : 0; @@ -861,12 +870,20 @@ Xex.LstTerm = function (list) { this.val = list; }; var result = args[i].Eval (domain); if (domain.Thrown ()) return result; - if (result.IsTrue) + if (result.IsTrue ()) return Xex.One; } return Xex.Zero; } + function Feq (domain, vari, args) + { + for (var i = 1; i < args.length; i++) + if (! args[i - 1].Equals (args[i])) + return Xex.Zero; + return Xex.One; + } + function Fprogn (domain, vari, args) { var result = Xex.One; @@ -887,13 +904,35 @@ Xex.LstTerm = function (list) { this.val = list; }; if (domain.Thrown ()) return result; - if (result.IsTrue) + if (result.IsTrue ()) return args[1].Eval (domain); if (args.length == 2) return Zero; return args[2].Eval (domain); } + function Fcond (domain, vari, args) + { + for (var i = 0; i < args.length; i++) + { + var list = args[i].val; + var result = list.val[0].Eval (doamin); + if (result.isTrue ()) + { + for (var j = 1; j < list.val.length; j++) + { + domain.depth++; + result = list.val[j].Eval (domain); + domain.depth--; + if (domain.Thrown ()) + return result; + } + return result; + } + } + return Xex.Zero; + } + function eval_terms (domain, terms, idx) { var result = Xex.Zero; @@ -995,6 +1034,7 @@ Xex.Load = function (server, file) obj.open ('GET', url, false); obj.overrideMimeType ('text/xml'); obj.send (''); + alert (file); return obj.responseXML.firstChild; } @@ -1527,10 +1567,27 @@ MIM.im_domain.DefType (MIM.State.prototype); return args[0]; } + function Fmove (domain, vari, args) + { + var ic = domain.context; + var pos = args[0].IsInt ? args[0].val : args[0].Position (ic); + ic.move (pos); + return args[0]; + } + + function Fmark (domain, vari, args) + { + args[0].Mark (domain.context); + return args[0]; + } + im_domain.DefSubr (Finsert, "insert", false, 1, 1); im_domain.DefSubr (Finsert_candidates, "insert-candidates", false, 1, 1); + im_domain.DefSubr (Fmove, "move", false, 1, 1); + im_domain.DefSubr (Fmark, "mark", false, 1, 1); }) (); + (function () { function get_global_var (vname) { @@ -1574,6 +1631,8 @@ MIM.im_domain.DefType (MIM.State.prototype); for (var macro in im.domain.functions) im.domain.CopyFunc (this.domain, macro); } + else + Xex.Term.Parse (node); } } parsers['title'] = function (node) @@ -2471,7 +2530,7 @@ MIM.debug_print = function (event, ic) MIM.debug_nodes['status' + index].innerHTML = ic.im.load_status; else MIM.debug_nodes['status' + index].innerHTML = 'no IM'; - MIM.debug_nodes['keymap' + index].innerHTML = ic.keymap.name; + MIM.debug_nodes['keymap' + index].innerHTML = ic.state.name; MIM.debug_nodes['preedit' + index].innerHTML = ic.preedit; }; -- 1.7.10.4