diff options
author | MW | 2007-08-28 18:30:28 +0000 |
---|---|---|
committer | MW | 2007-08-28 18:30:28 +0000 |
commit | c16aafee09bfcce12c3d667cd6ec382e29695490 (patch) | |
tree | c36c20a4c0efa3fbe5351b79d278d57a66e363ff | |
parent | startup event on script added to object, not all inside object. (diff) | |
download | opensim-SC-c16aafee09bfcce12c3d667cd6ec382e29695490.zip opensim-SC-c16aafee09bfcce12c3d667cd6ec382e29695490.tar.gz opensim-SC-c16aafee09bfcce12c3d667cd6ec382e29695490.tar.bz2 opensim-SC-c16aafee09bfcce12c3d667cd6ec382e29695490.tar.xz |
Taken the old scripting engine out of Region.Environment and moved it into a separate module: OpenSim.Region.ExtensionsScriptModule (named as such because the purpose of it is to script server extensions, rather than "user scripting" like Tedd's engine.)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/ModuleLoader.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/CSharpScriptEngine.cs) | 204 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs) | 142 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JScriptEngine/JScriptEngine.cs) | 204 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/ClassInstance.cs) | 92 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/ClassRecord.cs) | 1278 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Heap.cs) | 86 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs) | 1100 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs) | 192 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs) | 80 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.cs) | 270 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/MainMemory.cs) | 90 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/MethodMemory.cs) | 92 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Object.cs) | 74 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/OpCodes.cs) | 112 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Stack.cs) | 84 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/StackFrame.cs) | 98 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Thread.cs) | 238 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JavaEngine.cs) | 57 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/OpenSimJVM.cs) | 341 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/ArrayReference.cs) | 20 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/BaseType.cs) | 20 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/ObjectReference.cs) | 32 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs) | 33 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs) | 33 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj | 213 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj.user | 12 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.dll.build | 78 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj | 207 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj.user | 12 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.dll.build | 77 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/Script.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/Script.cs) | 128 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/ScriptAPI.cs) | 64 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/ScriptInfo.cs) | 126 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs) | 534 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedEvents.cs) | 46 | ||||
-rw-r--r-- | OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs (renamed from OpenSim/Region/Environment/Scenes/Scripting/ScriptManager.cs) | 245 | ||||
-rw-r--r-- | prebuild.xml | 28 |
45 files changed, 3727 insertions, 3081 deletions
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 8e42d90..dbe43d5 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -2,6 +2,7 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Reflection; | 3 | using System.Reflection; |
4 | using System.Text; | 4 | using System.Text; |
5 | using OpenSim.Framework.Console; | ||
5 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
6 | using OpenSim.Region.Environment.Interfaces; | 7 | using OpenSim.Region.Environment.Interfaces; |
7 | using OpenSim.Region.Environment.Modules; | 8 | using OpenSim.Region.Environment.Modules; |
@@ -37,6 +38,8 @@ namespace OpenSim.Region.Environment | |||
37 | avatarProfiles.Initialise(scene); | 38 | avatarProfiles.Initialise(scene); |
38 | scene.AddModule(avatarProfiles.GetName(), avatarProfiles); | 39 | scene.AddModule(avatarProfiles.GetName(), avatarProfiles); |
39 | 40 | ||
41 | this.LoadModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); | ||
42 | |||
40 | // Post Initialise Modules | 43 | // Post Initialise Modules |
41 | xferManager.PostInitialise(); | 44 | xferManager.PostInitialise(); |
42 | // chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot | 45 | // chatModule.PostInitialise(); //for now leave this disabled as it would start up a partially working irc bot |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 703fe65..300269a 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -21,7 +21,7 @@ namespace OpenSim.Region.Environment.Modules | |||
21 | 21 | ||
22 | private int m_port = 6668; | 22 | private int m_port = 6668; |
23 | private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; | 23 | private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; |
24 | private string m_nick = "OpenSimBoT"; | 24 | private string m_nick = "OpenSimBot"; |
25 | private string m_channel = "#opensim"; | 25 | private string m_channel = "#opensim"; |
26 | 26 | ||
27 | private NetworkStream m_stream; | 27 | private NetworkStream m_stream; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index dcec289..568639f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -155,16 +155,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
155 | }); | 155 | }); |
156 | } | 156 | } |
157 | 157 | ||
158 | |||
159 | /// <summary> | ||
160 | /// | ||
161 | /// </summary> | ||
162 | /// <param name="remoteClient"></param> | ||
163 | public void SendAvatarsToClient(IClientAPI remoteClient) | ||
164 | { | ||
165 | |||
166 | } | ||
167 | |||
168 | /// <summary> | 158 | /// <summary> |
169 | /// | 159 | /// |
170 | /// </summary> | 160 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b2ddb7d..cd5d2a2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -44,7 +44,6 @@ using OpenSim.Framework.Communications.Caches; | |||
44 | using OpenSim.Region.Environment.LandManagement; | 44 | using OpenSim.Region.Environment.LandManagement; |
45 | using OpenSim.Region.Environment; | 45 | using OpenSim.Region.Environment; |
46 | using OpenSim.Region.Environment.Interfaces; | 46 | using OpenSim.Region.Environment.Interfaces; |
47 | using OpenSim.Region.Scripting; | ||
48 | using OpenSim.Region.Terrain; | 47 | using OpenSim.Region.Terrain; |
49 | using OpenSim.Framework.Data; | 48 | using OpenSim.Framework.Data; |
50 | using Caps = OpenSim.Region.Capabilities.Caps; | 49 | using Caps = OpenSim.Region.Capabilities.Caps; |
@@ -122,13 +121,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
122 | get { return m_estateManager; } | 121 | get { return m_estateManager; } |
123 | } | 122 | } |
124 | 123 | ||
125 | private ScriptManager m_scriptManager; | ||
126 | |||
127 | public ScriptManager ScriptManager | ||
128 | { | ||
129 | get { return m_scriptManager; } | ||
130 | } | ||
131 | |||
132 | private PermissionManager m_permissionManager; | 124 | private PermissionManager m_permissionManager; |
133 | 125 | ||
134 | public PermissionManager PermissionsMngr | 126 | public PermissionManager PermissionsMngr |
@@ -174,7 +166,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
174 | 166 | ||
175 | m_LandManager = new LandManager(this, m_regInfo); | 167 | m_LandManager = new LandManager(this, m_regInfo); |
176 | m_estateManager = new EstateManager(this, m_regInfo); | 168 | m_estateManager = new EstateManager(this, m_regInfo); |
177 | m_scriptManager = new ScriptManager(this); | ||
178 | m_eventManager = new EventManager(); | 169 | m_eventManager = new EventManager(); |
179 | m_permissionManager = new PermissionManager(this); | 170 | m_permissionManager = new PermissionManager(this); |
180 | 171 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs deleted file mode 100644 index 5a7b780..0000000 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Byte : BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs deleted file mode 100644 index c87ee8f..0000000 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Char : BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs index 8e1b23e..7da3d55 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/CSharpScriptEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs | |||
@@ -1,102 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.CodeDom.Compiler; | 29 | using System.CodeDom.Compiler; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using Microsoft.CSharp; | 31 | using Microsoft.CSharp; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | 33 | ||
34 | namespace OpenSim.Region.Scripting | 34 | namespace OpenSim.Region.ExtensionsScriptModule.CSharp |
35 | { | 35 | { |
36 | public class CSharpScriptEngine : IScriptCompiler | 36 | public class CSharpScriptEngine : IScriptCompiler |
37 | { | 37 | { |
38 | public string FileExt() | 38 | public string FileExt() |
39 | { | 39 | { |
40 | return ".cs"; | 40 | return ".cs"; |
41 | } | 41 | } |
42 | 42 | ||
43 | private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) | 43 | private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) |
44 | { | 44 | { |
45 | CompilerParameters compilerParams = new CompilerParameters(); | 45 | CompilerParameters compilerParams = new CompilerParameters(); |
46 | CompilerResults compilerResults; | 46 | CompilerResults compilerResults; |
47 | compilerParams.GenerateExecutable = false; | 47 | compilerParams.GenerateExecutable = false; |
48 | compilerParams.GenerateInMemory = true; | 48 | compilerParams.GenerateInMemory = true; |
49 | compilerParams.IncludeDebugInformation = false; | 49 | compilerParams.IncludeDebugInformation = false; |
50 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); | 50 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); |
51 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); | 51 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); |
52 | compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); | 52 | compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); |
53 | compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); | 53 | compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); |
54 | compilerParams.ReferencedAssemblies.Add("System.dll"); | 54 | compilerParams.ReferencedAssemblies.Add("System.dll"); |
55 | 55 | ||
56 | compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); | 56 | compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); |
57 | 57 | ||
58 | if (compilerResults.Errors.Count > 0) | 58 | if (compilerResults.Errors.Count > 0) |
59 | { | 59 | { |
60 | MainLog.Instance.Error("Compile errors"); | 60 | MainLog.Instance.Error("Compile errors"); |
61 | foreach (CompilerError error in compilerResults.Errors) | 61 | foreach (CompilerError error in compilerResults.Errors) |
62 | { | 62 | { |
63 | MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); | 63 | MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | else | 66 | else |
67 | { | 67 | { |
68 | Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); | 68 | Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); |
69 | 69 | ||
70 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) | 70 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) |
71 | { | 71 | { |
72 | Type testInterface = pluginType.GetInterface("IScript", true); | 72 | Type testInterface = pluginType.GetInterface("IScript", true); |
73 | 73 | ||
74 | if (testInterface != null) | 74 | if (testInterface != null) |
75 | { | 75 | { |
76 | IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | 76 | IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); |
77 | 77 | ||
78 | string scriptName = "C#/" + script.Name; | 78 | string scriptName = "C#/" + script.Name; |
79 | Console.WriteLine("Script: " + scriptName + " loaded."); | 79 | Console.WriteLine("Script: " + scriptName + " loaded."); |
80 | 80 | ||
81 | if (!scripts.ContainsKey(scriptName)) | 81 | if (!scripts.ContainsKey(scriptName)) |
82 | { | 82 | { |
83 | scripts.Add(scriptName, script); | 83 | scripts.Add(scriptName, script); |
84 | } | 84 | } |
85 | else | 85 | else |
86 | { | 86 | { |
87 | scripts[scriptName] = script; | 87 | scripts[scriptName] = script; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | } | 90 | } |
91 | return scripts; | 91 | return scripts; |
92 | } | 92 | } |
93 | return null; | 93 | return null; |
94 | } | 94 | } |
95 | 95 | ||
96 | public Dictionary<string,IScript> compile(string filename) | 96 | public Dictionary<string,IScript> compile(string filename) |
97 | { | 97 | { |
98 | CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); | 98 | CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); |
99 | return LoadDotNetScript(csharpProvider, filename); | 99 | return LoadDotNetScript(csharpProvider, filename); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | } | 102 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs index 80d77f2..90d3438 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs | |||
@@ -1,72 +1,72 @@ | |||
1 | using OpenSim.Framework.Console; | 1 | using OpenSim.Framework.Console; |
2 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
3 | using OpenSim.Region.Environment; | 3 | using OpenSim.Region.Environment; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using libsecondlife; | 7 | using libsecondlife; |
8 | 8 | ||
9 | namespace OpenSim.Region.Scripting.Examples | 9 | namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples |
10 | { | 10 | { |
11 | public class LSLExportScript : IScript | 11 | public class LSLExportScript : IScript |
12 | { | 12 | { |
13 | ScriptInfo script; | 13 | ScriptInfo script; |
14 | 14 | ||
15 | public string Name | 15 | public string Name |
16 | { | 16 | { |
17 | get { return "LSL Export Script 0.1"; } | 17 | get { return "LSL Export Script 0.1"; } |
18 | } | 18 | } |
19 | 19 | ||
20 | public void Initialise(ScriptInfo scriptInfo) | 20 | public void Initialise(ScriptInfo scriptInfo) |
21 | { | 21 | { |
22 | script = scriptInfo; | 22 | script = scriptInfo; |
23 | 23 | ||
24 | script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); | 24 | script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); |
25 | } | 25 | } |
26 | 26 | ||
27 | void ProcessConsoleMsg(string[] args) | 27 | void ProcessConsoleMsg(string[] args) |
28 | { | 28 | { |
29 | /*if (args[0].ToLower() == "lslexport") | 29 | /*if (args[0].ToLower() == "lslexport") |
30 | { | 30 | { |
31 | string sequence = ""; | 31 | string sequence = ""; |
32 | 32 | ||
33 | foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) | 33 | foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) |
34 | { | 34 | { |
35 | SceneObject root = obj.Value; | 35 | SceneObject root = obj.Value; |
36 | 36 | ||
37 | sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; | 37 | sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; |
38 | 38 | ||
39 | string rootPrim = processPrimitiveToString(root.rootPrimitive); | 39 | string rootPrim = processPrimitiveToString(root.rootPrimitive); |
40 | 40 | ||
41 | sequence += "ROOT:" + rootPrim; | 41 | sequence += "ROOT:" + rootPrim; |
42 | 42 | ||
43 | foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) | 43 | foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) |
44 | { | 44 | { |
45 | string child = processPrimitiveToString(prim.Value); | 45 | string child = processPrimitiveToString(prim.Value); |
46 | sequence += "CHILD:" + child; | 46 | sequence += "CHILD:" + child; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | System.Console.WriteLine(sequence); | 50 | System.Console.WriteLine(sequence); |
51 | }*/ | 51 | }*/ |
52 | } | 52 | } |
53 | 53 | ||
54 | string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) | 54 | string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) |
55 | { | 55 | { |
56 | /*string desc = prim.Description; | 56 | /*string desc = prim.Description; |
57 | string name = prim.Name; | 57 | string name = prim.Name; |
58 | LLVector3 pos = prim.Pos; | 58 | LLVector3 pos = prim.Pos; |
59 | LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w); | 59 | LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w); |
60 | LLVector3 scale = prim.Scale; | 60 | LLVector3 scale = prim.Scale; |
61 | LLVector3 rootPos = prim.WorldPos; | 61 | LLVector3 rootPos = prim.WorldPos; |
62 | 62 | ||
63 | string setPrimParams = ""; | 63 | string setPrimParams = ""; |
64 | 64 | ||
65 | setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; | 65 | setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; |
66 | 66 | ||
67 | return setPrimParams; | 67 | return setPrimParams; |
68 | */ | 68 | */ |
69 | return ""; | 69 | return ""; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } \ No newline at end of file | 72 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JScriptEngine/JScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs index 554ffeb..8efbdc2 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JScriptEngine/JScriptEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs | |||
@@ -1,102 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.CodeDom.Compiler; | 29 | using System.CodeDom.Compiler; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using Microsoft.JScript; | 31 | using Microsoft.JScript; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | 33 | ||
34 | namespace OpenSim.Region.Scripting | 34 | namespace OpenSim.Region.ExtensionsScriptModule.JScript |
35 | { | 35 | { |
36 | public class JScriptEngine : IScriptCompiler | 36 | public class JScriptEngine : IScriptCompiler |
37 | { | 37 | { |
38 | public string FileExt() | 38 | public string FileExt() |
39 | { | 39 | { |
40 | return ".js"; | 40 | return ".js"; |
41 | } | 41 | } |
42 | 42 | ||
43 | private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) | 43 | private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) |
44 | { | 44 | { |
45 | CompilerParameters compilerParams = new CompilerParameters(); | 45 | CompilerParameters compilerParams = new CompilerParameters(); |
46 | CompilerResults compilerResults; | 46 | CompilerResults compilerResults; |
47 | compilerParams.GenerateExecutable = false; | 47 | compilerParams.GenerateExecutable = false; |
48 | compilerParams.GenerateInMemory = true; | 48 | compilerParams.GenerateInMemory = true; |
49 | compilerParams.IncludeDebugInformation = false; | 49 | compilerParams.IncludeDebugInformation = false; |
50 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); | 50 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); |
51 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); | 51 | compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); |
52 | compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); | 52 | compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); |
53 | compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); | 53 | compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); |
54 | compilerParams.ReferencedAssemblies.Add("System.dll"); | 54 | compilerParams.ReferencedAssemblies.Add("System.dll"); |
55 | 55 | ||
56 | compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); | 56 | compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); |
57 | 57 | ||
58 | if (compilerResults.Errors.Count > 0) | 58 | if (compilerResults.Errors.Count > 0) |
59 | { | 59 | { |
60 | MainLog.Instance.Error("Compile errors"); | 60 | MainLog.Instance.Error("Compile errors"); |
61 | foreach (CompilerError error in compilerResults.Errors) | 61 | foreach (CompilerError error in compilerResults.Errors) |
62 | { | 62 | { |
63 | MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); | 63 | MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | else | 66 | else |
67 | { | 67 | { |
68 | Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); | 68 | Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); |
69 | 69 | ||
70 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) | 70 | foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) |
71 | { | 71 | { |
72 | Type testInterface = pluginType.GetInterface("IScript", true); | 72 | Type testInterface = pluginType.GetInterface("IScript", true); |
73 | 73 | ||
74 | if (testInterface != null) | 74 | if (testInterface != null) |
75 | { | 75 | { |
76 | IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); | 76 | IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); |
77 | 77 | ||
78 | string scriptName = "JS.NET/" + script.Name; | 78 | string scriptName = "JS.NET/" + script.Name; |
79 | Console.WriteLine("Script: " + scriptName + " loaded."); | 79 | Console.WriteLine("Script: " + scriptName + " loaded."); |
80 | 80 | ||
81 | if (!scripts.ContainsKey(scriptName)) | 81 | if (!scripts.ContainsKey(scriptName)) |
82 | { | 82 | { |
83 | scripts.Add(scriptName, script); | 83 | scripts.Add(scriptName, script); |
84 | } | 84 | } |
85 | else | 85 | else |
86 | { | 86 | { |
87 | scripts[scriptName] = script; | 87 | scripts[scriptName] = script; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | } | 90 | } |
91 | return scripts; | 91 | return scripts; |
92 | } | 92 | } |
93 | return null; | 93 | return null; |
94 | } | 94 | } |
95 | 95 | ||
96 | public Dictionary<string, IScript> compile(string filename) | 96 | public Dictionary<string, IScript> compile(string filename) |
97 | { | 97 | { |
98 | JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); | 98 | JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); |
99 | return LoadDotNetScript(jscriptProvider, filename); | 99 | return LoadDotNetScript(jscriptProvider, filename); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | } | 102 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs index 4b734a3..bda4e3e 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/ClassInstance.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs | |||
@@ -1,46 +1,46 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 32 | ||
33 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
34 | { | 34 | { |
35 | public class ClassInstance : Object | 35 | public class ClassInstance : Object |
36 | { | 36 | { |
37 | public int Size; | 37 | public int Size; |
38 | public ClassRecord ClassRec; | 38 | public ClassRecord ClassRec; |
39 | public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); | 39 | public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); |
40 | 40 | ||
41 | public ClassInstance() | 41 | public ClassInstance() |
42 | { | 42 | { |
43 | 43 | ||
44 | } | 44 | } |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs index 4b2aec3..116d2bc 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/ClassRecord.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs | |||
@@ -1,640 +1,640 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
33 | using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | 33 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
34 | 34 | ||
35 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 35 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
36 | { | 36 | { |
37 | public class ClassRecord | 37 | public class ClassRecord |
38 | { | 38 | { |
39 | private ushort m_majorVersion; | 39 | private ushort m_majorVersion; |
40 | private ushort m_minorVersion; | 40 | private ushort m_minorVersion; |
41 | private ushort m_constantPoolCount; | 41 | private ushort m_constantPoolCount; |
42 | private ushort m_accessFlags; | 42 | private ushort m_accessFlags; |
43 | private ushort m_thisClass; | 43 | private ushort m_thisClass; |
44 | private ushort m_supperClass; | 44 | private ushort m_supperClass; |
45 | private ushort m_interfaceCount; | 45 | private ushort m_interfaceCount; |
46 | private ushort m_fieldCount; | 46 | private ushort m_fieldCount; |
47 | private ushort m_methodCount; | 47 | private ushort m_methodCount; |
48 | //private ushort _attributeCount; | 48 | //private ushort _attributeCount; |
49 | //private string _name; | 49 | //private string _name; |
50 | public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); | 50 | public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); |
51 | public PoolClass MClass; | 51 | public PoolClass MClass; |
52 | 52 | ||
53 | public List<PoolItem> m_constantsPool = new List<PoolItem>(); | 53 | public List<PoolItem> m_constantsPool = new List<PoolItem>(); |
54 | private List<MethodInfo> m_methodsList = new List<MethodInfo>(); | 54 | private List<MethodInfo> m_methodsList = new List<MethodInfo>(); |
55 | private List<FieldInfo> m_fieldList = new List<FieldInfo>(); | 55 | private List<FieldInfo> m_fieldList = new List<FieldInfo>(); |
56 | 56 | ||
57 | public ClassRecord() | 57 | public ClassRecord() |
58 | { | 58 | { |
59 | 59 | ||
60 | } | 60 | } |
61 | 61 | ||
62 | public ClassInstance CreateNewInstance() | 62 | public ClassInstance CreateNewInstance() |
63 | { | 63 | { |
64 | ClassInstance classInst = new ClassInstance(); | 64 | ClassInstance classInst = new ClassInstance(); |
65 | classInst.ClassRec = this; | 65 | classInst.ClassRec = this; |
66 | //TODO: set fields | 66 | //TODO: set fields |
67 | 67 | ||
68 | return classInst; | 68 | return classInst; |
69 | } | 69 | } |
70 | 70 | ||
71 | public void LoadClassFromFile(string fileName) | 71 | public void LoadClassFromFile(string fileName) |
72 | { | 72 | { |
73 | Console.WriteLine("loading script " + fileName); | 73 | Console.WriteLine("loading script " + fileName); |
74 | FileStream fs = File.OpenRead(fileName); | 74 | FileStream fs = File.OpenRead(fileName); |
75 | this.LoadClassFromBytes(ReadFully(fs)); | 75 | this.LoadClassFromBytes(ReadFully(fs)); |
76 | fs.Close(); | 76 | fs.Close(); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void LoadClassFromBytes(byte[] data) | 79 | public void LoadClassFromBytes(byte[] data) |
80 | { | 80 | { |
81 | int i = 0; | 81 | int i = 0; |
82 | i += 4; | 82 | i += 4; |
83 | m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); | 83 | m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); |
84 | m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); | 84 | m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); |
85 | m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); | 85 | m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); |
86 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); | 86 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); |
87 | for (int count = 0; count < (m_constantPoolCount - 1); count++) | 87 | for (int count = 0; count < (m_constantPoolCount - 1); count++) |
88 | { | 88 | { |
89 | //read in the constant pool | 89 | //read in the constant pool |
90 | byte pooltype = data[i++]; | 90 | byte pooltype = data[i++]; |
91 | Console.WriteLine("#" + count + ": new constant type = " + pooltype); | 91 | Console.WriteLine("#" + count + ": new constant type = " + pooltype); |
92 | //Console.WriteLine("start position is: " + i); | 92 | //Console.WriteLine("start position is: " + i); |
93 | switch (pooltype) | 93 | switch (pooltype) |
94 | { | 94 | { |
95 | case 1: //Utf8 | 95 | case 1: //Utf8 |
96 | ushort uLength = (ushort)((data[i++] << 8) + data[i++]); | 96 | ushort uLength = (ushort)((data[i++] << 8) + data[i++]); |
97 | 97 | ||
98 | // Console.WriteLine("new utf8 type, length is " + uLength); | 98 | // Console.WriteLine("new utf8 type, length is " + uLength); |
99 | PoolUtf8 utf8 = new PoolUtf8(); | 99 | PoolUtf8 utf8 = new PoolUtf8(); |
100 | utf8.readValue(data, ref i, uLength); | 100 | utf8.readValue(data, ref i, uLength); |
101 | this.m_constantsPool.Add(utf8); | 101 | this.m_constantsPool.Add(utf8); |
102 | break; | 102 | break; |
103 | case 3: //Int | 103 | case 3: //Int |
104 | break; | 104 | break; |
105 | case 4: //Float | 105 | case 4: //Float |
106 | break; | 106 | break; |
107 | case 7: //Class | 107 | case 7: //Class |
108 | PoolClass pClass = new PoolClass(this); | 108 | PoolClass pClass = new PoolClass(this); |
109 | pClass.readValue(data, ref i); | 109 | pClass.readValue(data, ref i); |
110 | this.m_constantsPool.Add(pClass); | 110 | this.m_constantsPool.Add(pClass); |
111 | break; | 111 | break; |
112 | case 9: //FieldRef | 112 | case 9: //FieldRef |
113 | PoolFieldRef pField = new PoolFieldRef(this); | 113 | PoolFieldRef pField = new PoolFieldRef(this); |
114 | pField.readValue(data, ref i); | 114 | pField.readValue(data, ref i); |
115 | this.m_constantsPool.Add(pField); | 115 | this.m_constantsPool.Add(pField); |
116 | break; | 116 | break; |
117 | case 10: //Method | 117 | case 10: //Method |
118 | PoolMethodRef pMeth = new PoolMethodRef(this); | 118 | PoolMethodRef pMeth = new PoolMethodRef(this); |
119 | pMeth.readValue(data, ref i); | 119 | pMeth.readValue(data, ref i); |
120 | this.m_constantsPool.Add(pMeth); | 120 | this.m_constantsPool.Add(pMeth); |
121 | break; | 121 | break; |
122 | case 12: //NamedType | 122 | case 12: //NamedType |
123 | PoolNamedType pNamed = new PoolNamedType(this); | 123 | PoolNamedType pNamed = new PoolNamedType(this); |
124 | pNamed.readValue(data, ref i); | 124 | pNamed.readValue(data, ref i); |
125 | this.m_constantsPool.Add(pNamed); | 125 | this.m_constantsPool.Add(pNamed); |
126 | break; | 126 | break; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); | 130 | m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); |
131 | m_thisClass = (ushort)((data[i++] << 8) + data[i++]); | 131 | m_thisClass = (ushort)((data[i++] << 8) + data[i++]); |
132 | m_supperClass = (ushort)((data[i++] << 8) + data[i++]); | 132 | m_supperClass = (ushort)((data[i++] << 8) + data[i++]); |
133 | 133 | ||
134 | if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) | 134 | if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) |
135 | { | 135 | { |
136 | this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); | 136 | this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); |
137 | } | 137 | } |
138 | 138 | ||
139 | m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); | 139 | m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); |
140 | //should now read in the info for each interface | 140 | //should now read in the info for each interface |
141 | 141 | ||
142 | m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); | 142 | m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); |
143 | //should now read in the info for each field | 143 | //should now read in the info for each field |
144 | for (int count = 0; count < m_fieldCount; count++) | 144 | for (int count = 0; count < m_fieldCount; count++) |
145 | { | 145 | { |
146 | FieldInfo fieldInf = new FieldInfo(this); | 146 | FieldInfo fieldInf = new FieldInfo(this); |
147 | fieldInf.ReadData(data, ref i); | 147 | fieldInf.ReadData(data, ref i); |
148 | this.m_fieldList.Add(fieldInf); | 148 | this.m_fieldList.Add(fieldInf); |
149 | } | 149 | } |
150 | 150 | ||
151 | m_methodCount = (ushort)((data[i++] << 8) + data[i++]); | 151 | m_methodCount = (ushort)((data[i++] << 8) + data[i++]); |
152 | for (int count = 0; count < m_methodCount; count++) | 152 | for (int count = 0; count < m_methodCount; count++) |
153 | { | 153 | { |
154 | MethodInfo methInf = new MethodInfo(this); | 154 | MethodInfo methInf = new MethodInfo(this); |
155 | methInf.ReadData(data, ref i); | 155 | methInf.ReadData(data, ref i); |
156 | this.m_methodsList.Add(methInf); | 156 | this.m_methodsList.Add(methInf); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | public void AddMethodsToMemory(MethodMemory memory) | 160 | public void AddMethodsToMemory(MethodMemory memory) |
161 | { | 161 | { |
162 | for (int count = 0; count < m_methodCount; count++) | 162 | for (int count = 0; count < m_methodCount; count++) |
163 | { | 163 | { |
164 | this.m_methodsList[count].AddMethodCode(memory); | 164 | this.m_methodsList[count].AddMethodCode(memory); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | public bool StartMethod(Thread thread, string methodName) | 168 | public bool StartMethod(Thread thread, string methodName) |
169 | { | 169 | { |
170 | for (int count = 0; count < m_methodCount; count++) | 170 | for (int count = 0; count < m_methodCount; count++) |
171 | { | 171 | { |
172 | if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) | 172 | if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) |
173 | { | 173 | { |
174 | if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) | 174 | if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) |
175 | { | 175 | { |
176 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); | 176 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); |
177 | thread.SetPC(this.m_methodsList[count].CodePointer); | 177 | thread.SetPC(this.m_methodsList[count].CodePointer); |
178 | return true; | 178 | return true; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | } | 181 | } |
182 | return false; | 182 | return false; |
183 | } | 183 | } |
184 | 184 | ||
185 | public void PrintToConsole() | 185 | public void PrintToConsole() |
186 | { | 186 | { |
187 | Console.WriteLine("Class File:"); | 187 | Console.WriteLine("Class File:"); |
188 | Console.WriteLine("Major version: " + m_majorVersion); | 188 | Console.WriteLine("Major version: " + m_majorVersion); |
189 | Console.WriteLine("Minor version: " + m_minorVersion); | 189 | Console.WriteLine("Minor version: " + m_minorVersion); |
190 | Console.WriteLine("Pool size: " + m_constantPoolCount); | 190 | Console.WriteLine("Pool size: " + m_constantPoolCount); |
191 | 191 | ||
192 | for (int i = 0; i < m_constantsPool.Count; i++) | 192 | for (int i = 0; i < m_constantsPool.Count; i++) |
193 | { | 193 | { |
194 | this.m_constantsPool[i].Print(); | 194 | this.m_constantsPool[i].Print(); |
195 | } | 195 | } |
196 | 196 | ||
197 | Console.WriteLine("Access flags: " + m_accessFlags); | 197 | Console.WriteLine("Access flags: " + m_accessFlags); |
198 | Console.WriteLine("This class: " + m_thisClass); | 198 | Console.WriteLine("This class: " + m_thisClass); |
199 | Console.WriteLine("Super class: " + m_supperClass); | 199 | Console.WriteLine("Super class: " + m_supperClass); |
200 | 200 | ||
201 | for (int count = 0; count < m_fieldCount; count++) | 201 | for (int count = 0; count < m_fieldCount; count++) |
202 | { | 202 | { |
203 | Console.WriteLine(); | 203 | Console.WriteLine(); |
204 | this.m_fieldList[count].Print(); | 204 | this.m_fieldList[count].Print(); |
205 | } | 205 | } |
206 | 206 | ||
207 | for (int count = 0; count < m_methodCount; count++) | 207 | for (int count = 0; count < m_methodCount; count++) |
208 | { | 208 | { |
209 | Console.WriteLine(); | 209 | Console.WriteLine(); |
210 | this.m_methodsList[count].Print(); | 210 | this.m_methodsList[count].Print(); |
211 | } | 211 | } |
212 | 212 | ||
213 | Console.WriteLine("class name is " + this.MClass.Name.Value); | 213 | Console.WriteLine("class name is " + this.MClass.Name.Value); |
214 | } | 214 | } |
215 | 215 | ||
216 | public static byte[] ReadFully(Stream stream) | 216 | public static byte[] ReadFully(Stream stream) |
217 | { | 217 | { |
218 | byte[] buffer = new byte[1024]; | 218 | byte[] buffer = new byte[1024]; |
219 | using (MemoryStream ms = new MemoryStream()) | 219 | using (MemoryStream ms = new MemoryStream()) |
220 | { | 220 | { |
221 | while (true) | 221 | while (true) |
222 | { | 222 | { |
223 | int read = stream.Read(buffer, 0, buffer.Length); | 223 | int read = stream.Read(buffer, 0, buffer.Length); |
224 | if (read <= 0) | 224 | if (read <= 0) |
225 | return ms.ToArray(); | 225 | return ms.ToArray(); |
226 | ms.Write(buffer, 0, read); | 226 | ms.Write(buffer, 0, read); |
227 | } | 227 | } |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | #region nested classes | 231 | #region nested classes |
232 | public class PoolItem | 232 | public class PoolItem |
233 | { | 233 | { |
234 | public virtual void Print() | 234 | public virtual void Print() |
235 | { | 235 | { |
236 | 236 | ||
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | public class PoolUtf8 : PoolItem | 240 | public class PoolUtf8 : PoolItem |
241 | { | 241 | { |
242 | public string Value = ""; | 242 | public string Value = ""; |
243 | 243 | ||
244 | public void readValue(byte[] data, ref int pointer, int length) | 244 | public void readValue(byte[] data, ref int pointer, int length) |
245 | { | 245 | { |
246 | for (int i = 0; i < length; i++) | 246 | for (int i = 0; i < length; i++) |
247 | { | 247 | { |
248 | int a = (int)data[pointer++]; | 248 | int a = (int)data[pointer++]; |
249 | if ((a & 0x80) == 0) | 249 | if ((a & 0x80) == 0) |
250 | { | 250 | { |
251 | Value = Value + (char)a; | 251 | Value = Value + (char)a; |
252 | } | 252 | } |
253 | else if ((a & 0x20) == 0) | 253 | else if ((a & 0x20) == 0) |
254 | { | 254 | { |
255 | int b = (int)data[pointer++]; | 255 | int b = (int)data[pointer++]; |
256 | Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); | 256 | Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); |
257 | } | 257 | } |
258 | else | 258 | else |
259 | { | 259 | { |
260 | int b = (int)data[pointer++]; | 260 | int b = (int)data[pointer++]; |
261 | int c = (int)data[pointer++]; | 261 | int c = (int)data[pointer++]; |
262 | Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); | 262 | Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | public override void Print() | 267 | public override void Print() |
268 | { | 268 | { |
269 | Console.WriteLine("Utf8 type: " + Value); | 269 | Console.WriteLine("Utf8 type: " + Value); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | private class PoolInt : PoolItem | 273 | private class PoolInt : PoolItem |
274 | { | 274 | { |
275 | 275 | ||
276 | } | 276 | } |
277 | 277 | ||
278 | public class PoolClass : PoolItem | 278 | public class PoolClass : PoolItem |
279 | { | 279 | { |
280 | //public string name = ""; | 280 | //public string name = ""; |
281 | public ushort namePointer = 0; | 281 | public ushort namePointer = 0; |
282 | private ClassRecord parent; | 282 | private ClassRecord parent; |
283 | public PoolUtf8 Name; | 283 | public PoolUtf8 Name; |
284 | 284 | ||
285 | public PoolClass(ClassRecord paren) | 285 | public PoolClass(ClassRecord paren) |
286 | { | 286 | { |
287 | parent = paren; | 287 | parent = paren; |
288 | } | 288 | } |
289 | 289 | ||
290 | public void readValue(byte[] data, ref int pointer) | 290 | public void readValue(byte[] data, ref int pointer) |
291 | { | 291 | { |
292 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 292 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); |
293 | } | 293 | } |
294 | 294 | ||
295 | public override void Print() | 295 | public override void Print() |
296 | { | 296 | { |
297 | this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); | 297 | this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); |
298 | Console.Write("Class type: " + namePointer); | 298 | Console.Write("Class type: " + namePointer); |
299 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); | 299 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); |
300 | 300 | ||
301 | } | 301 | } |
302 | } | 302 | } |
303 | 303 | ||
304 | public class PoolFieldRef : PoolItem | 304 | public class PoolFieldRef : PoolItem |
305 | { | 305 | { |
306 | public ushort classPointer = 0; | 306 | public ushort classPointer = 0; |
307 | public ushort nameTypePointer = 0; | 307 | public ushort nameTypePointer = 0; |
308 | public PoolNamedType mNameType; | 308 | public PoolNamedType mNameType; |
309 | public PoolClass mClass; | 309 | public PoolClass mClass; |
310 | private ClassRecord parent; | 310 | private ClassRecord parent; |
311 | 311 | ||
312 | public PoolFieldRef(ClassRecord paren) | 312 | public PoolFieldRef(ClassRecord paren) |
313 | { | 313 | { |
314 | parent = paren; | 314 | parent = paren; |
315 | } | 315 | } |
316 | 316 | ||
317 | public void readValue(byte[] data, ref int pointer) | 317 | public void readValue(byte[] data, ref int pointer) |
318 | { | 318 | { |
319 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 319 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); |
320 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 320 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); |
321 | } | 321 | } |
322 | 322 | ||
323 | public override void Print() | 323 | public override void Print() |
324 | { | 324 | { |
325 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); | 325 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); |
326 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); | 326 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); |
327 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); | 327 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); |
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | public class PoolMethodRef : PoolItem | 331 | public class PoolMethodRef : PoolItem |
332 | { | 332 | { |
333 | public ushort classPointer = 0; | 333 | public ushort classPointer = 0; |
334 | public ushort nameTypePointer = 0; | 334 | public ushort nameTypePointer = 0; |
335 | public PoolNamedType mNameType; | 335 | public PoolNamedType mNameType; |
336 | public PoolClass mClass; | 336 | public PoolClass mClass; |
337 | private ClassRecord parent; | 337 | private ClassRecord parent; |
338 | 338 | ||
339 | public PoolMethodRef(ClassRecord paren) | 339 | public PoolMethodRef(ClassRecord paren) |
340 | { | 340 | { |
341 | parent = paren; | 341 | parent = paren; |
342 | } | 342 | } |
343 | 343 | ||
344 | public void readValue(byte[] data, ref int pointer) | 344 | public void readValue(byte[] data, ref int pointer) |
345 | { | 345 | { |
346 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 346 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); |
347 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 347 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); |
348 | } | 348 | } |
349 | 349 | ||
350 | public override void Print() | 350 | public override void Print() |
351 | { | 351 | { |
352 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); | 352 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); |
353 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); | 353 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); |
354 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); | 354 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); |
355 | } | 355 | } |
356 | } | 356 | } |
357 | 357 | ||
358 | public class PoolNamedType : PoolItem | 358 | public class PoolNamedType : PoolItem |
359 | { | 359 | { |
360 | public ushort namePointer = 0; | 360 | public ushort namePointer = 0; |
361 | public ushort typePointer = 0; | 361 | public ushort typePointer = 0; |
362 | private ClassRecord parent; | 362 | private ClassRecord parent; |
363 | public PoolUtf8 Name; | 363 | public PoolUtf8 Name; |
364 | public PoolUtf8 Type; | 364 | public PoolUtf8 Type; |
365 | 365 | ||
366 | public PoolNamedType(ClassRecord paren) | 366 | public PoolNamedType(ClassRecord paren) |
367 | { | 367 | { |
368 | parent = paren; | 368 | parent = paren; |
369 | } | 369 | } |
370 | 370 | ||
371 | public void readValue(byte[] data, ref int pointer) | 371 | public void readValue(byte[] data, ref int pointer) |
372 | { | 372 | { |
373 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 373 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); |
374 | typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 374 | typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); |
375 | } | 375 | } |
376 | 376 | ||
377 | public override void Print() | 377 | public override void Print() |
378 | { | 378 | { |
379 | Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); | 379 | Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); |
380 | Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); | 380 | Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); |
381 | Console.Write("Named type: " + namePointer + " , " + typePointer); | 381 | Console.Write("Named type: " + namePointer + " , " + typePointer); |
382 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); | 382 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | //*********************** | 386 | //*********************** |
387 | public class MethodInfo | 387 | public class MethodInfo |
388 | { | 388 | { |
389 | public ushort AccessFlags = 0; | 389 | public ushort AccessFlags = 0; |
390 | public ushort NameIndex = 0; | 390 | public ushort NameIndex = 0; |
391 | public string Name = ""; | 391 | public string Name = ""; |
392 | public ushort DescriptorIndex = 0; | 392 | public ushort DescriptorIndex = 0; |
393 | public ushort AttributeCount = 0; | 393 | public ushort AttributeCount = 0; |
394 | public List<MethodAttribute> Attributes = new List<MethodAttribute>(); | 394 | public List<MethodAttribute> Attributes = new List<MethodAttribute>(); |
395 | private ClassRecord parent; | 395 | private ClassRecord parent; |
396 | public int CodePointer = 0; | 396 | public int CodePointer = 0; |
397 | 397 | ||
398 | public MethodInfo(ClassRecord paren) | 398 | public MethodInfo(ClassRecord paren) |
399 | { | 399 | { |
400 | parent = paren; | 400 | parent = paren; |
401 | } | 401 | } |
402 | 402 | ||
403 | public void AddMethodCode(MethodMemory memory) | 403 | public void AddMethodCode(MethodMemory memory) |
404 | { | 404 | { |
405 | Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); | 405 | Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); |
406 | memory.Methodcount++; | 406 | memory.Methodcount++; |
407 | this.CodePointer = memory.NextMethodPC; | 407 | this.CodePointer = memory.NextMethodPC; |
408 | memory.NextMethodPC += this.Attributes[0].Code.Length; | 408 | memory.NextMethodPC += this.Attributes[0].Code.Length; |
409 | } | 409 | } |
410 | 410 | ||
411 | public void ReadData(byte[] data, ref int pointer) | 411 | public void ReadData(byte[] data, ref int pointer) |
412 | { | 412 | { |
413 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | 413 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); |
414 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 414 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); |
415 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 415 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); |
416 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 416 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); |
417 | for (int i = 0; i < AttributeCount; i++) | 417 | for (int i = 0; i < AttributeCount; i++) |
418 | { | 418 | { |
419 | MethodAttribute attri = new MethodAttribute(this.parent); | 419 | MethodAttribute attri = new MethodAttribute(this.parent); |
420 | attri.ReadData(data, ref pointer); | 420 | attri.ReadData(data, ref pointer); |
421 | this.Attributes.Add(attri); | 421 | this.Attributes.Add(attri); |
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | public void Print() | 425 | public void Print() |
426 | { | 426 | { |
427 | Console.WriteLine("Method Info Struct: "); | 427 | Console.WriteLine("Method Info Struct: "); |
428 | Console.WriteLine("AccessFlags: " + AccessFlags); | 428 | Console.WriteLine("AccessFlags: " + AccessFlags); |
429 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 429 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
430 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); | 430 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); |
431 | Console.WriteLine("Attribute Count:" + AttributeCount); | 431 | Console.WriteLine("Attribute Count:" + AttributeCount); |
432 | for (int i = 0; i < AttributeCount; i++) | 432 | for (int i = 0; i < AttributeCount; i++) |
433 | { | 433 | { |
434 | this.Attributes[i].Print(); | 434 | this.Attributes[i].Print(); |
435 | } | 435 | } |
436 | } | 436 | } |
437 | 437 | ||
438 | public class MethodAttribute | 438 | public class MethodAttribute |
439 | { | 439 | { |
440 | public ushort NameIndex = 0; | 440 | public ushort NameIndex = 0; |
441 | public string Name = ""; | 441 | public string Name = ""; |
442 | public Int32 Length = 0; | 442 | public Int32 Length = 0; |
443 | //for now only support code attribute | 443 | //for now only support code attribute |
444 | public ushort MaxStack = 0; | 444 | public ushort MaxStack = 0; |
445 | public ushort MaxLocals = 0; | 445 | public ushort MaxLocals = 0; |
446 | public Int32 CodeLength = 0; | 446 | public Int32 CodeLength = 0; |
447 | public byte[] Code; | 447 | public byte[] Code; |
448 | public ushort ExceptionTableLength = 0; | 448 | public ushort ExceptionTableLength = 0; |
449 | public ushort SubAttributeCount = 0; | 449 | public ushort SubAttributeCount = 0; |
450 | public List<SubAttribute> SubAttributes = new List<SubAttribute>(); | 450 | public List<SubAttribute> SubAttributes = new List<SubAttribute>(); |
451 | private ClassRecord parent; | 451 | private ClassRecord parent; |
452 | 452 | ||
453 | public MethodAttribute(ClassRecord paren) | 453 | public MethodAttribute(ClassRecord paren) |
454 | { | 454 | { |
455 | parent = paren; | 455 | parent = paren; |
456 | } | 456 | } |
457 | 457 | ||
458 | public void ReadData(byte[] data, ref int pointer) | 458 | public void ReadData(byte[] data, ref int pointer) |
459 | { | 459 | { |
460 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 460 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); |
461 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 461 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); |
462 | MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); | 462 | MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); |
463 | MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); | 463 | MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); |
464 | CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 464 | CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); |
465 | Code = new byte[CodeLength]; | 465 | Code = new byte[CodeLength]; |
466 | for (int i = 0; i < CodeLength; i++) | 466 | for (int i = 0; i < CodeLength; i++) |
467 | { | 467 | { |
468 | Code[i] = data[pointer++]; | 468 | Code[i] = data[pointer++]; |
469 | } | 469 | } |
470 | ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); | 470 | ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); |
471 | SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 471 | SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); |
472 | for (int i = 0; i < SubAttributeCount; i++) | 472 | for (int i = 0; i < SubAttributeCount; i++) |
473 | { | 473 | { |
474 | SubAttribute subAttri = new SubAttribute(this.parent); | 474 | SubAttribute subAttri = new SubAttribute(this.parent); |
475 | subAttri.ReadData(data, ref pointer); | 475 | subAttri.ReadData(data, ref pointer); |
476 | this.SubAttributes.Add(subAttri); | 476 | this.SubAttributes.Add(subAttri); |
477 | } | 477 | } |
478 | } | 478 | } |
479 | 479 | ||
480 | public void Print() | 480 | public void Print() |
481 | { | 481 | { |
482 | Console.WriteLine("Method Attribute: "); | 482 | Console.WriteLine("Method Attribute: "); |
483 | Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 483 | Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
484 | Console.WriteLine("Length: " + Length); | 484 | Console.WriteLine("Length: " + Length); |
485 | Console.WriteLine("MaxStack: " + MaxStack); | 485 | Console.WriteLine("MaxStack: " + MaxStack); |
486 | Console.WriteLine("MaxLocals: " + MaxLocals); | 486 | Console.WriteLine("MaxLocals: " + MaxLocals); |
487 | Console.WriteLine("CodeLength: " + CodeLength); | 487 | Console.WriteLine("CodeLength: " + CodeLength); |
488 | for (int i = 0; i < Code.Length; i++) | 488 | for (int i = 0; i < Code.Length; i++) |
489 | { | 489 | { |
490 | Console.WriteLine("OpCode #" + i + " is: " + Code[i]); | 490 | Console.WriteLine("OpCode #" + i + " is: " + Code[i]); |
491 | } | 491 | } |
492 | Console.WriteLine("SubAttributes: " + SubAttributeCount); | 492 | Console.WriteLine("SubAttributes: " + SubAttributeCount); |
493 | for (int i = 0; i < SubAttributeCount; i++) | 493 | for (int i = 0; i < SubAttributeCount; i++) |
494 | { | 494 | { |
495 | this.SubAttributes[i].Print(); | 495 | this.SubAttributes[i].Print(); |
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | public class SubAttribute | 499 | public class SubAttribute |
500 | { | 500 | { |
501 | public ushort NameIndex = 0; | 501 | public ushort NameIndex = 0; |
502 | public string Name = ""; | 502 | public string Name = ""; |
503 | public Int32 Length = 0; | 503 | public Int32 Length = 0; |
504 | public byte[] Data; | 504 | public byte[] Data; |
505 | private ClassRecord parent; | 505 | private ClassRecord parent; |
506 | 506 | ||
507 | public SubAttribute(ClassRecord paren) | 507 | public SubAttribute(ClassRecord paren) |
508 | { | 508 | { |
509 | parent = paren; | 509 | parent = paren; |
510 | } | 510 | } |
511 | 511 | ||
512 | public void ReadData(byte[] data, ref int pointer) | 512 | public void ReadData(byte[] data, ref int pointer) |
513 | { | 513 | { |
514 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 514 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); |
515 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 515 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); |
516 | Data = new byte[Length]; | 516 | Data = new byte[Length]; |
517 | for (int i = 0; i < Length; i++) | 517 | for (int i = 0; i < Length; i++) |
518 | { | 518 | { |
519 | Data[i] = data[pointer++]; | 519 | Data[i] = data[pointer++]; |
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
523 | public void Print() | 523 | public void Print() |
524 | { | 524 | { |
525 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 525 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
526 | } | 526 | } |
527 | 527 | ||
528 | } | 528 | } |
529 | } | 529 | } |
530 | 530 | ||
531 | } | 531 | } |
532 | private class InterfaceInfo | 532 | private class InterfaceInfo |
533 | { | 533 | { |
534 | public void ReadData(byte[] data, ref int i) | 534 | public void ReadData(byte[] data, ref int i) |
535 | { | 535 | { |
536 | 536 | ||
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | public class FieldInfo | 540 | public class FieldInfo |
541 | { | 541 | { |
542 | public ushort AccessFlags = 0; | 542 | public ushort AccessFlags = 0; |
543 | public ushort NameIndex = 0; | 543 | public ushort NameIndex = 0; |
544 | public string Name = ""; | 544 | public string Name = ""; |
545 | public ushort DescriptorIndex = 0; | 545 | public ushort DescriptorIndex = 0; |
546 | public ushort AttributeCount = 0; | 546 | public ushort AttributeCount = 0; |
547 | public List<FieldAttribute> Attributes = new List<FieldAttribute>(); | 547 | public List<FieldAttribute> Attributes = new List<FieldAttribute>(); |
548 | private ClassRecord parent; | 548 | private ClassRecord parent; |
549 | 549 | ||
550 | public FieldInfo(ClassRecord paren) | 550 | public FieldInfo(ClassRecord paren) |
551 | { | 551 | { |
552 | parent = paren; | 552 | parent = paren; |
553 | } | 553 | } |
554 | 554 | ||
555 | public void ReadData(byte[] data, ref int pointer) | 555 | public void ReadData(byte[] data, ref int pointer) |
556 | { | 556 | { |
557 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | 557 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); |
558 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 558 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); |
559 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 559 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); |
560 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 560 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); |
561 | for (int i = 0; i < AttributeCount; i++) | 561 | for (int i = 0; i < AttributeCount; i++) |
562 | { | 562 | { |
563 | FieldAttribute attri = new FieldAttribute(this.parent); | 563 | FieldAttribute attri = new FieldAttribute(this.parent); |
564 | attri.ReadData(data, ref pointer); | 564 | attri.ReadData(data, ref pointer); |
565 | this.Attributes.Add(attri); | 565 | this.Attributes.Add(attri); |
566 | } | 566 | } |
567 | } | 567 | } |
568 | 568 | ||
569 | public void Print() | 569 | public void Print() |
570 | { | 570 | { |
571 | Console.WriteLine("Field Info Struct: "); | 571 | Console.WriteLine("Field Info Struct: "); |
572 | Console.WriteLine("AccessFlags: " + AccessFlags); | 572 | Console.WriteLine("AccessFlags: " + AccessFlags); |
573 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 573 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
574 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); | 574 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); |
575 | Console.WriteLine("Attribute Count:" + AttributeCount); | 575 | Console.WriteLine("Attribute Count:" + AttributeCount); |
576 | //if static, add to static field list | 576 | //if static, add to static field list |
577 | // if (this.AccessFlags == 9) //public and static | 577 | // if (this.AccessFlags == 9) //public and static |
578 | if ((this.AccessFlags & 0x08) != 0) | 578 | if ((this.AccessFlags & 0x08) != 0) |
579 | { | 579 | { |
580 | switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) | 580 | switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) |
581 | { | 581 | { |
582 | case "I": | 582 | case "I": |
583 | Int newin = new Int(); | 583 | Int newin = new Int(); |
584 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); | 584 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); |
585 | break; | 585 | break; |
586 | case "F": | 586 | case "F": |
587 | Float newfl = new Float(); | 587 | Float newfl = new Float(); |
588 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); | 588 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); |
589 | break; | 589 | break; |
590 | } | 590 | } |
591 | 591 | ||
592 | } | 592 | } |
593 | for (int i = 0; i < AttributeCount; i++) | 593 | for (int i = 0; i < AttributeCount; i++) |
594 | { | 594 | { |
595 | this.Attributes[i].Print(); | 595 | this.Attributes[i].Print(); |
596 | } | 596 | } |
597 | } | 597 | } |
598 | 598 | ||
599 | public class FieldAttribute | 599 | public class FieldAttribute |
600 | { | 600 | { |
601 | public ushort NameIndex = 0; | 601 | public ushort NameIndex = 0; |
602 | public string Name = ""; | 602 | public string Name = ""; |
603 | public Int32 Length = 0; | 603 | public Int32 Length = 0; |
604 | public byte[] Data; | 604 | public byte[] Data; |
605 | private ClassRecord parent; | 605 | private ClassRecord parent; |
606 | 606 | ||
607 | public FieldAttribute(ClassRecord paren) | 607 | public FieldAttribute(ClassRecord paren) |
608 | { | 608 | { |
609 | parent = paren; | 609 | parent = paren; |
610 | } | 610 | } |
611 | 611 | ||
612 | public void ReadData(byte[] data, ref int pointer) | 612 | public void ReadData(byte[] data, ref int pointer) |
613 | { | 613 | { |
614 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 614 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); |
615 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 615 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); |
616 | Data = new byte[Length]; | 616 | Data = new byte[Length]; |
617 | for (int i = 0; i < Length; i++) | 617 | for (int i = 0; i < Length; i++) |
618 | { | 618 | { |
619 | Data[i] = data[pointer++]; | 619 | Data[i] = data[pointer++]; |
620 | } | 620 | } |
621 | } | 621 | } |
622 | 622 | ||
623 | public void Print() | 623 | public void Print() |
624 | { | 624 | { |
625 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 625 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | } | 628 | } |
629 | 629 | ||
630 | private class AttributeInfo | 630 | private class AttributeInfo |
631 | { | 631 | { |
632 | public void ReadData(byte[] data, ref int i) | 632 | public void ReadData(byte[] data, ref int i) |
633 | { | 633 | { |
634 | 634 | ||
635 | } | 635 | } |
636 | } | 636 | } |
637 | #endregion | 637 | #endregion |
638 | 638 | ||
639 | } | 639 | } |
640 | } \ No newline at end of file | 640 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs index c6423fc..1b30956 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Heap.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs | |||
@@ -1,43 +1,43 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 33 | { |
34 | public class Heap | 34 | public class Heap |
35 | { | 35 | { |
36 | public List<ClassInstance> ClassObjects = new List<ClassInstance>(); | 36 | public List<ClassInstance> ClassObjects = new List<ClassInstance>(); |
37 | 37 | ||
38 | public Heap() | 38 | public Heap() |
39 | { | 39 | { |
40 | 40 | ||
41 | } | 41 | } |
42 | } | 42 | } |
43 | } | 43 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs index ef6570d..1d5a0f6 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs | |||
@@ -1,551 +1,551 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | 33 | ||
34 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
35 | { | 35 | { |
36 | partial class Thread | 36 | partial class Thread |
37 | { | 37 | { |
38 | private partial class Interpreter | 38 | private partial class Interpreter |
39 | { | 39 | { |
40 | private bool IsLogicOpCode(byte opcode) | 40 | private bool IsLogicOpCode(byte opcode) |
41 | { | 41 | { |
42 | bool result = false; | 42 | bool result = false; |
43 | switch (opcode) | 43 | switch (opcode) |
44 | { | 44 | { |
45 | case (byte)(byte)OpCode.iconst_m1: | 45 | case (byte)(byte)OpCode.iconst_m1: |
46 | Int m_int = new Int(); | 46 | Int m_int = new Int(); |
47 | m_int.mValue = -1; | 47 | m_int.mValue = -1; |
48 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 48 | this.m_thread.m_currentFrame.OpStack.Push(m_int); |
49 | result = true; | 49 | result = true; |
50 | break; | 50 | break; |
51 | case (byte)(byte)OpCode.iconst_0: | 51 | case (byte)(byte)OpCode.iconst_0: |
52 | m_int = new Int(); | 52 | m_int = new Int(); |
53 | m_int.mValue = 0; | 53 | m_int.mValue = 0; |
54 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 54 | this.m_thread.m_currentFrame.OpStack.Push(m_int); |
55 | result = true; | 55 | result = true; |
56 | break; | 56 | break; |
57 | case (byte)(byte)OpCode.iconst_1: | 57 | case (byte)(byte)OpCode.iconst_1: |
58 | m_int = new Int(); | 58 | m_int = new Int(); |
59 | m_int.mValue = 1; | 59 | m_int.mValue = 1; |
60 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 60 | this.m_thread.m_currentFrame.OpStack.Push(m_int); |
61 | result = true; | 61 | result = true; |
62 | break; | 62 | break; |
63 | case (byte)(byte)OpCode.iconst_2: | 63 | case (byte)(byte)OpCode.iconst_2: |
64 | m_int = new Int(); | 64 | m_int = new Int(); |
65 | m_int.mValue = 2; | 65 | m_int.mValue = 2; |
66 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 66 | this.m_thread.m_currentFrame.OpStack.Push(m_int); |
67 | result = true; | 67 | result = true; |
68 | break; | 68 | break; |
69 | case (byte)(byte)OpCode.iconst_3: | 69 | case (byte)(byte)OpCode.iconst_3: |
70 | m_int = new Int(); | 70 | m_int = new Int(); |
71 | m_int.mValue = 3; | 71 | m_int.mValue = 3; |
72 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 72 | this.m_thread.m_currentFrame.OpStack.Push(m_int); |
73 | break; | 73 | break; |
74 | case (byte)(byte)OpCode.iconst_4: | 74 | case (byte)(byte)OpCode.iconst_4: |
75 | m_int = new Int(); | 75 | m_int = new Int(); |
76 | m_int.mValue = 4; | 76 | m_int.mValue = 4; |
77 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 77 | this.m_thread.m_currentFrame.OpStack.Push(m_int); |
78 | result = true; | 78 | result = true; |
79 | break; | 79 | break; |
80 | case (byte)OpCode.iconst_5: | 80 | case (byte)OpCode.iconst_5: |
81 | m_int = new Int(); | 81 | m_int = new Int(); |
82 | m_int.mValue = 5; | 82 | m_int.mValue = 5; |
83 | this.m_thread.m_currentFrame.OpStack.Push(m_int); | 83 | this.m_thread.m_currentFrame.OpStack.Push(m_int); |
84 | result = true; | 84 | result = true; |
85 | break; | 85 | break; |
86 | case (byte)OpCode.fconst_0: | 86 | case (byte)OpCode.fconst_0: |
87 | Float m_float = new Float(); | 87 | Float m_float = new Float(); |
88 | m_float.mValue = 0.0f; | 88 | m_float.mValue = 0.0f; |
89 | this.m_thread.m_currentFrame.OpStack.Push(m_float); | 89 | this.m_thread.m_currentFrame.OpStack.Push(m_float); |
90 | result = true; | 90 | result = true; |
91 | break; | 91 | break; |
92 | case (byte)OpCode.fconst_1: | 92 | case (byte)OpCode.fconst_1: |
93 | m_float = new Float(); | 93 | m_float = new Float(); |
94 | m_float.mValue = 1.0f; | 94 | m_float.mValue = 1.0f; |
95 | this.m_thread.m_currentFrame.OpStack.Push(m_float); | 95 | this.m_thread.m_currentFrame.OpStack.Push(m_float); |
96 | result = true; | 96 | result = true; |
97 | break; | 97 | break; |
98 | case (byte)OpCode.fconst_2: | 98 | case (byte)OpCode.fconst_2: |
99 | m_float = new Float(); | 99 | m_float = new Float(); |
100 | m_float.mValue = 2.0f; | 100 | m_float.mValue = 2.0f; |
101 | this.m_thread.m_currentFrame.OpStack.Push(m_float); | 101 | this.m_thread.m_currentFrame.OpStack.Push(m_float); |
102 | result = true; | 102 | result = true; |
103 | break; | 103 | break; |
104 | case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? | 104 | case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? |
105 | int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]; | 105 | int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]; |
106 | Int pushInt = new Int(); | 106 | Int pushInt = new Int(); |
107 | pushInt.mValue = pushvalue; | 107 | pushInt.mValue = pushvalue; |
108 | this.m_thread.m_currentFrame.OpStack.Push(pushInt); | 108 | this.m_thread.m_currentFrame.OpStack.Push(pushInt); |
109 | this.m_thread.PC++; | 109 | this.m_thread.PC++; |
110 | result = true; | 110 | result = true; |
111 | break; | 111 | break; |
112 | case (byte)OpCode.sipush: | 112 | case (byte)OpCode.sipush: |
113 | short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 113 | short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
114 | Int pushInt2 = new Int(); | 114 | Int pushInt2 = new Int(); |
115 | pushInt2.mValue = pushvalue2; | 115 | pushInt2.mValue = pushvalue2; |
116 | this.m_thread.m_currentFrame.OpStack.Push(pushInt2); | 116 | this.m_thread.m_currentFrame.OpStack.Push(pushInt2); |
117 | this.m_thread.PC += 2; | 117 | this.m_thread.PC += 2; |
118 | result = true; | 118 | result = true; |
119 | break; | 119 | break; |
120 | case (byte)OpCode.fload: | 120 | case (byte)OpCode.fload: |
121 | short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); | 121 | short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); |
122 | Float fload = new Float(); | 122 | Float fload = new Float(); |
123 | if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null) | 123 | if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null) |
124 | { | 124 | { |
125 | if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) | 125 | if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) |
126 | { | 126 | { |
127 | fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue; | 127 | fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue; |
128 | this.m_thread.m_currentFrame.OpStack.Push(fload); | 128 | this.m_thread.m_currentFrame.OpStack.Push(fload); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | this.m_thread.PC++; | 131 | this.m_thread.PC++; |
132 | result = true; | 132 | result = true; |
133 | break; | 133 | break; |
134 | case (byte)OpCode.iload_0: | 134 | case (byte)OpCode.iload_0: |
135 | if (this.m_thread.m_currentFrame.LocalVariables[0] != null) | 135 | if (this.m_thread.m_currentFrame.LocalVariables[0] != null) |
136 | { | 136 | { |
137 | if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) | 137 | if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) |
138 | { | 138 | { |
139 | Int newInt = new Int(); | 139 | Int newInt = new Int(); |
140 | newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; | 140 | newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; |
141 | this.m_thread.m_currentFrame.OpStack.Push(newInt); | 141 | this.m_thread.m_currentFrame.OpStack.Push(newInt); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | result = true; | 144 | result = true; |
145 | break; | 145 | break; |
146 | case (byte)OpCode.iload_1: | 146 | case (byte)OpCode.iload_1: |
147 | if (this.m_thread.m_currentFrame.LocalVariables[1] != null) | 147 | if (this.m_thread.m_currentFrame.LocalVariables[1] != null) |
148 | { | 148 | { |
149 | if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) | 149 | if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) |
150 | { | 150 | { |
151 | Int newInt = new Int(); | 151 | Int newInt = new Int(); |
152 | newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; | 152 | newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; |
153 | this.m_thread.m_currentFrame.OpStack.Push(newInt); | 153 | this.m_thread.m_currentFrame.OpStack.Push(newInt); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | result = true; | 156 | result = true; |
157 | break; | 157 | break; |
158 | case (byte)OpCode.fload_0: | 158 | case (byte)OpCode.fload_0: |
159 | if (this.m_thread.m_currentFrame.LocalVariables[0] != null) | 159 | if (this.m_thread.m_currentFrame.LocalVariables[0] != null) |
160 | { | 160 | { |
161 | if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) | 161 | if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) |
162 | { | 162 | { |
163 | Float newfloat = new Float(); | 163 | Float newfloat = new Float(); |
164 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; | 164 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; |
165 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 165 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | result = true; | 168 | result = true; |
169 | break; | 169 | break; |
170 | case (byte)OpCode.fload_1: | 170 | case (byte)OpCode.fload_1: |
171 | if (this.m_thread.m_currentFrame.LocalVariables[1] != null) | 171 | if (this.m_thread.m_currentFrame.LocalVariables[1] != null) |
172 | { | 172 | { |
173 | if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) | 173 | if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) |
174 | { | 174 | { |
175 | Float newfloat = new Float(); | 175 | Float newfloat = new Float(); |
176 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; | 176 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; |
177 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 177 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | result = true; | 180 | result = true; |
181 | break; | 181 | break; |
182 | case (byte)OpCode.fload_2: | 182 | case (byte)OpCode.fload_2: |
183 | if (this.m_thread.m_currentFrame.LocalVariables[2] != null) | 183 | if (this.m_thread.m_currentFrame.LocalVariables[2] != null) |
184 | { | 184 | { |
185 | if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) | 185 | if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) |
186 | { | 186 | { |
187 | Float newfloat = new Float(); | 187 | Float newfloat = new Float(); |
188 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue; | 188 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue; |
189 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 189 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | result = true; | 192 | result = true; |
193 | break; | 193 | break; |
194 | case (byte)OpCode.fload_3: | 194 | case (byte)OpCode.fload_3: |
195 | if (this.m_thread.m_currentFrame.LocalVariables[3] != null) | 195 | if (this.m_thread.m_currentFrame.LocalVariables[3] != null) |
196 | { | 196 | { |
197 | if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) | 197 | if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) |
198 | { | 198 | { |
199 | Float newfloat = new Float(); | 199 | Float newfloat = new Float(); |
200 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue; | 200 | newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue; |
201 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); | 201 | this.m_thread.m_currentFrame.OpStack.Push(newfloat); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | result = true; | 204 | result = true; |
205 | break; | 205 | break; |
206 | case (byte)OpCode.istore: | 206 | case (byte)OpCode.istore: |
207 | short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); | 207 | short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); |
208 | BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); | 208 | BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); |
209 | if (istor is Int) | 209 | if (istor is Int) |
210 | { | 210 | { |
211 | this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor; | 211 | this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor; |
212 | } | 212 | } |
213 | this.m_thread.PC++; | 213 | this.m_thread.PC++; |
214 | result = true; | 214 | result = true; |
215 | break; | 215 | break; |
216 | case (byte)OpCode.fstore: | 216 | case (byte)OpCode.fstore: |
217 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); | 217 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); |
218 | BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); | 218 | BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); |
219 | if (fstor is Float) | 219 | if (fstor is Float) |
220 | { | 220 | { |
221 | this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor; | 221 | this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor; |
222 | } | 222 | } |
223 | this.m_thread.PC++; | 223 | this.m_thread.PC++; |
224 | result = true; | 224 | result = true; |
225 | break; | 225 | break; |
226 | case (byte)OpCode.istore_0: | 226 | case (byte)OpCode.istore_0: |
227 | BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop(); | 227 | BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop(); |
228 | if (baset is Int) | 228 | if (baset is Int) |
229 | { | 229 | { |
230 | this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset; | 230 | this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset; |
231 | } | 231 | } |
232 | result = true; | 232 | result = true; |
233 | break; | 233 | break; |
234 | case (byte)OpCode.istore_1: | 234 | case (byte)OpCode.istore_1: |
235 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); | 235 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); |
236 | if (baset is Int) | 236 | if (baset is Int) |
237 | { | 237 | { |
238 | this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset; | 238 | this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset; |
239 | } | 239 | } |
240 | result = true; | 240 | result = true; |
241 | break; | 241 | break; |
242 | case (byte)OpCode.fstore_0: | 242 | case (byte)OpCode.fstore_0: |
243 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); | 243 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); |
244 | if (baset is Float) | 244 | if (baset is Float) |
245 | { | 245 | { |
246 | this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset; | 246 | this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset; |
247 | } | 247 | } |
248 | result = true; | 248 | result = true; |
249 | break; | 249 | break; |
250 | case (byte)OpCode.fstore_1: | 250 | case (byte)OpCode.fstore_1: |
251 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); | 251 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); |
252 | if (baset is Float) | 252 | if (baset is Float) |
253 | { | 253 | { |
254 | this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset; | 254 | this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset; |
255 | } | 255 | } |
256 | result = true; | 256 | result = true; |
257 | break; | 257 | break; |
258 | case (byte)OpCode.fstore_2: | 258 | case (byte)OpCode.fstore_2: |
259 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); | 259 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); |
260 | if (baset is Float) | 260 | if (baset is Float) |
261 | { | 261 | { |
262 | this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset; | 262 | this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset; |
263 | } | 263 | } |
264 | result = true; | 264 | result = true; |
265 | break; | 265 | break; |
266 | case (byte)OpCode.fstore_3: | 266 | case (byte)OpCode.fstore_3: |
267 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); | 267 | baset = this.m_thread.m_currentFrame.OpStack.Pop(); |
268 | if (baset is Float) | 268 | if (baset is Float) |
269 | { | 269 | { |
270 | this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset; | 270 | this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset; |
271 | } | 271 | } |
272 | result = true; | 272 | result = true; |
273 | break; | 273 | break; |
274 | case (byte)OpCode.pop: | 274 | case (byte)OpCode.pop: |
275 | this.m_thread.m_currentFrame.OpStack.Pop(); | 275 | this.m_thread.m_currentFrame.OpStack.Pop(); |
276 | result = true; | 276 | result = true; |
277 | break; | 277 | break; |
278 | case (byte)OpCode.fadd: | 278 | case (byte)OpCode.fadd: |
279 | BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 279 | BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop(); |
280 | BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 280 | BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
281 | if (bf1 is Float && bf2 is Float) | 281 | if (bf1 is Float && bf2 is Float) |
282 | { | 282 | { |
283 | Float nflt = new Float(); | 283 | Float nflt = new Float(); |
284 | nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; | 284 | nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; |
285 | this.m_thread.m_currentFrame.OpStack.Push(nflt); | 285 | this.m_thread.m_currentFrame.OpStack.Push(nflt); |
286 | } | 286 | } |
287 | result = true; | 287 | result = true; |
288 | break; | 288 | break; |
289 | case (byte)OpCode.fsub: | 289 | case (byte)OpCode.fsub: |
290 | BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 290 | BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop(); |
291 | BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 291 | BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
292 | if (bsf1 is Float && bsf2 is Float) | 292 | if (bsf1 is Float && bsf2 is Float) |
293 | { | 293 | { |
294 | Float resf = new Float(); | 294 | Float resf = new Float(); |
295 | resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; | 295 | resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; |
296 | this.m_thread.m_currentFrame.OpStack.Push(resf); | 296 | this.m_thread.m_currentFrame.OpStack.Push(resf); |
297 | } | 297 | } |
298 | result = true; | 298 | result = true; |
299 | break; | 299 | break; |
300 | case (byte)OpCode.imul: //check the order of the two values off the stack is correct | 300 | case (byte)OpCode.imul: //check the order of the two values off the stack is correct |
301 | BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 301 | BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop(); |
302 | BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 302 | BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
303 | if (bs1 is Int && bs2 is Int) | 303 | if (bs1 is Int && bs2 is Int) |
304 | { | 304 | { |
305 | Int nInt = new Int(); | 305 | Int nInt = new Int(); |
306 | nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; | 306 | nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; |
307 | this.m_thread.m_currentFrame.OpStack.Push(nInt); | 307 | this.m_thread.m_currentFrame.OpStack.Push(nInt); |
308 | } | 308 | } |
309 | result = true; | 309 | result = true; |
310 | break; | 310 | break; |
311 | case (byte)OpCode.iinc: | 311 | case (byte)OpCode.iinc: |
312 | if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null) | 312 | if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null) |
313 | { | 313 | { |
314 | if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) | 314 | if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) |
315 | { | 315 | { |
316 | ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]; | 316 | ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]; |
317 | } | 317 | } |
318 | } | 318 | } |
319 | this.m_thread.PC += 2; | 319 | this.m_thread.PC += 2; |
320 | result = true; | 320 | result = true; |
321 | break; | 321 | break; |
322 | case (byte)OpCode.f2i: | 322 | case (byte)OpCode.f2i: |
323 | BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 323 | BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
324 | if (conv1 is Float) | 324 | if (conv1 is Float) |
325 | { | 325 | { |
326 | Int newconv = new Int(); | 326 | Int newconv = new Int(); |
327 | newconv.mValue = (int)((Float)conv1).mValue; | 327 | newconv.mValue = (int)((Float)conv1).mValue; |
328 | this.m_thread.m_currentFrame.OpStack.Push(newconv); | 328 | this.m_thread.m_currentFrame.OpStack.Push(newconv); |
329 | } | 329 | } |
330 | result = true; | 330 | result = true; |
331 | break; | 331 | break; |
332 | case (byte)OpCode.fcmpl: | 332 | case (byte)OpCode.fcmpl: |
333 | BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 333 | BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); |
334 | BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 334 | BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
335 | if (flcom1 is Float && flcom2 is Float) | 335 | if (flcom1 is Float && flcom2 is Float) |
336 | { | 336 | { |
337 | Int compres = new Int(); | 337 | Int compres = new Int(); |
338 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | 338 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) |
339 | { | 339 | { |
340 | compres.mValue = -1; | 340 | compres.mValue = -1; |
341 | } | 341 | } |
342 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | 342 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) |
343 | { | 343 | { |
344 | compres.mValue = 1; | 344 | compres.mValue = 1; |
345 | } | 345 | } |
346 | else | 346 | else |
347 | { | 347 | { |
348 | compres.mValue = 0; | 348 | compres.mValue = 0; |
349 | } | 349 | } |
350 | this.m_thread.m_currentFrame.OpStack.Push(compres); | 350 | this.m_thread.m_currentFrame.OpStack.Push(compres); |
351 | } | 351 | } |
352 | result = true; | 352 | result = true; |
353 | break; | 353 | break; |
354 | case (byte)OpCode.fcmpg: | 354 | case (byte)OpCode.fcmpg: |
355 | flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 355 | flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); |
356 | flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 356 | flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
357 | if (flcom1 is Float && flcom2 is Float) | 357 | if (flcom1 is Float && flcom2 is Float) |
358 | { | 358 | { |
359 | Int compres = new Int(); | 359 | Int compres = new Int(); |
360 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | 360 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) |
361 | { | 361 | { |
362 | compres.mValue = -1; | 362 | compres.mValue = -1; |
363 | } | 363 | } |
364 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | 364 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) |
365 | { | 365 | { |
366 | compres.mValue = 1; | 366 | compres.mValue = 1; |
367 | } | 367 | } |
368 | else | 368 | else |
369 | { | 369 | { |
370 | compres.mValue = 0; | 370 | compres.mValue = 0; |
371 | } | 371 | } |
372 | this.m_thread.m_currentFrame.OpStack.Push(compres); | 372 | this.m_thread.m_currentFrame.OpStack.Push(compres); |
373 | } | 373 | } |
374 | result = true; | 374 | result = true; |
375 | break; | 375 | break; |
376 | case (byte)OpCode.ifge: | 376 | case (byte)OpCode.ifge: |
377 | short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 377 | short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
378 | BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 378 | BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
379 | if (compe1 is Int) | 379 | if (compe1 is Int) |
380 | { | 380 | { |
381 | if (((Int)compe1).mValue >= 0) | 381 | if (((Int)compe1).mValue >= 0) |
382 | { | 382 | { |
383 | this.m_thread.PC += -1 + compareoffset2; | 383 | this.m_thread.PC += -1 + compareoffset2; |
384 | } | 384 | } |
385 | else | 385 | else |
386 | { | 386 | { |
387 | this.m_thread.PC += 2; | 387 | this.m_thread.PC += 2; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | else | 390 | else |
391 | { | 391 | { |
392 | this.m_thread.PC += 2; | 392 | this.m_thread.PC += 2; |
393 | } | 393 | } |
394 | result = true; | 394 | result = true; |
395 | break; | 395 | break; |
396 | case (byte)OpCode.ifle: | 396 | case (byte)OpCode.ifle: |
397 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 397 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
398 | BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 398 | BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
399 | if (comp1 is Int) | 399 | if (comp1 is Int) |
400 | { | 400 | { |
401 | if (((Int)comp1).mValue <= 0) | 401 | if (((Int)comp1).mValue <= 0) |
402 | { | 402 | { |
403 | this.m_thread.PC += -1 + compareoffset1; | 403 | this.m_thread.PC += -1 + compareoffset1; |
404 | } | 404 | } |
405 | else | 405 | else |
406 | { | 406 | { |
407 | this.m_thread.PC += 2; | 407 | this.m_thread.PC += 2; |
408 | } | 408 | } |
409 | } | 409 | } |
410 | else | 410 | else |
411 | { | 411 | { |
412 | this.m_thread.PC += 2; | 412 | this.m_thread.PC += 2; |
413 | } | 413 | } |
414 | result = true; | 414 | result = true; |
415 | break; | 415 | break; |
416 | case (byte)OpCode.if_icmpge: | 416 | case (byte)OpCode.if_icmpge: |
417 | short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 417 | short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
418 | BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 418 | BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); |
419 | BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 419 | BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
420 | if (bc1 is Int && bc2 is Int) | 420 | if (bc1 is Int && bc2 is Int) |
421 | { | 421 | { |
422 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); | 422 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); |
423 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) | 423 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) |
424 | { | 424 | { |
425 | // Console.WriteLine("branch compare true , offset is " +compareoffset); | 425 | // Console.WriteLine("branch compare true , offset is " +compareoffset); |
426 | // Console.WriteLine("current PC is " + this._mThread.PC); | 426 | // Console.WriteLine("current PC is " + this._mThread.PC); |
427 | this.m_thread.PC += -1 + compareoffset; | 427 | this.m_thread.PC += -1 + compareoffset; |
428 | //Console.WriteLine("new PC is " + this._mThread.PC); | 428 | //Console.WriteLine("new PC is " + this._mThread.PC); |
429 | } | 429 | } |
430 | else | 430 | else |
431 | { | 431 | { |
432 | //Console.WriteLine("branch compare false"); | 432 | //Console.WriteLine("branch compare false"); |
433 | this.m_thread.PC += 2; | 433 | this.m_thread.PC += 2; |
434 | } | 434 | } |
435 | } | 435 | } |
436 | else | 436 | else |
437 | { | 437 | { |
438 | this.m_thread.PC += 2; | 438 | this.m_thread.PC += 2; |
439 | } | 439 | } |
440 | result = true; | 440 | result = true; |
441 | break; | 441 | break; |
442 | case (byte)OpCode.if_icmple: | 442 | case (byte)OpCode.if_icmple: |
443 | short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 443 | short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
444 | BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); | 444 | BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); |
445 | BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 445 | BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
446 | if (bcl1 is Int && bcl2 is Int) | 446 | if (bcl1 is Int && bcl2 is Int) |
447 | { | 447 | { |
448 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); | 448 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); |
449 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) | 449 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) |
450 | { | 450 | { |
451 | // Console.WriteLine("branch compare true , offset is " + compareloffset); | 451 | // Console.WriteLine("branch compare true , offset is " + compareloffset); |
452 | // Console.WriteLine("current PC is " + this._mThread.PC); | 452 | // Console.WriteLine("current PC is " + this._mThread.PC); |
453 | this.m_thread.PC += -1 + compareloffset; | 453 | this.m_thread.PC += -1 + compareloffset; |
454 | // Console.WriteLine("new PC is " + this._mThread.PC); | 454 | // Console.WriteLine("new PC is " + this._mThread.PC); |
455 | } | 455 | } |
456 | else | 456 | else |
457 | { | 457 | { |
458 | //Console.WriteLine("branch compare false"); | 458 | //Console.WriteLine("branch compare false"); |
459 | this.m_thread.PC += 2; | 459 | this.m_thread.PC += 2; |
460 | } | 460 | } |
461 | } | 461 | } |
462 | else | 462 | else |
463 | { | 463 | { |
464 | this.m_thread.PC += 2; | 464 | this.m_thread.PC += 2; |
465 | } | 465 | } |
466 | result = true; | 466 | result = true; |
467 | break; | 467 | break; |
468 | case (byte)OpCode._goto: | 468 | case (byte)OpCode._goto: |
469 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 469 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
470 | this.m_thread.PC += -1 + offset; | 470 | this.m_thread.PC += -1 + offset; |
471 | result = true; | 471 | result = true; |
472 | break; | 472 | break; |
473 | case (byte)OpCode.getstatic: | 473 | case (byte)OpCode.getstatic: |
474 | short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 474 | short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
475 | if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | 475 | if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) |
476 | { | 476 | { |
477 | if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) | 477 | if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) |
478 | { | 478 | { |
479 | //from this class | 479 | //from this class |
480 | if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | 480 | if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) |
481 | { | 481 | { |
482 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) | 482 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) |
483 | { | 483 | { |
484 | Float retFloat = new Float(); | 484 | Float retFloat = new Float(); |
485 | retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; | 485 | retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; |
486 | this.m_thread.m_currentFrame.OpStack.Push(retFloat); | 486 | this.m_thread.m_currentFrame.OpStack.Push(retFloat); |
487 | } | 487 | } |
488 | else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) | 488 | else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) |
489 | { | 489 | { |
490 | Int retInt = new Int(); | 490 | Int retInt = new Int(); |
491 | retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; | 491 | retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; |
492 | // Console.WriteLine("getting static field, " + retInt.mValue); | 492 | // Console.WriteLine("getting static field, " + retInt.mValue); |
493 | this.m_thread.m_currentFrame.OpStack.Push(retInt); | 493 | this.m_thread.m_currentFrame.OpStack.Push(retInt); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | } | 496 | } |
497 | else | 497 | else |
498 | { | 498 | { |
499 | //get from a different class | 499 | //get from a different class |
500 | } | 500 | } |
501 | } | 501 | } |
502 | this.m_thread.PC += 2; | 502 | this.m_thread.PC += 2; |
503 | result = true; | 503 | result = true; |
504 | break; | 504 | break; |
505 | case (byte)OpCode.putstatic: | 505 | case (byte)OpCode.putstatic: |
506 | fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); | 506 | fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); |
507 | BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); | 507 | BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); |
508 | if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | 508 | if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) |
509 | { | 509 | { |
510 | if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) | 510 | if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) |
511 | { | 511 | { |
512 | // this class | 512 | // this class |
513 | if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | 513 | if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) |
514 | { | 514 | { |
515 | if (addstatic is Float) | 515 | if (addstatic is Float) |
516 | { | 516 | { |
517 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) | 517 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) |
518 | { | 518 | { |
519 | Float newf = new Float(); | 519 | Float newf = new Float(); |
520 | newf.mValue = ((Float)addstatic).mValue; | 520 | newf.mValue = ((Float)addstatic).mValue; |
521 | this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; | 521 | this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; |
522 | } | 522 | } |
523 | } | 523 | } |
524 | else if (addstatic is Int) | 524 | else if (addstatic is Int) |
525 | { | 525 | { |
526 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) | 526 | if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) |
527 | { | 527 | { |
528 | //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); | 528 | //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); |
529 | Int newi = new Int(); | 529 | Int newi = new Int(); |
530 | newi.mValue = ((Int)addstatic).mValue; | 530 | newi.mValue = ((Int)addstatic).mValue; |
531 | this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; | 531 | this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; |
532 | } | 532 | } |
533 | } | 533 | } |
534 | } | 534 | } |
535 | } | 535 | } |
536 | else | 536 | else |
537 | { | 537 | { |
538 | // a different class | 538 | // a different class |
539 | } | 539 | } |
540 | } | 540 | } |
541 | this.m_thread.PC += 2; | 541 | this.m_thread.PC += 2; |
542 | result = true; | 542 | result = true; |
543 | break; | 543 | break; |
544 | 544 | ||
545 | } | 545 | } |
546 | 546 | ||
547 | return result; | 547 | return result; |
548 | } | 548 | } |
549 | } | 549 | } |
550 | } | 550 | } |
551 | } \ No newline at end of file | 551 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs index 42fd299..9ccf749 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs | |||
@@ -1,96 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 31 | using OpenSim.Framework.Interfaces; |
32 | using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Types; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
36 | 36 | ||
37 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 37 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
38 | { | 38 | { |
39 | partial class Thread | 39 | partial class Thread |
40 | { | 40 | { |
41 | private partial class Interpreter | 41 | private partial class Interpreter |
42 | { | 42 | { |
43 | private bool IsMethodOpCode(byte opcode) | 43 | private bool IsMethodOpCode(byte opcode) |
44 | { | 44 | { |
45 | bool result = false; | 45 | bool result = false; |
46 | switch (opcode) | 46 | switch (opcode) |
47 | { | 47 | { |
48 | case 184: | 48 | case 184: |
49 | short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); | 49 | short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); |
50 | if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | 50 | if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) |
51 | { | 51 | { |
52 | string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; | 52 | string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; |
53 | string typeparam = ""; | 53 | string typeparam = ""; |
54 | string typereturn = ""; | 54 | string typereturn = ""; |
55 | int firstbrak = 0; | 55 | int firstbrak = 0; |
56 | int secondbrak = 0; | 56 | int secondbrak = 0; |
57 | firstbrak = typ.LastIndexOf('('); | 57 | firstbrak = typ.LastIndexOf('('); |
58 | secondbrak = typ.LastIndexOf(')'); | 58 | secondbrak = typ.LastIndexOf(')'); |
59 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); | 59 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); |
60 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); | 60 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); |
61 | if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) | 61 | if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) |
62 | { | 62 | { |
63 | //calling a method in this class | 63 | //calling a method in this class |
64 | if (typeparam.Length == 0) | 64 | if (typeparam.Length == 0) |
65 | { | 65 | { |
66 | this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); | 66 | this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); |
67 | } | 67 | } |
68 | else | 68 | else |
69 | { | 69 | { |
70 | this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); | 70 | this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | else | 73 | else |
74 | { | 74 | { |
75 | //calling a method of a different class | 75 | //calling a method of a different class |
76 | 76 | ||
77 | // OpenSimAPI Class | 77 | // OpenSimAPI Class |
78 | if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") | 78 | if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") |
79 | { | 79 | { |
80 | this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); | 80 | this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | } | 83 | } |
84 | else | 84 | else |
85 | { | 85 | { |
86 | this.m_thread.PC += 2; | 86 | this.m_thread.PC += 2; |
87 | } | 87 | } |
88 | result = true; | 88 | result = true; |
89 | break; | 89 | break; |
90 | } | 90 | } |
91 | 91 | ||
92 | return result; | 92 | return result; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs index 3c18a11..f6fc226 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs | |||
@@ -1,40 +1,40 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 33 | { |
34 | partial class Thread | 34 | partial class Thread |
35 | { | 35 | { |
36 | private partial class Interpreter | 36 | private partial class Interpreter |
37 | { | 37 | { |
38 | } | 38 | } |
39 | } | 39 | } |
40 | } | 40 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs index e718328..efc8ac3 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Interpreter.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs | |||
@@ -1,135 +1,135 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | 33 | ||
34 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
35 | { | 35 | { |
36 | partial class Thread | 36 | partial class Thread |
37 | { | 37 | { |
38 | private partial class Interpreter | 38 | private partial class Interpreter |
39 | { | 39 | { |
40 | private Thread m_thread; | 40 | private Thread m_thread; |
41 | 41 | ||
42 | public Interpreter(Thread parentThread) | 42 | public Interpreter(Thread parentThread) |
43 | { | 43 | { |
44 | m_thread = parentThread; | 44 | m_thread = parentThread; |
45 | } | 45 | } |
46 | 46 | ||
47 | public bool Excute() | 47 | public bool Excute() |
48 | { | 48 | { |
49 | bool run = true; | 49 | bool run = true; |
50 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; | 50 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; |
51 | // Console.WriteLine("opCode is: " + currentOpCode); | 51 | // Console.WriteLine("opCode is: " + currentOpCode); |
52 | bool handled = false; | 52 | bool handled = false; |
53 | 53 | ||
54 | handled = this.IsLogicOpCode(currentOpCode); | 54 | handled = this.IsLogicOpCode(currentOpCode); |
55 | if (!handled) | 55 | if (!handled) |
56 | { | 56 | { |
57 | handled = this.IsMethodOpCode(currentOpCode); | 57 | handled = this.IsMethodOpCode(currentOpCode); |
58 | } | 58 | } |
59 | if (!handled) | 59 | if (!handled) |
60 | { | 60 | { |
61 | if (currentOpCode == 172) | 61 | if (currentOpCode == 172) |
62 | { | 62 | { |
63 | if (this.m_thread.stack.StackFrames.Count > 1) | 63 | if (this.m_thread.stack.StackFrames.Count > 1) |
64 | { | 64 | { |
65 | Console.WriteLine("returning int from function"); | 65 | Console.WriteLine("returning int from function"); |
66 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; | 66 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; |
67 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 67 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
68 | this.m_thread.stack.StackFrames.Pop(); | 68 | this.m_thread.stack.StackFrames.Pop(); |
69 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 69 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); |
70 | this.m_thread.PC = retPC1; | 70 | this.m_thread.PC = retPC1; |
71 | if (bas1 is Int) | 71 | if (bas1 is Int) |
72 | { | 72 | { |
73 | this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); | 73 | this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | else | 76 | else |
77 | { | 77 | { |
78 | // Console.WriteLine("No parent function so ending program"); | 78 | // Console.WriteLine("No parent function so ending program"); |
79 | this.m_thread.stack.StackFrames.Pop(); | 79 | this.m_thread.stack.StackFrames.Pop(); |
80 | run = false; | 80 | run = false; |
81 | } | 81 | } |
82 | handled = true; | 82 | handled = true; |
83 | } | 83 | } |
84 | if (currentOpCode == 174) | 84 | if (currentOpCode == 174) |
85 | { | 85 | { |
86 | if (this.m_thread.stack.StackFrames.Count > 1) | 86 | if (this.m_thread.stack.StackFrames.Count > 1) |
87 | { | 87 | { |
88 | Console.WriteLine("returning float from function"); | 88 | Console.WriteLine("returning float from function"); |
89 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; | 89 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; |
90 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 90 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); |
91 | this.m_thread.stack.StackFrames.Pop(); | 91 | this.m_thread.stack.StackFrames.Pop(); |
92 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 92 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); |
93 | this.m_thread.PC = retPC1; | 93 | this.m_thread.PC = retPC1; |
94 | if (bas1 is Float) | 94 | if (bas1 is Float) |
95 | { | 95 | { |
96 | this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); | 96 | this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | // Console.WriteLine("No parent function so ending program"); | 101 | // Console.WriteLine("No parent function so ending program"); |
102 | this.m_thread.stack.StackFrames.Pop(); | 102 | this.m_thread.stack.StackFrames.Pop(); |
103 | run = false; | 103 | run = false; |
104 | } | 104 | } |
105 | handled = true; | 105 | handled = true; |
106 | } | 106 | } |
107 | if (currentOpCode == 177) | 107 | if (currentOpCode == 177) |
108 | { | 108 | { |
109 | if (this.m_thread.stack.StackFrames.Count > 1) | 109 | if (this.m_thread.stack.StackFrames.Count > 1) |
110 | { | 110 | { |
111 | Console.WriteLine("returning from function"); | 111 | Console.WriteLine("returning from function"); |
112 | int retPC = this.m_thread.m_currentFrame.ReturnPC; | 112 | int retPC = this.m_thread.m_currentFrame.ReturnPC; |
113 | this.m_thread.stack.StackFrames.Pop(); | 113 | this.m_thread.stack.StackFrames.Pop(); |
114 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 114 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); |
115 | this.m_thread.PC = retPC; | 115 | this.m_thread.PC = retPC; |
116 | } | 116 | } |
117 | else | 117 | else |
118 | { | 118 | { |
119 | // Console.WriteLine("No parent function so ending program"); | 119 | // Console.WriteLine("No parent function so ending program"); |
120 | this.m_thread.stack.StackFrames.Pop(); | 120 | this.m_thread.stack.StackFrames.Pop(); |
121 | run = false; | 121 | run = false; |
122 | } | 122 | } |
123 | handled = true; | 123 | handled = true; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | if (!handled) | 126 | if (!handled) |
127 | { | 127 | { |
128 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); | 128 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); |
129 | } | 129 | } |
130 | return run; | 130 | return run; |
131 | 131 | ||
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs index 7174975..3599dba 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/MainMemory.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs | |||
@@ -1,45 +1,45 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 33 | { |
34 | public class MainMemory | 34 | public class MainMemory |
35 | { | 35 | { |
36 | public Heap HeapArea; | 36 | public Heap HeapArea; |
37 | public MethodMemory MethodArea; | 37 | public MethodMemory MethodArea; |
38 | 38 | ||
39 | public MainMemory() | 39 | public MainMemory() |
40 | { | 40 | { |
41 | MethodArea = new MethodMemory(); | 41 | MethodArea = new MethodMemory(); |
42 | HeapArea = new Heap(); | 42 | HeapArea = new Heap(); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | 45 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs index 5f29091..e32be8f 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/MethodMemory.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs | |||
@@ -1,46 +1,46 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 33 | { |
34 | public class MethodMemory | 34 | public class MethodMemory |
35 | { | 35 | { |
36 | public byte[] MethodBuffer; | 36 | public byte[] MethodBuffer; |
37 | public List<ClassRecord> Classes = new List<ClassRecord>(); | 37 | public List<ClassRecord> Classes = new List<ClassRecord>(); |
38 | public int NextMethodPC = 0; | 38 | public int NextMethodPC = 0; |
39 | public int Methodcount = 0; | 39 | public int Methodcount = 0; |
40 | 40 | ||
41 | public MethodMemory() | 41 | public MethodMemory() |
42 | { | 42 | { |
43 | MethodBuffer = new byte[20000]; | 43 | MethodBuffer = new byte[20000]; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs index 8acb2bd..3d43808 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Object.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs | |||
@@ -1,37 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 33 | { |
34 | public class Object | 34 | public class Object |
35 | { | 35 | { |
36 | } | 36 | } |
37 | } | 37 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs index 22a9f12..c6ac987 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/OpCodes.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs | |||
@@ -1,56 +1,56 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
6 | { | 6 | { |
7 | public enum OpCode : byte | 7 | public enum OpCode : byte |
8 | { | 8 | { |
9 | iconst_m1 = 2, | 9 | iconst_m1 = 2, |
10 | iconst_0 = 3, | 10 | iconst_0 = 3, |
11 | iconst_1 = 4, | 11 | iconst_1 = 4, |
12 | iconst_2 = 5, | 12 | iconst_2 = 5, |
13 | iconst_3 = 6, | 13 | iconst_3 = 6, |
14 | iconst_4 = 7, | 14 | iconst_4 = 7, |
15 | iconst_5 = 8, | 15 | iconst_5 = 8, |
16 | fconst_0 = 11, | 16 | fconst_0 = 11, |
17 | fconst_1 = 12, | 17 | fconst_1 = 12, |
18 | fconst_2 = 13, | 18 | fconst_2 = 13, |
19 | bipush = 16, | 19 | bipush = 16, |
20 | sipush = 17, | 20 | sipush = 17, |
21 | fload = 23, | 21 | fload = 23, |
22 | iload_0 = 26, | 22 | iload_0 = 26, |
23 | iload_1 = 27, | 23 | iload_1 = 27, |
24 | fload_0 = 34, | 24 | fload_0 = 34, |
25 | fload_1 = 35, | 25 | fload_1 = 35, |
26 | fload_2 = 36, | 26 | fload_2 = 36, |
27 | fload_3 = 37, | 27 | fload_3 = 37, |
28 | istore = 54, | 28 | istore = 54, |
29 | fstore = 56, | 29 | fstore = 56, |
30 | istore_0 = 59, | 30 | istore_0 = 59, |
31 | istore_1 = 60, | 31 | istore_1 = 60, |
32 | istore_2 = 61, | 32 | istore_2 = 61, |
33 | istore_3 = 62, | 33 | istore_3 = 62, |
34 | fstore_0 = 67, | 34 | fstore_0 = 67, |
35 | fstore_1 = 68, | 35 | fstore_1 = 68, |
36 | fstore_2 = 69, | 36 | fstore_2 = 69, |
37 | fstore_3 = 70, | 37 | fstore_3 = 70, |
38 | pop = 87, | 38 | pop = 87, |
39 | fadd = 98, | 39 | fadd = 98, |
40 | fsub = 102, | 40 | fsub = 102, |
41 | imul = 104, | 41 | imul = 104, |
42 | iinc = 132, | 42 | iinc = 132, |
43 | f2i = 139, | 43 | f2i = 139, |
44 | fcmpl = 149, | 44 | fcmpl = 149, |
45 | fcmpg = 150, | 45 | fcmpg = 150, |
46 | ifge = 156, | 46 | ifge = 156, |
47 | ifgt = 157, | 47 | ifgt = 157, |
48 | ifle = 158, | 48 | ifle = 158, |
49 | if_icmpge = 162, | 49 | if_icmpge = 162, |
50 | if_icmpgt = 163, | 50 | if_icmpgt = 163, |
51 | if_icmple = 164, | 51 | if_icmple = 164, |
52 | _goto = 167, | 52 | _goto = 167, |
53 | getstatic = 178, | 53 | getstatic = 178, |
54 | putstatic = 179 | 54 | putstatic = 179 |
55 | } | 55 | } |
56 | } | 56 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs index 7c12678..f665743 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Stack.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs | |||
@@ -1,42 +1,42 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 33 | { |
34 | public class Stack | 34 | public class Stack |
35 | { | 35 | { |
36 | public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); | 36 | public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); |
37 | 37 | ||
38 | public Stack() | 38 | public Stack() |
39 | { | 39 | { |
40 | } | 40 | } |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs index 76257b8..bbb3770 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/StackFrame.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs | |||
@@ -1,49 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 32 | ||
33 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
34 | { | 34 | { |
35 | public class StackFrame | 35 | public class StackFrame |
36 | { | 36 | { |
37 | public BaseType[] LocalVariables; | 37 | public BaseType[] LocalVariables; |
38 | public Stack<BaseType> OpStack = new Stack<BaseType>(); | 38 | public Stack<BaseType> OpStack = new Stack<BaseType>(); |
39 | 39 | ||
40 | public int ReturnPC = 0; | 40 | public int ReturnPC = 0; |
41 | public ClassRecord CallingClass = null; | 41 | public ClassRecord CallingClass = null; |
42 | 42 | ||
43 | public StackFrame() | 43 | public StackFrame() |
44 | { | 44 | { |
45 | LocalVariables = new BaseType[20]; | 45 | LocalVariables = new BaseType[20]; |
46 | } | 46 | } |
47 | 47 | ||
48 | } | 48 | } |
49 | } | 49 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs index aad1f47..f944c52 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JVM/Thread.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs | |||
@@ -1,119 +1,119 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
36 | using OpenSim.Region.Scripting; | 36 | using OpenSim.Region.ExtensionsScriptModule; |
37 | 37 | ||
38 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 38 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
39 | { | 39 | { |
40 | public partial class Thread | 40 | public partial class Thread |
41 | { | 41 | { |
42 | // Is this smart? | 42 | // Is this smart? |
43 | public static MainMemory GlobalMemory; | 43 | public static MainMemory GlobalMemory; |
44 | public static Scene World; | 44 | public static Scene World; |
45 | private int PC = 0; | 45 | private int PC = 0; |
46 | private Stack stack; | 46 | private Stack stack; |
47 | private Interpreter m_Interpreter; | 47 | private Interpreter m_Interpreter; |
48 | public ClassRecord currentClass; | 48 | public ClassRecord currentClass; |
49 | public ClassInstance currentInstance; | 49 | public ClassInstance currentInstance; |
50 | private StackFrame m_currentFrame; | 50 | private StackFrame m_currentFrame; |
51 | public int excutionCounter = 0; | 51 | public int excutionCounter = 0; |
52 | public bool running = false; | 52 | public bool running = false; |
53 | 53 | ||
54 | public ScriptInfo scriptInfo; | 54 | public ScriptInfo scriptInfo; |
55 | 55 | ||
56 | public Thread() | 56 | public Thread() |
57 | { | 57 | { |
58 | this.m_Interpreter = new Interpreter(this); | 58 | this.m_Interpreter = new Interpreter(this); |
59 | this.stack = new Stack(); | 59 | this.stack = new Stack(); |
60 | } | 60 | } |
61 | 61 | ||
62 | public void SetPC(int methodpointer) | 62 | public void SetPC(int methodpointer) |
63 | { | 63 | { |
64 | //Console.WriteLine("Thread PC has been set to " + methodpointer); | 64 | //Console.WriteLine("Thread PC has been set to " + methodpointer); |
65 | PC = methodpointer; | 65 | PC = methodpointer; |
66 | } | 66 | } |
67 | 67 | ||
68 | public void StartMethod(ClassRecord rec, string methName) | 68 | public void StartMethod(ClassRecord rec, string methName) |
69 | { | 69 | { |
70 | m_currentFrame = new StackFrame(); | 70 | m_currentFrame = new StackFrame(); |
71 | this.stack.StackFrames.Push(m_currentFrame); | 71 | this.stack.StackFrames.Push(m_currentFrame); |
72 | this.currentClass = rec; | 72 | this.currentClass = rec; |
73 | currentClass.StartMethod(this, methName); | 73 | currentClass.StartMethod(this, methName); |
74 | } | 74 | } |
75 | 75 | ||
76 | public void StartMethod( string methName) | 76 | public void StartMethod( string methName) |
77 | { | 77 | { |
78 | m_currentFrame = new StackFrame(); | 78 | m_currentFrame = new StackFrame(); |
79 | this.stack.StackFrames.Push(m_currentFrame); | 79 | this.stack.StackFrames.Push(m_currentFrame); |
80 | currentClass.StartMethod(this, methName); | 80 | currentClass.StartMethod(this, methName); |
81 | } | 81 | } |
82 | 82 | ||
83 | public void JumpToStaticVoidMethod(string methName, int returnPC) | 83 | public void JumpToStaticVoidMethod(string methName, int returnPC) |
84 | { | 84 | { |
85 | m_currentFrame = new StackFrame(); | 85 | m_currentFrame = new StackFrame(); |
86 | m_currentFrame.ReturnPC = returnPC; | 86 | m_currentFrame.ReturnPC = returnPC; |
87 | this.stack.StackFrames.Push(m_currentFrame); | 87 | this.stack.StackFrames.Push(m_currentFrame); |
88 | currentClass.StartMethod(this, methName); | 88 | currentClass.StartMethod(this, methName); |
89 | } | 89 | } |
90 | 90 | ||
91 | public void JumpToStaticParamMethod(string methName, string param, int returnPC) | 91 | public void JumpToStaticParamMethod(string methName, string param, int returnPC) |
92 | { | 92 | { |
93 | if (param == "I") | 93 | if (param == "I") |
94 | { | 94 | { |
95 | BaseType bs1 = m_currentFrame.OpStack.Pop(); | 95 | BaseType bs1 = m_currentFrame.OpStack.Pop(); |
96 | m_currentFrame = new StackFrame(); | 96 | m_currentFrame = new StackFrame(); |
97 | m_currentFrame.ReturnPC = returnPC; | 97 | m_currentFrame.ReturnPC = returnPC; |
98 | this.stack.StackFrames.Push(m_currentFrame); | 98 | this.stack.StackFrames.Push(m_currentFrame); |
99 | m_currentFrame.LocalVariables[0] = ((Int)bs1); | 99 | m_currentFrame.LocalVariables[0] = ((Int)bs1); |
100 | currentClass.StartMethod(this, methName); | 100 | currentClass.StartMethod(this, methName); |
101 | } | 101 | } |
102 | if (param == "F") | 102 | if (param == "F") |
103 | { | 103 | { |
104 | 104 | ||
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) | 108 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) |
109 | { | 109 | { |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | public bool Excute() | 113 | public bool Excute() |
114 | { | 114 | { |
115 | excutionCounter++; | 115 | excutionCounter++; |
116 | return this.m_Interpreter.Excute(); | 116 | return this.m_Interpreter.Excute(); |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs index 58cdf49..28b9b33 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/JavaEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs | |||
@@ -1,29 +1,28 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | using OpenSim.Region.Scripting; | 5 | using OpenSim.Region.ExtensionsScriptModule; |
6 | using OpenSim.Region.Scripting.EmbeddedJVM; | 6 | |
7 | 7 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |
8 | namespace OpenSim.Region.Scripting | 8 | { |
9 | { | 9 | public class JavaEngine : IScriptCompiler |
10 | public class JavaEngine : IScriptCompiler | 10 | { |
11 | { | 11 | public string FileExt() |
12 | public string FileExt() | 12 | { |
13 | { | 13 | return ".java"; |
14 | return ".java"; | 14 | } |
15 | } | 15 | |
16 | 16 | public Dictionary<string, IScript> compile(string filename) | |
17 | public Dictionary<string, IScript> compile(string filename) | 17 | { |
18 | { | 18 | JVMScript script = new JVMScript(); |
19 | JVMScript script = new JVMScript(); | 19 | Dictionary<string, IScript> returns = new Dictionary<string, IScript>(); |
20 | Dictionary<string, IScript> returns = new Dictionary<string, IScript>(); | 20 | |
21 | 21 | script.LoadScript(filename); | |
22 | script.LoadScript(filename); | 22 | |
23 | 23 | returns.Add(filename, script); | |
24 | returns.Add(filename, script); | 24 | |
25 | 25 | return returns; | |
26 | return returns; | 26 | } |
27 | } | 27 | } |
28 | } | 28 | } |
29 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs index 9fb76d4..f60d555 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/OpenSimJVM.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs | |||
@@ -1,170 +1,171 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | using OpenSim.Region.Scripting; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; |
38 | 38 | using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; | |
39 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 39 | |
40 | { | 40 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine |
41 | public class JVMScript : IScript | 41 | { |
42 | { | 42 | public class JVMScript : IScript |
43 | private List<Thread> _threads = new List<Thread>(); | 43 | { |
44 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); | 44 | private List<Thread> _threads = new List<Thread>(); |
45 | private MainMemory _mainMemory; | 45 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); |
46 | 46 | private MainMemory _mainMemory; | |
47 | ScriptInfo scriptInfo; | 47 | |
48 | 48 | ScriptInfo scriptInfo; | |
49 | public void Initialise(ScriptInfo info) | 49 | |
50 | { | 50 | public void Initialise(ScriptInfo info) |
51 | scriptInfo = info; | 51 | { |
52 | 52 | scriptInfo = info; | |
53 | _mainMemory = new MainMemory(); | 53 | |
54 | Thread.GlobalMemory = this._mainMemory; | 54 | _mainMemory = new MainMemory(); |
55 | Thread.World = info.world; | 55 | Thread.GlobalMemory = this._mainMemory; |
56 | CompileScript(); | 56 | Thread.World = info.world; |
57 | 57 | CompileScript(); | |
58 | scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); | 58 | |
59 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); | 59 | scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); |
60 | } | 60 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); |
61 | 61 | } | |
62 | void events_OnNewPresence(ScenePresence presence) | 62 | |
63 | { | 63 | void events_OnNewPresence(ScenePresence presence) |
64 | for (int i = 0; i < this._threads.Count; i++) | 64 | { |
65 | { | 65 | for (int i = 0; i < this._threads.Count; i++) |
66 | if (!this._threads[i].running) | 66 | { |
67 | { | 67 | if (!this._threads[i].running) |
68 | this._threads[i].StartMethod("OnNewPresence"); | 68 | { |
69 | bool run = true; | 69 | this._threads[i].StartMethod("OnNewPresence"); |
70 | while (run) | 70 | bool run = true; |
71 | { | 71 | while (run) |
72 | run = this._threads[i].Excute(); | 72 | { |
73 | } | 73 | run = this._threads[i].Excute(); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | } | |
78 | void events_OnFrame() | 78 | |
79 | { | 79 | void events_OnFrame() |
80 | for (int i = 0; i < this._threads.Count; i++) | 80 | { |
81 | { | 81 | for (int i = 0; i < this._threads.Count; i++) |
82 | if (!this._threads[i].running) | 82 | { |
83 | { | 83 | if (!this._threads[i].running) |
84 | this._threads[i].StartMethod("OnFrame"); | 84 | { |
85 | bool run = true; | 85 | this._threads[i].StartMethod("OnFrame"); |
86 | while (run) | 86 | bool run = true; |
87 | { | 87 | while (run) |
88 | run = this._threads[i].Excute(); | 88 | { |
89 | } | 89 | run = this._threads[i].Excute(); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | } | |
94 | public string Name | 94 | |
95 | { | 95 | public string Name |
96 | get { return "JVM Scripting Engine"; } | 96 | { |
97 | } | 97 | get { return "JVM Scripting Engine"; } |
98 | 98 | } | |
99 | public void LoadScript(string script) | 99 | |
100 | { | 100 | public void LoadScript(string script) |
101 | Console.WriteLine("OpenSimJVM - loading new script: " + script); | 101 | { |
102 | CompileInfo comp = new CompileInfo(); | 102 | Console.WriteLine("OpenSimJVM - loading new script: " + script); |
103 | comp.script = script; | 103 | CompileInfo comp = new CompileInfo(); |
104 | comp.scriptName = script; | 104 | comp.script = script; |
105 | this.CompileScripts.Enqueue(comp); | 105 | comp.scriptName = script; |
106 | } | 106 | this.CompileScripts.Enqueue(comp); |
107 | 107 | } | |
108 | public void CompileScript() | 108 | |
109 | { | 109 | public void CompileScript() |
110 | CompileInfo comp = this.CompileScripts.Dequeue(); | 110 | { |
111 | string script = comp.script; | 111 | CompileInfo comp = this.CompileScripts.Dequeue(); |
112 | string scriptName = comp.scriptName; | 112 | string script = comp.script; |
113 | try | 113 | string scriptName = comp.scriptName; |
114 | { | 114 | try |
115 | //need to compile the script into a java class file | 115 | { |
116 | 116 | //need to compile the script into a java class file | |
117 | //first save it to a java source file | 117 | |
118 | TextWriter tw = new StreamWriter(scriptName + ".java"); | 118 | //first save it to a java source file |
119 | tw.WriteLine(script); | 119 | TextWriter tw = new StreamWriter(scriptName + ".java"); |
120 | tw.Close(); | 120 | tw.WriteLine(script); |
121 | 121 | tw.Close(); | |
122 | //now compile | 122 | |
123 | System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); | 123 | //now compile |
124 | // psi.RedirectStandardOutput = true; | 124 | System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); |
125 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | 125 | // psi.RedirectStandardOutput = true; |
126 | psi.UseShellExecute = false; | 126 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; |
127 | 127 | psi.UseShellExecute = false; | |
128 | System.Diagnostics.Process javacomp; | 128 | |
129 | javacomp = System.Diagnostics.Process.Start(psi); | 129 | System.Diagnostics.Process javacomp; |
130 | javacomp.WaitForExit(); | 130 | javacomp = System.Diagnostics.Process.Start(psi); |
131 | 131 | javacomp.WaitForExit(); | |
132 | 132 | ||
133 | //now load in class file | 133 | |
134 | ClassRecord class1 = new ClassRecord(); | 134 | //now load in class file |
135 | class1.LoadClassFromFile(scriptName + ".class"); | 135 | ClassRecord class1 = new ClassRecord(); |
136 | class1.PrintToConsole(); | 136 | class1.LoadClassFromFile(scriptName + ".class"); |
137 | //Console.WriteLine(); | 137 | class1.PrintToConsole(); |
138 | this._mainMemory.MethodArea.Classes.Add(class1); | 138 | //Console.WriteLine(); |
139 | class1.AddMethodsToMemory(this._mainMemory.MethodArea); | 139 | this._mainMemory.MethodArea.Classes.Add(class1); |
140 | 140 | class1.AddMethodsToMemory(this._mainMemory.MethodArea); | |
141 | Thread newThread = new Thread(); | 141 | |
142 | this._threads.Add(newThread); | 142 | Thread newThread = new Thread(); |
143 | newThread.currentClass = class1; | 143 | this._threads.Add(newThread); |
144 | newThread.scriptInfo = scriptInfo; | 144 | newThread.currentClass = class1; |
145 | 145 | newThread.scriptInfo = scriptInfo; | |
146 | //now delete the created files | 146 | |
147 | System.IO.File.Delete(scriptName + ".java"); | 147 | //now delete the created files |
148 | System.IO.File.Delete(scriptName + ".class"); | 148 | System.IO.File.Delete(scriptName + ".java"); |
149 | //this.OnFrame(); | 149 | System.IO.File.Delete(scriptName + ".class"); |
150 | } | 150 | //this.OnFrame(); |
151 | catch (Exception e) | 151 | } |
152 | { | 152 | catch (Exception e) |
153 | Console.WriteLine("exception"); | 153 | { |
154 | Console.WriteLine(e.StackTrace); | 154 | Console.WriteLine("exception"); |
155 | Console.WriteLine(e.Message); | 155 | Console.WriteLine(e.StackTrace); |
156 | } | 156 | Console.WriteLine(e.Message); |
157 | } | 157 | } |
158 | 158 | } | |
159 | private class CompileInfo | 159 | |
160 | { | 160 | private class CompileInfo |
161 | public string script; | 161 | { |
162 | public string scriptName; | 162 | public string script; |
163 | 163 | public string scriptName; | |
164 | public CompileInfo() | 164 | |
165 | { | 165 | public CompileInfo() |
166 | 166 | { | |
167 | } | 167 | |
168 | } | 168 | } |
169 | } | 169 | } |
170 | } | 170 | } |
171 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs index 0c4d623..97753cf 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/ArrayReference.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs | |||
@@ -1,10 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM.Types | 5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types |
6 | { | 6 | { |
7 | public class ArrayReference :BaseType | 7 | public class ArrayReference :BaseType |
8 | { | 8 | { |
9 | } | 9 | } |
10 | } | 10 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/BaseType.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs index 7fc0a4f..d1689df 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/BaseType.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/BaseType.cs | |||
@@ -1,10 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM.Types | 5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types |
6 | { | 6 | { |
7 | public class BaseType : Object | 7 | public class BaseType : Object |
8 | { | 8 | { |
9 | } | 9 | } |
10 | } | 10 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs index 7718765..8e1d435 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/ObjectReference.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs | |||
@@ -1,16 +1,16 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM.Types | 5 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types |
6 | { | 6 | { |
7 | public class ObjectReference : BaseType | 7 | public class ObjectReference : BaseType |
8 | { | 8 | { |
9 | public ushort Reference; | 9 | public ushort Reference; |
10 | 10 | ||
11 | public ObjectReference() | 11 | public ObjectReference() |
12 | { | 12 | { |
13 | 13 | ||
14 | } | 14 | } |
15 | } | 15 | } |
16 | } | 16 | } |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs new file mode 100644 index 0000000..cfbbd19 --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs | |||
@@ -0,0 +1,11 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
5 | |||
6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | ||
7 | { | ||
8 | public class Byte : BaseType | ||
9 | { | ||
10 | } | ||
11 | } | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs new file mode 100644 index 0000000..650e1ed --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs | |||
@@ -0,0 +1,11 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
5 | |||
6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | ||
7 | { | ||
8 | public class Char : BaseType | ||
9 | { | ||
10 | } | ||
11 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs index 982e748..b5bcc64 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs | |||
@@ -1,16 +1,17 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | |
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes | 5 | |
6 | { | 6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
7 | public class Float : BaseType | 7 | { |
8 | { | 8 | public class Float : BaseType |
9 | public float mValue = 0; | 9 | { |
10 | 10 | public float mValue = 0; | |
11 | public Float() | 11 | |
12 | { | 12 | public Float() |
13 | 13 | { | |
14 | } | 14 | |
15 | } | 15 | } |
16 | } | 16 | } |
17 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs index 073a9b3..df133af 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs | |||
@@ -1,16 +1,17 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | |
5 | namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes | 5 | |
6 | { | 6 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
7 | public class Int : BaseType | 7 | { |
8 | { | 8 | public class Int : BaseType |
9 | public int mValue = 0; | 9 | { |
10 | 10 | public int mValue = 0; | |
11 | public Int() | 11 | |
12 | { | 12 | public Int() |
13 | 13 | { | |
14 | } | 14 | |
15 | } | 15 | } |
16 | } | 16 | } |
17 | } | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj new file mode 100644 index 0000000..51ce2ad --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj | |||
@@ -0,0 +1,213 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{DD34045D-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon> | ||
10 | </ApplicationIcon> | ||
11 | <AssemblyKeyContainerName> | ||
12 | </AssemblyKeyContainerName> | ||
13 | <AssemblyName>OpenSim.Region.ExtensionScriptEngine</AssemblyName> | ||
14 | <DefaultClientScript>JScript</DefaultClientScript> | ||
15 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
17 | <DelaySign>false</DelaySign> | ||
18 | <OutputType>Library</OutputType> | ||
19 | <AppDesignerFolder> | ||
20 | </AppDesignerFolder> | ||
21 | <RootNamespace>OpenSim.Region.ExtensionScriptEngine</RootNamespace> | ||
22 | <StartupObject> | ||
23 | </StartupObject> | ||
24 | <FileUpgradeFlags> | ||
25 | </FileUpgradeFlags> | ||
26 | </PropertyGroup> | ||
27 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
28 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
29 | <BaseAddress>285212672</BaseAddress> | ||
30 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
31 | <ConfigurationOverrideFile> | ||
32 | </ConfigurationOverrideFile> | ||
33 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
34 | <DocumentationFile> | ||
35 | </DocumentationFile> | ||
36 | <DebugSymbols>True</DebugSymbols> | ||
37 | <FileAlignment>4096</FileAlignment> | ||
38 | <Optimize>False</Optimize> | ||
39 | <OutputPath>..\..\..\bin\</OutputPath> | ||
40 | <RegisterForComInterop>False</RegisterForComInterop> | ||
41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
43 | <WarningLevel>4</WarningLevel> | ||
44 | <NoWarn> | ||
45 | </NoWarn> | ||
46 | </PropertyGroup> | ||
47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
49 | <BaseAddress>285212672</BaseAddress> | ||
50 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
51 | <ConfigurationOverrideFile> | ||
52 | </ConfigurationOverrideFile> | ||
53 | <DefineConstants>TRACE</DefineConstants> | ||
54 | <DocumentationFile> | ||
55 | </DocumentationFile> | ||
56 | <DebugSymbols>False</DebugSymbols> | ||
57 | <FileAlignment>4096</FileAlignment> | ||
58 | <Optimize>True</Optimize> | ||
59 | <OutputPath>..\..\..\bin\</OutputPath> | ||
60 | <RegisterForComInterop>False</RegisterForComInterop> | ||
61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
63 | <WarningLevel>4</WarningLevel> | ||
64 | <NoWarn> | ||
65 | </NoWarn> | ||
66 | </PropertyGroup> | ||
67 | <ItemGroup> | ||
68 | <Reference Include="libsecondlife.dll"> | ||
69 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
70 | <Private>False</Private> | ||
71 | </Reference> | ||
72 | <Reference Include="Microsoft.JScript"> | ||
73 | <HintPath>Microsoft.JScript.dll</HintPath> | ||
74 | <Private>False</Private> | ||
75 | </Reference> | ||
76 | <Reference Include="System"> | ||
77 | <HintPath>System.dll</HintPath> | ||
78 | <Private>False</Private> | ||
79 | </Reference> | ||
80 | <Reference Include="System.Xml"> | ||
81 | <HintPath>System.Xml.dll</HintPath> | ||
82 | <Private>False</Private> | ||
83 | </Reference> | ||
84 | </ItemGroup> | ||
85 | <ItemGroup> | ||
86 | <ProjectReference Include="..\..\Framework\General\OpenSim.Framework.csproj"> | ||
87 | <Name>OpenSim.Framework</Name> | ||
88 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
89 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
90 | <Private>False</Private> | ||
91 | </ProjectReference> | ||
92 | <ProjectReference Include="..\..\Framework\Console\OpenSim.Framework.Console.csproj"> | ||
93 | <Name>OpenSim.Framework.Console</Name> | ||
94 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
95 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
96 | <Private>False</Private> | ||
97 | </ProjectReference> | ||
98 | <ProjectReference Include="..\Environment\OpenSim.Region.Environment.csproj"> | ||
99 | <Name>OpenSim.Region.Environment</Name> | ||
100 | <Project>{DCBA491C-0000-0000-0000-000000000000}</Project> | ||
101 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
102 | <Private>False</Private> | ||
103 | </ProjectReference> | ||
104 | </ItemGroup> | ||
105 | <ItemGroup> | ||
106 | <Compile Include="NullScriptHost.cs"> | ||
107 | <SubType>Code</SubType> | ||
108 | </Compile> | ||
109 | <Compile Include="Script.cs"> | ||
110 | <SubType>Code</SubType> | ||
111 | </Compile> | ||
112 | <Compile Include="ScriptAPI.cs"> | ||
113 | <SubType>Code</SubType> | ||
114 | </Compile> | ||
115 | <Compile Include="ScriptInfo.cs"> | ||
116 | <SubType>Code</SubType> | ||
117 | </Compile> | ||
118 | <Compile Include="ScriptInterpretedAPI.cs"> | ||
119 | <SubType>Code</SubType> | ||
120 | </Compile> | ||
121 | <Compile Include="ScriptInterpretedEvents.cs"> | ||
122 | <SubType>Code</SubType> | ||
123 | </Compile> | ||
124 | <Compile Include="ScriptManager.cs"> | ||
125 | <SubType>Code</SubType> | ||
126 | </Compile> | ||
127 | <Compile Include="Engines\CSharpEngine\CSharpScriptEngine.cs"> | ||
128 | <SubType>Code</SubType> | ||
129 | </Compile> | ||
130 | <Compile Include="Engines\CSharpEngine\Examples\ExportRegionToLSL.cs"> | ||
131 | <SubType>Code</SubType> | ||
132 | </Compile> | ||
133 | <Compile Include="Engines\JScriptEngine\JScriptEngine.cs"> | ||
134 | <SubType>Code</SubType> | ||
135 | </Compile> | ||
136 | <Compile Include="Engines\JVMEngine\JavaEngine.cs"> | ||
137 | <SubType>Code</SubType> | ||
138 | </Compile> | ||
139 | <Compile Include="Engines\JVMEngine\OpenSimJVM.cs"> | ||
140 | <SubType>Code</SubType> | ||
141 | </Compile> | ||
142 | <Compile Include="Engines\JVMEngine\JVM\ClassInstance.cs"> | ||
143 | <SubType>Code</SubType> | ||
144 | </Compile> | ||
145 | <Compile Include="Engines\JVMEngine\JVM\ClassRecord.cs"> | ||
146 | <SubType>Code</SubType> | ||
147 | </Compile> | ||
148 | <Compile Include="Engines\JVMEngine\JVM\Heap.cs"> | ||
149 | <SubType>Code</SubType> | ||
150 | </Compile> | ||
151 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.cs"> | ||
152 | <SubType>Code</SubType> | ||
153 | </Compile> | ||
154 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.Logic.cs"> | ||
155 | <SubType>Code</SubType> | ||
156 | </Compile> | ||
157 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.Methods.cs"> | ||
158 | <SubType>Code</SubType> | ||
159 | </Compile> | ||
160 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.Return.cs"> | ||
161 | <SubType>Code</SubType> | ||
162 | </Compile> | ||
163 | <Compile Include="Engines\JVMEngine\JVM\MainMemory.cs"> | ||
164 | <SubType>Code</SubType> | ||
165 | </Compile> | ||
166 | <Compile Include="Engines\JVMEngine\JVM\MethodMemory.cs"> | ||
167 | <SubType>Code</SubType> | ||
168 | </Compile> | ||
169 | <Compile Include="Engines\JVMEngine\JVM\Object.cs"> | ||
170 | <SubType>Code</SubType> | ||
171 | </Compile> | ||
172 | <Compile Include="Engines\JVMEngine\JVM\OpCodes.cs"> | ||
173 | <SubType>Code</SubType> | ||
174 | </Compile> | ||
175 | <Compile Include="Engines\JVMEngine\JVM\Stack.cs"> | ||
176 | <SubType>Code</SubType> | ||
177 | </Compile> | ||
178 | <Compile Include="Engines\JVMEngine\JVM\StackFrame.cs"> | ||
179 | <SubType>Code</SubType> | ||
180 | </Compile> | ||
181 | <Compile Include="Engines\JVMEngine\JVM\Thread.cs"> | ||
182 | <SubType>Code</SubType> | ||
183 | </Compile> | ||
184 | <Compile Include="Engines\JVMEngine\Types\ArrayReference.cs"> | ||
185 | <SubType>Code</SubType> | ||
186 | </Compile> | ||
187 | <Compile Include="Engines\JVMEngine\Types\BaseType.cs"> | ||
188 | <SubType>Code</SubType> | ||
189 | </Compile> | ||
190 | <Compile Include="Engines\JVMEngine\Types\ObjectReference.cs"> | ||
191 | <SubType>Code</SubType> | ||
192 | </Compile> | ||
193 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Byte.cs"> | ||
194 | <SubType>Code</SubType> | ||
195 | </Compile> | ||
196 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Char.cs"> | ||
197 | <SubType>Code</SubType> | ||
198 | </Compile> | ||
199 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Float.cs"> | ||
200 | <SubType>Code</SubType> | ||
201 | </Compile> | ||
202 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Int.cs"> | ||
203 | <SubType>Code</SubType> | ||
204 | </Compile> | ||
205 | </ItemGroup> | ||
206 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
207 | <PropertyGroup> | ||
208 | <PreBuildEvent> | ||
209 | </PreBuildEvent> | ||
210 | <PostBuildEvent> | ||
211 | </PostBuildEvent> | ||
212 | </PropertyGroup> | ||
213 | </Project> \ No newline at end of file | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj.user b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj.user new file mode 100644 index 0000000..b3114ad --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.csproj.user | |||
@@ -0,0 +1,12 @@ | |||
1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim11-07\bin\</ReferencePath> | ||
6 | <LastOpenVersion>8.0.50727</LastOpenVersion> | ||
7 | <ProjectView>ProjectFiles</ProjectView> | ||
8 | <ProjectTrust>0</ProjectTrust> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " /> | ||
11 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " /> | ||
12 | </Project> | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.dll.build b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.dll.build new file mode 100644 index 0000000..ab3b7f4 --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionScriptEngine.dll.build | |||
@@ -0,0 +1,78 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Region.ExtensionScriptEngine" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Region.ExtensionScriptEngine" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="IScriptHost.cs" /> | ||
15 | <include name="NullScriptHost.cs" /> | ||
16 | <include name="Script.cs" /> | ||
17 | <include name="ScriptAPI.cs" /> | ||
18 | <include name="ScriptInfo.cs" /> | ||
19 | <include name="ScriptInterpretedAPI.cs" /> | ||
20 | <include name="ScriptInterpretedEvents.cs" /> | ||
21 | <include name="ScriptManager.cs" /> | ||
22 | <include name="Engines/CSharpEngine/CSharpScriptEngine.cs" /> | ||
23 | <include name="Engines/CSharpEngine/Examples/ExportRegionToLSL.cs" /> | ||
24 | <include name="Engines/JScriptEngine/JScriptEngine.cs" /> | ||
25 | <include name="Engines/JVMEngine/JavaEngine.cs" /> | ||
26 | <include name="Engines/JVMEngine/OpenSimJVM.cs" /> | ||
27 | <include name="Engines/JVMEngine/JVM/ClassInstance.cs" /> | ||
28 | <include name="Engines/JVMEngine/JVM/ClassRecord.cs" /> | ||
29 | <include name="Engines/JVMEngine/JVM/Heap.cs" /> | ||
30 | <include name="Engines/JVMEngine/JVM/Interpreter.cs" /> | ||
31 | <include name="Engines/JVMEngine/JVM/Interpreter.Logic.cs" /> | ||
32 | <include name="Engines/JVMEngine/JVM/Interpreter.Methods.cs" /> | ||
33 | <include name="Engines/JVMEngine/JVM/Interpreter.Return.cs" /> | ||
34 | <include name="Engines/JVMEngine/JVM/MainMemory.cs" /> | ||
35 | <include name="Engines/JVMEngine/JVM/MethodMemory.cs" /> | ||
36 | <include name="Engines/JVMEngine/JVM/Object.cs" /> | ||
37 | <include name="Engines/JVMEngine/JVM/OpCodes.cs" /> | ||
38 | <include name="Engines/JVMEngine/JVM/Stack.cs" /> | ||
39 | <include name="Engines/JVMEngine/JVM/StackFrame.cs" /> | ||
40 | <include name="Engines/JVMEngine/JVM/Thread.cs" /> | ||
41 | <include name="Engines/JVMEngine/Types/ArrayReference.cs" /> | ||
42 | <include name="Engines/JVMEngine/Types/BaseType.cs" /> | ||
43 | <include name="Engines/JVMEngine/Types/ObjectReference.cs" /> | ||
44 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs" /> | ||
45 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Char.cs" /> | ||
46 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Float.cs" /> | ||
47 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Int.cs" /> | ||
48 | </sources> | ||
49 | <references basedir="${project::get-base-directory()}"> | ||
50 | <lib> | ||
51 | <include name="${project::get-base-directory()}" /> | ||
52 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
53 | </lib> | ||
54 | <include name="../../../bin/libsecondlife.dll" /> | ||
55 | <include name="Microsoft.JScript.dll" /> | ||
56 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
57 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
58 | <include name="../../../bin/OpenSim.Region.Environment.dll" /> | ||
59 | <include name="System.dll" /> | ||
60 | <include name="System.Xml.dll" /> | ||
61 | </references> | ||
62 | </csc> | ||
63 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
64 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
65 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
66 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
67 | <include name="*.dll"/> | ||
68 | <include name="*.exe"/> | ||
69 | </fileset> | ||
70 | </copy> | ||
71 | </target> | ||
72 | <target name="clean"> | ||
73 | <delete dir="${bin.dir}" failonerror="false" /> | ||
74 | <delete dir="${obj.dir}" failonerror="false" /> | ||
75 | </target> | ||
76 | <target name="doc" description="Creates documentation."> | ||
77 | </target> | ||
78 | </project> | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj new file mode 100644 index 0000000..3bc95bb --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj | |||
@@ -0,0 +1,207 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{512D761A-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Region.ExtensionsScriptModule</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Region.ExtensionsScriptModule</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Axiom.MathLib.dll" > | ||
62 | <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="Microsoft.JScript" > | ||
70 | <HintPath>Microsoft.JScript.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\..\Framework\General\OpenSim.Framework.csproj"> | ||
84 | <Name>OpenSim.Framework</Name> | ||
85 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | <ProjectReference Include="..\..\Framework\Console\OpenSim.Framework.Console.csproj"> | ||
90 | <Name>OpenSim.Framework.Console</Name> | ||
91 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
93 | <Private>False</Private> | ||
94 | </ProjectReference> | ||
95 | <ProjectReference Include="..\Environment\OpenSim.Region.Environment.csproj"> | ||
96 | <Name>OpenSim.Region.Environment</Name> | ||
97 | <Project>{DCBA491C-0000-0000-0000-000000000000}</Project> | ||
98 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
99 | <Private>False</Private> | ||
100 | </ProjectReference> | ||
101 | </ItemGroup> | ||
102 | <ItemGroup> | ||
103 | <Compile Include="Script.cs"> | ||
104 | <SubType>Code</SubType> | ||
105 | </Compile> | ||
106 | <Compile Include="ScriptAPI.cs"> | ||
107 | <SubType>Code</SubType> | ||
108 | </Compile> | ||
109 | <Compile Include="ScriptInfo.cs"> | ||
110 | <SubType>Code</SubType> | ||
111 | </Compile> | ||
112 | <Compile Include="ScriptInterpretedAPI.cs"> | ||
113 | <SubType>Code</SubType> | ||
114 | </Compile> | ||
115 | <Compile Include="ScriptInterpretedEvents.cs"> | ||
116 | <SubType>Code</SubType> | ||
117 | </Compile> | ||
118 | <Compile Include="ScriptManager.cs"> | ||
119 | <SubType>Code</SubType> | ||
120 | </Compile> | ||
121 | <Compile Include="Engines\CSharp\CSharpScriptEngine.cs"> | ||
122 | <SubType>Code</SubType> | ||
123 | </Compile> | ||
124 | <Compile Include="Engines\CSharp\Examples\ExportRegionToLSL.cs"> | ||
125 | <SubType>Code</SubType> | ||
126 | </Compile> | ||
127 | <Compile Include="Engines\JScript\JScriptEngine.cs"> | ||
128 | <SubType>Code</SubType> | ||
129 | </Compile> | ||
130 | <Compile Include="Engines\JVMEngine\JavaEngine.cs"> | ||
131 | <SubType>Code</SubType> | ||
132 | </Compile> | ||
133 | <Compile Include="Engines\JVMEngine\OpenSimJVM.cs"> | ||
134 | <SubType>Code</SubType> | ||
135 | </Compile> | ||
136 | <Compile Include="Engines\JVMEngine\JVM\ClassInstance.cs"> | ||
137 | <SubType>Code</SubType> | ||
138 | </Compile> | ||
139 | <Compile Include="Engines\JVMEngine\JVM\ClassRecord.cs"> | ||
140 | <SubType>Code</SubType> | ||
141 | </Compile> | ||
142 | <Compile Include="Engines\JVMEngine\JVM\Heap.cs"> | ||
143 | <SubType>Code</SubType> | ||
144 | </Compile> | ||
145 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.cs"> | ||
146 | <SubType>Code</SubType> | ||
147 | </Compile> | ||
148 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.Logic.cs"> | ||
149 | <SubType>Code</SubType> | ||
150 | </Compile> | ||
151 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.Methods.cs"> | ||
152 | <SubType>Code</SubType> | ||
153 | </Compile> | ||
154 | <Compile Include="Engines\JVMEngine\JVM\Interpreter.Return.cs"> | ||
155 | <SubType>Code</SubType> | ||
156 | </Compile> | ||
157 | <Compile Include="Engines\JVMEngine\JVM\MainMemory.cs"> | ||
158 | <SubType>Code</SubType> | ||
159 | </Compile> | ||
160 | <Compile Include="Engines\JVMEngine\JVM\MethodMemory.cs"> | ||
161 | <SubType>Code</SubType> | ||
162 | </Compile> | ||
163 | <Compile Include="Engines\JVMEngine\JVM\Object.cs"> | ||
164 | <SubType>Code</SubType> | ||
165 | </Compile> | ||
166 | <Compile Include="Engines\JVMEngine\JVM\OpCodes.cs"> | ||
167 | <SubType>Code</SubType> | ||
168 | </Compile> | ||
169 | <Compile Include="Engines\JVMEngine\JVM\Stack.cs"> | ||
170 | <SubType>Code</SubType> | ||
171 | </Compile> | ||
172 | <Compile Include="Engines\JVMEngine\JVM\StackFrame.cs"> | ||
173 | <SubType>Code</SubType> | ||
174 | </Compile> | ||
175 | <Compile Include="Engines\JVMEngine\JVM\Thread.cs"> | ||
176 | <SubType>Code</SubType> | ||
177 | </Compile> | ||
178 | <Compile Include="Engines\JVMEngine\Types\ArrayReference.cs"> | ||
179 | <SubType>Code</SubType> | ||
180 | </Compile> | ||
181 | <Compile Include="Engines\JVMEngine\Types\BaseType.cs"> | ||
182 | <SubType>Code</SubType> | ||
183 | </Compile> | ||
184 | <Compile Include="Engines\JVMEngine\Types\ObjectReference.cs"> | ||
185 | <SubType>Code</SubType> | ||
186 | </Compile> | ||
187 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Byte.cs"> | ||
188 | <SubType>Code</SubType> | ||
189 | </Compile> | ||
190 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Char.cs"> | ||
191 | <SubType>Code</SubType> | ||
192 | </Compile> | ||
193 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Float.cs"> | ||
194 | <SubType>Code</SubType> | ||
195 | </Compile> | ||
196 | <Compile Include="Engines\JVMEngine\Types\PrimitiveTypes\Int.cs"> | ||
197 | <SubType>Code</SubType> | ||
198 | </Compile> | ||
199 | </ItemGroup> | ||
200 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
201 | <PropertyGroup> | ||
202 | <PreBuildEvent> | ||
203 | </PreBuildEvent> | ||
204 | <PostBuildEvent> | ||
205 | </PostBuildEvent> | ||
206 | </PropertyGroup> | ||
207 | </Project> | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj.user b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj.user new file mode 100644 index 0000000..b3114ad --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.csproj.user | |||
@@ -0,0 +1,12 @@ | |||
1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim11-07\bin\</ReferencePath> | ||
6 | <LastOpenVersion>8.0.50727</LastOpenVersion> | ||
7 | <ProjectView>ProjectFiles</ProjectView> | ||
8 | <ProjectTrust>0</ProjectTrust> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " /> | ||
11 | <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " /> | ||
12 | </Project> | ||
diff --git a/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.dll.build b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.dll.build new file mode 100644 index 0000000..5714dcb --- /dev/null +++ b/OpenSim/Region/ExtensionsScriptModule/OpenSim.Region.ExtensionsScriptModule.dll.build | |||
@@ -0,0 +1,77 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Region.ExtensionsScriptModule" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Region.ExtensionsScriptModule" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="Script.cs" /> | ||
15 | <include name="ScriptAPI.cs" /> | ||
16 | <include name="ScriptInfo.cs" /> | ||
17 | <include name="ScriptInterpretedAPI.cs" /> | ||
18 | <include name="ScriptInterpretedEvents.cs" /> | ||
19 | <include name="ScriptManager.cs" /> | ||
20 | <include name="Engines/CSharp/CSharpScriptEngine.cs" /> | ||
21 | <include name="Engines/CSharp/Examples/ExportRegionToLSL.cs" /> | ||
22 | <include name="Engines/JScript/JScriptEngine.cs" /> | ||
23 | <include name="Engines/JVMEngine/JavaEngine.cs" /> | ||
24 | <include name="Engines/JVMEngine/OpenSimJVM.cs" /> | ||
25 | <include name="Engines/JVMEngine/JVM/ClassInstance.cs" /> | ||
26 | <include name="Engines/JVMEngine/JVM/ClassRecord.cs" /> | ||
27 | <include name="Engines/JVMEngine/JVM/Heap.cs" /> | ||
28 | <include name="Engines/JVMEngine/JVM/Interpreter.cs" /> | ||
29 | <include name="Engines/JVMEngine/JVM/Interpreter.Logic.cs" /> | ||
30 | <include name="Engines/JVMEngine/JVM/Interpreter.Methods.cs" /> | ||
31 | <include name="Engines/JVMEngine/JVM/Interpreter.Return.cs" /> | ||
32 | <include name="Engines/JVMEngine/JVM/MainMemory.cs" /> | ||
33 | <include name="Engines/JVMEngine/JVM/MethodMemory.cs" /> | ||
34 | <include name="Engines/JVMEngine/JVM/Object.cs" /> | ||
35 | <include name="Engines/JVMEngine/JVM/OpCodes.cs" /> | ||
36 | <include name="Engines/JVMEngine/JVM/Stack.cs" /> | ||
37 | <include name="Engines/JVMEngine/JVM/StackFrame.cs" /> | ||
38 | <include name="Engines/JVMEngine/JVM/Thread.cs" /> | ||
39 | <include name="Engines/JVMEngine/Types/ArrayReference.cs" /> | ||
40 | <include name="Engines/JVMEngine/Types/BaseType.cs" /> | ||
41 | <include name="Engines/JVMEngine/Types/ObjectReference.cs" /> | ||
42 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs" /> | ||
43 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Char.cs" /> | ||
44 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Float.cs" /> | ||
45 | <include name="Engines/JVMEngine/Types/PrimitiveTypes/Int.cs" /> | ||
46 | </sources> | ||
47 | <references basedir="${project::get-base-directory()}"> | ||
48 | <lib> | ||
49 | <include name="${project::get-base-directory()}" /> | ||
50 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
51 | </lib> | ||
52 | <include name="../../../bin/Axiom.MathLib.dll" /> | ||
53 | <include name="../../../bin/libsecondlife.dll" /> | ||
54 | <include name="Microsoft.JScript.dll" /> | ||
55 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
56 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> | ||
57 | <include name="../../../bin/OpenSim.Region.Environment.dll" /> | ||
58 | <include name="System.dll" /> | ||
59 | <include name="System.Xml.dll" /> | ||
60 | </references> | ||
61 | </csc> | ||
62 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
63 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
64 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
65 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
66 | <include name="*.dll"/> | ||
67 | <include name="*.exe"/> | ||
68 | </fileset> | ||
69 | </copy> | ||
70 | </target> | ||
71 | <target name="clean"> | ||
72 | <delete dir="${bin.dir}" failonerror="false" /> | ||
73 | <delete dir="${obj.dir}" failonerror="false" /> | ||
74 | </target> | ||
75 | <target name="doc" description="Creates documentation."> | ||
76 | </target> | ||
77 | </project> | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs index e1e1d87..839d1a5 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/Script.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Script.cs | |||
@@ -1,64 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using OpenSim.Region.Environment.Scenes; | 28 | using OpenSim.Region.Environment.Scenes; |
29 | 29 | ||
30 | namespace OpenSim.Region.Scripting | 30 | namespace OpenSim.Region.ExtensionsScriptModule |
31 | { | 31 | { |
32 | public interface IScript | 32 | public interface IScript |
33 | { | 33 | { |
34 | void Initialise(ScriptInfo scriptInfo); | 34 | void Initialise(ScriptInfo scriptInfo); |
35 | string Name { get; } | 35 | string Name { get; } |
36 | } | 36 | } |
37 | 37 | ||
38 | public class TestScript : IScript | 38 | public class TestScript : IScript |
39 | { | 39 | { |
40 | ScriptInfo script; | 40 | ScriptInfo script; |
41 | 41 | ||
42 | public string Name | 42 | public string Name |
43 | { | 43 | { |
44 | get { return "TestScript 0.1"; } | 44 | get { return "TestScript 0.1"; } |
45 | } | 45 | } |
46 | 46 | ||
47 | public void Initialise(ScriptInfo scriptInfo) | 47 | public void Initialise(ScriptInfo scriptInfo) |
48 | { | 48 | { |
49 | script = scriptInfo; | 49 | script = scriptInfo; |
50 | script.events.OnFrame += events_OnFrame; | 50 | script.events.OnFrame += events_OnFrame; |
51 | script.events.OnNewPresence += events_OnNewPresence; | 51 | script.events.OnNewPresence += events_OnNewPresence; |
52 | } | 52 | } |
53 | 53 | ||
54 | void events_OnNewPresence(ScenePresence presence) | 54 | void events_OnNewPresence(ScenePresence presence) |
55 | { | 55 | { |
56 | script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!"); | 56 | script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!"); |
57 | } | 57 | } |
58 | 58 | ||
59 | void events_OnFrame() | 59 | void events_OnFrame() |
60 | { | 60 | { |
61 | //script.logger.Verbose("Hello World!"); | 61 | //script.logger.Verbose("Hello World!"); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | } | 64 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs index b3a804d..d32de7c 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptAPI.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs | |||
@@ -1,32 +1,32 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using Key = libsecondlife.LLUUID; | 4 | using Key = libsecondlife.LLUUID; |
5 | using Rotation = libsecondlife.LLQuaternion; | 5 | using Rotation = libsecondlife.LLQuaternion; |
6 | using Vector = libsecondlife.LLVector3; | 6 | using Vector = libsecondlife.LLVector3; |
7 | using LSLList = System.Collections.Generic.List<string>; | 7 | using LSLList = System.Collections.Generic.List<string>; |
8 | 8 | ||
9 | 9 | ||
10 | using OpenSim.Region.Environment.Scenes; | 10 | using OpenSim.Region.Environment.Scenes; |
11 | 11 | ||
12 | namespace OpenSim.Region.Scripting | 12 | namespace OpenSim.Region.ExtensionsScriptModule |
13 | { | 13 | { |
14 | // This class is to be used for engines which may not be able to access the Scene directly. | 14 | // This class is to be used for engines which may not be able to access the Scene directly. |
15 | // Scene access is preffered, but obviously not possible on some non-.NET languages. | 15 | // Scene access is preffered, but obviously not possible on some non-.NET languages. |
16 | public class ScriptAPI | 16 | public class ScriptAPI |
17 | { | 17 | { |
18 | Scene scene; | 18 | Scene scene; |
19 | ScriptInterpretedAPI interpretedAPI; | 19 | ScriptInterpretedAPI interpretedAPI; |
20 | 20 | ||
21 | public ScriptAPI(Scene world, Key taskID) | 21 | public ScriptAPI(Scene world, Key taskID) |
22 | { | 22 | { |
23 | scene = world; | 23 | scene = world; |
24 | interpretedAPI = new ScriptInterpretedAPI(world, taskID); | 24 | interpretedAPI = new ScriptInterpretedAPI(world, taskID); |
25 | } | 25 | } |
26 | 26 | ||
27 | public Object CallMethod(String method, Object[] args) | 27 | public Object CallMethod(String method, Object[] args) |
28 | { | 28 | { |
29 | return null; | 29 | return null; |
30 | } | 30 | } |
31 | } | 31 | } |
32 | } | 32 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs index 35a6d9f..f8eef1f 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInfo.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs | |||
@@ -1,63 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using OpenSim.Framework.Console; | 28 | using OpenSim.Framework.Console; |
29 | using OpenSim.Region.Environment.Scenes; | 29 | using OpenSim.Region.Environment.Scenes; |
30 | 30 | ||
31 | namespace OpenSim.Region.Scripting | 31 | namespace OpenSim.Region.ExtensionsScriptModule |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// Class which provides access to the world | 34 | /// Class which provides access to the world |
35 | /// </summary> | 35 | /// </summary> |
36 | public class ScriptInfo | 36 | public class ScriptInfo |
37 | { | 37 | { |
38 | // Reference to world.eventsManager provided for convenience | 38 | // Reference to world.eventsManager provided for convenience |
39 | public EventManager events; | 39 | public EventManager events; |
40 | 40 | ||
41 | // The main world | 41 | // The main world |
42 | public Scene world; | 42 | public Scene world; |
43 | 43 | ||
44 | // The console | 44 | // The console |
45 | public LogBase logger; | 45 | public LogBase logger; |
46 | 46 | ||
47 | // API Access | 47 | // API Access |
48 | public ScriptAPI api; | 48 | public ScriptAPI api; |
49 | 49 | ||
50 | public ScriptInfo(Scene scene) | 50 | public ScriptInfo(Scene scene) |
51 | { | 51 | { |
52 | world = scene; | 52 | world = scene; |
53 | events = world.EventManager; | 53 | events = world.EventManager; |
54 | logger = MainLog.Instance; | 54 | logger = MainLog.Instance; |
55 | api = new ScriptAPI(world, libsecondlife.LLUUID.Zero); | 55 | api = new ScriptAPI(world, libsecondlife.LLUUID.Zero); |
56 | } | 56 | } |
57 | 57 | ||
58 | public void CreateTaskAPI(libsecondlife.LLUUID task) | 58 | public void CreateTaskAPI(libsecondlife.LLUUID task) |
59 | { | 59 | { |
60 | api = new ScriptAPI(world, task); | 60 | api = new ScriptAPI(world, task); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs index 4617feb..c880bce 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs | |||
@@ -1,267 +1,267 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using Key = libsecondlife.LLUUID; | 4 | using Key = libsecondlife.LLUUID; |
5 | using Rotation = libsecondlife.LLQuaternion; | 5 | using Rotation = libsecondlife.LLQuaternion; |
6 | using Vector = libsecondlife.LLVector3; | 6 | using Vector = libsecondlife.LLVector3; |
7 | using LSLList = System.Collections.Generic.List<string>; | 7 | using LSLList = System.Collections.Generic.List<string>; |
8 | 8 | ||
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Environment.LandManagement; | 10 | using OpenSim.Region.Environment.LandManagement; |
11 | using libsecondlife; | 11 | using libsecondlife; |
12 | 12 | ||
13 | namespace OpenSim.Region.Scripting | 13 | namespace OpenSim.Region.ExtensionsScriptModule |
14 | { | 14 | { |
15 | /// <summary> | 15 | /// <summary> |
16 | /// A class inteded to act as an API for LSL-styled interpreted languages | 16 | /// A class inteded to act as an API for LSL-styled interpreted languages |
17 | /// </summary> | 17 | /// </summary> |
18 | /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> | 18 | /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> |
19 | class ScriptInterpretedAPI | 19 | class ScriptInterpretedAPI |
20 | { | 20 | { |
21 | protected LLUUID m_object; | 21 | protected LLUUID m_object; |
22 | protected Scene m_scene; | 22 | protected Scene m_scene; |
23 | 23 | ||
24 | /// <summary> | 24 | /// <summary> |
25 | /// The scene in which this script is acting | 25 | /// The scene in which this script is acting |
26 | /// </summary> | 26 | /// </summary> |
27 | public Scene Scene | 27 | public Scene Scene |
28 | { | 28 | { |
29 | get { return m_scene; } | 29 | get { return m_scene; } |
30 | } | 30 | } |
31 | 31 | ||
32 | /// <summary> | 32 | /// <summary> |
33 | /// The id of the object our script is supposed to be acting in | 33 | /// The id of the object our script is supposed to be acting in |
34 | /// </summary> | 34 | /// </summary> |
35 | public Key ObjectID | 35 | public Key ObjectID |
36 | { | 36 | { |
37 | get { return m_object; } | 37 | get { return m_object; } |
38 | } | 38 | } |
39 | 39 | ||
40 | /// <summary> | 40 | /// <summary> |
41 | /// The object our script is supposed to be in | 41 | /// The object our script is supposed to be in |
42 | /// </summary> | 42 | /// </summary> |
43 | public SceneObjectGroup Task | 43 | public SceneObjectGroup Task |
44 | { | 44 | { |
45 | get { return Scene.Objects[ObjectID]; } | 45 | get { return Scene.Objects[ObjectID]; } |
46 | } | 46 | } |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// Creates a new ScriptInterpretedAPI for a specified object | 49 | /// Creates a new ScriptInterpretedAPI for a specified object |
50 | /// </summary> | 50 | /// </summary> |
51 | /// <param name="world">The scene the object is located in</param> | 51 | /// <param name="world">The scene the object is located in</param> |
52 | /// <param name="member">The specific member being 'occupied' by the script</param> | 52 | /// <param name="member">The specific member being 'occupied' by the script</param> |
53 | public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) | 53 | public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) |
54 | { | 54 | { |
55 | m_scene = world; | 55 | m_scene = world; |
56 | m_object = member; | 56 | m_object = member; |
57 | } | 57 | } |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Returns the absolute number of a integer value. | 60 | /// Returns the absolute number of a integer value. |
61 | /// </summary> | 61 | /// </summary> |
62 | /// <param name="val">Input</param> | 62 | /// <param name="val">Input</param> |
63 | /// <returns>Absolute number of input</returns> | 63 | /// <returns>Absolute number of input</returns> |
64 | public int osAbs(int val) | 64 | public int osAbs(int val) |
65 | { | 65 | { |
66 | return Math.Abs(val); | 66 | return Math.Abs(val); |
67 | } | 67 | } |
68 | 68 | ||
69 | public float osAcos(float val) | 69 | public float osAcos(float val) |
70 | { | 70 | { |
71 | return (float)Math.Acos(val); | 71 | return (float)Math.Acos(val); |
72 | } | 72 | } |
73 | 73 | ||
74 | [Obsolete("Unimplemented")] | 74 | [Obsolete("Unimplemented")] |
75 | public void osAddToLandPassList(Key avatar, float hours) | 75 | public void osAddToLandPassList(Key avatar, float hours) |
76 | { | 76 | { |
77 | Vector myPosition = Task.AbsolutePosition; | 77 | Vector myPosition = Task.AbsolutePosition; |
78 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); | 78 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); |
79 | 79 | ||
80 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); | 80 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | 83 | ||
84 | [Obsolete("Unimplemented")] | 84 | [Obsolete("Unimplemented")] |
85 | public void osAdjustSoundVolume(float volume) | 85 | public void osAdjustSoundVolume(float volume) |
86 | { | 86 | { |
87 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); | 87 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); |
88 | return; | 88 | return; |
89 | } | 89 | } |
90 | 90 | ||
91 | [Obsolete("Unimplemented")] | 91 | [Obsolete("Unimplemented")] |
92 | public void osAllowInventoryDrop(int add) | 92 | public void osAllowInventoryDrop(int add) |
93 | { | 93 | { |
94 | return; | 94 | return; |
95 | } | 95 | } |
96 | 96 | ||
97 | [Obsolete("Unimplemented")] | 97 | [Obsolete("Unimplemented")] |
98 | public float osAngleBetween(Rotation a, Rotation b) | 98 | public float osAngleBetween(Rotation a, Rotation b) |
99 | { | 99 | { |
100 | Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); | 100 | Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); |
101 | Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); | 101 | Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); |
102 | 102 | ||
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | [Obsolete("Unimplemented")] | 106 | [Obsolete("Unimplemented")] |
107 | public void osApplyImpulse(Vector force, int local) | 107 | public void osApplyImpulse(Vector force, int local) |
108 | { | 108 | { |
109 | return; | 109 | return; |
110 | } | 110 | } |
111 | 111 | ||
112 | [Obsolete("Unimplemented")] | 112 | [Obsolete("Unimplemented")] |
113 | public void osApplyRotationalImpulse(Vector force, int local) | 113 | public void osApplyRotationalImpulse(Vector force, int local) |
114 | { | 114 | { |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | 117 | ||
118 | public float osAsin(float val) | 118 | public float osAsin(float val) |
119 | { | 119 | { |
120 | return (float)Math.Asin(val); | 120 | return (float)Math.Asin(val); |
121 | } | 121 | } |
122 | 122 | ||
123 | public float osAtan2(float x, float y) | 123 | public float osAtan2(float x, float y) |
124 | { | 124 | { |
125 | return (float)Math.Atan2(x, y); | 125 | return (float)Math.Atan2(x, y); |
126 | } | 126 | } |
127 | 127 | ||
128 | [Obsolete("Unimplemented")] | 128 | [Obsolete("Unimplemented")] |
129 | public void osAttachToAvatar(Key avatar, int attachmentPoint) | 129 | public void osAttachToAvatar(Key avatar, int attachmentPoint) |
130 | { | 130 | { |
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | 133 | ||
134 | [Obsolete("Unimplemented")] | 134 | [Obsolete("Unimplemented")] |
135 | public Key osAvatarOnSitTarget() | 135 | public Key osAvatarOnSitTarget() |
136 | { | 136 | { |
137 | //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences | 137 | //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences |
138 | /* | 138 | /* |
139 | foreach (KeyValuePair<Key, EntityBase> Child in Task.Children) | 139 | foreach (KeyValuePair<Key, EntityBase> Child in Task.Children) |
140 | { | 140 | { |
141 | if (Child.Value is ScenePresence) | 141 | if (Child.Value is ScenePresence) |
142 | { | 142 | { |
143 | return Child.Value.uuid; | 143 | return Child.Value.uuid; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | */ | 146 | */ |
147 | 147 | ||
148 | return Key.Zero; | 148 | return Key.Zero; |
149 | } | 149 | } |
150 | 150 | ||
151 | public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) | 151 | public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) |
152 | { | 152 | { |
153 | Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); | 153 | Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); |
154 | Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); | 154 | Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); |
155 | Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); | 155 | Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); |
156 | Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); | 156 | Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); |
157 | 157 | ||
158 | axQ.FromAxes(axFwd, axLeft, axUp); | 158 | axQ.FromAxes(axFwd, axLeft, axUp); |
159 | 159 | ||
160 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); | 160 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); |
161 | } | 161 | } |
162 | 162 | ||
163 | public Rotation osAxisAngle2Rot(Vector axis, float angle) | 163 | public Rotation osAxisAngle2Rot(Vector axis, float angle) |
164 | { | 164 | { |
165 | Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); | 165 | Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); |
166 | 166 | ||
167 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); | 167 | return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); |
168 | } | 168 | } |
169 | 169 | ||
170 | public string osBase64ToString(string str) | 170 | public string osBase64ToString(string str) |
171 | { | 171 | { |
172 | Encoding enc = System.Text.Encoding.UTF8; | 172 | Encoding enc = System.Text.Encoding.UTF8; |
173 | return enc.GetString(Convert.FromBase64String(str)); | 173 | return enc.GetString(Convert.FromBase64String(str)); |
174 | } | 174 | } |
175 | 175 | ||
176 | [Obsolete("Unimplemented")] | 176 | [Obsolete("Unimplemented")] |
177 | public void osBreakAllLinks() | 177 | public void osBreakAllLinks() |
178 | { | 178 | { |
179 | return; | 179 | return; |
180 | } | 180 | } |
181 | 181 | ||
182 | [Obsolete("Unimplemented")] | 182 | [Obsolete("Unimplemented")] |
183 | public void osBreakLink() | 183 | public void osBreakLink() |
184 | { | 184 | { |
185 | return; | 185 | return; |
186 | } | 186 | } |
187 | 187 | ||
188 | public LSLList osCSV2List(string src) | 188 | public LSLList osCSV2List(string src) |
189 | { | 189 | { |
190 | LSLList retVal = new LSLList(); | 190 | LSLList retVal = new LSLList(); |
191 | retVal.AddRange(src.Split(',')); | 191 | retVal.AddRange(src.Split(',')); |
192 | 192 | ||
193 | return retVal; | 193 | return retVal; |
194 | } | 194 | } |
195 | 195 | ||
196 | public int osCeil(float val) | 196 | public int osCeil(float val) |
197 | { | 197 | { |
198 | return (int)Math.Ceiling(val); | 198 | return (int)Math.Ceiling(val); |
199 | } | 199 | } |
200 | 200 | ||
201 | [Obsolete("Unimplemented")] | 201 | [Obsolete("Unimplemented")] |
202 | public void osCloseRemoteDataChannel(Key channel) | 202 | public void osCloseRemoteDataChannel(Key channel) |
203 | { | 203 | { |
204 | return; | 204 | return; |
205 | } | 205 | } |
206 | 206 | ||
207 | [Obsolete("Unimplemented")] | 207 | [Obsolete("Unimplemented")] |
208 | public float osCloud(Vector offset) | 208 | public float osCloud(Vector offset) |
209 | { | 209 | { |
210 | return 0.0f; | 210 | return 0.0f; |
211 | } | 211 | } |
212 | 212 | ||
213 | [Obsolete("Unimplemented")] | 213 | [Obsolete("Unimplemented")] |
214 | public void osCollisionFilter(string name, Key id, int accept) | 214 | public void osCollisionFilter(string name, Key id, int accept) |
215 | { | 215 | { |
216 | return; | 216 | return; |
217 | } | 217 | } |
218 | 218 | ||
219 | [Obsolete("Unimplemented")] | 219 | [Obsolete("Unimplemented")] |
220 | public void osCollisionSprite(string impact_sprite) | 220 | public void osCollisionSprite(string impact_sprite) |
221 | { | 221 | { |
222 | return; | 222 | return; |
223 | } | 223 | } |
224 | 224 | ||
225 | public float osCos(float theta) | 225 | public float osCos(float theta) |
226 | { | 226 | { |
227 | return (float)Math.Cos(theta); | 227 | return (float)Math.Cos(theta); |
228 | } | 228 | } |
229 | 229 | ||
230 | public void osCreateLink(Key target, int parent) | 230 | public void osCreateLink(Key target, int parent) |
231 | { | 231 | { |
232 | if(Scene.Entities[target] is SceneObjectGroup) | 232 | if(Scene.Entities[target] is SceneObjectGroup) |
233 | Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]); | 233 | Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]); |
234 | 234 | ||
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | 237 | ||
238 | [Obsolete("Partially Unimplemented")] | 238 | [Obsolete("Partially Unimplemented")] |
239 | public LSLList osDeleteSubList(LSLList src, int start, int end) | 239 | public LSLList osDeleteSubList(LSLList src, int start, int end) |
240 | { | 240 | { |
241 | if (start < 0 || end < 0) | 241 | if (start < 0 || end < 0) |
242 | { | 242 | { |
243 | throw new Exception("Unsupported at this time."); | 243 | throw new Exception("Unsupported at this time."); |
244 | } | 244 | } |
245 | 245 | ||
246 | src.RemoveRange(start, start - end + 1); | 246 | src.RemoveRange(start, start - end + 1); |
247 | return src; | 247 | return src; |
248 | } | 248 | } |
249 | 249 | ||
250 | [Obsolete("Partially Unimplemented")] | 250 | [Obsolete("Partially Unimplemented")] |
251 | public string osDeleteSubString(string src, int start, int end) | 251 | public string osDeleteSubString(string src, int start, int end) |
252 | { | 252 | { |
253 | if (start < 0 || end < 0) | 253 | if (start < 0 || end < 0) |
254 | { | 254 | { |
255 | throw new Exception("Unsupported at this time."); | 255 | throw new Exception("Unsupported at this time."); |
256 | } | 256 | } |
257 | 257 | ||
258 | return src.Remove(start, start - end + 1); | 258 | return src.Remove(start, start - end + 1); |
259 | } | 259 | } |
260 | 260 | ||
261 | [Obsolete("Unimplemented")] | 261 | [Obsolete("Unimplemented")] |
262 | public void osDetachFromAvatar(Key avatar) | 262 | public void osDetachFromAvatar(Key avatar) |
263 | { | 263 | { |
264 | return; | 264 | return; |
265 | } | 265 | } |
266 | } | 266 | } |
267 | } | 267 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedEvents.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs index 41fe9c5..92c67b7 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedEvents.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs | |||
@@ -1,23 +1,23 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using Key = libsecondlife.LLUUID; | 6 | using Key = libsecondlife.LLUUID; |
7 | 7 | ||
8 | namespace OpenSim.Region.Scripting | 8 | namespace OpenSim.Region.ExtensionsScriptModule |
9 | { | 9 | { |
10 | 10 | ||
11 | public class ScriptInterpretedEvents | 11 | public class ScriptInterpretedEvents |
12 | { | 12 | { |
13 | public delegate void OnTouchStartDelegate(Key user); | 13 | public delegate void OnTouchStartDelegate(Key user); |
14 | public event OnTouchStartDelegate OnTouchStart; | 14 | public event OnTouchStartDelegate OnTouchStart; |
15 | 15 | ||
16 | 16 | ||
17 | public void TriggerTouchStart(Key user) | 17 | public void TriggerTouchStart(Key user) |
18 | { | 18 | { |
19 | if (OnTouchStart != null) | 19 | if (OnTouchStart != null) |
20 | OnTouchStart(user); | 20 | OnTouchStart(user); |
21 | } | 21 | } |
22 | } | 22 | } |
23 | } | 23 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs index 3bd395e..a97979f 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptManager.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs | |||
@@ -1,107 +1,138 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
30 | using OpenSim.Region.Environment.Scenes; | 30 | using OpenSim.Region.Environment; |
31 | 31 | using OpenSim.Region.Environment.Scenes; | |
32 | namespace OpenSim.Region.Scripting | 32 | using OpenSim.Region.Environment.Interfaces; |
33 | { | 33 | using OpenSim.Region.ExtensionsScriptModule.CSharp; |
34 | public class ScriptManager | 34 | using OpenSim.Region.ExtensionsScriptModule.JScript; |
35 | { | 35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; |
36 | List<IScript> scripts = new List<IScript>(); | 36 | |
37 | Scene scene; | 37 | namespace OpenSim.Region.ExtensionsScriptModule |
38 | Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); | 38 | { |
39 | 39 | public class ScriptManager : IRegionModule | |
40 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) | 40 | { |
41 | { | 41 | List<IScript> scripts = new List<IScript>(); |
42 | foreach (KeyValuePair<string, IScript> script in compiledscripts) | 42 | Scene m_scene; |
43 | { | 43 | Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); |
44 | ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | 44 | |
45 | MainLog.Instance.Verbose("Loading " + script.Key); | 45 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) |
46 | script.Value.Initialise(scriptInfo); | 46 | { |
47 | scripts.Add(script.Value); | 47 | foreach (KeyValuePair<string, IScript> script in compiledscripts) |
48 | } | 48 | { |
49 | MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); | 49 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. |
50 | } | 50 | MainLog.Instance.Verbose("Loading " + script.Key); |
51 | 51 | script.Value.Initialise(scriptInfo); | |
52 | public ScriptManager(Scene world) | 52 | scripts.Add(script.Value); |
53 | { | 53 | } |
54 | scene = world; | 54 | MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); |
55 | 55 | } | |
56 | // Default Engines | 56 | |
57 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); | 57 | public ScriptManager() |
58 | compilers.Add(csharpCompiler.FileExt(),csharpCompiler); | 58 | { |
59 | 59 | // Default Engines | |
60 | JScriptEngine jscriptCompiler = new JScriptEngine(); | 60 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); |
61 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); | 61 | compilers.Add(csharpCompiler.FileExt(),csharpCompiler); |
62 | 62 | ||
63 | JavaEngine javaCompiler = new JavaEngine(); | 63 | JScriptEngine jscriptCompiler = new JScriptEngine(); |
64 | compilers.Add(javaCompiler.FileExt(), javaCompiler); | 64 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); |
65 | } | 65 | |
66 | 66 | JavaEngine javaCompiler = new JavaEngine(); | |
67 | public void Compile(string filename) | 67 | compilers.Add(javaCompiler.FileExt(), javaCompiler); |
68 | { | 68 | } |
69 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) | 69 | |
70 | { | 70 | public void Initialise(Scene scene) |
71 | if (filename.EndsWith(compiler.Key)) | 71 | { |
72 | { | 72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); |
73 | LoadFromCompiler(compiler.Value.compile(filename)); | 73 | m_scene = scene; |
74 | break; | 74 | |
75 | } | 75 | m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod<bool, string, int>(Compile)); |
76 | } | 76 | m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod<bool, IScript, int>(AddPreCompiledScript)); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void RunScriptCmd(string[] args) | 79 | public void PostInitialise() |
80 | { | 80 | { |
81 | switch (args[0]) | 81 | |
82 | { | 82 | } |
83 | case "load": | 83 | |
84 | Compile(args[1]); | 84 | public void CloseDown() |
85 | break; | 85 | { |
86 | 86 | ||
87 | default: | 87 | } |
88 | MainLog.Instance.Error("Unknown script command"); | 88 | |
89 | break; | 89 | public string GetName() |
90 | } | 90 | { |
91 | } | 91 | return "ExtensionsScriptingModule"; |
92 | 92 | } | |
93 | public void AddPreCompiledScript(IScript script) | 93 | |
94 | { | 94 | public bool Compile(string filename, int dummyParam) |
95 | MainLog.Instance.Verbose("Loading script " + script.Name); | 95 | { |
96 | ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | 96 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) |
97 | script.Initialise(scriptInfo); | 97 | { |
98 | scripts.Add(script); | 98 | if (filename.EndsWith(compiler.Key)) |
99 | } | 99 | { |
100 | } | 100 | LoadFromCompiler(compiler.Value.compile(filename)); |
101 | 101 | break; | |
102 | interface IScriptCompiler | 102 | } |
103 | { | 103 | } |
104 | Dictionary<string,IScript> compile(string filename); | 104 | |
105 | string FileExt(); | 105 | return true; |
106 | } | 106 | } |
107 | } | 107 | |
108 | public void RunScriptCmd(string[] args) | ||
109 | { | ||
110 | switch (args[0]) | ||
111 | { | ||
112 | case "load": | ||
113 | Compile(args[1], 0); | ||
114 | break; | ||
115 | |||
116 | default: | ||
117 | MainLog.Instance.Error("Unknown script command"); | ||
118 | break; | ||
119 | } | ||
120 | } | ||
121 | |||
122 | public bool AddPreCompiledScript(IScript script, int dummyParam) | ||
123 | { | ||
124 | MainLog.Instance.Verbose("Loading script " + script.Name); | ||
125 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | ||
126 | script.Initialise(scriptInfo); | ||
127 | scripts.Add(script); | ||
128 | |||
129 | return true; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | interface IScriptCompiler | ||
134 | { | ||
135 | Dictionary<string,IScript> compile(string filename); | ||
136 | string FileExt(); | ||
137 | } | ||
138 | } | ||
diff --git a/prebuild.xml b/prebuild.xml index 0dcaabc..2d475c7 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -595,6 +595,34 @@ | |||
595 | </Files> | 595 | </Files> |
596 | </Project> | 596 | </Project> |
597 | 597 | ||
598 | <Project name="OpenSim.Region.ExtensionsScriptModule" path="OpenSim/Region/ExtensionsScriptModule" type="Library"> | ||
599 | <Configuration name="Debug"> | ||
600 | <Options> | ||
601 | <OutputPath>../../../bin/</OutputPath> | ||
602 | </Options> | ||
603 | </Configuration> | ||
604 | <Configuration name="Release"> | ||
605 | <Options> | ||
606 | <OutputPath>../../../bin/</OutputPath> | ||
607 | </Options> | ||
608 | </Configuration> | ||
609 | |||
610 | <ReferencePath>../../../bin/</ReferencePath> | ||
611 | <Reference name="System"/> | ||
612 | <Reference name="System.Xml"/> | ||
613 | <Reference name="Microsoft.JScript"/> | ||
614 | <Reference name="libsecondlife.dll" /> | ||
615 | <Reference name="OpenSim.Framework"/> | ||
616 | <Reference name="OpenSim.Region.Environment"/> | ||
617 | <Reference name="OpenSim.Framework.Console"/> | ||
618 | <Reference name="Axiom.MathLib.dll"/> | ||
619 | |||
620 | <Files> | ||
621 | <Match pattern="*.cs" recurse="true"/> | ||
622 | </Files> | ||
623 | </Project> | ||
624 | |||
625 | |||
598 | <!-- OpenSim app --> | 626 | <!-- OpenSim app --> |
599 | <Project name="OpenSim" path="OpenSim/Region/Application" type="Exe"> | 627 | <Project name="OpenSim" path="OpenSim/Region/Application" type="Exe"> |
600 | <Configuration name="Debug"> | 628 | <Configuration name="Debug"> |