Changeset 34100 for lang/csharp
- Timestamp:
- 06/22/09 13:26:10 (4 years ago)
- Location:
- lang/csharp/soyText/soyText
- Files:
-
- 9 modified
-
DocExecutor.cs (modified) (1 diff)
-
PythonEngine.cs (modified) (3 diffs)
-
Reg.cs (modified) (1 diff)
-
bin/Debug/soyText.application (modified) (1 diff)
-
bin/Debug/soyText.exe (modified) (previous)
-
bin/Debug/soyText.exe.manifest (modified) (2 diffs)
-
bin/Debug/soyText.pdb (modified) (previous)
-
bin/Debug/soyText.vshost.application (modified) (1 diff)
-
soyText.suo (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
lang/csharp/soyText/soyText/DocExecutor.cs
r34020 r34100 29 29 if (document.parsed["interpreter"] == "IronPython") 30 30 { 31 var p = new PythonEngine( );32 var res=p.evaluate( document.documentSet, scr);31 var p = new PythonEngine(document); 32 var res=p.evaluate(); //document.documentSet, scr); 33 33 stdout(res); 34 34 return; -
lang/csharp/soyText/soyText/PythonEngine.cs
r34038 r34100 16 16 private ScriptEngine engine; 17 17 private ScriptScope scope; 18 19 public PythonEngine( )18 private Document document; 19 public PythonEngine(Document document) 20 20 { 21 this.document = document; 21 22 engine = Python.CreateEngine(); 22 23 scope = engine.CreateScope(); … … 27 28 button = from_form; 28 29 } 29 /*public string evaluate(EditorTab ds, string code) 30 31 public string evaluate() 30 32 { 31 var u = new PythonUtil(ds); 32 return evaluate(u, code); 33 }*/ 33 var u = new PythonUtil(documentSet); 34 var uses=document.parsed["uses"] ?? ""; 35 var buf = ""; 36 buf += "import sys\r\n"; 37 buf += "sys.stdout=util\r\n"; 38 buf += "sys.path+=[r\"" + libDir + "\"]\r\n"; 39 foreach (var l in Str.eachLine(uses)) 40 { 41 var s = l; 42 Reg.sub(ref s, @"^\s*", ""); 43 importModule(s); 44 buf += "from m" + s + " import *\r\n"; 45 } 46 return evaluate(u, buf+document.body); 47 } 48 public void importModule(string id) 49 { 50 Mkdir.setFileContent(libDir + "/m" + id + ".py", documentSet.byId(id).body); 34 51 35 public string evaluate(DocumentSet ds, string code)36 {37 var u = new PythonUtil(ds);38 return evaluate(u, code);39 52 } 40 53 public string evaluate(PythonUtil u, string code) { 41 54 scope.SetVariable("util", u); 42 43 /*var d=Delegate.CreateDelegate(;44 d.Method=delegate(string s)45 {46 MessageBox.Show(s);47 });48 scope.("alert",);*/49 55 50 56 try … … 61 67 } 62 68 return u.stdout; 63 64 /* 65 if (!scope.ContainsVariable("x")) 69 } 70 public DocumentSet documentSet 71 { 72 get 66 73 { 67 return "x was deleted";74 return document.documentSet; 68 75 } 69 string result = scope.GetVariable<object>("x").ToString(); 70 if (result == "") return "RESULT is empty: " + code; 71 return result.Length+": "+result;*/ 76 } 77 public string libDir 78 { 79 get 80 { 81 return documentSet.workspace.home + "/ironPython/lib"; 82 } 72 83 } 73 84 } -
lang/csharp/soyText/soyText/Reg.cs
r33400 r34100 56 56 return false; 57 57 }*/ 58 59 internal static void sub(ref string l, string pattern, string replacement) 60 { 61 l=Regex.Replace(l, pattern, replacement); 62 63 } 58 64 } 59 65 } -
lang/csharp/soyText/soyText/bin/Debug/soyText.application
r34038 r34100 12 12 </dsig:Transforms> 13 13 <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 14 <dsig:DigestValue> nyZII1fjkR8GGyK7/De/XtqCQy8=</dsig:DigestValue>14 <dsig:DigestValue>XyuhzM+190h32w0NIpb41p7hQD4=</dsig:DigestValue> 15 15 </hash> 16 16 </dependentAssembly> -
lang/csharp/soyText/soyText/bin/Debug/soyText.exe.manifest
r34038 r34100 113 113 </dependency> 114 114 <dependency> 115 <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="7 7824">115 <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="soyText.exe" size="78848"> 116 116 <assemblyIdentity name="soyText" version="1.0.0.0" language="neutral" processorArchitecture="msil" /> 117 117 <hash> … … 120 120 </dsig:Transforms> 121 121 <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 122 <dsig:DigestValue> DF71TlIMf9OQjcnh3xPI2JEU0MU=</dsig:DigestValue>122 <dsig:DigestValue>3YywIbZ7rDDj2rf0+lJMxLbWIps=</dsig:DigestValue> 123 123 </hash> 124 124 </dependentAssembly> -
lang/csharp/soyText/soyText/bin/Debug/soyText.vshost.application
r34038 r34100 12 12 </dsig:Transforms> 13 13 <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> 14 <dsig:DigestValue> nyZII1fjkR8GGyK7/De/XtqCQy8=</dsig:DigestValue>14 <dsig:DigestValue>XyuhzM+190h32w0NIpb41p7hQD4=</dsig:DigestValue> 15 15 </hash> 16 16 </dependentAssembly>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)