aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting')
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs204
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs138
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs204
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs90
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs1006
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs86
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs854
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs192
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs80
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs270
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs90
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs92
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs74
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs84
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs98
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs238
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs58
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs340
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs280
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs102
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs970
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs1216
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs210
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Script.cs128
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs64
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs116
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs412
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs214
36 files changed, 4059 insertions, 4059 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs
index 1fc576e..b0ccd22 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/CSharpScriptEngine.cs
@@ -1,102 +1,102 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.CodeDom.Compiler; 29using System.CodeDom.Compiler;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using Microsoft.CSharp; 31using Microsoft.CSharp;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33
34namespace OpenSim.Region.Scripting 34namespace OpenSim.Region.Scripting
35{ 35{
36 public class CSharpScriptEngine : IScriptCompiler 36 public class CSharpScriptEngine : IScriptCompiler
37 { 37 {
38 public string FileExt() 38 public string FileExt()
39 { 39 {
40 return ".cs"; 40 return ".cs";
41 } 41 }
42 42
43 private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) 43 private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
44 { 44 {
45 CompilerParameters compilerParams = new CompilerParameters(); 45 CompilerParameters compilerParams = new CompilerParameters();
46 CompilerResults compilerResults; 46 CompilerResults compilerResults;
47 compilerParams.GenerateExecutable = false; 47 compilerParams.GenerateExecutable = false;
48 compilerParams.GenerateInMemory = true; 48 compilerParams.GenerateInMemory = true;
49 compilerParams.IncludeDebugInformation = false; 49 compilerParams.IncludeDebugInformation = false;
50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); 50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); 51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); 52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); 53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
54 compilerParams.ReferencedAssemblies.Add("System.dll"); 54 compilerParams.ReferencedAssemblies.Add("System.dll");
55 55
56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); 56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
57 57
58 if (compilerResults.Errors.Count > 0) 58 if (compilerResults.Errors.Count > 0)
59 { 59 {
60 MainLog.Instance.Error("Compile errors"); 60 MainLog.Instance.Error("Compile errors");
61 foreach (CompilerError error in compilerResults.Errors) 61 foreach (CompilerError error in compilerResults.Errors)
62 { 62 {
63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
64 } 64 }
65 } 65 }
66 else 66 else
67 { 67 {
68 Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); 68 Dictionary<string,IScript> scripts = new Dictionary<string,IScript>();
69 69
70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
71 { 71 {
72 Type testInterface = pluginType.GetInterface("IScript", true); 72 Type testInterface = pluginType.GetInterface("IScript", true);
73 73
74 if (testInterface != null) 74 if (testInterface != null)
75 { 75 {
76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
77 77
78 string scriptName = "C#/" + script.getName(); 78 string scriptName = "C#/" + script.getName();
79 Console.WriteLine("Script: " + scriptName + " loaded."); 79 Console.WriteLine("Script: " + scriptName + " loaded.");
80 80
81 if (!scripts.ContainsKey(scriptName)) 81 if (!scripts.ContainsKey(scriptName))
82 { 82 {
83 scripts.Add(scriptName, script); 83 scripts.Add(scriptName, script);
84 } 84 }
85 else 85 else
86 { 86 {
87 scripts[scriptName] = script; 87 scripts[scriptName] = script;
88 } 88 }
89 } 89 }
90 } 90 }
91 return scripts; 91 return scripts;
92 } 92 }
93 return null; 93 return null;
94 } 94 }
95 95
96 public Dictionary<string,IScript> compile(string filename) 96 public Dictionary<string,IScript> compile(string filename)
97 { 97 {
98 CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); 98 CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
99 return LoadDotNetScript(csharpProvider, filename); 99 return LoadDotNetScript(csharpProvider, filename);
100 } 100 }
101 } 101 }
102} 102}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
index d9f1f0a..79d88b1 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/CSharpEngine/Examples/ExportRegionToLSL.cs
@@ -1,70 +1,70 @@
1using OpenSim.Framework.Console; 1using OpenSim.Framework.Console;
2using OpenSim.Framework; 2using OpenSim.Framework;
3using OpenSim.Region.Environment; 3using OpenSim.Region.Environment;
4using OpenSim.Region.Environment.Scenes; 4using OpenSim.Region.Environment.Scenes;
5 5
6using System.Collections.Generic; 6using System.Collections.Generic;
7using libsecondlife; 7using libsecondlife;
8 8
9namespace OpenSim.Region.Scripting.Examples 9namespace OpenSim.Region.Scripting.Examples
10{ 10{
11 public class LSLExportScript : IScript 11 public class LSLExportScript : IScript
12 { 12 {
13 ScriptInfo script; 13 ScriptInfo script;
14 14
15 public string getName() 15 public string getName()
16 { 16 {
17 return "LSL Export Script 0.1"; 17 return "LSL Export Script 0.1";
18 } 18 }
19 19
20 public void Initialise(ScriptInfo scriptInfo) 20 public void Initialise(ScriptInfo scriptInfo)
21 { 21 {
22 script = scriptInfo; 22 script = scriptInfo;
23 23
24 script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); 24 script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg);
25 } 25 }
26 26
27 void ProcessConsoleMsg(string[] args) 27 void ProcessConsoleMsg(string[] args)
28 { 28 {
29 if (args[0].ToLower() == "lslexport") 29 if (args[0].ToLower() == "lslexport")
30 { 30 {
31 string sequence = ""; 31 string sequence = "";
32 32
33 foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) 33 foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
34 { 34 {
35 SceneObject root = obj.Value; 35 SceneObject root = obj.Value;
36 36
37 sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; 37 sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n";
38 38
39 string rootPrim = processPrimitiveToString(root.rootPrimitive); 39 string rootPrim = processPrimitiveToString(root.rootPrimitive);
40 40
41 sequence += "ROOT:" + rootPrim; 41 sequence += "ROOT:" + rootPrim;
42 42
43 foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) 43 foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children)
44 { 44 {
45 string child = processPrimitiveToString(prim.Value); 45 string child = processPrimitiveToString(prim.Value);
46 sequence += "CHILD:" + child; 46 sequence += "CHILD:" + child;
47 } 47 }
48 } 48 }
49 49
50 System.Console.WriteLine(sequence); 50 System.Console.WriteLine(sequence);
51 } 51 }
52 } 52 }
53 53
54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim) 54 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim)
55 { 55 {
56 string desc = prim.Description; 56 string desc = prim.Description;
57 string name = prim.Name; 57 string name = prim.Name;
58 LLVector3 pos = prim.Pos; 58 LLVector3 pos = prim.Pos;
59 LLVector3 rot = new LLVector3(); 59 LLVector3 rot = new LLVector3();
60 LLVector3 scale = prim.Scale; 60 LLVector3 scale = prim.Scale;
61 LLVector3 rootPos = prim.WorldPos; 61 LLVector3 rootPos = prim.WorldPos;
62 62
63 string setPrimParams = ""; 63 string setPrimParams = "";
64 64
65 setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; 65 setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
66 66
67 return setPrimParams; 67 return setPrimParams;
68 } 68 }
69 } 69 }
70} \ No newline at end of file 70} \ 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
index 0833e7a..af4f8b4 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JScriptEngine/JScriptEngine.cs
@@ -1,102 +1,102 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.CodeDom.Compiler; 29using System.CodeDom.Compiler;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using Microsoft.JScript; 31using Microsoft.JScript;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33
34namespace OpenSim.Region.Scripting 34namespace OpenSim.Region.Scripting
35{ 35{
36 public class JScriptEngine : IScriptCompiler 36 public class JScriptEngine : IScriptCompiler
37 { 37 {
38 public string FileExt() 38 public string FileExt()
39 { 39 {
40 return ".js"; 40 return ".js";
41 } 41 }
42 42
43 private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) 43 private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
44 { 44 {
45 CompilerParameters compilerParams = new CompilerParameters(); 45 CompilerParameters compilerParams = new CompilerParameters();
46 CompilerResults compilerResults; 46 CompilerResults compilerResults;
47 compilerParams.GenerateExecutable = false; 47 compilerParams.GenerateExecutable = false;
48 compilerParams.GenerateInMemory = true; 48 compilerParams.GenerateInMemory = true;
49 compilerParams.IncludeDebugInformation = false; 49 compilerParams.IncludeDebugInformation = false;
50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll"); 50 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); 51 compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); 52 compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); 53 compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
54 compilerParams.ReferencedAssemblies.Add("System.dll"); 54 compilerParams.ReferencedAssemblies.Add("System.dll");
55 55
56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); 56 compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
57 57
58 if (compilerResults.Errors.Count > 0) 58 if (compilerResults.Errors.Count > 0)
59 { 59 {
60 MainLog.Instance.Error("Compile errors"); 60 MainLog.Instance.Error("Compile errors");
61 foreach (CompilerError error in compilerResults.Errors) 61 foreach (CompilerError error in compilerResults.Errors)
62 { 62 {
63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 63 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
64 } 64 }
65 } 65 }
66 else 66 else
67 { 67 {
68 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); 68 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
69 69
70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 70 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
71 { 71 {
72 Type testInterface = pluginType.GetInterface("IScript", true); 72 Type testInterface = pluginType.GetInterface("IScript", true);
73 73
74 if (testInterface != null) 74 if (testInterface != null)
75 { 75 {
76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 76 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
77 77
78 string scriptName = "JS.NET/" + script.getName(); 78 string scriptName = "JS.NET/" + script.getName();
79 Console.WriteLine("Script: " + scriptName + " loaded."); 79 Console.WriteLine("Script: " + scriptName + " loaded.");
80 80
81 if (!scripts.ContainsKey(scriptName)) 81 if (!scripts.ContainsKey(scriptName))
82 { 82 {
83 scripts.Add(scriptName, script); 83 scripts.Add(scriptName, script);
84 } 84 }
85 else 85 else
86 { 86 {
87 scripts[scriptName] = script; 87 scripts[scriptName] = script;
88 } 88 }
89 } 89 }
90 } 90 }
91 return scripts; 91 return scripts;
92 } 92 }
93 return null; 93 return null;
94 } 94 }
95 95
96 public Dictionary<string, IScript> compile(string filename) 96 public Dictionary<string, IScript> compile(string filename)
97 { 97 {
98 JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); 98 JScriptCodeProvider jscriptProvider = new JScriptCodeProvider();
99 return LoadDotNetScript(jscriptProvider, filename); 99 return LoadDotNetScript(jscriptProvider, filename);
100 } 100 }
101 } 101 }
102} 102}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
index 0b1cf41..ca729b4 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassInstance.cs
@@ -1,45 +1,45 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32 32
33namespace OpenSim.Region.Scripting.EmbeddedJVM 33namespace OpenSim.Region.Scripting.EmbeddedJVM
34{ 34{
35 public class ClassInstance : Object 35 public class ClassInstance : Object
36 { 36 {
37 public int size; 37 public int size;
38 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); 38 public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
39 39
40 public ClassInstance() 40 public ClassInstance()
41 { 41 {
42 42
43 } 43 }
44 } 44 }
45} 45}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
index f821f52..f151b7e 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs
@@ -1,503 +1,503 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types;
33 33
34namespace OpenSim.Region.Scripting.EmbeddedJVM 34namespace OpenSim.Region.Scripting.EmbeddedJVM
35{ 35{
36 public class ClassRecord 36 public class ClassRecord
37 { 37 {
38 private ushort _majorVersion; 38 private ushort _majorVersion;
39 private ushort _minorVersion; 39 private ushort _minorVersion;
40 private ushort _constantPoolCount; 40 private ushort _constantPoolCount;
41 private ushort _accessFlags; 41 private ushort _accessFlags;
42 private ushort _thisClass; 42 private ushort _thisClass;
43 private ushort _supperClass; 43 private ushort _supperClass;
44 private ushort _interfaceCount; 44 private ushort _interfaceCount;
45 private ushort _fieldCount; 45 private ushort _fieldCount;
46 private ushort _methodCount; 46 private ushort _methodCount;
47 //private ushort _attributeCount; 47 //private ushort _attributeCount;
48 //private string _name; 48 //private string _name;
49 public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); 49 public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>();
50 public PoolClass mClass; 50 public PoolClass mClass;
51 51
52 public List<PoolItem> _constantsPool = new List<PoolItem>(); 52 public List<PoolItem> _constantsPool = new List<PoolItem>();
53 private List<MethodInfo> _methodsList = new List<MethodInfo>(); 53 private List<MethodInfo> _methodsList = new List<MethodInfo>();
54 private List<FieldInfo> _fieldList = new List<FieldInfo>(); 54 private List<FieldInfo> _fieldList = new List<FieldInfo>();
55 55
56 public ClassRecord() 56 public ClassRecord()
57 { 57 {
58 58
59 } 59 }
60 60
61 public ClassInstance CreateNewInstance() 61 public ClassInstance CreateNewInstance()
62 { 62 {
63 return new ClassInstance(); 63 return new ClassInstance();
64 } 64 }
65 65
66 public void LoadClassFromFile(string fileName) 66 public void LoadClassFromFile(string fileName)
67 { 67 {
68 Console.WriteLine("loading script " + fileName); 68 Console.WriteLine("loading script " + fileName);
69 FileStream fs = File.OpenRead(fileName); 69 FileStream fs = File.OpenRead(fileName);
70 this.LoadClassFromBytes(ReadFully(fs)); 70 this.LoadClassFromBytes(ReadFully(fs));
71 fs.Close(); 71 fs.Close();
72 } 72 }
73 73
74 public void LoadClassFromBytes(byte[] data) 74 public void LoadClassFromBytes(byte[] data)
75 { 75 {
76 int i = 0; 76 int i = 0;
77 i += 4; 77 i += 4;
78 _minorVersion = (ushort)((data[i++] << 8) + data[i++] ); 78 _minorVersion = (ushort)((data[i++] << 8) + data[i++] );
79 _majorVersion = (ushort)((data[i++] << 8) + data[i++] ); 79 _majorVersion = (ushort)((data[i++] << 8) + data[i++] );
80 _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] ); 80 _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] );
81 // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool"); 81 // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool");
82 for (int count = 0; count < _constantPoolCount -1 ; count++) 82 for (int count = 0; count < _constantPoolCount -1 ; count++)
83 { 83 {
84 //read in the constant pool 84 //read in the constant pool
85 byte pooltype = data[i++]; 85 byte pooltype = data[i++];
86 //Console.WriteLine("#" +count +": new constant type = " +pooltype); 86 //Console.WriteLine("#" +count +": new constant type = " +pooltype);
87 //Console.WriteLine("start position is: " + i); 87 //Console.WriteLine("start position is: " + i);
88 switch (pooltype) 88 switch (pooltype)
89 { 89 {
90 case 1: //Utf8 90 case 1: //Utf8
91 ushort uLength = (ushort)((data[i++] << 8) + data[i++] ); 91 ushort uLength = (ushort)((data[i++] << 8) + data[i++] );
92 92
93 // Console.WriteLine("new utf8 type, length is " + uLength); 93 // Console.WriteLine("new utf8 type, length is " + uLength);
94 PoolUtf8 utf8 = new PoolUtf8(); 94 PoolUtf8 utf8 = new PoolUtf8();
95 utf8.readValue(data, ref i, uLength); 95 utf8.readValue(data, ref i, uLength);
96 this._constantsPool.Add(utf8); 96 this._constantsPool.Add(utf8);
97 break; 97 break;
98 case 3: //Int 98 case 3: //Int
99 break; 99 break;
100 case 7: //Class 100 case 7: //Class
101 PoolClass pClass = new PoolClass(this); 101 PoolClass pClass = new PoolClass(this);
102 pClass.readValue(data, ref i); 102 pClass.readValue(data, ref i);
103 this._constantsPool.Add(pClass); 103 this._constantsPool.Add(pClass);
104 break; 104 break;
105 case 10: //Method 105 case 10: //Method
106 PoolMethodRef pMeth = new PoolMethodRef(this); 106 PoolMethodRef pMeth = new PoolMethodRef(this);
107 pMeth.readValue(data, ref i); 107 pMeth.readValue(data, ref i);
108 this._constantsPool.Add(pMeth); 108 this._constantsPool.Add(pMeth);
109 break; 109 break;
110 case 12: //NamedType 110 case 12: //NamedType
111 PoolNamedType pNamed = new PoolNamedType(this); 111 PoolNamedType pNamed = new PoolNamedType(this);
112 pNamed.readValue(data, ref i); 112 pNamed.readValue(data, ref i);
113 this._constantsPool.Add(pNamed); 113 this._constantsPool.Add(pNamed);
114 break; 114 break;
115 } 115 }
116 } 116 }
117 117
118 _accessFlags = (ushort)((data[i++] << 8) + data[i++] ); 118 _accessFlags = (ushort)((data[i++] << 8) + data[i++] );
119 _thisClass = (ushort)((data[i++] << 8) + data[i++] ); 119 _thisClass = (ushort)((data[i++] << 8) + data[i++] );
120 _supperClass = (ushort)((data[i++] << 8) + data[i++] ); 120 _supperClass = (ushort)((data[i++] << 8) + data[i++] );
121 121
122 if (this._constantsPool[this._thisClass - 1] is PoolClass) 122 if (this._constantsPool[this._thisClass - 1] is PoolClass)
123 { 123 {
124 this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]); 124 this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]);
125 } 125 }
126 126
127 _interfaceCount = (ushort)((data[i++] << 8) + data[i++]); 127 _interfaceCount = (ushort)((data[i++] << 8) + data[i++]);
128 //should now read in the info for each interface 128 //should now read in the info for each interface
129 _fieldCount = (ushort)((data[i++] << 8) + data[i++]); 129 _fieldCount = (ushort)((data[i++] << 8) + data[i++]);
130 //should now read in the info for each field 130 //should now read in the info for each field
131 _methodCount = (ushort)((data[i++] << 8) + data[i++]); 131 _methodCount = (ushort)((data[i++] << 8) + data[i++]);
132 for (int count = 0; count < _methodCount; count++) 132 for (int count = 0; count < _methodCount; count++)
133 { 133 {
134 MethodInfo methInf = new MethodInfo(this); 134 MethodInfo methInf = new MethodInfo(this);
135 methInf.ReadData(data, ref i); 135 methInf.ReadData(data, ref i);
136 this._methodsList.Add(methInf); 136 this._methodsList.Add(methInf);
137 } 137 }
138 } 138 }
139 139
140 public void AddMethodsToMemory(MethodMemory memory) 140 public void AddMethodsToMemory(MethodMemory memory)
141 { 141 {
142 for (int count = 0; count < _methodCount; count++) 142 for (int count = 0; count < _methodCount; count++)
143 { 143 {
144 this._methodsList[count].AddMethodCode(memory); 144 this._methodsList[count].AddMethodCode(memory);
145 } 145 }
146 } 146 }
147 147
148 public bool StartMethod(Thread thread, string methodName) 148 public bool StartMethod(Thread thread, string methodName)
149 { 149 {
150 for (int count = 0; count < _methodCount; count++) 150 for (int count = 0; count < _methodCount; count++)
151 { 151 {
152 if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8) 152 if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8)
153 { 153 {
154 if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName) 154 if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName)
155 { 155 {
156 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); 156 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value);
157 thread.SetPC(this._methodsList[count].CodePointer); 157 thread.SetPC(this._methodsList[count].CodePointer);
158 return true; 158 return true;
159 } 159 }
160 } 160 }
161 } 161 }
162 return false; 162 return false;
163 } 163 }
164 164
165 public void PrintToConsole() 165 public void PrintToConsole()
166 { 166 {
167 Console.WriteLine("Class File:"); 167 Console.WriteLine("Class File:");
168 Console.WriteLine("Major version: " + _majorVersion); 168 Console.WriteLine("Major version: " + _majorVersion);
169 Console.WriteLine("Minor version: " + _minorVersion); 169 Console.WriteLine("Minor version: " + _minorVersion);
170 Console.WriteLine("Pool size: " + _constantPoolCount); 170 Console.WriteLine("Pool size: " + _constantPoolCount);
171 171
172 for (int i = 0; i < _constantsPool.Count; i++) 172 for (int i = 0; i < _constantsPool.Count; i++)
173 { 173 {
174 this._constantsPool[i].Print(); 174 this._constantsPool[i].Print();
175 } 175 }
176 176
177 Console.WriteLine("Access flags: " + _accessFlags); 177 Console.WriteLine("Access flags: " + _accessFlags);
178 Console.WriteLine("This class: " + _thisClass ); 178 Console.WriteLine("This class: " + _thisClass );
179 Console.WriteLine("Super class: " + _supperClass); 179 Console.WriteLine("Super class: " + _supperClass);
180 180
181 for (int count = 0; count < _methodCount; count++) 181 for (int count = 0; count < _methodCount; count++)
182 { 182 {
183 Console.WriteLine(); 183 Console.WriteLine();
184 this._methodsList[count].Print(); 184 this._methodsList[count].Print();
185 } 185 }
186 186
187 Console.WriteLine("class name is " + this.mClass.Name.Value); 187 Console.WriteLine("class name is " + this.mClass.Name.Value);
188 } 188 }
189 189
190 public static byte[] ReadFully(Stream stream) 190 public static byte[] ReadFully(Stream stream)
191 { 191 {
192 byte[] buffer = new byte[1024]; 192 byte[] buffer = new byte[1024];
193 using (MemoryStream ms = new MemoryStream()) 193 using (MemoryStream ms = new MemoryStream())
194 { 194 {
195 while (true) 195 while (true)
196 { 196 {
197 int read = stream.Read(buffer, 0, buffer.Length); 197 int read = stream.Read(buffer, 0, buffer.Length);
198 if (read <= 0) 198 if (read <= 0)
199 return ms.ToArray(); 199 return ms.ToArray();
200 ms.Write(buffer, 0, read); 200 ms.Write(buffer, 0, read);
201 } 201 }
202 } 202 }
203 } 203 }
204 204
205 #region nested classes 205 #region nested classes
206 public class PoolItem 206 public class PoolItem
207 { 207 {
208 public virtual void Print() 208 public virtual void Print()
209 { 209 {
210 210
211 } 211 }
212 } 212 }
213 213
214 public class PoolUtf8 : PoolItem 214 public class PoolUtf8 : PoolItem
215 { 215 {
216 public string Value = ""; 216 public string Value = "";
217 217
218 public void readValue(byte[] data,ref int pointer , int length) 218 public void readValue(byte[] data,ref int pointer , int length)
219 { 219 {
220 for (int i = 0; i < length; i++) 220 for (int i = 0; i < length; i++)
221 { 221 {
222 int a =(int) data[pointer++]; 222 int a =(int) data[pointer++];
223 if ((a & 0x80) == 0) 223 if ((a & 0x80) == 0)
224 { 224 {
225 Value = Value + (char)a; 225 Value = Value + (char)a;
226 } 226 }
227 else if ((a & 0x20) == 0) 227 else if ((a & 0x20) == 0)
228 { 228 {
229 int b = (int) data[pointer++]; 229 int b = (int) data[pointer++];
230 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); 230 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f));
231 } 231 }
232 else 232 else
233 { 233 {
234 int b = (int)data[pointer++]; 234 int b = (int)data[pointer++];
235 int c = (int)data[pointer++]; 235 int c = (int)data[pointer++];
236 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); 236 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f));
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 public override void Print() 241 public override void Print()
242 { 242 {
243 Console.WriteLine("Utf8 type: " + Value); 243 Console.WriteLine("Utf8 type: " + Value);
244 } 244 }
245 } 245 }
246 246
247 private class PoolInt : PoolItem 247 private class PoolInt : PoolItem
248 { 248 {
249 249
250 } 250 }
251 251
252 public class PoolClass : PoolItem 252 public class PoolClass : PoolItem
253 { 253 {
254 //public string name = ""; 254 //public string name = "";
255 public ushort namePointer = 0; 255 public ushort namePointer = 0;
256 private ClassRecord parent; 256 private ClassRecord parent;
257 public PoolUtf8 Name; 257 public PoolUtf8 Name;
258 258
259 public PoolClass(ClassRecord paren) 259 public PoolClass(ClassRecord paren)
260 { 260 {
261 parent = paren; 261 parent = paren;
262 } 262 }
263 263
264 public void readValue(byte[] data, ref int pointer) 264 public void readValue(byte[] data, ref int pointer)
265 { 265 {
266 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 266 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] );
267 } 267 }
268 268
269 public override void Print() 269 public override void Print()
270 { 270 {
271 this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); 271 this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]);
272 Console.Write("Class type: " + namePointer); 272 Console.Write("Class type: " + namePointer);
273 Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); 273 Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value);
274 274
275 } 275 }
276 } 276 }
277 277
278 public class PoolMethodRef : PoolItem 278 public class PoolMethodRef : PoolItem
279 { 279 {
280 public ushort classPointer = 0; 280 public ushort classPointer = 0;
281 public ushort nameTypePointer = 0; 281 public ushort nameTypePointer = 0;
282 public PoolNamedType mNameType; 282 public PoolNamedType mNameType;
283 public PoolClass mClass; 283 public PoolClass mClass;
284 private ClassRecord parent; 284 private ClassRecord parent;
285 285
286 public PoolMethodRef(ClassRecord paren) 286 public PoolMethodRef(ClassRecord paren)
287 { 287 {
288 parent = paren; 288 parent = paren;
289 } 289 }
290 290
291 public void readValue(byte[] data, ref int pointer) 291 public void readValue(byte[] data, ref int pointer)
292 { 292 {
293 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 293 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
294 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 294 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]);
295 } 295 }
296 296
297 public override void Print() 297 public override void Print()
298 { 298 {
299 this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); 299 this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]);
300 this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); 300 this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]);
301 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); 301 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer);
302 } 302 }
303 } 303 }
304 304
305 public class PoolNamedType : PoolItem 305 public class PoolNamedType : PoolItem
306 { 306 {
307 public ushort namePointer = 0; 307 public ushort namePointer = 0;
308 public ushort typePointer = 0; 308 public ushort typePointer = 0;
309 private ClassRecord parent; 309 private ClassRecord parent;
310 public PoolUtf8 Name; 310 public PoolUtf8 Name;
311 public PoolUtf8 Type; 311 public PoolUtf8 Type;
312 312
313 public PoolNamedType(ClassRecord paren) 313 public PoolNamedType(ClassRecord paren)
314 { 314 {
315 parent = paren; 315 parent = paren;
316 } 316 }
317 317
318 public void readValue(byte[] data, ref int pointer) 318 public void readValue(byte[] data, ref int pointer)
319 { 319 {
320 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 320 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] );
321 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); 321 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] );
322 } 322 }
323 323
324 public override void Print() 324 public override void Print()
325 { 325 {
326 Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]); 326 Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]);
327 Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]); 327 Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]);
328 Console.Write("Named type: " + namePointer + " , " + typePointer ); 328 Console.Write("Named type: " + namePointer + " , " + typePointer );
329 Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value); 329 Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value);
330 } 330 }
331 } 331 }
332 332
333 //*********************** 333 //***********************
334 public class MethodInfo 334 public class MethodInfo
335 { 335 {
336 public ushort AccessFlags = 0; 336 public ushort AccessFlags = 0;
337 public ushort NameIndex = 0; 337 public ushort NameIndex = 0;
338 public string Name = ""; 338 public string Name = "";
339 public ushort DescriptorIndex = 0; 339 public ushort DescriptorIndex = 0;
340 public ushort AttributeCount = 0; 340 public ushort AttributeCount = 0;
341 public List<MethodAttribute> Attributes = new List<MethodAttribute>(); 341 public List<MethodAttribute> Attributes = new List<MethodAttribute>();
342 private ClassRecord parent; 342 private ClassRecord parent;
343 public int CodePointer = 0; 343 public int CodePointer = 0;
344 344
345 public MethodInfo(ClassRecord paren) 345 public MethodInfo(ClassRecord paren)
346 { 346 {
347 parent = paren; 347 parent = paren;
348 } 348 }
349 349
350 public void AddMethodCode(MethodMemory memory) 350 public void AddMethodCode(MethodMemory memory)
351 { 351 {
352 Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); 352 Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length);
353 memory.Methodcount++; 353 memory.Methodcount++;
354 this.CodePointer = memory.NextMethodPC; 354 this.CodePointer = memory.NextMethodPC;
355 memory.NextMethodPC += this.Attributes[0].Code.Length; 355 memory.NextMethodPC += this.Attributes[0].Code.Length;
356 } 356 }
357 357
358 public void ReadData(byte[] data, ref int pointer) 358 public void ReadData(byte[] data, ref int pointer)
359 { 359 {
360 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); 360 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]);
361 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 361 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
362 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 362 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
363 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 363 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
364 for(int i =0; i< AttributeCount; i++) 364 for(int i =0; i< AttributeCount; i++)
365 { 365 {
366 MethodAttribute attri = new MethodAttribute(this.parent); 366 MethodAttribute attri = new MethodAttribute(this.parent);
367 attri.ReadData(data, ref pointer); 367 attri.ReadData(data, ref pointer);
368 this.Attributes.Add(attri); 368 this.Attributes.Add(attri);
369 } 369 }
370 } 370 }
371 371
372 public void Print() 372 public void Print()
373 { 373 {
374 Console.WriteLine("Method Info Struct: "); 374 Console.WriteLine("Method Info Struct: ");
375 Console.WriteLine("AccessFlags: " + AccessFlags); 375 Console.WriteLine("AccessFlags: " + AccessFlags);
376 Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); 376 Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value);
377 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value); 377 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value);
378 Console.WriteLine("Attribute Count:" + AttributeCount); 378 Console.WriteLine("Attribute Count:" + AttributeCount);
379 for (int i = 0; i < AttributeCount; i++) 379 for (int i = 0; i < AttributeCount; i++)
380 { 380 {
381 this.Attributes[i].Print(); 381 this.Attributes[i].Print();
382 } 382 }
383 } 383 }
384 384
385 public class MethodAttribute 385 public class MethodAttribute
386 { 386 {
387 public ushort NameIndex = 0; 387 public ushort NameIndex = 0;
388 public string Name = ""; 388 public string Name = "";
389 public Int32 Length = 0; 389 public Int32 Length = 0;
390 //for now only support code attribute 390 //for now only support code attribute
391 public ushort MaxStack = 0; 391 public ushort MaxStack = 0;
392 public ushort MaxLocals = 0; 392 public ushort MaxLocals = 0;
393 public Int32 CodeLength = 0; 393 public Int32 CodeLength = 0;
394 public byte[] Code; 394 public byte[] Code;
395 public ushort ExceptionTableLength = 0; 395 public ushort ExceptionTableLength = 0;
396 public ushort SubAttributeCount = 0; 396 public ushort SubAttributeCount = 0;
397 public List<SubAttribute> SubAttributes = new List<SubAttribute>(); 397 public List<SubAttribute> SubAttributes = new List<SubAttribute>();
398 private ClassRecord parent; 398 private ClassRecord parent;
399 399
400 public MethodAttribute(ClassRecord paren) 400 public MethodAttribute(ClassRecord paren)
401 { 401 {
402 parent = paren; 402 parent = paren;
403 } 403 }
404 404
405 public void ReadData(byte[] data, ref int pointer) 405 public void ReadData(byte[] data, ref int pointer)
406 { 406 {
407 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 407 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
408 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 408 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
409 MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); 409 MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]);
410 MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); 410 MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]);
411 CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 411 CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
412 Code = new byte[CodeLength]; 412 Code = new byte[CodeLength];
413 for (int i = 0; i < CodeLength; i++) 413 for (int i = 0; i < CodeLength; i++)
414 { 414 {
415 Code[i] = data[pointer++]; 415 Code[i] = data[pointer++];
416 } 416 }
417 ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); 417 ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]);
418 SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 418 SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]);
419 for (int i = 0; i < SubAttributeCount; i++) 419 for (int i = 0; i < SubAttributeCount; i++)
420 { 420 {
421 SubAttribute subAttri = new SubAttribute(this.parent); 421 SubAttribute subAttri = new SubAttribute(this.parent);
422 subAttri.ReadData(data, ref pointer); 422 subAttri.ReadData(data, ref pointer);
423 this.SubAttributes.Add(subAttri); 423 this.SubAttributes.Add(subAttri);
424 } 424 }
425 } 425 }
426 426
427 public void Print() 427 public void Print()
428 { 428 {
429 Console.WriteLine("Method Attribute: "); 429 Console.WriteLine("Method Attribute: ");
430 Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); 430 Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value);
431 Console.WriteLine("Length: " + Length); 431 Console.WriteLine("Length: " + Length);
432 Console.WriteLine("MaxStack: " + MaxStack); 432 Console.WriteLine("MaxStack: " + MaxStack);
433 Console.WriteLine("MaxLocals: " + MaxLocals); 433 Console.WriteLine("MaxLocals: " + MaxLocals);
434 Console.WriteLine("CodeLength: " + CodeLength); 434 Console.WriteLine("CodeLength: " + CodeLength);
435 for (int i = 0; i < Code.Length; i++) 435 for (int i = 0; i < Code.Length; i++)
436 { 436 {
437 Console.WriteLine("OpCode #" + i + " is: " + Code[i]); 437 Console.WriteLine("OpCode #" + i + " is: " + Code[i]);
438 } 438 }
439 Console.WriteLine("SubAttributes: " + SubAttributeCount); 439 Console.WriteLine("SubAttributes: " + SubAttributeCount);
440 for (int i = 0; i < SubAttributeCount; i++) 440 for (int i = 0; i < SubAttributeCount; i++)
441 { 441 {
442 this.SubAttributes[i].Print(); 442 this.SubAttributes[i].Print();
443 } 443 }
444 } 444 }
445 445
446 public class SubAttribute 446 public class SubAttribute
447 { 447 {
448 public ushort NameIndex = 0; 448 public ushort NameIndex = 0;
449 public string Name = ""; 449 public string Name = "";
450 public Int32 Length = 0; 450 public Int32 Length = 0;
451 public byte[] Data; 451 public byte[] Data;
452 private ClassRecord parent; 452 private ClassRecord parent;
453 453
454 public SubAttribute(ClassRecord paren) 454 public SubAttribute(ClassRecord paren)
455 { 455 {
456 parent = paren; 456 parent = paren;
457 } 457 }
458 458
459 public void ReadData(byte[] data, ref int pointer) 459 public void ReadData(byte[] data, ref int pointer)
460 { 460 {
461 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 461 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]);
462 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 462 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
463 Data = new byte[Length]; 463 Data = new byte[Length];
464 for (int i = 0; i < Length; i++) 464 for (int i = 0; i < Length; i++)
465 { 465 {
466 Data[i] = data[pointer++]; 466 Data[i] = data[pointer++];
467 } 467 }
468 } 468 }
469 469
470 public void Print() 470 public void Print()
471 { 471 {
472 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); 472 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
473 } 473 }
474 474
475 } 475 }
476 } 476 }
477 477
478 } 478 }
479 private class InterfaceInfo 479 private class InterfaceInfo
480 { 480 {
481 public void ReadData(byte[] data, ref int i) 481 public void ReadData(byte[] data, ref int i)
482 { 482 {
483 483
484 } 484 }
485 } 485 }
486 private class FieldInfo 486 private class FieldInfo
487 { 487 {
488 public void ReadData(byte[] data, ref int i) 488 public void ReadData(byte[] data, ref int i)
489 { 489 {
490 490
491 } 491 }
492 } 492 }
493 private class AttributeInfo 493 private class AttributeInfo
494 { 494 {
495 public void ReadData(byte[] data, ref int i) 495 public void ReadData(byte[] data, ref int i)
496 { 496 {
497 497
498 } 498 }
499 } 499 }
500 #endregion 500 #endregion
501 501
502 } 502 }
503} 503}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs
index 1a97b7d..c6423fc 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Heap.cs
@@ -1,43 +1,43 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class Heap 34 public class Heap
35 { 35 {
36 public List<ClassInstance> ClassObjects = new List<ClassInstance>(); 36 public List<ClassInstance> ClassObjects = new List<ClassInstance>();
37 37
38 public Heap() 38 public Heap()
39 { 39 {
40 40
41 } 41 }
42 } 42 }
43} 43}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
index ef6b805..56135d3 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs
@@ -1,427 +1,427 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33 33
34namespace OpenSim.Region.Scripting.EmbeddedJVM 34namespace OpenSim.Region.Scripting.EmbeddedJVM
35{ 35{
36 partial class Thread 36 partial class Thread
37 { 37 {
38 private partial class Interpreter 38 private partial class Interpreter
39 { 39 {
40 private bool IsLogicOpCode(byte opcode) 40 private bool IsLogicOpCode(byte opcode)
41 { 41 {
42 bool result = false; 42 bool result = false;
43 switch (opcode) 43 switch (opcode)
44 { 44 {
45 case 2: 45 case 2:
46 Int m_int= new Int(); 46 Int m_int= new Int();
47 m_int.mValue = -1; 47 m_int.mValue = -1;
48 this._mThread.currentFrame.OpStack.Push(m_int); 48 this._mThread.currentFrame.OpStack.Push(m_int);
49 result = true; 49 result = true;
50 break; 50 break;
51 case 3: 51 case 3:
52 m_int= new Int(); 52 m_int= new Int();
53 m_int.mValue = 0; 53 m_int.mValue = 0;
54 this._mThread.currentFrame.OpStack.Push(m_int); 54 this._mThread.currentFrame.OpStack.Push(m_int);
55 result = true; 55 result = true;
56 break; 56 break;
57 case 4: 57 case 4:
58 m_int = new Int(); 58 m_int = new Int();
59 m_int.mValue = 1; 59 m_int.mValue = 1;
60 this._mThread.currentFrame.OpStack.Push(m_int); 60 this._mThread.currentFrame.OpStack.Push(m_int);
61 result = true; 61 result = true;
62 break; 62 break;
63 case 5: 63 case 5:
64 m_int = new Int(); 64 m_int = new Int();
65 m_int.mValue = 2; 65 m_int.mValue = 2;
66 this._mThread.currentFrame.OpStack.Push(m_int); 66 this._mThread.currentFrame.OpStack.Push(m_int);
67 result = true; 67 result = true;
68 break; 68 break;
69 case 6: 69 case 6:
70 m_int = new Int(); 70 m_int = new Int();
71 m_int.mValue = 3; 71 m_int.mValue = 3;
72 this._mThread.currentFrame.OpStack.Push(m_int); 72 this._mThread.currentFrame.OpStack.Push(m_int);
73 break; 73 break;
74 case 7: 74 case 7:
75 m_int = new Int(); 75 m_int = new Int();
76 m_int.mValue = 4; 76 m_int.mValue = 4;
77 this._mThread.currentFrame.OpStack.Push(m_int); 77 this._mThread.currentFrame.OpStack.Push(m_int);
78 result = true; 78 result = true;
79 break; 79 break;
80 case 8: 80 case 8:
81 m_int = new Int(); 81 m_int = new Int();
82 m_int.mValue = 5; 82 m_int.mValue = 5;
83 this._mThread.currentFrame.OpStack.Push(m_int); 83 this._mThread.currentFrame.OpStack.Push(m_int);
84 result = true; 84 result = true;
85 break; 85 break;
86 case 11: 86 case 11:
87 Float m_float = new Float(); 87 Float m_float = new Float();
88 m_float.mValue = 0.0f; 88 m_float.mValue = 0.0f;
89 this._mThread.currentFrame.OpStack.Push(m_float); 89 this._mThread.currentFrame.OpStack.Push(m_float);
90 result = true; 90 result = true;
91 break; 91 break;
92 case 12: 92 case 12:
93 m_float = new Float(); 93 m_float = new Float();
94 m_float.mValue = 1.0f; 94 m_float.mValue = 1.0f;
95 this._mThread.currentFrame.OpStack.Push(m_float); 95 this._mThread.currentFrame.OpStack.Push(m_float);
96 result = true; 96 result = true;
97 break; 97 break;
98 case 13: 98 case 13:
99 m_float = new Float(); 99 m_float = new Float();
100 m_float.mValue = 2.0f; 100 m_float.mValue = 2.0f;
101 this._mThread.currentFrame.OpStack.Push(m_float); 101 this._mThread.currentFrame.OpStack.Push(m_float);
102 result = true; 102 result = true;
103 break; 103 break;
104 case 16: 104 case 16:
105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; 105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC];
106 Int pushInt = new Int(); 106 Int pushInt = new Int();
107 pushInt.mValue = pushvalue; 107 pushInt.mValue = pushvalue;
108 this._mThread.currentFrame.OpStack.Push(pushInt); 108 this._mThread.currentFrame.OpStack.Push(pushInt);
109 this._mThread.PC++; 109 this._mThread.PC++;
110 result = true; 110 result = true;
111 break; 111 break;
112 case 17: 112 case 17:
113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
114 Int pushInt2 = new Int(); 114 Int pushInt2 = new Int();
115 pushInt2.mValue = pushvalue2; 115 pushInt2.mValue = pushvalue2;
116 this._mThread.currentFrame.OpStack.Push(pushInt2); 116 this._mThread.currentFrame.OpStack.Push(pushInt2);
117 this._mThread.PC += 2; 117 this._mThread.PC += 2;
118 result = true; 118 result = true;
119 break; 119 break;
120 case 23: 120 case 23:
121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); 121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
122 Float fload = new Float(); 122 Float fload = new Float();
123 if (this._mThread.currentFrame.LocalVariables[findex1] != null) 123 if (this._mThread.currentFrame.LocalVariables[findex1] != null)
124 { 124 {
125 if (this._mThread.currentFrame.LocalVariables[findex1] is Float) 125 if (this._mThread.currentFrame.LocalVariables[findex1] is Float)
126 { 126 {
127 fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue; 127 fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue;
128 this._mThread.currentFrame.OpStack.Push(fload); 128 this._mThread.currentFrame.OpStack.Push(fload);
129 } 129 }
130 } 130 }
131 this._mThread.PC++; 131 this._mThread.PC++;
132 result = true; 132 result = true;
133 break; 133 break;
134 case 26: 134 case 26:
135 if (this._mThread.currentFrame.LocalVariables[0] != null) 135 if (this._mThread.currentFrame.LocalVariables[0] != null)
136 { 136 {
137 if (this._mThread.currentFrame.LocalVariables[0] is Int) 137 if (this._mThread.currentFrame.LocalVariables[0] is Int)
138 { 138 {
139 Int newInt = new Int(); 139 Int newInt = new Int();
140 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue; 140 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue;
141 this._mThread.currentFrame.OpStack.Push(newInt); 141 this._mThread.currentFrame.OpStack.Push(newInt);
142 } 142 }
143 } 143 }
144 result = true; 144 result = true;
145 break; 145 break;
146 case 27: 146 case 27:
147 if (this._mThread.currentFrame.LocalVariables[1] != null) 147 if (this._mThread.currentFrame.LocalVariables[1] != null)
148 { 148 {
149 if (this._mThread.currentFrame.LocalVariables[1] is Int) 149 if (this._mThread.currentFrame.LocalVariables[1] is Int)
150 { 150 {
151 Int newInt = new Int(); 151 Int newInt = new Int();
152 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue; 152 newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue;
153 this._mThread.currentFrame.OpStack.Push(newInt); 153 this._mThread.currentFrame.OpStack.Push(newInt);
154 } 154 }
155 } 155 }
156 result = true; 156 result = true;
157 break; 157 break;
158 case 34: 158 case 34:
159 if (this._mThread.currentFrame.LocalVariables[0] != null) 159 if (this._mThread.currentFrame.LocalVariables[0] != null)
160 { 160 {
161 if (this._mThread.currentFrame.LocalVariables[0] is Float) 161 if (this._mThread.currentFrame.LocalVariables[0] is Float)
162 { 162 {
163 Float newfloat = new Float(); 163 Float newfloat = new Float();
164 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue; 164 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue;
165 this._mThread.currentFrame.OpStack.Push(newfloat); 165 this._mThread.currentFrame.OpStack.Push(newfloat);
166 } 166 }
167 } 167 }
168 result = true; 168 result = true;
169 break; 169 break;
170 case 35: 170 case 35:
171 if (this._mThread.currentFrame.LocalVariables[1] != null) 171 if (this._mThread.currentFrame.LocalVariables[1] != null)
172 { 172 {
173 if (this._mThread.currentFrame.LocalVariables[1] is Float) 173 if (this._mThread.currentFrame.LocalVariables[1] is Float)
174 { 174 {
175 Float newfloat = new Float(); 175 Float newfloat = new Float();
176 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue; 176 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue;
177 this._mThread.currentFrame.OpStack.Push(newfloat); 177 this._mThread.currentFrame.OpStack.Push(newfloat);
178 } 178 }
179 } 179 }
180 result = true; 180 result = true;
181 break; 181 break;
182 case 36: 182 case 36:
183 if (this._mThread.currentFrame.LocalVariables[2] != null) 183 if (this._mThread.currentFrame.LocalVariables[2] != null)
184 { 184 {
185 if (this._mThread.currentFrame.LocalVariables[2] is Float) 185 if (this._mThread.currentFrame.LocalVariables[2] is Float)
186 { 186 {
187 Float newfloat = new Float(); 187 Float newfloat = new Float();
188 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue; 188 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue;
189 this._mThread.currentFrame.OpStack.Push(newfloat); 189 this._mThread.currentFrame.OpStack.Push(newfloat);
190 } 190 }
191 } 191 }
192 result = true; 192 result = true;
193 break; 193 break;
194 case 37: 194 case 37:
195 if (this._mThread.currentFrame.LocalVariables[3] != null) 195 if (this._mThread.currentFrame.LocalVariables[3] != null)
196 { 196 {
197 if (this._mThread.currentFrame.LocalVariables[3] is Float) 197 if (this._mThread.currentFrame.LocalVariables[3] is Float)
198 { 198 {
199 Float newfloat = new Float(); 199 Float newfloat = new Float();
200 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue; 200 newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue;
201 this._mThread.currentFrame.OpStack.Push(newfloat); 201 this._mThread.currentFrame.OpStack.Push(newfloat);
202 } 202 }
203 } 203 }
204 result = true; 204 result = true;
205 break; 205 break;
206 case 56: 206 case 56:
207 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); 207 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] ));
208 BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); 208 BaseType fstor = this._mThread.currentFrame.OpStack.Pop();
209 if (fstor is Float) 209 if (fstor is Float)
210 { 210 {
211 this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor; 211 this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor;
212 } 212 }
213 this._mThread.PC++; 213 this._mThread.PC++;
214 result = true; 214 result = true;
215 break; 215 break;
216 case 59: 216 case 59:
217 BaseType baset = this._mThread.currentFrame.OpStack.Pop(); 217 BaseType baset = this._mThread.currentFrame.OpStack.Pop();
218 if (baset is Int) 218 if (baset is Int)
219 { 219 {
220 this._mThread.currentFrame.LocalVariables[0] = (Int)baset; 220 this._mThread.currentFrame.LocalVariables[0] = (Int)baset;
221 } 221 }
222 result = true; 222 result = true;
223 break; 223 break;
224 case 60: 224 case 60:
225 baset = this._mThread.currentFrame.OpStack.Pop(); 225 baset = this._mThread.currentFrame.OpStack.Pop();
226 if (baset is Int) 226 if (baset is Int)
227 { 227 {
228 this._mThread.currentFrame.LocalVariables[1] = (Int)baset; 228 this._mThread.currentFrame.LocalVariables[1] = (Int)baset;
229 } 229 }
230 result = true; 230 result = true;
231 break; 231 break;
232 case 67: 232 case 67:
233 baset = this._mThread.currentFrame.OpStack.Pop(); 233 baset = this._mThread.currentFrame.OpStack.Pop();
234 if (baset is Float) 234 if (baset is Float)
235 { 235 {
236 this._mThread.currentFrame.LocalVariables[0] = (Float)baset; 236 this._mThread.currentFrame.LocalVariables[0] = (Float)baset;
237 } 237 }
238 result = true; 238 result = true;
239 break; 239 break;
240 case 68: 240 case 68:
241 baset = this._mThread.currentFrame.OpStack.Pop(); 241 baset = this._mThread.currentFrame.OpStack.Pop();
242 if (baset is Float) 242 if (baset is Float)
243 { 243 {
244 this._mThread.currentFrame.LocalVariables[1] = (Float)baset; 244 this._mThread.currentFrame.LocalVariables[1] = (Float)baset;
245 } 245 }
246 result = true; 246 result = true;
247 break; 247 break;
248 case 69: 248 case 69:
249 baset = this._mThread.currentFrame.OpStack.Pop(); 249 baset = this._mThread.currentFrame.OpStack.Pop();
250 if (baset is Float) 250 if (baset is Float)
251 { 251 {
252 this._mThread.currentFrame.LocalVariables[2] = (Float)baset; 252 this._mThread.currentFrame.LocalVariables[2] = (Float)baset;
253 } 253 }
254 result = true; 254 result = true;
255 break; 255 break;
256 case 70: 256 case 70:
257 baset = this._mThread.currentFrame.OpStack.Pop(); 257 baset = this._mThread.currentFrame.OpStack.Pop();
258 if (baset is Float) 258 if (baset is Float)
259 { 259 {
260 this._mThread.currentFrame.LocalVariables[3] = (Float)baset; 260 this._mThread.currentFrame.LocalVariables[3] = (Float)baset;
261 } 261 }
262 result = true; 262 result = true;
263 break; 263 break;
264 case 87: 264 case 87:
265 this._mThread.currentFrame.OpStack.Pop(); 265 this._mThread.currentFrame.OpStack.Pop();
266 result = true; 266 result = true;
267 break; 267 break;
268 case 98: 268 case 98:
269 BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); 269 BaseType bf2 = this._mThread.currentFrame.OpStack.Pop();
270 BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); 270 BaseType bf1 = this._mThread.currentFrame.OpStack.Pop();
271 if (bf1 is Float && bf2 is Float) 271 if (bf1 is Float && bf2 is Float)
272 { 272 {
273 Float nflt = new Float(); 273 Float nflt = new Float();
274 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; 274 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue;
275 this._mThread.currentFrame.OpStack.Push(nflt); 275 this._mThread.currentFrame.OpStack.Push(nflt);
276 } 276 }
277 result = true; 277 result = true;
278 break; 278 break;
279 case 102: 279 case 102:
280 BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); 280 BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop();
281 BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); 281 BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop();
282 if (bsf1 is Float && bsf2 is Float) 282 if (bsf1 is Float && bsf2 is Float)
283 { 283 {
284 Float resf = new Float(); 284 Float resf = new Float();
285 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; 285 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue;
286 this._mThread.currentFrame.OpStack.Push(resf); 286 this._mThread.currentFrame.OpStack.Push(resf);
287 } 287 }
288 result = true; 288 result = true;
289 break; 289 break;
290 case 104: //check the order of the two values off the stack is correct 290 case 104: //check the order of the two values off the stack is correct
291 BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); 291 BaseType bs2 = this._mThread.currentFrame.OpStack.Pop();
292 BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); 292 BaseType bs1 = this._mThread.currentFrame.OpStack.Pop();
293 if (bs1 is Int && bs2 is Int) 293 if (bs1 is Int && bs2 is Int)
294 { 294 {
295 Int nInt = new Int(); 295 Int nInt = new Int();
296 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; 296 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue;
297 this._mThread.currentFrame.OpStack.Push(nInt); 297 this._mThread.currentFrame.OpStack.Push(nInt);
298 } 298 }
299 result = true; 299 result = true;
300 break; 300 break;
301 case 132: 301 case 132:
302 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) 302 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null)
303 { 303 {
304 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) 304 if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int)
305 { 305 {
306 ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; 306 ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1];
307 } 307 }
308 } 308 }
309 this._mThread.PC += 2; 309 this._mThread.PC += 2;
310 result = true; 310 result = true;
311 break; 311 break;
312 case 139: 312 case 139:
313 BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); 313 BaseType conv1 = this._mThread.currentFrame.OpStack.Pop();
314 if (conv1 is Float) 314 if (conv1 is Float)
315 { 315 {
316 Int newconv = new Int(); 316 Int newconv = new Int();
317 newconv.mValue = (int)((Float)conv1).mValue; 317 newconv.mValue = (int)((Float)conv1).mValue;
318 this._mThread.currentFrame.OpStack.Push(newconv); 318 this._mThread.currentFrame.OpStack.Push(newconv);
319 } 319 }
320 result = true; 320 result = true;
321 break; 321 break;
322 case 149: 322 case 149:
323 BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); 323 BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop();
324 BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); 324 BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop();
325 if (flcom1 is Float && flcom2 is Float) 325 if (flcom1 is Float && flcom2 is Float)
326 { 326 {
327 Int compres = new Int(); 327 Int compres = new Int();
328 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 328 if (((Float)flcom1).mValue < ((Float)flcom2).mValue)
329 { 329 {
330 compres.mValue = -1; 330 compres.mValue = -1;
331 } 331 }
332 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 332 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue)
333 { 333 {
334 compres.mValue = 1; 334 compres.mValue = 1;
335 } 335 }
336 else 336 else
337 { 337 {
338 compres.mValue = 0; 338 compres.mValue = 0;
339 } 339 }
340 this._mThread.currentFrame.OpStack.Push(compres); 340 this._mThread.currentFrame.OpStack.Push(compres);
341 } 341 }
342 result = true; 342 result = true;
343 break; 343 break;
344 case 158: 344 case 158:
345 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 345 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
346 BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); 346 BaseType comp1 = this._mThread.currentFrame.OpStack.Pop();
347 if (comp1 is Int) 347 if (comp1 is Int)
348 { 348 {
349 if (((Int)comp1).mValue <= 0) 349 if (((Int)comp1).mValue <= 0)
350 { 350 {
351 this._mThread.PC += -1 + compareoffset1; 351 this._mThread.PC += -1 + compareoffset1;
352 } 352 }
353 else 353 else
354 { 354 {
355 this._mThread.PC += 2; 355 this._mThread.PC += 2;
356 } 356 }
357 } 357 }
358 else 358 else
359 { 359 {
360 this._mThread.PC += 2; 360 this._mThread.PC += 2;
361 } 361 }
362 result = true; 362 result = true;
363 break; 363 break;
364 case 162: 364 case 162:
365 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 365 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
366 BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); 366 BaseType bc2 = this._mThread.currentFrame.OpStack.Pop();
367 BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); 367 BaseType bc1 = this._mThread.currentFrame.OpStack.Pop();
368 if (bc1 is Int && bc2 is Int) 368 if (bc1 is Int && bc2 is Int)
369 { 369 {
370 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); 370 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
371 if (((Int)bc1).mValue >= ((Int)bc2).mValue) 371 if (((Int)bc1).mValue >= ((Int)bc2).mValue)
372 { 372 {
373 // Console.WriteLine("branch compare true , offset is " +compareoffset); 373 // Console.WriteLine("branch compare true , offset is " +compareoffset);
374 // Console.WriteLine("current PC is " + this._mThread.PC); 374 // Console.WriteLine("current PC is " + this._mThread.PC);
375 this._mThread.PC += -1 + compareoffset; 375 this._mThread.PC += -1 + compareoffset;
376 //Console.WriteLine("new PC is " + this._mThread.PC); 376 //Console.WriteLine("new PC is " + this._mThread.PC);
377 } 377 }
378 else 378 else
379 { 379 {
380 //Console.WriteLine("branch compare false"); 380 //Console.WriteLine("branch compare false");
381 this._mThread.PC += 2; 381 this._mThread.PC += 2;
382 } 382 }
383 } 383 }
384 else 384 else
385 { 385 {
386 this._mThread.PC += 2; 386 this._mThread.PC += 2;
387 } 387 }
388 result = true; 388 result = true;
389 break; 389 break;
390 case 164: 390 case 164:
391 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); 391 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
392 BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); 392 BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop();
393 BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); 393 BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop();
394 if (bcl1 is Int && bcl2 is Int) 394 if (bcl1 is Int && bcl2 is Int)
395 { 395 {
396 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); 396 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
397 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) 397 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue)
398 { 398 {
399 // Console.WriteLine("branch compare true , offset is " + compareloffset); 399 // Console.WriteLine("branch compare true , offset is " + compareloffset);
400 // Console.WriteLine("current PC is " + this._mThread.PC); 400 // Console.WriteLine("current PC is " + this._mThread.PC);
401 this._mThread.PC += -1 + compareloffset; 401 this._mThread.PC += -1 + compareloffset;
402 // Console.WriteLine("new PC is " + this._mThread.PC); 402 // Console.WriteLine("new PC is " + this._mThread.PC);
403 } 403 }
404 else 404 else
405 { 405 {
406 //Console.WriteLine("branch compare false"); 406 //Console.WriteLine("branch compare false");
407 this._mThread.PC += 2; 407 this._mThread.PC += 2;
408 } 408 }
409 } 409 }
410 else 410 else
411 { 411 {
412 this._mThread.PC += 2; 412 this._mThread.PC += 2;
413 } 413 }
414 result = true; 414 result = true;
415 break; 415 break;
416 case 167: 416 case 167:
417 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); 417 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
418 this._mThread.PC += -1 + offset; 418 this._mThread.PC += -1 + offset;
419 result = true; 419 result = true;
420 break; 420 break;
421 } 421 }
422 422
423 return result; 423 return result;
424 } 424 }
425 } 425 }
426 } 426 }
427} 427}
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
index e2e2b7c..6b85fcc 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Methods.cs
@@ -1,96 +1,96 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36 36
37namespace OpenSim.Region.Scripting.EmbeddedJVM 37namespace OpenSim.Region.Scripting.EmbeddedJVM
38{ 38{
39 partial class Thread 39 partial class Thread
40 { 40 {
41 private partial class Interpreter 41 private partial class Interpreter
42 { 42 {
43 private bool IsMethodOpCode(byte opcode) 43 private bool IsMethodOpCode(byte opcode)
44 { 44 {
45 bool result = false; 45 bool result = false;
46 switch (opcode) 46 switch (opcode)
47 { 47 {
48 case 184: 48 case 184:
49 short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); 49 short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
50 if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) 50 if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
51 { 51 {
52 string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value; 52 string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value;
53 string typeparam = ""; 53 string typeparam = "";
54 string typereturn = ""; 54 string typereturn = "";
55 int firstbrak = 0; 55 int firstbrak = 0;
56 int secondbrak = 0; 56 int secondbrak = 0;
57 firstbrak = typ.LastIndexOf('('); 57 firstbrak = typ.LastIndexOf('(');
58 secondbrak = typ.LastIndexOf(')'); 58 secondbrak = typ.LastIndexOf(')');
59 typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); 59 typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
60 typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); 60 typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
61 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value) 61 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
62 { 62 {
63 //calling a method in this class 63 //calling a method in this class
64 if (typeparam.Length == 0) 64 if (typeparam.Length == 0)
65 { 65 {
66 this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2)); 66 this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2));
67 } 67 }
68 else 68 else
69 { 69 {
70 this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2)); 70 this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2));
71 } 71 }
72 } 72 }
73 else 73 else
74 { 74 {
75 //calling a method of a different class 75 //calling a method of a different class
76 76
77 // OpenSimAPI Class 77 // OpenSimAPI Class
78 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") 78 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
79 { 79 {
80 this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null); 80 this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null);
81 } 81 }
82 } 82 }
83 } 83 }
84 else 84 else
85 { 85 {
86 this._mThread.PC += 2; 86 this._mThread.PC += 2;
87 } 87 }
88 result = true; 88 result = true;
89 break; 89 break;
90 } 90 }
91 91
92 return result; 92 return result;
93 } 93 }
94 } 94 }
95 } 95 }
96} 96}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs
index 6444776..3c18a11 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Return.cs
@@ -1,40 +1,40 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 partial class Thread 34 partial class Thread
35 { 35 {
36 private partial class Interpreter 36 private partial class Interpreter
37 { 37 {
38 } 38 }
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs
index d44f315..9961cbd 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.cs
@@ -1,135 +1,135 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33 33
34namespace OpenSim.Region.Scripting.EmbeddedJVM 34namespace OpenSim.Region.Scripting.EmbeddedJVM
35{ 35{
36 partial class Thread 36 partial class Thread
37 { 37 {
38 private partial class Interpreter 38 private partial class Interpreter
39 { 39 {
40 private Thread _mThread; 40 private Thread _mThread;
41 41
42 public Interpreter(Thread parentThread) 42 public Interpreter(Thread parentThread)
43 { 43 {
44 _mThread = parentThread; 44 _mThread = parentThread;
45 } 45 }
46 46
47 public bool Excute() 47 public bool Excute()
48 { 48 {
49 bool run = true; 49 bool run = true;
50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++]; 50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++];
51 // Console.WriteLine("opCode is: " + currentOpCode); 51 // Console.WriteLine("opCode is: " + currentOpCode);
52 bool handled = false; 52 bool handled = false;
53 53
54 handled = this.IsLogicOpCode(currentOpCode); 54 handled = this.IsLogicOpCode(currentOpCode);
55 if (!handled) 55 if (!handled)
56 { 56 {
57 handled = this.IsMethodOpCode(currentOpCode); 57 handled = this.IsMethodOpCode(currentOpCode);
58 } 58 }
59 if (!handled) 59 if (!handled)
60 { 60 {
61 if (currentOpCode == 172) 61 if (currentOpCode == 172)
62 { 62 {
63 if (this._mThread.stack.StackFrames.Count > 1) 63 if (this._mThread.stack.StackFrames.Count > 1)
64 { 64 {
65 Console.WriteLine("returning int from function"); 65 Console.WriteLine("returning int from function");
66 int retPC1 = this._mThread.currentFrame.ReturnPC; 66 int retPC1 = this._mThread.currentFrame.ReturnPC;
67 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); 67 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
68 this._mThread.stack.StackFrames.Pop(); 68 this._mThread.stack.StackFrames.Pop();
69 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); 69 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
70 this._mThread.PC = retPC1; 70 this._mThread.PC = retPC1;
71 if (bas1 is Int) 71 if (bas1 is Int)
72 { 72 {
73 this._mThread.currentFrame.OpStack.Push((Int)bas1); 73 this._mThread.currentFrame.OpStack.Push((Int)bas1);
74 } 74 }
75 } 75 }
76 else 76 else
77 { 77 {
78 // Console.WriteLine("No parent function so ending program"); 78 // Console.WriteLine("No parent function so ending program");
79 this._mThread.stack.StackFrames.Pop(); 79 this._mThread.stack.StackFrames.Pop();
80 run = false; 80 run = false;
81 } 81 }
82 handled = true; 82 handled = true;
83 } 83 }
84 if (currentOpCode == 174) 84 if (currentOpCode == 174)
85 { 85 {
86 if (this._mThread.stack.StackFrames.Count > 1) 86 if (this._mThread.stack.StackFrames.Count > 1)
87 { 87 {
88 Console.WriteLine("returning float from function"); 88 Console.WriteLine("returning float from function");
89 int retPC1 = this._mThread.currentFrame.ReturnPC; 89 int retPC1 = this._mThread.currentFrame.ReturnPC;
90 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); 90 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
91 this._mThread.stack.StackFrames.Pop(); 91 this._mThread.stack.StackFrames.Pop();
92 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); 92 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
93 this._mThread.PC = retPC1; 93 this._mThread.PC = retPC1;
94 if (bas1 is Float) 94 if (bas1 is Float)
95 { 95 {
96 this._mThread.currentFrame.OpStack.Push((Float)bas1); 96 this._mThread.currentFrame.OpStack.Push((Float)bas1);
97 } 97 }
98 } 98 }
99 else 99 else
100 { 100 {
101 // Console.WriteLine("No parent function so ending program"); 101 // Console.WriteLine("No parent function so ending program");
102 this._mThread.stack.StackFrames.Pop(); 102 this._mThread.stack.StackFrames.Pop();
103 run = false; 103 run = false;
104 } 104 }
105 handled = true; 105 handled = true;
106 } 106 }
107 if (currentOpCode == 177) 107 if (currentOpCode == 177)
108 { 108 {
109 if (this._mThread.stack.StackFrames.Count > 1) 109 if (this._mThread.stack.StackFrames.Count > 1)
110 { 110 {
111 Console.WriteLine("returning from function"); 111 Console.WriteLine("returning from function");
112 int retPC = this._mThread.currentFrame.ReturnPC; 112 int retPC = this._mThread.currentFrame.ReturnPC;
113 this._mThread.stack.StackFrames.Pop(); 113 this._mThread.stack.StackFrames.Pop();
114 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); 114 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
115 this._mThread.PC = retPC; 115 this._mThread.PC = retPC;
116 } 116 }
117 else 117 else
118 { 118 {
119 // Console.WriteLine("No parent function so ending program"); 119 // Console.WriteLine("No parent function so ending program");
120 this._mThread.stack.StackFrames.Pop(); 120 this._mThread.stack.StackFrames.Pop();
121 run = false; 121 run = false;
122 } 122 }
123 handled = true; 123 handled = true;
124 } 124 }
125 } 125 }
126 if (!handled) 126 if (!handled)
127 { 127 {
128 Console.WriteLine("opcode " + currentOpCode + " not been handled "); 128 Console.WriteLine("opcode " + currentOpCode + " not been handled ");
129 } 129 }
130 return run; 130 return run;
131 131
132 } 132 }
133 } 133 }
134 } 134 }
135} 135}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs
index addb6ff..7174975 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MainMemory.cs
@@ -1,45 +1,45 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class MainMemory 34 public class MainMemory
35 { 35 {
36 public Heap HeapArea; 36 public Heap HeapArea;
37 public MethodMemory MethodArea; 37 public MethodMemory MethodArea;
38 38
39 public MainMemory() 39 public MainMemory()
40 { 40 {
41 MethodArea = new MethodMemory(); 41 MethodArea = new MethodMemory();
42 HeapArea = new Heap(); 42 HeapArea = new Heap();
43 } 43 }
44 } 44 }
45} 45}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs
index 7d69e91..5f29091 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/MethodMemory.cs
@@ -1,46 +1,46 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class MethodMemory 34 public class MethodMemory
35 { 35 {
36 public byte[] MethodBuffer; 36 public byte[] MethodBuffer;
37 public List<ClassRecord> Classes = new List<ClassRecord>(); 37 public List<ClassRecord> Classes = new List<ClassRecord>();
38 public int NextMethodPC = 0; 38 public int NextMethodPC = 0;
39 public int Methodcount = 0; 39 public int Methodcount = 0;
40 40
41 public MethodMemory() 41 public MethodMemory()
42 { 42 {
43 MethodBuffer = new byte[20000]; 43 MethodBuffer = new byte[20000];
44 } 44 }
45 } 45 }
46} 46}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs
index 6a0a1a4..8acb2bd 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Object.cs
@@ -1,37 +1,37 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class Object 34 public class Object
35 { 35 {
36 } 36 }
37} 37}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs
index 74f0a7f..7c12678 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Stack.cs
@@ -1,42 +1,42 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Scripting.EmbeddedJVM 32namespace OpenSim.Region.Scripting.EmbeddedJVM
33{ 33{
34 public class Stack 34 public class Stack
35 { 35 {
36 public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); 36 public Stack<StackFrame> StackFrames = new Stack<StackFrame>();
37 37
38 public Stack() 38 public Stack()
39 { 39 {
40 } 40 }
41 } 41 }
42} 42}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs
index 1072395..76257b8 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/StackFrame.cs
@@ -1,49 +1,49 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32 32
33namespace OpenSim.Region.Scripting.EmbeddedJVM 33namespace OpenSim.Region.Scripting.EmbeddedJVM
34{ 34{
35 public class StackFrame 35 public class StackFrame
36 { 36 {
37 public BaseType[] LocalVariables; 37 public BaseType[] LocalVariables;
38 public Stack<BaseType> OpStack = new Stack<BaseType>(); 38 public Stack<BaseType> OpStack = new Stack<BaseType>();
39 39
40 public int ReturnPC = 0; 40 public int ReturnPC = 0;
41 public ClassRecord CallingClass = null; 41 public ClassRecord CallingClass = null;
42 42
43 public StackFrame() 43 public StackFrame()
44 { 44 {
45 LocalVariables = new BaseType[20]; 45 LocalVariables = new BaseType[20];
46 } 46 }
47 47
48 } 48 }
49} 49}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
index 59f3042..eda2640 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
@@ -1,119 +1,119 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.Scripting.EmbeddedJVM.Types; 31using OpenSim.Region.Scripting.EmbeddedJVM.Types;
32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; 32using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36using OpenSim.Region.Scripting; 36using OpenSim.Region.Scripting;
37 37
38namespace OpenSim.Region.Scripting.EmbeddedJVM 38namespace OpenSim.Region.Scripting.EmbeddedJVM
39{ 39{
40 public partial class Thread 40 public partial class Thread
41 { 41 {
42 // Is this smart? 42 // Is this smart?
43 public static MainMemory GlobalMemory; 43 public static MainMemory GlobalMemory;
44 public static Scene World; 44 public static Scene World;
45 private int PC = 0; 45 private int PC = 0;
46 private Stack stack; 46 private Stack stack;
47 private Interpreter mInterpreter; 47 private Interpreter mInterpreter;
48 public ClassRecord currentClass; 48 public ClassRecord currentClass;
49 public ClassInstance currentInstance; 49 public ClassInstance currentInstance;
50 private StackFrame currentFrame; 50 private StackFrame currentFrame;
51 public int excutionCounter = 0; 51 public int excutionCounter = 0;
52 public bool running = false; 52 public bool running = false;
53 53
54 public ScriptInfo scriptInfo; 54 public ScriptInfo scriptInfo;
55 55
56 public Thread() 56 public Thread()
57 { 57 {
58 this.mInterpreter = new Interpreter(this); 58 this.mInterpreter = new Interpreter(this);
59 this.stack = new Stack(); 59 this.stack = new Stack();
60 } 60 }
61 61
62 public void SetPC(int methodpointer) 62 public void SetPC(int methodpointer)
63 { 63 {
64 //Console.WriteLine("Thread PC has been set to " + methodpointer); 64 //Console.WriteLine("Thread PC has been set to " + methodpointer);
65 PC = methodpointer; 65 PC = methodpointer;
66 } 66 }
67 67
68 public void StartMethod(ClassRecord rec, string methName) 68 public void StartMethod(ClassRecord rec, string methName)
69 { 69 {
70 currentFrame = new StackFrame(); 70 currentFrame = new StackFrame();
71 this.stack.StackFrames.Push(currentFrame); 71 this.stack.StackFrames.Push(currentFrame);
72 this.currentClass = rec; 72 this.currentClass = rec;
73 currentClass.StartMethod(this, methName); 73 currentClass.StartMethod(this, methName);
74 } 74 }
75 75
76 public void StartMethod( string methName) 76 public void StartMethod( string methName)
77 { 77 {
78 currentFrame = new StackFrame(); 78 currentFrame = new StackFrame();
79 this.stack.StackFrames.Push(currentFrame); 79 this.stack.StackFrames.Push(currentFrame);
80 currentClass.StartMethod(this, methName); 80 currentClass.StartMethod(this, methName);
81 } 81 }
82 82
83 public void JumpToStaticVoidMethod(string methName, int returnPC) 83 public void JumpToStaticVoidMethod(string methName, int returnPC)
84 { 84 {
85 currentFrame = new StackFrame(); 85 currentFrame = new StackFrame();
86 currentFrame.ReturnPC = returnPC; 86 currentFrame.ReturnPC = returnPC;
87 this.stack.StackFrames.Push(currentFrame); 87 this.stack.StackFrames.Push(currentFrame);
88 currentClass.StartMethod(this, methName); 88 currentClass.StartMethod(this, methName);
89 } 89 }
90 90
91 public void JumpToStaticParamMethod(string methName, string param, int returnPC) 91 public void JumpToStaticParamMethod(string methName, string param, int returnPC)
92 { 92 {
93 if (param == "I") 93 if (param == "I")
94 { 94 {
95 BaseType bs1 = currentFrame.OpStack.Pop(); 95 BaseType bs1 = currentFrame.OpStack.Pop();
96 currentFrame = new StackFrame(); 96 currentFrame = new StackFrame();
97 currentFrame.ReturnPC = returnPC; 97 currentFrame.ReturnPC = returnPC;
98 this.stack.StackFrames.Push(currentFrame); 98 this.stack.StackFrames.Push(currentFrame);
99 currentFrame.LocalVariables[0] = ((Int)bs1); 99 currentFrame.LocalVariables[0] = ((Int)bs1);
100 currentClass.StartMethod(this, methName); 100 currentClass.StartMethod(this, methName);
101 } 101 }
102 if (param == "F") 102 if (param == "F")
103 { 103 {
104 104
105 } 105 }
106 } 106 }
107 107
108 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) 108 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
109 { 109 {
110 110
111 } 111 }
112 112
113 public bool Excute() 113 public bool Excute()
114 { 114 {
115 excutionCounter++; 115 excutionCounter++;
116 return this.mInterpreter.Excute(); 116 return this.mInterpreter.Excute();
117 } 117 }
118 } 118 }
119} 119}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
index a884e2b..58cdf49 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
@@ -1,29 +1,29 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5using OpenSim.Region.Scripting; 5using OpenSim.Region.Scripting;
6using OpenSim.Region.Scripting.EmbeddedJVM; 6using OpenSim.Region.Scripting.EmbeddedJVM;
7 7
8namespace OpenSim.Region.Scripting 8namespace OpenSim.Region.Scripting
9{ 9{
10 public class JavaEngine : IScriptCompiler 10 public class JavaEngine : IScriptCompiler
11 { 11 {
12 public string FileExt() 12 public string FileExt()
13 { 13 {
14 return ".java"; 14 return ".java";
15 } 15 }
16 16
17 public Dictionary<string, IScript> compile(string filename) 17 public Dictionary<string, IScript> compile(string filename)
18 { 18 {
19 JVMScript script = new JVMScript(); 19 JVMScript script = new JVMScript();
20 Dictionary<string, IScript> returns = new Dictionary<string, IScript>(); 20 Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
21 21
22 script.LoadScript(filename); 22 script.LoadScript(filename);
23 23
24 returns.Add(filename, script); 24 returns.Add(filename, script);
25 25
26 return returns; 26 return returns;
27 } 27 }
28 } 28 }
29} 29}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
index 8b38951..78c6f67 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
@@ -1,170 +1,170 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using System.IO; 31using System.IO;
32using System.Threading; 32using System.Threading;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces; 34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Utilities; 35using OpenSim.Framework.Utilities;
36using OpenSim.Region.Scripting; 36using OpenSim.Region.Scripting;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38 38
39namespace OpenSim.Region.Scripting.EmbeddedJVM 39namespace OpenSim.Region.Scripting.EmbeddedJVM
40{ 40{
41 public class JVMScript : IScript 41 public class JVMScript : IScript
42 { 42 {
43 private List<Thread> _threads = new List<Thread>(); 43 private List<Thread> _threads = new List<Thread>();
44 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); 44 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
45 private MainMemory _mainMemory; 45 private MainMemory _mainMemory;
46 46
47 ScriptInfo scriptInfo; 47 ScriptInfo scriptInfo;
48 48
49 public void Initialise(ScriptInfo info) 49 public void Initialise(ScriptInfo info)
50 { 50 {
51 scriptInfo = info; 51 scriptInfo = info;
52 52
53 _mainMemory = new MainMemory(); 53 _mainMemory = new MainMemory();
54 Thread.GlobalMemory = this._mainMemory; 54 Thread.GlobalMemory = this._mainMemory;
55 Thread.World = info.world; 55 Thread.World = info.world;
56 CompileScript(); 56 CompileScript();
57 57
58 scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); 58 scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
59 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 59 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
60 } 60 }
61 61
62 void events_OnNewPresence(ScenePresence presence) 62 void events_OnNewPresence(ScenePresence presence)
63 { 63 {
64 for (int i = 0; i < this._threads.Count; i++) 64 for (int i = 0; i < this._threads.Count; i++)
65 { 65 {
66 if (!this._threads[i].running) 66 if (!this._threads[i].running)
67 { 67 {
68 this._threads[i].StartMethod("OnNewPresence"); 68 this._threads[i].StartMethod("OnNewPresence");
69 bool run = true; 69 bool run = true;
70 while (run) 70 while (run)
71 { 71 {
72 run = this._threads[i].Excute(); 72 run = this._threads[i].Excute();
73 } 73 }
74 } 74 }
75 } 75 }
76 } 76 }
77 77
78 void events_OnFrame() 78 void events_OnFrame()
79 { 79 {
80 for (int i = 0; i < this._threads.Count; i++) 80 for (int i = 0; i < this._threads.Count; i++)
81 { 81 {
82 if (!this._threads[i].running) 82 if (!this._threads[i].running)
83 { 83 {
84 this._threads[i].StartMethod("OnFrame"); 84 this._threads[i].StartMethod("OnFrame");
85 bool run = true; 85 bool run = true;
86 while (run) 86 while (run)
87 { 87 {
88 run = this._threads[i].Excute(); 88 run = this._threads[i].Excute();
89 } 89 }
90 } 90 }
91 } 91 }
92 } 92 }
93 93
94 public string getName() 94 public string getName()
95 { 95 {
96 return "JVM Scripting Engine"; 96 return "JVM Scripting Engine";
97 } 97 }
98 98
99 public void LoadScript(string script) 99 public void LoadScript(string script)
100 { 100 {
101 Console.WriteLine("OpenSimJVM - loading new script: " + script); 101 Console.WriteLine("OpenSimJVM - loading new script: " + script);
102 CompileInfo comp = new CompileInfo(); 102 CompileInfo comp = new CompileInfo();
103 comp.script = script; 103 comp.script = script;
104 comp.scriptName = script; 104 comp.scriptName = script;
105 this.CompileScripts.Enqueue(comp); 105 this.CompileScripts.Enqueue(comp);
106 } 106 }
107 107
108 public void CompileScript() 108 public void CompileScript()
109 { 109 {
110 CompileInfo comp = this.CompileScripts.Dequeue(); 110 CompileInfo comp = this.CompileScripts.Dequeue();
111 string script = comp.script; 111 string script = comp.script;
112 string scriptName = comp.scriptName; 112 string scriptName = comp.scriptName;
113 try 113 try
114 { 114 {
115 //need to compile the script into a java class file 115 //need to compile the script into a java class file
116 116
117 //first save it to a java source file 117 //first save it to a java source file
118 TextWriter tw = new StreamWriter(scriptName + ".java"); 118 TextWriter tw = new StreamWriter(scriptName + ".java");
119 tw.WriteLine(script); 119 tw.WriteLine(script);
120 tw.Close(); 120 tw.Close();
121 121
122 //now compile 122 //now compile
123 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); 123 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java");
124 // psi.RedirectStandardOutput = true; 124 // psi.RedirectStandardOutput = true;
125 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; 125 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
126 psi.UseShellExecute = false; 126 psi.UseShellExecute = false;
127 127
128 System.Diagnostics.Process javacomp; 128 System.Diagnostics.Process javacomp;
129 javacomp = System.Diagnostics.Process.Start(psi); 129 javacomp = System.Diagnostics.Process.Start(psi);
130 javacomp.WaitForExit(); 130 javacomp.WaitForExit();
131 131
132 132
133 //now load in class file 133 //now load in class file
134 ClassRecord class1 = new ClassRecord(); 134 ClassRecord class1 = new ClassRecord();
135 class1.LoadClassFromFile(scriptName + ".class"); 135 class1.LoadClassFromFile(scriptName + ".class");
136 class1.PrintToConsole(); 136 class1.PrintToConsole();
137 //Console.WriteLine(); 137 //Console.WriteLine();
138 this._mainMemory.MethodArea.Classes.Add(class1); 138 this._mainMemory.MethodArea.Classes.Add(class1);
139 class1.AddMethodsToMemory(this._mainMemory.MethodArea); 139 class1.AddMethodsToMemory(this._mainMemory.MethodArea);
140 140
141 Thread newThread = new Thread(); 141 Thread newThread = new Thread();
142 this._threads.Add(newThread); 142 this._threads.Add(newThread);
143 newThread.currentClass = class1; 143 newThread.currentClass = class1;
144 newThread.scriptInfo = scriptInfo; 144 newThread.scriptInfo = scriptInfo;
145 145
146 //now delete the created files 146 //now delete the created files
147 System.IO.File.Delete(scriptName + ".java"); 147 System.IO.File.Delete(scriptName + ".java");
148 System.IO.File.Delete(scriptName + ".class"); 148 System.IO.File.Delete(scriptName + ".class");
149 //this.OnFrame(); 149 //this.OnFrame();
150 } 150 }
151 catch (Exception e) 151 catch (Exception e)
152 { 152 {
153 Console.WriteLine("exception"); 153 Console.WriteLine("exception");
154 Console.WriteLine(e.StackTrace); 154 Console.WriteLine(e.StackTrace);
155 Console.WriteLine(e.Message); 155 Console.WriteLine(e.Message);
156 } 156 }
157 } 157 }
158 158
159 private class CompileInfo 159 private class CompileInfo
160 { 160 {
161 public string script; 161 public string script;
162 public string scriptName; 162 public string scriptName;
163 163
164 public CompileInfo() 164 public CompileInfo()
165 { 165 {
166 166
167 } 167 }
168 } 168 }
169 } 169 }
170} 170}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs
index 40e2e22..0c4d623 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ArrayReference.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
6{ 6{
7 public class ArrayReference :BaseType 7 public class ArrayReference :BaseType
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs
index 4ee1720..7fc0a4f 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/BaseType.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
6{ 6{
7 public class BaseType : Object 7 public class BaseType : Object
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs
index 75d8e41..7718765 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/ObjectReference.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
6{ 6{
7 public class ObjectReference : BaseType 7 public class ObjectReference : BaseType
8 { 8 {
9 public ushort Reference; 9 public ushort Reference;
10 10
11 public ObjectReference() 11 public ObjectReference()
12 { 12 {
13 13
14 } 14 }
15 } 15 }
16} 16}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
index f5446dc..5a7b780 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Byte : BaseType 7 public class Byte : BaseType
8 { 8 {
9 } 9 }
10} 10}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
index 89824b4..c87ee8f 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
@@ -1,10 +1,10 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Char : BaseType 7 public class Char : BaseType
8 { 8 {
9 } 9 }
10} 10}
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
index 2638c20..982e748 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Float : BaseType 7 public class Float : BaseType
8 { 8 {
9 public float mValue = 0; 9 public float mValue = 0;
10 10
11 public Float() 11 public Float()
12 { 12 {
13 13
14 } 14 }
15 } 15 }
16} 16}
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
index 0155e72..073a9b3 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes 5namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
6{ 6{
7 public class Int : BaseType 7 public class Int : BaseType
8 { 8 {
9 public int mValue = 0; 9 public int mValue = 0;
10 10
11 public Int() 11 public Int()
12 { 12 {
13 13
14 } 14 }
15 } 15 }
16} 16}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs
index 8b957d3..012a00e 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs
@@ -1,140 +1,140 @@
1using System; 1using System;
2using System.Reflection; 2using System.Reflection;
3using System.Reflection.Emit; 3using System.Reflection.Emit;
4using System.Threading; 4using System.Threading;
5 5
6using OpenSim.Region.Scripting; 6using OpenSim.Region.Scripting;
7 7
8namespace OpenSim.ScriptEngines.LSL 8namespace OpenSim.ScriptEngines.LSL
9{ 9{
10 10
11 11
12 public class Engine 12 public class Engine
13 { 13 {
14 public void Start(ScriptInfo WorldAPI) 14 public void Start(ScriptInfo WorldAPI)
15 { 15 {
16 16
17 17
18 18
19 // Create Assembly Name 19 // Create Assembly Name
20 AssemblyName asmName = new AssemblyName(); 20 AssemblyName asmName = new AssemblyName();
21 asmName.Name = "TestAssembly"; 21 asmName.Name = "TestAssembly";
22 22
23 // Create Assembly 23 // Create Assembly
24 AssemblyBuilder asmBuilder = 24 AssemblyBuilder asmBuilder =
25 Thread.GetDomain().DefineDynamicAssembly 25 Thread.GetDomain().DefineDynamicAssembly
26 (asmName, AssemblyBuilderAccess.RunAndSave); 26 (asmName, AssemblyBuilderAccess.RunAndSave);
27 27
28 // Create a module (and save to disk) 28 // Create a module (and save to disk)
29 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule 29 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
30 (asmName.Name, asmName.Name + ".dll"); 30 (asmName.Name, asmName.Name + ".dll");
31 31
32 // Create a Class (/Type) 32 // Create a Class (/Type)
33 TypeBuilder typeBuilder = modBuilder.DefineType( 33 TypeBuilder typeBuilder = modBuilder.DefineType(
34 "MyClass", 34 "MyClass",
35 TypeAttributes.Public, 35 TypeAttributes.Public,
36 typeof(object), 36 typeof(object),
37 new Type[] { typeof(LSL_CLRInterface.LSLScript) }); 37 new Type[] { typeof(LSL_CLRInterface.LSLScript) });
38 38
39 39
40 40
41 /* 41 /*
42 * Generate the IL itself 42 * Generate the IL itself
43 */ 43 */
44 44
45 GenerateIL(WorldAPI, typeBuilder); 45 GenerateIL(WorldAPI, typeBuilder);
46 46
47 47
48 /* 48 /*
49 * Done generating, create a type and run it. 49 * Done generating, create a type and run it.
50 */ 50 */
51 51
52 // Create type object for the class (after defining fields and methods) 52 // Create type object for the class (after defining fields and methods)
53 Type type = typeBuilder.CreateType(); 53 Type type = typeBuilder.CreateType();
54 54
55 asmBuilder.Save("TestAssembly.dll"); 55 asmBuilder.Save("TestAssembly.dll");
56 56
57 // Create an instance we can play with 57 // Create an instance we can play with
58 //LSLScript hello = (LSLScript)Activator.CreateInstance(type); 58 //LSLScript hello = (LSLScript)Activator.CreateInstance(type);
59 LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); 59 LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type);
60 60
61 // Play with it 61 // Play with it
62 MyScript.event_state_entry("Test"); 62 MyScript.event_state_entry("Test");
63 } 63 }
64 64
65 private void GenerateIL(ScriptInfo WorldAPI, TypeBuilder typeBuilder) 65 private void GenerateIL(ScriptInfo WorldAPI, TypeBuilder typeBuilder)
66 { 66 {
67 67
68 68
69 // For debug 69 // For debug
70 LSO_Parser LSOP = new LSO_Parser(); 70 LSO_Parser LSOP = new LSO_Parser();
71 LSOP.ParseFile("LSO\\CloseToDefault.lso", WorldAPI, ref typeBuilder); 71 LSOP.ParseFile("LSO\\CloseToDefault.lso", WorldAPI, ref typeBuilder);
72 return; 72 return;
73 73
74 74
75 // Override a Method / Function 75 // Override a Method / Function
76 MethodBuilder methodBuilder = typeBuilder.DefineMethod("event_state_entry", 76 MethodBuilder methodBuilder = typeBuilder.DefineMethod("event_state_entry",
77 MethodAttributes.Private | MethodAttributes.Virtual, 77 MethodAttributes.Private | MethodAttributes.Virtual,
78 typeof(void), 78 typeof(void),
79 new Type[] { typeof(object) }); 79 new Type[] { typeof(object) });
80 80
81 typeBuilder.DefineMethodOverride(methodBuilder, 81 typeBuilder.DefineMethodOverride(methodBuilder,
82 typeof(LSL_CLRInterface.LSLScript).GetMethod("event_state_entry")); 82 typeof(LSL_CLRInterface.LSLScript).GetMethod("event_state_entry"));
83 83
84 // Create the IL generator 84 // Create the IL generator
85 ILGenerator il = methodBuilder.GetILGenerator(); 85 ILGenerator il = methodBuilder.GetILGenerator();
86 86
87 87
88 /* 88 /*
89 * TRY 89 * TRY
90 */ 90 */
91 il.BeginExceptionBlock(); 91 il.BeginExceptionBlock();
92 92
93 // Push "Hello World!" string to stack 93 // Push "Hello World!" string to stack
94 il.Emit(OpCodes.Ldstr, "Hello World!"); 94 il.Emit(OpCodes.Ldstr, "Hello World!");
95 95
96 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); 96 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
97 il.Emit(OpCodes.Call, typeof(Console).GetMethod 97 il.Emit(OpCodes.Call, typeof(Console).GetMethod
98 ("WriteLine", new Type[] { typeof(string) })); 98 ("WriteLine", new Type[] { typeof(string) }));
99 99
100 //il.EmitCall(OpCodes.Callvirt 100 //il.EmitCall(OpCodes.Callvirt
101 //il.Emit(OpCodes.Call, typeof(WorldAPI).GetMethod 101 //il.Emit(OpCodes.Call, typeof(WorldAPI).GetMethod
102 //("TestFunction")); 102 //("TestFunction"));
103 103
104 104
105 //il.ThrowException(typeof(NotSupportedException)); 105 //il.ThrowException(typeof(NotSupportedException));
106 106
107 107
108 /* 108 /*
109 * CATCH 109 * CATCH
110 */ 110 */
111 il.BeginCatchBlock(typeof(Exception)); 111 il.BeginCatchBlock(typeof(Exception));
112 112
113 // Push "Hello World!" string to stack 113 // Push "Hello World!" string to stack
114 il.Emit(OpCodes.Ldstr, "Something went wrong: "); 114 il.Emit(OpCodes.Ldstr, "Something went wrong: ");
115 115
116 //call void [mscorlib]System.Console::WriteLine(string) 116 //call void [mscorlib]System.Console::WriteLine(string)
117 il.Emit(OpCodes.Call, typeof(Console).GetMethod 117 il.Emit(OpCodes.Call, typeof(Console).GetMethod
118 ("Write", new Type[] { typeof(string) })); 118 ("Write", new Type[] { typeof(string) }));
119 119
120 //callvirt instance string [mscorlib]System.Exception::get_Message() 120 //callvirt instance string [mscorlib]System.Exception::get_Message()
121 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod 121 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod
122 ("get_Message")); 122 ("get_Message"));
123 123
124 //call void [mscorlib]System.Console::WriteLine(string) 124 //call void [mscorlib]System.Console::WriteLine(string)
125 il.Emit(OpCodes.Call, typeof(Console).GetMethod 125 il.Emit(OpCodes.Call, typeof(Console).GetMethod
126 ("WriteLine", new Type[] { typeof(string) })); 126 ("WriteLine", new Type[] { typeof(string) }));
127 127
128 /* 128 /*
129 * END TRY 129 * END TRY
130 */ 130 */
131 il.EndExceptionBlock(); 131 il.EndExceptionBlock();
132 132
133 133
134 // Push "Return from current method, with return value if present" to stack 134 // Push "Return from current method, with return value if present" to stack
135 il.Emit(OpCodes.Ret); 135 il.Emit(OpCodes.Ret);
136 136
137 137
138 } 138 }
139 } 139 }
140} 140}
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
index dc612ff..57bbf11 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs
@@ -1,51 +1,51 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.ScriptEngines.LSL 5namespace OpenSim.ScriptEngines.LSL
6{ 6{
7 public class LSL_CLRInterface 7 public class LSL_CLRInterface
8 { 8 {
9 public interface LSLScript 9 public interface LSLScript
10 { 10 {
11 //public virtual void Run(object arg) 11 //public virtual void Run(object arg)
12 //{ 12 //{
13 //} 13 //}
14 //void Run(object arg); 14 //void Run(object arg);
15 15
16 void event_state_entry(object arg); 16 void event_state_entry(object arg);
17 //void event_state_exit(); 17 //void event_state_exit();
18 void event_touch_start(object arg); 18 void event_touch_start(object arg);
19 //void event_touch(); 19 //void event_touch();
20 //void event_touch_end(); 20 //void event_touch_end();
21 //void event_collision_start(); 21 //void event_collision_start();
22 //void event_collision(); 22 //void event_collision();
23 //void event_collision_end(); 23 //void event_collision_end();
24 //void event_land_collision_start(); 24 //void event_land_collision_start();
25 //void event_land_collision(); 25 //void event_land_collision();
26 //void event_land_collision_end(); 26 //void event_land_collision_end();
27 //void event_timer(); 27 //void event_timer();
28 //void event_listen(); 28 //void event_listen();
29 //void event_on_rez(); 29 //void event_on_rez();
30 //void event_sensor(); 30 //void event_sensor();
31 //void event_no_sensor(); 31 //void event_no_sensor();
32 //void event_control(); 32 //void event_control();
33 //void event_money(); 33 //void event_money();
34 //void event_email(); 34 //void event_email();
35 //void event_at_target(); 35 //void event_at_target();
36 //void event_not_at_target(); 36 //void event_not_at_target();
37 //void event_at_rot_target(); 37 //void event_at_rot_target();
38 //void event_not_at_rot_target(); 38 //void event_not_at_rot_target();
39 //void event_run_time_permissions(); 39 //void event_run_time_permissions();
40 //void event_changed(); 40 //void event_changed();
41 //void event_attach(); 41 //void event_attach();
42 //void event_dataserver(); 42 //void event_dataserver();
43 //void event_link_message(); 43 //void event_link_message();
44 //void event_moving_start(); 44 //void event_moving_start();
45 //void event_moving_end(); 45 //void event_moving_end();
46 //void event_object_rez(); 46 //void event_object_rez();
47 //void event_remote_data(); 47 //void event_remote_data();
48 //void event_http_response(); 48 //void event_http_response();
49 } 49 }
50 } 50 }
51} 51}
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
index edeccdd..b45abe0 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs
@@ -1,485 +1,485 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.ScriptEngines.LSL 5namespace OpenSim.ScriptEngines.LSL
6{ 6{
7 static class LSO_Enums 7 static class LSO_Enums
8 { 8 {
9 9
10 public enum Variable_Type_Codes 10 public enum Variable_Type_Codes
11 { 11 {
12 Void = 0, 12 Void = 0,
13 Integer = 1, 13 Integer = 1,
14 Float = 2, 14 Float = 2,
15 String = 3, 15 String = 3,
16 Key = 4, 16 Key = 4,
17 Vector = 5, 17 Vector = 5,
18 Rotation = 6, 18 Rotation = 6,
19 List = 7 19 List = 7
20 } 20 }
21 public enum Event_Mask_Values 21 public enum Event_Mask_Values
22 { 22 {
23 state_entry = 0, 23 state_entry = 0,
24 state_exit = 1, 24 state_exit = 1,
25 touch_start = 2, 25 touch_start = 2,
26 touch = 3, 26 touch = 3,
27 touch_end = 4, 27 touch_end = 4,
28 collision_start = 5, 28 collision_start = 5,
29 collision = 6, 29 collision = 6,
30 collision_end = 7, 30 collision_end = 7,
31 land_collision_start = 8, 31 land_collision_start = 8,
32 land_collision = 9, 32 land_collision = 9,
33 land_collision_end = 10, 33 land_collision_end = 10,
34 timer = 11, 34 timer = 11,
35 listen = 12, 35 listen = 12,
36 on_rez = 13, 36 on_rez = 13,
37 sensor = 14, 37 sensor = 14,
38 no_sensor = 15, 38 no_sensor = 15,
39 control = 16, 39 control = 16,
40 money = 17, 40 money = 17,
41 email = 18, 41 email = 18,
42 at_target = 19, 42 at_target = 19,
43 not_at_target = 20, 43 not_at_target = 20,
44 at_rot_target = 21, 44 at_rot_target = 21,
45 not_at_rot_target = 22, 45 not_at_rot_target = 22,
46 run_time_permissions = 23, 46 run_time_permissions = 23,
47 changed = 24, 47 changed = 24,
48 attach = 25, 48 attach = 25,
49 dataserver = 26, 49 dataserver = 26,
50 link_message = 27, 50 link_message = 27,
51 moving_start = 28, 51 moving_start = 28,
52 moving_end = 29, 52 moving_end = 29,
53 object_rez = 30, 53 object_rez = 30,
54 remote_data = 31, 54 remote_data = 31,
55 http_response = 32 55 http_response = 32
56 } 56 }
57 public enum Operation_Table 57 public enum Operation_Table
58 { 58 {
59 NOOP = 0x0, 59 NOOP = 0x0,
60 POP = 0x1, 60 POP = 0x1,
61 POPS = 0x2, 61 POPS = 0x2,
62 POPL = 0x3, 62 POPL = 0x3,
63 POPV = 0x4, 63 POPV = 0x4,
64 POPQ = 0x5, 64 POPQ = 0x5,
65 POPARG = 0x6, 65 POPARG = 0x6,
66 POPIP = 0x7, 66 POPIP = 0x7,
67 POPBP = 0x8, 67 POPBP = 0x8,
68 POPSP = 0x9, 68 POPSP = 0x9,
69 POPSLR = 0xa, 69 POPSLR = 0xa,
70 DUP = 0x20, 70 DUP = 0x20,
71 DUPS = 0x21, 71 DUPS = 0x21,
72 DUPL = 0x22, 72 DUPL = 0x22,
73 DUPV = 0x23, 73 DUPV = 0x23,
74 DUPQ = 0x24, 74 DUPQ = 0x24,
75 STORE = 0x30, 75 STORE = 0x30,
76 STORES = 0x31, 76 STORES = 0x31,
77 STOREL = 0x32, 77 STOREL = 0x32,
78 STOREV = 0x33, 78 STOREV = 0x33,
79 STOREQ = 0x34, 79 STOREQ = 0x34,
80 STOREG = 0x35, 80 STOREG = 0x35,
81 STOREGS = 0x36, 81 STOREGS = 0x36,
82 STOREGL = 0x37, 82 STOREGL = 0x37,
83 STOREGV = 0x38, 83 STOREGV = 0x38,
84 STOREGQ = 0x39, 84 STOREGQ = 0x39,
85 LOADP = 0x3a, 85 LOADP = 0x3a,
86 LOADSP = 0x3b, 86 LOADSP = 0x3b,
87 LOADLP = 0x3c, 87 LOADLP = 0x3c,
88 LOADVP = 0x3d, 88 LOADVP = 0x3d,
89 LOADQP = 0x3e, 89 LOADQP = 0x3e,
90 LOADGP = 0x3f, 90 LOADGP = 0x3f,
91 LOADGSP = 0x40, 91 LOADGSP = 0x40,
92 LOADGLP = 0x41, 92 LOADGLP = 0x41,
93 LOADGVP = 0x42, 93 LOADGVP = 0x42,
94 LOADGQP = 0x43, 94 LOADGQP = 0x43,
95 PUSH = 0x50, 95 PUSH = 0x50,
96 PUSHS = 0x51, 96 PUSHS = 0x51,
97 PUSHL = 0x52, 97 PUSHL = 0x52,
98 PUSHV = 0x53, 98 PUSHV = 0x53,
99 PUSHQ = 0x54, 99 PUSHQ = 0x54,
100 PUSHG = 0x55, 100 PUSHG = 0x55,
101 PUSHGS = 0x56, 101 PUSHGS = 0x56,
102 PUSHGL = 0x57, 102 PUSHGL = 0x57,
103 PUSHGV = 0x58, 103 PUSHGV = 0x58,
104 PUSHGQ = 0x59, 104 PUSHGQ = 0x59,
105 PUSHIP = 0x5a, 105 PUSHIP = 0x5a,
106 PUSHBP = 0x5b, 106 PUSHBP = 0x5b,
107 PUSHSP = 0x5c, 107 PUSHSP = 0x5c,
108 PUSHARGB = 0x5d, 108 PUSHARGB = 0x5d,
109 PUSHARGI = 0x5e, 109 PUSHARGI = 0x5e,
110 PUSHARGF = 0x5f, 110 PUSHARGF = 0x5f,
111 PUSHARGS = 0x60, 111 PUSHARGS = 0x60,
112 PUSHARGV = 0x61, 112 PUSHARGV = 0x61,
113 PUSHARGQ = 0x62, 113 PUSHARGQ = 0x62,
114 PUSHE = 0x63, 114 PUSHE = 0x63,
115 PUSHEV = 0x64, 115 PUSHEV = 0x64,
116 PUSHEQ = 0x65, 116 PUSHEQ = 0x65,
117 PUSHARGE = 0x66, 117 PUSHARGE = 0x66,
118 ADD = 0x70, 118 ADD = 0x70,
119 SUB = 0x71, 119 SUB = 0x71,
120 MUL = 0x72, 120 MUL = 0x72,
121 DIV = 0x73, 121 DIV = 0x73,
122 MOD = 0x74, 122 MOD = 0x74,
123 EQ = 0x75, 123 EQ = 0x75,
124 NEQ = 0x76, 124 NEQ = 0x76,
125 LEQ = 0x77, 125 LEQ = 0x77,
126 GEQ = 0x78, 126 GEQ = 0x78,
127 LESS = 0x79, 127 LESS = 0x79,
128 GREATER = 0x7a, 128 GREATER = 0x7a,
129 BITAND = 0x7b, 129 BITAND = 0x7b,
130 BITOR = 0x7c, 130 BITOR = 0x7c,
131 BITXOR = 0x7d, 131 BITXOR = 0x7d,
132 BOOLAND = 0x7e, 132 BOOLAND = 0x7e,
133 BOOLOR = 0x7f, 133 BOOLOR = 0x7f,
134 NEG = 0x80, 134 NEG = 0x80,
135 BITNOT = 0x81, 135 BITNOT = 0x81,
136 BOOLNOT = 0x82, 136 BOOLNOT = 0x82,
137 JUMP = 0x90, 137 JUMP = 0x90,
138 JUMPIF = 0x91, 138 JUMPIF = 0x91,
139 JUMPNIF = 0x92, 139 JUMPNIF = 0x92,
140 STATE = 0x93, 140 STATE = 0x93,
141 CALL = 0x94, 141 CALL = 0x94,
142 RETURN = 0x95, 142 RETURN = 0x95,
143 CAST = 0xa0, 143 CAST = 0xa0,
144 STACKTOS = 0xb0, 144 STACKTOS = 0xb0,
145 STACKTOL = 0xb1, 145 STACKTOL = 0xb1,
146 PRINT = 0xc0, 146 PRINT = 0xc0,
147 CALLLIB = 0xd0, 147 CALLLIB = 0xd0,
148 CALLLIB_TWO_BYTE = 0xd1, 148 CALLLIB_TWO_BYTE = 0xd1,
149 SHL = 0xe0, 149 SHL = 0xe0,
150 SHR = 0xe1 150 SHR = 0xe1
151 } 151 }
152 public enum BuiltIn_Functions 152 public enum BuiltIn_Functions
153 { 153 {
154 llSin = 0, 154 llSin = 0,
155 llCos = 1, 155 llCos = 1,
156 llTan = 2, 156 llTan = 2,
157 llAtan2 = 3, 157 llAtan2 = 3,
158 llSqrt = 4, 158 llSqrt = 4,
159 llPow = 5, 159 llPow = 5,
160 llAbs = 6, 160 llAbs = 6,
161 llFabs = 7, 161 llFabs = 7,
162 llFrand = 8, 162 llFrand = 8,
163 llFloor = 9, 163 llFloor = 9,
164 llCeil = 10, 164 llCeil = 10,
165 llRound = 11, 165 llRound = 11,
166 llVecMag = 12, 166 llVecMag = 12,
167 llVecNorm = 13, 167 llVecNorm = 13,
168 llVecDist = 14, 168 llVecDist = 14,
169 llRot2Euler = 15, 169 llRot2Euler = 15,
170 llEuler2Rot = 16, 170 llEuler2Rot = 16,
171 llAxes2Rot = 17, 171 llAxes2Rot = 17,
172 llRot2Fwd = 18, 172 llRot2Fwd = 18,
173 llRot2Left = 19, 173 llRot2Left = 19,
174 llRot2Up = 20, 174 llRot2Up = 20,
175 llRotBetween = 21, 175 llRotBetween = 21,
176 llWhisper = 22, 176 llWhisper = 22,
177 llSay = 23, 177 llSay = 23,
178 llShout = 24, 178 llShout = 24,
179 llListen = 25, 179 llListen = 25,
180 llListenControl = 26, 180 llListenControl = 26,
181 llListenRemove = 27, 181 llListenRemove = 27,
182 llSensor = 28, 182 llSensor = 28,
183 llSensorRepeat = 29, 183 llSensorRepeat = 29,
184 llSensorRemove = 30, 184 llSensorRemove = 30,
185 llDetectedName = 31, 185 llDetectedName = 31,
186 llDetectedKey = 32, 186 llDetectedKey = 32,
187 llDetectedOwner = 33, 187 llDetectedOwner = 33,
188 llDetectedType = 34, 188 llDetectedType = 34,
189 llDetectedPos = 35, 189 llDetectedPos = 35,
190 llDetectedVel = 36, 190 llDetectedVel = 36,
191 llDetectedGrab = 37, 191 llDetectedGrab = 37,
192 llDetectedRot = 38, 192 llDetectedRot = 38,
193 llDetectedGroup = 39, 193 llDetectedGroup = 39,
194 llDetectedLinkNumber = 40, 194 llDetectedLinkNumber = 40,
195 llDie = 41, 195 llDie = 41,
196 llGround = 42, 196 llGround = 42,
197 llCloud = 43, 197 llCloud = 43,
198 llWind = 44, 198 llWind = 44,
199 llSetStatus = 45, 199 llSetStatus = 45,
200 llGetStatus = 46, 200 llGetStatus = 46,
201 llSetScale = 47, 201 llSetScale = 47,
202 llGetScale = 48, 202 llGetScale = 48,
203 llSetColor = 49, 203 llSetColor = 49,
204 llGetAlpha = 50, 204 llGetAlpha = 50,
205 llSetAlpha = 51, 205 llSetAlpha = 51,
206 llGetColor = 52, 206 llGetColor = 52,
207 llSetTexture = 53, 207 llSetTexture = 53,
208 llScaleTexture = 54, 208 llScaleTexture = 54,
209 llOffsetTexture = 55, 209 llOffsetTexture = 55,
210 llRotateTexture = 56, 210 llRotateTexture = 56,
211 llGetTexture = 57, 211 llGetTexture = 57,
212 llSetPos = 58, 212 llSetPos = 58,
213 llGetPos = 59, 213 llGetPos = 59,
214 llGetLocalPos = 60, 214 llGetLocalPos = 60,
215 llSetRot = 61, 215 llSetRot = 61,
216 llGetRot = 62, 216 llGetRot = 62,
217 llGetLocalRot = 63, 217 llGetLocalRot = 63,
218 llSetForce = 64, 218 llSetForce = 64,
219 llGetForce = 65, 219 llGetForce = 65,
220 llTarget = 66, 220 llTarget = 66,
221 llTargetRemove = 67, 221 llTargetRemove = 67,
222 llRotTarget = 68, 222 llRotTarget = 68,
223 llRotTargetRemove = 69, 223 llRotTargetRemove = 69,
224 llMoveToTarget = 70, 224 llMoveToTarget = 70,
225 llStopMoveToTarget = 71, 225 llStopMoveToTarget = 71,
226 llApplyImpulse = 72, 226 llApplyImpulse = 72,
227 llApplyRotationalImpulse = 73, 227 llApplyRotationalImpulse = 73,
228 llSetTorque = 74, 228 llSetTorque = 74,
229 llGetTorque = 75, 229 llGetTorque = 75,
230 llSetForceAndTorque = 76, 230 llSetForceAndTorque = 76,
231 llGetVel = 77, 231 llGetVel = 77,
232 llGetAccel = 78, 232 llGetAccel = 78,
233 llGetOmega = 79, 233 llGetOmega = 79,
234 llGetTimeOfDay = 80, 234 llGetTimeOfDay = 80,
235 llGetWallclock = 81, 235 llGetWallclock = 81,
236 llGetTime = 82, 236 llGetTime = 82,
237 llResetTime = 83, 237 llResetTime = 83,
238 llGetAndResetTime = 84, 238 llGetAndResetTime = 84,
239 llSound = 85, 239 llSound = 85,
240 llPlaySound = 86, 240 llPlaySound = 86,
241 llLoopSound = 87, 241 llLoopSound = 87,
242 llLoopSoundMaster = 88, 242 llLoopSoundMaster = 88,
243 llLoopSoundSlave = 89, 243 llLoopSoundSlave = 89,
244 llPlaySoundSlave = 90, 244 llPlaySoundSlave = 90,
245 llTriggerSound = 91, 245 llTriggerSound = 91,
246 llStopSound = 92, 246 llStopSound = 92,
247 llPreloadSound = 93, 247 llPreloadSound = 93,
248 llGetSubString = 94, 248 llGetSubString = 94,
249 llDeleteSubString = 95, 249 llDeleteSubString = 95,
250 llInsertString = 96, 250 llInsertString = 96,
251 llToUpper = 97, 251 llToUpper = 97,
252 llToLower = 98, 252 llToLower = 98,
253 llGiveMoney = 99, 253 llGiveMoney = 99,
254 llMakeExplosion = 100, 254 llMakeExplosion = 100,
255 llMakeFountain = 101, 255 llMakeFountain = 101,
256 llMakeSmoke = 102, 256 llMakeSmoke = 102,
257 llMakeFire = 103, 257 llMakeFire = 103,
258 llRezObject = 104, 258 llRezObject = 104,
259 llLookAt = 105, 259 llLookAt = 105,
260 llStopLookAt = 106, 260 llStopLookAt = 106,
261 llSetTimerEvent = 107, 261 llSetTimerEvent = 107,
262 llSleep = 108, 262 llSleep = 108,
263 llGetMass = 109, 263 llGetMass = 109,
264 llCollisionFilter = 110, 264 llCollisionFilter = 110,
265 llTakeControls = 111, 265 llTakeControls = 111,
266 llReleaseControls = 112, 266 llReleaseControls = 112,
267 llAttachToAvatar = 113, 267 llAttachToAvatar = 113,
268 llDetachFromAvatar = 114, 268 llDetachFromAvatar = 114,
269 llTakeCamera = 115, 269 llTakeCamera = 115,
270 llReleaseCamera = 116, 270 llReleaseCamera = 116,
271 llGetOwner = 117, 271 llGetOwner = 117,
272 llInstantMessage = 118, 272 llInstantMessage = 118,
273 llEmail = 119, 273 llEmail = 119,
274 llGetNextEmail = 120, 274 llGetNextEmail = 120,
275 llGetKey = 121, 275 llGetKey = 121,
276 llSetBuoyancy = 122, 276 llSetBuoyancy = 122,
277 llSetHoverHeight = 123, 277 llSetHoverHeight = 123,
278 llStopHover = 124, 278 llStopHover = 124,
279 llMinEventDelay = 125, 279 llMinEventDelay = 125,
280 llSoundPreload = 126, 280 llSoundPreload = 126,
281 llRotLookAt = 127, 281 llRotLookAt = 127,
282 llStringLength = 128, 282 llStringLength = 128,
283 llStartAnimation = 129, 283 llStartAnimation = 129,
284 llStopAnimation = 130, 284 llStopAnimation = 130,
285 llPointAt = 131, 285 llPointAt = 131,
286 llStopPointAt = 132, 286 llStopPointAt = 132,
287 llTargetOmega = 133, 287 llTargetOmega = 133,
288 llGetStartParameter = 134, 288 llGetStartParameter = 134,
289 llGodLikeRezObject = 135, 289 llGodLikeRezObject = 135,
290 llRequestPermissions = 136, 290 llRequestPermissions = 136,
291 llGetPermissionsKey = 137, 291 llGetPermissionsKey = 137,
292 llGetPermissions = 138, 292 llGetPermissions = 138,
293 llGetLinkNumber = 139, 293 llGetLinkNumber = 139,
294 llSetLinkColor = 140, 294 llSetLinkColor = 140,
295 llCreateLink = 141, 295 llCreateLink = 141,
296 llBreakLink = 142, 296 llBreakLink = 142,
297 llBreakAllLinks = 143, 297 llBreakAllLinks = 143,
298 llGetLinkKey = 144, 298 llGetLinkKey = 144,
299 llGetLinkName = 145, 299 llGetLinkName = 145,
300 llGetInventoryNumber = 146, 300 llGetInventoryNumber = 146,
301 llGetInventoryName = 147, 301 llGetInventoryName = 147,
302 llSetScriptState = 148, 302 llSetScriptState = 148,
303 llGetEnergy = 149, 303 llGetEnergy = 149,
304 llGiveInventory = 150, 304 llGiveInventory = 150,
305 llRemoveInventory = 151, 305 llRemoveInventory = 151,
306 llSetText = 152, 306 llSetText = 152,
307 llWater = 153, 307 llWater = 153,
308 llPassTouches = 154, 308 llPassTouches = 154,
309 llRequestAgentData = 155, 309 llRequestAgentData = 155,
310 llRequestInventoryData = 156, 310 llRequestInventoryData = 156,
311 llSetDamage = 157, 311 llSetDamage = 157,
312 llTeleportAgentHome = 158, 312 llTeleportAgentHome = 158,
313 llModifyLand = 159, 313 llModifyLand = 159,
314 llCollisionSound = 160, 314 llCollisionSound = 160,
315 llCollisionSprite = 161, 315 llCollisionSprite = 161,
316 llGetAnimation = 162, 316 llGetAnimation = 162,
317 llResetScript = 163, 317 llResetScript = 163,
318 llMessageLinked = 164, 318 llMessageLinked = 164,
319 llPushObject = 165, 319 llPushObject = 165,
320 llPassCollisions = 166, 320 llPassCollisions = 166,
321 llGetScriptName = 167, 321 llGetScriptName = 167,
322 llGetNumberOfSides = 168, 322 llGetNumberOfSides = 168,
323 llAxisAngle2Rot = 169, 323 llAxisAngle2Rot = 169,
324 llRot2Axis = 170, 324 llRot2Axis = 170,
325 llRot2Angle = 171, 325 llRot2Angle = 171,
326 llAcos = 172, 326 llAcos = 172,
327 llAsin = 173, 327 llAsin = 173,
328 llAngleBetween = 174, 328 llAngleBetween = 174,
329 llGetInventoryKey = 175, 329 llGetInventoryKey = 175,
330 llAllowInventoryDrop = 176, 330 llAllowInventoryDrop = 176,
331 llGetSunDirection = 177, 331 llGetSunDirection = 177,
332 llGetTextureOffset = 178, 332 llGetTextureOffset = 178,
333 llGetTextureScale = 179, 333 llGetTextureScale = 179,
334 llGetTextureRot = 180, 334 llGetTextureRot = 180,
335 llSubStringIndex = 181, 335 llSubStringIndex = 181,
336 llGetOwnerKey = 182, 336 llGetOwnerKey = 182,
337 llGetCenterOfMass = 183, 337 llGetCenterOfMass = 183,
338 llListSort = 184, 338 llListSort = 184,
339 llGetListLength = 185, 339 llGetListLength = 185,
340 llList2Integer = 186, 340 llList2Integer = 186,
341 llList2Float = 187, 341 llList2Float = 187,
342 llList2String = 188, 342 llList2String = 188,
343 llList2Key = 189, 343 llList2Key = 189,
344 llList2Vector = 190, 344 llList2Vector = 190,
345 llList2Rot = 191, 345 llList2Rot = 191,
346 llList2List = 192, 346 llList2List = 192,
347 llDeleteSubList = 193, 347 llDeleteSubList = 193,
348 llGetListEntryType = 194, 348 llGetListEntryType = 194,
349 llList2CSV = 195, 349 llList2CSV = 195,
350 llCSV2List = 196, 350 llCSV2List = 196,
351 llListRandomize = 197, 351 llListRandomize = 197,
352 llList2ListStrided = 198, 352 llList2ListStrided = 198,
353 llGetRegionCorner = 199, 353 llGetRegionCorner = 199,
354 llListInsertList = 200, 354 llListInsertList = 200,
355 llListFindList = 201, 355 llListFindList = 201,
356 llGetObjectName = 202, 356 llGetObjectName = 202,
357 llSetObjectName = 203, 357 llSetObjectName = 203,
358 llGetDate = 204, 358 llGetDate = 204,
359 llEdgeOfWorld = 205, 359 llEdgeOfWorld = 205,
360 llGetAgentInfo = 206, 360 llGetAgentInfo = 206,
361 llAdjustSoundVolume = 207, 361 llAdjustSoundVolume = 207,
362 llSetSoundQueueing = 208, 362 llSetSoundQueueing = 208,
363 llSetSoundRadius = 209, 363 llSetSoundRadius = 209,
364 llKey2Name = 210, 364 llKey2Name = 210,
365 llSetTextureAnim = 211, 365 llSetTextureAnim = 211,
366 llTriggerSoundLimited = 212, 366 llTriggerSoundLimited = 212,
367 llEjectFromLand = 213, 367 llEjectFromLand = 213,
368 llParseString2List = 214, 368 llParseString2List = 214,
369 llOverMyLand = 215, 369 llOverMyLand = 215,
370 llGetLandOwnerAt = 216, 370 llGetLandOwnerAt = 216,
371 llGetNotecardLine = 217, 371 llGetNotecardLine = 217,
372 llGetAgentSize = 218, 372 llGetAgentSize = 218,
373 llSameGroup = 219, 373 llSameGroup = 219,
374 llUnSit = 220, 374 llUnSit = 220,
375 llGroundSlope = 221, 375 llGroundSlope = 221,
376 llGroundNormal = 222, 376 llGroundNormal = 222,
377 llGroundContour = 223, 377 llGroundContour = 223,
378 llGetAttached = 224, 378 llGetAttached = 224,
379 llGetFreeMemory = 225, 379 llGetFreeMemory = 225,
380 llGetRegionName = 226, 380 llGetRegionName = 226,
381 llGetRegionTimeDilation = 227, 381 llGetRegionTimeDilation = 227,
382 llGetRegionFPS = 228, 382 llGetRegionFPS = 228,
383 llParticleSystem = 229, 383 llParticleSystem = 229,
384 llGroundRepel = 230, 384 llGroundRepel = 230,
385 llGiveInventoryList = 231, 385 llGiveInventoryList = 231,
386 llSetVehicleType = 232, 386 llSetVehicleType = 232,
387 llSetVehicleFloatParam = 233, 387 llSetVehicleFloatParam = 233,
388 llSetVehicleVectorParam = 234, 388 llSetVehicleVectorParam = 234,
389 llSetVehicleRotationParam = 235, 389 llSetVehicleRotationParam = 235,
390 llSetVehicleFlags = 236, 390 llSetVehicleFlags = 236,
391 llRemoveVehicleFlags = 237, 391 llRemoveVehicleFlags = 237,
392 llSitTarget = 238, 392 llSitTarget = 238,
393 llAvatarOnSitTarget = 239, 393 llAvatarOnSitTarget = 239,
394 llAddToLandPassList = 240, 394 llAddToLandPassList = 240,
395 llSetTouchText = 241, 395 llSetTouchText = 241,
396 llSetSitText = 242, 396 llSetSitText = 242,
397 llSetCameraEyeOffset = 243, 397 llSetCameraEyeOffset = 243,
398 llSetCameraAtOffset = 244, 398 llSetCameraAtOffset = 244,
399 llDumpList2String = 245, 399 llDumpList2String = 245,
400 llScriptDanger = 246, 400 llScriptDanger = 246,
401 llDialog = 247, 401 llDialog = 247,
402 llVolumeDetect = 248, 402 llVolumeDetect = 248,
403 llResetOtherScript = 249, 403 llResetOtherScript = 249,
404 llGetScriptState = 250, 404 llGetScriptState = 250,
405 llRemoteLoadScript = 251, 405 llRemoteLoadScript = 251,
406 llSetRemoteScriptAccessPin = 252, 406 llSetRemoteScriptAccessPin = 252,
407 llRemoteLoadScriptPin = 253, 407 llRemoteLoadScriptPin = 253,
408 llOpenRemoteDataChannel = 254, 408 llOpenRemoteDataChannel = 254,
409 llSendRemoteData = 255, 409 llSendRemoteData = 255,
410 llRemoteDataReply = 256, 410 llRemoteDataReply = 256,
411 llCloseRemoteDataChannel = 257, 411 llCloseRemoteDataChannel = 257,
412 llMD5String = 258, 412 llMD5String = 258,
413 llSetPrimitiveParams = 259, 413 llSetPrimitiveParams = 259,
414 llStringToBase64 = 260, 414 llStringToBase64 = 260,
415 llBase64ToString = 261, 415 llBase64ToString = 261,
416 llXorBase64Strings = 262, 416 llXorBase64Strings = 262,
417 llRemoteDataSetRegion = 263, 417 llRemoteDataSetRegion = 263,
418 llLog10 = 264, 418 llLog10 = 264,
419 llLog = 265, 419 llLog = 265,
420 llGetAnimationList = 266, 420 llGetAnimationList = 266,
421 llSetParcelMusicURL = 267, 421 llSetParcelMusicURL = 267,
422 llGetRootPosition = 268, 422 llGetRootPosition = 268,
423 llGetRootRotation = 269, 423 llGetRootRotation = 269,
424 llGetObjectDesc = 270, 424 llGetObjectDesc = 270,
425 llSetObjectDesc = 271, 425 llSetObjectDesc = 271,
426 llGetCreator = 272, 426 llGetCreator = 272,
427 llGetTimestamp = 273, 427 llGetTimestamp = 273,
428 llSetLinkAlpha = 274, 428 llSetLinkAlpha = 274,
429 llGetNumberOfPrims = 275, 429 llGetNumberOfPrims = 275,
430 llGetNumberOfNotecardLines = 276, 430 llGetNumberOfNotecardLines = 276,
431 llGetBoundingBox = 277, 431 llGetBoundingBox = 277,
432 llGetGeometricCenter = 278, 432 llGetGeometricCenter = 278,
433 llGetPrimitiveParams = 279, 433 llGetPrimitiveParams = 279,
434 llIntegerToBase64 = 280, 434 llIntegerToBase64 = 280,
435 llBase64ToInteger = 281, 435 llBase64ToInteger = 281,
436 llGetGMTclock = 282, 436 llGetGMTclock = 282,
437 llGetSimulatorHostname = 283, 437 llGetSimulatorHostname = 283,
438 llSetLocalRot = 284, 438 llSetLocalRot = 284,
439 llParseStringKeepNulls = 285, 439 llParseStringKeepNulls = 285,
440 llRezAtRoot = 286, 440 llRezAtRoot = 286,
441 llGetObjectPermMask = 287, 441 llGetObjectPermMask = 287,
442 llSetObjectPermMask = 288, 442 llSetObjectPermMask = 288,
443 llGetInventoryPermMask = 289, 443 llGetInventoryPermMask = 289,
444 llSetInventoryPermMask = 290, 444 llSetInventoryPermMask = 290,
445 llGetInventoryCreator = 291, 445 llGetInventoryCreator = 291,
446 llOwnerSay = 292, 446 llOwnerSay = 292,
447 llRequestSimulatorData = 293, 447 llRequestSimulatorData = 293,
448 llForceMouselook = 294, 448 llForceMouselook = 294,
449 llGetObjectMass = 295, 449 llGetObjectMass = 295,
450 llListReplaceList = 296, 450 llListReplaceList = 296,
451 llLoadURL = 297, 451 llLoadURL = 297,
452 llParcelMediaCommandList = 298, 452 llParcelMediaCommandList = 298,
453 llParcelMediaQuery = 299, 453 llParcelMediaQuery = 299,
454 llModPow = 300, 454 llModPow = 300,
455 llGetInventoryType = 301, 455 llGetInventoryType = 301,
456 llSetPayPrice = 302, 456 llSetPayPrice = 302,
457 llGetCameraPos = 303, 457 llGetCameraPos = 303,
458 llGetCameraRot = 304, 458 llGetCameraRot = 304,
459 llSetPrimURL = 305, 459 llSetPrimURL = 305,
460 llRefreshPrimURL = 306, 460 llRefreshPrimURL = 306,
461 llEscapeURL = 307, 461 llEscapeURL = 307,
462 llUnescapeURL = 308, 462 llUnescapeURL = 308,
463 llMapDestination = 309, 463 llMapDestination = 309,
464 llAddToLandBanList = 310, 464 llAddToLandBanList = 310,
465 llRemoveFromLandPassList = 311, 465 llRemoveFromLandPassList = 311,
466 llRemoveFromLandBanList = 312, 466 llRemoveFromLandBanList = 312,
467 llSetCameraParams = 313, 467 llSetCameraParams = 313,
468 llClearCameraParams = 314, 468 llClearCameraParams = 314,
469 llListStatistics = 315, 469 llListStatistics = 315,
470 llGetUnixTime = 316, 470 llGetUnixTime = 316,
471 llGetParcelFlags = 317, 471 llGetParcelFlags = 317,
472 llGetRegionFlags = 318, 472 llGetRegionFlags = 318,
473 llXorBase64StringsCorrect = 319, 473 llXorBase64StringsCorrect = 319,
474 llHTTPRequest = 320, 474 llHTTPRequest = 320,
475 llResetLandBanList = 321, 475 llResetLandBanList = 321,
476 llResetLandPassList = 322, 476 llResetLandPassList = 322,
477 llGetParcelPrimCount = 323, 477 llGetParcelPrimCount = 323,
478 llGetParcelPrimOwners = 324, 478 llGetParcelPrimOwners = 324,
479 llGetObjectPrimCount = 325, 479 llGetObjectPrimCount = 325,
480 llGetParcelMaxPrims = 326, 480 llGetParcelMaxPrims = 326,
481 llGetParcelDetails = 327 481 llGetParcelDetails = 327
482 } 482 }
483 483
484 } 484 }
485} 485}
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
index 2da1189..ebe4465 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs
@@ -1,608 +1,608 @@
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Text; 3 using System.Text;
4 using System.IO; 4 using System.IO;
5 using System.Reflection; 5 using System.Reflection;
6 using System.Reflection.Emit; 6 using System.Reflection.Emit;
7using OpenSim.Region.Scripting; 7using OpenSim.Region.Scripting;
8 8
9 namespace OpenSim.ScriptEngines.LSL 9 namespace OpenSim.ScriptEngines.LSL
10 { 10 {
11 class LSO_Parser 11 class LSO_Parser
12 { 12 {
13 private bool Debug = true; 13 private bool Debug = true;
14 private FileStream fs; 14 private FileStream fs;
15 private BinaryReader br; 15 private BinaryReader br;
16 private LSO_Struct.Header myHeader; 16 private LSO_Struct.Header myHeader;
17 17
18 private TypeBuilder typeBuilder; 18 private TypeBuilder typeBuilder;
19 private ScriptInfo WorldAPI; 19 private ScriptInfo WorldAPI;
20 20
21 /// <summary> 21 /// <summary>
22 /// Parse LSO file. 22 /// Parse LSO file.
23 /// Reads LSO ByteCode into memory structures. 23 /// Reads LSO ByteCode into memory structures.
24 /// TODO: What else does it do? 24 /// TODO: What else does it do?
25 /// </summary> 25 /// </summary>
26 /// <param name="FileName">FileName of LSO ByteCode file</param> 26 /// <param name="FileName">FileName of LSO ByteCode file</param>
27 public void ParseFile(string FileName, ScriptInfo _WorldAPI, ref TypeBuilder _typeBuilder) 27 public void ParseFile(string FileName, ScriptInfo _WorldAPI, ref TypeBuilder _typeBuilder)
28 { 28 {
29 typeBuilder = _typeBuilder; 29 typeBuilder = _typeBuilder;
30 WorldAPI = _WorldAPI; 30 WorldAPI = _WorldAPI;
31 // Open 31 // Open
32 SendToDebug("Opening filename: " + FileName); 32 SendToDebug("Opening filename: " + FileName);
33 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); 33 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
34 br = new BinaryReader(fs, Encoding.BigEndianUnicode); 34 br = new BinaryReader(fs, Encoding.BigEndianUnicode);
35 35
36 36
37 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. 37 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack.
38 38
39 39
40 // HEADER BLOCK 40 // HEADER BLOCK
41 SendToDebug("Reading HEADER BLOCK at: 0"); 41 SendToDebug("Reading HEADER BLOCK at: 0");
42 fs.Seek(0, SeekOrigin.Begin); 42 fs.Seek(0, SeekOrigin.Begin);
43 myHeader = new LSO_Struct.Header(); 43 myHeader = new LSO_Struct.Header();
44 myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); 44 myHeader.TM = BitConverter.ToUInt32(br_read(4), 0);
45 myHeader.IP = BitConverter.ToUInt32(br_read(4), 0); 45 myHeader.IP = BitConverter.ToUInt32(br_read(4), 0);
46 myHeader.VN = BitConverter.ToUInt32(br_read(4), 0); 46 myHeader.VN = BitConverter.ToUInt32(br_read(4), 0);
47 myHeader.BP = BitConverter.ToUInt32(br_read(4), 0); 47 myHeader.BP = BitConverter.ToUInt32(br_read(4), 0);
48 myHeader.SP = BitConverter.ToUInt32(br_read(4), 0); 48 myHeader.SP = BitConverter.ToUInt32(br_read(4), 0);
49 myHeader.HR = BitConverter.ToUInt32(br_read(4), 0); 49 myHeader.HR = BitConverter.ToUInt32(br_read(4), 0);
50 myHeader.HP = BitConverter.ToUInt32(br_read(4), 0); 50 myHeader.HP = BitConverter.ToUInt32(br_read(4), 0);
51 myHeader.CS = BitConverter.ToUInt32(br_read(4), 0); 51 myHeader.CS = BitConverter.ToUInt32(br_read(4), 0);
52 myHeader.NS = BitConverter.ToUInt32(br_read(4), 0); 52 myHeader.NS = BitConverter.ToUInt32(br_read(4), 0);
53 myHeader.CE = BitConverter.ToUInt32(br_read(4), 0); 53 myHeader.CE = BitConverter.ToUInt32(br_read(4), 0);
54 myHeader.IE = BitConverter.ToUInt32(br_read(4), 0); 54 myHeader.IE = BitConverter.ToUInt32(br_read(4), 0);
55 myHeader.ER = BitConverter.ToUInt32(br_read(4), 0); 55 myHeader.ER = BitConverter.ToUInt32(br_read(4), 0);
56 myHeader.FR = BitConverter.ToUInt32(br_read(4), 0); 56 myHeader.FR = BitConverter.ToUInt32(br_read(4), 0);
57 myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0); 57 myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0);
58 myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0); 58 myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0);
59 myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0); 59 myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0);
60 myHeader.PR = BitConverter.ToUInt32(br_read(4), 0); 60 myHeader.PR = BitConverter.ToUInt32(br_read(4), 0);
61 myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0); 61 myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0);
62 myHeader.SR = BitConverter.ToUInt32(br_read(4), 0); 62 myHeader.SR = BitConverter.ToUInt32(br_read(4), 0);
63 myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0); 63 myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0);
64 myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0); 64 myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0);
65 myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); 65 myHeader.NER = BitConverter.ToUInt64(br_read(8), 0);
66 66
67 // Print Header Block to debug 67 // Print Header Block to debug
68 SendToDebug("TM - Top of memory (size): " + myHeader.TM); 68 SendToDebug("TM - Top of memory (size): " + myHeader.TM);
69 SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); 69 SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP);
70 SendToDebug("VN - Version number: " + myHeader.VN); 70 SendToDebug("VN - Version number: " + myHeader.VN);
71 SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); 71 SendToDebug("BP - Local Frame Pointer: " + myHeader.BP);
72 SendToDebug("SP - Stack Pointer: " + myHeader.SP); 72 SendToDebug("SP - Stack Pointer: " + myHeader.SP);
73 SendToDebug("HR - Heap Register: " + myHeader.HR); 73 SendToDebug("HR - Heap Register: " + myHeader.HR);
74 SendToDebug("HP - Heap Pointer: " + myHeader.HP); 74 SendToDebug("HP - Heap Pointer: " + myHeader.HP);
75 SendToDebug("CS - Current State: " + myHeader.CS); 75 SendToDebug("CS - Current State: " + myHeader.CS);
76 SendToDebug("NS - Next State: " + myHeader.NS); 76 SendToDebug("NS - Next State: " + myHeader.NS);
77 SendToDebug("CE - Current Events: " + myHeader.CE); 77 SendToDebug("CE - Current Events: " + myHeader.CE);
78 SendToDebug("IE - In Event: " + myHeader.IE); 78 SendToDebug("IE - In Event: " + myHeader.IE);
79 SendToDebug("ER - Event Register: " + myHeader.ER); 79 SendToDebug("ER - Event Register: " + myHeader.ER);
80 SendToDebug("FR - Fault Register: " + myHeader.FR); 80 SendToDebug("FR - Fault Register: " + myHeader.FR);
81 SendToDebug("SLR - Sleep Register: " + myHeader.SLR); 81 SendToDebug("SLR - Sleep Register: " + myHeader.SLR);
82 SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); 82 SendToDebug("GVR - Global Variable Register: " + myHeader.GVR);
83 SendToDebug("GFR - Global Function Register: " + myHeader.GFR); 83 SendToDebug("GFR - Global Function Register: " + myHeader.GFR);
84 SendToDebug("PR - Parameter Register: " + myHeader.PR); 84 SendToDebug("PR - Parameter Register: " + myHeader.PR);
85 SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); 85 SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR);
86 SendToDebug("SR - State Register: " + myHeader.SR); 86 SendToDebug("SR - State Register: " + myHeader.SR);
87 SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); 87 SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE);
88 SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); 88 SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE);
89 SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); 89 SendToDebug("NER - 64-bit Event Register: " + myHeader.NER);
90 SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); 90 SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position);
91 91
92 // STATIC BLOCK 92 // STATIC BLOCK
93 SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); 93 SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR);
94 fs.Seek(myHeader.GVR, SeekOrigin.Begin); 94 fs.Seek(myHeader.GVR, SeekOrigin.Begin);
95 int StaticBlockCount = 0; 95 int StaticBlockCount = 0;
96 // Read function blocks until we hit GFR 96 // Read function blocks until we hit GFR
97 while (fs.Position < myHeader.GFR) 97 while (fs.Position < myHeader.GFR)
98 { 98 {
99 StaticBlockCount++; 99 StaticBlockCount++;
100 SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position); 100 SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position);
101 //fs.Seek(myHeader.GVR, SeekOrigin.Begin); 101 //fs.Seek(myHeader.GVR, SeekOrigin.Begin);
102 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); 102 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
103 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); 103 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
104 myStaticBlock.ObjectType = br_read(1)[0]; 104 myStaticBlock.ObjectType = br_read(1)[0];
105 SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); 105 SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString());
106 myStaticBlock.Unknown = br_read(1)[0]; 106 myStaticBlock.Unknown = br_read(1)[0];
107 // Size of datatype varies 107 // Size of datatype varies
108 if (myStaticBlock.ObjectType != 0) 108 if (myStaticBlock.ObjectType != 0)
109 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); 109 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType));
110 } 110 }
111 SendToDebug("Number of Static Blocks read: " + StaticBlockCount); 111 SendToDebug("Number of Static Blocks read: " + StaticBlockCount);
112 112
113 113
114 // FUNCTION BLOCK 114 // FUNCTION BLOCK
115 // Always right after STATIC BLOCK 115 // Always right after STATIC BLOCK
116 LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); 116 LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock();
117 if (myHeader.GFR == myHeader.SR) 117 if (myHeader.GFR == myHeader.SR)
118 { 118 {
119 // If GFR and SR are at same position then there is no fuction block 119 // If GFR and SR are at same position then there is no fuction block
120 SendToDebug("No FUNCTION BLOCK found"); 120 SendToDebug("No FUNCTION BLOCK found");
121 } else { 121 } else {
122 SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); 122 SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR);
123 fs.Seek(myHeader.GFR, SeekOrigin.Begin); 123 fs.Seek(myHeader.GFR, SeekOrigin.Begin);
124 myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); 124 myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0);
125 SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); 125 SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount);
126 if (myFunctionBlock.FunctionCount > 0) 126 if (myFunctionBlock.FunctionCount > 0)
127 { 127 {
128 myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; 128 myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount];
129 for (int i = 0; i < myFunctionBlock.FunctionCount; i++) 129 for (int i = 0; i < myFunctionBlock.FunctionCount; i++)
130 { 130 {
131 SendToDebug("Reading function " + i + " at: " + fs.Position); 131 SendToDebug("Reading function " + i + " at: " + fs.Position);
132 // TODO: ADD TO FUNCTION LIST (How do we identify it later?) 132 // TODO: ADD TO FUNCTION LIST (How do we identify it later?)
133 // Note! Absolute position 133 // Note! Absolute position
134 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; 134 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR;
135 SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); 135 SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]);
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 140
141 // STATE FRAME BLOCK 141 // STATE FRAME BLOCK
142 // Always right after FUNCTION BLOCK 142 // Always right after FUNCTION BLOCK
143 SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); 143 SendToDebug("Reading STATE BLOCK at: " + myHeader.SR);
144 fs.Seek(myHeader.SR, SeekOrigin.Begin); 144 fs.Seek(myHeader.SR, SeekOrigin.Begin);
145 LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); 145 LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock();
146 myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); 146 myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0);
147 if (myStateFrameBlock.StateCount > 0) 147 if (myStateFrameBlock.StateCount > 0)
148 { 148 {
149 // Initialize array 149 // Initialize array
150 myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; 150 myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount];
151 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 151 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
152 { 152 {
153 SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position); 153 SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position);
154 // Position is relative to state frame 154 // Position is relative to state frame
155 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); 155 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
156 myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); 156 myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8));
157 SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); 157 SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location);
158 SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); 158 SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count);
159 159
160 //// Read STATE BLOCK 160 //// Read STATE BLOCK
161 //long CurPos = fs.Position; 161 //long CurPos = fs.Position;
162 //fs.Seek(CurPos, SeekOrigin.Begin); 162 //fs.Seek(CurPos, SeekOrigin.Begin);
163 163
164 } 164 }
165 } 165 }
166 166
167 167
168 // STATE BLOCK 168 // STATE BLOCK
169 // For each StateFrameBlock there is one StateBlock with multiple event handlers 169 // For each StateFrameBlock there is one StateBlock with multiple event handlers
170 170
171 if (myStateFrameBlock.StateCount > 0) 171 if (myStateFrameBlock.StateCount > 0)
172 { 172 {
173 // Go through all State Frame Pointers found 173 // Go through all State Frame Pointers found
174 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 174 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
175 { 175 {
176 176
177 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); 177 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin);
178 SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); 178 SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position);
179 179
180 // READ: STATE BLOCK HEADER 180 // READ: STATE BLOCK HEADER
181 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); 181 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock();
182 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note 182 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note
183 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); 183 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0);
184 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; 184 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0];
185 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note 185 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note
186 SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); 186 SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos);
187 SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); 187 SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize);
188 SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); 188 SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos);
189 189
190 // We need to count number of bits flagged in EventMask? 190 // We need to count number of bits flagged in EventMask?
191 191
192 192
193 // for each bit in myStateFrameBlock.StatePointer[i].EventMask 193 // for each bit in myStateFrameBlock.StatePointer[i].EventMask
194 194
195 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE 195 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE
196 //TODO: Create event hooks 196 //TODO: Create event hooks
197 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; 197 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1];
198 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 198 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
199 { 199 {
200 200
201 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) 201 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true)
202 { 202 {
203 // We got an event 203 // We got an event
204 // READ: STATE BLOCK HANDLER 204 // READ: STATE BLOCK HANDLER
205 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); 205 SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position);
206 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); 206 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0);
207 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); 207 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0);
208 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); 208 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);
209 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 ); 209 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 );
210 } 210 }
211 } 211 }
212 } 212 }
213 } 213 }
214 214
215 215
216 216
217 217
218 //// READ FUNCTION CODE CHUNKS 218 //// READ FUNCTION CODE CHUNKS
219 //// Functions + Function start pos (GFR) 219 //// Functions + Function start pos (GFR)
220 //// TODO: Somehow be able to identify and reference this 220 //// TODO: Somehow be able to identify and reference this
221 //LSO_Struct.CodeChunk[] myFunctionCodeChunk; 221 //LSO_Struct.CodeChunk[] myFunctionCodeChunk;
222 //if (myFunctionBlock.FunctionCount > 0) 222 //if (myFunctionBlock.FunctionCount > 0)
223 //{ 223 //{
224 // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; 224 // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount];
225 // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) 225 // for (int i = 0; i < myFunctionBlock.FunctionCount; i++)
226 // { 226 // {
227 // SendToDebug("Reading Function Code Chunk " + i); 227 // SendToDebug("Reading Function Code Chunk " + i);
228 // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); 228 // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]);
229 // } 229 // }
230 230
231 //} 231 //}
232 // READ EVENT CODE CHUNKS 232 // READ EVENT CODE CHUNKS
233 LSO_Struct.CodeChunk[] myEventCodeChunk; 233 LSO_Struct.CodeChunk[] myEventCodeChunk;
234 if (myStateFrameBlock.StateCount > 0) 234 if (myStateFrameBlock.StateCount > 0)
235 { 235 {
236 myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; 236 myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount];
237 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 237 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
238 { 238 {
239 // TODO: Somehow organize events and functions so they can be found again, 239 // TODO: Somehow organize events and functions so they can be found again,
240 // two level search ain't no good 240 // two level search ain't no good
241 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 241 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
242 { 242 {
243 243
244 244
245 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) 245 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0)
246 { 246 {
247 SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); 247 SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii);
248 248
249 249
250 // Override a Method / Function 250 // Override a Method / Function
251 string eventname = "event_" + (LSO_Enums.Event_Mask_Values)ii; 251 string eventname = "event_" + (LSO_Enums.Event_Mask_Values)ii;
252 SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); 252 SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod...");
253 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, 253 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
254 MethodAttributes.Private | MethodAttributes.Virtual, 254 MethodAttributes.Private | MethodAttributes.Virtual,
255 typeof(void), 255 typeof(void),
256 new Type[] { typeof(object) }); 256 new Type[] { typeof(object) });
257 257
258 SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); 258 SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder...");
259 typeBuilder.DefineMethodOverride(methodBuilder, 259 typeBuilder.DefineMethodOverride(methodBuilder,
260 typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); 260 typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname));
261 261
262 // Create the IL generator 262 // Create the IL generator
263 263
264 SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); 264 SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();");
265 ILGenerator il = methodBuilder.GetILGenerator(); 265 ILGenerator il = methodBuilder.GetILGenerator();
266 266
267 267
268 LSO_Struct.CodeChunk myECC = 268 LSO_Struct.CodeChunk myECC =
269 GetCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, il, eventname); 269 GetCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, il, eventname);
270 } 270 }
271 271
272 } 272 }
273 } 273 }
274 274
275 } 275 }
276 276
277 277
278 // Close 278 // Close
279 br.Close(); 279 br.Close();
280 fs.Close(); 280 fs.Close();
281 281
282 } 282 }
283 283
284 private LSO_Struct.HeapBlock GetHeap(UInt32 pos) 284 private LSO_Struct.HeapBlock GetHeap(UInt32 pos)
285 { 285 {
286 // HEAP BLOCK 286 // HEAP BLOCK
287 // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) 287 // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries)
288 SendToDebug("Reading HEAP BLOCK at: " + pos); 288 SendToDebug("Reading HEAP BLOCK at: " + pos);
289 fs.Seek(pos, SeekOrigin.Begin); 289 fs.Seek(pos, SeekOrigin.Begin);
290 290
291 LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); 291 LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock();
292 myHeapBlock.DataBlockSize = BitConverter.ToUInt32(br_read(4), 0); 292 myHeapBlock.DataBlockSize = BitConverter.ToUInt32(br_read(4), 0);
293 myHeapBlock.ObjectType = br_read(1)[0]; 293 myHeapBlock.ObjectType = br_read(1)[0];
294 myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); 294 myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0);
295 myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); 295 myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType));
296 296
297 SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); 297 SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize);
298 SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); 298 SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString());
299 SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); 299 SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount);
300 300
301 return myHeapBlock; 301 return myHeapBlock;
302 } 302 }
303 303
304 304
305 305
306 private byte[] br_read(int len) 306 private byte[] br_read(int len)
307 { 307 {
308 if (len <= 0) 308 if (len <= 0)
309 return null; 309 return null;
310 310
311 try 311 try
312 { 312 {
313 byte[] bytes = new byte[len]; 313 byte[] bytes = new byte[len];
314 for (int i = len - 1; i > -1; i--) 314 for (int i = len - 1; i > -1; i--)
315 bytes[i] = br.ReadByte(); 315 bytes[i] = br.ReadByte();
316 return bytes; 316 return bytes;
317 } 317 }
318 catch (Exception e) 318 catch (Exception e)
319 { 319 {
320 SendToDebug("Exception: " + e.ToString()); 320 SendToDebug("Exception: " + e.ToString());
321 throw (e); 321 throw (e);
322 } 322 }
323 } 323 }
324 //private byte[] br_read_smallendian(int len) 324 //private byte[] br_read_smallendian(int len)
325 //{ 325 //{
326 // byte[] bytes = new byte[len]; 326 // byte[] bytes = new byte[len];
327 // br.Read(bytes,0, len); 327 // br.Read(bytes,0, len);
328 // return bytes; 328 // return bytes;
329 //} 329 //}
330 330
331 private int getObjectSize(byte ObjectType) 331 private int getObjectSize(byte ObjectType)
332 { 332 {
333 switch (ObjectType) 333 switch (ObjectType)
334 { 334 {
335 case 1: 335 case 1:
336 case 2: 336 case 2:
337 case 3: 337 case 3:
338 case 4: 338 case 4:
339 case 7: 339 case 7:
340 return 4; 340 return 4;
341 case 5: 341 case 5:
342 return 12; 342 return 12;
343 case 6: 343 case 6:
344 return 16; 344 return 16;
345 default: 345 default:
346 return 0; 346 return 0;
347 } 347 }
348 } 348 }
349 private void SendToDebug(string Message) 349 private void SendToDebug(string Message)
350 { 350 {
351 if (Debug == true) 351 if (Debug == true)
352 Console.WriteLine("Debug: " + Message); 352 Console.WriteLine("Debug: " + Message);
353 } 353 }
354 354
355 355
356 private string Read_String() 356 private string Read_String()
357 { 357 {
358 string ret = ""; 358 string ret = "";
359 byte reader = br_read(1)[0]; 359 byte reader = br_read(1)[0];
360 while (reader != 0x000) 360 while (reader != 0x000)
361 { 361 {
362 ret += (char)reader; 362 ret += (char)reader;
363 reader = br_read(1)[0]; 363 reader = br_read(1)[0];
364 } 364 }
365 return ret; 365 return ret;
366 } 366 }
367 367
368 /// <summary> 368 /// <summary>
369 /// Reads a code chunk into structure and returns it. 369 /// Reads a code chunk into structure and returns it.
370 /// </summary> 370 /// </summary>
371 /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> 371 /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param>
372 /// <returns></returns> 372 /// <returns></returns>
373 private LSO_Struct.CodeChunk GetCodeChunk(UInt32 pos, ILGenerator il, string eventname) 373 private LSO_Struct.CodeChunk GetCodeChunk(UInt32 pos, ILGenerator il, string eventname)
374 { 374 {
375 375
376 /* 376 /*
377 * CLR TRY 377 * CLR TRY
378 */ 378 */
379 //SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); 379 //SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()");
380 il.BeginExceptionBlock(); 380 il.BeginExceptionBlock();
381 381
382 // Push "Hello World!" string to stack 382 // Push "Hello World!" string to stack
383 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 383 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
384 il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); 384 il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname);
385 385
386 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); 386 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
387 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 387 //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
388 il.Emit(OpCodes.Call, typeof(Console).GetMethod 388 il.Emit(OpCodes.Call, typeof(Console).GetMethod
389 ("WriteLine", new Type[] { typeof(string) })); 389 ("WriteLine", new Type[] { typeof(string) }));
390 390
391 391
392 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); 392 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk();
393 393
394 SendToDebug("Reading Function Code Chunk at: " + pos); 394 SendToDebug("Reading Function Code Chunk at: " + pos);
395 fs.Seek(pos, SeekOrigin.Begin); 395 fs.Seek(pos, SeekOrigin.Begin);
396 myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); 396 myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0);
397 SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize ); 397 SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize );
398 // Read until null 398 // Read until null
399 myCodeChunk.Comment = Read_String(); 399 myCodeChunk.Comment = Read_String();
400 SendToDebug("Function comment: " + myCodeChunk.Comment); 400 SendToDebug("Function comment: " + myCodeChunk.Comment);
401 myCodeChunk.ReturnType = br_read(1)[0]; 401 myCodeChunk.ReturnType = br_read(1)[0];
402 SendToDebug("Return type: " + (LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType); 402 SendToDebug("Return type: " + (LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType);
403 // TODO: How to determine number of codechunks -- does this method work? 403 // TODO: How to determine number of codechunks -- does this method work?
404 myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); 404 myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>();
405 byte reader = br_read(1)[0]; 405 byte reader = br_read(1)[0];
406 reader = br_read(1)[0]; 406 reader = br_read(1)[0];
407 int ccount = 0; 407 int ccount = 0;
408 while (reader != 0x000) 408 while (reader != 0x000)
409 { 409 {
410 ccount++; 410 ccount++;
411 SendToDebug("Reading Code Chunk Argument " + ccount); 411 SendToDebug("Reading Code Chunk Argument " + ccount);
412 LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); 412 LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument();
413 CCA.FunctionReturnType = reader; 413 CCA.FunctionReturnType = reader;
414 reader = br_read(1)[0]; 414 reader = br_read(1)[0];
415 CCA.NullString = reader; 415 CCA.NullString = reader;
416 myCodeChunk.CodeChunkArguments.Add(CCA); 416 myCodeChunk.CodeChunkArguments.Add(CCA);
417 SendToDebug("Code Chunk Argument " + ccount + " return type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType); 417 SendToDebug("Code Chunk Argument " + ccount + " return type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType);
418 } 418 }
419 // End marker is 0x000 419 // End marker is 0x000
420 myCodeChunk.EndMarker = reader; 420 myCodeChunk.EndMarker = reader;
421 // TODO: How to read and identify following code 421 // TODO: How to read and identify following code
422 // TODO: Code is read until a return of some sort is found 422 // TODO: Code is read until a return of some sort is found
423 bool FoundRet = false; 423 bool FoundRet = false;
424 while (FoundRet == false) 424 while (FoundRet == false)
425 { 425 {
426 //reader = br_read(1)[0]; 426 //reader = br_read(1)[0];
427 //UInt16 opcode = BitConverter.ToUInt16(br_read(1),0); 427 //UInt16 opcode = BitConverter.ToUInt16(br_read(1),0);
428 UInt16 opcode = br_read(1)[0]; 428 UInt16 opcode = br_read(1)[0];
429 //long rPos = fs.Position; 429 //long rPos = fs.Position;
430 SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); 430 SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString());
431 switch (opcode) 431 switch (opcode)
432 { 432 {
433 // LONG 433 // LONG
434 case (UInt16)LSO_Enums.Operation_Table.POPARG: 434 case (UInt16)LSO_Enums.Operation_Table.POPARG:
435 case (UInt16)LSO_Enums.Operation_Table.STORE: 435 case (UInt16)LSO_Enums.Operation_Table.STORE:
436 case (UInt16)LSO_Enums.Operation_Table.STORES: 436 case (UInt16)LSO_Enums.Operation_Table.STORES:
437 case (UInt16)LSO_Enums.Operation_Table.STOREL: 437 case (UInt16)LSO_Enums.Operation_Table.STOREL:
438 case (UInt16)LSO_Enums.Operation_Table.STOREV: 438 case (UInt16)LSO_Enums.Operation_Table.STOREV:
439 case (UInt16)LSO_Enums.Operation_Table.STOREQ: 439 case (UInt16)LSO_Enums.Operation_Table.STOREQ:
440 case (UInt16)LSO_Enums.Operation_Table.STOREG: 440 case (UInt16)LSO_Enums.Operation_Table.STOREG:
441 case (UInt16)LSO_Enums.Operation_Table.STOREGS: 441 case (UInt16)LSO_Enums.Operation_Table.STOREGS:
442 case (UInt16)LSO_Enums.Operation_Table.STOREGL: 442 case (UInt16)LSO_Enums.Operation_Table.STOREGL:
443 case (UInt16)LSO_Enums.Operation_Table.STOREGV: 443 case (UInt16)LSO_Enums.Operation_Table.STOREGV:
444 case (UInt16)LSO_Enums.Operation_Table.STOREGQ: 444 case (UInt16)LSO_Enums.Operation_Table.STOREGQ:
445 case (UInt16)LSO_Enums.Operation_Table.LOADP: 445 case (UInt16)LSO_Enums.Operation_Table.LOADP:
446 case (UInt16)LSO_Enums.Operation_Table.LOADSP: 446 case (UInt16)LSO_Enums.Operation_Table.LOADSP:
447 case (UInt16)LSO_Enums.Operation_Table.LOADLP: 447 case (UInt16)LSO_Enums.Operation_Table.LOADLP:
448 case (UInt16)LSO_Enums.Operation_Table.LOADVP: 448 case (UInt16)LSO_Enums.Operation_Table.LOADVP:
449 case (UInt16)LSO_Enums.Operation_Table.LOADQP: 449 case (UInt16)LSO_Enums.Operation_Table.LOADQP:
450 case (UInt16)LSO_Enums.Operation_Table.PUSH: 450 case (UInt16)LSO_Enums.Operation_Table.PUSH:
451 case (UInt16)LSO_Enums.Operation_Table.PUSHS: 451 case (UInt16)LSO_Enums.Operation_Table.PUSHS:
452 case (UInt16)LSO_Enums.Operation_Table.PUSHL: 452 case (UInt16)LSO_Enums.Operation_Table.PUSHL:
453 case (UInt16)LSO_Enums.Operation_Table.PUSHV: 453 case (UInt16)LSO_Enums.Operation_Table.PUSHV:
454 case (UInt16)LSO_Enums.Operation_Table.PUSHQ: 454 case (UInt16)LSO_Enums.Operation_Table.PUSHQ:
455 case (UInt16)LSO_Enums.Operation_Table.PUSHG: 455 case (UInt16)LSO_Enums.Operation_Table.PUSHG:
456 case (UInt16)LSO_Enums.Operation_Table.PUSHGS: 456 case (UInt16)LSO_Enums.Operation_Table.PUSHGS:
457 case (UInt16)LSO_Enums.Operation_Table.PUSHGL: 457 case (UInt16)LSO_Enums.Operation_Table.PUSHGL:
458 case (UInt16)LSO_Enums.Operation_Table.PUSHGV: 458 case (UInt16)LSO_Enums.Operation_Table.PUSHGV:
459 case (UInt16)LSO_Enums.Operation_Table.PUSHGQ: 459 case (UInt16)LSO_Enums.Operation_Table.PUSHGQ:
460 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 460 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
461 break; 461 break;
462 // BYTE 462 // BYTE
463 case (UInt16)LSO_Enums.Operation_Table.PUSHARGB: 463 case (UInt16)LSO_Enums.Operation_Table.PUSHARGB:
464 SendToDebug("Param1: " + br_read(1)[0]); 464 SendToDebug("Param1: " + br_read(1)[0]);
465 break; 465 break;
466 // INTEGER 466 // INTEGER
467 case (UInt16)LSO_Enums.Operation_Table.PUSHARGI: 467 case (UInt16)LSO_Enums.Operation_Table.PUSHARGI:
468 // TODO: What is size of integer? 468 // TODO: What is size of integer?
469 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 469 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
470 break; 470 break;
471 // FLOAT 471 // FLOAT
472 case (UInt16)LSO_Enums.Operation_Table.PUSHARGF: 472 case (UInt16)LSO_Enums.Operation_Table.PUSHARGF:
473 // TODO: What is size of float? 473 // TODO: What is size of float?
474 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 474 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
475 break; 475 break;
476 // STRING 476 // STRING
477 case (UInt16)LSO_Enums.Operation_Table.PUSHARGS: 477 case (UInt16)LSO_Enums.Operation_Table.PUSHARGS:
478 string s = Read_String(); 478 string s = Read_String();
479 SendToDebug("Param1: " + s); 479 SendToDebug("Param1: " + s);
480 il.Emit(OpCodes.Ldstr, s); 480 il.Emit(OpCodes.Ldstr, s);
481 break; 481 break;
482 // VECTOR z,y,x 482 // VECTOR z,y,x
483 case (UInt16)LSO_Enums.Operation_Table.PUSHARGV: 483 case (UInt16)LSO_Enums.Operation_Table.PUSHARGV:
484 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); 484 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0));
485 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); 485 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0));
486 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); 486 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0));
487 break; 487 break;
488 // ROTATION s,z,y,x 488 // ROTATION s,z,y,x
489 case (UInt16)LSO_Enums.Operation_Table.PUSHARGQ: 489 case (UInt16)LSO_Enums.Operation_Table.PUSHARGQ:
490 SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4),0)); 490 SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4),0));
491 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); 491 SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0));
492 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); 492 SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0));
493 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); 493 SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0));
494 break; 494 break;
495 // LONG 495 // LONG
496 case (UInt16)LSO_Enums.Operation_Table.PUSHARGE: 496 case (UInt16)LSO_Enums.Operation_Table.PUSHARGE:
497 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 497 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
498 break; 498 break;
499 // BYTE 499 // BYTE
500 case (UInt16)LSO_Enums.Operation_Table.ADD: 500 case (UInt16)LSO_Enums.Operation_Table.ADD:
501 case (UInt16)LSO_Enums.Operation_Table.SUB: 501 case (UInt16)LSO_Enums.Operation_Table.SUB:
502 case (UInt16)LSO_Enums.Operation_Table.MUL: 502 case (UInt16)LSO_Enums.Operation_Table.MUL:
503 case (UInt16)LSO_Enums.Operation_Table.DIV: 503 case (UInt16)LSO_Enums.Operation_Table.DIV:
504 case (UInt16)LSO_Enums.Operation_Table.MOD: 504 case (UInt16)LSO_Enums.Operation_Table.MOD:
505 case (UInt16)LSO_Enums.Operation_Table.EQ: 505 case (UInt16)LSO_Enums.Operation_Table.EQ:
506 case (UInt16)LSO_Enums.Operation_Table.NEQ: 506 case (UInt16)LSO_Enums.Operation_Table.NEQ:
507 case (UInt16)LSO_Enums.Operation_Table.LEQ: 507 case (UInt16)LSO_Enums.Operation_Table.LEQ:
508 case (UInt16)LSO_Enums.Operation_Table.GEQ: 508 case (UInt16)LSO_Enums.Operation_Table.GEQ:
509 case (UInt16)LSO_Enums.Operation_Table.LESS: 509 case (UInt16)LSO_Enums.Operation_Table.LESS:
510 case (UInt16)LSO_Enums.Operation_Table.GREATER: 510 case (UInt16)LSO_Enums.Operation_Table.GREATER:
511 case (UInt16)LSO_Enums.Operation_Table.BOOLOR: 511 case (UInt16)LSO_Enums.Operation_Table.BOOLOR:
512 SendToDebug("Param1: " + br_read(1)[0]); 512 SendToDebug("Param1: " + br_read(1)[0]);
513 break; 513 break;
514 // LONG 514 // LONG
515 case (UInt16)LSO_Enums.Operation_Table.JUMP: 515 case (UInt16)LSO_Enums.Operation_Table.JUMP:
516 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 516 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
517 break; 517 break;
518 // BYTE, LONG 518 // BYTE, LONG
519 case (UInt16)LSO_Enums.Operation_Table.JUMPIF: 519 case (UInt16)LSO_Enums.Operation_Table.JUMPIF:
520 case (UInt16)LSO_Enums.Operation_Table.JUMPNIF: 520 case (UInt16)LSO_Enums.Operation_Table.JUMPNIF:
521 SendToDebug("Param1: " + br_read(1)[0]); 521 SendToDebug("Param1: " + br_read(1)[0]);
522 SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4),0)); 522 SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4),0));
523 break; 523 break;
524 // LONG 524 // LONG
525 case (UInt16)LSO_Enums.Operation_Table.STATE: 525 case (UInt16)LSO_Enums.Operation_Table.STATE:
526 case (UInt16)LSO_Enums.Operation_Table.CALL: 526 case (UInt16)LSO_Enums.Operation_Table.CALL:
527 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 527 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
528 break; 528 break;
529 // BYTE 529 // BYTE
530 case (UInt16)LSO_Enums.Operation_Table.CAST: 530 case (UInt16)LSO_Enums.Operation_Table.CAST:
531 SendToDebug("Param1: " + br_read(1)[0]); 531 SendToDebug("Param1: " + br_read(1)[0]);
532 break; 532 break;
533 // LONG 533 // LONG
534 case (UInt16)LSO_Enums.Operation_Table.STACKTOS: 534 case (UInt16)LSO_Enums.Operation_Table.STACKTOS:
535 case (UInt16)LSO_Enums.Operation_Table.STACKTOL: 535 case (UInt16)LSO_Enums.Operation_Table.STACKTOL:
536 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); 536 SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0));
537 break; 537 break;
538 // BYTE 538 // BYTE
539 case (UInt16)LSO_Enums.Operation_Table.PRINT: 539 case (UInt16)LSO_Enums.Operation_Table.PRINT:
540 case (UInt16)LSO_Enums.Operation_Table.CALLLIB: 540 case (UInt16)LSO_Enums.Operation_Table.CALLLIB:
541 SendToDebug("Param1: " + br_read(1)[0]); 541 SendToDebug("Param1: " + br_read(1)[0]);
542 break; 542 break;
543 // SHORT 543 // SHORT
544 case (UInt16)LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: 544 case (UInt16)LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE:
545 // TODO: What is size of short? 545 // TODO: What is size of short?
546 UInt16 _i = BitConverter.ToUInt16(br_read(2), 0); 546 UInt16 _i = BitConverter.ToUInt16(br_read(2), 0);
547 SendToDebug("Param1: " + _i); 547 SendToDebug("Param1: " + _i);
548 switch (_i) 548 switch (_i)
549 { 549 {
550 case (UInt16)LSO_Enums.BuiltIn_Functions.llSay: 550 case (UInt16)LSO_Enums.BuiltIn_Functions.llSay:
551 il.Emit(OpCodes.Call, typeof(Console).GetMethod 551 il.Emit(OpCodes.Call, typeof(Console).GetMethod
552 ("WriteLine", new Type[] { typeof(string) })); 552 ("WriteLine", new Type[] { typeof(string) }));
553 break; 553 break;
554 } 554 }
555 break; 555 break;
556 556
557 557
558 // RETURN 558 // RETURN
559 case (UInt16)LSO_Enums.Operation_Table.RETURN: 559 case (UInt16)LSO_Enums.Operation_Table.RETURN:
560 SendToDebug("Last OPCODE was return command. Code chunk execution complete."); 560 SendToDebug("Last OPCODE was return command. Code chunk execution complete.");
561 FoundRet = true; 561 FoundRet = true;
562 break; 562 break;
563 } 563 }
564 //fs.Seek(rPos, SeekOrigin.Begin); 564 //fs.Seek(rPos, SeekOrigin.Begin);
565 565
566 } 566 }
567 567
568 568
569 /* 569 /*
570 * CATCH 570 * CATCH
571 */ 571 */
572 SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); 572 SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));");
573 il.BeginCatchBlock(typeof(Exception)); 573 il.BeginCatchBlock(typeof(Exception));
574 574
575 // Push "Hello World!" string to stack 575 // Push "Hello World!" string to stack
576 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 576 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
577 il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); 577 il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": ");
578 578
579 //call void [mscorlib]System.Console::WriteLine(string) 579 //call void [mscorlib]System.Console::WriteLine(string)
580 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 580 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
581 il.Emit(OpCodes.Call, typeof(Console).GetMethod 581 il.Emit(OpCodes.Call, typeof(Console).GetMethod
582 ("Write", new Type[] { typeof(string) })); 582 ("Write", new Type[] { typeof(string) }));
583 583
584 //callvirt instance string [mscorlib]System.Exception::get_Message() 584 //callvirt instance string [mscorlib]System.Exception::get_Message()
585 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); 585 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt...");
586 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod 586 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod
587 ("get_Message")); 587 ("get_Message"));
588 588
589 //call void [mscorlib]System.Console::WriteLine(string) 589 //call void [mscorlib]System.Console::WriteLine(string)
590 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 590 SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
591 il.Emit(OpCodes.Call, typeof(Console).GetMethod 591 il.Emit(OpCodes.Call, typeof(Console).GetMethod
592 ("WriteLine", new Type[] { typeof(string) })); 592 ("WriteLine", new Type[] { typeof(string) }));
593 593
594 /* 594 /*
595 * CLR END TRY 595 * CLR END TRY
596 */ 596 */
597 //SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); 597 //SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();");
598 il.EndExceptionBlock(); 598 il.EndExceptionBlock();
599 // Push "Return from current method, with return value if present" to stack 599 // Push "Return from current method, with return value if present" to stack
600 il.Emit(OpCodes.Ret); 600 il.Emit(OpCodes.Ret);
601 601
602 602
603 603
604 return myCodeChunk; 604 return myCodeChunk;
605 605
606 } 606 }
607 } 607 }
608} 608}
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
index 3b91e9f..66c6c5e 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs
@@ -1,105 +1,105 @@
1 1
2using System; 2using System;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5 5
6namespace OpenSim.ScriptEngines.LSL 6namespace OpenSim.ScriptEngines.LSL
7{ 7{
8 static class LSO_Struct 8 static class LSO_Struct
9 { 9 {
10 10
11 public struct Header 11 public struct Header
12 { 12 {
13 public UInt32 TM; 13 public UInt32 TM;
14 public UInt32 IP; 14 public UInt32 IP;
15 public UInt32 VN; 15 public UInt32 VN;
16 public UInt32 BP; 16 public UInt32 BP;
17 public UInt32 SP; 17 public UInt32 SP;
18 public UInt32 HR; 18 public UInt32 HR;
19 public UInt32 HP; 19 public UInt32 HP;
20 public UInt32 CS; 20 public UInt32 CS;
21 public UInt32 NS; 21 public UInt32 NS;
22 public UInt32 CE; 22 public UInt32 CE;
23 public UInt32 IE; 23 public UInt32 IE;
24 public UInt32 ER; 24 public UInt32 ER;
25 public UInt32 FR; 25 public UInt32 FR;
26 public UInt32 SLR; 26 public UInt32 SLR;
27 public UInt32 GVR; 27 public UInt32 GVR;
28 public UInt32 GFR; 28 public UInt32 GFR;
29 public UInt32 PR; 29 public UInt32 PR;
30 public UInt32 ESR; 30 public UInt32 ESR;
31 public UInt32 SR; 31 public UInt32 SR;
32 public UInt64 NCE; 32 public UInt64 NCE;
33 public UInt64 NIE; 33 public UInt64 NIE;
34 public UInt64 NER; 34 public UInt64 NER;
35 } 35 }
36 36
37 public struct StaticBlock 37 public struct StaticBlock
38 { 38 {
39 public UInt32 Static_Chunk_Header_Size; 39 public UInt32 Static_Chunk_Header_Size;
40 public byte ObjectType; 40 public byte ObjectType;
41 public byte Unknown; 41 public byte Unknown;
42 public byte[] BlockVariable; 42 public byte[] BlockVariable;
43 } 43 }
44 /* Not actually a structure 44 /* Not actually a structure
45 public struct StaticBlockVariable 45 public struct StaticBlockVariable
46 { 46 {
47 public UInt32 Integer1; 47 public UInt32 Integer1;
48 public UInt32 Float1; 48 public UInt32 Float1;
49 public UInt32 HeapPointer_String; 49 public UInt32 HeapPointer_String;
50 public UInt32 HeapPointer_Key; 50 public UInt32 HeapPointer_Key;
51 public byte[] Vector_12; 51 public byte[] Vector_12;
52 public byte[] Rotation_16; 52 public byte[] Rotation_16;
53 public UInt32 Pointer_List_Structure; 53 public UInt32 Pointer_List_Structure;
54 } */ 54 } */
55 public struct HeapBlock 55 public struct HeapBlock
56 { 56 {
57 public UInt32 DataBlockSize; 57 public UInt32 DataBlockSize;
58 public byte ObjectType; 58 public byte ObjectType;
59 public UInt16 ReferenceCount; 59 public UInt16 ReferenceCount;
60 public byte[] Data; 60 public byte[] Data;
61 } 61 }
62 public struct StateFrameBlock 62 public struct StateFrameBlock
63 { 63 {
64 public UInt32 StateCount; 64 public UInt32 StateCount;
65 public StatePointerBlock[] StatePointer; 65 public StatePointerBlock[] StatePointer;
66 } 66 }
67 public struct StatePointerBlock 67 public struct StatePointerBlock
68 { 68 {
69 public UInt32 Location; 69 public UInt32 Location;
70 public System.Collections.BitArray EventMask; 70 public System.Collections.BitArray EventMask;
71 public StateBlock StateBlock; 71 public StateBlock StateBlock;
72 } 72 }
73 public struct StateBlock 73 public struct StateBlock
74 { 74 {
75 public UInt32 StartPos; 75 public UInt32 StartPos;
76 public UInt32 EndPos; 76 public UInt32 EndPos;
77 public UInt32 HeaderSize; 77 public UInt32 HeaderSize;
78 public byte Unknown; 78 public byte Unknown;
79 public StateBlockHandler[] StateBlockHandlers; 79 public StateBlockHandler[] StateBlockHandlers;
80 } 80 }
81 public struct StateBlockHandler 81 public struct StateBlockHandler
82 { 82 {
83 public UInt32 CodeChunkPointer; 83 public UInt32 CodeChunkPointer;
84 public UInt32 CallFrameSize; 84 public UInt32 CallFrameSize;
85 } 85 }
86 public struct FunctionBlock 86 public struct FunctionBlock
87 { 87 {
88 public UInt32 FunctionCount; 88 public UInt32 FunctionCount;
89 public UInt32[] CodeChunkPointer; 89 public UInt32[] CodeChunkPointer;
90 } 90 }
91 public struct CodeChunk 91 public struct CodeChunk
92 { 92 {
93 public UInt32 CodeChunkHeaderSize; 93 public UInt32 CodeChunkHeaderSize;
94 public string Comment; 94 public string Comment;
95 public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; 95 public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments;
96 public byte EndMarker; 96 public byte EndMarker;
97 public byte ReturnType; 97 public byte ReturnType;
98 } 98 }
99 public struct CodeChunkArgument 99 public struct CodeChunkArgument
100 { 100 {
101 public byte FunctionReturnType; 101 public byte FunctionReturnType;
102 public byte NullString; 102 public byte NullString;
103 } 103 }
104 } 104 }
105} 105}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs
index 99d7d04..40825c0 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Script.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs
@@ -1,64 +1,64 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Region.Environment.Scenes; 28using OpenSim.Region.Environment.Scenes;
29 29
30namespace OpenSim.Region.Scripting 30namespace OpenSim.Region.Scripting
31{ 31{
32 public interface IScript 32 public interface IScript
33 { 33 {
34 void Initialise(ScriptInfo scriptInfo); 34 void Initialise(ScriptInfo scriptInfo);
35 string getName(); 35 string getName();
36 } 36 }
37 37
38 public class TestScript : IScript 38 public class TestScript : IScript
39 { 39 {
40 ScriptInfo script; 40 ScriptInfo script;
41 41
42 public string getName() 42 public string getName()
43 { 43 {
44 return "TestScript 0.1"; 44 return "TestScript 0.1";
45 } 45 }
46 46
47 public void Initialise(ScriptInfo scriptInfo) 47 public void Initialise(ScriptInfo scriptInfo)
48 { 48 {
49 script = scriptInfo; 49 script = scriptInfo;
50 script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); 50 script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
51 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 51 script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
52 } 52 }
53 53
54 void events_OnNewPresence(ScenePresence presence) 54 void events_OnNewPresence(ScenePresence presence)
55 { 55 {
56 script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); 56 script.logger.Verbose("Hello " + presence.firstname.ToString() + "!");
57 } 57 }
58 58
59 void events_OnFrame() 59 void events_OnFrame()
60 { 60 {
61 //script.logger.Verbose("Hello World!"); 61 //script.logger.Verbose("Hello World!");
62 } 62 }
63 } 63 }
64} 64}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs
index a8f6aa5..b4f6a05 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptAPI.cs
@@ -1,32 +1,32 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using Key = libsecondlife.LLUUID; 4using Key = libsecondlife.LLUUID;
5using Rotation = libsecondlife.LLQuaternion; 5using Rotation = libsecondlife.LLQuaternion;
6using Vector = libsecondlife.LLVector3; 6using Vector = libsecondlife.LLVector3;
7using LSLList = System.Collections.Generic.List<string>; 7using LSLList = System.Collections.Generic.List<string>;
8 8
9 9
10using OpenSim.Region.Environment.Scenes; 10using OpenSim.Region.Environment.Scenes;
11 11
12namespace OpenSim.Region.Scripting 12namespace OpenSim.Region.Scripting
13{ 13{
14 // This class is to be used for engines which may not be able to access the Scene directly. 14 // This class is to be used for engines which may not be able to access the Scene directly.
15 // Scene access is preffered, but obviously not possible on some non-.NET languages. 15 // Scene access is preffered, but obviously not possible on some non-.NET languages.
16 public class ScriptAPI 16 public class ScriptAPI
17 { 17 {
18 Scene scene; 18 Scene scene;
19 ScriptInterpretedAPI interpretedAPI; 19 ScriptInterpretedAPI interpretedAPI;
20 20
21 public ScriptAPI(Scene world) 21 public ScriptAPI(Scene world)
22 { 22 {
23 scene = world; 23 scene = world;
24 interpretedAPI = new ScriptInterpretedAPI(); 24 interpretedAPI = new ScriptInterpretedAPI();
25 } 25 }
26 26
27 public Object CallMethod(String method, Object[] args) 27 public Object CallMethod(String method, Object[] args)
28 { 28 {
29 return null; 29 return null;
30 } 30 }
31 } 31 }
32} 32}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
index c3be22a..4a6086c 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInfo.cs
@@ -1,58 +1,58 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework.Console; 28using OpenSim.Framework.Console;
29using OpenSim.Region.Environment.Scenes; 29using OpenSim.Region.Environment.Scenes;
30 30
31namespace OpenSim.Region.Scripting 31namespace OpenSim.Region.Scripting
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Class which provides access to the world 34 /// Class which provides access to the world
35 /// </summary> 35 /// </summary>
36 public class ScriptInfo 36 public class ScriptInfo
37 { 37 {
38 // Reference to world.eventsManager provided for convenience 38 // Reference to world.eventsManager provided for convenience
39 public EventManager events; 39 public EventManager events;
40 40
41 // The main world 41 // The main world
42 public Scene world; 42 public Scene world;
43 43
44 // The console 44 // The console
45 public LogBase logger; 45 public LogBase logger;
46 46
47 // API Access 47 // API Access
48 public ScriptAPI api; 48 public ScriptAPI api;
49 49
50 public ScriptInfo(Scene scene) 50 public ScriptInfo(Scene scene)
51 { 51 {
52 world = scene; 52 world = scene;
53 events = world.EventManager; 53 events = world.EventManager;
54 logger = MainLog.Instance; 54 logger = MainLog.Instance;
55 api = new ScriptAPI(scene); 55 api = new ScriptAPI(scene);
56 } 56 }
57 } 57 }
58} 58}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
index 085d97e..b4a6019 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedAPI.cs
@@ -1,206 +1,206 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using Key = libsecondlife.LLUUID; 4using Key = libsecondlife.LLUUID;
5using Rotation = libsecondlife.LLQuaternion; 5using Rotation = libsecondlife.LLQuaternion;
6using Vector = libsecondlife.LLVector3; 6using Vector = libsecondlife.LLVector3;
7using LSLList = System.Collections.Generic.List<string>; 7using LSLList = System.Collections.Generic.List<string>;
8 8
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10 10
11namespace OpenSim.Region.Scripting 11namespace OpenSim.Region.Scripting
12{ 12{
13 /// <summary> 13 /// <summary>
14 /// A class inteded to act as an API for LSL-styled interpreted languages 14 /// A class inteded to act as an API for LSL-styled interpreted languages
15 /// </summary> 15 /// </summary>
16 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> 16 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
17 class ScriptInterpretedAPI 17 class ScriptInterpretedAPI
18 { 18 {
19 public int osAbs(int val) 19 public int osAbs(int val)
20 { 20 {
21 return Math.Abs(val); 21 return Math.Abs(val);
22 } 22 }
23 23
24 public float osAcos(float val) 24 public float osAcos(float val)
25 { 25 {
26 return (float)Math.Acos(val); 26 return (float)Math.Acos(val);
27 } 27 }
28 28
29 [Obsolete("Unimplemented")] 29 [Obsolete("Unimplemented")]
30 public void osAddToLandPassList(Key avatar, float hours) 30 public void osAddToLandPassList(Key avatar, float hours)
31 { 31 {
32 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); 32 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
33 return; 33 return;
34 } 34 }
35 35
36 [Obsolete("Unimplemented")] 36 [Obsolete("Unimplemented")]
37 public void osAdjustSoundVolume(float volume) 37 public void osAdjustSoundVolume(float volume)
38 { 38 {
39 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAdjustSoundVolume(float volume)"); 39 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented function called by script: osAdjustSoundVolume(float volume)");
40 return; 40 return;
41 } 41 }
42 42
43 [Obsolete("Unimplemented")] 43 [Obsolete("Unimplemented")]
44 public void osAllowInventoryDrop(int add) 44 public void osAllowInventoryDrop(int add)
45 { 45 {
46 return; 46 return;
47 } 47 }
48 48
49 [Obsolete("Unimplemented")] 49 [Obsolete("Unimplemented")]
50 public float osAngleBetween(Rotation a, Rotation b) 50 public float osAngleBetween(Rotation a, Rotation b)
51 { 51 {
52 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); 52 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z);
53 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); 53 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z);
54 54
55 return 0; 55 return 0;
56 } 56 }
57 57
58 [Obsolete("Unimplemented")] 58 [Obsolete("Unimplemented")]
59 public void osApplyImpulse(Vector force, int local) 59 public void osApplyImpulse(Vector force, int local)
60 { 60 {
61 return; 61 return;
62 } 62 }
63 63
64 [Obsolete("Unimplemented")] 64 [Obsolete("Unimplemented")]
65 public void osApplyRotationalImpulse(Vector force, int local) 65 public void osApplyRotationalImpulse(Vector force, int local)
66 { 66 {
67 return; 67 return;
68 } 68 }
69 69
70 public float osAsin(float val) 70 public float osAsin(float val)
71 { 71 {
72 return (float)Math.Asin(val); 72 return (float)Math.Asin(val);
73 } 73 }
74 74
75 public float osAtan2(float x, float y) 75 public float osAtan2(float x, float y)
76 { 76 {
77 return (float)Math.Atan2(x, y); 77 return (float)Math.Atan2(x, y);
78 } 78 }
79 79
80 [Obsolete("Unimplemented")] 80 [Obsolete("Unimplemented")]
81 public void osAttachToAvatar(Key avatar, int attachmentPoint) 81 public void osAttachToAvatar(Key avatar, int attachmentPoint)
82 { 82 {
83 return; 83 return;
84 } 84 }
85 85
86 [Obsolete("Unimplemented")] 86 [Obsolete("Unimplemented")]
87 public Key osAvatarOnSitTarget() 87 public Key osAvatarOnSitTarget()
88 { 88 {
89 return Key.Zero; 89 return Key.Zero;
90 } 90 }
91 91
92 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) 92 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
93 { 93 {
94 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); 94 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion();
95 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); 95 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z);
96 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); 96 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z);
97 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); 97 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z);
98 98
99 axQ.FromAxes(axFwd, axLeft, axUp); 99 axQ.FromAxes(axFwd, axLeft, axUp);
100 100
101 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); 101 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
102 } 102 }
103 103
104 public Rotation osAxisAngle2Rot(Vector axis, float angle) 104 public Rotation osAxisAngle2Rot(Vector axis, float angle)
105 { 105 {
106 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); 106 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z));
107 107
108 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); 108 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
109 } 109 }
110 110
111 public string osBase64ToString(string str) 111 public string osBase64ToString(string str)
112 { 112 {
113 Encoding enc = System.Text.Encoding.UTF8; 113 Encoding enc = System.Text.Encoding.UTF8;
114 return enc.GetString(Convert.FromBase64String(str)); 114 return enc.GetString(Convert.FromBase64String(str));
115 } 115 }
116 116
117 [Obsolete("Unimplemented")] 117 [Obsolete("Unimplemented")]
118 public void osBreakAllLinks() 118 public void osBreakAllLinks()
119 { 119 {
120 return; 120 return;
121 } 121 }
122 122
123 [Obsolete("Unimplemented")] 123 [Obsolete("Unimplemented")]
124 public void osBreakLink() 124 public void osBreakLink()
125 { 125 {
126 return; 126 return;
127 } 127 }
128 128
129 public LSLList osCSV2List(string src) 129 public LSLList osCSV2List(string src)
130 { 130 {
131 LSLList retVal = new LSLList(); 131 LSLList retVal = new LSLList();
132 retVal.AddRange(src.Split(',')); 132 retVal.AddRange(src.Split(','));
133 133
134 return retVal; 134 return retVal;
135 } 135 }
136 136
137 public int osCeil(float val) 137 public int osCeil(float val)
138 { 138 {
139 return (int)Math.Ceiling(val); 139 return (int)Math.Ceiling(val);
140 } 140 }
141 141
142 [Obsolete("Unimplemented")] 142 [Obsolete("Unimplemented")]
143 public void osCloseRemoteDataChannel(Key channel) 143 public void osCloseRemoteDataChannel(Key channel)
144 { 144 {
145 return; 145 return;
146 } 146 }
147 147
148 [Obsolete("Unimplemented")] 148 [Obsolete("Unimplemented")]
149 public float osCloud(Vector offset) 149 public float osCloud(Vector offset)
150 { 150 {
151 return 0.0f; 151 return 0.0f;
152 } 152 }
153 153
154 [Obsolete("Unimplemented")] 154 [Obsolete("Unimplemented")]
155 public void osCollisionFilter(string name, Key id, int accept) 155 public void osCollisionFilter(string name, Key id, int accept)
156 { 156 {
157 return; 157 return;
158 } 158 }
159 159
160 [Obsolete("Unimplemented")] 160 [Obsolete("Unimplemented")]
161 public void osCollisionSprite(string impact_sprite) 161 public void osCollisionSprite(string impact_sprite)
162 { 162 {
163 return; 163 return;
164 } 164 }
165 165
166 public float osCos(float theta) 166 public float osCos(float theta)
167 { 167 {
168 return (float)Math.Cos(theta); 168 return (float)Math.Cos(theta);
169 } 169 }
170 170
171 [Obsolete("Unimplemented")] 171 [Obsolete("Unimplemented")]
172 public void osCreateLink(Key target, int parent) 172 public void osCreateLink(Key target, int parent)
173 { 173 {
174 return; 174 return;
175 } 175 }
176 176
177 [Obsolete("Partially Unimplemented")] 177 [Obsolete("Partially Unimplemented")]
178 public LSLList osDeleteSubList(LSLList src, int start, int end) 178 public LSLList osDeleteSubList(LSLList src, int start, int end)
179 { 179 {
180 if (start < 0 || end < 0) 180 if (start < 0 || end < 0)
181 { 181 {
182 throw new Exception("Unsupported at this time."); 182 throw new Exception("Unsupported at this time.");
183 } 183 }
184 184
185 src.RemoveRange(start, start - end + 1); 185 src.RemoveRange(start, start - end + 1);
186 return src; 186 return src;
187 } 187 }
188 188
189 [Obsolete("Partially Unimplemented")] 189 [Obsolete("Partially Unimplemented")]
190 public string osDeleteSubString(string src, int start, int end) 190 public string osDeleteSubString(string src, int start, int end)
191 { 191 {
192 if (start < 0 || end < 0) 192 if (start < 0 || end < 0)
193 { 193 {
194 throw new Exception("Unsupported at this time."); 194 throw new Exception("Unsupported at this time.");
195 } 195 }
196 196
197 return src.Remove(start, start - end + 1); 197 return src.Remove(start, start - end + 1);
198 } 198 }
199 199
200 [Obsolete("Unimplemented")] 200 [Obsolete("Unimplemented")]
201 public void osDetachFromAvatar(Key avatar) 201 public void osDetachFromAvatar(Key avatar)
202 { 202 {
203 return; 203 return;
204 } 204 }
205 } 205 }
206} 206}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs
index 7743186..d6456a6 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptInterpretedEvents.cs
@@ -1,16 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Region.Environment.Scenes; 4using OpenSim.Region.Environment.Scenes;
5using libsecondlife; 5using libsecondlife;
6using Key = libsecondlife.LLUUID; 6using Key = libsecondlife.LLUUID;
7 7
8namespace OpenSim.Region.Scripting 8namespace OpenSim.Region.Scripting
9{ 9{
10 10
11 public class ScriptInterpretedEvents 11 public class ScriptInterpretedEvents
12 { 12 {
13 public delegate void OnTouchStartDelegate(Key user); 13 public delegate void OnTouchStartDelegate(Key user);
14 public event OnTouchStartDelegate OnTouchStart; 14 public event OnTouchStartDelegate OnTouchStart;
15 } 15 }
16} 16}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
index 7a08735..27e831b 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptManager.cs
@@ -1,107 +1,107 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31 31
32namespace OpenSim.Region.Scripting 32namespace OpenSim.Region.Scripting
33{ 33{
34 public class ScriptManager 34 public class ScriptManager
35 { 35 {
36 List<IScript> scripts = new List<IScript>(); 36 List<IScript> scripts = new List<IScript>();
37 Scene scene; 37 Scene scene;
38 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 38 Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
39 39
40 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) 40 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
41 { 41 {
42 foreach (KeyValuePair<string, IScript> script in compiledscripts) 42 foreach (KeyValuePair<string, IScript> script in compiledscripts)
43 { 43 {
44 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 44 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
45 MainLog.Instance.Verbose("Loading " + script.Key); 45 MainLog.Instance.Verbose("Loading " + script.Key);
46 script.Value.Initialise(scriptInfo); 46 script.Value.Initialise(scriptInfo);
47 scripts.Add(script.Value); 47 scripts.Add(script.Value);
48 } 48 }
49 MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); 49 MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)");
50 } 50 }
51 51
52 public ScriptManager(Scene world) 52 public ScriptManager(Scene world)
53 { 53 {
54 scene = world; 54 scene = world;
55 55
56 // Default Engines 56 // Default Engines
57 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); 57 CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
58 compilers.Add(csharpCompiler.FileExt(),csharpCompiler); 58 compilers.Add(csharpCompiler.FileExt(),csharpCompiler);
59 59
60 JScriptEngine jscriptCompiler = new JScriptEngine(); 60 JScriptEngine jscriptCompiler = new JScriptEngine();
61 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); 61 compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
62 62
63 JavaEngine javaCompiler = new JavaEngine(); 63 JavaEngine javaCompiler = new JavaEngine();
64 compilers.Add(javaCompiler.FileExt(), javaCompiler); 64 compilers.Add(javaCompiler.FileExt(), javaCompiler);
65 } 65 }
66 66
67 public void Compile(string filename) 67 public void Compile(string filename)
68 { 68 {
69 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) 69 foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
70 { 70 {
71 if (filename.EndsWith(compiler.Key)) 71 if (filename.EndsWith(compiler.Key))
72 { 72 {
73 LoadFromCompiler(compiler.Value.compile(filename)); 73 LoadFromCompiler(compiler.Value.compile(filename));
74 break; 74 break;
75 } 75 }
76 } 76 }
77 } 77 }
78 78
79 public void RunScriptCmd(string[] args) 79 public void RunScriptCmd(string[] args)
80 { 80 {
81 switch (args[0]) 81 switch (args[0])
82 { 82 {
83 case "load": 83 case "load":
84 Compile(args[1]); 84 Compile(args[1]);
85 break; 85 break;
86 86
87 default: 87 default:
88 MainLog.Instance.Error("Unknown script command"); 88 MainLog.Instance.Error("Unknown script command");
89 break; 89 break;
90 } 90 }
91 } 91 }
92 92
93 public void AddPreCompiledScript(IScript script) 93 public void AddPreCompiledScript(IScript script)
94 { 94 {
95 MainLog.Instance.Verbose("Loading script " + script.getName()); 95 MainLog.Instance.Verbose("Loading script " + script.getName());
96 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 96 ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
97 script.Initialise(scriptInfo); 97 script.Initialise(scriptInfo);
98 scripts.Add(script); 98 scripts.Add(script);
99 } 99 }
100 } 100 }
101 101
102 interface IScriptCompiler 102 interface IScriptCompiler
103 { 103 {
104 Dictionary<string,IScript> compile(string filename); 104 Dictionary<string,IScript> compile(string filename);
105 string FileExt(); 105 string FileExt();
106 } 106 }
107} 107}