dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/JScript/Execute Support.cs,1.2,1.3


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/JScript/Execute Support.cs,1.2,1.3
Date: Tue, 14 Jan 2003 07:37:38 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/JScript/Execute
In directory subversions:/tmp/cvs-serv17079/JScript/Execute

Modified Files:
        Support.cs 
Log Message:


Make the "print" function work in jsrun.


Index: Support.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/JScript/Execute/Support.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Support.cs  14 Jan 2003 10:35:50 -0000      1.2
--- Support.cs  14 Jan 2003 12:37:36 -0000      1.3
***************
*** 24,27 ****
--- 24,28 ----
  using System;
  using System.Reflection;
+ using Microsoft.JScript.Vsa;
  
  internal sealed class Support
***************
*** 279,282 ****
--- 280,310 ----
                                }
                                list.last = elem;
+                       }
+ 
+       // Evaluate and print an expression tree.
+       public static void Print(VsaEngine engine, JNode expr)
+                       {
+                               if(expr is JArgList)
+                               {
+                                       Print(engine, ((JArgList)expr).expr1);
+                                       Print(engine, ((JArgList)expr).expr2);
+                               }
+                               else
+                               {
+                                       Object value = expr.Eval(engine);
+                                       String pvalue;
+                                       if(value is ArrayObject)
+                                       {
+                                               pvalue = 
ArrayPrototype.join(value, String.Empty);
+                                       }
+                                       else
+                                       {
+                                               pvalue = 
Convert.ToString(value);
+                                       }
+                                       if(pvalue != null)
+                                       {
+                                               Console.Write(pvalue);
+                                       }
+                               }
                        }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]