diff options
Diffstat (limited to 'OpenSim/ScriptEngine/Components/DotNetEngine/Compilers')
9 files changed, 0 insertions, 642 deletions
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs deleted file mode 100644 index 3d2d9d2..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/CILCompiler.cs +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.CodeDom.Compiler; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using log4net; | ||
34 | using OpenSim.ScriptEngine.Shared; | ||
35 | using ScriptAssemblies; | ||
36 | |||
37 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers | ||
38 | { | ||
39 | public abstract class CILCompiler | ||
40 | { | ||
41 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | private string ScriptEnginesPath = "ScriptEngines"; | ||
43 | private string Name { get { return "SECS.DotNetEngine.CILCompiler"; } } | ||
44 | private string m_scriptAssemblyName; | ||
45 | internal string ScriptAssemblyName { get { return m_scriptAssemblyName; } set { m_scriptAssemblyName = value; } } | ||
46 | |||
47 | // Default inherit | ||
48 | protected string ScriptInheritFrom = typeof(ScriptAssemblies.ScriptBase).Name; | ||
49 | private readonly System.Security.Cryptography.MD5CryptoServiceProvider MD5Sum = new System.Security.Cryptography.MD5CryptoServiceProvider(); | ||
50 | protected CodeDomProvider CompileProvider; | ||
51 | |||
52 | //private string[] AppDomainAssemblies = new string[] { "OpenSim.Region.ScriptEngine.Shared.dll", "OpenSim.Region.ScriptEngine.Shared.Script.dll", "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll" }; | ||
53 | private readonly string[] AppDomainAssemblies = new string[] { | ||
54 | Assembly.GetAssembly(typeof(Int32)).Location, | ||
55 | "OpenSim.ScriptEngine.Shared.dll", | ||
56 | "OpenSim.ScriptEngine.Shared.Script.dll", | ||
57 | Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.Shared.dll") | ||
58 | }; | ||
59 | |||
60 | public abstract string PreProcessScript(ref string script); | ||
61 | |||
62 | public CILCompiler() | ||
63 | { | ||
64 | } | ||
65 | |||
66 | private static readonly Regex FileNameFixer = new Regex(@"[^a-zA-Z0-9\.\-]", RegexOptions.Compiled | RegexOptions.Singleline); | ||
67 | public string Compile(ScriptMetaData data, ref string _script) | ||
68 | { | ||
69 | // Add "using", "inherit", default constructor, etc around script. | ||
70 | string script = PreProcessScript(ref _script); | ||
71 | |||
72 | // Get filename based on content | ||
73 | string md5Sum = System.Convert.ToBase64String( | ||
74 | MD5Sum.ComputeHash( | ||
75 | System.Text.Encoding.ASCII.GetBytes(script) | ||
76 | )); | ||
77 | // Unique name for this assembly | ||
78 | ScriptAssemblyName = "SECS_Script_" + FileNameFixer.Replace(md5Sum, "_"); | ||
79 | |||
80 | string OutFile = Path.Combine(ScriptEnginesPath, ScriptAssemblyName + ".dll"); | ||
81 | |||
82 | // Make sure target dir exist | ||
83 | if (!Directory.Exists(ScriptEnginesPath)) | ||
84 | try { Directory.CreateDirectory(ScriptEnginesPath); } | ||
85 | catch { } | ||
86 | |||
87 | // Already exist? No point in recompiling | ||
88 | if (File.Exists(OutFile)) | ||
89 | return OutFile; | ||
90 | |||
91 | // | ||
92 | // Dump source code | ||
93 | // | ||
94 | string dumpFile = OutFile + ".txt"; | ||
95 | try | ||
96 | { | ||
97 | if (File.Exists(dumpFile)) | ||
98 | File.Delete(dumpFile); | ||
99 | File.WriteAllText(dumpFile, script); | ||
100 | } | ||
101 | catch (Exception e) | ||
102 | { | ||
103 | m_log.DebugFormat("[{0}] Exception trying to dump script source code to file \"{1}\": {2}", Name, dumpFile, e.ToString()); | ||
104 | } | ||
105 | |||
106 | // | ||
107 | // COMPILE | ||
108 | // | ||
109 | |||
110 | CompilerParameters parameters = new CompilerParameters(); | ||
111 | parameters.IncludeDebugInformation = true; | ||
112 | //string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); | ||
113 | |||
114 | foreach (string file in AppDomainAssemblies) | ||
115 | { | ||
116 | parameters.ReferencedAssemblies.Add(file); | ||
117 | m_log.DebugFormat("[{0}] Adding reference for compile: \"{1}\".", Name, file); | ||
118 | } | ||
119 | //lock (commandProvider) | ||
120 | //{ | ||
121 | // foreach (string key in commandProvider.Keys) | ||
122 | // { | ||
123 | // IScriptCommandProvider cp = commandProvider[key]; | ||
124 | // string | ||
125 | // file = cp.GetType().Assembly.Location; | ||
126 | // parameters.ReferencedAssemblies.Add(file); | ||
127 | // m_log.DebugFormat("[{0}] Loading command provider assembly \"{1}\" into AppDomain: \"{2}\".", Name, | ||
128 | // key, file); | ||
129 | // } | ||
130 | //} | ||
131 | |||
132 | parameters.GenerateExecutable = false; | ||
133 | parameters.OutputAssembly = OutFile; | ||
134 | parameters.IncludeDebugInformation = true; | ||
135 | //parameters.WarningLevel = 1; // Should be 4? | ||
136 | parameters.TreatWarningsAsErrors = false; | ||
137 | |||
138 | // Do compile | ||
139 | CompilerResults results = CompileProvider.CompileAssemblyFromSource(parameters, script); | ||
140 | |||
141 | |||
142 | // | ||
143 | // WARNINGS AND ERRORS | ||
144 | // | ||
145 | //TODO | ||
146 | int display = 5; | ||
147 | if (results.Errors.Count > 0) | ||
148 | { | ||
149 | string errtext = String.Empty; | ||
150 | foreach (CompilerError CompErr in results.Errors) | ||
151 | { | ||
152 | // Show 5 errors max | ||
153 | // | ||
154 | if (display <= 0) | ||
155 | break; | ||
156 | display--; | ||
157 | |||
158 | string severity = "Error"; | ||
159 | if (CompErr.IsWarning) | ||
160 | severity = "Warning"; | ||
161 | |||
162 | //TODO: Implement | ||
163 | KeyValuePair<int, int> lslPos = new KeyValuePair<int, int>(); | ||
164 | |||
165 | //lslPos = "NOT IMPLEMENTED";// FindErrorPosition(CompErr.Line, CompErr.Column); | ||
166 | |||
167 | string text = CompErr.ErrorText; | ||
168 | |||
169 | // The Second Life viewer's script editor begins | ||
170 | // countingn lines and columns at 0, so we subtract 1. | ||
171 | errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", | ||
172 | lslPos.Key - 1, lslPos.Value - 1, | ||
173 | CompErr.ErrorNumber, text, severity); | ||
174 | } | ||
175 | |||
176 | if (!File.Exists(OutFile)) | ||
177 | { | ||
178 | throw new Exception(errtext); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | // TODO: Process errors | ||
183 | return OutFile; | ||
184 | } | ||
185 | |||
186 | } | ||
187 | } | ||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs deleted file mode 100644 index a8599bf..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_CS.cs +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.CodeDom.Compiler; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Microsoft.CSharp; | ||
32 | using OpenSim.ScriptEngine.Shared; | ||
33 | |||
34 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers | ||
35 | { | ||
36 | public class Compiler_CS : CILCompiler, IScriptCompiler | ||
37 | { | ||
38 | private string[] ScriptUsing = new string[] | ||
39 | { | ||
40 | "System", | ||
41 | "OpenSim.ScriptEngine.Shared", | ||
42 | "OpenSim.Region.ScriptEngine.Shared", | ||
43 | "System.Collections.Generic" | ||
44 | }; | ||
45 | |||
46 | public Compiler_CS() | ||
47 | { | ||
48 | CompileProvider = new CSharpCodeProvider(); | ||
49 | } | ||
50 | |||
51 | public override string PreProcessScript(ref string script) | ||
52 | { | ||
53 | string s = ""; | ||
54 | foreach (string u in ScriptUsing) | ||
55 | { | ||
56 | s += "using " + u + ";"; | ||
57 | } | ||
58 | |||
59 | s += "\r\n" | ||
60 | + String.Empty + "namespace ScriptAssemblies { " | ||
61 | + String.Empty + "public class UserScript" + " : " + ScriptInheritFrom + " { \r\n" + | ||
62 | @"public Script() { } " + | ||
63 | script + | ||
64 | "} }\r\n"; | ||
65 | |||
66 | return s; | ||
67 | } | ||
68 | |||
69 | } | ||
70 | } | ||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs deleted file mode 100644 index 4361ae2..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_JS.cs +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.CodeDom.Compiler; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Microsoft.JScript; | ||
32 | using OpenSim.ScriptEngine.Shared; | ||
33 | |||
34 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers | ||
35 | { | ||
36 | public class Compiler_JS : CILCompiler, IScriptCompiler | ||
37 | { | ||
38 | |||
39 | public Compiler_JS() | ||
40 | { | ||
41 | CompileProvider = new JScriptCodeProvider() as CodeDomProvider; | ||
42 | } | ||
43 | |||
44 | public override string PreProcessScript(ref string script) | ||
45 | { | ||
46 | return | ||
47 | "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" + | ||
48 | "package SecondLife {\r\n" + | ||
49 | "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" + | ||
50 | script + | ||
51 | "} }\r\n"; | ||
52 | |||
53 | } | ||
54 | |||
55 | } | ||
56 | } | ||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs deleted file mode 100644 index 496afc9..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_LSL.cs +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using System.Text; | ||
31 | using OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.LSL; | ||
32 | using OpenSim.ScriptEngine.Shared; | ||
33 | |||
34 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers | ||
35 | { | ||
36 | public class Compiler_LSL : IScriptCompiler | ||
37 | { | ||
38 | |||
39 | |||
40 | private readonly Compiler_CS m_Compiler_CS = new Compiler_CS(); | ||
41 | private readonly LSL2CS m_LSL2CS = new LSL2CS(); | ||
42 | |||
43 | public string Compile(ScriptMetaData scriptMetaData, ref string script) | ||
44 | { | ||
45 | // Convert script to CS | ||
46 | string scriptCS = m_LSL2CS.Convert(ref script); | ||
47 | // Use CS compiler to compile it | ||
48 | return m_Compiler_CS.Compile(scriptMetaData, ref scriptCS); | ||
49 | } | ||
50 | |||
51 | public string PreProcessScript(ref string script) | ||
52 | { | ||
53 | // This is handled by our converter | ||
54 | return script; | ||
55 | } | ||
56 | } | ||
57 | } | ||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs deleted file mode 100644 index 04597ba..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_VB.cs +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.CodeDom.Compiler; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using Microsoft.VisualBasic; | ||
32 | using OpenSim.ScriptEngine.Shared; | ||
33 | |||
34 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers | ||
35 | { | ||
36 | public class Compiler_VB : CILCompiler, IScriptCompiler | ||
37 | { | ||
38 | |||
39 | public Compiler_VB() | ||
40 | { | ||
41 | CompileProvider = new VBCodeProvider() as CodeDomProvider; | ||
42 | } | ||
43 | |||
44 | public override string PreProcessScript(ref string script) | ||
45 | { | ||
46 | return | ||
47 | "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + | ||
48 | String.Empty + "NameSpace SecondLife:" + | ||
49 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass: " + | ||
50 | "\r\nPublic Sub New()\r\nEnd Sub: " + | ||
51 | script + | ||
52 | ":End Class :End Namespace\r\n"; | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs deleted file mode 100644 index dce17ad..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Compiler_YP.cs +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using System.Text; | ||
31 | using OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.YP; | ||
32 | using OpenSim.ScriptEngine.Shared; | ||
33 | |||
34 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers | ||
35 | { | ||
36 | public class Compiler_YP: IScriptCompiler | ||
37 | { | ||
38 | |||
39 | private readonly Compiler_CS m_Compiler_CS = new Compiler_CS(); | ||
40 | |||
41 | public string Compile(ScriptMetaData scriptMetaData, ref string script) | ||
42 | { | ||
43 | // Convert script to CS | ||
44 | string scriptCS = YP2CS.Convert(ref script); | ||
45 | // Use CS compiler to compile it | ||
46 | return m_Compiler_CS.Compile(scriptMetaData, ref scriptCS); | ||
47 | } | ||
48 | |||
49 | public string PreProcessScript(ref string script) | ||
50 | { | ||
51 | // This is handled by our converter | ||
52 | return script; | ||
53 | } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs deleted file mode 100644 index d4af1c7..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/LSL/LSL2CS.cs +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Text; | ||
30 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | ||
31 | |||
32 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.LSL | ||
33 | { | ||
34 | public class LSL2CS | ||
35 | { | ||
36 | private ICodeConverter Converter = new CSCodeGenerator(); | ||
37 | |||
38 | public string Convert(ref string script) | ||
39 | { | ||
40 | //m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap; | ||
41 | return Converter.Convert(script); | ||
42 | } | ||
43 | } | ||
44 | } | ||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs deleted file mode 100644 index dedc48e..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using System.Runtime.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // General Information about an assembly is controlled through the following | ||
33 | // set of attributes. Change these attribute values to modify the information | ||
34 | // associated with an assembly. | ||
35 | [assembly: AssemblyTitle("OpenSim.ScriptEngine.Components.DotNetEngine.Compilers")] | ||
36 | [assembly: AssemblyDescription("")] | ||
37 | [assembly: AssemblyConfiguration("")] | ||
38 | [assembly: AssemblyCompany("http://opensimulator.org")] | ||
39 | [assembly: AssemblyProduct("OpenSim.ScriptEngine.Components.DotNetEngine.Compilers")] | ||
40 | [assembly: AssemblyCopyright("Copyright © Microsoft 2008")] | ||
41 | [assembly: AssemblyTrademark("")] | ||
42 | [assembly: AssemblyCulture("")] | ||
43 | |||
44 | // Setting ComVisible to false makes the types in this assembly not visible | ||
45 | // to COM components. If you need to access a type in this assembly from | ||
46 | // COM, set the ComVisible attribute to true on that type. | ||
47 | [assembly: ComVisible(false)] | ||
48 | |||
49 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
50 | [assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")] | ||
51 | |||
52 | // Version information for an assembly consists of the following four values: | ||
53 | // | ||
54 | // Major Version | ||
55 | // Minor Version | ||
56 | // Build Number | ||
57 | // Revision | ||
58 | // | ||
59 | // You can specify all the values or you can default the Build and Revision Numbers | ||
60 | // by using the '*' as shown below: | ||
61 | // [assembly: AssemblyVersion("0.6.5.*")] | ||
62 | [assembly: AssemblyVersion("0.6.5.*")] | ||
63 | [assembly: AssemblyFileVersion("0.6.5.0")] | ||
diff --git a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs b/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs deleted file mode 100644 index 10b5715..0000000 --- a/OpenSim/ScriptEngine/Components/DotNetEngine/Compilers/YP/YP2CS.cs +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Text; | ||
30 | |||
31 | namespace OpenSim.ScriptEngine.Components.DotNetEngine.Compilers.YP | ||
32 | { | ||
33 | public class YP2CS | ||
34 | { | ||
35 | public static string Convert(ref string script) | ||
36 | { | ||
37 | return script; | ||
38 | } | ||
39 | |||
40 | public string PreProcessScript(ref string script) | ||
41 | { | ||
42 | return | ||
43 | "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " + | ||
44 | "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + | ||
45 | String.Empty + "namespace SecondLife { " + | ||
46 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" + | ||
47 | //@"public Script() { } " + | ||
48 | @"static OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP YP=null; " + | ||
49 | @"public Script() { YP= new OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP(); } " + | ||
50 | script + | ||
51 | "} }\r\n"; | ||
52 | } | ||
53 | } | ||
54 | } | ||