diff options
author | Adam Frisby | 2008-05-08 05:09:35 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-08 05:09:35 +0000 |
commit | 8a48516bcfcce1a49499d33db0e8eab2f59f7c1a (patch) | |
tree | ead8b2684a00546180dc5ccbcedbce48427faeb5 | |
parent | * Fixes Prim ExtraParams (diff) | |
download | opensim-SC-8a48516bcfcce1a49499d33db0e8eab2f59f7c1a.zip opensim-SC-8a48516bcfcce1a49499d33db0e8eab2f59f7c1a.tar.gz opensim-SC-8a48516bcfcce1a49499d33db0e8eab2f59f7c1a.tar.bz2 opensim-SC-8a48516bcfcce1a49499d33db0e8eab2f59f7c1a.tar.xz |
* Spring cleaning, round 3029
36 files changed, 5 insertions, 3489 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 3a45f70..d349d37 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Net; | ||
29 | using log4net.Config; | 30 | using log4net.Config; |
30 | using Nini.Config; | 31 | using Nini.Config; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -137,7 +138,7 @@ namespace OpenSim | |||
137 | // System.Web.HttpUtility.UrlEncode(msg)); | 138 | // System.Web.HttpUtility.UrlEncode(msg)); |
138 | //wc.Dispose(); | 139 | //wc.Dispose(); |
139 | } | 140 | } |
140 | catch (Exception) | 141 | catch (WebException) |
141 | { | 142 | { |
142 | // Ignore | 143 | // Ignore |
143 | } | 144 | } |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 735f662..adfddcb 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -351,7 +351,7 @@ namespace OpenSim | |||
351 | { | 351 | { |
352 | // Set BuildVersion String for Show version command | 352 | // Set BuildVersion String for Show version command |
353 | string svnFileName = "../.svn/entries"; | 353 | string svnFileName = "../.svn/entries"; |
354 | string inputLine = null; | 354 | string inputLine; |
355 | int strcmp; | 355 | int strcmp; |
356 | 356 | ||
357 | if (File.Exists(svnFileName)) | 357 | if (File.Exists(svnFileName)) |
@@ -375,7 +375,7 @@ namespace OpenSim | |||
375 | EntriesFile.Close(); | 375 | EntriesFile.Close(); |
376 | } | 376 | } |
377 | 377 | ||
378 | if ((buildVersion != null) && (buildVersion.Length > 0)) | 378 | if (!string.IsNullOrEmpty(buildVersion)) |
379 | { | 379 | { |
380 | m_log.Info("[STARTUP]: OpenSim version: " + VersionInfo.Version + ", SVN build r" + buildVersion + "\n"); | 380 | m_log.Info("[STARTUP]: OpenSim version: " + VersionInfo.Version + ", SVN build r" + buildVersion + "\n"); |
381 | } | 381 | } |
diff --git a/OpenSim/Region/Application/OpenSimMainConsole.cs b/OpenSim/Region/Application/OpenSimMainConsole.cs index 2653273..c02095c 100644 --- a/OpenSim/Region/Application/OpenSimMainConsole.cs +++ b/OpenSim/Region/Application/OpenSimMainConsole.cs | |||
@@ -643,7 +643,7 @@ namespace OpenSim | |||
643 | break; | 643 | break; |
644 | 644 | ||
645 | case "version": | 645 | case "version": |
646 | if ((buildVersion != null) && (buildVersion.Length > 0)) | 646 | if (!string.IsNullOrEmpty(buildVersion)) |
647 | { | 647 | { |
648 | m_console.Notice("The build version is: r" + buildVersion); | 648 | m_console.Notice("The build version is: r" + buildVersion); |
649 | } | 649 | } |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs deleted file mode 100644 index a06e222..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs +++ /dev/null | |||
@@ -1,107 +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 OpenSim 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; | ||
29 | using System.CodeDom.Compiler; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Microsoft.CSharp; | ||
34 | |||
35 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.CSharp | ||
36 | { | ||
37 | public class CSharpScriptEngine : IScriptCompiler | ||
38 | { | ||
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
41 | public string FileExt() | ||
42 | { | ||
43 | return ".cs"; | ||
44 | } | ||
45 | |||
46 | private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) | ||
47 | { | ||
48 | CompilerParameters compilerParams = new CompilerParameters(); | ||
49 | CompilerResults compilerResults; | ||
50 | compilerParams.GenerateExecutable = false; | ||
51 | compilerParams.GenerateInMemory = true; | ||
52 | compilerParams.IncludeDebugInformation = false; | ||
53 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll"); | ||
54 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); | ||
55 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll"); | ||
56 | compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); | ||
57 | compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); | ||
58 | compilerParams.ReferencedAssemblies.Add("System.dll"); | ||
59 | |||
60 | compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); | ||
61 | |||
62 | if (compilerResults.Errors.Count > 0) | ||
63 | { | ||
64 | m_log.Error("Compile errors"); | ||
65 | foreach (CompilerError error in compilerResults.Errors) | ||
66 | { | ||
67 | m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); | ||
68 | } | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); | ||
73 | |||
74 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) | ||
75 | { | ||
76 | Type testInterface = pluginType.GetInterface("IScript", true); | ||
77 | |||
78 | if (testInterface != null) | ||
79 | { | ||
80 | IScript script = | ||
81 | (IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | ||
82 | |||
83 | string scriptName = "C#/" + script.Name; | ||
84 | Console.WriteLine("Script: " + scriptName + " loaded."); | ||
85 | |||
86 | if (!scripts.ContainsKey(scriptName)) | ||
87 | { | ||
88 | scripts.Add(scriptName, script); | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | scripts[scriptName] = script; | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | return scripts; | ||
97 | } | ||
98 | return null; | ||
99 | } | ||
100 | |||
101 | public Dictionary<string, IScript> compile(string filename) | ||
102 | { | ||
103 | CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); | ||
104 | return LoadDotNetScript(csharpProvider, filename); | ||
105 | } | ||
106 | } | ||
107 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs deleted file mode 100644 index dfe9336..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs +++ /dev/null | |||
@@ -1,75 +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 OpenSim 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 OpenSim.Region.Environment.Scenes; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.CSharp.Examples | ||
31 | { | ||
32 | public class LSLExportScript : IScript | ||
33 | { | ||
34 | private ScriptInfo script; | ||
35 | |||
36 | public string Name | ||
37 | { | ||
38 | get { return "LSL Export Script 0.1"; } | ||
39 | } | ||
40 | |||
41 | public void Initialise(ScriptInfo scriptInfo) | ||
42 | { | ||
43 | script = scriptInfo; | ||
44 | |||
45 | script.events.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(ProcessConsoleMsg); | ||
46 | } | ||
47 | |||
48 | private void ProcessConsoleMsg(string[] args) | ||
49 | { | ||
50 | /*if (args[0].ToLower() == "lslexport") | ||
51 | { | ||
52 | string sequence = String.Empty; | ||
53 | |||
54 | foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) | ||
55 | { | ||
56 | SceneObject root = obj.Value; | ||
57 | |||
58 | sequence += "NEWOBJ::" + obj.Key.ToString() + "\n"; | ||
59 | |||
60 | string rootPrim = processPrimitiveToString(root.rootPrimitive); | ||
61 | |||
62 | sequence += "ROOT:" + rootPrim; | ||
63 | |||
64 | foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) | ||
65 | { | ||
66 | string child = processPrimitiveToString(prim.Value); | ||
67 | sequence += "CHILD:" + child; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | System.Console.WriteLine(sequence); | ||
72 | }*/ | ||
73 | } | ||
74 | } | ||
75 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs deleted file mode 100644 index 0c3d50e..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs +++ /dev/null | |||
@@ -1,107 +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 OpenSim 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; | ||
29 | using System.CodeDom.Compiler; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Microsoft.JScript; | ||
34 | |||
35 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JScript | ||
36 | { | ||
37 | public class JScriptEngine : IScriptCompiler | ||
38 | { | ||
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
41 | public string FileExt() | ||
42 | { | ||
43 | return ".js"; | ||
44 | } | ||
45 | |||
46 | private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) | ||
47 | { | ||
48 | CompilerParameters compilerParams = new CompilerParameters(); | ||
49 | CompilerResults compilerResults; | ||
50 | compilerParams.GenerateExecutable = false; | ||
51 | compilerParams.GenerateInMemory = true; | ||
52 | compilerParams.IncludeDebugInformation = false; | ||
53 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll"); | ||
54 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); | ||
55 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll"); | ||
56 | compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); | ||
57 | compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); | ||
58 | compilerParams.ReferencedAssemblies.Add("System.dll"); | ||
59 | |||
60 | compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); | ||
61 | |||
62 | if (compilerResults.Errors.Count > 0) | ||
63 | { | ||
64 | m_log.Error("Compile errors"); | ||
65 | foreach (CompilerError error in compilerResults.Errors) | ||
66 | { | ||
67 | m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); | ||
68 | } | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); | ||
73 | |||
74 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) | ||
75 | { | ||
76 | Type testInterface = pluginType.GetInterface("IScript", true); | ||
77 | |||
78 | if (testInterface != null) | ||
79 | { | ||
80 | IScript script = | ||
81 | (IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | ||
82 | |||
83 | string scriptName = "JS.NET/" + script.Name; | ||
84 | Console.WriteLine("Script: " + scriptName + " loaded."); | ||
85 | |||
86 | if (!scripts.ContainsKey(scriptName)) | ||
87 | { | ||
88 | scripts.Add(scriptName, script); | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | scripts[scriptName] = script; | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | return scripts; | ||
97 | } | ||
98 | return null; | ||
99 | } | ||
100 | |||
101 | public Dictionary<string, IScript> compile(string filename) | ||
102 | { | ||
103 | JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); | ||
104 | return LoadDotNetScript(jscriptProvider, filename); | ||
105 | } | ||
106 | } | ||
107 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs deleted file mode 100644 index b6a0046..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs +++ /dev/null | |||
@@ -1,43 +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 OpenSim 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.Collections.Generic; | ||
29 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types; | ||
30 | |||
31 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
32 | { | ||
33 | public class ClassInstance : Object | ||
34 | { | ||
35 | public int Size; | ||
36 | public ClassRecord ClassRec; | ||
37 | public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); | ||
38 | |||
39 | public ClassInstance() | ||
40 | { | ||
41 | } | ||
42 | } | ||
43 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs deleted file mode 100644 index d1cacd3..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs +++ /dev/null | |||
@@ -1,648 +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 OpenSim 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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
35 | { | ||
36 | public class ClassRecord | ||
37 | { | ||
38 | private ushort m_majorVersion; | ||
39 | private ushort m_minorVersion; | ||
40 | private ushort m_constantPoolCount; | ||
41 | private ushort m_accessFlags; | ||
42 | private ushort m_thisClass; | ||
43 | private ushort m_supperClass; | ||
44 | private ushort m_interfaceCount; | ||
45 | private ushort m_fieldCount; | ||
46 | private ushort m_methodCount; | ||
47 | //private ushort _attributeCount; | ||
48 | //private string _name; | ||
49 | public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); | ||
50 | public PoolClass MClass; | ||
51 | |||
52 | public List<PoolItem> m_constantsPool = new List<PoolItem>(); | ||
53 | private List<MethodInfo> m_methodsList = new List<MethodInfo>(); | ||
54 | private List<FieldInfo> m_fieldList = new List<FieldInfo>(); | ||
55 | |||
56 | public ClassRecord() | ||
57 | { | ||
58 | } | ||
59 | |||
60 | public ClassInstance CreateNewInstance() | ||
61 | { | ||
62 | ClassInstance classInst = new ClassInstance(); | ||
63 | classInst.ClassRec = this; | ||
64 | //TODO: set fields | ||
65 | |||
66 | return classInst; | ||
67 | } | ||
68 | |||
69 | public void LoadClassFromFile(string fileName) | ||
70 | { | ||
71 | Console.WriteLine("loading script " + fileName); | ||
72 | FileStream fs = File.OpenRead(fileName); | ||
73 | LoadClassFromBytes(ReadFully(fs)); | ||
74 | fs.Close(); | ||
75 | } | ||
76 | |||
77 | public void LoadClassFromBytes(byte[] data) | ||
78 | { | ||
79 | int i = 0; | ||
80 | i += 4; | ||
81 | m_minorVersion = (ushort) ((data[i++] << 8) + data[i++]); | ||
82 | m_majorVersion = (ushort) ((data[i++] << 8) + data[i++]); | ||
83 | m_constantPoolCount = (ushort) ((data[i++] << 8) + data[i++]); | ||
84 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); | ||
85 | for (int count = 0; count < (m_constantPoolCount - 1); count++) | ||
86 | { | ||
87 | //read in the constant pool | ||
88 | byte pooltype = data[i++]; | ||
89 | Console.WriteLine("#" + count + ": new constant type = " + pooltype); | ||
90 | //Console.WriteLine("start position is: " + i); | ||
91 | switch (pooltype) | ||
92 | { | ||
93 | case 1: //Utf8 | ||
94 | ushort uLength = (ushort) ((data[i++] << 8) + data[i++]); | ||
95 | |||
96 | // Console.WriteLine("new utf8 type, length is " + uLength); | ||
97 | PoolUtf8 utf8 = new PoolUtf8(); | ||
98 | utf8.readValue(data, ref i, uLength); | ||
99 | m_constantsPool.Add(utf8); | ||
100 | break; | ||
101 | case 3: //Int | ||
102 | break; | ||
103 | case 4: //Float | ||
104 | break; | ||
105 | case 7: //Class | ||
106 | PoolClass pClass = new PoolClass(this); | ||
107 | pClass.readValue(data, ref i); | ||
108 | m_constantsPool.Add(pClass); | ||
109 | break; | ||
110 | case 9: //FieldRef | ||
111 | PoolFieldRef pField = new PoolFieldRef(this); | ||
112 | pField.readValue(data, ref i); | ||
113 | m_constantsPool.Add(pField); | ||
114 | break; | ||
115 | case 10: //Method | ||
116 | PoolMethodRef pMeth = new PoolMethodRef(this); | ||
117 | pMeth.readValue(data, ref i); | ||
118 | m_constantsPool.Add(pMeth); | ||
119 | break; | ||
120 | case 12: //NamedType | ||
121 | PoolNamedType pNamed = new PoolNamedType(this); | ||
122 | pNamed.readValue(data, ref i); | ||
123 | m_constantsPool.Add(pNamed); | ||
124 | break; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | m_accessFlags = (ushort) ((data[i++] << 8) + data[i++]); | ||
129 | m_thisClass = (ushort) ((data[i++] << 8) + data[i++]); | ||
130 | m_supperClass = (ushort) ((data[i++] << 8) + data[i++]); | ||
131 | |||
132 | if (m_constantsPool[m_thisClass - 1] is PoolClass) | ||
133 | { | ||
134 | MClass = ((PoolClass) m_constantsPool[m_thisClass - 1]); | ||
135 | } | ||
136 | |||
137 | m_interfaceCount = (ushort) ((data[i++] << 8) + data[i++]); | ||
138 | //should now read in the info for each interface | ||
139 | |||
140 | m_fieldCount = (ushort) ((data[i++] << 8) + data[i++]); | ||
141 | //should now read in the info for each field | ||
142 | for (int count = 0; count < m_fieldCount; count++) | ||
143 | { | ||
144 | FieldInfo fieldInf = new FieldInfo(this); | ||
145 | fieldInf.ReadData(data, ref i); | ||
146 | m_fieldList.Add(fieldInf); | ||
147 | } | ||
148 | |||
149 | m_methodCount = (ushort) ((data[i++] << 8) + data[i++]); | ||
150 | for (int count = 0; count < m_methodCount; count++) | ||
151 | { | ||
152 | MethodInfo methInf = new MethodInfo(this); | ||
153 | methInf.ReadData(data, ref i); | ||
154 | m_methodsList.Add(methInf); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | public void AddMethodsToMemory(MethodMemory memory) | ||
159 | { | ||
160 | for (int count = 0; count < m_methodCount; count++) | ||
161 | { | ||
162 | m_methodsList[count].AddMethodCode(memory); | ||
163 | } | ||
164 | } | ||
165 | |||
166 | public bool StartMethod(Thread thread, string methodName) | ||
167 | { | ||
168 | for (int count = 0; count < m_methodCount; count++) | ||
169 | { | ||
170 | if (m_constantsPool[m_methodsList[count].NameIndex - 1] is PoolUtf8) | ||
171 | { | ||
172 | if (((PoolUtf8) m_constantsPool[m_methodsList[count].NameIndex - 1]).Value == methodName) | ||
173 | { | ||
174 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); | ||
175 | thread.SetPC(m_methodsList[count].CodePointer); | ||
176 | return true; | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | return false; | ||
181 | } | ||
182 | |||
183 | public void PrintToConsole() | ||
184 | { | ||
185 | Console.WriteLine("Class File:"); | ||
186 | Console.WriteLine("Major version: " + m_majorVersion); | ||
187 | Console.WriteLine("Minor version: " + m_minorVersion); | ||
188 | Console.WriteLine("Pool size: " + m_constantPoolCount); | ||
189 | |||
190 | for (int i = 0; i < m_constantsPool.Count; i++) | ||
191 | { | ||
192 | m_constantsPool[i].Print(); | ||
193 | } | ||
194 | |||
195 | Console.WriteLine("Access flags: " + m_accessFlags); | ||
196 | Console.WriteLine("This class: " + m_thisClass); | ||
197 | Console.WriteLine("Super class: " + m_supperClass); | ||
198 | |||
199 | for (int count = 0; count < m_fieldCount; count++) | ||
200 | { | ||
201 | Console.WriteLine(); | ||
202 | m_fieldList[count].Print(); | ||
203 | } | ||
204 | |||
205 | for (int count = 0; count < m_methodCount; count++) | ||
206 | { | ||
207 | Console.WriteLine(); | ||
208 | m_methodsList[count].Print(); | ||
209 | } | ||
210 | |||
211 | Console.WriteLine("class name is " + MClass.Name.Value); | ||
212 | } | ||
213 | |||
214 | public static byte[] ReadFully(Stream stream) | ||
215 | { | ||
216 | byte[] buffer = new byte[1024]; | ||
217 | using (MemoryStream ms = new MemoryStream()) | ||
218 | { | ||
219 | while (true) | ||
220 | { | ||
221 | int read = stream.Read(buffer, 0, buffer.Length); | ||
222 | if (read <= 0) | ||
223 | return ms.ToArray(); | ||
224 | ms.Write(buffer, 0, read); | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | |||
229 | #region nested classes | ||
230 | |||
231 | public class PoolItem | ||
232 | { | ||
233 | public virtual void Print() | ||
234 | { | ||
235 | } | ||
236 | } | ||
237 | |||
238 | public class PoolUtf8 : PoolItem | ||
239 | { | ||
240 | public string Value = String.Empty; | ||
241 | |||
242 | public void readValue(byte[] data, ref int pointer, int length) | ||
243 | { | ||
244 | for (int i = 0; i < length; i++) | ||
245 | { | ||
246 | int a = (int) data[pointer++]; | ||
247 | if ((a & 0x80) == 0) | ||
248 | { | ||
249 | Value = Value + (char) a; | ||
250 | } | ||
251 | else if ((a & 0x20) == 0) | ||
252 | { | ||
253 | int b = (int) data[pointer++]; | ||
254 | Value = Value + (char) (((a & 0x1f) << 6) + (b & 0x3f)); | ||
255 | } | ||
256 | else | ||
257 | { | ||
258 | int b = (int) data[pointer++]; | ||
259 | int c = (int) data[pointer++]; | ||
260 | Value = Value + (char) (((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | |||
265 | public override void Print() | ||
266 | { | ||
267 | Console.WriteLine("Utf8 type: " + Value); | ||
268 | } | ||
269 | } | ||
270 | |||
271 | private class PoolInt : PoolItem | ||
272 | { | ||
273 | } | ||
274 | |||
275 | public class PoolClass : PoolItem | ||
276 | { | ||
277 | //public string name = String.Empty; | ||
278 | public ushort namePointer = 0; | ||
279 | private ClassRecord parent; | ||
280 | public PoolUtf8 Name; | ||
281 | |||
282 | public PoolClass(ClassRecord paren) | ||
283 | { | ||
284 | parent = paren; | ||
285 | } | ||
286 | |||
287 | public void readValue(byte[] data, ref int pointer) | ||
288 | { | ||
289 | namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
290 | } | ||
291 | |||
292 | public override void Print() | ||
293 | { | ||
294 | Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]); | ||
295 | Console.Write("Class type: " + namePointer); | ||
296 | Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | public class PoolFieldRef : PoolItem | ||
301 | { | ||
302 | public ushort classPointer = 0; | ||
303 | public ushort nameTypePointer = 0; | ||
304 | public PoolNamedType mNameType; | ||
305 | public PoolClass mClass; | ||
306 | private ClassRecord parent; | ||
307 | |||
308 | public PoolFieldRef(ClassRecord paren) | ||
309 | { | ||
310 | parent = paren; | ||
311 | } | ||
312 | |||
313 | public void readValue(byte[] data, ref int pointer) | ||
314 | { | ||
315 | classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
316 | nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
317 | } | ||
318 | |||
319 | public override void Print() | ||
320 | { | ||
321 | mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]); | ||
322 | mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]); | ||
323 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); | ||
324 | } | ||
325 | } | ||
326 | |||
327 | public class PoolMethodRef : PoolItem | ||
328 | { | ||
329 | public ushort classPointer = 0; | ||
330 | public ushort nameTypePointer = 0; | ||
331 | public PoolNamedType mNameType; | ||
332 | public PoolClass mClass; | ||
333 | private ClassRecord parent; | ||
334 | |||
335 | public PoolMethodRef(ClassRecord paren) | ||
336 | { | ||
337 | parent = paren; | ||
338 | } | ||
339 | |||
340 | public void readValue(byte[] data, ref int pointer) | ||
341 | { | ||
342 | classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
343 | nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
344 | } | ||
345 | |||
346 | public override void Print() | ||
347 | { | ||
348 | mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]); | ||
349 | mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]); | ||
350 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | public class PoolNamedType : PoolItem | ||
355 | { | ||
356 | public ushort namePointer = 0; | ||
357 | public ushort typePointer = 0; | ||
358 | private ClassRecord parent; | ||
359 | public PoolUtf8 Name; | ||
360 | public PoolUtf8 Type; | ||
361 | |||
362 | public PoolNamedType(ClassRecord paren) | ||
363 | { | ||
364 | parent = paren; | ||
365 | } | ||
366 | |||
367 | public void readValue(byte[] data, ref int pointer) | ||
368 | { | ||
369 | namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
370 | typePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
371 | } | ||
372 | |||
373 | public override void Print() | ||
374 | { | ||
375 | Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]); | ||
376 | Type = ((PoolUtf8) parent.m_constantsPool[typePointer - 1]); | ||
377 | Console.Write("Named type: " + namePointer + " , " + typePointer); | ||
378 | Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | //*********************** | ||
383 | public class MethodInfo | ||
384 | { | ||
385 | public ushort AccessFlags = 0; | ||
386 | public ushort NameIndex = 0; | ||
387 | public string Name = String.Empty; | ||
388 | public ushort DescriptorIndex = 0; | ||
389 | public ushort AttributeCount = 0; | ||
390 | public List<MethodAttribute> Attributes = new List<MethodAttribute>(); | ||
391 | private ClassRecord parent; | ||
392 | public int CodePointer = 0; | ||
393 | |||
394 | public MethodInfo(ClassRecord paren) | ||
395 | { | ||
396 | parent = paren; | ||
397 | } | ||
398 | |||
399 | public void AddMethodCode(MethodMemory memory) | ||
400 | { | ||
401 | Array.Copy(Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, Attributes[0].Code.Length); | ||
402 | memory.Methodcount++; | ||
403 | CodePointer = memory.NextMethodPC; | ||
404 | memory.NextMethodPC += Attributes[0].Code.Length; | ||
405 | } | ||
406 | |||
407 | public void ReadData(byte[] data, ref int pointer) | ||
408 | { | ||
409 | AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
410 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
411 | DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
412 | AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
413 | for (int i = 0; i < AttributeCount; i++) | ||
414 | { | ||
415 | MethodAttribute attri = new MethodAttribute(parent); | ||
416 | attri.ReadData(data, ref pointer); | ||
417 | Attributes.Add(attri); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | public void Print() | ||
422 | { | ||
423 | Console.WriteLine("Method Info Struct: "); | ||
424 | Console.WriteLine("AccessFlags: " + AccessFlags); | ||
425 | Console.WriteLine("NameIndex: " + NameIndex + " // " + | ||
426 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
427 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + | ||
428 | ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value); | ||
429 | Console.WriteLine("Attribute Count:" + AttributeCount); | ||
430 | for (int i = 0; i < AttributeCount; i++) | ||
431 | { | ||
432 | Attributes[i].Print(); | ||
433 | } | ||
434 | } | ||
435 | |||
436 | public class MethodAttribute | ||
437 | { | ||
438 | public ushort NameIndex = 0; | ||
439 | public string Name = String.Empty; | ||
440 | public Int32 Length = 0; | ||
441 | //for now only support code attribute | ||
442 | public ushort MaxStack = 0; | ||
443 | public ushort MaxLocals = 0; | ||
444 | public Int32 CodeLength = 0; | ||
445 | public byte[] Code; | ||
446 | public ushort ExceptionTableLength = 0; | ||
447 | public ushort SubAttributeCount = 0; | ||
448 | public List<SubAttribute> SubAttributes = new List<SubAttribute>(); | ||
449 | private ClassRecord parent; | ||
450 | |||
451 | public MethodAttribute(ClassRecord paren) | ||
452 | { | ||
453 | parent = paren; | ||
454 | } | ||
455 | |||
456 | public void ReadData(byte[] data, ref int pointer) | ||
457 | { | ||
458 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
459 | Length = | ||
460 | (Int32) | ||
461 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
462 | MaxStack = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
463 | MaxLocals = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
464 | CodeLength = | ||
465 | (Int32) | ||
466 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
467 | Code = new byte[CodeLength]; | ||
468 | for (int i = 0; i < CodeLength; i++) | ||
469 | { | ||
470 | Code[i] = data[pointer++]; | ||
471 | } | ||
472 | ExceptionTableLength = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
473 | SubAttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
474 | for (int i = 0; i < SubAttributeCount; i++) | ||
475 | { | ||
476 | SubAttribute subAttri = new SubAttribute(parent); | ||
477 | subAttri.ReadData(data, ref pointer); | ||
478 | SubAttributes.Add(subAttri); | ||
479 | } | ||
480 | } | ||
481 | |||
482 | public void Print() | ||
483 | { | ||
484 | Console.WriteLine("Method Attribute: "); | ||
485 | Console.WriteLine("Name Index: " + NameIndex + " // " + | ||
486 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
487 | Console.WriteLine("Length: " + Length); | ||
488 | Console.WriteLine("MaxStack: " + MaxStack); | ||
489 | Console.WriteLine("MaxLocals: " + MaxLocals); | ||
490 | Console.WriteLine("CodeLength: " + CodeLength); | ||
491 | for (int i = 0; i < Code.Length; i++) | ||
492 | { | ||
493 | Console.WriteLine("OpCode #" + i + " is: " + Code[i]); | ||
494 | } | ||
495 | Console.WriteLine("SubAttributes: " + SubAttributeCount); | ||
496 | for (int i = 0; i < SubAttributeCount; i++) | ||
497 | { | ||
498 | SubAttributes[i].Print(); | ||
499 | } | ||
500 | } | ||
501 | |||
502 | public class SubAttribute | ||
503 | { | ||
504 | public ushort NameIndex = 0; | ||
505 | public string Name = String.Empty; | ||
506 | public Int32 Length = 0; | ||
507 | public byte[] Data; | ||
508 | private ClassRecord parent; | ||
509 | |||
510 | public SubAttribute(ClassRecord paren) | ||
511 | { | ||
512 | parent = paren; | ||
513 | } | ||
514 | |||
515 | public void ReadData(byte[] data, ref int pointer) | ||
516 | { | ||
517 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
518 | Length = | ||
519 | (Int32) | ||
520 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + | ||
521 | data[pointer++]); | ||
522 | Data = new byte[Length]; | ||
523 | for (int i = 0; i < Length; i++) | ||
524 | { | ||
525 | Data[i] = data[pointer++]; | ||
526 | } | ||
527 | } | ||
528 | |||
529 | public void Print() | ||
530 | { | ||
531 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + | ||
532 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
533 | } | ||
534 | } | ||
535 | } | ||
536 | } | ||
537 | |||
538 | private class InterfaceInfo | ||
539 | { | ||
540 | public void ReadData(byte[] data, ref int i) | ||
541 | { | ||
542 | } | ||
543 | } | ||
544 | |||
545 | public class FieldInfo | ||
546 | { | ||
547 | public ushort AccessFlags = 0; | ||
548 | public ushort NameIndex = 0; | ||
549 | public string Name = String.Empty; | ||
550 | public ushort DescriptorIndex = 0; | ||
551 | public ushort AttributeCount = 0; | ||
552 | public List<FieldAttribute> Attributes = new List<FieldAttribute>(); | ||
553 | private ClassRecord parent; | ||
554 | |||
555 | public FieldInfo(ClassRecord paren) | ||
556 | { | ||
557 | parent = paren; | ||
558 | } | ||
559 | |||
560 | public void ReadData(byte[] data, ref int pointer) | ||
561 | { | ||
562 | AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
563 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
564 | DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
565 | AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
566 | for (int i = 0; i < AttributeCount; i++) | ||
567 | { | ||
568 | FieldAttribute attri = new FieldAttribute(parent); | ||
569 | attri.ReadData(data, ref pointer); | ||
570 | Attributes.Add(attri); | ||
571 | } | ||
572 | } | ||
573 | |||
574 | public void Print() | ||
575 | { | ||
576 | Console.WriteLine("Field Info Struct: "); | ||
577 | Console.WriteLine("AccessFlags: " + AccessFlags); | ||
578 | Console.WriteLine("NameIndex: " + NameIndex + " // " + | ||
579 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
580 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + | ||
581 | ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value); | ||
582 | Console.WriteLine("Attribute Count:" + AttributeCount); | ||
583 | //if static, add to static field list | ||
584 | // if (this.AccessFlags == 9) //public and static | ||
585 | if ((AccessFlags & 0x08) != 0) | ||
586 | { | ||
587 | switch (((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value) | ||
588 | { | ||
589 | case "I": | ||
590 | Int newin = new Int(); | ||
591 | parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newin); | ||
592 | break; | ||
593 | case "F": | ||
594 | Float newfl = new Float(); | ||
595 | parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newfl); | ||
596 | break; | ||
597 | } | ||
598 | } | ||
599 | for (int i = 0; i < AttributeCount; i++) | ||
600 | { | ||
601 | Attributes[i].Print(); | ||
602 | } | ||
603 | } | ||
604 | |||
605 | public class FieldAttribute | ||
606 | { | ||
607 | public ushort NameIndex = 0; | ||
608 | public string Name = String.Empty; | ||
609 | public Int32 Length = 0; | ||
610 | public byte[] Data; | ||
611 | private ClassRecord parent; | ||
612 | |||
613 | public FieldAttribute(ClassRecord paren) | ||
614 | { | ||
615 | parent = paren; | ||
616 | } | ||
617 | |||
618 | public void ReadData(byte[] data, ref int pointer) | ||
619 | { | ||
620 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
621 | Length = | ||
622 | (Int32) | ||
623 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
624 | Data = new byte[Length]; | ||
625 | for (int i = 0; i < Length; i++) | ||
626 | { | ||
627 | Data[i] = data[pointer++]; | ||
628 | } | ||
629 | } | ||
630 | |||
631 | public void Print() | ||
632 | { | ||
633 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + | ||
634 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
635 | } | ||
636 | } | ||
637 | } | ||
638 | |||
639 | private class AttributeInfo | ||
640 | { | ||
641 | public void ReadData(byte[] data, ref int i) | ||
642 | { | ||
643 | } | ||
644 | } | ||
645 | |||
646 | #endregion | ||
647 | } | ||
648 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs deleted file mode 100644 index 6507328..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs +++ /dev/null | |||
@@ -1,40 +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 OpenSim 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.Collections.Generic; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
31 | { | ||
32 | public class Heap | ||
33 | { | ||
34 | public List<ClassInstance> ClassObjects = new List<ClassInstance>(); | ||
35 | |||
36 | public Heap() | ||
37 | { | ||
38 | } | ||
39 | } | ||
40 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs deleted file mode 100644 index f5ffc6f..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs +++ /dev/null | |||
@@ -1,619 +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 OpenSim 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 OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types; | ||
29 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes; | ||
30 | |||
31 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
32 | { | ||
33 | partial class Thread | ||
34 | { | ||
35 | private partial class Interpreter | ||
36 | { | ||
37 | private bool IsLogicOpCode(byte opcode) | ||
38 | { | ||
39 | bool result = false; | ||
40 | switch (opcode) | ||
41 | { | ||
42 | case (byte) (byte) OpCode.iconst_m1: | ||
43 | Int m_int = new Int(); | ||
44 | m_int.mValue = -1; | ||
45 | m_thread.m_currentFrame.OpStack.Push(m_int); | ||
46 | result = true; | ||
47 | break; | ||
48 | case (byte) (byte) OpCode.iconst_0: | ||
49 | m_int = new Int(); | ||
50 | m_int.mValue = 0; | ||
51 | m_thread.m_currentFrame.OpStack.Push(m_int); | ||
52 | result = true; | ||
53 | break; | ||
54 | case (byte) (byte) OpCode.iconst_1: | ||
55 | m_int = new Int(); | ||
56 | m_int.mValue = 1; | ||
57 | m_thread.m_currentFrame.OpStack.Push(m_int); | ||
58 | result = true; | ||
59 | break; | ||
60 | case (byte) (byte) OpCode.iconst_2: | ||
61 | m_int = new Int(); | ||
62 | m_int.mValue = 2; | ||
63 | m_thread.m_currentFrame.OpStack.Push(m_int); | ||
64 | result = true; | ||
65 | break; | ||
66 | case (byte) (byte) OpCode.iconst_3: | ||
67 | m_int = new Int(); | ||
68 | m_int.mValue = 3; | ||
69 | m_thread.m_currentFrame.OpStack.Push(m_int); | ||
70 | break; | ||
71 | case (byte) (byte) OpCode.iconst_4: | ||
72 | m_int = new Int(); | ||
73 | m_int.mValue = 4; | ||
74 | m_thread.m_currentFrame.OpStack.Push(m_int); | ||
75 | result = true; | ||
76 | break; | ||
77 | case (byte) OpCode.iconst_5: | ||
78 | m_int = new Int(); | ||
79 | m_int.mValue = 5; | ||
80 | m_thread.m_currentFrame.OpStack.Push(m_int); | ||
81 | result = true; | ||
82 | break; | ||
83 | case (byte) OpCode.fconst_0: | ||
84 | Float m_float = new Float(); | ||
85 | m_float.mValue = 0.0f; | ||
86 | m_thread.m_currentFrame.OpStack.Push(m_float); | ||
87 | result = true; | ||
88 | break; | ||
89 | case (byte) OpCode.fconst_1: | ||
90 | m_float = new Float(); | ||
91 | m_float.mValue = 1.0f; | ||
92 | m_thread.m_currentFrame.OpStack.Push(m_float); | ||
93 | result = true; | ||
94 | break; | ||
95 | case (byte) OpCode.fconst_2: | ||
96 | m_float = new Float(); | ||
97 | m_float.mValue = 2.0f; | ||
98 | m_thread.m_currentFrame.OpStack.Push(m_float); | ||
99 | result = true; | ||
100 | break; | ||
101 | case (byte) OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? | ||
102 | int pushvalue = (int) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]; | ||
103 | Int pushInt = new Int(); | ||
104 | pushInt.mValue = pushvalue; | ||
105 | m_thread.m_currentFrame.OpStack.Push(pushInt); | ||
106 | m_thread.PC++; | ||
107 | result = true; | ||
108 | break; | ||
109 | case (byte) OpCode.sipush: | ||
110 | short pushvalue2 = | ||
111 | (short) | ||
112 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
113 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
114 | Int pushInt2 = new Int(); | ||
115 | pushInt2.mValue = pushvalue2; | ||
116 | m_thread.m_currentFrame.OpStack.Push(pushInt2); | ||
117 | m_thread.PC += 2; | ||
118 | result = true; | ||
119 | break; | ||
120 | case (byte) OpCode.fload: | ||
121 | short findex1 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC])); | ||
122 | Float fload = new Float(); | ||
123 | if (m_thread.m_currentFrame.LocalVariables[findex1] != null) | ||
124 | { | ||
125 | if (m_thread.m_currentFrame.LocalVariables[findex1] is Float) | ||
126 | { | ||
127 | fload.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[findex1]).mValue; | ||
128 | m_thread.m_currentFrame.OpStack.Push(fload); | ||
129 | } | ||
130 | } | ||
131 | m_thread.PC++; | ||
132 | result = true; | ||
133 | break; | ||
134 | case (byte) OpCode.iload_0: | ||
135 | if (m_thread.m_currentFrame.LocalVariables[0] != null) | ||
136 | { | ||
137 | if (m_thread.m_currentFrame.LocalVariables[0] is Int) | ||
138 | { | ||
139 | Int newInt = new Int(); | ||
140 | newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[0]).mValue; | ||
141 | m_thread.m_currentFrame.OpStack.Push(newInt); | ||
142 | } | ||
143 | } | ||
144 | result = true; | ||
145 | break; | ||
146 | case (byte) OpCode.iload_1: | ||
147 | if (m_thread.m_currentFrame.LocalVariables[1] != null) | ||
148 | { | ||
149 | if (m_thread.m_currentFrame.LocalVariables[1] is Int) | ||
150 | { | ||
151 | Int newInt = new Int(); | ||
152 | newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[1]).mValue; | ||
153 | m_thread.m_currentFrame.OpStack.Push(newInt); | ||
154 | } | ||
155 | } | ||
156 | result = true; | ||
157 | break; | ||
158 | case (byte) OpCode.fload_0: | ||
159 | if (m_thread.m_currentFrame.LocalVariables[0] != null) | ||
160 | { | ||
161 | if (m_thread.m_currentFrame.LocalVariables[0] is Float) | ||
162 | { | ||
163 | Float newfloat = new Float(); | ||
164 | newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[0]).mValue; | ||
165 | m_thread.m_currentFrame.OpStack.Push(newfloat); | ||
166 | } | ||
167 | } | ||
168 | result = true; | ||
169 | break; | ||
170 | case (byte) OpCode.fload_1: | ||
171 | if (m_thread.m_currentFrame.LocalVariables[1] != null) | ||
172 | { | ||
173 | if (m_thread.m_currentFrame.LocalVariables[1] is Float) | ||
174 | { | ||
175 | Float newfloat = new Float(); | ||
176 | newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[1]).mValue; | ||
177 | m_thread.m_currentFrame.OpStack.Push(newfloat); | ||
178 | } | ||
179 | } | ||
180 | result = true; | ||
181 | break; | ||
182 | case (byte) OpCode.fload_2: | ||
183 | if (m_thread.m_currentFrame.LocalVariables[2] != null) | ||
184 | { | ||
185 | if (m_thread.m_currentFrame.LocalVariables[2] is Float) | ||
186 | { | ||
187 | Float newfloat = new Float(); | ||
188 | newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[2]).mValue; | ||
189 | m_thread.m_currentFrame.OpStack.Push(newfloat); | ||
190 | } | ||
191 | } | ||
192 | result = true; | ||
193 | break; | ||
194 | case (byte) OpCode.fload_3: | ||
195 | if (m_thread.m_currentFrame.LocalVariables[3] != null) | ||
196 | { | ||
197 | if (m_thread.m_currentFrame.LocalVariables[3] is Float) | ||
198 | { | ||
199 | Float newfloat = new Float(); | ||
200 | newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[3]).mValue; | ||
201 | m_thread.m_currentFrame.OpStack.Push(newfloat); | ||
202 | } | ||
203 | } | ||
204 | result = true; | ||
205 | break; | ||
206 | case (byte) OpCode.istore: | ||
207 | short findex3 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC])); | ||
208 | BaseType istor = m_thread.m_currentFrame.OpStack.Pop(); | ||
209 | if (istor is Int) | ||
210 | { | ||
211 | m_thread.m_currentFrame.LocalVariables[findex3] = (Int) istor; | ||
212 | } | ||
213 | m_thread.PC++; | ||
214 | result = true; | ||
215 | break; | ||
216 | case (byte) OpCode.fstore: | ||
217 | short findex = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC])); | ||
218 | BaseType fstor = m_thread.m_currentFrame.OpStack.Pop(); | ||
219 | if (fstor is Float) | ||
220 | { | ||
221 | m_thread.m_currentFrame.LocalVariables[findex] = (Float) fstor; | ||
222 | } | ||
223 | m_thread.PC++; | ||
224 | result = true; | ||
225 | break; | ||
226 | case (byte) OpCode.istore_0: | ||
227 | BaseType baset = m_thread.m_currentFrame.OpStack.Pop(); | ||
228 | if (baset is Int) | ||
229 | { | ||
230 | m_thread.m_currentFrame.LocalVariables[0] = (Int) baset; | ||
231 | } | ||
232 | result = true; | ||
233 | break; | ||
234 | case (byte) OpCode.istore_1: | ||
235 | baset = m_thread.m_currentFrame.OpStack.Pop(); | ||
236 | if (baset is Int) | ||
237 | { | ||
238 | m_thread.m_currentFrame.LocalVariables[1] = (Int) baset; | ||
239 | } | ||
240 | result = true; | ||
241 | break; | ||
242 | case (byte) OpCode.fstore_0: | ||
243 | baset = m_thread.m_currentFrame.OpStack.Pop(); | ||
244 | if (baset is Float) | ||
245 | { | ||
246 | m_thread.m_currentFrame.LocalVariables[0] = (Float) baset; | ||
247 | } | ||
248 | result = true; | ||
249 | break; | ||
250 | case (byte) OpCode.fstore_1: | ||
251 | baset = m_thread.m_currentFrame.OpStack.Pop(); | ||
252 | if (baset is Float) | ||
253 | { | ||
254 | m_thread.m_currentFrame.LocalVariables[1] = (Float) baset; | ||
255 | } | ||
256 | result = true; | ||
257 | break; | ||
258 | case (byte) OpCode.fstore_2: | ||
259 | baset = m_thread.m_currentFrame.OpStack.Pop(); | ||
260 | if (baset is Float) | ||
261 | { | ||
262 | m_thread.m_currentFrame.LocalVariables[2] = (Float) baset; | ||
263 | } | ||
264 | result = true; | ||
265 | break; | ||
266 | case (byte) OpCode.fstore_3: | ||
267 | baset = m_thread.m_currentFrame.OpStack.Pop(); | ||
268 | if (baset is Float) | ||
269 | { | ||
270 | m_thread.m_currentFrame.LocalVariables[3] = (Float) baset; | ||
271 | } | ||
272 | result = true; | ||
273 | break; | ||
274 | case (byte) OpCode.pop: | ||
275 | m_thread.m_currentFrame.OpStack.Pop(); | ||
276 | result = true; | ||
277 | break; | ||
278 | case (byte) OpCode.fadd: | ||
279 | BaseType bf2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
280 | BaseType bf1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
281 | if (bf1 is Float && bf2 is Float) | ||
282 | { | ||
283 | Float nflt = new Float(); | ||
284 | nflt.mValue = ((Float) bf1).mValue + ((Float) bf2).mValue; | ||
285 | m_thread.m_currentFrame.OpStack.Push(nflt); | ||
286 | } | ||
287 | result = true; | ||
288 | break; | ||
289 | case (byte) OpCode.fsub: | ||
290 | BaseType bsf2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
291 | BaseType bsf1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
292 | if (bsf1 is Float && bsf2 is Float) | ||
293 | { | ||
294 | Float resf = new Float(); | ||
295 | resf.mValue = ((Float) bsf1).mValue - ((Float) bsf2).mValue; | ||
296 | m_thread.m_currentFrame.OpStack.Push(resf); | ||
297 | } | ||
298 | result = true; | ||
299 | break; | ||
300 | case (byte) OpCode.imul: //check the order of the two values off the stack is correct | ||
301 | BaseType bs2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
302 | BaseType bs1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
303 | if (bs1 is Int && bs2 is Int) | ||
304 | { | ||
305 | Int nInt = new Int(); | ||
306 | nInt.mValue = ((Int) bs1).mValue*((Int) bs2).mValue; | ||
307 | m_thread.m_currentFrame.OpStack.Push(nInt); | ||
308 | } | ||
309 | result = true; | ||
310 | break; | ||
311 | case (byte) OpCode.iinc: | ||
312 | if (m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]] != | ||
313 | null) | ||
314 | { | ||
315 | if ( | ||
316 | m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] | ||
317 | ] is Int) | ||
318 | { | ||
319 | ((Int) | ||
320 | m_thread.m_currentFrame.LocalVariables[ | ||
321 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]]).mValue += | ||
322 | (sbyte) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]; | ||
323 | } | ||
324 | } | ||
325 | m_thread.PC += 2; | ||
326 | result = true; | ||
327 | break; | ||
328 | case (byte) OpCode.f2i: | ||
329 | BaseType conv1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
330 | if (conv1 is Float) | ||
331 | { | ||
332 | Int newconv = new Int(); | ||
333 | newconv.mValue = (int) ((Float) conv1).mValue; | ||
334 | m_thread.m_currentFrame.OpStack.Push(newconv); | ||
335 | } | ||
336 | result = true; | ||
337 | break; | ||
338 | case (byte) OpCode.fcmpl: | ||
339 | BaseType flcom2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
340 | BaseType flcom1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
341 | if (flcom1 is Float && flcom2 is Float) | ||
342 | { | ||
343 | Int compres = new Int(); | ||
344 | if (((Float) flcom1).mValue < ((Float) flcom2).mValue) | ||
345 | { | ||
346 | compres.mValue = -1; | ||
347 | } | ||
348 | else if (((Float) flcom1).mValue > ((Float) flcom2).mValue) | ||
349 | { | ||
350 | compres.mValue = 1; | ||
351 | } | ||
352 | else | ||
353 | { | ||
354 | compres.mValue = 0; | ||
355 | } | ||
356 | m_thread.m_currentFrame.OpStack.Push(compres); | ||
357 | } | ||
358 | result = true; | ||
359 | break; | ||
360 | case (byte) OpCode.fcmpg: | ||
361 | flcom2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
362 | flcom1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
363 | if (flcom1 is Float && flcom2 is Float) | ||
364 | { | ||
365 | Int compres = new Int(); | ||
366 | if (((Float) flcom1).mValue < ((Float) flcom2).mValue) | ||
367 | { | ||
368 | compres.mValue = -1; | ||
369 | } | ||
370 | else if (((Float) flcom1).mValue > ((Float) flcom2).mValue) | ||
371 | { | ||
372 | compres.mValue = 1; | ||
373 | } | ||
374 | else | ||
375 | { | ||
376 | compres.mValue = 0; | ||
377 | } | ||
378 | m_thread.m_currentFrame.OpStack.Push(compres); | ||
379 | } | ||
380 | result = true; | ||
381 | break; | ||
382 | case (byte) OpCode.ifge: | ||
383 | short compareoffset2 = | ||
384 | (short) | ||
385 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
386 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
387 | BaseType compe1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
388 | if (compe1 is Int) | ||
389 | { | ||
390 | if (((Int) compe1).mValue >= 0) | ||
391 | { | ||
392 | m_thread.PC += -1 + compareoffset2; | ||
393 | } | ||
394 | else | ||
395 | { | ||
396 | m_thread.PC += 2; | ||
397 | } | ||
398 | } | ||
399 | else | ||
400 | { | ||
401 | m_thread.PC += 2; | ||
402 | } | ||
403 | result = true; | ||
404 | break; | ||
405 | case (byte) OpCode.ifle: | ||
406 | short compareoffset1 = | ||
407 | (short) | ||
408 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
409 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
410 | BaseType comp1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
411 | if (comp1 is Int) | ||
412 | { | ||
413 | if (((Int) comp1).mValue <= 0) | ||
414 | { | ||
415 | m_thread.PC += -1 + compareoffset1; | ||
416 | } | ||
417 | else | ||
418 | { | ||
419 | m_thread.PC += 2; | ||
420 | } | ||
421 | } | ||
422 | else | ||
423 | { | ||
424 | m_thread.PC += 2; | ||
425 | } | ||
426 | result = true; | ||
427 | break; | ||
428 | case (byte) OpCode.if_icmpge: | ||
429 | short compareoffset = | ||
430 | (short) | ||
431 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
432 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
433 | BaseType bc2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
434 | BaseType bc1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
435 | if (bc1 is Int && bc2 is Int) | ||
436 | { | ||
437 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); | ||
438 | if (((Int) bc1).mValue >= ((Int) bc2).mValue) | ||
439 | { | ||
440 | // Console.WriteLine("branch compare true , offset is " +compareoffset); | ||
441 | // Console.WriteLine("current PC is " + this._mThread.PC); | ||
442 | m_thread.PC += -1 + compareoffset; | ||
443 | //Console.WriteLine("new PC is " + this._mThread.PC); | ||
444 | } | ||
445 | else | ||
446 | { | ||
447 | //Console.WriteLine("branch compare false"); | ||
448 | m_thread.PC += 2; | ||
449 | } | ||
450 | } | ||
451 | else | ||
452 | { | ||
453 | m_thread.PC += 2; | ||
454 | } | ||
455 | result = true; | ||
456 | break; | ||
457 | case (byte) OpCode.if_icmple: | ||
458 | short compareloffset = | ||
459 | (short) | ||
460 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
461 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
462 | BaseType bcl2 = m_thread.m_currentFrame.OpStack.Pop(); | ||
463 | BaseType bcl1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
464 | if (bcl1 is Int && bcl2 is Int) | ||
465 | { | ||
466 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); | ||
467 | if (((Int) bcl1).mValue <= ((Int) bcl2).mValue) | ||
468 | { | ||
469 | // Console.WriteLine("branch compare true , offset is " + compareloffset); | ||
470 | // Console.WriteLine("current PC is " + this._mThread.PC); | ||
471 | m_thread.PC += -1 + compareloffset; | ||
472 | // Console.WriteLine("new PC is " + this._mThread.PC); | ||
473 | } | ||
474 | else | ||
475 | { | ||
476 | //Console.WriteLine("branch compare false"); | ||
477 | m_thread.PC += 2; | ||
478 | } | ||
479 | } | ||
480 | else | ||
481 | { | ||
482 | m_thread.PC += 2; | ||
483 | } | ||
484 | result = true; | ||
485 | break; | ||
486 | case (byte) OpCode._goto: | ||
487 | short offset = | ||
488 | (short) | ||
489 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
490 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
491 | m_thread.PC += -1 + offset; | ||
492 | result = true; | ||
493 | break; | ||
494 | case (byte) OpCode.getstatic: | ||
495 | short fieldrefIndex = | ||
496 | (short) | ||
497 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
498 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
499 | if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | ||
500 | { | ||
501 | if ( | ||
502 | ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). | ||
503 | mClass.Name.Value == m_thread.currentClass.MClass.Name.Value) | ||
504 | { | ||
505 | //from this class | ||
506 | if ( | ||
507 | m_thread.currentClass.StaticFields.ContainsKey( | ||
508 | ((ClassRecord.PoolFieldRef) | ||
509 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | ||
510 | { | ||
511 | if ( | ||
512 | m_thread.currentClass.StaticFields[ | ||
513 | ((ClassRecord.PoolFieldRef) | ||
514 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name. | ||
515 | Value] is Float) | ||
516 | { | ||
517 | Float retFloat = new Float(); | ||
518 | retFloat.mValue = | ||
519 | ((Float) | ||
520 | m_thread.currentClass.StaticFields[ | ||
521 | ((ClassRecord.PoolFieldRef) | ||
522 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
523 | Name.Value]).mValue; | ||
524 | m_thread.m_currentFrame.OpStack.Push(retFloat); | ||
525 | } | ||
526 | else if ( | ||
527 | m_thread.currentClass.StaticFields[ | ||
528 | ((ClassRecord.PoolFieldRef) | ||
529 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
530 | Name.Value] is Int) | ||
531 | { | ||
532 | Int retInt = new Int(); | ||
533 | retInt.mValue = | ||
534 | ((Int) | ||
535 | m_thread.currentClass.StaticFields[ | ||
536 | ((ClassRecord.PoolFieldRef) | ||
537 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). | ||
538 | mNameType.Name.Value]).mValue; | ||
539 | // Console.WriteLine("getting static field, " + retInt.mValue); | ||
540 | m_thread.m_currentFrame.OpStack.Push(retInt); | ||
541 | } | ||
542 | } | ||
543 | } | ||
544 | else | ||
545 | { | ||
546 | //get from a different class | ||
547 | } | ||
548 | } | ||
549 | m_thread.PC += 2; | ||
550 | result = true; | ||
551 | break; | ||
552 | case (byte) OpCode.putstatic: | ||
553 | fieldrefIndex = | ||
554 | (short) | ||
555 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
556 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
557 | BaseType addstatic = m_thread.m_currentFrame.OpStack.Pop(); | ||
558 | if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | ||
559 | { | ||
560 | if ( | ||
561 | ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). | ||
562 | mClass.Name.Value == m_thread.currentClass.MClass.Name.Value) | ||
563 | { | ||
564 | // this class | ||
565 | if ( | ||
566 | m_thread.currentClass.StaticFields.ContainsKey( | ||
567 | ((ClassRecord.PoolFieldRef) | ||
568 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | ||
569 | { | ||
570 | if (addstatic is Float) | ||
571 | { | ||
572 | if ( | ||
573 | m_thread.currentClass.StaticFields[ | ||
574 | ((ClassRecord.PoolFieldRef) | ||
575 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
576 | Name.Value] is Float) | ||
577 | { | ||
578 | Float newf = new Float(); | ||
579 | newf.mValue = ((Float) addstatic).mValue; | ||
580 | m_thread.currentClass.StaticFields[ | ||
581 | ((ClassRecord.PoolFieldRef) | ||
582 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
583 | Name.Value] = newf; | ||
584 | } | ||
585 | } | ||
586 | else if (addstatic is Int) | ||
587 | { | ||
588 | if ( | ||
589 | m_thread.currentClass.StaticFields[ | ||
590 | ((ClassRecord.PoolFieldRef) | ||
591 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
592 | Name.Value] is Int) | ||
593 | { | ||
594 | //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); | ||
595 | Int newi = new Int(); | ||
596 | newi.mValue = ((Int) addstatic).mValue; | ||
597 | m_thread.currentClass.StaticFields[ | ||
598 | ((ClassRecord.PoolFieldRef) | ||
599 | m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. | ||
600 | Name.Value] = newi; | ||
601 | } | ||
602 | } | ||
603 | } | ||
604 | } | ||
605 | else | ||
606 | { | ||
607 | // a different class | ||
608 | } | ||
609 | } | ||
610 | m_thread.PC += 2; | ||
611 | result = true; | ||
612 | break; | ||
613 | } | ||
614 | |||
615 | return result; | ||
616 | } | ||
617 | } | ||
618 | } | ||
619 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs deleted file mode 100644 index 7da2012..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs +++ /dev/null | |||
@@ -1,104 +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 OpenSim 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; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
31 | { | ||
32 | partial class Thread | ||
33 | { | ||
34 | private partial class Interpreter | ||
35 | { | ||
36 | private bool IsMethodOpCode(byte opcode) | ||
37 | { | ||
38 | bool result = false; | ||
39 | switch (opcode) | ||
40 | { | ||
41 | case 184: | ||
42 | short refIndex = | ||
43 | (short) | ||
44 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
45 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
46 | if (m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | ||
47 | { | ||
48 | string typ = | ||
49 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]). | ||
50 | mNameType.Type.Value; | ||
51 | string typeparam = String.Empty; | ||
52 | string typereturn = String.Empty; | ||
53 | int firstbrak = 0; | ||
54 | int secondbrak = 0; | ||
55 | firstbrak = typ.LastIndexOf('('); | ||
56 | secondbrak = typ.LastIndexOf(')'); | ||
57 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); | ||
58 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); | ||
59 | if ( | ||
60 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass | ||
61 | .Name.Value == m_thread.currentClass.MClass.Name.Value) | ||
62 | { | ||
63 | //calling a method in this class | ||
64 | if (typeparam.Length == 0) | ||
65 | { | ||
66 | m_thread.JumpToStaticVoidMethod( | ||
67 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
68 | .mNameType.Name.Value, (m_thread.PC + 2)); | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | m_thread.JumpToStaticParamMethod( | ||
73 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
74 | .mNameType.Name.Value, typeparam, (m_thread.PC + 2)); | ||
75 | } | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | //calling a method of a different class | ||
80 | |||
81 | // OpenSimAPI Class | ||
82 | if ( | ||
83 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]). | ||
84 | mClass.Name.Value == "OpenSimAPI") | ||
85 | { | ||
86 | m_thread.scriptInfo.api.CallMethod( | ||
87 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
88 | .mNameType.Name.Value, null); | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | m_thread.PC += 2; | ||
95 | } | ||
96 | result = true; | ||
97 | break; | ||
98 | } | ||
99 | |||
100 | return result; | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs deleted file mode 100644 index 3ae7b91..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs +++ /dev/null | |||
@@ -1,36 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
29 | { | ||
30 | partial class Thread | ||
31 | { | ||
32 | private partial class Interpreter | ||
33 | { | ||
34 | } | ||
35 | } | ||
36 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs deleted file mode 100644 index 2dd711f..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs +++ /dev/null | |||
@@ -1,132 +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 OpenSim 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; | ||
29 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types; | ||
30 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
33 | { | ||
34 | partial class Thread | ||
35 | { | ||
36 | private partial class Interpreter | ||
37 | { | ||
38 | private Thread m_thread; | ||
39 | |||
40 | public Interpreter(Thread parentThread) | ||
41 | { | ||
42 | m_thread = parentThread; | ||
43 | } | ||
44 | |||
45 | public bool Excute() | ||
46 | { | ||
47 | bool run = true; | ||
48 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[m_thread.PC++]; | ||
49 | // Console.WriteLine("opCode is: " + currentOpCode); | ||
50 | bool handled = false; | ||
51 | |||
52 | handled = IsLogicOpCode(currentOpCode); | ||
53 | if (!handled) | ||
54 | { | ||
55 | handled = IsMethodOpCode(currentOpCode); | ||
56 | } | ||
57 | if (!handled) | ||
58 | { | ||
59 | if (currentOpCode == 172) | ||
60 | { | ||
61 | if (m_thread.stack.StackFrames.Count > 1) | ||
62 | { | ||
63 | Console.WriteLine("returning int from function"); | ||
64 | int retPC1 = m_thread.m_currentFrame.ReturnPC; | ||
65 | BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
66 | m_thread.stack.StackFrames.Pop(); | ||
67 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); | ||
68 | m_thread.PC = retPC1; | ||
69 | if (bas1 is Int) | ||
70 | { | ||
71 | m_thread.m_currentFrame.OpStack.Push((Int) bas1); | ||
72 | } | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | // Console.WriteLine("No parent function so ending program"); | ||
77 | m_thread.stack.StackFrames.Pop(); | ||
78 | run = false; | ||
79 | } | ||
80 | handled = true; | ||
81 | } | ||
82 | if (currentOpCode == 174) | ||
83 | { | ||
84 | if (m_thread.stack.StackFrames.Count > 1) | ||
85 | { | ||
86 | Console.WriteLine("returning float from function"); | ||
87 | int retPC1 = m_thread.m_currentFrame.ReturnPC; | ||
88 | BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop(); | ||
89 | m_thread.stack.StackFrames.Pop(); | ||
90 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); | ||
91 | m_thread.PC = retPC1; | ||
92 | if (bas1 is Float) | ||
93 | { | ||
94 | m_thread.m_currentFrame.OpStack.Push((Float) bas1); | ||
95 | } | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | // Console.WriteLine("No parent function so ending program"); | ||
100 | m_thread.stack.StackFrames.Pop(); | ||
101 | run = false; | ||
102 | } | ||
103 | handled = true; | ||
104 | } | ||
105 | if (currentOpCode == 177) | ||
106 | { | ||
107 | if (m_thread.stack.StackFrames.Count > 1) | ||
108 | { | ||
109 | Console.WriteLine("returning from function"); | ||
110 | int retPC = m_thread.m_currentFrame.ReturnPC; | ||
111 | m_thread.stack.StackFrames.Pop(); | ||
112 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); | ||
113 | m_thread.PC = retPC; | ||
114 | } | ||
115 | else | ||
116 | { | ||
117 | // Console.WriteLine("No parent function so ending program"); | ||
118 | m_thread.stack.StackFrames.Pop(); | ||
119 | run = false; | ||
120 | } | ||
121 | handled = true; | ||
122 | } | ||
123 | } | ||
124 | if (!handled) | ||
125 | { | ||
126 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); | ||
127 | } | ||
128 | return run; | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs deleted file mode 100644 index 9d912c4..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs +++ /dev/null | |||
@@ -1,41 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
29 | { | ||
30 | public class MainMemory | ||
31 | { | ||
32 | public Heap HeapArea; | ||
33 | public MethodMemory MethodArea; | ||
34 | |||
35 | public MainMemory() | ||
36 | { | ||
37 | MethodArea = new MethodMemory(); | ||
38 | HeapArea = new Heap(); | ||
39 | } | ||
40 | } | ||
41 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs deleted file mode 100644 index b482e72..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.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 OpenSim 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.Collections.Generic; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
31 | { | ||
32 | public class MethodMemory | ||
33 | { | ||
34 | public byte[] MethodBuffer; | ||
35 | public List<ClassRecord> Classes = new List<ClassRecord>(); | ||
36 | public int NextMethodPC = 0; | ||
37 | public int Methodcount = 0; | ||
38 | |||
39 | public MethodMemory() | ||
40 | { | ||
41 | MethodBuffer = new byte[20000]; | ||
42 | } | ||
43 | } | ||
44 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs deleted file mode 100644 index de89a2a..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs +++ /dev/null | |||
@@ -1,33 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
29 | { | ||
30 | public class Object | ||
31 | { | ||
32 | } | ||
33 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs deleted file mode 100644 index 31fa08d..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs +++ /dev/null | |||
@@ -1,79 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
29 | { | ||
30 | public enum OpCode : byte | ||
31 | { | ||
32 | iconst_m1 = 2, | ||
33 | iconst_0 = 3, | ||
34 | iconst_1 = 4, | ||
35 | iconst_2 = 5, | ||
36 | iconst_3 = 6, | ||
37 | iconst_4 = 7, | ||
38 | iconst_5 = 8, | ||
39 | fconst_0 = 11, | ||
40 | fconst_1 = 12, | ||
41 | fconst_2 = 13, | ||
42 | bipush = 16, | ||
43 | sipush = 17, | ||
44 | fload = 23, | ||
45 | iload_0 = 26, | ||
46 | iload_1 = 27, | ||
47 | fload_0 = 34, | ||
48 | fload_1 = 35, | ||
49 | fload_2 = 36, | ||
50 | fload_3 = 37, | ||
51 | istore = 54, | ||
52 | fstore = 56, | ||
53 | istore_0 = 59, | ||
54 | istore_1 = 60, | ||
55 | istore_2 = 61, | ||
56 | istore_3 = 62, | ||
57 | fstore_0 = 67, | ||
58 | fstore_1 = 68, | ||
59 | fstore_2 = 69, | ||
60 | fstore_3 = 70, | ||
61 | pop = 87, | ||
62 | fadd = 98, | ||
63 | fsub = 102, | ||
64 | imul = 104, | ||
65 | iinc = 132, | ||
66 | f2i = 139, | ||
67 | fcmpl = 149, | ||
68 | fcmpg = 150, | ||
69 | ifge = 156, | ||
70 | ifgt = 157, | ||
71 | ifle = 158, | ||
72 | if_icmpge = 162, | ||
73 | if_icmpgt = 163, | ||
74 | if_icmple = 164, | ||
75 | _goto = 167, | ||
76 | getstatic = 178, | ||
77 | putstatic = 179 | ||
78 | } | ||
79 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs deleted file mode 100644 index eedcb41..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs +++ /dev/null | |||
@@ -1,40 +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 OpenSim 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.Collections.Generic; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
31 | { | ||
32 | public class Stack | ||
33 | { | ||
34 | public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); | ||
35 | |||
36 | public Stack() | ||
37 | { | ||
38 | } | ||
39 | } | ||
40 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs deleted file mode 100644 index 5d9c75b..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs +++ /dev/null | |||
@@ -1,46 +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 OpenSim 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.Collections.Generic; | ||
29 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types; | ||
30 | |||
31 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
32 | { | ||
33 | public class StackFrame | ||
34 | { | ||
35 | public BaseType[] LocalVariables; | ||
36 | public Stack<BaseType> OpStack = new Stack<BaseType>(); | ||
37 | |||
38 | public int ReturnPC = 0; | ||
39 | public ClassRecord CallingClass = null; | ||
40 | |||
41 | public StackFrame() | ||
42 | { | ||
43 | LocalVariables = new BaseType[20]; | ||
44 | } | ||
45 | } | ||
46 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs deleted file mode 100644 index 3e9d0f4..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs +++ /dev/null | |||
@@ -1,111 +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 OpenSim 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 OpenSim.Region.Environment.Scenes; | ||
29 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types; | ||
30 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM | ||
33 | { | ||
34 | public partial class Thread | ||
35 | { | ||
36 | // Is this smart? | ||
37 | public static MainMemory GlobalMemory; | ||
38 | public static Scene World; | ||
39 | private int PC = 0; | ||
40 | private Stack stack; | ||
41 | private Interpreter m_Interpreter; | ||
42 | public ClassRecord currentClass; | ||
43 | public ClassInstance currentInstance; | ||
44 | private StackFrame m_currentFrame; | ||
45 | public int excutionCounter = 0; | ||
46 | public bool running = false; | ||
47 | |||
48 | public ScriptInfo scriptInfo; | ||
49 | |||
50 | public Thread() | ||
51 | { | ||
52 | m_Interpreter = new Interpreter(this); | ||
53 | stack = new Stack(); | ||
54 | } | ||
55 | |||
56 | public void SetPC(int methodpointer) | ||
57 | { | ||
58 | //Console.WriteLine("Thread PC has been set to " + methodpointer); | ||
59 | PC = methodpointer; | ||
60 | } | ||
61 | |||
62 | public void StartMethod(ClassRecord rec, string methName) | ||
63 | { | ||
64 | m_currentFrame = new StackFrame(); | ||
65 | stack.StackFrames.Push(m_currentFrame); | ||
66 | currentClass = rec; | ||
67 | currentClass.StartMethod(this, methName); | ||
68 | } | ||
69 | |||
70 | public void StartMethod(string methName) | ||
71 | { | ||
72 | m_currentFrame = new StackFrame(); | ||
73 | stack.StackFrames.Push(m_currentFrame); | ||
74 | currentClass.StartMethod(this, methName); | ||
75 | } | ||
76 | |||
77 | public void JumpToStaticVoidMethod(string methName, int returnPC) | ||
78 | { | ||
79 | m_currentFrame = new StackFrame(); | ||
80 | m_currentFrame.ReturnPC = returnPC; | ||
81 | stack.StackFrames.Push(m_currentFrame); | ||
82 | currentClass.StartMethod(this, methName); | ||
83 | } | ||
84 | |||
85 | public void JumpToStaticParamMethod(string methName, string param, int returnPC) | ||
86 | { | ||
87 | if (param == "I") | ||
88 | { | ||
89 | BaseType bs1 = m_currentFrame.OpStack.Pop(); | ||
90 | m_currentFrame = new StackFrame(); | ||
91 | m_currentFrame.ReturnPC = returnPC; | ||
92 | stack.StackFrames.Push(m_currentFrame); | ||
93 | m_currentFrame.LocalVariables[0] = ((Int) bs1); | ||
94 | currentClass.StartMethod(this, methName); | ||
95 | } | ||
96 | if (param == "F") | ||
97 | { | ||
98 | } | ||
99 | } | ||
100 | |||
101 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) | ||
102 | { | ||
103 | } | ||
104 | |||
105 | public bool Excute() | ||
106 | { | ||
107 | excutionCounter++; | ||
108 | return m_Interpreter.Excute(); | ||
109 | } | ||
110 | } | ||
111 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs deleted file mode 100644 index 8b6f89c..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs +++ /dev/null | |||
@@ -1,51 +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 OpenSim 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.Collections.Generic; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine | ||
31 | { | ||
32 | public class JavaEngine : IScriptCompiler | ||
33 | { | ||
34 | public string FileExt() | ||
35 | { | ||
36 | return ".java"; | ||
37 | } | ||
38 | |||
39 | public Dictionary<string, IScript> compile(string filename) | ||
40 | { | ||
41 | JVMScript script = new JVMScript(); | ||
42 | Dictionary<string, IScript> returns = new Dictionary<string, IScript>(); | ||
43 | |||
44 | script.LoadScript(filename); | ||
45 | |||
46 | returns.Add(filename, script); | ||
47 | |||
48 | return returns; | ||
49 | } | ||
50 | } | ||
51 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs deleted file mode 100644 index 017b38b..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs +++ /dev/null | |||
@@ -1,166 +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 OpenSim 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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Diagnostics; | ||
31 | using System.IO; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.JVM; | ||
35 | |||
36 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine | ||
37 | { | ||
38 | public class JVMScript : IScript | ||
39 | { | ||
40 | private List<Thread> _threads = new List<Thread>(); | ||
41 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); | ||
42 | private MainMemory _mainMemory; | ||
43 | |||
44 | private ScriptInfo scriptInfo; | ||
45 | |||
46 | public void Initialise(ScriptInfo info) | ||
47 | { | ||
48 | scriptInfo = info; | ||
49 | |||
50 | _mainMemory = new MainMemory(); | ||
51 | Thread.GlobalMemory = _mainMemory; | ||
52 | Thread.World = info.world; | ||
53 | CompileScript(); | ||
54 | |||
55 | scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); | ||
56 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); | ||
57 | } | ||
58 | |||
59 | private void events_OnNewPresence(ScenePresence presence) | ||
60 | { | ||
61 | for (int i = 0; i < _threads.Count; i++) | ||
62 | { | ||
63 | if (!_threads[i].running) | ||
64 | { | ||
65 | _threads[i].StartMethod("OnNewPresence"); | ||
66 | bool run = true; | ||
67 | while (run) | ||
68 | { | ||
69 | run = _threads[i].Excute(); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | private void events_OnFrame() | ||
76 | { | ||
77 | for (int i = 0; i < _threads.Count; i++) | ||
78 | { | ||
79 | if (!_threads[i].running) | ||
80 | { | ||
81 | _threads[i].StartMethod("OnFrame"); | ||
82 | bool run = true; | ||
83 | while (run) | ||
84 | { | ||
85 | run = _threads[i].Excute(); | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | public string Name | ||
92 | { | ||
93 | get { return "JVM Scripting Engine"; } | ||
94 | } | ||
95 | |||
96 | public void LoadScript(string script) | ||
97 | { | ||
98 | Console.WriteLine("OpenSimJVM - loading new script: " + script); | ||
99 | CompileInfo comp = new CompileInfo(); | ||
100 | comp.script = script; | ||
101 | comp.scriptName = script; | ||
102 | CompileScripts.Enqueue(comp); | ||
103 | } | ||
104 | |||
105 | public void CompileScript() | ||
106 | { | ||
107 | CompileInfo comp = CompileScripts.Dequeue(); | ||
108 | string script = comp.script; | ||
109 | string scriptName = comp.scriptName; | ||
110 | try | ||
111 | { | ||
112 | //need to compile the script into a java class file | ||
113 | |||
114 | //first save it to a java source file | ||
115 | TextWriter tw = new StreamWriter(scriptName + ".java"); | ||
116 | tw.WriteLine(script); | ||
117 | tw.Close(); | ||
118 | |||
119 | //now compile | ||
120 | ProcessStartInfo psi = new ProcessStartInfo("javac.exe", "*.java"); | ||
121 | // psi.RedirectStandardOutput = true; | ||
122 | psi.WindowStyle = ProcessWindowStyle.Hidden; | ||
123 | psi.UseShellExecute = false; | ||
124 | |||
125 | Process javacomp; | ||
126 | javacomp = Process.Start(psi); | ||
127 | javacomp.WaitForExit(); | ||
128 | |||
129 | |||
130 | //now load in class file | ||
131 | ClassRecord class1 = new ClassRecord(); | ||
132 | class1.LoadClassFromFile(scriptName + ".class"); | ||
133 | class1.PrintToConsole(); | ||
134 | //Console.WriteLine(); | ||
135 | _mainMemory.MethodArea.Classes.Add(class1); | ||
136 | class1.AddMethodsToMemory(_mainMemory.MethodArea); | ||
137 | |||
138 | Thread newThread = new Thread(); | ||
139 | _threads.Add(newThread); | ||
140 | newThread.currentClass = class1; | ||
141 | newThread.scriptInfo = scriptInfo; | ||
142 | |||
143 | //now delete the created files | ||
144 | File.Delete(scriptName + ".java"); | ||
145 | File.Delete(scriptName + ".class"); | ||
146 | //this.OnFrame(); | ||
147 | } | ||
148 | catch (Exception e) | ||
149 | { | ||
150 | Console.WriteLine("exception"); | ||
151 | Console.WriteLine(e.StackTrace); | ||
152 | Console.WriteLine(e.Message); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | private class CompileInfo | ||
157 | { | ||
158 | public string script; | ||
159 | public string scriptName; | ||
160 | |||
161 | public CompileInfo() | ||
162 | { | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs deleted file mode 100644 index 1ef0ff4..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs +++ /dev/null | |||
@@ -1,33 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types | ||
29 | { | ||
30 | public class ArrayReference : BaseType | ||
31 | { | ||
32 | } | ||
33 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs deleted file mode 100644 index 829a18c..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs +++ /dev/null | |||
@@ -1,35 +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 OpenSim 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; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types | ||
31 | { | ||
32 | public class BaseType : Object | ||
33 | { | ||
34 | } | ||
35 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs deleted file mode 100644 index bbcde5c..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs +++ /dev/null | |||
@@ -1,38 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types | ||
29 | { | ||
30 | public class ObjectReference : BaseType | ||
31 | { | ||
32 | public ushort Reference; | ||
33 | |||
34 | public ObjectReference() | ||
35 | { | ||
36 | } | ||
37 | } | ||
38 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs deleted file mode 100644 index e732f33..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs +++ /dev/null | |||
@@ -1,33 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes | ||
29 | { | ||
30 | public class Byte : BaseType | ||
31 | { | ||
32 | } | ||
33 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs deleted file mode 100644 index e066454..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs +++ /dev/null | |||
@@ -1,33 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes | ||
29 | { | ||
30 | public class Char : BaseType | ||
31 | { | ||
32 | } | ||
33 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs deleted file mode 100644 index 5d60f65..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs +++ /dev/null | |||
@@ -1,38 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes | ||
29 | { | ||
30 | public class Float : BaseType | ||
31 | { | ||
32 | public float mValue = 0; | ||
33 | |||
34 | public Float() | ||
35 | { | ||
36 | } | ||
37 | } | ||
38 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs deleted file mode 100644 index 24ee850..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs +++ /dev/null | |||
@@ -1,38 +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 OpenSim 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 | namespace OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine.Types.PrimitiveTypes | ||
29 | { | ||
30 | public class Int : BaseType | ||
31 | { | ||
32 | public int mValue = 0; | ||
33 | |||
34 | public Int() | ||
35 | { | ||
36 | } | ||
37 | } | ||
38 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs deleted file mode 100644 index cd330d2..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/Script.cs +++ /dev/null | |||
@@ -1,64 +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 OpenSim 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 OpenSim.Region.Environment.Scenes; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule | ||
31 | { | ||
32 | public interface IScript | ||
33 | { | ||
34 | void Initialise(ScriptInfo scriptInfo); | ||
35 | string Name { get; } | ||
36 | } | ||
37 | |||
38 | public class TestScript : IScript | ||
39 | { | ||
40 | private ScriptInfo script; | ||
41 | |||
42 | public string Name | ||
43 | { | ||
44 | get { return "TestScript 0.1"; } | ||
45 | } | ||
46 | |||
47 | public void Initialise(ScriptInfo scriptInfo) | ||
48 | { | ||
49 | script = scriptInfo; | ||
50 | script.events.OnFrame += events_OnFrame; | ||
51 | script.events.OnNewPresence += events_OnNewPresence; | ||
52 | } | ||
53 | |||
54 | private void events_OnNewPresence(ScenePresence presence) | ||
55 | { | ||
56 | script.Log.Info("[TESTSCRIPT]: Hello " + presence.Firstname.ToString() + "!"); | ||
57 | } | ||
58 | |||
59 | private void events_OnFrame() | ||
60 | { | ||
61 | //script.logger.Info("[TESTSCRIPT]: Hello World!"); | ||
62 | } | ||
63 | } | ||
64 | } | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs deleted file mode 100644 index fb97a64..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.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 OpenSim 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; | ||
29 | using OpenSim.Region.Environment.Scenes; | ||
30 | using Key = libsecondlife.LLUUID; | ||
31 | using Rotation = libsecondlife.LLQuaternion; | ||
32 | using Vector = libsecondlife.LLVector3; | ||
33 | using LSLList = System.Collections.Generic.List<string>; | ||
34 | |||
35 | namespace OpenSim.Region.ExtensionsScriptModule | ||
36 | { | ||
37 | // This class is to be used for engines which may not be able to access the Scene directly. | ||
38 | // Scene access is preffered, but obviously not possible on some non-.NET languages. | ||
39 | public class ScriptAPI | ||
40 | { | ||
41 | private Scene scene; | ||
42 | private ScriptInterpretedAPI interpretedAPI; | ||
43 | |||
44 | public ScriptAPI(Scene world, Key taskID) | ||
45 | { | ||
46 | scene = world; | ||
47 | interpretedAPI = new ScriptInterpretedAPI(world, taskID); | ||
48 | } | ||
49 | |||
50 | public Object CallMethod(String method, Object[] args) | ||
51 | { | ||
52 | return null; | ||
53 | } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs deleted file mode 100644 index 16c449f..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs +++ /dev/null | |||
@@ -1,68 +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 OpenSim 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 libsecondlife; | ||
30 | using log4net; | ||
31 | using OpenSim.Region.Environment.Scenes; | ||
32 | |||
33 | namespace OpenSim.Region.ExtensionsScriptModule | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Class which provides access to the world | ||
37 | /// </summary> | ||
38 | public class ScriptInfo | ||
39 | { | ||
40 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
41 | |||
42 | // Reference to world.eventsManager provided for convenience | ||
43 | public EventManager events; | ||
44 | |||
45 | // The main world | ||
46 | public Scene world; | ||
47 | |||
48 | // API Access | ||
49 | public ScriptAPI api; | ||
50 | |||
51 | public ILog Log | ||
52 | { | ||
53 | get { return m_log; } | ||
54 | } | ||
55 | |||
56 | public ScriptInfo(Scene scene) | ||
57 | { | ||
58 | world = scene; | ||
59 | events = world.EventManager; | ||
60 | api = new ScriptAPI(world, LLUUID.Zero); | ||
61 | } | ||
62 | |||
63 | public void CreateTaskAPI(LLUUID task) | ||
64 | { | ||
65 | api = new ScriptAPI(world, task); | ||
66 | } | ||
67 | } | ||
68 | } | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs deleted file mode 100644 index 8520d23..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs +++ /dev/null | |||
@@ -1,302 +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 OpenSim 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; | ||
29 | using System.Reflection; | ||
30 | using System.Text; | ||
31 | using Axiom.Math; | ||
32 | using log4net; | ||
33 | using OpenSim.Region.Environment.Interfaces; | ||
34 | using OpenSim.Region.Environment.Scenes; | ||
35 | using Key = libsecondlife.LLUUID; | ||
36 | using Rotation = libsecondlife.LLQuaternion; | ||
37 | using Vector = libsecondlife.LLVector3; | ||
38 | using LSLList = System.Collections.Generic.List<string>; | ||
39 | |||
40 | namespace OpenSim.Region.ExtensionsScriptModule | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// A class inteded to act as an API for LSL-styled interpreted languages | ||
44 | /// </summary> | ||
45 | /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> | ||
46 | internal class ScriptInterpretedAPI | ||
47 | { | ||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | protected Key m_object; | ||
51 | protected Scene m_scene; | ||
52 | |||
53 | /// <summary> | ||
54 | /// The scene in which this script is acting | ||
55 | /// </summary> | ||
56 | public Scene Scene | ||
57 | { | ||
58 | get { return m_scene; } | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// The id of the object our script is supposed to be acting in | ||
63 | /// </summary> | ||
64 | public Key ObjectID | ||
65 | { | ||
66 | get { return m_object; } | ||
67 | } | ||
68 | |||
69 | /// <summary> | ||
70 | /// The object our script is supposed to be in | ||
71 | /// </summary> | ||
72 | public SceneObjectGroup Task | ||
73 | { | ||
74 | // XXX Casting not ideal, but previous Scene.Objects propery wasn't actually populated, so | ||
75 | // wouldn't have worked anyway. | ||
76 | get { return (SceneObjectGroup)Scene.Entities[ObjectID]; } | ||
77 | } | ||
78 | |||
79 | /// <summary> | ||
80 | /// Creates a new ScriptInterpretedAPI for a specified object | ||
81 | /// </summary> | ||
82 | /// <param name="world">The scene the object is located in</param> | ||
83 | /// <param name="member">The specific member being 'occupied' by the script</param> | ||
84 | public ScriptInterpretedAPI(Scene world, Key member) | ||
85 | { | ||
86 | m_scene = world; | ||
87 | m_object = member; | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
91 | /// Returns the absolute number of a integer value. | ||
92 | /// </summary> | ||
93 | /// <param name="val">Input</param> | ||
94 | /// <returns>Absolute number of input</returns> | ||
95 | public int osAbs(int val) | ||
96 | { | ||
97 | return Math.Abs(val); | ||
98 | } | ||
99 | |||
100 | public float osAcos(float val) | ||
101 | { | ||
102 | return (float) Math.Acos(val); | ||
103 | } | ||
104 | |||
105 | [Obsolete("Unimplemented")] | ||
106 | public void osAddToLandPassList(Key avatar, float hours) | ||
107 | { | ||
108 | Vector myPosition = Task.AbsolutePosition; | ||
109 | ILandObject myParcel = Scene.LandChannel.GetLandObject(myPosition.X, myPosition.Y); | ||
110 | if (myParcel == null) | ||
111 | { | ||
112 | //Dont do anything! | ||
113 | } | ||
114 | m_log.Warn("[script]: " + | ||
115 | "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); | ||
116 | return; | ||
117 | } | ||
118 | |||
119 | [Obsolete("Unimplemented")] | ||
120 | public void osAdjustSoundVolume(float volume) | ||
121 | { | ||
122 | m_log.Warn("[script]: Unimplemented function called by script: osAdjustSoundVolume(float volume)"); | ||
123 | return; | ||
124 | } | ||
125 | |||
126 | [Obsolete("Unimplemented")] | ||
127 | public void osAllowInventoryDrop(int add) | ||
128 | { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | [Obsolete("Unimplemented")] | ||
133 | public float osAngleBetween(Rotation a, Rotation b) | ||
134 | { | ||
135 | Quaternion axA = new Quaternion(a.W, a.X, a.Y, a.Z); | ||
136 | Quaternion axB = new Quaternion(b.W, b.X, b.Y, b.Z); | ||
137 | |||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | [Obsolete("Unimplemented")] | ||
142 | public void osApplyImpulse(Vector force, int local) | ||
143 | { | ||
144 | return; | ||
145 | } | ||
146 | |||
147 | [Obsolete("Unimplemented")] | ||
148 | public void osApplyRotationalImpulse(Vector force, int local) | ||
149 | { | ||
150 | return; | ||
151 | } | ||
152 | |||
153 | public float osAsin(float val) | ||
154 | { | ||
155 | return (float) Math.Asin(val); | ||
156 | } | ||
157 | |||
158 | public float osAtan2(float x, float y) | ||
159 | { | ||
160 | return (float) Math.Atan2(x, y); | ||
161 | } | ||
162 | |||
163 | [Obsolete("Unimplemented")] | ||
164 | public void osAttachToAvatar(Key avatar, int attachmentPoint) | ||
165 | { | ||
166 | return; | ||
167 | } | ||
168 | |||
169 | [Obsolete("Unimplemented")] | ||
170 | public Key osAvatarOnSitTarget() | ||
171 | { | ||
172 | //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences | ||
173 | /* | ||
174 | foreach (KeyValuePair<Key, EntityBase> Child in Task.Children) | ||
175 | { | ||
176 | if (Child.Value is ScenePresence) | ||
177 | { | ||
178 | return Child.Value.uuid; | ||
179 | } | ||
180 | } | ||
181 | */ | ||
182 | |||
183 | return Key.Zero; | ||
184 | } | ||
185 | |||
186 | public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) | ||
187 | { | ||
188 | Quaternion axQ = new Quaternion(); | ||
189 | Vector3 axFwd = new Vector3(fwd.X, fwd.Y, fwd.Z); | ||
190 | Vector3 axLeft = new Vector3(left.X, left.Y, left.Z); | ||
191 | Vector3 axUp = new Vector3(up.X, up.Y, up.Z); | ||
192 | |||
193 | axQ.FromAxes(axFwd, axLeft, axUp); | ||
194 | |||
195 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); | ||
196 | } | ||
197 | |||
198 | public Rotation osAxisAngle2Rot(Vector axis, float angle) | ||
199 | { | ||
200 | Quaternion axQ = Quaternion.FromAngleAxis(angle, new Vector3(axis.X, axis.Y, axis.Z)); | ||
201 | |||
202 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); | ||
203 | } | ||
204 | |||
205 | public string osBase64ToString(string str) | ||
206 | { | ||
207 | Encoding enc = Encoding.UTF8; | ||
208 | return enc.GetString(Convert.FromBase64String(str)); | ||
209 | } | ||
210 | |||
211 | [Obsolete("Unimplemented")] | ||
212 | public void osBreakAllLinks() | ||
213 | { | ||
214 | return; | ||
215 | } | ||
216 | |||
217 | [Obsolete("Unimplemented")] | ||
218 | public void osBreakLink() | ||
219 | { | ||
220 | return; | ||
221 | } | ||
222 | |||
223 | public LSLList osCSV2List(string src) | ||
224 | { | ||
225 | LSLList retVal = new LSLList(); | ||
226 | retVal.AddRange(src.Split(',')); | ||
227 | |||
228 | return retVal; | ||
229 | } | ||
230 | |||
231 | public int osCeil(float val) | ||
232 | { | ||
233 | return (int) Math.Ceiling(val); | ||
234 | } | ||
235 | |||
236 | [Obsolete("Unimplemented")] | ||
237 | public void osCloseRemoteDataChannel(Key channel) | ||
238 | { | ||
239 | return; | ||
240 | } | ||
241 | |||
242 | [Obsolete("Unimplemented")] | ||
243 | public float osCloud(Vector offset) | ||
244 | { | ||
245 | return 0.0f; | ||
246 | } | ||
247 | |||
248 | [Obsolete("Unimplemented")] | ||
249 | public void osCollisionFilter(string name, Key id, int accept) | ||
250 | { | ||
251 | return; | ||
252 | } | ||
253 | |||
254 | [Obsolete("Unimplemented")] | ||
255 | public void osCollisionSprite(string impact_sprite) | ||
256 | { | ||
257 | return; | ||
258 | } | ||
259 | |||
260 | public float osCos(float theta) | ||
261 | { | ||
262 | return (float) Math.Cos(theta); | ||
263 | } | ||
264 | |||
265 | public void osCreateLink(Key target, int parent) | ||
266 | { | ||
267 | if (Scene.Entities[target] is SceneObjectGroup) | ||
268 | Task.LinkToGroup((SceneObjectGroup) Scene.Entities[target]); | ||
269 | |||
270 | return; | ||
271 | } | ||
272 | |||
273 | [Obsolete("Partially Unimplemented")] | ||
274 | public LSLList osDeleteSubList(LSLList src, int start, int end) | ||
275 | { | ||
276 | if (start < 0 || end < 0) | ||
277 | { | ||
278 | throw new Exception("Unsupported at this time."); | ||
279 | } | ||
280 | |||
281 | src.RemoveRange(start, start - end + 1); | ||
282 | return src; | ||
283 | } | ||
284 | |||
285 | [Obsolete("Partially Unimplemented")] | ||
286 | public string osDeleteSubString(string src, int start, int end) | ||
287 | { | ||
288 | if (start < 0 || end < 0) | ||
289 | { | ||
290 | throw new Exception("Unsupported at this time."); | ||
291 | } | ||
292 | |||
293 | return src.Remove(start, start - end + 1); | ||
294 | } | ||
295 | |||
296 | [Obsolete("Unimplemented")] | ||
297 | public void osDetachFromAvatar(Key avatar) | ||
298 | { | ||
299 | return; | ||
300 | } | ||
301 | } | ||
302 | } | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs deleted file mode 100644 index 56ab524..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs +++ /dev/null | |||
@@ -1,45 +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 OpenSim 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 Key = libsecondlife.LLUUID; | ||
29 | |||
30 | namespace OpenSim.Region.ExtensionsScriptModule | ||
31 | { | ||
32 | public class ScriptInterpretedEvents | ||
33 | { | ||
34 | public delegate void OnTouchStartDelegate(Key user); | ||
35 | |||
36 | public event OnTouchStartDelegate OnTouchStart; | ||
37 | |||
38 | |||
39 | public void TriggerTouchStart(Key user) | ||
40 | { | ||
41 | if (OnTouchStart != null) | ||
42 | OnTouchStart(user); | ||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs deleted file mode 100644 index 48ebf86..0000000 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs +++ /dev/null | |||
@@ -1,152 +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 OpenSim 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.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Region.Environment.Interfaces; | ||
33 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.ExtensionsScriptModule.Engines.CSharp; | ||
35 | using OpenSim.Region.ExtensionsScriptModule.Engines.JScript; | ||
36 | using OpenSim.Region.ExtensionsScriptModule.Engines.JVMEngine; | ||
37 | |||
38 | namespace OpenSim.Region.ExtensionsScriptModule | ||
39 | { | ||
40 | public class ScriptManager : IRegionModule, IExtensionScriptModule | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | private readonly List<IScript> scripts = new List<IScript>(); | ||
45 | private Scene m_scene; | ||
46 | private readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); | ||
47 | |||
48 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) | ||
49 | { | ||
50 | foreach (KeyValuePair<string, IScript> script in compiledscripts) | ||
51 | { | ||
52 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); | ||
53 | // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | ||
54 | m_log.Info("[SCRIPT]: Loading " + script.Key); | ||
55 | script.Value.Initialise(scriptInfo); | ||
56 | scripts.Add(script.Value); | ||
57 | } | ||
58 | |||
59 | m_log.Info("[SCRIPT]: " + string.Format("Finished loading {0} script(s)", compiledscripts.Count)); | ||
60 | } | ||
61 | |||
62 | public ScriptManager() | ||
63 | { | ||
64 | // Default Engines | ||
65 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); | ||
66 | compilers.Add(csharpCompiler.FileExt(), csharpCompiler); | ||
67 | |||
68 | JScriptEngine jscriptCompiler = new JScriptEngine(); | ||
69 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); | ||
70 | |||
71 | JavaEngine javaCompiler = new JavaEngine(); | ||
72 | compilers.Add(javaCompiler.FileExt(), javaCompiler); | ||
73 | } | ||
74 | |||
75 | public void Initialise(Scene scene, IConfigSource config) | ||
76 | { | ||
77 | m_log.Info("[SCRIPTMODULE]: Initialising Extensions Scripting Module"); | ||
78 | m_scene = scene; | ||
79 | |||
80 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); | ||
81 | } | ||
82 | |||
83 | public void PostInitialise() | ||
84 | { | ||
85 | } | ||
86 | |||
87 | public void Close() | ||
88 | { | ||
89 | } | ||
90 | |||
91 | public string Name | ||
92 | { | ||
93 | get { return "ExtensionsScriptingModule"; } | ||
94 | } | ||
95 | |||
96 | public bool IsSharedModule | ||
97 | { | ||
98 | get { return false; } | ||
99 | } | ||
100 | |||
101 | public bool Compile(string filename) | ||
102 | { | ||
103 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) | ||
104 | { | ||
105 | if (filename.EndsWith(compiler.Key)) | ||
106 | { | ||
107 | LoadFromCompiler(compiler.Value.compile(filename)); | ||
108 | break; | ||
109 | } | ||
110 | } | ||
111 | |||
112 | return true; | ||
113 | } | ||
114 | |||
115 | public void RunScriptCmd(string[] args) | ||
116 | { | ||
117 | switch (args[0]) | ||
118 | { | ||
119 | case "load": | ||
120 | Compile(args[1]); | ||
121 | break; | ||
122 | |||
123 | default: | ||
124 | m_log.Error("Unknown script command"); | ||
125 | break; | ||
126 | } | ||
127 | } | ||
128 | |||
129 | public bool AddPreCompiledScript(IScript script) | ||
130 | { | ||
131 | m_log.Info("[SCRIPT]: Loading script " + script.Name); | ||
132 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); | ||
133 | // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | ||
134 | script.Initialise(scriptInfo); | ||
135 | scripts.Add(script); | ||
136 | |||
137 | return true; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | public interface IExtensionScriptModule | ||
142 | { | ||
143 | bool Compile(string filename); | ||
144 | bool AddPreCompiledScript(IScript script); | ||
145 | } | ||
146 | |||
147 | internal interface IScriptCompiler | ||
148 | { | ||
149 | Dictionary<string, IScript> compile(string filename); | ||
150 | string FileExt(); | ||
151 | } | ||
152 | } | ||
diff --git a/prebuild.xml b/prebuild.xml index 0b84c6b..24fbb7f 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -969,35 +969,6 @@ | |||
969 | </Files> | 969 | </Files> |
970 | </Project> | 970 | </Project> |
971 | 971 | ||
972 | <Project name="OpenSim.Region.ExtensionsScriptModule" path="OpenSim/Region/ExtensionsScriptModule" type="Library"> | ||
973 | <Configuration name="Debug"> | ||
974 | <Options> | ||
975 | <OutputPath>../../../bin/</OutputPath> | ||
976 | </Options> | ||
977 | </Configuration> | ||
978 | <Configuration name="Release"> | ||
979 | <Options> | ||
980 | <OutputPath>../../../bin/</OutputPath> | ||
981 | </Options> | ||
982 | </Configuration> | ||
983 | |||
984 | <ReferencePath>../../../bin/</ReferencePath> | ||
985 | <Reference name="System"/> | ||
986 | <Reference name="System.Xml"/> | ||
987 | <Reference name="Microsoft.JScript"/> | ||
988 | <Reference name="libsecondlife.dll" /> | ||
989 | <Reference name="OpenSim.Framework"/> | ||
990 | <Reference name="OpenSim.Region.Environment"/> | ||
991 | <Reference name="OpenSim.Framework.Console"/> | ||
992 | <Reference name="Axiom.MathLib.dll"/> | ||
993 | <Reference name="Nini.dll"/> | ||
994 | <Reference name="log4net"/> | ||
995 | |||
996 | <Files> | ||
997 | <Match pattern="*.cs" recurse="true"/> | ||
998 | </Files> | ||
999 | </Project> | ||
1000 | |||
1001 | <!-- OpenSim app --> | 972 | <!-- OpenSim app --> |
1002 | <Project name="OpenSim" path="OpenSim/Region/Application" type="Exe"> | 973 | <Project name="OpenSim" path="OpenSim/Region/Application" type="Exe"> |
1003 | <Configuration name="Debug"> | 974 | <Configuration name="Debug"> |