From 820ab4d8540dfd7cd2f64b19214e16ee0659da5c Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 17 Sep 2009 09:57:26 +0000 Subject: [PATCH] *** empty log message *** --- XmlExpr.cs | 51 +++++++++++++++++++++++++++++++-------------------- xex.cs | 2 +- xex.xml | 1 + 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/XmlExpr.cs b/XmlExpr.cs index ee82b94..99ef8d5 100644 --- a/XmlExpr.cs +++ b/XmlExpr.cs @@ -1088,10 +1088,10 @@ namespace System.Xml.Expression for (int i = 0; i < args.Length; i++) domain.DebugWrite (false, " {0}", args[i].ToString ()); domain.DebugWrite (false, ")"); - domain.depth += 2; + domain.depth++; Term result = func.Call (domain, args); - domain.depth -= 2; - domain.DebugWrite (true, " => {0})", result.ToString ()); + domain.depth--; + domain.DebugWrite (true, " ==> {0})", result.ToString ()); return result; } @@ -1151,26 +1151,30 @@ namespace System.Xml.Expression public override string ToString () { + string str; + if (objval == null) - return "" + intval + ""; - if (objval is Name) - return "" + objval + ""; - if (objval is string) - return "" + objval + ""; - if (objval is List) + str = "" + intval + ""; + else if (objval is Name) + str = "" + objval + ""; + else if (objval is string) + str = "" + objval + ""; + else if (objval is List) { - string str = ""; + str = ""; foreach (Term e in (List) objval) str += e; - return str + ""; + str += ""; } - if (objval is Funcall) - return ""; - if (objval is Variable) - return ""; - if (objval is Term) - return "" + objval + ""; - throw new Exception ("invalid Term object: " + objval); + else if (objval is Funcall) + str = ""; + else if (objval is Variable) + str = ""; + else if (objval is Term) + str = "" + objval + ""; + else + throw new Exception ("invalid Term object: " + objval); + return str; } } @@ -1263,7 +1267,10 @@ namespace System.Xml.Expression if (n.Name == Ndefun) domain.Defun (n); else if (n.Name != Ndefvar) - terms[i]= new Term (n, domain); + { + terms[i]= new Term (n, domain); + Console.WriteLine ("term="+terms[i]); + } } } @@ -1272,10 +1279,14 @@ namespace System.Xml.Expression Term result = Zero; domain.depth = 0; + for (int i = 0; i < terms.Length; i++) + Console.WriteLine (terms[i]); + foreach (Term term in terms) { + Console.WriteLine (term); result = term.Eval (domain); - Console.WriteLine (result); + Console.WriteLine ("=>" + result); } return result; } diff --git a/xex.cs b/xex.cs index 6b3a690..610b1b5 100644 --- a/xex.cs +++ b/xex.cs @@ -11,7 +11,7 @@ public class Test Xexpression.Domain domain = new Xexpression.Domain (null); Xexpression xex = new Xexpression ("xex.xml", domain); - Xexpression.debug_level = 1; + Xexpression.debug_level = 3; Console.WriteLine (xex.Eval (domain)); } } diff --git a/xex.xml b/xex.xml index 6efacdd..3d1cf35 100644 --- a/xex.xml +++ b/xex.xml @@ -38,4 +38,5 @@ 2 + 3 -- 1.7.10.4