From: handa Date: Wed, 30 Sep 2009 08:35:37 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6da38c4d8072a32a940434f3a5dfa7a9e6b24b1f;p=m17n%2Fm17n-lib-cs.git *** empty log message *** --- diff --git a/MDatabase.cs b/MDatabase.cs index 5779783..afefa61 100644 --- a/MDatabase.cs +++ b/MDatabase.cs @@ -417,6 +417,7 @@ namespace M17N.Core }; public Tag tag; + public NameTable name_table = new NameTable (); private Loader loader; private object ExtraInfo; // Directory of the database file. @@ -995,9 +996,10 @@ namespace M17N.Core return loader (tag, ExtraInfo); if (Info.Format == Mxml) { - XmlDocument doc = new XmlDocument (); + XmlDocument doc = new XmlDocument (name_table); try { - XmlReader reader = XmlReader.Create (FileInfo.FullName); + XmlTextReader reader + = new XmlTextReader (FileInfo.FullName, name_table); doc.Load (reader); LastLoaded = DateTime.Now; } catch (Exception e) { @@ -1030,8 +1032,8 @@ namespace M17N.Core return null; if (Info.Format == Mxml) { - XmlDocument doc = new XmlDocument (); - XmlTextReader reader = new XmlTextReader (stream); + XmlDocument doc = new XmlDocument (name_table); + XmlTextReader reader = new XmlTextReader (stream, name_table); reader.WhitespaceHandling = WhitespaceHandling.None; try { @@ -1075,8 +1077,8 @@ namespace M17N.Core return null; if (Info.Format == Mxml) { - XmlDocument doc = new XmlDocument (); - XmlTextReader reader = new XmlTextReader (stream); + XmlDocument doc = new XmlDocument (name_table); + XmlTextReader reader = new XmlTextReader (stream, name_table); reader.WhitespaceHandling = WhitespaceHandling.None; try { @@ -1122,8 +1124,8 @@ namespace M17N.Core if (Info.Format != Mxml) throw new Exception ("Not an XML format"); - XmlDocument doc = new XmlDocument (); - XmlTextReader reader = new XmlTextReader (stream); + XmlDocument doc = new XmlDocument (name_table); + XmlTextReader reader = new XmlTextReader (stream, name_table); int len = nodes.Length; reader.WhitespaceHandling = WhitespaceHandling.None; diff --git a/MInputMethod.cs b/MInputMethod.cs index a6c8552..ee54f6d 100644 --- a/MInputMethod.cs +++ b/MInputMethod.cs @@ -506,6 +506,7 @@ namespace M17N.Input if (description == null) description = "No description"; keys = new List (); + Console.WriteLine ("cmd:" + p); for (p = p.next; ! p.IsEmpty; p = p.next) { if (p.IsMText) @@ -517,7 +518,7 @@ namespace M17N.Input public Command (XmlNode node) { - name = node.Attributes["id"].Value; + name = node.Attributes[0].Value; keys = new List (); for (node = node.FirstChild; node != null; node = node.NextSibling) { @@ -794,7 +795,7 @@ namespace M17N.Input } // Instance members - internal Xex.Domain domain; + internal Xex.Domain domain = new Xex.Domain (im_domain, null); private LoadStatus load_status = LoadStatus.None; private MDatabase.Tag tag; @@ -910,6 +911,7 @@ namespace M17N.Input mdb = MDatabase.Find (tag); if (mdb == null) return false; + mdb.name_table = Xex.Symbol.Table; try { MSymbol format = mdb.Format; @@ -931,10 +933,10 @@ namespace M17N.Input private bool load_body () { - domain = new Xex.Domain (im_domain, null); mdb = MDatabase.Find (tag); if (mdb == null) return false; + mdb.name_table = Xex.Symbol.Table; try { object obj = mdb.Load (); if (obj is MPlist) @@ -1363,9 +1365,7 @@ namespace M17N.Input Xex.Variable vari = get_global_var (name); if (vari != null) domain.Defvar (vari); - else - domain.Defvar (node_list[i]); - + domain.Defvar (node_list[i]); var_names[i] = name; } } diff --git a/MPlist.cs b/MPlist.cs index 35cafd8..6b89ac1 100644 --- a/MPlist.cs +++ b/MPlist.cs @@ -688,7 +688,7 @@ namespace M17N.Core val = new MPlist (this); key = MSymbol.plist; } - else if (c == '"' || c == '\\') + else if (c == '"') { MText mt; ReadMText (out mt); diff --git a/Makefile b/Makefile index 353493b..aa7e4eb 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ expr.exe: expr.cs xex.exe: xex.cs XmlExpr.dll $(RUNCS) -r:XmlExpr.dll $< -%.exe: %.cs +%.exe: %.cs ${DLL} $(RUNCS) -r:M17N.dll -r:M17NCore $< clean: diff --git a/XmlExpr.cs b/XmlExpr.cs index 1dbff0f..6337449 100644 --- a/XmlExpr.cs +++ b/XmlExpr.cs @@ -435,6 +435,8 @@ namespace System.Xml.Expression private static bool SubsetP (string[] r1, string[] r2) { + if (r2 == null) + return true; foreach (string s in r1) if (! SubsetP (s, r2)) return false; @@ -443,6 +445,8 @@ namespace System.Xml.Expression private static bool SubsetP (string str, string[] r) { + if (r == null) + return true; foreach (string s in r) if (str == s) return true; @@ -485,6 +489,8 @@ namespace System.Xml.Expression private static bool SubsetP (Symbol[] r1, Symbol[] r2) { + if (r2 == null) + return true; foreach (Symbol n in r1) if (! SubsetP (n, r2)) return false; @@ -493,6 +499,8 @@ namespace System.Xml.Expression private static bool SubsetP (Symbol name, Symbol[] r) { + if (r == null) + return true; foreach (Symbol n in r) if (name == n) return true; @@ -750,7 +758,7 @@ namespace System.Xml.Expression Variable vari; node = node.FirstChild; - if (node.Name == Ndescription) + if (node != null && node.Name == Ndescription) { desc = node.InnerText; node = node.NextSibling; @@ -759,10 +767,15 @@ namespace System.Xml.Expression desc = null; if (node != null) { - Symbol type = node.Name; + XmlNode nn; + if (node.Name == "value") + nn = node.FirstChild; + else + nn = node; + Symbol type = nn.Name; XmlNodeList range_list = null; int nranges = 0; - string val = node.InnerText; + string val = nn.InnerText; node = node.NextSibling; if (node != null) @@ -792,7 +805,7 @@ namespace System.Xml.Expression { range[i * 2] = range[i * 2 + 1] - = parse_integer (n.InnerText); + = parse_integer (n.FirstChild.InnerText); } } } @@ -818,7 +831,7 @@ namespace System.Xml.Expression { range = new string[nranges]; for (int i = 0; i < nranges; i++) - range[i] = range_list[i].InnerText; + range[i] = range_list[i].FirstChild.InnerText; } if (variables.TryGetValue (name, out vari)) @@ -842,7 +855,7 @@ namespace System.Xml.Expression { range = new Symbol[nranges]; for (int i = 0; i < nranges; i++) - range[i] = range_list[i].InnerText; + range[i] = range_list[i].FirstChild.InnerText; } if (variables.TryGetValue (name, out vari)) diff --git a/input.cs b/input.cs index 465fe64..9cc52e7 100644 --- a/input.cs +++ b/input.cs @@ -13,7 +13,7 @@ public class Test public static void Main() { //M17n.debug = true; - MDatabase.ApplicationDir = "/usr/local/share/m17n-xml"; + MDatabase.ApplicationDir = "/usr/local/share/m17n"; MText desc, title; Xex.Variable[] vars; MInputMethod.Command[] cmds; @@ -26,7 +26,7 @@ public class Test Console.WriteLine (node.OuterXml); -#elif true +#elif false MInputMethod im = MInputMethod.Find ("vi", "telex"); if (im.Info (out desc, out title, out vars, out cmds)) diff --git a/input.txt b/input.txt index 9db4123..628c73a 100644 --- a/input.txt +++ b/input.txt @@ -11,6 +11,12 @@ INPUT-METHOD = STATELIST ? '' +TAGS = '' LANG NAME EXTRA ? '' + +LANG = '' LANGNAME '' +NAME = '' NAME '' +EXTRA = '' EXTRANAME '' + VARLIST = '' DEFVAR + '' CMDLIST = '' COMMAND + '' MODULELIST = '' MODULE + '' @@ -33,7 +39,10 @@ RULE = '' [ KEYSEQ | CMDREF ] FUNCALL * '' CMDREF = '' -STATE = '' [ HOOK BRANCH CATCHALL ] * '' +STATE = '' + TITLE ? + [ HOOK BRANCH CATCHALL ] * + '' HOOK = '' FUNCALL + '' @@ -44,7 +53,7 @@ CATCHALL = '' FUNCALL * '' TERM += MIM-TERM PREDEFINED += MIM-PREDEFEIND -MIM-TERM = KEYSEQ | MARKER +MIM-TERM = KEYSEQ | MARKER | SELECTOR KEYSEQ = '' [ INTTERM | STRTERM | SYMTERM ] + '' KEYSEQTERM = KEYSEQ | VAR (value is KEYSEQ) | FUNCALL (return KEYSEQ) @@ -61,9 +70,9 @@ MIM-PREDEFINED | SHIFT | SHIFTBACK INSERT = '' [ INTTERM | STRTERM ] '' -CANDIDATES = '' [ STRTERM | LISTTERM ] '' +CANDIDATES = '' [ STRTERM | LISTTERM ] + '' DELETE = '' [ MARKERTERM | INTTERM ] '' -SELECT = '' +SELECT = '' SHOW = '' HIDE = '' MOVE = '' [ MARKERTERM | INTTERM ] '' diff --git a/temp.plist b/temp.plist index d1d9645..3b6a100 100644 --- a/temp.plist +++ b/temp.plist @@ -1,4 +1,5 @@ "\xC0" +(\ ) (a 123 0x123) -10 ?\xC0