aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-26 15:34:23 +0000
committerMelanie Thielker2008-09-26 15:34:23 +0000
commit12a6b7c835cae71e87352a48087c253e8c147c38 (patch)
tree52b9d26b7cb62e0b1ae1a6a6f5db42dabe511899 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
parent* minor: fix lolbug in RestInventoryService spotted by jhurliman (diff)
downloadopensim-SC-12a6b7c835cae71e87352a48087c253e8c147c38.zip
opensim-SC-12a6b7c835cae71e87352a48087c253e8c147c38.tar.gz
opensim-SC-12a6b7c835cae71e87352a48087c253e8c147c38.tar.bz2
opensim-SC-12a6b7c835cae71e87352a48087c253e8c147c38.tar.xz
Yay! Common/ is gone! One API is achieved!
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs41
1 files changed, 14 insertions, 27 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 4cb74fa..4adedc3 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -217,23 +217,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
217 217
218 } 218 }
219 219
220 ////private ICodeCompiler icc = codeProvider.CreateCompiler();
221 //public string CompileFromFile(string LSOFileName)
222 //{
223 // switch (Path.GetExtension(LSOFileName).ToLower())
224 // {
225 // case ".txt":
226 // case ".lsl":
227 // Common.ScriptEngineBase.Common.SendToDebug("Source code is LSL, converting to CS");
228 // return CompileFromLSLText(File.ReadAllText(LSOFileName));
229 // case ".cs":
230 // Common.ScriptEngineBase.Common.SendToDebug("Source code is CS");
231 // return CompileFromCSText(File.ReadAllText(LSOFileName));
232 // default:
233 // throw new Exception("Unknown script type.");
234 // }
235 //}
236
237 /// <summary> 220 /// <summary>
238 /// Converts script from LSL to CS and calls CompileFromCSText 221 /// Converts script from LSL to CS and calls CompileFromCSText
239 /// </summary> 222 /// </summary>
@@ -332,9 +315,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
332 private static string CreateJSCompilerScript(string compileScript) 315 private static string CreateJSCompilerScript(string compileScript)
333 { 316 {
334 compileScript = String.Empty + 317 compileScript = String.Empty +
335 "import OpenSim.Region.ScriptEngine.Common; import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" + 318 "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
336 "package SecondLife {\r\n" + 319 "package SecondLife {\r\n" +
337 "class Script extends OpenSim.Region.ScriptEngine.Common.ScriptBaseClass { \r\n" + 320 "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
338 compileScript + 321 compileScript +
339 "} }\r\n"; 322 "} }\r\n";
340 return compileScript; 323 return compileScript;
@@ -343,9 +326,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
343 private static string CreateCSCompilerScript(string compileScript) 326 private static string CreateCSCompilerScript(string compileScript)
344 { 327 {
345 compileScript = String.Empty + 328 compileScript = String.Empty +
346 "using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + 329 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
347 String.Empty + "namespace SecondLife { " + 330 String.Empty + "namespace SecondLife { " +
348 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.ScriptBaseClass { \r\n" + 331 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
349 @"public Script() { } " + 332 @"public Script() { } " +
350 compileScript + 333 compileScript +
351 "} }\r\n"; 334 "} }\r\n";
@@ -356,9 +339,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
356 { 339 {
357 compileScript = String.Empty + 340 compileScript = String.Empty +
358 "using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " + 341 "using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " +
359 "using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + 342 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
360 String.Empty + "namespace SecondLife { " + 343 String.Empty + "namespace SecondLife { " +
361 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.ScriptBaseClass { \r\n" + 344 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
362 //@"public Script() { } " + 345 //@"public Script() { } " +
363 @"static OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP YP=null; " + 346 @"static OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP YP=null; " +
364 @"public Script() { YP= new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP(); } "+ 347 @"public Script() { YP= new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP(); } "+
@@ -371,9 +354,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
371 private static string CreateVBCompilerScript(string compileScript) 354 private static string CreateVBCompilerScript(string compileScript)
372 { 355 {
373 compileScript = String.Empty + 356 compileScript = String.Empty +
374 "Imports OpenSim.Region.ScriptEngine.Common: Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + 357 "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
375 String.Empty + "NameSpace SecondLife:" + 358 String.Empty + "NameSpace SecondLife:" +
376 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.ScriptBaseClass: " + 359 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass: " +
377 "\r\nPublic Sub New()\r\nEnd Sub: " + 360 "\r\nPublic Sub New()\r\nEnd Sub: " +
378 compileScript + 361 compileScript +
379 ":End Class :End Namespace\r\n"; 362 ":End Class :End Namespace\r\n";
@@ -439,9 +422,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
439 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); 422 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
440 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); 423 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location);
441 //Console.WriteLine("Assembly location: " + rootPath); 424 //Console.WriteLine("Assembly location: " + rootPath);
442 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
443 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); 425 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll"));
444 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); 426 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
427
428 if (lang == enumCompileType.yp)
429 {
430 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.YieldProlog.dll"));
431 }
445 432
446 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); 433 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
447 parameters.GenerateExecutable = false; 434 parameters.GenerateExecutable = false;