From 74cd26b7228f20bcd9fb2503a81045a36d80a63a Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 6 Aug 2007 12:54:13 +0000 Subject: Part 1 of a two-part commit to change caps of 'scripting' dir... --- .../Engines/CSharpEngine/CSharpScriptEngine.cs | 102 ---- .../CSharpEngine/Examples/ExportRegionToLSL.cs | 70 --- .../Engines/JScriptEngine/JScriptEngine.cs | 102 ---- .../Engines/JVMEngine/JVM/ClassInstance.cs | 46 -- .../scripting/Engines/JVMEngine/JVM/ClassRecord.cs | 640 --------------------- .../Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs | 43 -- .../Engines/JVMEngine/JVM/Interpreter.Logic.cs | 551 ------------------ .../Engines/JVMEngine/JVM/Interpreter.Methods.cs | 96 ---- .../Engines/JVMEngine/JVM/Interpreter.Return.cs | 40 -- .../scripting/Engines/JVMEngine/JVM/Interpreter.cs | 135 ----- .../scripting/Engines/JVMEngine/JVM/MainMemory.cs | 45 -- .../Engines/JVMEngine/JVM/MethodMemory.cs | 46 -- .../scripting/Engines/JVMEngine/JVM/Object.cs | 37 -- .../scripting/Engines/JVMEngine/JVM/OpCodes.cs | 56 -- .../scripting/Engines/JVMEngine/JVM/Stack.cs | 42 -- .../scripting/Engines/JVMEngine/JVM/StackFrame.cs | 49 -- .../scripting/Engines/JVMEngine/JVM/Thread.cs | 119 ---- .../scripting/Engines/JVMEngine/JavaEngine.cs | 29 - .../scripting/Engines/JVMEngine/OpenSimJVM.cs | 170 ------ .../Engines/JVMEngine/Types/ArrayReference.cs | 10 - .../scripting/Engines/JVMEngine/Types/BaseType.cs | 10 - .../Engines/JVMEngine/Types/ObjectReference.cs | 16 - .../Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs | 10 - .../Engines/JVMEngine/Types/PrimitiveTypes/Char.cs | 10 - .../JVMEngine/Types/PrimitiveTypes/Float.cs | 16 - .../Engines/JVMEngine/Types/PrimitiveTypes/Int.cs | 16 - .../Engines/LSLEngine/LSLHandler/Common.cs | 84 --- .../Engines/LSLEngine/LSLHandler/Engine.cs | 228 -------- .../LSLEngine/LSLHandler/IL_common_functions.cs | 56 -- .../LSLHandler/LSL_BuiltIn_Commands_Interface.cs | 366 ------------ .../LSL_BuiltIn_Commands_TestImplementation.cs | 377 ------------ .../LSLEngine/LSLHandler/LSL_CLRInterface.cs | 79 --- .../LSLHandler/LSL_OPCODE_IL_processor.cs | 351 ----------- .../Engines/LSLEngine/LSLHandler/LSO_Enums.cs | 548 ------------------ .../Engines/LSLEngine/LSLHandler/LSO_Parser.cs | 629 -------------------- .../Engines/LSLEngine/LSLHandler/LSO_Struct.cs | 133 ----- .../scripting/Engines/LSLEngine/LSLScript.cs | 33 -- .../scripting/Engines/LSLEngine/LSLScriptEngine.cs | 27 - 38 files changed, 5417 deletions(-) delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Common.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/IL_common_functions.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_Interface.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_TestImplementation.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_OPCODE_IL_processor.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs delete mode 100644 OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs (limited to 'OpenSim/Region/Environment/Scenes/scripting/Engines') diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs deleted file mode 100644 index b0ccd22..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Microsoft.CSharp; -using OpenSim.Framework.Console; - -namespace OpenSim.Region.Scripting -{ - public class CSharpScriptEngine : IScriptCompiler - { - public string FileExt() - { - return ".cs"; - } - - private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) - { - CompilerParameters compilerParams = new CompilerParameters(); - CompilerResults compilerResults; - compilerParams.GenerateExecutable = false; - compilerParams.GenerateInMemory = true; - compilerParams.IncludeDebugInformation = false; - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); - compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); - compilerParams.ReferencedAssemblies.Add("System.dll"); - - compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); - - if (compilerResults.Errors.Count > 0) - { - MainLog.Instance.Error("Compile errors"); - foreach (CompilerError error in compilerResults.Errors) - { - MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); - } - } - else - { - Dictionary scripts = new Dictionary(); - - foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) - { - Type testInterface = pluginType.GetInterface("IScript", true); - - if (testInterface != null) - { - IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); - - string scriptName = "C#/" + script.getName(); - Console.WriteLine("Script: " + scriptName + " loaded."); - - if (!scripts.ContainsKey(scriptName)) - { - scripts.Add(scriptName, script); - } - else - { - scripts[scriptName] = script; - } - } - } - return scripts; - } - return null; - } - - public Dictionary compile(string filename) - { - CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); - return LoadDotNetScript(csharpProvider, filename); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs deleted file mode 100644 index f753b30..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs +++ /dev/null @@ -1,70 +0,0 @@ -using OpenSim.Framework.Console; -using OpenSim.Framework; -using OpenSim.Region.Environment; -using OpenSim.Region.Environment.Scenes; - -using System.Collections.Generic; -using libsecondlife; - -namespace OpenSim.Region.Scripting.Examples -{ - public class LSLExportScript : IScript - { - ScriptInfo script; - - public string getName() - { - return "LSL Export Script 0.1"; - } - - public void Initialise(ScriptInfo scriptInfo) - { - script = scriptInfo; - - script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); - } - - void ProcessConsoleMsg(string[] args) - { - if (args[0].ToLower() == "lslexport") - { - string sequence = ""; - - foreach (KeyValuePair obj in script.world.Objects) - { - SceneObject root = obj.Value; - - sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; - - string rootPrim = processPrimitiveToString(root.rootPrimitive); - - sequence += "ROOT:" + rootPrim; - - foreach (KeyValuePair prim in root.Children) - { - string child = processPrimitiveToString(prim.Value); - sequence += "CHILD:" + child; - } - } - - System.Console.WriteLine(sequence); - } - } - - string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim) - { - string desc = prim.Description; - string name = prim.Name; - LLVector3 pos = prim.Pos; - LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w); - LLVector3 scale = prim.Scale; - LLVector3 rootPos = prim.WorldPos; - - string setPrimParams = ""; - - setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; - - return setPrimParams; - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs deleted file mode 100644 index af4f8b4..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Microsoft.JScript; -using OpenSim.Framework.Console; - -namespace OpenSim.Region.Scripting -{ - public class JScriptEngine : IScriptCompiler - { - public string FileExt() - { - return ".js"; - } - - private Dictionary LoadDotNetScript(CodeDomProvider compiler, string filename) - { - CompilerParameters compilerParams = new CompilerParameters(); - CompilerResults compilerResults; - compilerParams.GenerateExecutable = false; - compilerParams.GenerateInMemory = true; - compilerParams.IncludeDebugInformation = false; - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); - compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); - compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); - compilerParams.ReferencedAssemblies.Add("System.dll"); - - compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); - - if (compilerResults.Errors.Count > 0) - { - MainLog.Instance.Error("Compile errors"); - foreach (CompilerError error in compilerResults.Errors) - { - MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); - } - } - else - { - Dictionary scripts = new Dictionary(); - - foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) - { - Type testInterface = pluginType.GetInterface("IScript", true); - - if (testInterface != null) - { - IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); - - string scriptName = "JS.NET/" + script.getName(); - Console.WriteLine("Script: " + scriptName + " loaded."); - - if (!scripts.ContainsKey(scriptName)) - { - scripts.Add(scriptName, script); - } - else - { - scripts[scriptName] = script; - } - } - } - return scripts; - } - return null; - } - - public Dictionary compile(string filename) - { - JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); - return LoadDotNetScript(jscriptProvider, filename); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs deleted file mode 100644 index 4b734a3..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Scripting.EmbeddedJVM.Types; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class ClassInstance : Object - { - public int Size; - public ClassRecord ClassRec; - public Dictionary Fields = new Dictionary(); - - public ClassInstance() - { - - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs deleted file mode 100644 index 4b2aec3..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs +++ /dev/null @@ -1,640 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.IO; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Scripting.EmbeddedJVM.Types; -using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class ClassRecord - { - private ushort m_majorVersion; - private ushort m_minorVersion; - private ushort m_constantPoolCount; - private ushort m_accessFlags; - private ushort m_thisClass; - private ushort m_supperClass; - private ushort m_interfaceCount; - private ushort m_fieldCount; - private ushort m_methodCount; - //private ushort _attributeCount; - //private string _name; - public Dictionary StaticFields = new Dictionary(); - public PoolClass MClass; - - public List m_constantsPool = new List(); - private List m_methodsList = new List(); - private List m_fieldList = new List(); - - public ClassRecord() - { - - } - - public ClassInstance CreateNewInstance() - { - ClassInstance classInst = new ClassInstance(); - classInst.ClassRec = this; - //TODO: set fields - - return classInst; - } - - public void LoadClassFromFile(string fileName) - { - Console.WriteLine("loading script " + fileName); - FileStream fs = File.OpenRead(fileName); - this.LoadClassFromBytes(ReadFully(fs)); - fs.Close(); - } - - public void LoadClassFromBytes(byte[] data) - { - int i = 0; - i += 4; - m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); - m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); - m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); - Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); - for (int count = 0; count < (m_constantPoolCount - 1); count++) - { - //read in the constant pool - byte pooltype = data[i++]; - Console.WriteLine("#" + count + ": new constant type = " + pooltype); - //Console.WriteLine("start position is: " + i); - switch (pooltype) - { - case 1: //Utf8 - ushort uLength = (ushort)((data[i++] << 8) + data[i++]); - - // Console.WriteLine("new utf8 type, length is " + uLength); - PoolUtf8 utf8 = new PoolUtf8(); - utf8.readValue(data, ref i, uLength); - this.m_constantsPool.Add(utf8); - break; - case 3: //Int - break; - case 4: //Float - break; - case 7: //Class - PoolClass pClass = new PoolClass(this); - pClass.readValue(data, ref i); - this.m_constantsPool.Add(pClass); - break; - case 9: //FieldRef - PoolFieldRef pField = new PoolFieldRef(this); - pField.readValue(data, ref i); - this.m_constantsPool.Add(pField); - break; - case 10: //Method - PoolMethodRef pMeth = new PoolMethodRef(this); - pMeth.readValue(data, ref i); - this.m_constantsPool.Add(pMeth); - break; - case 12: //NamedType - PoolNamedType pNamed = new PoolNamedType(this); - pNamed.readValue(data, ref i); - this.m_constantsPool.Add(pNamed); - break; - } - } - - m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); - m_thisClass = (ushort)((data[i++] << 8) + data[i++]); - m_supperClass = (ushort)((data[i++] << 8) + data[i++]); - - if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) - { - this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); - } - - m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); - //should now read in the info for each interface - - m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); - //should now read in the info for each field - for (int count = 0; count < m_fieldCount; count++) - { - FieldInfo fieldInf = new FieldInfo(this); - fieldInf.ReadData(data, ref i); - this.m_fieldList.Add(fieldInf); - } - - m_methodCount = (ushort)((data[i++] << 8) + data[i++]); - for (int count = 0; count < m_methodCount; count++) - { - MethodInfo methInf = new MethodInfo(this); - methInf.ReadData(data, ref i); - this.m_methodsList.Add(methInf); - } - } - - public void AddMethodsToMemory(MethodMemory memory) - { - for (int count = 0; count < m_methodCount; count++) - { - this.m_methodsList[count].AddMethodCode(memory); - } - } - - public bool StartMethod(Thread thread, string methodName) - { - for (int count = 0; count < m_methodCount; count++) - { - if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) - { - if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) - { - //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); - thread.SetPC(this.m_methodsList[count].CodePointer); - return true; - } - } - } - return false; - } - - public void PrintToConsole() - { - Console.WriteLine("Class File:"); - Console.WriteLine("Major version: " + m_majorVersion); - Console.WriteLine("Minor version: " + m_minorVersion); - Console.WriteLine("Pool size: " + m_constantPoolCount); - - for (int i = 0; i < m_constantsPool.Count; i++) - { - this.m_constantsPool[i].Print(); - } - - Console.WriteLine("Access flags: " + m_accessFlags); - Console.WriteLine("This class: " + m_thisClass); - Console.WriteLine("Super class: " + m_supperClass); - - for (int count = 0; count < m_fieldCount; count++) - { - Console.WriteLine(); - this.m_fieldList[count].Print(); - } - - for (int count = 0; count < m_methodCount; count++) - { - Console.WriteLine(); - this.m_methodsList[count].Print(); - } - - Console.WriteLine("class name is " + this.MClass.Name.Value); - } - - public static byte[] ReadFully(Stream stream) - { - byte[] buffer = new byte[1024]; - using (MemoryStream ms = new MemoryStream()) - { - while (true) - { - int read = stream.Read(buffer, 0, buffer.Length); - if (read <= 0) - return ms.ToArray(); - ms.Write(buffer, 0, read); - } - } - } - - #region nested classes - public class PoolItem - { - public virtual void Print() - { - - } - } - - public class PoolUtf8 : PoolItem - { - public string Value = ""; - - public void readValue(byte[] data, ref int pointer, int length) - { - for (int i = 0; i < length; i++) - { - int a = (int)data[pointer++]; - if ((a & 0x80) == 0) - { - Value = Value + (char)a; - } - else if ((a & 0x20) == 0) - { - int b = (int)data[pointer++]; - Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); - } - else - { - int b = (int)data[pointer++]; - int c = (int)data[pointer++]; - Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); - } - } - } - - public override void Print() - { - Console.WriteLine("Utf8 type: " + Value); - } - } - - private class PoolInt : PoolItem - { - - } - - public class PoolClass : PoolItem - { - //public string name = ""; - public ushort namePointer = 0; - private ClassRecord parent; - public PoolUtf8 Name; - - public PoolClass(ClassRecord paren) - { - parent = paren; - } - - public void readValue(byte[] data, ref int pointer) - { - namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); - } - - public override void Print() - { - this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); - Console.Write("Class type: " + namePointer); - Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); - - } - } - - public class PoolFieldRef : PoolItem - { - public ushort classPointer = 0; - public ushort nameTypePointer = 0; - public PoolNamedType mNameType; - public PoolClass mClass; - private ClassRecord parent; - - public PoolFieldRef(ClassRecord paren) - { - parent = paren; - } - - public void readValue(byte[] data, ref int pointer) - { - classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); - nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); - } - - public override void Print() - { - this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); - this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); - Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); - } - } - - public class PoolMethodRef : PoolItem - { - public ushort classPointer = 0; - public ushort nameTypePointer = 0; - public PoolNamedType mNameType; - public PoolClass mClass; - private ClassRecord parent; - - public PoolMethodRef(ClassRecord paren) - { - parent = paren; - } - - public void readValue(byte[] data, ref int pointer) - { - classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); - nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); - } - - public override void Print() - { - this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); - this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); - Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); - } - } - - public class PoolNamedType : PoolItem - { - public ushort namePointer = 0; - public ushort typePointer = 0; - private ClassRecord parent; - public PoolUtf8 Name; - public PoolUtf8 Type; - - public PoolNamedType(ClassRecord paren) - { - parent = paren; - } - - public void readValue(byte[] data, ref int pointer) - { - namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); - typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); - } - - public override void Print() - { - Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); - Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); - Console.Write("Named type: " + namePointer + " , " + typePointer); - Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); - } - } - - //*********************** - public class MethodInfo - { - public ushort AccessFlags = 0; - public ushort NameIndex = 0; - public string Name = ""; - public ushort DescriptorIndex = 0; - public ushort AttributeCount = 0; - public List Attributes = new List(); - private ClassRecord parent; - public int CodePointer = 0; - - public MethodInfo(ClassRecord paren) - { - parent = paren; - } - - public void AddMethodCode(MethodMemory memory) - { - Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); - memory.Methodcount++; - this.CodePointer = memory.NextMethodPC; - memory.NextMethodPC += this.Attributes[0].Code.Length; - } - - public void ReadData(byte[] data, ref int pointer) - { - AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); - NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); - DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); - AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); - for (int i = 0; i < AttributeCount; i++) - { - MethodAttribute attri = new MethodAttribute(this.parent); - attri.ReadData(data, ref pointer); - this.Attributes.Add(attri); - } - } - - public void Print() - { - Console.WriteLine("Method Info Struct: "); - Console.WriteLine("AccessFlags: " + AccessFlags); - Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); - Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); - Console.WriteLine("Attribute Count:" + AttributeCount); - for (int i = 0; i < AttributeCount; i++) - { - this.Attributes[i].Print(); - } - } - - public class MethodAttribute - { - public ushort NameIndex = 0; - public string Name = ""; - public Int32 Length = 0; - //for now only support code attribute - public ushort MaxStack = 0; - public ushort MaxLocals = 0; - public Int32 CodeLength = 0; - public byte[] Code; - public ushort ExceptionTableLength = 0; - public ushort SubAttributeCount = 0; - public List SubAttributes = new List(); - private ClassRecord parent; - - public MethodAttribute(ClassRecord paren) - { - parent = paren; - } - - public void ReadData(byte[] data, ref int pointer) - { - NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); - Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); - MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); - MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); - CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); - Code = new byte[CodeLength]; - for (int i = 0; i < CodeLength; i++) - { - Code[i] = data[pointer++]; - } - ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); - SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); - for (int i = 0; i < SubAttributeCount; i++) - { - SubAttribute subAttri = new SubAttribute(this.parent); - subAttri.ReadData(data, ref pointer); - this.SubAttributes.Add(subAttri); - } - } - - public void Print() - { - Console.WriteLine("Method Attribute: "); - Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); - Console.WriteLine("Length: " + Length); - Console.WriteLine("MaxStack: " + MaxStack); - Console.WriteLine("MaxLocals: " + MaxLocals); - Console.WriteLine("CodeLength: " + CodeLength); - for (int i = 0; i < Code.Length; i++) - { - Console.WriteLine("OpCode #" + i + " is: " + Code[i]); - } - Console.WriteLine("SubAttributes: " + SubAttributeCount); - for (int i = 0; i < SubAttributeCount; i++) - { - this.SubAttributes[i].Print(); - } - } - - public class SubAttribute - { - public ushort NameIndex = 0; - public string Name = ""; - public Int32 Length = 0; - public byte[] Data; - private ClassRecord parent; - - public SubAttribute(ClassRecord paren) - { - parent = paren; - } - - public void ReadData(byte[] data, ref int pointer) - { - NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); - Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); - Data = new byte[Length]; - for (int i = 0; i < Length; i++) - { - Data[i] = data[pointer++]; - } - } - - public void Print() - { - Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); - } - - } - } - - } - private class InterfaceInfo - { - public void ReadData(byte[] data, ref int i) - { - - } - } - - public class FieldInfo - { - public ushort AccessFlags = 0; - public ushort NameIndex = 0; - public string Name = ""; - public ushort DescriptorIndex = 0; - public ushort AttributeCount = 0; - public List Attributes = new List(); - private ClassRecord parent; - - public FieldInfo(ClassRecord paren) - { - parent = paren; - } - - public void ReadData(byte[] data, ref int pointer) - { - AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); - NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); - DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); - AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); - for (int i = 0; i < AttributeCount; i++) - { - FieldAttribute attri = new FieldAttribute(this.parent); - attri.ReadData(data, ref pointer); - this.Attributes.Add(attri); - } - } - - public void Print() - { - Console.WriteLine("Field Info Struct: "); - Console.WriteLine("AccessFlags: " + AccessFlags); - Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); - Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); - Console.WriteLine("Attribute Count:" + AttributeCount); - //if static, add to static field list - // if (this.AccessFlags == 9) //public and static - if ((this.AccessFlags & 0x08) != 0) - { - switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) - { - case "I": - Int newin = new Int(); - this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); - break; - case "F": - Float newfl = new Float(); - this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); - break; - } - - } - for (int i = 0; i < AttributeCount; i++) - { - this.Attributes[i].Print(); - } - } - - public class FieldAttribute - { - public ushort NameIndex = 0; - public string Name = ""; - public Int32 Length = 0; - public byte[] Data; - private ClassRecord parent; - - public FieldAttribute(ClassRecord paren) - { - parent = paren; - } - - public void ReadData(byte[] data, ref int pointer) - { - NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); - Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); - Data = new byte[Length]; - for (int i = 0; i < Length; i++) - { - Data[i] = data[pointer++]; - } - } - - public void Print() - { - Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); - } - } - } - - private class AttributeInfo - { - public void ReadData(byte[] data, ref int i) - { - - } - } - #endregion - - } -} \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs deleted file mode 100644 index c6423fc..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class Heap - { - public List ClassObjects = new List(); - - public Heap() - { - - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs deleted file mode 100644 index ef6570d..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs +++ /dev/null @@ -1,551 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Scripting.EmbeddedJVM.Types; -using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - partial class Thread - { - private partial class Interpreter - { - private bool IsLogicOpCode(byte opcode) - { - bool result = false; - switch (opcode) - { - case (byte)(byte)OpCode.iconst_m1: - Int m_int = new Int(); - m_int.mValue = -1; - this.m_thread.m_currentFrame.OpStack.Push(m_int); - result = true; - break; - case (byte)(byte)OpCode.iconst_0: - m_int = new Int(); - m_int.mValue = 0; - this.m_thread.m_currentFrame.OpStack.Push(m_int); - result = true; - break; - case (byte)(byte)OpCode.iconst_1: - m_int = new Int(); - m_int.mValue = 1; - this.m_thread.m_currentFrame.OpStack.Push(m_int); - result = true; - break; - case (byte)(byte)OpCode.iconst_2: - m_int = new Int(); - m_int.mValue = 2; - this.m_thread.m_currentFrame.OpStack.Push(m_int); - result = true; - break; - case (byte)(byte)OpCode.iconst_3: - m_int = new Int(); - m_int.mValue = 3; - this.m_thread.m_currentFrame.OpStack.Push(m_int); - break; - case (byte)(byte)OpCode.iconst_4: - m_int = new Int(); - m_int.mValue = 4; - this.m_thread.m_currentFrame.OpStack.Push(m_int); - result = true; - break; - case (byte)OpCode.iconst_5: - m_int = new Int(); - m_int.mValue = 5; - this.m_thread.m_currentFrame.OpStack.Push(m_int); - result = true; - break; - case (byte)OpCode.fconst_0: - Float m_float = new Float(); - m_float.mValue = 0.0f; - this.m_thread.m_currentFrame.OpStack.Push(m_float); - result = true; - break; - case (byte)OpCode.fconst_1: - m_float = new Float(); - m_float.mValue = 1.0f; - this.m_thread.m_currentFrame.OpStack.Push(m_float); - result = true; - break; - case (byte)OpCode.fconst_2: - m_float = new Float(); - m_float.mValue = 2.0f; - this.m_thread.m_currentFrame.OpStack.Push(m_float); - result = true; - break; - case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? - int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]; - Int pushInt = new Int(); - pushInt.mValue = pushvalue; - this.m_thread.m_currentFrame.OpStack.Push(pushInt); - this.m_thread.PC++; - result = true; - break; - case (byte)OpCode.sipush: - short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - Int pushInt2 = new Int(); - pushInt2.mValue = pushvalue2; - this.m_thread.m_currentFrame.OpStack.Push(pushInt2); - this.m_thread.PC += 2; - result = true; - break; - case (byte)OpCode.fload: - short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); - Float fload = new Float(); - if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) - { - fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(fload); - } - } - this.m_thread.PC++; - result = true; - break; - case (byte)OpCode.iload_0: - if (this.m_thread.m_currentFrame.LocalVariables[0] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) - { - Int newInt = new Int(); - newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newInt); - } - } - result = true; - break; - case (byte)OpCode.iload_1: - if (this.m_thread.m_currentFrame.LocalVariables[1] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) - { - Int newInt = new Int(); - newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newInt); - } - } - result = true; - break; - case (byte)OpCode.fload_0: - if (this.m_thread.m_currentFrame.LocalVariables[0] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) - { - Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); - } - } - result = true; - break; - case (byte)OpCode.fload_1: - if (this.m_thread.m_currentFrame.LocalVariables[1] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) - { - Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); - } - } - result = true; - break; - case (byte)OpCode.fload_2: - if (this.m_thread.m_currentFrame.LocalVariables[2] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) - { - Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); - } - } - result = true; - break; - case (byte)OpCode.fload_3: - if (this.m_thread.m_currentFrame.LocalVariables[3] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) - { - Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); - } - } - result = true; - break; - case (byte)OpCode.istore: - short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); - BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); - if (istor is Int) - { - this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor; - } - this.m_thread.PC++; - result = true; - break; - case (byte)OpCode.fstore: - short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); - BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); - if (fstor is Float) - { - this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor; - } - this.m_thread.PC++; - result = true; - break; - case (byte)OpCode.istore_0: - BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop(); - if (baset is Int) - { - this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset; - } - result = true; - break; - case (byte)OpCode.istore_1: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); - if (baset is Int) - { - this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset; - } - result = true; - break; - case (byte)OpCode.fstore_0: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); - if (baset is Float) - { - this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset; - } - result = true; - break; - case (byte)OpCode.fstore_1: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); - if (baset is Float) - { - this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset; - } - result = true; - break; - case (byte)OpCode.fstore_2: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); - if (baset is Float) - { - this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset; - } - result = true; - break; - case (byte)OpCode.fstore_3: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); - if (baset is Float) - { - this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset; - } - result = true; - break; - case (byte)OpCode.pop: - this.m_thread.m_currentFrame.OpStack.Pop(); - result = true; - break; - case (byte)OpCode.fadd: - BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (bf1 is Float && bf2 is Float) - { - Float nflt = new Float(); - nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; - this.m_thread.m_currentFrame.OpStack.Push(nflt); - } - result = true; - break; - case (byte)OpCode.fsub: - BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (bsf1 is Float && bsf2 is Float) - { - Float resf = new Float(); - resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; - this.m_thread.m_currentFrame.OpStack.Push(resf); - } - result = true; - break; - case (byte)OpCode.imul: //check the order of the two values off the stack is correct - BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (bs1 is Int && bs2 is Int) - { - Int nInt = new Int(); - nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; - this.m_thread.m_currentFrame.OpStack.Push(nInt); - } - result = true; - break; - case (byte)OpCode.iinc: - if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null) - { - if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) - { - ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]; - } - } - this.m_thread.PC += 2; - result = true; - break; - case (byte)OpCode.f2i: - BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (conv1 is Float) - { - Int newconv = new Int(); - newconv.mValue = (int)((Float)conv1).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newconv); - } - result = true; - break; - case (byte)OpCode.fcmpl: - BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (flcom1 is Float && flcom2 is Float) - { - Int compres = new Int(); - if (((Float)flcom1).mValue < ((Float)flcom2).mValue) - { - compres.mValue = -1; - } - else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) - { - compres.mValue = 1; - } - else - { - compres.mValue = 0; - } - this.m_thread.m_currentFrame.OpStack.Push(compres); - } - result = true; - break; - case (byte)OpCode.fcmpg: - flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); - flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (flcom1 is Float && flcom2 is Float) - { - Int compres = new Int(); - if (((Float)flcom1).mValue < ((Float)flcom2).mValue) - { - compres.mValue = -1; - } - else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) - { - compres.mValue = 1; - } - else - { - compres.mValue = 0; - } - this.m_thread.m_currentFrame.OpStack.Push(compres); - } - result = true; - break; - case (byte)OpCode.ifge: - short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (compe1 is Int) - { - if (((Int)compe1).mValue >= 0) - { - this.m_thread.PC += -1 + compareoffset2; - } - else - { - this.m_thread.PC += 2; - } - } - else - { - this.m_thread.PC += 2; - } - result = true; - break; - case (byte)OpCode.ifle: - short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (comp1 is Int) - { - if (((Int)comp1).mValue <= 0) - { - this.m_thread.PC += -1 + compareoffset1; - } - else - { - this.m_thread.PC += 2; - } - } - else - { - this.m_thread.PC += 2; - } - result = true; - break; - case (byte)OpCode.if_icmpge: - short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (bc1 is Int && bc2 is Int) - { - //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); - if (((Int)bc1).mValue >= ((Int)bc2).mValue) - { - // Console.WriteLine("branch compare true , offset is " +compareoffset); - // Console.WriteLine("current PC is " + this._mThread.PC); - this.m_thread.PC += -1 + compareoffset; - //Console.WriteLine("new PC is " + this._mThread.PC); - } - else - { - //Console.WriteLine("branch compare false"); - this.m_thread.PC += 2; - } - } - else - { - this.m_thread.PC += 2; - } - result = true; - break; - case (byte)OpCode.if_icmple: - short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); - if (bcl1 is Int && bcl2 is Int) - { - //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); - if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) - { - // Console.WriteLine("branch compare true , offset is " + compareloffset); - // Console.WriteLine("current PC is " + this._mThread.PC); - this.m_thread.PC += -1 + compareloffset; - // Console.WriteLine("new PC is " + this._mThread.PC); - } - else - { - //Console.WriteLine("branch compare false"); - this.m_thread.PC += 2; - } - } - else - { - this.m_thread.PC += 2; - } - result = true; - break; - case (byte)OpCode._goto: - short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - this.m_thread.PC += -1 + offset; - result = true; - break; - case (byte)OpCode.getstatic: - short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) - { - if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) - { - //from this class - if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) - { - if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) - { - Float retFloat = new Float(); - retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(retFloat); - } - else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) - { - Int retInt = new Int(); - retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; - // Console.WriteLine("getting static field, " + retInt.mValue); - this.m_thread.m_currentFrame.OpStack.Push(retInt); - } - } - } - else - { - //get from a different class - } - } - this.m_thread.PC += 2; - result = true; - break; - case (byte)OpCode.putstatic: - fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); - if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) - { - if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) - { - // this class - if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) - { - if (addstatic is Float) - { - if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) - { - Float newf = new Float(); - newf.mValue = ((Float)addstatic).mValue; - this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; - } - } - else if (addstatic is Int) - { - if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) - { - //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); - Int newi = new Int(); - newi.mValue = ((Int)addstatic).mValue; - this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; - } - } - } - } - else - { - // a different class - } - } - this.m_thread.PC += 2; - result = true; - break; - - } - - return result; - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs deleted file mode 100644 index 42fd299..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs +++ /dev/null @@ -1,96 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Scripting.EmbeddedJVM.Types; -using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; -using OpenSim.Framework.Types; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - partial class Thread - { - private partial class Interpreter - { - private bool IsMethodOpCode(byte opcode) - { - bool result = false; - switch (opcode) - { - case 184: - short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); - if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) - { - string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; - string typeparam = ""; - string typereturn = ""; - int firstbrak = 0; - int secondbrak = 0; - firstbrak = typ.LastIndexOf('('); - secondbrak = typ.LastIndexOf(')'); - typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); - typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); - if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) - { - //calling a method in this class - if (typeparam.Length == 0) - { - this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); - } - else - { - this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); - } - } - else - { - //calling a method of a different class - - // OpenSimAPI Class - if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") - { - this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); - } - } - } - else - { - this.m_thread.PC += 2; - } - result = true; - break; - } - - return result; - } - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs deleted file mode 100644 index 3c18a11..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - partial class Thread - { - private partial class Interpreter - { - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs deleted file mode 100644 index e718328..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Scripting.EmbeddedJVM.Types; -using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - partial class Thread - { - private partial class Interpreter - { - private Thread m_thread; - - public Interpreter(Thread parentThread) - { - m_thread = parentThread; - } - - public bool Excute() - { - bool run = true; - byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; - // Console.WriteLine("opCode is: " + currentOpCode); - bool handled = false; - - handled = this.IsLogicOpCode(currentOpCode); - if (!handled) - { - handled = this.IsMethodOpCode(currentOpCode); - } - if (!handled) - { - if (currentOpCode == 172) - { - if (this.m_thread.stack.StackFrames.Count > 1) - { - Console.WriteLine("returning int from function"); - int retPC1 = this.m_thread.m_currentFrame.ReturnPC; - BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); - this.m_thread.stack.StackFrames.Pop(); - this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); - this.m_thread.PC = retPC1; - if (bas1 is Int) - { - this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); - } - } - else - { - // Console.WriteLine("No parent function so ending program"); - this.m_thread.stack.StackFrames.Pop(); - run = false; - } - handled = true; - } - if (currentOpCode == 174) - { - if (this.m_thread.stack.StackFrames.Count > 1) - { - Console.WriteLine("returning float from function"); - int retPC1 = this.m_thread.m_currentFrame.ReturnPC; - BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); - this.m_thread.stack.StackFrames.Pop(); - this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); - this.m_thread.PC = retPC1; - if (bas1 is Float) - { - this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); - } - } - else - { - // Console.WriteLine("No parent function so ending program"); - this.m_thread.stack.StackFrames.Pop(); - run = false; - } - handled = true; - } - if (currentOpCode == 177) - { - if (this.m_thread.stack.StackFrames.Count > 1) - { - Console.WriteLine("returning from function"); - int retPC = this.m_thread.m_currentFrame.ReturnPC; - this.m_thread.stack.StackFrames.Pop(); - this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); - this.m_thread.PC = retPC; - } - else - { - // Console.WriteLine("No parent function so ending program"); - this.m_thread.stack.StackFrames.Pop(); - run = false; - } - handled = true; - } - } - if (!handled) - { - Console.WriteLine("opcode " + currentOpCode + " not been handled "); - } - return run; - - } - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs deleted file mode 100644 index 7174975..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class MainMemory - { - public Heap HeapArea; - public MethodMemory MethodArea; - - public MainMemory() - { - MethodArea = new MethodMemory(); - HeapArea = new Heap(); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs deleted file mode 100644 index 5f29091..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class MethodMemory - { - public byte[] MethodBuffer; - public List Classes = new List(); - public int NextMethodPC = 0; - public int Methodcount = 0; - - public MethodMemory() - { - MethodBuffer = new byte[20000]; - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs deleted file mode 100644 index 8acb2bd..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class Object - { - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs deleted file mode 100644 index 22a9f12..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/OpCodes.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public enum OpCode : byte - { - iconst_m1 = 2, - iconst_0 = 3, - iconst_1 = 4, - iconst_2 = 5, - iconst_3 = 6, - iconst_4 = 7, - iconst_5 = 8, - fconst_0 = 11, - fconst_1 = 12, - fconst_2 = 13, - bipush = 16, - sipush = 17, - fload = 23, - iload_0 = 26, - iload_1 = 27, - fload_0 = 34, - fload_1 = 35, - fload_2 = 36, - fload_3 = 37, - istore = 54, - fstore = 56, - istore_0 = 59, - istore_1 = 60, - istore_2 = 61, - istore_3 = 62, - fstore_0 = 67, - fstore_1 = 68, - fstore_2 = 69, - fstore_3 = 70, - pop = 87, - fadd = 98, - fsub = 102, - imul = 104, - iinc = 132, - f2i = 139, - fcmpl = 149, - fcmpg = 150, - ifge = 156, - ifgt = 157, - ifle = 158, - if_icmpge = 162, - if_icmpgt = 163, - if_icmple = 164, - _goto = 167, - getstatic = 178, - putstatic = 179 - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs deleted file mode 100644 index 7c12678..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class Stack - { - public Stack StackFrames = new Stack(); - - public Stack() - { - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs deleted file mode 100644 index 76257b8..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Scripting.EmbeddedJVM.Types; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class StackFrame - { - public BaseType[] LocalVariables; - public Stack OpStack = new Stack(); - - public int ReturnPC = 0; - public ClassRecord CallingClass = null; - - public StackFrame() - { - LocalVariables = new BaseType[20]; - } - - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs deleted file mode 100644 index aad1f47..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs +++ /dev/null @@ -1,119 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Scripting.EmbeddedJVM.Types; -using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Scripting; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public partial class Thread - { - // Is this smart? - public static MainMemory GlobalMemory; - public static Scene World; - private int PC = 0; - private Stack stack; - private Interpreter m_Interpreter; - public ClassRecord currentClass; - public ClassInstance currentInstance; - private StackFrame m_currentFrame; - public int excutionCounter = 0; - public bool running = false; - - public ScriptInfo scriptInfo; - - public Thread() - { - this.m_Interpreter = new Interpreter(this); - this.stack = new Stack(); - } - - public void SetPC(int methodpointer) - { - //Console.WriteLine("Thread PC has been set to " + methodpointer); - PC = methodpointer; - } - - public void StartMethod(ClassRecord rec, string methName) - { - m_currentFrame = new StackFrame(); - this.stack.StackFrames.Push(m_currentFrame); - this.currentClass = rec; - currentClass.StartMethod(this, methName); - } - - public void StartMethod( string methName) - { - m_currentFrame = new StackFrame(); - this.stack.StackFrames.Push(m_currentFrame); - currentClass.StartMethod(this, methName); - } - - public void JumpToStaticVoidMethod(string methName, int returnPC) - { - m_currentFrame = new StackFrame(); - m_currentFrame.ReturnPC = returnPC; - this.stack.StackFrames.Push(m_currentFrame); - currentClass.StartMethod(this, methName); - } - - public void JumpToStaticParamMethod(string methName, string param, int returnPC) - { - if (param == "I") - { - BaseType bs1 = m_currentFrame.OpStack.Pop(); - m_currentFrame = new StackFrame(); - m_currentFrame.ReturnPC = returnPC; - this.stack.StackFrames.Push(m_currentFrame); - m_currentFrame.LocalVariables[0] = ((Int)bs1); - currentClass.StartMethod(this, methName); - } - if (param == "F") - { - - } - } - - public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) - { - - } - - public bool Excute() - { - excutionCounter++; - return this.m_Interpreter.Excute(); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs deleted file mode 100644 index 58cdf49..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using OpenSim.Region.Scripting; -using OpenSim.Region.Scripting.EmbeddedJVM; - -namespace OpenSim.Region.Scripting -{ - public class JavaEngine : IScriptCompiler - { - public string FileExt() - { - return ".java"; - } - - public Dictionary compile(string filename) - { - JVMScript script = new JVMScript(); - Dictionary returns = new Dictionary(); - - script.LoadScript(filename); - - returns.Add(filename, script); - - return returns; - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs deleted file mode 100644 index 78c6f67..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs +++ /dev/null @@ -1,170 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Threading; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Utilities; -using OpenSim.Region.Scripting; -using OpenSim.Region.Environment.Scenes; - -namespace OpenSim.Region.Scripting.EmbeddedJVM -{ - public class JVMScript : IScript - { - private List _threads = new List(); - private BlockingQueue CompileScripts = new BlockingQueue(); - private MainMemory _mainMemory; - - ScriptInfo scriptInfo; - - public void Initialise(ScriptInfo info) - { - scriptInfo = info; - - _mainMemory = new MainMemory(); - Thread.GlobalMemory = this._mainMemory; - Thread.World = info.world; - CompileScript(); - - scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); - scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); - } - - void events_OnNewPresence(ScenePresence presence) - { - for (int i = 0; i < this._threads.Count; i++) - { - if (!this._threads[i].running) - { - this._threads[i].StartMethod("OnNewPresence"); - bool run = true; - while (run) - { - run = this._threads[i].Excute(); - } - } - } - } - - void events_OnFrame() - { - for (int i = 0; i < this._threads.Count; i++) - { - if (!this._threads[i].running) - { - this._threads[i].StartMethod("OnFrame"); - bool run = true; - while (run) - { - run = this._threads[i].Excute(); - } - } - } - } - - public string getName() - { - return "JVM Scripting Engine"; - } - - public void LoadScript(string script) - { - Console.WriteLine("OpenSimJVM - loading new script: " + script); - CompileInfo comp = new CompileInfo(); - comp.script = script; - comp.scriptName = script; - this.CompileScripts.Enqueue(comp); - } - - public void CompileScript() - { - CompileInfo comp = this.CompileScripts.Dequeue(); - string script = comp.script; - string scriptName = comp.scriptName; - try - { - //need to compile the script into a java class file - - //first save it to a java source file - TextWriter tw = new StreamWriter(scriptName + ".java"); - tw.WriteLine(script); - tw.Close(); - - //now compile - System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); - // psi.RedirectStandardOutput = true; - psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; - psi.UseShellExecute = false; - - System.Diagnostics.Process javacomp; - javacomp = System.Diagnostics.Process.Start(psi); - javacomp.WaitForExit(); - - - //now load in class file - ClassRecord class1 = new ClassRecord(); - class1.LoadClassFromFile(scriptName + ".class"); - class1.PrintToConsole(); - //Console.WriteLine(); - this._mainMemory.MethodArea.Classes.Add(class1); - class1.AddMethodsToMemory(this._mainMemory.MethodArea); - - Thread newThread = new Thread(); - this._threads.Add(newThread); - newThread.currentClass = class1; - newThread.scriptInfo = scriptInfo; - - //now delete the created files - System.IO.File.Delete(scriptName + ".java"); - System.IO.File.Delete(scriptName + ".class"); - //this.OnFrame(); - } - catch (Exception e) - { - Console.WriteLine("exception"); - Console.WriteLine(e.StackTrace); - Console.WriteLine(e.Message); - } - } - - private class CompileInfo - { - public string script; - public string scriptName; - - public CompileInfo() - { - - } - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs deleted file mode 100644 index 0c4d623..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM.Types -{ - public class ArrayReference :BaseType - { - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs deleted file mode 100644 index 7fc0a4f..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM.Types -{ - public class BaseType : Object - { - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs deleted file mode 100644 index 7718765..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM.Types -{ - public class ObjectReference : BaseType - { - public ushort Reference; - - public ObjectReference() - { - - } - } -} 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes -{ - public class Byte : BaseType - { - } -} 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes -{ - public class Char : BaseType - { - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs deleted file mode 100644 index 982e748..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes -{ - public class Float : BaseType - { - public float mValue = 0; - - public Float() - { - - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs deleted file mode 100644 index 073a9b3..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes -{ - public class Int : BaseType - { - public int mValue = 0; - - public Int() - { - - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Common.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Common.cs deleted file mode 100644 index 554ba1a..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Common.cs +++ /dev/null @@ -1,84 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.LSL -{ - public static class Common - { - static public bool Debug = true; - static public bool IL_UseTryCatch = true; - static public bool IL_CreateConstructor = true; - static public bool IL_CreateFunctionList = true; - static public bool IL_ProcessCodeChunks = true; - - public delegate void SendToDebugEventDelegate(string Message); - public delegate void SendToLogEventDelegate(string Message); - static public event SendToDebugEventDelegate SendToDebugEvent; - static public event SendToLogEventDelegate SendToLogEvent; - - static public void SendToDebug(string Message) - { - //if (Debug == true) - Console.WriteLine("Debug: " + Message); - SendToDebugEvent(DateTime.Now.ToString("[HH:mm:ss] ") + Message + "\r\n"); - } - static public void SendToLog(string Message) - { - //if (Debug == true) - Console.WriteLine("LOG: " + Message); - SendToLogEvent(DateTime.Now.ToString("[HH:mm:ss] ") + Message + "\r\n"); - } - } - - // TEMPORARY TEST THINGIES - public static class IL_Helper - { - public static string ReverseFormatString(string text1, string format) - { - Common.SendToDebug("ReverseFormatString text1: " + text1); - Common.SendToDebug("ReverseFormatString format: " + format); - return string.Format(format, text1); - } - public static string ReverseFormatString(string text1, UInt32 text2, string format) - { - Common.SendToDebug("ReverseFormatString text1: " + text1); - Common.SendToDebug("ReverseFormatString text2: " + text2.ToString()); - Common.SendToDebug("ReverseFormatString format: " + format); - return string.Format(format, text1, text2.ToString()); - } - public static string Cast_ToString(object obj) - { - Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); - return "ABCDEFGIHJKLMNOPQ123"; - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs deleted file mode 100644 index 5cd1f71..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs +++ /dev/null @@ -1,228 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; - using System.Reflection; - using System.Reflection.Emit; - using System.Threading; - - namespace OpenSim.Region.Scripting.LSL - { - - - public class Engine - { - //private string LSO_FileName = @"LSO\AdditionTest.lso"; - private string LSO_FileName;// = @"LSO\CloseToDefault.lso"; - AppDomain appDomain; - - public void Start(string FileName) - { - LSO_FileName = FileName; - - - //appDomain = AppDomain.CreateDomain("AlternateAppDomain"); - appDomain = Thread.GetDomain(); - - // Create Assembly Name - AssemblyName asmName = new AssemblyName(); - asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName); - //asmName.Name = "TestAssembly"; - - string DLL_FileName = asmName.Name + ".dll"; - string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(FileName) + @"\" + DLL_FileName; - - Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(FileName)); - Common.SendToLog("Assembly name: " + asmName.Name); - Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); - Common.SendToLog("Starting processing of LSL ByteCode..."); - Common.SendToLog(""); - - - - // Create Assembly - AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( - asmName, - AssemblyBuilderAccess.RunAndSave - ); - //// Create Assembly - //AssemblyBuilder asmBuilder = - // Thread.GetDomain().DefineDynamicAssembly - //(asmName, AssemblyBuilderAccess.RunAndSave); - - // Create a module (and save to disk) - ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule - (asmName.Name, - DLL_FileName); - - //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); - // Create a Class (/Type) - TypeBuilder typeBuilder = modBuilder.DefineType( - "LSL_ScriptObject", - TypeAttributes.Public | TypeAttributes.BeforeFieldInit); - //, - // typeof()); - //, typeof(LSL_BuiltIn_Commands_Interface)); - //, - // typeof(object), - // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); - - - if (Common.IL_CreateConstructor) - IL_CREATE_CONSTRUCTOR(typeBuilder); - - - /* - * Generate the IL itself - */ - - LSO_Parser LSOP = new LSO_Parser(); - LSOP.ParseFile(LSO_FileName, typeBuilder); - - /* - * Done generating. Create a type and run it. - */ - - - - Common.SendToLog("Attempting to compile assembly..."); - // Compile it - Type type = typeBuilder.CreateType(); - Common.SendToLog("Compilation successful!"); - - Common.SendToLog("Saving assembly: " + DLL_FileName); - asmBuilder.Save(DLL_FileName); - - - Common.SendToLog("Creating an instance of new assembly..."); - // Create an instance we can play with - //LSLScript hello = (LSLScript)Activator.CreateInstance(type); - //LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); - object MyScript = (object)Activator.CreateInstance(type); - - - Common.SendToLog(""); - - System.Reflection.MemberInfo[] Members = type.GetMembers(); - - Common.SendToLog("Members of assembly " + type.ToString () + ":"); - foreach (MemberInfo member in Members ) - Common.SendToLog(member.ToString()); - - - // Play with it - //MyScript.event_state_entry("Test"); - object[] args = { null } ; - //System.Collections.Generic.List Functions = (System.Collections.Generic.List)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); - - string[] ret = { }; - if (Common.IL_CreateFunctionList) - ret = (string[])type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); - - foreach (string s in ret) - { - Common.SendToLog(""); - Common.SendToLog("*** Executing LSL Server Event: " + s); - //object test = type.GetMember(s); - //object runner = type.InvokeMember(s, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, MyScript, args); - //runner(); - //objBooks_Late = type.InvokeMember(s, BindingFlags.CreateInstance, null, objApp_Late, null); - type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); - - } - - } - - - private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder) - { - - - Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); - //ConstructorBuilder constructor = typeBuilder.DefineConstructor( - // MethodAttributes.Public, - // CallingConventions.Standard, - // new Type[0]); - ConstructorBuilder constructor = typeBuilder.DefineConstructor( - MethodAttributes.Public | - MethodAttributes.SpecialName | - MethodAttributes.RTSpecialName, - CallingConventions.Standard, - new Type[0]); - - //Define the reflection ConstructorInfor for System.Object - ConstructorInfo conObj = typeof(object).GetConstructor(new Type[0]); - - //call constructor of base object - ILGenerator il = constructor.GetILGenerator(); - - Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: UInt32 State = 0;"); - string FieldName; - // Create state object - FieldName = "State"; - FieldBuilder State_fb = typeBuilder.DefineField( - FieldName, - typeof(UInt32), - FieldAttributes.Public); - il.Emit(OpCodes.Ldarg_0); - il.Emit(OpCodes.Ldc_I4, 0); - il.Emit(OpCodes.Stfld, State_fb); - - - Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: LSL_BuiltIn_Commands_TestImplementation LSL_BuiltIns = New LSL_BuiltIn_Commands_TestImplementation();"); - //Type objType1 = typeof(object); - Type objType1 = typeof(LSL_BuiltIn_Commands_TestImplementation); - - FieldName = "LSL_BuiltIns"; - FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField( - FieldName, - objType1, - FieldAttributes.Public); - - //LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation(); - il.Emit(OpCodes.Ldarg_0); - //il.Emit(OpCodes.Ldstr, "Test 123"); - il.Emit(OpCodes.Newobj, objType1.GetConstructor(new Type[] { })); - il.Emit(OpCodes.Stfld, LSL_BuiltIns_fb); - - il.Emit(OpCodes.Ldarg_0); - il.Emit(OpCodes.Call, conObj); - - - - ////il.Emit(OpCodes.Newobj, typeof(UInt32)); - //il.Emit(OpCodes.Starg_0); - //// Create LSL function library - //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField("LSL_BuiltIns", typeof(LSL_BuiltIn_Commands_Interface), FieldAttributes.Public); - //il.Emit(OpCodes.Newobj, typeof(LSL_BuiltIn_Commands_Interface)); - //il.Emit(OpCodes.Stloc_1); - - il.Emit(OpCodes.Ret); - } - } - } diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/IL_common_functions.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/IL_common_functions.cs deleted file mode 100644 index 2f23a91..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/IL_common_functions.cs +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.Reflection.Emit; - -namespace OpenSim.Region.Scripting.LSL -{ - partial class LSO_Parser - { - private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) - { - TypeBuilder typeBuilder = modBuilder.DefineType(typeName, - TypeAttributes.Public | - TypeAttributes.Class | - TypeAttributes.AutoClass | - TypeAttributes.AnsiClass | - TypeAttributes.BeforeFieldInit | - TypeAttributes.AutoLayout, - typeof(object), - new Type[] { typeof(object) }); - return typeBuilder; - - } - - - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_Interface.cs deleted file mode 100644 index d8a0ce3..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_Interface.cs +++ /dev/null @@ -1,366 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; - using System.Collections.Generic; - using System.Text; - - namespace OpenSim.Region.Scripting.LSL - { - public interface LSL_BuiltIn_Commands_Interface - { - void llSin(); - void llCos(); - void llTan(); - void llAtan2(); - void llSqrt(); - void llPow(); - void llAbs(); - void llFabs(); - void llFrand(); - void llFloor(); - void llCeil(); - void llRound(); - void llVecMag(); - void llVecNorm(); - void llVecDist(); - void llRot2Euler(); - void llEuler2Rot(); - void llAxes2Rot(); - void llRot2Fwd(); - void llRot2Left(); - void llRot2Up(); - void llRotBetween(); - void llWhisper(); - void llSay(UInt32 channelID, string text); - void llShout(); - void llListen(); - void llListenControl(); - void llListenRemove(); - void llSensor(); - void llSensorRepeat(); - void llSensorRemove(); - void llDetectedName(); - void llDetectedKey(); - void llDetectedOwner(); - void llDetectedType(); - void llDetectedPos(); - void llDetectedVel(); - void llDetectedGrab(); - void llDetectedRot(); - void llDetectedGroup(); - void llDetectedLinkNumber(); - void llDie(); - void llGround(); - void llCloud(); - void llWind(); - void llSetStatus(); - void llGetStatus(); - void llSetScale(); - void llGetScale(); - void llSetColor(); - void llGetAlpha(); - void llSetAlpha(); - void llGetColor(); - void llSetTexture(); - void llScaleTexture(); - void llOffsetTexture(); - void llRotateTexture(); - void llGetTexture(); - void llSetPos(); - void llGetPos(); - void llGetLocalPos(); - void llSetRot(); - void llGetRot(); - void llGetLocalRot(); - void llSetForce(); - void llGetForce(); - void llTarget(); - void llTargetRemove(); - void llRotTarget(); - void llRotTargetRemove(); - void llMoveToTarget(); - void llStopMoveToTarget(); - void llApplyImpulse(); - void llApplyRotationalImpulse(); - void llSetTorque(); - void llGetTorque(); - void llSetForceAndTorque(); - void llGetVel(); - void llGetAccel(); - void llGetOmega(); - void llGetTimeOfDay(); - void llGetWallclock(); - void llGetTime(); - void llResetTime(); - void llGetAndResetTime(); - void llSound(); - void llPlaySound(); - void llLoopSound(); - void llLoopSoundMaster(); - void llLoopSoundSlave(); - void llPlaySoundSlave(); - void llTriggerSound(); - void llStopSound(); - void llPreloadSound(); - void llGetSubString(); - void llDeleteSubString(); - void llInsertString(); - void llToUpper(); - void llToLower(); - void llGiveMoney(); - void llMakeExplosion(); - void llMakeFountain(); - void llMakeSmoke(); - void llMakeFire(); - void llRezObject(); - void llLookAt(); - void llStopLookAt(); - void llSetTimerEvent(); - void llSleep(); - void llGetMass(); - void llCollisionFilter(); - void llTakeControls(); - void llReleaseControls(); - void llAttachToAvatar(); - void llDetachFromAvatar(); - void llTakeCamera(); - void llReleaseCamera(); - void llGetOwner(); - void llInstantMessage(); - void llEmail(); - void llGetNextEmail(); - void llGetKey(); - void llSetBuoyancy(); - void llSetHoverHeight(); - void llStopHover(); - void llMinEventDelay(); - void llSoundPreload(); - void llRotLookAt(); - void llStringLength(); - void llStartAnimation(); - void llStopAnimation(); - void llPointAt(); - void llStopPointAt(); - void llTargetOmega(); - void llGetStartParameter(); - void llGodLikeRezObject(); - void llRequestPermissions(); - void llGetPermissionsKey(); - void llGetPermissions(); - void llGetLinkNumber(); - void llSetLinkColor(); - void llCreateLink(); - void llBreakLink(); - void llBreakAllLinks(); - void llGetLinkKey(); - void llGetLinkName(); - void llGetInventoryNumber(); - void llGetInventoryName(); - void llSetScriptState(); - void llGetEnergy(); - void llGiveInventory(); - void llRemoveInventory(); - void llSetText(); - void llWater(); - void llPassTouches(); - void llRequestAgentData(); - void llRequestInventoryData(); - void llSetDamage(); - void llTeleportAgentHome(); - void llModifyLand(); - void llCollisionSound(); - void llCollisionSprite(); - void llGetAnimation(); - void llResetScript(); - void llMessageLinked(); - void llPushObject(); - void llPassCollisions(); - void llGetScriptName(); - void llGetNumberOfSides(); - void llAxisAngle2Rot(); - void llRot2Axis(); - void llRot2Angle(); - void llAcos(); - void llAsin(); - void llAngleBetween(); - void llGetInventoryKey(); - void llAllowInventoryDrop(); - void llGetSunDirection(); - void llGetTextureOffset(); - void llGetTextureScale(); - void llGetTextureRot(); - void llSubStringIndex(); - void llGetOwnerKey(); - void llGetCenterOfMass(); - void llListSort(); - void llGetListLength(); - void llList2Integer(); - void llList2Float(); - void llList2String(); - void llList2Key(); - void llList2Vector(); - void llList2Rot(); - void llList2List(); - void llDeleteSubList(); - void llGetListEntryType(); - void llList2CSV(); - void llCSV2List(); - void llListRandomize(); - void llList2ListStrided(); - void llGetRegionCorner(); - void llListInsertList(); - void llListFindList(); - void llGetObjectName(); - void llSetObjectName(); - void llGetDate(); - void llEdgeOfWorld(); - void llGetAgentInfo(); - void llAdjustSoundVolume(); - void llSetSoundQueueing(); - void llSetSoundRadius(); - void llKey2Name(); - void llSetTextureAnim(); - void llTriggerSoundLimited(); - void llEjectFromLand(); - void llParseString2List(); - void llOverMyLand(); - void llGetLandOwnerAt(); - void llGetNotecardLine(); - void llGetAgentSize(); - void llSameGroup(); - void llUnSit(); - void llGroundSlope(); - void llGroundNormal(); - void llGroundContour(); - void llGetAttached(); - void llGetFreeMemory(); - void llGetRegionName(); - void llGetRegionTimeDilation(); - void llGetRegionFPS(); - void llParticleSystem(); - void llGroundRepel(); - void llGiveInventoryList(); - void llSetVehicleType(); - void llSetVehicleFloatParam(); - void llSetVehicleVectorParam(); - void llSetVehicleRotationParam(); - void llSetVehicleFlags(); - void llRemoveVehicleFlags(); - void llSitTarget(); - void llAvatarOnSitTarget(); - void llAddToLandPassList(); - void llSetTouchText(); - void llSetSitText(); - void llSetCameraEyeOffset(); - void llSetCameraAtOffset(); - void llDumpList2String(); - void llScriptDanger(); - void llDialog(); - void llVolumeDetect(); - void llResetOtherScript(); - void llGetScriptState(); - void llRemoteLoadScript(); - void llSetRemoteScriptAccessPin(); - void llRemoteLoadScriptPin(); - void llOpenRemoteDataChannel(); - void llSendRemoteData(); - void llRemoteDataReply(); - void llCloseRemoteDataChannel(); - void llMD5String(); - void llSetPrimitiveParams(); - void llStringToBase64(); - void llBase64ToString(); - void llXorBase64Strings(); - void llRemoteDataSetRegion(); - void llLog10(); - void llLog(); - void llGetAnimationList(); - void llSetParcelMusicURL(); - void llGetRootPosition(); - void llGetRootRotation(); - void llGetObjectDesc(); - void llSetObjectDesc(); - void llGetCreator(); - void llGetTimestamp(); - void llSetLinkAlpha(); - void llGetNumberOfPrims(); - void llGetNumberOfNotecardLines(); - void llGetBoundingBox(); - void llGetGeometricCenter(); - void llGetPrimitiveParams(); - void llIntegerToBase64(); - void llBase64ToInteger(); - void llGetGMTclock(); - void llGetSimulatorHostname(); - void llSetLocalRot(); - void llParseStringKeepNulls(); - void llRezAtRoot(); - void llGetObjectPermMask(); - void llSetObjectPermMask(); - void llGetInventoryPermMask(); - void llSetInventoryPermMask(); - void llGetInventoryCreator(); - void llOwnerSay(); - void llRequestSimulatorData(); - void llForceMouselook(); - void llGetObjectMass(); - void llListReplaceList(); - void llLoadURL(); - void llParcelMediaCommandList(); - void llParcelMediaQuery(); - void llModPow(); - void llGetInventoryType(); - void llSetPayPrice(); - void llGetCameraPos(); - void llGetCameraRot(); - void llSetPrimURL(); - void llRefreshPrimURL(); - void llEscapeURL(); - void llUnescapeURL(); - void llMapDestination(); - void llAddToLandBanList(); - void llRemoveFromLandPassList(); - void llRemoveFromLandBanList(); - void llSetCameraParams(); - void llClearCameraParams(); - void llListStatistics(); - void llGetUnixTime(); - void llGetParcelFlags(); - void llGetRegionFlags(); - void llXorBase64StringsCorrect(); - void llHTTPRequest(); - void llResetLandBanList(); - void llResetLandPassList(); - void llGetParcelPrimCount(); - void llGetParcelPrimOwners(); - void llGetObjectPrimCount(); - void llGetParcelMaxPrims(); - void llGetParcelDetails(); - } - } diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_TestImplementation.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_TestImplementation.cs deleted file mode 100644 index 4b0fa7e..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_BuiltIn_Commands_TestImplementation.cs +++ /dev/null @@ -1,377 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.LSL -{ - public class LSL_BuiltIn_Commands_TestImplementation: LSL_BuiltIn_Commands_Interface - { - public LSL_BuiltIn_Commands_TestImplementation() - { - Common.SendToDebug("LSL_BuiltIn_Commands_TestImplementation: Creating object"); - } - - public void llSin() { } - public void llCos() { } - public void llTan() { } - public void llAtan2() { } - public void llSqrt() { } - public void llPow() { } - public void llAbs() { } - public void llFabs() { } - public void llFrand() { } - public void llFloor() { } - public void llCeil() { } - public void llRound() { } - public void llVecMag() { } - public void llVecNorm() { } - public void llVecDist() { } - public void llRot2Euler() { } - public void llEuler2Rot() { } - public void llAxes2Rot() { } - public void llRot2Fwd() { } - public void llRot2Left() { } - public void llRot2Up() { } - public void llRotBetween() { } - public void llWhisper() { } - public void llSay(UInt32 channelID, string text) - { - Common.SendToDebug("INTERNAL FUNCTION llSay(" + channelID + ", \"" + text + "\");"); - } - public void llShout() { } - public void llListen() { } - public void llListenControl() { } - public void llListenRemove() { } - public void llSensor() { } - public void llSensorRepeat() { } - public void llSensorRemove() { } - public void llDetectedName() { } - public void llDetectedKey() { } - public void llDetectedOwner() { } - public void llDetectedType() { } - public void llDetectedPos() { } - public void llDetectedVel() { } - public void llDetectedGrab() { } - public void llDetectedRot() { } - public void llDetectedGroup() { } - public void llDetectedLinkNumber() { } - public void llDie() { } - public void llGround() { } - public void llCloud() { } - public void llWind() { } - public void llSetStatus() { } - public void llGetStatus() { } - public void llSetScale() { } - public void llGetScale() { } - public void llSetColor() { } - public void llGetAlpha() { } - public void llSetAlpha() { } - public void llGetColor() { } - public void llSetTexture() { } - public void llScaleTexture() { } - public void llOffsetTexture() { } - public void llRotateTexture() { } - public void llGetTexture() { } - public void llSetPos() { } - public void llGetPos() { } - public void llGetLocalPos() { } - public void llSetRot() { } - public void llGetRot() { } - public void llGetLocalRot() { } - public void llSetForce() { } - public void llGetForce() { } - public void llTarget() { } - public void llTargetRemove() { } - public void llRotTarget() { } - public void llRotTargetRemove() { } - public void llMoveToTarget() { } - public void llStopMoveToTarget() { } - public void llApplyImpulse() { } - public void llApplyRotationalImpulse() { } - public void llSetTorque() { } - public void llGetTorque() { } - public void llSetForceAndTorque() { } - public void llGetVel() { } - public void llGetAccel() { } - public void llGetOmega() { } - public void llGetTimeOfDay() { } - public void llGetWallclock() { } - public void llGetTime() { } - public void llResetTime() { } - public void llGetAndResetTime() { } - public void llSound() { } - public void llPlaySound() { } - public void llLoopSound() { } - public void llLoopSoundMaster() { } - public void llLoopSoundSlave() { } - public void llPlaySoundSlave() { } - public void llTriggerSound() { } - public void llStopSound() { } - public void llPreloadSound() { } - public void llGetSubString() { } - public void llDeleteSubString() { } - public void llInsertString() { } - public void llToUpper() { } - public void llToLower() { } - public void llGiveMoney() { } - public void llMakeExplosion() { } - public void llMakeFountain() { } - public void llMakeSmoke() { } - public void llMakeFire() { } - public void llRezObject() { } - public void llLookAt() { } - public void llStopLookAt() { } - public void llSetTimerEvent() { } - public void llSleep() { } - public void llGetMass() { } - public void llCollisionFilter() { } - public void llTakeControls() { } - public void llReleaseControls() { } - public void llAttachToAvatar() { } - public void llDetachFromAvatar() { } - public void llTakeCamera() { } - public void llReleaseCamera() { } - public void llGetOwner() { } - public void llInstantMessage() { } - public void llEmail() { } - public void llGetNextEmail() { } - public void llGetKey() { } - public void llSetBuoyancy() { } - public void llSetHoverHeight() { } - public void llStopHover() { } - public void llMinEventDelay() { } - public void llSoundPreload() { } - public void llRotLookAt() { } - public void llStringLength() { } - public void llStartAnimation() { } - public void llStopAnimation() { } - public void llPointAt() { } - public void llStopPointAt() { } - public void llTargetOmega() { } - public void llGetStartParameter() { } - public void llGodLikeRezObject() { } - public void llRequestPermissions() { } - public void llGetPermissionsKey() { } - public void llGetPermissions() { } - public void llGetLinkNumber() { } - public void llSetLinkColor() { } - public void llCreateLink() { } - public void llBreakLink() { } - public void llBreakAllLinks() { } - public void llGetLinkKey() { } - public void llGetLinkName() { } - public void llGetInventoryNumber() { } - public void llGetInventoryName() { } - public void llSetScriptState() { } - public void llGetEnergy() { } - public void llGiveInventory() { } - public void llRemoveInventory() { } - public void llSetText() { } - public void llWater() { } - public void llPassTouches() { } - public void llRequestAgentData() { } - public void llRequestInventoryData() { } - public void llSetDamage() { } - public void llTeleportAgentHome() { } - public void llModifyLand() { } - public void llCollisionSound() { } - public void llCollisionSprite() { } - public void llGetAnimation() { } - public void llResetScript() { } - public void llMessageLinked() { } - public void llPushObject() { } - public void llPassCollisions() { } - public void llGetScriptName() { } - public void llGetNumberOfSides() { } - public void llAxisAngle2Rot() { } - public void llRot2Axis() { } - public void llRot2Angle() { } - public void llAcos() { } - public void llAsin() { } - public void llAngleBetween() { } - public void llGetInventoryKey() { } - public void llAllowInventoryDrop() { } - public void llGetSunDirection() { } - public void llGetTextureOffset() { } - public void llGetTextureScale() { } - public void llGetTextureRot() { } - public void llSubStringIndex() { } - public void llGetOwnerKey() { } - public void llGetCenterOfMass() { } - public void llListSort() { } - public void llGetListLength() { } - public void llList2Integer() { } - public void llList2Float() { } - public void llList2String() { } - public void llList2Key() { } - public void llList2Vector() { } - public void llList2Rot() { } - public void llList2List() { } - public void llDeleteSubList() { } - public void llGetListEntryType() { } - public void llList2CSV() { } - public void llCSV2List() { } - public void llListRandomize() { } - public void llList2ListStrided() { } - public void llGetRegionCorner() { } - public void llListInsertList() { } - public void llListFindList() { } - public void llGetObjectName() { } - public void llSetObjectName() { } - public void llGetDate() { } - public void llEdgeOfWorld() { } - public void llGetAgentInfo() { } - public void llAdjustSoundVolume() { } - public void llSetSoundQueueing() { } - public void llSetSoundRadius() { } - public void llKey2Name() { } - public void llSetTextureAnim() { } - public void llTriggerSoundLimited() { } - public void llEjectFromLand() { } - public void llParseString2List() { } - public void llOverMyLand() { } - public void llGetLandOwnerAt() { } - public void llGetNotecardLine() { } - public void llGetAgentSize() { } - public void llSameGroup() { } - public void llUnSit() { } - public void llGroundSlope() { } - public void llGroundNormal() { } - public void llGroundContour() { } - public void llGetAttached() { } - public void llGetFreeMemory() { } - public void llGetRegionName() { } - public void llGetRegionTimeDilation() { } - public void llGetRegionFPS() { } - public void llParticleSystem() { } - public void llGroundRepel() { } - public void llGiveInventoryList() { } - public void llSetVehicleType() { } - public void llSetVehicleFloatParam() { } - public void llSetVehicleVectorParam() { } - public void llSetVehicleRotationParam() { } - public void llSetVehicleFlags() { } - public void llRemoveVehicleFlags() { } - public void llSitTarget() { } - public void llAvatarOnSitTarget() { } - public void llAddToLandPassList() { } - public void llSetTouchText() { } - public void llSetSitText() { } - public void llSetCameraEyeOffset() { } - public void llSetCameraAtOffset() { } - public void llDumpList2String() { } - public void llScriptDanger() { } - public void llDialog() { } - public void llVolumeDetect() { } - public void llResetOtherScript() { } - public void llGetScriptState() { } - public void llRemoteLoadScript() { } - public void llSetRemoteScriptAccessPin() { } - public void llRemoteLoadScriptPin() { } - public void llOpenRemoteDataChannel() { } - public void llSendRemoteData() { } - public void llRemoteDataReply() { } - public void llCloseRemoteDataChannel() { } - public void llMD5String() { } - public void llSetPrimitiveParams() { } - public void llStringToBase64() { } - public void llBase64ToString() { } - public void llXorBase64Strings() { } - public void llRemoteDataSetRegion() { } - public void llLog10() { } - public void llLog() { } - public void llGetAnimationList() { } - public void llSetParcelMusicURL() { } - public void llGetRootPosition() { } - public void llGetRootRotation() { } - public void llGetObjectDesc() { } - public void llSetObjectDesc() { } - public void llGetCreator() { } - public void llGetTimestamp() { } - public void llSetLinkAlpha() { } - public void llGetNumberOfPrims() { } - public void llGetNumberOfNotecardLines() { } - public void llGetBoundingBox() { } - public void llGetGeometricCenter() { } - public void llGetPrimitiveParams() { } - public void llIntegerToBase64() { } - public void llBase64ToInteger() { } - public void llGetGMTclock() { } - public void llGetSimulatorHostname() { } - public void llSetLocalRot() { } - public void llParseStringKeepNulls() { } - public void llRezAtRoot() { } - public void llGetObjectPermMask() { } - public void llSetObjectPermMask() { } - public void llGetInventoryPermMask() { } - public void llSetInventoryPermMask() { } - public void llGetInventoryCreator() { } - public void llOwnerSay() { } - public void llRequestSimulatorData() { } - public void llForceMouselook() { } - public void llGetObjectMass() { } - public void llListReplaceList() { } - public void llLoadURL() { } - public void llParcelMediaCommandList() { } - public void llParcelMediaQuery() { } - public void llModPow() { } - public void llGetInventoryType() { } - public void llSetPayPrice() { } - public void llGetCameraPos() { } - public void llGetCameraRot() { } - public void llSetPrimURL() { } - public void llRefreshPrimURL() { } - public void llEscapeURL() { } - public void llUnescapeURL() { } - public void llMapDestination() { } - public void llAddToLandBanList() { } - public void llRemoveFromLandPassList() { } - public void llRemoveFromLandBanList() { } - public void llSetCameraParams() { } - public void llClearCameraParams() { } - public void llListStatistics() { } - public void llGetUnixTime() { } - public void llGetParcelFlags() { } - public void llGetRegionFlags() { } - public void llXorBase64StringsCorrect() { } - public void llHTTPRequest() { } - public void llResetLandBanList() { } - public void llResetLandPassList() { } - public void llGetParcelPrimCount() { } - public void llGetParcelPrimOwners() { } - public void llGetObjectPrimCount() { } - public void llGetParcelMaxPrims() { } - public void llGetParcelDetails() { } - - - - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs deleted file mode 100644 index ed22c8c..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs +++ /dev/null @@ -1,79 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.LSL -{ - public class LSL_CLRInterface - { - public interface LSLScript - { - //public virtual void Run(object arg) - //{ - //} - //void Run(object arg); - - //void event_state_entry(object arg); - //void event_state_exit(); - //void event_touch_start(object arg); - //void event_touch(); - //void event_touch_end(); - //void event_collision_start(); - //void event_collision(); - //void event_collision_end(); - //void event_land_collision_start(); - //void event_land_collision(); - //void event_land_collision_end(); - //void event_timer(); - //void event_listen(); - //void event_on_rez(); - //void event_sensor(); - //void event_no_sensor(); - //void event_control(); - //void event_money(); - //void event_email(); - //void event_at_target(); - //void event_not_at_target(); - //void event_at_rot_target(); - //void event_not_at_rot_target(); - //void event_run_time_permissions(); - //void event_changed(); - //void event_attach(); - //void event_dataserver(); - //void event_link_message(); - //void event_moving_start(); - //void event_moving_end(); - //void event_object_rez(); - //void event_remote_data(); - //void event_http_response(); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_OPCODE_IL_processor.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_OPCODE_IL_processor.cs deleted file mode 100644 index e85c1d0..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_OPCODE_IL_processor.cs +++ /dev/null @@ -1,351 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.Reflection.Emit; - -namespace OpenSim.Region.Scripting.LSL -{ - partial class LSO_Parser - { - //LSO_Enums MyLSO_Enums = new LSO_Enums(); - - internal bool LSL_PROCESS_OPCODE(ILGenerator il) - { - - byte bp1; - UInt32 u32p1; - UInt16 opcode = br_read(1)[0]; - Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); - string idesc = ((LSO_Enums.Operation_Table)opcode).ToString(); - switch ((LSO_Enums.Operation_Table)opcode) - { - - case LSO_Enums.Operation_Table.POP: - case LSO_Enums.Operation_Table.POPL: - case LSO_Enums.Operation_Table.POPV: - case LSO_Enums.Operation_Table.POPQ: - case LSO_Enums.Operation_Table.POPIP: - case LSO_Enums.Operation_Table.POPBP: - case LSO_Enums.Operation_Table.POPSP: - case LSO_Enums.Operation_Table.POPSLR: - // ignore -- builds callframe - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Pop);"); - il.Emit(OpCodes.Pop); - break; - case LSO_Enums.Operation_Table.POPARG: - Common.SendToDebug("Instruction " + idesc + ": Ignored"); - Common.SendToDebug("Instruction " + idesc + ": Description: Drop x bytes from the stack "); - Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - - // LONG - case LSO_Enums.Operation_Table.STORE: - case LSO_Enums.Operation_Table.STORES: - case LSO_Enums.Operation_Table.STOREL: - case LSO_Enums.Operation_Table.STOREV: - case LSO_Enums.Operation_Table.STOREQ: - case LSO_Enums.Operation_Table.STOREG: - case LSO_Enums.Operation_Table.STOREGS: - case LSO_Enums.Operation_Table.STOREGL: - case LSO_Enums.Operation_Table.STOREGV: - case LSO_Enums.Operation_Table.STOREGQ: - case LSO_Enums.Operation_Table.LOADP: - case LSO_Enums.Operation_Table.LOADSP: - case LSO_Enums.Operation_Table.LOADLP: - case LSO_Enums.Operation_Table.LOADVP: - case LSO_Enums.Operation_Table.LOADQP: - case LSO_Enums.Operation_Table.PUSH: - case LSO_Enums.Operation_Table.PUSHS: - case LSO_Enums.Operation_Table.PUSHL: - case LSO_Enums.Operation_Table.PUSHV: - case LSO_Enums.Operation_Table.PUSHQ: - case LSO_Enums.Operation_Table.PUSHG: - case LSO_Enums.Operation_Table.PUSHGS: - case LSO_Enums.Operation_Table.PUSHGL: - case LSO_Enums.Operation_Table.PUSHGV: - case LSO_Enums.Operation_Table.PUSHGQ: - Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // None - case LSO_Enums.Operation_Table.PUSHIP: - case LSO_Enums.Operation_Table.PUSHBP: - case LSO_Enums.Operation_Table.PUSHSP: - // Push Stack Top (Memory Address) to stack - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldc_I4, " + myHeader.SP + ");"); - Common.SendToDebug("Instruction " + idesc + ": Description: Pushing Stack Top (Memory Address from header) to stack"); - il.Emit(OpCodes.Ldc_I4, myHeader.SP); - break; - // BYTE - case LSO_Enums.Operation_Table.PUSHARGB: - Common.SendToDebug("Param1: " + br_read(1)[0]); - break; - // INTEGER - case LSO_Enums.Operation_Table.PUSHARGI: - // TODO: What is size of integer? - u32p1 = BitConverter.ToUInt32(br_read(4), 0); - Common.SendToDebug("Instruction PUSHSP: il.Emit(OpCodes.Ldc_I4, " + u32p1 + ");"); - Common.SendToDebug("Param1: " + u32p1); - il.Emit(OpCodes.Ldc_I4, u32p1); - break; - // FLOAT - case LSO_Enums.Operation_Table.PUSHARGF: - // TODO: What is size of float? - Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // STRING - case LSO_Enums.Operation_Table.PUSHARGS: - string s = Read_String(); - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldstr, \"" + s + "\");"); - Common.SendToDebug("Param1: " + s); - il.Emit(OpCodes.Ldstr, s); - break; - // VECTOR z,y,x - case LSO_Enums.Operation_Table.PUSHARGV: - Common.SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4), 0)); - Common.SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4), 0)); - Common.SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // ROTATION s,z,y,x - case LSO_Enums.Operation_Table.PUSHARGQ: - Common.SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4), 0)); - Common.SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4), 0)); - Common.SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4), 0)); - Common.SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // LONG - case LSO_Enums.Operation_Table.PUSHARGE: - u32p1 = BitConverter.ToUInt32(br_read(4), 0); - //Common.SendToDebug("Instruction PUSHSP: il.Emit(OpCodes., " + u32p1 + ");"); - Common.SendToDebug("Instruction " + idesc + ": Ignoring (not in use according to doc)"); - //Common.SendToDebug("Instruction " + idesc + ": Description: Pushes X bytes of $00 onto the stack (used to put space for local variable memory for a call)"); - Common.SendToDebug("Param1: " + u32p1); - //il.Emit(OpCodes.ldc_i4, u32p1); - //if (u32p1 > 0) { - //for (int _ic=0; _ic < u32p1; _ic++) - //{ - // Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldnull);"); - // il.Emit(OpCodes.Ldnull); - //} - break; - // BYTE - case LSO_Enums.Operation_Table.ADD: - bp1 = br_read(1)[0]; - Common.SendToDebug("Instruction " + idesc + ": Add type: " + ((LSO_Enums.OpCode_Add_TypeDefs)bp1).ToString()); - Common.SendToDebug("Param1: " + bp1); - switch ((LSO_Enums.OpCode_Add_TypeDefs)bp1) - { - case LSO_Enums.OpCode_Add_TypeDefs.String: - Common.SendToDebug("Instruction " + idesc - + ": il.Emit(OpCodes.Call, typeof(System.String).GetMethod(\"Concat\", new Type[] { typeof(object), typeof(object) }));"); - il.Emit(OpCodes.Call, typeof(System.String).GetMethod - ("Concat", new Type[] { typeof(object), typeof(object) })); - - break; - case LSO_Enums.OpCode_Add_TypeDefs.UInt32: - default: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Add);"); - il.Emit(OpCodes.Add); - break; - } - - - //il.Emit(OpCodes.Add, p1); - break; - case LSO_Enums.Operation_Table.SUB: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Sub);"); - bp1 = br_read(1)[0]; - Common.SendToDebug("Param1: " + bp1); - il.Emit(OpCodes.Sub); - //il.Emit(OpCodes.Sub, p1); - break; - case LSO_Enums.Operation_Table.MUL: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Mul);"); - bp1 = br_read(1)[0]; - Common.SendToDebug("Param1: " + bp1); - il.Emit(OpCodes.Mul); - //il.Emit(OpCodes.Mul, p1); - break; - case LSO_Enums.Operation_Table.DIV: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Div);"); - bp1 = br_read(1)[0]; - Common.SendToDebug("Param1: " + bp1); - il.Emit(OpCodes.Div); - //il.Emit(OpCodes.Div, p1); - break; - case LSO_Enums.Operation_Table.EQ: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ceq);"); - bp1 = br_read(1)[0]; - Common.SendToDebug("Param1: " + bp1); - il.Emit(OpCodes.Ceq); - //il.Emit(OpCodes.Ceq, p1); - break; - case LSO_Enums.Operation_Table.NEQ: - case LSO_Enums.Operation_Table.LEQ: - case LSO_Enums.Operation_Table.GEQ: - case LSO_Enums.Operation_Table.LESS: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Clt_Un);"); - bp1 = br_read(1)[0]; - Common.SendToDebug("Param1: " + bp1); - il.Emit(OpCodes.Clt_Un); - //il.Emit(OpCodes.Clt, p1); - break; - case LSO_Enums.Operation_Table.GREATER: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Cgt_Un);"); - bp1 = br_read(1)[0]; - Common.SendToDebug("Param1: " + bp1); - il.Emit(OpCodes.Cgt_Un); - //il.Emit(OpCodes.Cgt, p1); - break; - case LSO_Enums.Operation_Table.MOD: - case LSO_Enums.Operation_Table.BOOLOR: - bp1 = br_read(1)[0]; - Common.SendToDebug("Param1: " + bp1); - break; - // LONG - case LSO_Enums.Operation_Table.JUMP: - Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // BYTE, LONG - case LSO_Enums.Operation_Table.JUMPIF: - case LSO_Enums.Operation_Table.JUMPNIF: - Common.SendToDebug("Param1: " + br_read(1)[0]); - Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // LONG - case LSO_Enums.Operation_Table.STATE: - bp1 = br_read(1)[0]; - //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack - //il.Emit(OpCodes.Ldc_I4, 0); // Push index position - //il.Emit(OpCodes.Ldstr, EventList[p1]); // Push value - //il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value - break; - case LSO_Enums.Operation_Table.CALL: - Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // BYTE - case LSO_Enums.Operation_Table.CAST: - bp1 = br_read(1)[0]; - Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + ((LSO_Enums.OpCode_Cast_TypeDefs)bp1)); - Common.SendToDebug("Param1: " + bp1); - switch ((LSO_Enums.OpCode_Cast_TypeDefs)bp1) - { - case LSO_Enums.OpCode_Cast_TypeDefs.String: - Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Calli, typeof(System.Convert).GetMethod(\"ToString\", new Type[] { typeof(object) }));"); - //il.Emit(OpCodes.Box, typeof (UInt32)); - il.Emit(OpCodes.Calli, typeof(Common).GetMethod - ("Cast_ToString", new Type[] { typeof(object) })); - - //il.Emit(OpCodes.Box, typeof(System.UInt32) ); - //il.Emit(OpCodes.Box, typeof(string)); - - //il.Emit(OpCodes.Conv_R8); - //il.Emit(OpCodes.Call, typeof(System.Convert).GetMethod - // ("ToString", new Type[] { typeof(float) })); - - break; - default: - Common.SendToDebug("Instruction " + idesc + ": Unknown cast type!"); - break; - } - break; - // LONG - case LSO_Enums.Operation_Table.STACKTOS: - case LSO_Enums.Operation_Table.STACKTOL: - Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); - break; - // BYTE - case LSO_Enums.Operation_Table.PRINT: - case LSO_Enums.Operation_Table.CALLLIB: - Common.SendToDebug("Param1: " + br_read(1)[0]); - break; - // SHORT - case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: - // TODO: What is size of short? - UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); - Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString()); - Common.SendToDebug("Param1: " + U16p1); - switch ((LSO_Enums.BuiltIn_Functions)U16p1) - { - case LSO_Enums.BuiltIn_Functions.llSay: - Common.SendToDebug("Instruction " + idesc + " " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString() - + ": Mapped to internal function"); - - //il.Emit(OpCodes.Ldstr, "INTERNAL COMMAND: llSay({0}, \"{1}\""); - //il.Emit(OpCodes.Call, typeof(IL_Helper).GetMethod("ReverseFormatString", - // new Type[] { typeof(string), typeof(UInt32), typeof(string) } - //)); - - - //il.Emit(OpCodes.Pop); - //il.Emit(OpCodes.Call, - // typeof(Console).GetMethod("WriteLine", - // new Type[] { typeof(string) } - //)); - - - il.Emit(OpCodes.Call, - typeof(Common).GetMethod("SendToLog", - new Type[] { typeof(string) } - )); - - - - //il.Emit(OpCodes.Pop); - - //il.Emit(OpCodes.Ldind_I2, 0); - - //il.Emit(OpCodes.Call, typeof(string).GetMethod("Format", new Type[] { typeof(string), typeof(object) })); - //il.EmitCalli(OpCodes.Calli, - //il.Emit(OpCodes.Call, typeof().GetMethod - // ("llSay", new Type[] { typeof(UInt32), typeof(string) })); - break; - default: - Common.SendToDebug("Instruction " + idesc + ": " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString() + ": INTERNAL COMMAND NOT IMPLEMENTED"); - break; - } - - //Common.SendToDebug("Instruction " + idesc + ": DEBUG: Faking return code:"); - //Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldc_I4, 0);"); - //il.Emit(OpCodes.Ldc_I4, 0); - break; - - // RETURN - case LSO_Enums.Operation_Table.RETURN: - - Common.SendToDebug("Last OPCODE was return command. Code chunk execution complete."); - return true; - } - return false; - } - - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs deleted file mode 100644 index 7cac152..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs +++ /dev/null @@ -1,548 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.LSL -{ - static class LSO_Enums - { - //public System.Collections.Generic.Dictionary OpCode_Add_Types; - - //LSO_Enums() { - // OpCode_Add_Types.Add(51, typeof(String)); - // OpCode_Add_Types.Add(17, typeof(UInt32)); - //} - - public enum OpCode_Add_TypeDefs - { - String = 51, - UInt32 = 17 - } - public enum OpCode_Cast_TypeDefs - { - String = 19 - } - -#pragma warning disable 649 - - public struct Vector - { - public UInt32 Z; - public UInt32 Y; - public UInt32 X; - } - - public struct Rotation - { - public UInt32 S; - public UInt32 Z; - public UInt32 Y; - public UInt32 X; - } - -#pragma warning restore 649 - - public enum Variable_Type_Codes - { - Void = 0, - Integer = 1, - Float = 2, - String = 3, - Key = 4, - Vector = 5, - Rotation = 6, - List = 7 - } - public enum Event_Mask_Values - { - state_entry = 0, - state_exit = 1, - touch_start = 2, - touch = 3, - touch_end = 4, - collision_start = 5, - collision = 6, - collision_end = 7, - land_collision_start = 8, - land_collision = 9, - land_collision_end = 10, - timer = 11, - listen = 12, - on_rez = 13, - sensor = 14, - no_sensor = 15, - control = 16, - money = 17, - email = 18, - at_target = 19, - not_at_target = 20, - at_rot_target = 21, - not_at_rot_target = 22, - run_time_permissions = 23, - changed = 24, - attach = 25, - dataserver = 26, - link_message = 27, - moving_start = 28, - moving_end = 29, - object_rez = 30, - remote_data = 31, - http_response = 32 - } - public enum Operation_Table - { - NOOP = 0x0, - POP = 0x1, - POPS = 0x2, - POPL = 0x3, - POPV = 0x4, - POPQ = 0x5, - POPARG = 0x6, - POPIP = 0x7, - POPBP = 0x8, - POPSP = 0x9, - POPSLR = 0xa, - DUP = 0x20, - DUPS = 0x21, - DUPL = 0x22, - DUPV = 0x23, - DUPQ = 0x24, - STORE = 0x30, - STORES = 0x31, - STOREL = 0x32, - STOREV = 0x33, - STOREQ = 0x34, - STOREG = 0x35, - STOREGS = 0x36, - STOREGL = 0x37, - STOREGV = 0x38, - STOREGQ = 0x39, - LOADP = 0x3a, - LOADSP = 0x3b, - LOADLP = 0x3c, - LOADVP = 0x3d, - LOADQP = 0x3e, - LOADGP = 0x3f, - LOADGSP = 0x40, - LOADGLP = 0x41, - LOADGVP = 0x42, - LOADGQP = 0x43, - PUSH = 0x50, - PUSHS = 0x51, - PUSHL = 0x52, - PUSHV = 0x53, - PUSHQ = 0x54, - PUSHG = 0x55, - PUSHGS = 0x56, - PUSHGL = 0x57, - PUSHGV = 0x58, - PUSHGQ = 0x59, - PUSHIP = 0x5a, - PUSHBP = 0x5b, - PUSHSP = 0x5c, - PUSHARGB = 0x5d, - PUSHARGI = 0x5e, - PUSHARGF = 0x5f, - PUSHARGS = 0x60, - PUSHARGV = 0x61, - PUSHARGQ = 0x62, - PUSHE = 0x63, - PUSHEV = 0x64, - PUSHEQ = 0x65, - PUSHARGE = 0x66, - ADD = 0x70, - SUB = 0x71, - MUL = 0x72, - DIV = 0x73, - MOD = 0x74, - EQ = 0x75, - NEQ = 0x76, - LEQ = 0x77, - GEQ = 0x78, - LESS = 0x79, - GREATER = 0x7a, - BITAND = 0x7b, - BITOR = 0x7c, - BITXOR = 0x7d, - BOOLAND = 0x7e, - BOOLOR = 0x7f, - NEG = 0x80, - BITNOT = 0x81, - BOOLNOT = 0x82, - JUMP = 0x90, - JUMPIF = 0x91, - JUMPNIF = 0x92, - STATE = 0x93, - CALL = 0x94, - RETURN = 0x95, - CAST = 0xa0, - STACKTOS = 0xb0, - STACKTOL = 0xb1, - PRINT = 0xc0, - CALLLIB = 0xd0, - CALLLIB_TWO_BYTE = 0xd1, - SHL = 0xe0, - SHR = 0xe1 - } - public enum BuiltIn_Functions - { - llSin = 0, - llCos = 1, - llTan = 2, - llAtan2 = 3, - llSqrt = 4, - llPow = 5, - llAbs = 6, - llFabs = 7, - llFrand = 8, - llFloor = 9, - llCeil = 10, - llRound = 11, - llVecMag = 12, - llVecNorm = 13, - llVecDist = 14, - llRot2Euler = 15, - llEuler2Rot = 16, - llAxes2Rot = 17, - llRot2Fwd = 18, - llRot2Left = 19, - llRot2Up = 20, - llRotBetween = 21, - llWhisper = 22, - llSay = 23, - llShout = 24, - llListen = 25, - llListenControl = 26, - llListenRemove = 27, - llSensor = 28, - llSensorRepeat = 29, - llSensorRemove = 30, - llDetectedName = 31, - llDetectedKey = 32, - llDetectedOwner = 33, - llDetectedType = 34, - llDetectedPos = 35, - llDetectedVel = 36, - llDetectedGrab = 37, - llDetectedRot = 38, - llDetectedGroup = 39, - llDetectedLinkNumber = 40, - llDie = 41, - llGround = 42, - llCloud = 43, - llWind = 44, - llSetStatus = 45, - llGetStatus = 46, - llSetScale = 47, - llGetScale = 48, - llSetColor = 49, - llGetAlpha = 50, - llSetAlpha = 51, - llGetColor = 52, - llSetTexture = 53, - llScaleTexture = 54, - llOffsetTexture = 55, - llRotateTexture = 56, - llGetTexture = 57, - llSetPos = 58, - llGetPos = 59, - llGetLocalPos = 60, - llSetRot = 61, - llGetRot = 62, - llGetLocalRot = 63, - llSetForce = 64, - llGetForce = 65, - llTarget = 66, - llTargetRemove = 67, - llRotTarget = 68, - llRotTargetRemove = 69, - llMoveToTarget = 70, - llStopMoveToTarget = 71, - llApplyImpulse = 72, - llApplyRotationalImpulse = 73, - llSetTorque = 74, - llGetTorque = 75, - llSetForceAndTorque = 76, - llGetVel = 77, - llGetAccel = 78, - llGetOmega = 79, - llGetTimeOfDay = 80, - llGetWallclock = 81, - llGetTime = 82, - llResetTime = 83, - llGetAndResetTime = 84, - llSound = 85, - llPlaySound = 86, - llLoopSound = 87, - llLoopSoundMaster = 88, - llLoopSoundSlave = 89, - llPlaySoundSlave = 90, - llTriggerSound = 91, - llStopSound = 92, - llPreloadSound = 93, - llGetSubString = 94, - llDeleteSubString = 95, - llInsertString = 96, - llToUpper = 97, - llToLower = 98, - llGiveMoney = 99, - llMakeExplosion = 100, - llMakeFountain = 101, - llMakeSmoke = 102, - llMakeFire = 103, - llRezObject = 104, - llLookAt = 105, - llStopLookAt = 106, - llSetTimerEvent = 107, - llSleep = 108, - llGetMass = 109, - llCollisionFilter = 110, - llTakeControls = 111, - llReleaseControls = 112, - llAttachToAvatar = 113, - llDetachFromAvatar = 114, - llTakeCamera = 115, - llReleaseCamera = 116, - llGetOwner = 117, - llInstantMessage = 118, - llEmail = 119, - llGetNextEmail = 120, - llGetKey = 121, - llSetBuoyancy = 122, - llSetHoverHeight = 123, - llStopHover = 124, - llMinEventDelay = 125, - llSoundPreload = 126, - llRotLookAt = 127, - llStringLength = 128, - llStartAnimation = 129, - llStopAnimation = 130, - llPointAt = 131, - llStopPointAt = 132, - llTargetOmega = 133, - llGetStartParameter = 134, - llGodLikeRezObject = 135, - llRequestPermissions = 136, - llGetPermissionsKey = 137, - llGetPermissions = 138, - llGetLinkNumber = 139, - llSetLinkColor = 140, - llCreateLink = 141, - llBreakLink = 142, - llBreakAllLinks = 143, - llGetLinkKey = 144, - llGetLinkName = 145, - llGetInventoryNumber = 146, - llGetInventoryName = 147, - llSetScriptState = 148, - llGetEnergy = 149, - llGiveInventory = 150, - llRemoveInventory = 151, - llSetText = 152, - llWater = 153, - llPassTouches = 154, - llRequestAgentData = 155, - llRequestInventoryData = 156, - llSetDamage = 157, - llTeleportAgentHome = 158, - llModifyLand = 159, - llCollisionSound = 160, - llCollisionSprite = 161, - llGetAnimation = 162, - llResetScript = 163, - llMessageLinked = 164, - llPushObject = 165, - llPassCollisions = 166, - llGetScriptName = 167, - llGetNumberOfSides = 168, - llAxisAngle2Rot = 169, - llRot2Axis = 170, - llRot2Angle = 171, - llAcos = 172, - llAsin = 173, - llAngleBetween = 174, - llGetInventoryKey = 175, - llAllowInventoryDrop = 176, - llGetSunDirection = 177, - llGetTextureOffset = 178, - llGetTextureScale = 179, - llGetTextureRot = 180, - llSubStringIndex = 181, - llGetOwnerKey = 182, - llGetCenterOfMass = 183, - llListSort = 184, - llGetListLength = 185, - llList2Integer = 186, - llList2Float = 187, - llList2String = 188, - llList2Key = 189, - llList2Vector = 190, - llList2Rot = 191, - llList2List = 192, - llDeleteSubList = 193, - llGetListEntryType = 194, - llList2CSV = 195, - llCSV2List = 196, - llListRandomize = 197, - llList2ListStrided = 198, - llGetRegionCorner = 199, - llListInsertList = 200, - llListFindList = 201, - llGetObjectName = 202, - llSetObjectName = 203, - llGetDate = 204, - llEdgeOfWorld = 205, - llGetAgentInfo = 206, - llAdjustSoundVolume = 207, - llSetSoundQueueing = 208, - llSetSoundRadius = 209, - llKey2Name = 210, - llSetTextureAnim = 211, - llTriggerSoundLimited = 212, - llEjectFromLand = 213, - llParseString2List = 214, - llOverMyLand = 215, - llGetLandOwnerAt = 216, - llGetNotecardLine = 217, - llGetAgentSize = 218, - llSameGroup = 219, - llUnSit = 220, - llGroundSlope = 221, - llGroundNormal = 222, - llGroundContour = 223, - llGetAttached = 224, - llGetFreeMemory = 225, - llGetRegionName = 226, - llGetRegionTimeDilation = 227, - llGetRegionFPS = 228, - llParticleSystem = 229, - llGroundRepel = 230, - llGiveInventoryList = 231, - llSetVehicleType = 232, - llSetVehicleFloatParam = 233, - llSetVehicleVectorParam = 234, - llSetVehicleRotationParam = 235, - llSetVehicleFlags = 236, - llRemoveVehicleFlags = 237, - llSitTarget = 238, - llAvatarOnSitTarget = 239, - llAddToLandPassList = 240, - llSetTouchText = 241, - llSetSitText = 242, - llSetCameraEyeOffset = 243, - llSetCameraAtOffset = 244, - llDumpList2String = 245, - llScriptDanger = 246, - llDialog = 247, - llVolumeDetect = 248, - llResetOtherScript = 249, - llGetScriptState = 250, - llRemoteLoadScript = 251, - llSetRemoteScriptAccessPin = 252, - llRemoteLoadScriptPin = 253, - llOpenRemoteDataChannel = 254, - llSendRemoteData = 255, - llRemoteDataReply = 256, - llCloseRemoteDataChannel = 257, - llMD5String = 258, - llSetPrimitiveParams = 259, - llStringToBase64 = 260, - llBase64ToString = 261, - llXorBase64Strings = 262, - llRemoteDataSetRegion = 263, - llLog10 = 264, - llLog = 265, - llGetAnimationList = 266, - llSetParcelMusicURL = 267, - llGetRootPosition = 268, - llGetRootRotation = 269, - llGetObjectDesc = 270, - llSetObjectDesc = 271, - llGetCreator = 272, - llGetTimestamp = 273, - llSetLinkAlpha = 274, - llGetNumberOfPrims = 275, - llGetNumberOfNotecardLines = 276, - llGetBoundingBox = 277, - llGetGeometricCenter = 278, - llGetPrimitiveParams = 279, - llIntegerToBase64 = 280, - llBase64ToInteger = 281, - llGetGMTclock = 282, - llGetSimulatorHostname = 283, - llSetLocalRot = 284, - llParseStringKeepNulls = 285, - llRezAtRoot = 286, - llGetObjectPermMask = 287, - llSetObjectPermMask = 288, - llGetInventoryPermMask = 289, - llSetInventoryPermMask = 290, - llGetInventoryCreator = 291, - llOwnerSay = 292, - llRequestSimulatorData = 293, - llForceMouselook = 294, - llGetObjectMass = 295, - llListReplaceList = 296, - llLoadURL = 297, - llParcelMediaCommandList = 298, - llParcelMediaQuery = 299, - llModPow = 300, - llGetInventoryType = 301, - llSetPayPrice = 302, - llGetCameraPos = 303, - llGetCameraRot = 304, - llSetPrimURL = 305, - llRefreshPrimURL = 306, - llEscapeURL = 307, - llUnescapeURL = 308, - llMapDestination = 309, - llAddToLandBanList = 310, - llRemoveFromLandPassList = 311, - llRemoveFromLandBanList = 312, - llSetCameraParams = 313, - llClearCameraParams = 314, - llListStatistics = 315, - llGetUnixTime = 316, - llGetParcelFlags = 317, - llGetRegionFlags = 318, - llXorBase64StringsCorrect = 319, - llHTTPRequest = 320, - llResetLandBanList = 321, - llResetLandPassList = 322, - llGetParcelPrimCount = 323, - llGetParcelPrimOwners = 324, - llGetObjectPrimCount = 325, - llGetParcelMaxPrims = 326, - llGetParcelDetails = 327 - } - - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs deleted file mode 100644 index 4ad1f83..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs +++ /dev/null @@ -1,629 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Reflection; -using System.Reflection.Emit; - -namespace OpenSim.Region.Scripting.LSL -{ - partial class LSO_Parser - { - private FileStream fs; - private BinaryReader br; - private LSO_Struct.Header myHeader; - - private TypeBuilder typeBuilder; - private System.Collections.Generic.List EventList = new System.Collections.Generic.List(); - - /// - /// Parse LSO file. - /// Reads LSO ByteCode into memory structures. - /// TODO: What else does it do? - /// - /// FileName of LSO ByteCode file - public void ParseFile(string FileName, TypeBuilder _typeBuilder) - { - typeBuilder = _typeBuilder; - //WorldAPI = _WorldAPI; - // Open - Common.SendToDebug("Opening filename: " + FileName); - fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); - br = new BinaryReader(fs, Encoding.BigEndianUnicode); - - - // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. - - - // HEADER BLOCK - Common.SendToDebug("Reading HEADER BLOCK at: 0"); - fs.Seek(0, SeekOrigin.Begin); - myHeader = new LSO_Struct.Header(); - myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); - myHeader.IP = BitConverter.ToUInt32(br_read(4), 0); - myHeader.VN = BitConverter.ToUInt32(br_read(4), 0); - myHeader.BP = BitConverter.ToUInt32(br_read(4), 0); - myHeader.SP = BitConverter.ToUInt32(br_read(4), 0); - myHeader.HR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.HP = BitConverter.ToUInt32(br_read(4), 0); - myHeader.CS = BitConverter.ToUInt32(br_read(4), 0); - myHeader.NS = BitConverter.ToUInt32(br_read(4), 0); - myHeader.CE = BitConverter.ToUInt32(br_read(4), 0); - myHeader.IE = BitConverter.ToUInt32(br_read(4), 0); - myHeader.ER = BitConverter.ToUInt32(br_read(4), 0); - myHeader.FR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.PR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.SR = BitConverter.ToUInt32(br_read(4), 0); - myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0); - myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0); - myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); - - // Print Header Block to debug - Common.SendToDebug("TM - Top of memory (size): " + myHeader.TM); - Common.SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); - Common.SendToDebug("VN - Version number: " + myHeader.VN); - Common.SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); - Common.SendToDebug("SP - Stack Pointer: " + myHeader.SP); - Common.SendToDebug("HR - Heap Register: " + myHeader.HR); - Common.SendToDebug("HP - Heap Pointer: " + myHeader.HP); - Common.SendToDebug("CS - Current State: " + myHeader.CS); - Common.SendToDebug("NS - Next State: " + myHeader.NS); - Common.SendToDebug("CE - Current Events: " + myHeader.CE); - Common.SendToDebug("IE - In Event: " + myHeader.IE); - Common.SendToDebug("ER - Event Register: " + myHeader.ER); - Common.SendToDebug("FR - Fault Register: " + myHeader.FR); - Common.SendToDebug("SLR - Sleep Register: " + myHeader.SLR); - Common.SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); - Common.SendToDebug("GFR - Global Function Register: " + myHeader.GFR); - Common.SendToDebug("PR - Parameter Register: " + myHeader.PR); - Common.SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); - Common.SendToDebug("SR - State Register: " + myHeader.SR); - Common.SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); - Common.SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); - Common.SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); - Common.SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); - - // STATIC BLOCK - Common.SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); - fs.Seek(myHeader.GVR, SeekOrigin.Begin); - int StaticBlockCount = 0; - // Read function blocks until we hit GFR - while (fs.Position < myHeader.GFR) - { - StaticBlockCount++; - Common.SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position); - //fs.Seek(myHeader.GVR, SeekOrigin.Begin); - LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); - myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); - myStaticBlock.ObjectType = br_read(1)[0]; - Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); - myStaticBlock.Unknown = br_read(1)[0]; - // Size of datatype varies - if (myStaticBlock.ObjectType != 0) - myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); - } - Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); - - - // FUNCTION BLOCK - // Always right after STATIC BLOCK - LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); - if (myHeader.GFR == myHeader.SR) - { - // If GFR and SR are at same position then there is no fuction block - Common.SendToDebug("No FUNCTION BLOCK found"); - } - else - { - Common.SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); - fs.Seek(myHeader.GFR, SeekOrigin.Begin); - myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); - Common.SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); - if (myFunctionBlock.FunctionCount > 0) - { - myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; - for (int i = 0; i < myFunctionBlock.FunctionCount; i++) - { - Common.SendToDebug("Reading function " + i + " at: " + fs.Position); - // TODO: ADD TO FUNCTION LIST (How do we identify it later?) - // Note! Absolute position - myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; - Common.SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); - } - } - } - - - // STATE FRAME BLOCK - // Always right after FUNCTION BLOCK - Common.SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); - fs.Seek(myHeader.SR, SeekOrigin.Begin); - LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); - myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); - if (myStateFrameBlock.StateCount > 0) - { - // Initialize array - myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; - for (int i = 0; i < myStateFrameBlock.StateCount; i++) - { - Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); - // Position is relative to state frame - myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); - myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); - Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); - Common.SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); - - //// Read STATE BLOCK - //long CurPos = fs.Position; - //fs.Seek(CurPos, SeekOrigin.Begin); - - } - } - - - // STATE BLOCK - // For each StateFrameBlock there is one StateBlock with multiple event handlers - - if (myStateFrameBlock.StateCount > 0) - { - // Go through all State Frame Pointers found - for (int i = 0; i < myStateFrameBlock.StateCount; i++) - { - - fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); - Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); - - // READ: STATE BLOCK HEADER - myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); - myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note - myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); - myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; - myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note - Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); - Common.SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); - Common.SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); - - // We need to count number of bits flagged in EventMask? - - - // for each bit in myStateFrameBlock.StatePointer[i].EventMask - - // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE - //TODO: Create event hooks - myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; - for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) - { - - if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) - { - // We got an event - // READ: STATE BLOCK HANDLER - Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); - myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); - myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); - Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); - Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize); - } - } - } - } - - - - - //// READ FUNCTION CODE CHUNKS - //// Functions + Function start pos (GFR) - //// TODO: Somehow be able to identify and reference this - //LSO_Struct.CodeChunk[] myFunctionCodeChunk; - //if (myFunctionBlock.FunctionCount > 0) - //{ - // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; - // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) - // { - // Common.SendToDebug("Reading Function Code Chunk " + i); - // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); - // } - - //} - // READ EVENT CODE CHUNKS - LSO_Struct.CodeChunk[] myEventCodeChunk; - if (myStateFrameBlock.StateCount > 0) - { - myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; - for (int i = 0; i < myStateFrameBlock.StateCount; i++) - { - // TODO: Somehow organize events and functions so they can be found again, - // two level search ain't no good - for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) - { - - - if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) - { - Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); - - - // Override a Method / Function - string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values)ii; - Common.SendToDebug("Event Name: " + eventname); - if (Common.IL_ProcessCodeChunks) - { - EventList.Add(eventname); - - // JUMP TO CODE PROCESSOR - ProcessCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, typeBuilder, eventname); - } - } - - } - - } - - } - - - // Close - br.Close(); - fs.Close(); - - if (Common.IL_CreateFunctionList) - IL_INSERT_FUNCTIONLIST(); - - } - - private LSO_Struct.HeapBlock GetHeap(UInt32 pos) - { - // HEAP BLOCK - // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) - Common.SendToDebug("Reading HEAP BLOCK at: " + pos); - fs.Seek(pos, SeekOrigin.Begin); - - LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); - myHeapBlock.DataBlockSize = BitConverter.ToUInt32(br_read(4), 0); - myHeapBlock.ObjectType = br_read(1)[0]; - myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); - myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); - - Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); - Common.SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); - Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); - - return myHeapBlock; - } - private byte[] br_read(int len) - { - if (len <= 0) - return null; - - try - { - byte[] bytes = new byte[len]; - for (int i = len - 1; i > -1; i--) - bytes[i] = br.ReadByte(); - return bytes; - } - catch (Exception e) - { - Common.SendToDebug("Exception: " + e.ToString()); - throw (e); - } - } - //private byte[] br_read_smallendian(int len) - //{ - // byte[] bytes = new byte[len]; - // br.Read(bytes,0, len); - // return bytes; - //} - private Type getLLObjectType(byte objectCode) - { - switch ((LSO_Enums.Variable_Type_Codes)objectCode) - { - case LSO_Enums.Variable_Type_Codes.Void: return typeof(void); - case LSO_Enums.Variable_Type_Codes.Integer: return typeof(UInt32); - case LSO_Enums.Variable_Type_Codes.Float: return typeof(float); - case LSO_Enums.Variable_Type_Codes.String: return typeof(string); - case LSO_Enums.Variable_Type_Codes.Key: return typeof(string); - case LSO_Enums.Variable_Type_Codes.Vector: return typeof(LSO_Enums.Vector); - case LSO_Enums.Variable_Type_Codes.Rotation: return typeof(LSO_Enums.Rotation); - case LSO_Enums.Variable_Type_Codes.List: - Common.SendToDebug("TODO: List datatype not implemented yet!"); - return typeof(System.Collections.ArrayList); - default: - Common.SendToDebug("Lookup of LSL datatype " + objectCode + " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); - return typeof(object); - } - } - private int getObjectSize(byte ObjectType) - { - switch (ObjectType) - { - case 1: - case 2: - case 3: - case 4: - case 7: - return 4; - case 5: - return 12; - case 6: - return 16; - default: - return 0; - } - } - private string Read_String() - { - string ret = ""; - byte reader = br_read(1)[0]; - while (reader != 0x000) - { - ret += (char)reader; - reader = br_read(1)[0]; - } - return ret; - } - - /// - /// Reads a code chunk and creates IL - /// - /// Absolute position in file. REMEMBER TO ADD myHeader.GFR! - /// TypeBuilder for assembly - /// Name of event (function) to generate - private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) - { - - LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); - - Common.SendToDebug("Reading Function Code Chunk at: " + pos); - fs.Seek(pos, SeekOrigin.Begin); - myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); - Common.SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize); - // Read until null - myCodeChunk.Comment = Read_String(); - Common.SendToDebug("Function comment: " + myCodeChunk.Comment); - myCodeChunk.ReturnType = br_read(1)[0]; - Common.SendToDebug("Return type #" + myCodeChunk.ReturnType + ": " + (getLLObjectType(myCodeChunk.ReturnType).ToString())); - - // TODO: How to determine number of codechunks -- does this method work? - myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List(); - byte reader = br_read(1)[0]; - reader = br_read(1)[0]; - - // NOTE ON CODE CHUNK ARGUMENTS - // This determins type definition - int ccount = 0; - while (reader != 0x000) - { - ccount++; - Common.SendToDebug("Reading Code Chunk Argument " + ccount); - LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); - CCA.FunctionReturnType = reader; - reader = br_read(1)[0]; - CCA.NullString = reader; - myCodeChunk.CodeChunkArguments.Add(CCA); - Common.SendToDebug("Code Chunk Argument " + ccount + " type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType); - } - // Create string array - Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; - for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) - { - MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType); - Common.SendToDebug("Method argument " + _ic + ": " + getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType).ToString()); - } - // End marker is 0x000 - myCodeChunk.EndMarker = reader; - - - // - // Emit: START OF METHOD (FUNCTION) - // - - Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); - MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, - MethodAttributes.Public, - typeof(void), - MethodArgs); - //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), - // new Type[] { typeof(object) }, //); - - //Common.SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); - //typeBuilder.DefineMethodOverride(methodBuilder, - // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); - - // Create the IL generator - - Common.SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); - ILGenerator il = methodBuilder.GetILGenerator(); - - - if (Common.IL_UseTryCatch) - IL_INSERT_TRY(il, eventname); - - - - // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); - //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); - //il.Emit(OpCodes.Call, typeof(Console).GetMethod - // ("WriteLine", new Type[] { typeof(string) })); - - //Common.SendToDebug("STARTUP: il.Emit(OpCodes.Ldc_I4_S, 0);"); - - //il.Emit(OpCodes.Ldc_I4_S, 0); - for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) - { - Common.SendToDebug("PARAMS: il.Emit(OpCodes.Ldarg, " + _ic + ");"); - il.Emit(OpCodes.Ldarg, _ic); - } - - - - // - // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL - // - bool FoundRet = false; - while (FoundRet == false) - { - FoundRet = LSL_PROCESS_OPCODE(il); - } - - - if (Common.IL_UseTryCatch) - IL_INSERT_END_TRY(il, eventname); - - // Emit: RETURN FROM METHOD - il.Emit(OpCodes.Ret); - - return; - - } - - private void IL_INSERT_FUNCTIONLIST() - { - - Common.SendToDebug("Creating function list"); - - - string eventname = "GetFunctions"; - - Common.SendToDebug("Creating IL " + eventname); - // Define a private String field. - //FieldBuilder myField = myTypeBuilder.DefineField("EventList", typeof(String[]), FieldAttributes.Public); - - - //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); - - - - MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, - MethodAttributes.Public, - typeof(string[]), - null); - - //typeBuilder.DefineMethodOverride(methodBuilder, - // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); - - ILGenerator il = methodBuilder.GetILGenerator(); - - - - - // IL_INSERT_TRY(il, eventname); - - // // Push string to stack - // il.Emit(OpCodes.Ldstr, "Inside " + eventname); - - //// Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); - //il.Emit(OpCodes.Call, typeof(Console).GetMethod - // ("WriteLine", new Type[] { typeof(string) })); - - //initIL.Emit(OpCodes.Newobj, typeof(string[])); - - //string[] MyArray = new string[2] { "TestItem1" , "TestItem2" }; - - il.DeclareLocal(typeof(string[])); - - //il.Emit(OpCodes.Ldarg_0); - il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length - il.Emit(OpCodes.Newarr, typeof(String)); // create new string array - il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack - - for (int lv = 0; lv < EventList.Count; lv++) - { - il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack - il.Emit(OpCodes.Ldc_I4, lv); // Push index position - il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value - il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value - } - - - - // IL_INSERT_END_TRY(il, eventname); - - il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack - il.Emit(OpCodes.Ret); // Return - - } - - - private void IL_INSERT_TRY(ILGenerator il, string eventname) - { - /* - * CLR TRY - */ - //Common.SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); - il.BeginExceptionBlock(); - - // Push "Hello World!" string to stack - //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); - il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); - - } - - private void IL_INSERT_END_TRY(ILGenerator il, string eventname) - { - /* - * CATCH - */ - Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); - il.BeginCatchBlock(typeof(Exception)); - - // Push "Hello World!" string to stack - Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); - il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); - - //call void [mscorlib]System.Console::WriteLine(string) - Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); - il.Emit(OpCodes.Call, typeof(Console).GetMethod - ("Write", new Type[] { typeof(string) })); - - //callvirt instance string [mscorlib]System.Exception::get_Message() - Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); - il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod - ("get_Message")); - - //call void [mscorlib]System.Console::WriteLine(string) - Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); - il.Emit(OpCodes.Call, typeof(Console).GetMethod - ("WriteLine", new Type[] { typeof(string) })); - - /* - * CLR END TRY - */ - //Common.SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); - il.EndExceptionBlock(); - } - - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs deleted file mode 100644 index 4d9be5d..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs +++ /dev/null @@ -1,133 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ - -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Scripting.LSL -{ - static class LSO_Struct - { - - public struct Header - { - public UInt32 TM; - public UInt32 IP; - public UInt32 VN; - public UInt32 BP; - public UInt32 SP; - public UInt32 HR; - public UInt32 HP; - public UInt32 CS; - public UInt32 NS; - public UInt32 CE; - public UInt32 IE; - public UInt32 ER; - public UInt32 FR; - public UInt32 SLR; - public UInt32 GVR; - public UInt32 GFR; - public UInt32 PR; - public UInt32 ESR; - public UInt32 SR; - public UInt64 NCE; - public UInt64 NIE; - public UInt64 NER; - } - - public struct StaticBlock - { - public UInt32 Static_Chunk_Header_Size; - public byte ObjectType; - public byte Unknown; - public byte[] BlockVariable; - } - /* Not actually a structure - public struct StaticBlockVariable - { - public UInt32 Integer1; - public UInt32 Float1; - public UInt32 HeapPointer_String; - public UInt32 HeapPointer_Key; - public byte[] Vector_12; - public byte[] Rotation_16; - public UInt32 Pointer_List_Structure; - } */ - public struct HeapBlock - { - public UInt32 DataBlockSize; - public byte ObjectType; - public UInt16 ReferenceCount; - public byte[] Data; - } - public struct StateFrameBlock - { - public UInt32 StateCount; - public StatePointerBlock[] StatePointer; - } - public struct StatePointerBlock - { - public UInt32 Location; - public System.Collections.BitArray EventMask; - public StateBlock StateBlock; - } - public struct StateBlock - { - public UInt32 StartPos; - public UInt32 EndPos; - public UInt32 HeaderSize; - public byte Unknown; - public StateBlockHandler[] StateBlockHandlers; - } - public struct StateBlockHandler - { - public UInt32 CodeChunkPointer; - public UInt32 CallFrameSize; - } - public struct FunctionBlock - { - public UInt32 FunctionCount; - public UInt32[] CodeChunkPointer; - } - public struct CodeChunk - { - public UInt32 CodeChunkHeaderSize; - public string Comment; - public System.Collections.Generic.List CodeChunkArguments; - public byte EndMarker; - public byte ReturnType; - } - public struct CodeChunkArgument - { - public byte FunctionReturnType; - public byte NullString; - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs deleted file mode 100644 index 49357f5..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScript.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using OpenSim.Region.Scripting; -using OpenSim.Region.Scripting.LSL; - -namespace OpenSim.Region.Scripting.LSL -{ - class LSLScript : IScript - { - ScriptInfo scriptInfo; - LSL.Engine lindenScriptEngine; - - public LSLScript(string filename, libsecondlife.LLUUID taskObject) - { - scriptInfo.CreateTaskAPI(taskObject); - - lindenScriptEngine = new Engine(); - lindenScriptEngine.Start(filename); - } - - public void Initialise(ScriptInfo info) - { - scriptInfo = info; - } - - public string getName() - { - return "LSL Script"; - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs deleted file mode 100644 index c232c2f..0000000 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLScriptEngine.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using OpenSim.Region.Scripting; -using OpenSim.Region.Scripting.LSL; - -namespace OpenSim.Region.Scripting -{ - public class LSLEngine : IScriptCompiler - { - public string FileExt() - { - return ".lso"; - } - - public Dictionary compile(string filename) - { - LSLScript script = new LSLScript(filename, libsecondlife.LLUUID.Zero); - Dictionary returns = new Dictionary(); - - returns.Add(filename, script); - - return returns; - } - } -} \ No newline at end of file -- cgit v1.1