aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTedd Hansen2007-08-12 16:44:57 +0000
committerTedd Hansen2007-08-12 16:44:57 +0000
commit734f28829064b4ef77ffce098e52e90224f064d3 (patch)
tree3159f5157dab0597823004243ac98e1c6c2d6e7c
parentHopefully fixes userprofiles.yap problem on startup. (thanks Adam!) (diff)
downloadopensim-SC_OLD-734f28829064b4ef77ffce098e52e90224f064d3.zip
opensim-SC_OLD-734f28829064b4ef77ffce098e52e90224f064d3.tar.gz
opensim-SC_OLD-734f28829064b4ef77ffce098e52e90224f064d3.tar.bz2
opensim-SC_OLD-734f28829064b4ef77ffce098e52e90224f064d3.tar.xz
LSL ScriptEngine now only needs to inherit from BaseClass and we will be MUCH closer to complete LSL support than we were yesterday.
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs45
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs2
2 files changed, 47 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
new file mode 100644
index 0000000..b5a4a39
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -0,0 +1,45 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5using Microsoft.CSharp;
6using System.CodeDom.Compiler;
7
8namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
9{
10 class Compiler
11 {
12 private LSL2CS.Converter.LSL2CSConverter LSL_Converter = new LSL2CS.Converter.LSL2CSConverter();
13 private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
14 //private ICodeCompiler icc = codeProvider.CreateCompiler();
15 public string Compile(string LSOFileName)
16 {
17
18
19 string OutFile = Path.GetFileNameWithoutExtension(LSOFileName);
20
21 // TODO: Add error handling
22 string CS_Code = LSL_Converter.Convert(File.ReadAllText(LSOFileName));
23
24 System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
25 parameters.GenerateExecutable = true;
26 parameters.OutputAssembly = OutFile;
27 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, CS_Code);
28
29 // TODO: Return errors to user somehow
30 if (results.Errors.Count > 0)
31 {
32 foreach (CompilerError CompErr in results.Errors)
33 {
34 Console.WriteLine("Line number " + CompErr.Line +
35 ", Error Number: " + CompErr.ErrorNumber +
36 ", '" + CompErr.ErrorText + ";");
37 }
38 }
39
40
41 return OutFile;
42 }
43
44 }
45}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index b302274..1a82f2f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -29,6 +29,8 @@ namespace LSL2CS.Converter
29 public string Convert(string Script) 29 public string Convert(string Script)
30 { 30 {
31 string Return = ""; 31 string Return = "";
32 QUOTES.Clear();
33
32 34
33 // 35 //
34 // Prepare script for processing 36 // Prepare script for processing