diff options
author | Tedd Hansen | 2008-01-12 15:52:34 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-01-12 15:52:34 +0000 |
commit | f9c981007db13d86342f5a68168e012b4026c78c (patch) | |
tree | 557e208bc079a02d47857fa59f6dfa40469b0fe4 /OpenSim/Region/ScriptEngine/LSOEngine/LSO | |
parent | Welcome back LSO. (diff) | |
download | opensim-SC-f9c981007db13d86342f5a68168e012b4026c78c.zip opensim-SC-f9c981007db13d86342f5a68168e012b4026c78c.tar.gz opensim-SC-f9c981007db13d86342f5a68168e012b4026c78c.tar.bz2 opensim-SC-f9c981007db13d86342f5a68168e012b4026c78c.tar.xz |
Set eol
Diffstat (limited to 'OpenSim/Region/ScriptEngine/LSOEngine/LSO')
9 files changed, 2758 insertions, 2758 deletions
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Common.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Common.cs index 02f63d2..d1bc21d 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Common.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Common.cs | |||
@@ -1,86 +1,86 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | 30 | ||
31 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 31 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
32 | { | 32 | { |
33 | public static class Common | 33 | public static class Common |
34 | { | 34 | { |
35 | public static bool Debug = true; | 35 | public static bool Debug = true; |
36 | public static bool IL_UseTryCatch = true; | 36 | public static bool IL_UseTryCatch = true; |
37 | public static bool IL_CreateConstructor = true; | 37 | public static bool IL_CreateConstructor = true; |
38 | public static bool IL_CreateFunctionList = true; | 38 | public static bool IL_CreateFunctionList = true; |
39 | public static bool IL_ProcessCodeChunks = true; | 39 | public static bool IL_ProcessCodeChunks = true; |
40 | 40 | ||
41 | public delegate void SendToDebugEventDelegate(string Message); | 41 | public delegate void SendToDebugEventDelegate(string Message); |
42 | 42 | ||
43 | public delegate void SendToLogEventDelegate(string Message); | 43 | public delegate void SendToLogEventDelegate(string Message); |
44 | 44 | ||
45 | public static event SendToDebugEventDelegate SendToDebugEvent; | 45 | public static event SendToDebugEventDelegate SendToDebugEvent; |
46 | public static event SendToLogEventDelegate SendToLogEvent; | 46 | public static event SendToLogEventDelegate SendToLogEvent; |
47 | 47 | ||
48 | public static void SendToDebug(string Message) | 48 | public static void SendToDebug(string Message) |
49 | { | 49 | { |
50 | //if (Debug == true) | 50 | //if (Debug == true) |
51 | Console.WriteLine("COMPILER:Debug: " + Message); | 51 | Console.WriteLine("COMPILER:Debug: " + Message); |
52 | SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 52 | SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
53 | } | 53 | } |
54 | 54 | ||
55 | public static void SendToLog(string Message) | 55 | public static void SendToLog(string Message) |
56 | { | 56 | { |
57 | //if (Debug == true) | 57 | //if (Debug == true) |
58 | Console.WriteLine("COMPILER:LOG: " + Message); | 58 | Console.WriteLine("COMPILER:LOG: " + Message); |
59 | SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 59 | SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | public static class IL_Helper | 63 | public static class IL_Helper |
64 | { | 64 | { |
65 | public static string ReverseFormatString(string text1, string format) | 65 | public static string ReverseFormatString(string text1, string format) |
66 | { | 66 | { |
67 | Common.SendToDebug("ReverseFormatString text1: " + text1); | 67 | Common.SendToDebug("ReverseFormatString text1: " + text1); |
68 | Common.SendToDebug("ReverseFormatString format: " + format); | 68 | Common.SendToDebug("ReverseFormatString format: " + format); |
69 | return string.Format(format, text1); | 69 | return string.Format(format, text1); |
70 | } | 70 | } |
71 | 71 | ||
72 | public static string ReverseFormatString(string text1, UInt32 text2, string format) | 72 | public static string ReverseFormatString(string text1, UInt32 text2, string format) |
73 | { | 73 | { |
74 | Common.SendToDebug("ReverseFormatString text1: " + text1); | 74 | Common.SendToDebug("ReverseFormatString text1: " + text1); |
75 | Common.SendToDebug("ReverseFormatString text2: " + text2.ToString()); | 75 | Common.SendToDebug("ReverseFormatString text2: " + text2.ToString()); |
76 | Common.SendToDebug("ReverseFormatString format: " + format); | 76 | Common.SendToDebug("ReverseFormatString format: " + format); |
77 | return string.Format(format, text1, text2.ToString()); | 77 | return string.Format(format, text1, text2.ToString()); |
78 | } | 78 | } |
79 | 79 | ||
80 | public static string Cast_ToString(object obj) | 80 | public static string Cast_ToString(object obj) |
81 | { | 81 | { |
82 | Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); | 82 | Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); |
83 | return "ABCDEFGIHJKLMNOPQ123"; | 83 | return "ABCDEFGIHJKLMNOPQ123"; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | } \ No newline at end of file | 86 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs index 27acc9c..6dde3e5 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs | |||
@@ -1,293 +1,293 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Reflection.Emit; | 32 | using System.Reflection.Emit; |
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Threading; | 34 | using System.Threading; |
35 | using OpenSim.Region.ScriptEngine.Common; | 35 | using OpenSim.Region.ScriptEngine.Common; |
36 | using OpenSim.Region.ScriptEngine.LSOEngine.LSO; | 36 | using OpenSim.Region.ScriptEngine.LSOEngine.LSO; |
37 | 37 | ||
38 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 38 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
39 | { | 39 | { |
40 | public class Engine | 40 | public class Engine |
41 | { | 41 | { |
42 | //private string LSO_FileName = @"LSO\AdditionTest.lso"; | 42 | //private string LSO_FileName = @"LSO\AdditionTest.lso"; |
43 | private string LSO_FileName; // = @"LSO\CloseToDefault.lso"; | 43 | private string LSO_FileName; // = @"LSO\CloseToDefault.lso"; |
44 | private AppDomain appDomain; | 44 | private AppDomain appDomain; |
45 | 45 | ||
46 | public string Compile(string LSOFileName) | 46 | public string Compile(string LSOFileName) |
47 | { | 47 | { |
48 | LSO_FileName = LSOFileName; | 48 | LSO_FileName = LSOFileName; |
49 | 49 | ||
50 | 50 | ||
51 | //appDomain = AppDomain.CreateDomain("AlternateAppDomain"); | 51 | //appDomain = AppDomain.CreateDomain("AlternateAppDomain"); |
52 | appDomain = Thread.GetDomain(); | 52 | appDomain = Thread.GetDomain(); |
53 | 53 | ||
54 | // Create Assembly Name | 54 | // Create Assembly Name |
55 | AssemblyName asmName = new AssemblyName(); | 55 | AssemblyName asmName = new AssemblyName(); |
56 | asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName); | 56 | asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName); |
57 | //asmName.Name = "TestAssembly"; | 57 | //asmName.Name = "TestAssembly"; |
58 | 58 | ||
59 | string DLL_FileName = asmName.Name + ".dll"; | 59 | string DLL_FileName = asmName.Name + ".dll"; |
60 | string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; | 60 | string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; |
61 | 61 | ||
62 | LSOEngine.LSO.Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName)); | 62 | LSOEngine.LSO.Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName)); |
63 | LSOEngine.LSO.Common.SendToLog("Assembly name: " + asmName.Name); | 63 | LSOEngine.LSO.Common.SendToLog("Assembly name: " + asmName.Name); |
64 | LSOEngine.LSO.Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); | 64 | LSOEngine.LSO.Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); |
65 | LSOEngine.LSO.Common.SendToLog("Starting processing of LSL ByteCode..."); | 65 | LSOEngine.LSO.Common.SendToLog("Starting processing of LSL ByteCode..."); |
66 | LSOEngine.LSO.Common.SendToLog(""); | 66 | LSOEngine.LSO.Common.SendToLog(""); |
67 | 67 | ||
68 | 68 | ||
69 | // Create Assembly | 69 | // Create Assembly |
70 | AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( | 70 | AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( |
71 | asmName, | 71 | asmName, |
72 | AssemblyBuilderAccess.RunAndSave | 72 | AssemblyBuilderAccess.RunAndSave |
73 | ); | 73 | ); |
74 | //// Create Assembly | 74 | //// Create Assembly |
75 | //AssemblyBuilder asmBuilder = | 75 | //AssemblyBuilder asmBuilder = |
76 | // Thread.GetDomain().DefineDynamicAssembly | 76 | // Thread.GetDomain().DefineDynamicAssembly |
77 | //(asmName, AssemblyBuilderAccess.RunAndSave); | 77 | //(asmName, AssemblyBuilderAccess.RunAndSave); |
78 | 78 | ||
79 | // Create a module (and save to disk) | 79 | // Create a module (and save to disk) |
80 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule | 80 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule |
81 | (asmName.Name, | 81 | (asmName.Name, |
82 | DLL_FileName); | 82 | DLL_FileName); |
83 | 83 | ||
84 | //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); | 84 | //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); |
85 | // Create a Class (/Type) | 85 | // Create a Class (/Type) |
86 | TypeBuilder typeBuilder = modBuilder.DefineType( | 86 | TypeBuilder typeBuilder = modBuilder.DefineType( |
87 | "LSL_ScriptObject", | 87 | "LSL_ScriptObject", |
88 | TypeAttributes.Public | TypeAttributes.BeforeFieldInit, | 88 | TypeAttributes.Public | TypeAttributes.BeforeFieldInit, |
89 | typeof (LSL_BaseClass)); | 89 | typeof (LSL_BaseClass)); |
90 | //, | 90 | //, |
91 | // typeof()); | 91 | // typeof()); |
92 | //, typeof(LSL_BuiltIn_Commands_Interface)); | 92 | //, typeof(LSL_BuiltIn_Commands_Interface)); |
93 | //, | 93 | //, |
94 | // typeof(object), | 94 | // typeof(object), |
95 | // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); | 95 | // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); |
96 | 96 | ||
97 | 97 | ||
98 | /* | 98 | /* |
99 | * Generate the IL itself | 99 | * Generate the IL itself |
100 | */ | 100 | */ |
101 | 101 | ||
102 | LSO_Parser LSOP = new LSO_Parser(LSO_FileName, typeBuilder); | 102 | LSO_Parser LSOP = new LSO_Parser(LSO_FileName, typeBuilder); |
103 | LSOP.OpenFile(); | 103 | LSOP.OpenFile(); |
104 | LSOP.Parse(); | 104 | LSOP.Parse(); |
105 | 105 | ||
106 | // Constructor has to be created AFTER LSO_Parser because of accumulated variables | 106 | // Constructor has to be created AFTER LSO_Parser because of accumulated variables |
107 | if (LSOEngine.LSO.Common.IL_CreateConstructor) | 107 | if (LSOEngine.LSO.Common.IL_CreateConstructor) |
108 | IL_CREATE_CONSTRUCTOR(typeBuilder, LSOP); | 108 | IL_CREATE_CONSTRUCTOR(typeBuilder, LSOP); |
109 | 109 | ||
110 | LSOP.CloseFile(); | 110 | LSOP.CloseFile(); |
111 | /* | 111 | /* |
112 | * Done generating. Create a type and run it. | 112 | * Done generating. Create a type and run it. |
113 | */ | 113 | */ |
114 | 114 | ||
115 | 115 | ||
116 | LSOEngine.LSO.Common.SendToLog("Attempting to compile assembly..."); | 116 | LSOEngine.LSO.Common.SendToLog("Attempting to compile assembly..."); |
117 | // Compile it | 117 | // Compile it |
118 | Type type = typeBuilder.CreateType(); | 118 | Type type = typeBuilder.CreateType(); |
119 | LSOEngine.LSO.Common.SendToLog("Compilation successful!"); | 119 | LSOEngine.LSO.Common.SendToLog("Compilation successful!"); |
120 | 120 | ||
121 | LSOEngine.LSO.Common.SendToLog("Saving assembly: " + DLL_FileName); | 121 | LSOEngine.LSO.Common.SendToLog("Saving assembly: " + DLL_FileName); |
122 | asmBuilder.Save(DLL_FileName); | 122 | asmBuilder.Save(DLL_FileName); |
123 | 123 | ||
124 | LSOEngine.LSO.Common.SendToLog("Returning assembly filename: " + DLL_FileName); | 124 | LSOEngine.LSO.Common.SendToLog("Returning assembly filename: " + DLL_FileName); |
125 | 125 | ||
126 | 126 | ||
127 | return DLL_FileName; | 127 | return DLL_FileName; |
128 | 128 | ||
129 | 129 | ||
130 | //Common.SendToLog("Creating an instance of new assembly..."); | 130 | //Common.SendToLog("Creating an instance of new assembly..."); |
131 | //// Create an instance we can play with | 131 | //// Create an instance we can play with |
132 | ////LSLScript hello = (LSLScript)Activator.CreateInstance(type); | 132 | ////LSLScript hello = (LSLScript)Activator.CreateInstance(type); |
133 | ////LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); | 133 | ////LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); |
134 | //object MyScript = (object)Activator.CreateInstance(type); | 134 | //object MyScript = (object)Activator.CreateInstance(type); |
135 | 135 | ||
136 | 136 | ||
137 | //System.Reflection.MemberInfo[] Members = type.GetMembers(); | 137 | //System.Reflection.MemberInfo[] Members = type.GetMembers(); |
138 | 138 | ||
139 | //Common.SendToLog("Members of assembly " + type.ToString() + ":"); | 139 | //Common.SendToLog("Members of assembly " + type.ToString() + ":"); |
140 | //foreach (MemberInfo member in Members) | 140 | //foreach (MemberInfo member in Members) |
141 | // Common.SendToLog(member.ToString()); | 141 | // Common.SendToLog(member.ToString()); |
142 | 142 | ||
143 | 143 | ||
144 | //// Play with it | 144 | //// Play with it |
145 | ////MyScript.event_state_entry("Test"); | 145 | ////MyScript.event_state_entry("Test"); |
146 | //object[] args = { null }; | 146 | //object[] args = { null }; |
147 | ////System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); | 147 | ////System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); |
148 | 148 | ||
149 | //string[] ret = { }; | 149 | //string[] ret = { }; |
150 | //if (Common.IL_CreateFunctionList) | 150 | //if (Common.IL_CreateFunctionList) |
151 | // ret = (string[])type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); | 151 | // ret = (string[])type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); |
152 | 152 | ||
153 | //foreach (string s in ret) | 153 | //foreach (string s in ret) |
154 | //{ | 154 | //{ |
155 | // Common.SendToLog(""); | 155 | // Common.SendToLog(""); |
156 | // Common.SendToLog("*** Executing LSL Server Event: " + s); | 156 | // Common.SendToLog("*** Executing LSL Server Event: " + s); |
157 | // //object test = type.GetMember(s); | 157 | // //object test = type.GetMember(s); |
158 | // //object runner = type.InvokeMember(s, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, MyScript, args); | 158 | // //object runner = type.InvokeMember(s, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, MyScript, args); |
159 | // //runner(); | 159 | // //runner(); |
160 | // //objBooks_Late = type.InvokeMember(s, BindingFlags.CreateInstance, null, objApp_Late, null); | 160 | // //objBooks_Late = type.InvokeMember(s, BindingFlags.CreateInstance, null, objApp_Late, null); |
161 | // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); | 161 | // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); |
162 | 162 | ||
163 | //} | 163 | //} |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) | 167 | private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) |
168 | { | 168 | { |
169 | LSOEngine.LSO.Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); | 169 | LSOEngine.LSO.Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); |
170 | //ConstructorBuilder constructor = typeBuilder.DefineConstructor( | 170 | //ConstructorBuilder constructor = typeBuilder.DefineConstructor( |
171 | // MethodAttributes.Public, | 171 | // MethodAttributes.Public, |
172 | // CallingConventions.Standard, | 172 | // CallingConventions.Standard, |
173 | // new Type[0]); | 173 | // new Type[0]); |
174 | ConstructorBuilder constructor = typeBuilder.DefineConstructor( | 174 | ConstructorBuilder constructor = typeBuilder.DefineConstructor( |
175 | MethodAttributes.Public | | 175 | MethodAttributes.Public | |
176 | MethodAttributes.SpecialName | | 176 | MethodAttributes.SpecialName | |
177 | MethodAttributes.RTSpecialName, | 177 | MethodAttributes.RTSpecialName, |
178 | CallingConventions.Standard, | 178 | CallingConventions.Standard, |
179 | new Type[0]); | 179 | new Type[0]); |
180 | 180 | ||
181 | //Define the reflection ConstructorInfor for System.Object | 181 | //Define the reflection ConstructorInfor for System.Object |
182 | ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]); | 182 | ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]); |
183 | 183 | ||
184 | //call constructor of base object | 184 | //call constructor of base object |
185 | ILGenerator il = constructor.GetILGenerator(); | 185 | ILGenerator il = constructor.GetILGenerator(); |
186 | 186 | ||
187 | il.Emit(OpCodes.Ldarg_0); | 187 | il.Emit(OpCodes.Ldarg_0); |
188 | il.Emit(OpCodes.Call, conObj); | 188 | il.Emit(OpCodes.Call, conObj); |
189 | 189 | ||
190 | 190 | ||
191 | //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: UInt32 State = 0;"); | 191 | //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: UInt32 State = 0;"); |
192 | //string FieldName; | 192 | //string FieldName; |
193 | //// Create state object | 193 | //// Create state object |
194 | //FieldName = "State"; | 194 | //FieldName = "State"; |
195 | //FieldBuilder State_fb = typeBuilder.DefineField( | 195 | //FieldBuilder State_fb = typeBuilder.DefineField( |
196 | // FieldName, | 196 | // FieldName, |
197 | // typeof(UInt32), | 197 | // typeof(UInt32), |
198 | // FieldAttributes.Public); | 198 | // FieldAttributes.Public); |
199 | //il.Emit(OpCodes.Ldarg_0); | 199 | //il.Emit(OpCodes.Ldarg_0); |
200 | //il.Emit(OpCodes.Ldc_I4, 0); | 200 | //il.Emit(OpCodes.Ldc_I4, 0); |
201 | //il.Emit(OpCodes.Stfld, State_fb); | 201 | //il.Emit(OpCodes.Stfld, State_fb); |
202 | 202 | ||
203 | 203 | ||
204 | //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: LSL_BuiltIn_Commands_TestImplementation LSL_BuiltIns = New LSL_BuiltIn_Commands_TestImplementation();"); | 204 | //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: LSL_BuiltIn_Commands_TestImplementation LSL_BuiltIns = New LSL_BuiltIn_Commands_TestImplementation();"); |
205 | ////Type objType1 = typeof(object); | 205 | ////Type objType1 = typeof(object); |
206 | //Type objType1 = typeof(LSL_BuiltIn_Commands_TestImplementation); | 206 | //Type objType1 = typeof(LSL_BuiltIn_Commands_TestImplementation); |
207 | 207 | ||
208 | //FieldName = "LSL_BuiltIns"; | 208 | //FieldName = "LSL_BuiltIns"; |
209 | //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField( | 209 | //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField( |
210 | // FieldName, | 210 | // FieldName, |
211 | // objType1, | 211 | // objType1, |
212 | // FieldAttributes.Public); | 212 | // FieldAttributes.Public); |
213 | 213 | ||
214 | ////LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation(); | 214 | ////LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation(); |
215 | //il.Emit(OpCodes.Ldarg_0); | 215 | //il.Emit(OpCodes.Ldarg_0); |
216 | ////il.Emit(OpCodes.Ldstr, "Test 123"); | 216 | ////il.Emit(OpCodes.Ldstr, "Test 123"); |
217 | //il.Emit(OpCodes.Newobj, objType1.GetConstructor(new Type[] { })); | 217 | //il.Emit(OpCodes.Newobj, objType1.GetConstructor(new Type[] { })); |
218 | //il.Emit(OpCodes.Stfld, LSL_BuiltIns_fb); | 218 | //il.Emit(OpCodes.Stfld, LSL_BuiltIns_fb); |
219 | 219 | ||
220 | foreach (UInt32 pos in LSOP.StaticBlocks.Keys) | 220 | foreach (UInt32 pos in LSOP.StaticBlocks.Keys) |
221 | { | 221 | { |
222 | LSO_Struct.StaticBlock sb; | 222 | LSO_Struct.StaticBlock sb; |
223 | LSOP.StaticBlocks.TryGetValue(pos, out sb); | 223 | LSOP.StaticBlocks.TryGetValue(pos, out sb); |
224 | 224 | ||
225 | if (sb.ObjectType > 0 && sb.ObjectType < 8) | 225 | if (sb.ObjectType > 0 && sb.ObjectType < 8) |
226 | { | 226 | { |
227 | // We don't want void or null's | 227 | // We don't want void or null's |
228 | 228 | ||
229 | il.Emit(OpCodes.Ldarg_0); | 229 | il.Emit(OpCodes.Ldarg_0); |
230 | // Push position to stack | 230 | // Push position to stack |
231 | il.Emit(OpCodes.Ldc_I4, pos); | 231 | il.Emit(OpCodes.Ldc_I4, pos); |
232 | //il.Emit(OpCodes.Box, typeof(UInt32)); | 232 | //il.Emit(OpCodes.Box, typeof(UInt32)); |
233 | 233 | ||
234 | 234 | ||
235 | Type datatype = null; | 235 | Type datatype = null; |
236 | 236 | ||
237 | // Push data to stack | 237 | // Push data to stack |
238 | LSOEngine.LSO.Common.SendToDebug("Adding to static (" + pos + ") type: " + | 238 | LSOEngine.LSO.Common.SendToDebug("Adding to static (" + pos + ") type: " + |
239 | ((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType + | 239 | ((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType + |
240 | ")"); | 240 | ")"); |
241 | switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType) | 241 | switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType) |
242 | { | 242 | { |
243 | case LSO_Enums.Variable_Type_Codes.Float: | 243 | case LSO_Enums.Variable_Type_Codes.Float: |
244 | case LSO_Enums.Variable_Type_Codes.Integer: | 244 | case LSO_Enums.Variable_Type_Codes.Integer: |
245 | //UInt32 | 245 | //UInt32 |
246 | il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); | 246 | il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); |
247 | datatype = typeof (UInt32); | 247 | datatype = typeof (UInt32); |
248 | il.Emit(OpCodes.Box, datatype); | 248 | il.Emit(OpCodes.Box, datatype); |
249 | break; | 249 | break; |
250 | case LSO_Enums.Variable_Type_Codes.String: | 250 | case LSO_Enums.Variable_Type_Codes.String: |
251 | case LSO_Enums.Variable_Type_Codes.Key: | 251 | case LSO_Enums.Variable_Type_Codes.Key: |
252 | //String | 252 | //String |
253 | LSO_Struct.HeapBlock hb = | 253 | LSO_Struct.HeapBlock hb = |
254 | LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); | 254 | LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); |
255 | il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data)); | 255 | il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data)); |
256 | datatype = typeof (string); | 256 | datatype = typeof (string); |
257 | break; | 257 | break; |
258 | case LSO_Enums.Variable_Type_Codes.Vector: | 258 | case LSO_Enums.Variable_Type_Codes.Vector: |
259 | datatype = typeof (LSO_Enums.Vector); | 259 | datatype = typeof (LSO_Enums.Vector); |
260 | //TODO: Not implemented | 260 | //TODO: Not implemented |
261 | break; | 261 | break; |
262 | case LSO_Enums.Variable_Type_Codes.Rotation: | 262 | case LSO_Enums.Variable_Type_Codes.Rotation: |
263 | //Object | 263 | //Object |
264 | //TODO: Not implemented | 264 | //TODO: Not implemented |
265 | datatype = typeof (LSO_Enums.Rotation); | 265 | datatype = typeof (LSO_Enums.Rotation); |
266 | break; | 266 | break; |
267 | default: | 267 | default: |
268 | datatype = typeof (object); | 268 | datatype = typeof (object); |
269 | break; | 269 | break; |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | // Make call | 273 | // Make call |
274 | il.Emit(OpCodes.Call, | 274 | il.Emit(OpCodes.Call, |
275 | typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype})); | 275 | typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype})); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | ////il.Emit(OpCodes.Newobj, typeof(UInt32)); | 280 | ////il.Emit(OpCodes.Newobj, typeof(UInt32)); |
281 | //il.Emit(OpCodes.Starg_0); | 281 | //il.Emit(OpCodes.Starg_0); |
282 | //// Create LSL function library | 282 | //// Create LSL function library |
283 | //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField("LSL_BuiltIns", typeof(LSL_BuiltIn_Commands_Interface), FieldAttributes.Public); | 283 | //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField("LSL_BuiltIns", typeof(LSL_BuiltIn_Commands_Interface), FieldAttributes.Public); |
284 | //il.Emit(OpCodes.Newobj, typeof(LSL_BuiltIn_Commands_Interface)); | 284 | //il.Emit(OpCodes.Newobj, typeof(LSL_BuiltIn_Commands_Interface)); |
285 | //il.Emit(OpCodes.Stloc_1); | 285 | //il.Emit(OpCodes.Stloc_1); |
286 | 286 | ||
287 | il.Emit(OpCodes.Ret); | 287 | il.Emit(OpCodes.Ret); |
288 | } | 288 | } |
289 | 289 | ||
290 | 290 | ||
291 | // End of class | 291 | // End of class |
292 | } | 292 | } |
293 | } \ No newline at end of file | 293 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/IL_common_functions.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/IL_common_functions.cs index 5125c80..9c57bcd 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/IL_common_functions.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/IL_common_functions.cs | |||
@@ -1,51 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Reflection.Emit; | 31 | using System.Reflection.Emit; |
32 | 32 | ||
33 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 33 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
34 | { | 34 | { |
35 | internal partial class LSO_Parser | 35 | internal partial class LSO_Parser |
36 | { | 36 | { |
37 | private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) | 37 | private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) |
38 | { | 38 | { |
39 | TypeBuilder typeBuilder = modBuilder.DefineType(typeName, | 39 | TypeBuilder typeBuilder = modBuilder.DefineType(typeName, |
40 | TypeAttributes.Public | | 40 | TypeAttributes.Public | |
41 | TypeAttributes.Class | | 41 | TypeAttributes.Class | |
42 | TypeAttributes.AutoClass | | 42 | TypeAttributes.AutoClass | |
43 | TypeAttributes.AnsiClass | | 43 | TypeAttributes.AnsiClass | |
44 | TypeAttributes.BeforeFieldInit | | 44 | TypeAttributes.BeforeFieldInit | |
45 | TypeAttributes.AutoLayout, | 45 | TypeAttributes.AutoLayout, |
46 | typeof (object), | 46 | typeof (object), |
47 | new Type[] {typeof (object)}); | 47 | new Type[] {typeof (object)}); |
48 | return typeBuilder; | 48 | return typeBuilder; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | } \ No newline at end of file | 51 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs index 339a99f..54cc5c5 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs | |||
@@ -1,395 +1,395 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | 31 | ||
32 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 32 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
33 | { | 33 | { |
34 | //public partial class LSL_BaseClass | 34 | //public partial class LSL_BaseClass |
35 | //{ | 35 | //{ |
36 | // /* | 36 | // /* |
37 | // * OPCODES | 37 | // * OPCODES |
38 | // * | 38 | // * |
39 | // * These are internal "assembly" commands, | 39 | // * These are internal "assembly" commands, |
40 | // * basic operators like "ADD", "PUSH" and "POP" | 40 | // * basic operators like "ADD", "PUSH" and "POP" |
41 | // * | 41 | // * |
42 | // * It also contains managed stack and keeps track of internal variables, etc. | 42 | // * It also contains managed stack and keeps track of internal variables, etc. |
43 | // * | 43 | // * |
44 | // */ | 44 | // */ |
45 | 45 | ||
46 | 46 | ||
47 | // public void StoreToLocal(UInt32 index) | 47 | // public void StoreToLocal(UInt32 index) |
48 | // { | 48 | // { |
49 | // // TODO: How to determine local? | 49 | // // TODO: How to determine local? |
50 | // LSOEngine.LSO.Common.SendToDebug("::StoreToLocal " + index); | 50 | // LSOEngine.LSO.Common.SendToDebug("::StoreToLocal " + index); |
51 | // if (LocalVariables.ContainsKey(index)) | 51 | // if (LocalVariables.ContainsKey(index)) |
52 | // LocalVariables.Remove(index); | 52 | // LocalVariables.Remove(index); |
53 | // LocalVariables.Add(index, LSLStack.Peek()); | 53 | // LocalVariables.Add(index, LSLStack.Peek()); |
54 | // } | 54 | // } |
55 | 55 | ||
56 | // public void StoreToGlobal(UInt32 index) | 56 | // public void StoreToGlobal(UInt32 index) |
57 | // { | 57 | // { |
58 | // LSOEngine.LSO.Common.SendToDebug("::StoreToGlobal " + index); | 58 | // LSOEngine.LSO.Common.SendToDebug("::StoreToGlobal " + index); |
59 | // if (GlobalVariables.ContainsKey(index)) | 59 | // if (GlobalVariables.ContainsKey(index)) |
60 | // GlobalVariables.Remove(index); | 60 | // GlobalVariables.Remove(index); |
61 | // GlobalVariables.Add(index, LSLStack.Peek()); | 61 | // GlobalVariables.Add(index, LSLStack.Peek()); |
62 | // } | 62 | // } |
63 | 63 | ||
64 | // public void StoreToStatic(UInt32 index) | 64 | // public void StoreToStatic(UInt32 index) |
65 | // { | 65 | // { |
66 | // LSOEngine.LSO.Common.SendToDebug("::StoreToStatic " + index); | 66 | // LSOEngine.LSO.Common.SendToDebug("::StoreToStatic " + index); |
67 | // //if (StaticVariables.ContainsKey(index)) | 67 | // //if (StaticVariables.ContainsKey(index)) |
68 | // // StaticVariables.Remove(index); | 68 | // // StaticVariables.Remove(index); |
69 | // StaticVariables.Add(index, LSLStack.Peek()); | 69 | // StaticVariables.Add(index, LSLStack.Peek()); |
70 | // } | 70 | // } |
71 | 71 | ||
72 | // public void GetFromLocal(UInt32 index) | 72 | // public void GetFromLocal(UInt32 index) |
73 | // { | 73 | // { |
74 | // // TODO: How to determine local? | 74 | // // TODO: How to determine local? |
75 | // LSOEngine.LSO.Common.SendToDebug("::GetFromLocal " + index); | 75 | // LSOEngine.LSO.Common.SendToDebug("::GetFromLocal " + index); |
76 | // object ret; | 76 | // object ret; |
77 | // LocalVariables.TryGetValue(index, out ret); | 77 | // LocalVariables.TryGetValue(index, out ret); |
78 | // LSLStack.Push(ret); | 78 | // LSLStack.Push(ret); |
79 | // //return ret; | 79 | // //return ret; |
80 | // } | 80 | // } |
81 | 81 | ||
82 | // public void GetFromGlobal(UInt32 index) | 82 | // public void GetFromGlobal(UInt32 index) |
83 | // { | 83 | // { |
84 | // LSOEngine.LSO.Common.SendToDebug("::GetFromGlobal " + index); | 84 | // LSOEngine.LSO.Common.SendToDebug("::GetFromGlobal " + index); |
85 | // object ret; | 85 | // object ret; |
86 | // GlobalVariables.TryGetValue(index, out ret); | 86 | // GlobalVariables.TryGetValue(index, out ret); |
87 | // LSLStack.Push(ret); | 87 | // LSLStack.Push(ret); |
88 | // //return ret; | 88 | // //return ret; |
89 | // } | 89 | // } |
90 | 90 | ||
91 | // public void GetFromStatic(UInt32 index) | 91 | // public void GetFromStatic(UInt32 index) |
92 | // { | 92 | // { |
93 | // LSOEngine.LSO.Common.SendToDebug("::GetFromStatic " + index); | 93 | // LSOEngine.LSO.Common.SendToDebug("::GetFromStatic " + index); |
94 | // object ret; | 94 | // object ret; |
95 | // StaticVariables.TryGetValue(index, out ret); | 95 | // StaticVariables.TryGetValue(index, out ret); |
96 | // LSOEngine.LSO.Common.SendToDebug("::GetFromStatic - ObjectType: " + ret.GetType().ToString()); | 96 | // LSOEngine.LSO.Common.SendToDebug("::GetFromStatic - ObjectType: " + ret.GetType().ToString()); |
97 | // LSLStack.Push(ret); | 97 | // LSLStack.Push(ret); |
98 | // //return ret; | 98 | // //return ret; |
99 | // } | 99 | // } |
100 | 100 | ||
101 | // public object POPToStack() | 101 | // public object POPToStack() |
102 | // { | 102 | // { |
103 | // LSOEngine.LSO.Common.SendToDebug("::POPToStack"); | 103 | // LSOEngine.LSO.Common.SendToDebug("::POPToStack"); |
104 | // //return LSLStack.Pop(); | 104 | // //return LSLStack.Pop(); |
105 | // object p = LSLStack.Pop(); | 105 | // object p = LSLStack.Pop(); |
106 | // if (p.GetType() == typeof (UInt32)) | 106 | // if (p.GetType() == typeof (UInt32)) |
107 | // return (UInt32) p; | 107 | // return (UInt32) p; |
108 | // if (p.GetType() == typeof (string)) | 108 | // if (p.GetType() == typeof (string)) |
109 | // return (string) p; | 109 | // return (string) p; |
110 | // if (p.GetType() == typeof (Int32)) | 110 | // if (p.GetType() == typeof (Int32)) |
111 | // return (Int32) p; | 111 | // return (Int32) p; |
112 | // if (p.GetType() == typeof (UInt16)) | 112 | // if (p.GetType() == typeof (UInt16)) |
113 | // return (UInt16) p; | 113 | // return (UInt16) p; |
114 | // if (p.GetType() == typeof (float)) | 114 | // if (p.GetType() == typeof (float)) |
115 | // return (float) p; | 115 | // return (float) p; |
116 | // if (p.GetType() == typeof (LSO_Enums.Vector)) | 116 | // if (p.GetType() == typeof (LSO_Enums.Vector)) |
117 | // return (LSO_Enums.Vector) p; | 117 | // return (LSO_Enums.Vector) p; |
118 | // if (p.GetType() == typeof (LSO_Enums.Rotation)) | 118 | // if (p.GetType() == typeof (LSO_Enums.Rotation)) |
119 | // return (LSO_Enums.Rotation) p; | 119 | // return (LSO_Enums.Rotation) p; |
120 | // if (p.GetType() == typeof (LSO_Enums.Key)) | 120 | // if (p.GetType() == typeof (LSO_Enums.Key)) |
121 | // return (LSO_Enums.Key) p; | 121 | // return (LSO_Enums.Key) p; |
122 | 122 | ||
123 | // return p; | 123 | // return p; |
124 | // } | 124 | // } |
125 | 125 | ||
126 | // //public object POPToStack(UInt32 count) | 126 | // //public object POPToStack(UInt32 count) |
127 | // //{ | 127 | // //{ |
128 | // // // POP NUMBER FROM TOP OF STACK | 128 | // // // POP NUMBER FROM TOP OF STACK |
129 | // // //LSLStack.SetLength(LSLStack.Length - 4); | 129 | // // //LSLStack.SetLength(LSLStack.Length - 4); |
130 | // // Common.SendToDebug("::POPToStack " + count); | 130 | // // Common.SendToDebug("::POPToStack " + count); |
131 | // // if (count < 2) | 131 | // // if (count < 2) |
132 | // // return LSLStack.Pop(); | 132 | // // return LSLStack.Pop(); |
133 | 133 | ||
134 | // // Stack<object> s = new Stack<object>(); | 134 | // // Stack<object> s = new Stack<object>(); |
135 | // // for (int i = 0; i < count; i++) | 135 | // // for (int i = 0; i < count; i++) |
136 | // // { | 136 | // // { |
137 | // // s.Push(LSLStack.Pop); | 137 | // // s.Push(LSLStack.Pop); |
138 | 138 | ||
139 | // // } | 139 | // // } |
140 | 140 | ||
141 | // //} | 141 | // //} |
142 | 142 | ||
143 | // public void POP() | 143 | // public void POP() |
144 | // { | 144 | // { |
145 | // // POP NUMBER FROM TOP OF STACK | 145 | // // POP NUMBER FROM TOP OF STACK |
146 | // //LSLStack.SetLength(LSLStack.Length - 4); | 146 | // //LSLStack.SetLength(LSLStack.Length - 4); |
147 | // LSOEngine.LSO.Common.SendToDebug("::POP"); | 147 | // LSOEngine.LSO.Common.SendToDebug("::POP"); |
148 | // if (LSLStack.Count < 1) | 148 | // if (LSLStack.Count < 1) |
149 | // { | 149 | // { |
150 | // //TODO: Temporary fix | 150 | // //TODO: Temporary fix |
151 | // LSOEngine.LSO.Common.SendToDebug("ERROR: TRYING TO POP EMPTY STACK!"); | 151 | // LSOEngine.LSO.Common.SendToDebug("ERROR: TRYING TO POP EMPTY STACK!"); |
152 | // } | 152 | // } |
153 | // else | 153 | // else |
154 | // { | 154 | // { |
155 | // LSLStack.Pop(); | 155 | // LSLStack.Pop(); |
156 | // } | 156 | // } |
157 | // } | 157 | // } |
158 | 158 | ||
159 | // public void PUSH(object Param) | 159 | // public void PUSH(object Param) |
160 | // { | 160 | // { |
161 | // if (Param == null) | 161 | // if (Param == null) |
162 | // { | 162 | // { |
163 | // LSOEngine.LSO.Common.SendToDebug("::PUSH: <null>"); | 163 | // LSOEngine.LSO.Common.SendToDebug("::PUSH: <null>"); |
164 | // } | 164 | // } |
165 | // else | 165 | // else |
166 | // { | 166 | // { |
167 | // //Common.SendToDebug("::PUSH: " + Param.GetType()); | 167 | // //Common.SendToDebug("::PUSH: " + Param.GetType()); |
168 | // } | 168 | // } |
169 | 169 | ||
170 | // LSLStack.Push(Param); | 170 | // LSLStack.Push(Param); |
171 | // } | 171 | // } |
172 | 172 | ||
173 | // public void ADD(UInt32 Param) | 173 | // public void ADD(UInt32 Param) |
174 | // { | 174 | // { |
175 | // LSOEngine.LSO.Common.SendToDebug("::ADD: " + Param); | 175 | // LSOEngine.LSO.Common.SendToDebug("::ADD: " + Param); |
176 | // object o2 = LSLStack.Pop(); | 176 | // object o2 = LSLStack.Pop(); |
177 | // object o1 = LSLStack.Pop(); | 177 | // object o1 = LSLStack.Pop(); |
178 | // LSOEngine.LSO.Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + | 178 | // LSOEngine.LSO.Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + |
179 | // " (" + o2.ToString() + ")"); | 179 | // " (" + o2.ToString() + ")"); |
180 | // if (o2.GetType() == typeof (string)) | 180 | // if (o2.GetType() == typeof (string)) |
181 | // { | 181 | // { |
182 | // LSLStack.Push((string) o1 + (string) o2); | 182 | // LSLStack.Push((string) o1 + (string) o2); |
183 | // return; | 183 | // return; |
184 | // } | 184 | // } |
185 | // if (o2.GetType() == typeof (UInt32)) | 185 | // if (o2.GetType() == typeof (UInt32)) |
186 | // { | 186 | // { |
187 | // LSLStack.Push((UInt32) o1 + (UInt32) o2); | 187 | // LSLStack.Push((UInt32) o1 + (UInt32) o2); |
188 | // return; | 188 | // return; |
189 | // } | 189 | // } |
190 | // } | 190 | // } |
191 | 191 | ||
192 | // public void SUB(UInt32 Param) | 192 | // public void SUB(UInt32 Param) |
193 | // { | 193 | // { |
194 | // LSOEngine.LSO.Common.SendToDebug("::SUB: " + Param); | 194 | // LSOEngine.LSO.Common.SendToDebug("::SUB: " + Param); |
195 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 195 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
196 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 196 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
197 | // LSLStack.Push((UInt32) (i1 - i2)); | 197 | // LSLStack.Push((UInt32) (i1 - i2)); |
198 | // } | 198 | // } |
199 | 199 | ||
200 | // public void MUL(UInt32 Param) | 200 | // public void MUL(UInt32 Param) |
201 | // { | 201 | // { |
202 | // LSOEngine.LSO.Common.SendToDebug("::SUB: " + Param); | 202 | // LSOEngine.LSO.Common.SendToDebug("::SUB: " + Param); |
203 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 203 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
204 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 204 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
205 | // LSLStack.Push((UInt32) (i1*i2)); | 205 | // LSLStack.Push((UInt32) (i1*i2)); |
206 | // } | 206 | // } |
207 | 207 | ||
208 | // public void DIV(UInt32 Param) | 208 | // public void DIV(UInt32 Param) |
209 | // { | 209 | // { |
210 | // LSOEngine.LSO.Common.SendToDebug("::DIV: " + Param); | 210 | // LSOEngine.LSO.Common.SendToDebug("::DIV: " + Param); |
211 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 211 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
212 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 212 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
213 | // LSLStack.Push((UInt32) (i1/i2)); | 213 | // LSLStack.Push((UInt32) (i1/i2)); |
214 | // } | 214 | // } |
215 | 215 | ||
216 | 216 | ||
217 | // public void MOD(UInt32 Param) | 217 | // public void MOD(UInt32 Param) |
218 | // { | 218 | // { |
219 | // LSOEngine.LSO.Common.SendToDebug("::MOD: " + Param); | 219 | // LSOEngine.LSO.Common.SendToDebug("::MOD: " + Param); |
220 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 220 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
221 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 221 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
222 | // LSLStack.Push((UInt32) (i1%i2)); | 222 | // LSLStack.Push((UInt32) (i1%i2)); |
223 | // } | 223 | // } |
224 | 224 | ||
225 | // public void EQ(UInt32 Param) | 225 | // public void EQ(UInt32 Param) |
226 | // { | 226 | // { |
227 | // LSOEngine.LSO.Common.SendToDebug("::EQ: " + Param); | 227 | // LSOEngine.LSO.Common.SendToDebug("::EQ: " + Param); |
228 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 228 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
229 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 229 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
230 | // if (i1 == i2) | 230 | // if (i1 == i2) |
231 | // { | 231 | // { |
232 | // LSLStack.Push((UInt32) 1); | 232 | // LSLStack.Push((UInt32) 1); |
233 | // } | 233 | // } |
234 | // else | 234 | // else |
235 | // { | 235 | // { |
236 | // LSLStack.Push((UInt32) 0); | 236 | // LSLStack.Push((UInt32) 0); |
237 | // } | 237 | // } |
238 | // } | 238 | // } |
239 | 239 | ||
240 | // public void NEQ(UInt32 Param) | 240 | // public void NEQ(UInt32 Param) |
241 | // { | 241 | // { |
242 | // LSOEngine.LSO.Common.SendToDebug("::NEQ: " + Param); | 242 | // LSOEngine.LSO.Common.SendToDebug("::NEQ: " + Param); |
243 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 243 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
244 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 244 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
245 | // if (i1 != i2) | 245 | // if (i1 != i2) |
246 | // { | 246 | // { |
247 | // LSLStack.Push((UInt32) 1); | 247 | // LSLStack.Push((UInt32) 1); |
248 | // } | 248 | // } |
249 | // else | 249 | // else |
250 | // { | 250 | // { |
251 | // LSLStack.Push((UInt32) 0); | 251 | // LSLStack.Push((UInt32) 0); |
252 | // } | 252 | // } |
253 | // } | 253 | // } |
254 | 254 | ||
255 | // public void LEQ(UInt32 Param) | 255 | // public void LEQ(UInt32 Param) |
256 | // { | 256 | // { |
257 | // LSOEngine.LSO.Common.SendToDebug("::LEQ: " + Param); | 257 | // LSOEngine.LSO.Common.SendToDebug("::LEQ: " + Param); |
258 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 258 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
259 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 259 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
260 | // if (i1 <= i2) | 260 | // if (i1 <= i2) |
261 | // { | 261 | // { |
262 | // LSLStack.Push((UInt32) 1); | 262 | // LSLStack.Push((UInt32) 1); |
263 | // } | 263 | // } |
264 | // else | 264 | // else |
265 | // { | 265 | // { |
266 | // LSLStack.Push((UInt32) 0); | 266 | // LSLStack.Push((UInt32) 0); |
267 | // } | 267 | // } |
268 | // } | 268 | // } |
269 | 269 | ||
270 | // public void GEQ(UInt32 Param) | 270 | // public void GEQ(UInt32 Param) |
271 | // { | 271 | // { |
272 | // LSOEngine.LSO.Common.SendToDebug("::GEQ: " + Param); | 272 | // LSOEngine.LSO.Common.SendToDebug("::GEQ: " + Param); |
273 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 273 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
274 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 274 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
275 | // if (i1 >= i2) | 275 | // if (i1 >= i2) |
276 | // { | 276 | // { |
277 | // LSLStack.Push((UInt32) 1); | 277 | // LSLStack.Push((UInt32) 1); |
278 | // } | 278 | // } |
279 | // else | 279 | // else |
280 | // { | 280 | // { |
281 | // LSLStack.Push((UInt32) 0); | 281 | // LSLStack.Push((UInt32) 0); |
282 | // } | 282 | // } |
283 | // } | 283 | // } |
284 | 284 | ||
285 | // public void LESS(UInt32 Param) | 285 | // public void LESS(UInt32 Param) |
286 | // { | 286 | // { |
287 | // LSOEngine.LSO.Common.SendToDebug("::LESS: " + Param); | 287 | // LSOEngine.LSO.Common.SendToDebug("::LESS: " + Param); |
288 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 288 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
289 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 289 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
290 | // if (i1 < i2) | 290 | // if (i1 < i2) |
291 | // { | 291 | // { |
292 | // LSLStack.Push((UInt32) 1); | 292 | // LSLStack.Push((UInt32) 1); |
293 | // } | 293 | // } |
294 | // else | 294 | // else |
295 | // { | 295 | // { |
296 | // LSLStack.Push((UInt32) 0); | 296 | // LSLStack.Push((UInt32) 0); |
297 | // } | 297 | // } |
298 | // } | 298 | // } |
299 | 299 | ||
300 | // public void GREATER(UInt32 Param) | 300 | // public void GREATER(UInt32 Param) |
301 | // { | 301 | // { |
302 | // LSOEngine.LSO.Common.SendToDebug("::GREATER: " + Param); | 302 | // LSOEngine.LSO.Common.SendToDebug("::GREATER: " + Param); |
303 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 303 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
304 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 304 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
305 | // if (i1 > i2) | 305 | // if (i1 > i2) |
306 | // { | 306 | // { |
307 | // LSLStack.Push((UInt32) 1); | 307 | // LSLStack.Push((UInt32) 1); |
308 | // } | 308 | // } |
309 | // else | 309 | // else |
310 | // { | 310 | // { |
311 | // LSLStack.Push((UInt32) 0); | 311 | // LSLStack.Push((UInt32) 0); |
312 | // } | 312 | // } |
313 | // } | 313 | // } |
314 | 314 | ||
315 | 315 | ||
316 | // public void BITAND() | 316 | // public void BITAND() |
317 | // { | 317 | // { |
318 | // LSOEngine.LSO.Common.SendToDebug("::BITAND"); | 318 | // LSOEngine.LSO.Common.SendToDebug("::BITAND"); |
319 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 319 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
320 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 320 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
321 | // LSLStack.Push((UInt32) (i1 & i2)); | 321 | // LSLStack.Push((UInt32) (i1 & i2)); |
322 | // } | 322 | // } |
323 | 323 | ||
324 | // public void BITOR() | 324 | // public void BITOR() |
325 | // { | 325 | // { |
326 | // LSOEngine.LSO.Common.SendToDebug("::BITOR"); | 326 | // LSOEngine.LSO.Common.SendToDebug("::BITOR"); |
327 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 327 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
328 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 328 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
329 | // LSLStack.Push((UInt32) (i1 | i2)); | 329 | // LSLStack.Push((UInt32) (i1 | i2)); |
330 | // } | 330 | // } |
331 | 331 | ||
332 | // public void BITXOR() | 332 | // public void BITXOR() |
333 | // { | 333 | // { |
334 | // LSOEngine.LSO.Common.SendToDebug("::BITXOR"); | 334 | // LSOEngine.LSO.Common.SendToDebug("::BITXOR"); |
335 | // UInt32 i2 = (UInt32) LSLStack.Pop(); | 335 | // UInt32 i2 = (UInt32) LSLStack.Pop(); |
336 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 336 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
337 | // LSLStack.Push((UInt32) (i1 ^ i2)); | 337 | // LSLStack.Push((UInt32) (i1 ^ i2)); |
338 | // } | 338 | // } |
339 | 339 | ||
340 | // public void BOOLAND() | 340 | // public void BOOLAND() |
341 | // { | 341 | // { |
342 | // LSOEngine.LSO.Common.SendToDebug("::BOOLAND"); | 342 | // LSOEngine.LSO.Common.SendToDebug("::BOOLAND"); |
343 | // bool b2 = bool.Parse((string) LSLStack.Pop()); | 343 | // bool b2 = bool.Parse((string) LSLStack.Pop()); |
344 | // bool b1 = bool.Parse((string) LSLStack.Pop()); | 344 | // bool b1 = bool.Parse((string) LSLStack.Pop()); |
345 | // if (b1 && b2) | 345 | // if (b1 && b2) |
346 | // { | 346 | // { |
347 | // LSLStack.Push((UInt32) 1); | 347 | // LSLStack.Push((UInt32) 1); |
348 | // } | 348 | // } |
349 | // else | 349 | // else |
350 | // { | 350 | // { |
351 | // LSLStack.Push((UInt32) 0); | 351 | // LSLStack.Push((UInt32) 0); |
352 | // } | 352 | // } |
353 | // } | 353 | // } |
354 | 354 | ||
355 | // public void BOOLOR() | 355 | // public void BOOLOR() |
356 | // { | 356 | // { |
357 | // LSOEngine.LSO.Common.SendToDebug("::BOOLOR"); | 357 | // LSOEngine.LSO.Common.SendToDebug("::BOOLOR"); |
358 | // bool b2 = bool.Parse((string) LSLStack.Pop()); | 358 | // bool b2 = bool.Parse((string) LSLStack.Pop()); |
359 | // bool b1 = bool.Parse((string) LSLStack.Pop()); | 359 | // bool b1 = bool.Parse((string) LSLStack.Pop()); |
360 | 360 | ||
361 | // if (b1 || b2) | 361 | // if (b1 || b2) |
362 | // { | 362 | // { |
363 | // LSLStack.Push((UInt32) 1); | 363 | // LSLStack.Push((UInt32) 1); |
364 | // } | 364 | // } |
365 | // else | 365 | // else |
366 | // { | 366 | // { |
367 | // LSLStack.Push((UInt32) 0); | 367 | // LSLStack.Push((UInt32) 0); |
368 | // } | 368 | // } |
369 | // } | 369 | // } |
370 | 370 | ||
371 | // public void NEG(UInt32 Param) | 371 | // public void NEG(UInt32 Param) |
372 | // { | 372 | // { |
373 | // LSOEngine.LSO.Common.SendToDebug("::NEG: " + Param); | 373 | // LSOEngine.LSO.Common.SendToDebug("::NEG: " + Param); |
374 | // //UInt32 i2 = (UInt32)LSLStack.Pop(); | 374 | // //UInt32 i2 = (UInt32)LSLStack.Pop(); |
375 | // UInt32 i1 = (UInt32) LSLStack.Pop(); | 375 | // UInt32 i1 = (UInt32) LSLStack.Pop(); |
376 | // LSLStack.Push((UInt32) (i1*-1)); | 376 | // LSLStack.Push((UInt32) (i1*-1)); |
377 | // } | 377 | // } |
378 | 378 | ||
379 | // public void BITNOT() | 379 | // public void BITNOT() |
380 | // { | 380 | // { |
381 | // //Common.SendToDebug("::BITNOT"); | 381 | // //Common.SendToDebug("::BITNOT"); |
382 | // //UInt32 i2 = (UInt32)LSLStack.Pop(); | 382 | // //UInt32 i2 = (UInt32)LSLStack.Pop(); |
383 | // //UInt32 i1 = (UInt32)LSLStack.Pop(); | 383 | // //UInt32 i1 = (UInt32)LSLStack.Pop(); |
384 | // //LSLStack.Push((UInt32)(i1 / i2)); | 384 | // //LSLStack.Push((UInt32)(i1 / i2)); |
385 | // } | 385 | // } |
386 | 386 | ||
387 | // public void BOOLNOT() | 387 | // public void BOOLNOT() |
388 | // { | 388 | // { |
389 | // //Common.SendToDebug("::BOOLNOT"); | 389 | // //Common.SendToDebug("::BOOLNOT"); |
390 | // ////UInt32 i2 = (UInt32)LSLStack.Pop(); | 390 | // ////UInt32 i2 = (UInt32)LSLStack.Pop(); |
391 | // //UInt32 i1 = (UInt32)LSLStack.Pop(); | 391 | // //UInt32 i1 = (UInt32)LSLStack.Pop(); |
392 | // //LSLStack.Push((UInt32)(i1)); | 392 | // //LSLStack.Push((UInt32)(i1)); |
393 | // } | 393 | // } |
394 | //} | 394 | //} |
395 | } \ No newline at end of file | 395 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_CLRInterface.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_CLRInterface.cs index 8454266..8bb7712 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_CLRInterface.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_CLRInterface.cs | |||
@@ -1,75 +1,75 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 29 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
30 | { | 30 | { |
31 | public class LSL_CLRInterface | 31 | public class LSL_CLRInterface |
32 | { | 32 | { |
33 | public interface LSLScript | 33 | public interface LSLScript |
34 | { | 34 | { |
35 | //public virtual void Run(object arg) | 35 | //public virtual void Run(object arg) |
36 | //{ | 36 | //{ |
37 | //} | 37 | //} |
38 | //void Run(object arg); | 38 | //void Run(object arg); |
39 | 39 | ||
40 | //void event_state_entry(object arg); | 40 | //void event_state_entry(object arg); |
41 | //void event_state_exit(); | 41 | //void event_state_exit(); |
42 | //void event_touch_start(object arg); | 42 | //void event_touch_start(object arg); |
43 | //void event_touch(); | 43 | //void event_touch(); |
44 | //void event_touch_end(); | 44 | //void event_touch_end(); |
45 | //void event_collision_start(); | 45 | //void event_collision_start(); |
46 | //void event_collision(); | 46 | //void event_collision(); |
47 | //void event_collision_end(); | 47 | //void event_collision_end(); |
48 | //void event_land_collision_start(); | 48 | //void event_land_collision_start(); |
49 | //void event_land_collision(); | 49 | //void event_land_collision(); |
50 | //void event_land_collision_end(); | 50 | //void event_land_collision_end(); |
51 | //void event_timer(); | 51 | //void event_timer(); |
52 | //void event_listen(); | 52 | //void event_listen(); |
53 | //void event_on_rez(); | 53 | //void event_on_rez(); |
54 | //void event_sensor(); | 54 | //void event_sensor(); |
55 | //void event_no_sensor(); | 55 | //void event_no_sensor(); |
56 | //void event_control(); | 56 | //void event_control(); |
57 | //void event_money(); | 57 | //void event_money(); |
58 | //void event_email(); | 58 | //void event_email(); |
59 | //void event_at_target(); | 59 | //void event_at_target(); |
60 | //void event_not_at_target(); | 60 | //void event_not_at_target(); |
61 | //void event_at_rot_target(); | 61 | //void event_at_rot_target(); |
62 | //void event_not_at_rot_target(); | 62 | //void event_not_at_rot_target(); |
63 | //void event_run_time_permissions(); | 63 | //void event_run_time_permissions(); |
64 | //void event_changed(); | 64 | //void event_changed(); |
65 | //void event_attach(); | 65 | //void event_attach(); |
66 | //void event_dataserver(); | 66 | //void event_dataserver(); |
67 | //void event_link_message(); | 67 | //void event_link_message(); |
68 | //void event_moving_start(); | 68 | //void event_moving_start(); |
69 | //void event_moving_end(); | 69 | //void event_moving_end(); |
70 | //void event_object_rez(); | 70 | //void event_object_rez(); |
71 | //void event_remote_data(); | 71 | //void event_remote_data(); |
72 | //void event_http_response(); | 72 | //void event_http_response(); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | } \ No newline at end of file | 75 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_OPCODE_IL_processor.cs index 68ecdca..30d3890 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_OPCODE_IL_processor.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_OPCODE_IL_processor.cs | |||
@@ -1,435 +1,435 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Reflection.Emit; | 31 | using System.Reflection.Emit; |
32 | using OpenSim.Region.ScriptEngine.Common; | 32 | using OpenSim.Region.ScriptEngine.Common; |
33 | 33 | ||
34 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 34 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
35 | { | 35 | { |
36 | internal partial class LSO_Parser | 36 | internal partial class LSO_Parser |
37 | { | 37 | { |
38 | //internal Stack<Type> ILStack = new Stack<Type>(); | 38 | //internal Stack<Type> ILStack = new Stack<Type>(); |
39 | //LSO_Enums MyLSO_Enums = new LSO_Enums(); | 39 | //LSO_Enums MyLSO_Enums = new LSO_Enums(); |
40 | 40 | ||
41 | internal bool LSL_PROCESS_OPCODE(ILGenerator il) | 41 | internal bool LSL_PROCESS_OPCODE(ILGenerator il) |
42 | { | 42 | { |
43 | byte bp1; | 43 | byte bp1; |
44 | UInt32 u32p1; | 44 | UInt32 u32p1; |
45 | float fp1; | 45 | float fp1; |
46 | UInt16 opcode = br_read(1)[0]; | 46 | UInt16 opcode = br_read(1)[0]; |
47 | Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString()); | 47 | Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString()); |
48 | string idesc = ((LSO_Enums.Operation_Table) opcode).ToString(); | 48 | string idesc = ((LSO_Enums.Operation_Table) opcode).ToString(); |
49 | switch ((LSO_Enums.Operation_Table) opcode) | 49 | switch ((LSO_Enums.Operation_Table) opcode) |
50 | { | 50 | { |
51 | /*************** | 51 | /*************** |
52 | * IMPLEMENTED * | 52 | * IMPLEMENTED * |
53 | ***************/ | 53 | ***************/ |
54 | case LSO_Enums.Operation_Table.NOOP: | 54 | case LSO_Enums.Operation_Table.NOOP: |
55 | break; | 55 | break; |
56 | case LSO_Enums.Operation_Table.PUSHSP: | 56 | case LSO_Enums.Operation_Table.PUSHSP: |
57 | // Push Stack Top (Memory Address) to stack | 57 | // Push Stack Top (Memory Address) to stack |
58 | Common.SendToDebug("Instruction " + idesc); | 58 | Common.SendToDebug("Instruction " + idesc); |
59 | Common.SendToDebug("Instruction " + idesc + | 59 | Common.SendToDebug("Instruction " + idesc + |
60 | ": Description: Pushing Stack Top (Memory Address from header) to stack"); | 60 | ": Description: Pushing Stack Top (Memory Address from header) to stack"); |
61 | IL_Push(il, (UInt32) myHeader.SP); | 61 | IL_Push(il, (UInt32) myHeader.SP); |
62 | break; | 62 | break; |
63 | // BYTE | 63 | // BYTE |
64 | case LSO_Enums.Operation_Table.PUSHARGB: | 64 | case LSO_Enums.Operation_Table.PUSHARGB: |
65 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 65 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
66 | break; | 66 | break; |
67 | // INTEGER | 67 | // INTEGER |
68 | case LSO_Enums.Operation_Table.PUSHARGI: | 68 | case LSO_Enums.Operation_Table.PUSHARGI: |
69 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 69 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
70 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); | 70 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); |
71 | IL_Push(il, u32p1); | 71 | IL_Push(il, u32p1); |
72 | break; | 72 | break; |
73 | // FLOAT | 73 | // FLOAT |
74 | case LSO_Enums.Operation_Table.PUSHARGF: | 74 | case LSO_Enums.Operation_Table.PUSHARGF: |
75 | fp1 = BitConverter.ToUInt32(br_read(4), 0); | 75 | fp1 = BitConverter.ToUInt32(br_read(4), 0); |
76 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); | 76 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); |
77 | IL_Push(il, fp1); | 77 | IL_Push(il, fp1); |
78 | break; | 78 | break; |
79 | // STRING | 79 | // STRING |
80 | case LSO_Enums.Operation_Table.PUSHARGS: | 80 | case LSO_Enums.Operation_Table.PUSHARGS: |
81 | string s = Read_String(); | 81 | string s = Read_String(); |
82 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); | 82 | Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); |
83 | IL_Debug(il, "OPCODE: " + idesc + ":" + s); | 83 | IL_Debug(il, "OPCODE: " + idesc + ":" + s); |
84 | IL_Push(il, s); | 84 | IL_Push(il, s); |
85 | break; | 85 | break; |
86 | // VECTOR z,y,x | 86 | // VECTOR z,y,x |
87 | case LSO_Enums.Operation_Table.PUSHARGV: | 87 | case LSO_Enums.Operation_Table.PUSHARGV: |
88 | LSO_Enums.Vector v = new LSO_Enums.Vector(); | 88 | LSO_Enums.Vector v = new LSO_Enums.Vector(); |
89 | v.Z = BitConverter.ToUInt32(br_read(4), 0); | 89 | v.Z = BitConverter.ToUInt32(br_read(4), 0); |
90 | v.Y = BitConverter.ToUInt32(br_read(4), 0); | 90 | v.Y = BitConverter.ToUInt32(br_read(4), 0); |
91 | v.X = BitConverter.ToUInt32(br_read(4), 0); | 91 | v.X = BitConverter.ToUInt32(br_read(4), 0); |
92 | Common.SendToDebug("Param1 Z: " + v.Z); | 92 | Common.SendToDebug("Param1 Z: " + v.Z); |
93 | Common.SendToDebug("Param1 Y: " + v.Y); | 93 | Common.SendToDebug("Param1 Y: " + v.Y); |
94 | Common.SendToDebug("Param1 X: " + v.X); | 94 | Common.SendToDebug("Param1 X: " + v.X); |
95 | IL_Push(il, v); | 95 | IL_Push(il, v); |
96 | break; | 96 | break; |
97 | // ROTATION s,z,y,x | 97 | // ROTATION s,z,y,x |
98 | case LSO_Enums.Operation_Table.PUSHARGQ: | 98 | case LSO_Enums.Operation_Table.PUSHARGQ: |
99 | LSO_Enums.Rotation r = new LSO_Enums.Rotation(); | 99 | LSO_Enums.Rotation r = new LSO_Enums.Rotation(); |
100 | r.S = BitConverter.ToUInt32(br_read(4), 0); | 100 | r.S = BitConverter.ToUInt32(br_read(4), 0); |
101 | r.Z = BitConverter.ToUInt32(br_read(4), 0); | 101 | r.Z = BitConverter.ToUInt32(br_read(4), 0); |
102 | r.Y = BitConverter.ToUInt32(br_read(4), 0); | 102 | r.Y = BitConverter.ToUInt32(br_read(4), 0); |
103 | r.X = BitConverter.ToUInt32(br_read(4), 0); | 103 | r.X = BitConverter.ToUInt32(br_read(4), 0); |
104 | Common.SendToDebug("Param1 S: " + r.S); | 104 | Common.SendToDebug("Param1 S: " + r.S); |
105 | Common.SendToDebug("Param1 Z: " + r.Z); | 105 | Common.SendToDebug("Param1 Z: " + r.Z); |
106 | Common.SendToDebug("Param1 Y: " + r.Y); | 106 | Common.SendToDebug("Param1 Y: " + r.Y); |
107 | Common.SendToDebug("Param1 X: " + r.X); | 107 | Common.SendToDebug("Param1 X: " + r.X); |
108 | IL_Push(il, r); | 108 | IL_Push(il, r); |
109 | break; | 109 | break; |
110 | 110 | ||
111 | case LSO_Enums.Operation_Table.PUSHE: | 111 | case LSO_Enums.Operation_Table.PUSHE: |
112 | IL_Push(il, (UInt32) 0); | 112 | IL_Push(il, (UInt32) 0); |
113 | break; | 113 | break; |
114 | 114 | ||
115 | case LSO_Enums.Operation_Table.PUSHARGE: | 115 | case LSO_Enums.Operation_Table.PUSHARGE: |
116 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 116 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
117 | Common.SendToDebug("Param1: " + u32p1); | 117 | Common.SendToDebug("Param1: " + u32p1); |
118 | //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); | 118 | //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); |
119 | IL_Push(il, u32p1); | 119 | IL_Push(il, u32p1); |
120 | break; | 120 | break; |
121 | // BYTE | 121 | // BYTE |
122 | case LSO_Enums.Operation_Table.ADD: | 122 | case LSO_Enums.Operation_Table.ADD: |
123 | case LSO_Enums.Operation_Table.SUB: | 123 | case LSO_Enums.Operation_Table.SUB: |
124 | case LSO_Enums.Operation_Table.MUL: | 124 | case LSO_Enums.Operation_Table.MUL: |
125 | case LSO_Enums.Operation_Table.DIV: | 125 | case LSO_Enums.Operation_Table.DIV: |
126 | case LSO_Enums.Operation_Table.EQ: | 126 | case LSO_Enums.Operation_Table.EQ: |
127 | case LSO_Enums.Operation_Table.NEQ: | 127 | case LSO_Enums.Operation_Table.NEQ: |
128 | case LSO_Enums.Operation_Table.LEQ: | 128 | case LSO_Enums.Operation_Table.LEQ: |
129 | case LSO_Enums.Operation_Table.GEQ: | 129 | case LSO_Enums.Operation_Table.GEQ: |
130 | case LSO_Enums.Operation_Table.LESS: | 130 | case LSO_Enums.Operation_Table.LESS: |
131 | case LSO_Enums.Operation_Table.GREATER: | 131 | case LSO_Enums.Operation_Table.GREATER: |
132 | case LSO_Enums.Operation_Table.NEG: | 132 | case LSO_Enums.Operation_Table.NEG: |
133 | case LSO_Enums.Operation_Table.MOD: | 133 | case LSO_Enums.Operation_Table.MOD: |
134 | bp1 = br_read(1)[0]; | 134 | bp1 = br_read(1)[0]; |
135 | Common.SendToDebug("Param1: " + bp1); | 135 | Common.SendToDebug("Param1: " + bp1); |
136 | IL_CallBaseFunction(il, idesc, (UInt32) bp1); | 136 | IL_CallBaseFunction(il, idesc, (UInt32) bp1); |
137 | break; | 137 | break; |
138 | 138 | ||
139 | // NO ARGUMENTS | 139 | // NO ARGUMENTS |
140 | case LSO_Enums.Operation_Table.BITAND: | 140 | case LSO_Enums.Operation_Table.BITAND: |
141 | case LSO_Enums.Operation_Table.BITOR: | 141 | case LSO_Enums.Operation_Table.BITOR: |
142 | case LSO_Enums.Operation_Table.BITXOR: | 142 | case LSO_Enums.Operation_Table.BITXOR: |
143 | case LSO_Enums.Operation_Table.BOOLAND: | 143 | case LSO_Enums.Operation_Table.BOOLAND: |
144 | case LSO_Enums.Operation_Table.BOOLOR: | 144 | case LSO_Enums.Operation_Table.BOOLOR: |
145 | case LSO_Enums.Operation_Table.BITNOT: | 145 | case LSO_Enums.Operation_Table.BITNOT: |
146 | case LSO_Enums.Operation_Table.BOOLNOT: | 146 | case LSO_Enums.Operation_Table.BOOLNOT: |
147 | IL_CallBaseFunction(il, idesc); | 147 | IL_CallBaseFunction(il, idesc); |
148 | break; | 148 | break; |
149 | // SHORT | 149 | // SHORT |
150 | case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: | 150 | case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: |
151 | // TODO: What is size of short? | 151 | // TODO: What is size of short? |
152 | UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); | 152 | UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); |
153 | Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + | 153 | Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + |
154 | ((LSO_Enums.BuiltIn_Functions) U16p1).ToString()); | 154 | ((LSO_Enums.BuiltIn_Functions) U16p1).ToString()); |
155 | //Common.SendToDebug("Param1: " + U16p1); | 155 | //Common.SendToDebug("Param1: " + U16p1); |
156 | string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString(); | 156 | string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString(); |
157 | 157 | ||
158 | bool cmdFound = false; | 158 | bool cmdFound = false; |
159 | foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods()) | 159 | foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods()) |
160 | { | 160 | { |
161 | // Found command | 161 | // Found command |
162 | if (mi.Name == fname) | 162 | if (mi.Name == fname) |
163 | { | 163 | { |
164 | il.Emit(OpCodes.Ldarg_0); | 164 | il.Emit(OpCodes.Ldarg_0); |
165 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {})); | 165 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {})); |
166 | // Pop required number of items from my stack to .Net stack | 166 | // Pop required number of items from my stack to .Net stack |
167 | IL_PopToStack(il, mi.GetParameters().Length); | 167 | IL_PopToStack(il, mi.GetParameters().Length); |
168 | il.Emit(OpCodes.Callvirt, mi); | 168 | il.Emit(OpCodes.Callvirt, mi); |
169 | cmdFound = true; | 169 | cmdFound = true; |
170 | break; | 170 | break; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | if (cmdFound == false) | 173 | if (cmdFound == false) |
174 | { | 174 | { |
175 | Common.SendToDebug("ERROR: UNABLE TO LOCATE OPCODE " + idesc + " IN BASECLASS"); | 175 | Common.SendToDebug("ERROR: UNABLE TO LOCATE OPCODE " + idesc + " IN BASECLASS"); |
176 | } | 176 | } |
177 | 177 | ||
178 | break; | 178 | break; |
179 | 179 | ||
180 | // RETURN | 180 | // RETURN |
181 | case LSO_Enums.Operation_Table.RETURN: | 181 | case LSO_Enums.Operation_Table.RETURN: |
182 | 182 | ||
183 | Common.SendToDebug("OPCODE: RETURN"); | 183 | Common.SendToDebug("OPCODE: RETURN"); |
184 | return true; | 184 | return true; |
185 | 185 | ||
186 | case LSO_Enums.Operation_Table.POP: | 186 | case LSO_Enums.Operation_Table.POP: |
187 | case LSO_Enums.Operation_Table.POPS: | 187 | case LSO_Enums.Operation_Table.POPS: |
188 | case LSO_Enums.Operation_Table.POPL: | 188 | case LSO_Enums.Operation_Table.POPL: |
189 | case LSO_Enums.Operation_Table.POPV: | 189 | case LSO_Enums.Operation_Table.POPV: |
190 | case LSO_Enums.Operation_Table.POPQ: | 190 | case LSO_Enums.Operation_Table.POPQ: |
191 | // Pops a specific datatype from the stack | 191 | // Pops a specific datatype from the stack |
192 | // We just ignore the datatype for now | 192 | // We just ignore the datatype for now |
193 | IL_Pop(il); | 193 | IL_Pop(il); |
194 | break; | 194 | break; |
195 | 195 | ||
196 | // LONG | 196 | // LONG |
197 | case LSO_Enums.Operation_Table.STORE: | 197 | case LSO_Enums.Operation_Table.STORE: |
198 | case LSO_Enums.Operation_Table.STORES: | 198 | case LSO_Enums.Operation_Table.STORES: |
199 | case LSO_Enums.Operation_Table.STOREL: | 199 | case LSO_Enums.Operation_Table.STOREL: |
200 | case LSO_Enums.Operation_Table.STOREV: | 200 | case LSO_Enums.Operation_Table.STOREV: |
201 | case LSO_Enums.Operation_Table.STOREQ: | 201 | case LSO_Enums.Operation_Table.STOREQ: |
202 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 202 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
203 | Common.SendToDebug("Param1: " + u32p1.ToString()); | 203 | Common.SendToDebug("Param1: " + u32p1.ToString()); |
204 | IL_CallBaseFunction(il, "StoreToLocal", u32p1); | 204 | IL_CallBaseFunction(il, "StoreToLocal", u32p1); |
205 | break; | 205 | break; |
206 | 206 | ||
207 | case LSO_Enums.Operation_Table.STOREG: | 207 | case LSO_Enums.Operation_Table.STOREG: |
208 | case LSO_Enums.Operation_Table.STOREGS: | 208 | case LSO_Enums.Operation_Table.STOREGS: |
209 | case LSO_Enums.Operation_Table.STOREGL: | 209 | case LSO_Enums.Operation_Table.STOREGL: |
210 | case LSO_Enums.Operation_Table.STOREGV: | 210 | case LSO_Enums.Operation_Table.STOREGV: |
211 | case LSO_Enums.Operation_Table.STOREGQ: | 211 | case LSO_Enums.Operation_Table.STOREGQ: |
212 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 212 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
213 | Common.SendToDebug("Param1: " + u32p1.ToString()); | 213 | Common.SendToDebug("Param1: " + u32p1.ToString()); |
214 | IL_CallBaseFunction(il, "StoreToGlobal", u32p1); | 214 | IL_CallBaseFunction(il, "StoreToGlobal", u32p1); |
215 | break; | 215 | break; |
216 | 216 | ||
217 | case LSO_Enums.Operation_Table.LOADP: | 217 | case LSO_Enums.Operation_Table.LOADP: |
218 | case LSO_Enums.Operation_Table.LOADSP: | 218 | case LSO_Enums.Operation_Table.LOADSP: |
219 | case LSO_Enums.Operation_Table.LOADLP: | 219 | case LSO_Enums.Operation_Table.LOADLP: |
220 | case LSO_Enums.Operation_Table.LOADVP: | 220 | case LSO_Enums.Operation_Table.LOADVP: |
221 | case LSO_Enums.Operation_Table.LOADQP: | 221 | case LSO_Enums.Operation_Table.LOADQP: |
222 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 222 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
223 | Common.SendToDebug("Param1: " + u32p1.ToString()); | 223 | Common.SendToDebug("Param1: " + u32p1.ToString()); |
224 | IL_CallBaseFunction(il, "StoreToLocal", u32p1); | 224 | IL_CallBaseFunction(il, "StoreToLocal", u32p1); |
225 | IL_Pop(il); | 225 | IL_Pop(il); |
226 | break; | 226 | break; |
227 | 227 | ||
228 | case LSO_Enums.Operation_Table.LOADGP: | 228 | case LSO_Enums.Operation_Table.LOADGP: |
229 | case LSO_Enums.Operation_Table.LOADGSP: | 229 | case LSO_Enums.Operation_Table.LOADGSP: |
230 | case LSO_Enums.Operation_Table.LOADGLP: | 230 | case LSO_Enums.Operation_Table.LOADGLP: |
231 | case LSO_Enums.Operation_Table.LOADGVP: | 231 | case LSO_Enums.Operation_Table.LOADGVP: |
232 | case LSO_Enums.Operation_Table.LOADGQP: | 232 | case LSO_Enums.Operation_Table.LOADGQP: |
233 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 233 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
234 | Common.SendToDebug("Param1: " + u32p1.ToString()); | 234 | Common.SendToDebug("Param1: " + u32p1.ToString()); |
235 | IL_CallBaseFunction(il, "StoreToStatic", u32p1 - 6 + myHeader.GVR); | 235 | IL_CallBaseFunction(il, "StoreToStatic", u32p1 - 6 + myHeader.GVR); |
236 | IL_Pop(il); | 236 | IL_Pop(il); |
237 | break; | 237 | break; |
238 | 238 | ||
239 | // PUSH FROM LOCAL FRAME | 239 | // PUSH FROM LOCAL FRAME |
240 | case LSO_Enums.Operation_Table.PUSH: | 240 | case LSO_Enums.Operation_Table.PUSH: |
241 | case LSO_Enums.Operation_Table.PUSHS: | 241 | case LSO_Enums.Operation_Table.PUSHS: |
242 | case LSO_Enums.Operation_Table.PUSHL: | 242 | case LSO_Enums.Operation_Table.PUSHL: |
243 | case LSO_Enums.Operation_Table.PUSHV: | 243 | case LSO_Enums.Operation_Table.PUSHV: |
244 | case LSO_Enums.Operation_Table.PUSHQ: | 244 | case LSO_Enums.Operation_Table.PUSHQ: |
245 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 245 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
246 | Common.SendToDebug("Param1: " + u32p1.ToString()); | 246 | Common.SendToDebug("Param1: " + u32p1.ToString()); |
247 | IL_CallBaseFunction(il, "GetFromLocal", u32p1); | 247 | IL_CallBaseFunction(il, "GetFromLocal", u32p1); |
248 | 248 | ||
249 | break; | 249 | break; |
250 | 250 | ||
251 | // PUSH FROM STATIC FRAME | 251 | // PUSH FROM STATIC FRAME |
252 | case LSO_Enums.Operation_Table.PUSHG: | 252 | case LSO_Enums.Operation_Table.PUSHG: |
253 | case LSO_Enums.Operation_Table.PUSHGS: | 253 | case LSO_Enums.Operation_Table.PUSHGS: |
254 | case LSO_Enums.Operation_Table.PUSHGL: | 254 | case LSO_Enums.Operation_Table.PUSHGL: |
255 | case LSO_Enums.Operation_Table.PUSHGV: | 255 | case LSO_Enums.Operation_Table.PUSHGV: |
256 | case LSO_Enums.Operation_Table.PUSHGQ: | 256 | case LSO_Enums.Operation_Table.PUSHGQ: |
257 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | 257 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); |
258 | Common.SendToDebug("Param1: " + u32p1.ToString()); | 258 | Common.SendToDebug("Param1: " + u32p1.ToString()); |
259 | IL_CallBaseFunction(il, "GetFromStatic", u32p1 - 6 + myHeader.GVR); | 259 | IL_CallBaseFunction(il, "GetFromStatic", u32p1 - 6 + myHeader.GVR); |
260 | break; | 260 | break; |
261 | 261 | ||
262 | 262 | ||
263 | /*********************** | 263 | /*********************** |
264 | * NOT IMPLEMENTED YET * | 264 | * NOT IMPLEMENTED YET * |
265 | ***********************/ | 265 | ***********************/ |
266 | 266 | ||
267 | 267 | ||
268 | case LSO_Enums.Operation_Table.POPIP: | 268 | case LSO_Enums.Operation_Table.POPIP: |
269 | case LSO_Enums.Operation_Table.POPSP: | 269 | case LSO_Enums.Operation_Table.POPSP: |
270 | case LSO_Enums.Operation_Table.POPSLR: | 270 | case LSO_Enums.Operation_Table.POPSLR: |
271 | case LSO_Enums.Operation_Table.POPARG: | 271 | case LSO_Enums.Operation_Table.POPARG: |
272 | case LSO_Enums.Operation_Table.POPBP: | 272 | case LSO_Enums.Operation_Table.POPBP: |
273 | //Common.SendToDebug("Instruction " + idesc + ": Ignored"); | 273 | //Common.SendToDebug("Instruction " + idesc + ": Ignored"); |
274 | Common.SendToDebug("Instruction " + idesc + | 274 | Common.SendToDebug("Instruction " + idesc + |
275 | ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); | 275 | ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); |
276 | //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 276 | //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
277 | IL_Pop(il); | 277 | IL_Pop(il); |
278 | break; | 278 | break; |
279 | 279 | ||
280 | 280 | ||
281 | // None | 281 | // None |
282 | case LSO_Enums.Operation_Table.PUSHIP: | 282 | case LSO_Enums.Operation_Table.PUSHIP: |
283 | // PUSH INSTRUCTION POINTER | 283 | // PUSH INSTRUCTION POINTER |
284 | break; | 284 | break; |
285 | case LSO_Enums.Operation_Table.PUSHBP: | 285 | case LSO_Enums.Operation_Table.PUSHBP: |
286 | 286 | ||
287 | case LSO_Enums.Operation_Table.PUSHEV: | 287 | case LSO_Enums.Operation_Table.PUSHEV: |
288 | break; | 288 | break; |
289 | case LSO_Enums.Operation_Table.PUSHEQ: | 289 | case LSO_Enums.Operation_Table.PUSHEQ: |
290 | break; | 290 | break; |
291 | 291 | ||
292 | 292 | ||
293 | // LONG | 293 | // LONG |
294 | case LSO_Enums.Operation_Table.JUMP: | 294 | case LSO_Enums.Operation_Table.JUMP: |
295 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 295 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
296 | break; | 296 | break; |
297 | // BYTE, LONG | 297 | // BYTE, LONG |
298 | case LSO_Enums.Operation_Table.JUMPIF: | 298 | case LSO_Enums.Operation_Table.JUMPIF: |
299 | case LSO_Enums.Operation_Table.JUMPNIF: | 299 | case LSO_Enums.Operation_Table.JUMPNIF: |
300 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 300 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
301 | Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); | 301 | Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); |
302 | break; | 302 | break; |
303 | // LONG | 303 | // LONG |
304 | case LSO_Enums.Operation_Table.STATE: | 304 | case LSO_Enums.Operation_Table.STATE: |
305 | bp1 = br_read(1)[0]; | 305 | bp1 = br_read(1)[0]; |
306 | //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack | 306 | //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack |
307 | //il.Emit(OpCodes.Ldc_I4, 0); // Push index position | 307 | //il.Emit(OpCodes.Ldc_I4, 0); // Push index position |
308 | //il.Emit(OpCodes.Ldstr, EventList[p1]); // Push value | 308 | //il.Emit(OpCodes.Ldstr, EventList[p1]); // Push value |
309 | //il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value | 309 | //il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value |
310 | break; | 310 | break; |
311 | case LSO_Enums.Operation_Table.CALL: | 311 | case LSO_Enums.Operation_Table.CALL: |
312 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 312 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
313 | Common.SendToDebug("ERROR: Function CALL not implemented yet."); | 313 | Common.SendToDebug("ERROR: Function CALL not implemented yet."); |
314 | break; | 314 | break; |
315 | // BYTE | 315 | // BYTE |
316 | case LSO_Enums.Operation_Table.CAST: | 316 | case LSO_Enums.Operation_Table.CAST: |
317 | bp1 = br_read(1)[0]; | 317 | bp1 = br_read(1)[0]; |
318 | Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + | 318 | Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + |
319 | ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)); | 319 | ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)); |
320 | Common.SendToDebug("Param1: " + bp1); | 320 | Common.SendToDebug("Param1: " + bp1); |
321 | switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1) | 321 | switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1) |
322 | { | 322 | { |
323 | case LSO_Enums.OpCode_Cast_TypeDefs.String: | 323 | case LSO_Enums.OpCode_Cast_TypeDefs.String: |
324 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); | 324 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); |
325 | break; | 325 | break; |
326 | default: | 326 | default: |
327 | Common.SendToDebug("Instruction " + idesc + ": Unknown cast type!"); | 327 | Common.SendToDebug("Instruction " + idesc + ": Unknown cast type!"); |
328 | break; | 328 | break; |
329 | } | 329 | } |
330 | break; | 330 | break; |
331 | // LONG | 331 | // LONG |
332 | case LSO_Enums.Operation_Table.STACKTOS: | 332 | case LSO_Enums.Operation_Table.STACKTOS: |
333 | case LSO_Enums.Operation_Table.STACKTOL: | 333 | case LSO_Enums.Operation_Table.STACKTOL: |
334 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | 334 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); |
335 | break; | 335 | break; |
336 | // BYTE | 336 | // BYTE |
337 | case LSO_Enums.Operation_Table.PRINT: | 337 | case LSO_Enums.Operation_Table.PRINT: |
338 | case LSO_Enums.Operation_Table.CALLLIB: | 338 | case LSO_Enums.Operation_Table.CALLLIB: |
339 | Common.SendToDebug("Param1: " + br_read(1)[0]); | 339 | Common.SendToDebug("Param1: " + br_read(1)[0]); |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | return false; | 342 | return false; |
343 | } | 343 | } |
344 | 344 | ||
345 | private void IL_PopToStack(ILGenerator il) | 345 | private void IL_PopToStack(ILGenerator il) |
346 | { | 346 | { |
347 | IL_PopToStack(il, 1); | 347 | IL_PopToStack(il, 1); |
348 | } | 348 | } |
349 | 349 | ||
350 | private void IL_PopToStack(ILGenerator il, int count) | 350 | private void IL_PopToStack(ILGenerator il, int count) |
351 | { | 351 | { |
352 | Common.SendToDebug("IL_PopToStack();"); | 352 | Common.SendToDebug("IL_PopToStack();"); |
353 | for (int i = 0; i < count; i++) | 353 | for (int i = 0; i < count; i++) |
354 | { | 354 | { |
355 | IL_CallBaseFunction(il, "POPToStack"); | 355 | IL_CallBaseFunction(il, "POPToStack"); |
356 | //il.Emit(OpCodes.Ldarg_0); | 356 | //il.Emit(OpCodes.Ldarg_0); |
357 | //il.Emit(OpCodes.Call, | 357 | //il.Emit(OpCodes.Call, |
358 | // typeof(LSL_BaseClass).GetMethod("POPToStack", | 358 | // typeof(LSL_BaseClass).GetMethod("POPToStack", |
359 | // new Type[] { })); | 359 | // new Type[] { })); |
360 | } | 360 | } |
361 | } | 361 | } |
362 | 362 | ||
363 | private void IL_Pop(ILGenerator il) | 363 | private void IL_Pop(ILGenerator il) |
364 | { | 364 | { |
365 | Common.SendToDebug("IL_Pop();"); | 365 | Common.SendToDebug("IL_Pop();"); |
366 | IL_CallBaseFunction(il, "POP"); | 366 | IL_CallBaseFunction(il, "POP"); |
367 | } | 367 | } |
368 | 368 | ||
369 | private void IL_Debug(ILGenerator il, string text) | 369 | private void IL_Debug(ILGenerator il, string text) |
370 | { | 370 | { |
371 | il.Emit(OpCodes.Ldstr, text); | 371 | il.Emit(OpCodes.Ldstr, text); |
372 | il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug", | 372 | il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug", |
373 | new Type[] {typeof (string)} | 373 | new Type[] {typeof (string)} |
374 | )); | 374 | )); |
375 | } | 375 | } |
376 | 376 | ||
377 | private void IL_CallBaseFunction(ILGenerator il, string methodname) | 377 | private void IL_CallBaseFunction(ILGenerator il, string methodname) |
378 | { | 378 | { |
379 | il.Emit(OpCodes.Ldarg_0); | 379 | il.Emit(OpCodes.Ldarg_0); |
380 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {})); | 380 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {})); |
381 | } | 381 | } |
382 | 382 | ||
383 | private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) | 383 | private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) |
384 | { | 384 | { |
385 | il.Emit(OpCodes.Ldarg_0); | 385 | il.Emit(OpCodes.Ldarg_0); |
386 | if (data.GetType() == typeof (string)) | 386 | if (data.GetType() == typeof (string)) |
387 | il.Emit(OpCodes.Ldstr, (string) data); | 387 | il.Emit(OpCodes.Ldstr, (string) data); |
388 | if (data.GetType() == typeof (UInt32)) | 388 | if (data.GetType() == typeof (UInt32)) |
389 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); | 389 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); |
390 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()})); | 390 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()})); |
391 | } | 391 | } |
392 | 392 | ||
393 | private void IL_Push(ILGenerator il, object data) | 393 | private void IL_Push(ILGenerator il, object data) |
394 | { | 394 | { |
395 | il.Emit(OpCodes.Ldarg_0); | 395 | il.Emit(OpCodes.Ldarg_0); |
396 | Common.SendToDebug("PUSH datatype: " + data.GetType()); | 396 | Common.SendToDebug("PUSH datatype: " + data.GetType()); |
397 | 397 | ||
398 | IL_PushDataTypeToILStack(il, data); | 398 | IL_PushDataTypeToILStack(il, data); |
399 | 399 | ||
400 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()})); | 400 | il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()})); |
401 | } | 401 | } |
402 | 402 | ||
403 | private void IL_PushDataTypeToILStack(ILGenerator il, object data) | 403 | private void IL_PushDataTypeToILStack(ILGenerator il, object data) |
404 | { | 404 | { |
405 | if (data.GetType() == typeof (UInt16)) | 405 | if (data.GetType() == typeof (UInt16)) |
406 | { | 406 | { |
407 | il.Emit(OpCodes.Ldc_I4, (UInt16) data); | 407 | il.Emit(OpCodes.Ldc_I4, (UInt16) data); |
408 | il.Emit(OpCodes.Box, data.GetType()); | 408 | il.Emit(OpCodes.Box, data.GetType()); |
409 | } | 409 | } |
410 | if (data.GetType() == typeof (UInt32)) | 410 | if (data.GetType() == typeof (UInt32)) |
411 | { | 411 | { |
412 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); | 412 | il.Emit(OpCodes.Ldc_I4, (UInt32) data); |
413 | il.Emit(OpCodes.Box, data.GetType()); | 413 | il.Emit(OpCodes.Box, data.GetType()); |
414 | } | 414 | } |
415 | if (data.GetType() == typeof (Int32)) | 415 | if (data.GetType() == typeof (Int32)) |
416 | { | 416 | { |
417 | il.Emit(OpCodes.Ldc_I4, (Int32) data); | 417 | il.Emit(OpCodes.Ldc_I4, (Int32) data); |
418 | il.Emit(OpCodes.Box, data.GetType()); | 418 | il.Emit(OpCodes.Box, data.GetType()); |
419 | } | 419 | } |
420 | if (data.GetType() == typeof (float)) | 420 | if (data.GetType() == typeof (float)) |
421 | { | 421 | { |
422 | il.Emit(OpCodes.Ldc_I4, (float) data); | 422 | il.Emit(OpCodes.Ldc_I4, (float) data); |
423 | il.Emit(OpCodes.Box, data.GetType()); | 423 | il.Emit(OpCodes.Box, data.GetType()); |
424 | } | 424 | } |
425 | if (data.GetType() == typeof (string)) | 425 | if (data.GetType() == typeof (string)) |
426 | il.Emit(OpCodes.Ldstr, (string) data); | 426 | il.Emit(OpCodes.Ldstr, (string) data); |
427 | //if (data.GetType() == typeof(LSO_Enums.Rotation)) | 427 | //if (data.GetType() == typeof(LSO_Enums.Rotation)) |
428 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); | 428 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); |
429 | //if (data.GetType() == typeof(LSO_Enums.Vector)) | 429 | //if (data.GetType() == typeof(LSO_Enums.Vector)) |
430 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); | 430 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); |
431 | //if (data.GetType() == typeof(LSO_Enums.Key)) | 431 | //if (data.GetType() == typeof(LSO_Enums.Key)) |
432 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); | 432 | // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); |
433 | } | 433 | } |
434 | } | 434 | } |
435 | } \ No newline at end of file | 435 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Enums.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Enums.cs index c7bce4a..ea84efd 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Enums.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Enums.cs | |||
@@ -1,560 +1,560 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | 30 | ||
31 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 31 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
32 | { | 32 | { |
33 | public static class LSO_Enums | 33 | public static class LSO_Enums |
34 | { | 34 | { |
35 | //public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types; | 35 | //public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types; |
36 | 36 | ||
37 | //LSO_Enums() { | 37 | //LSO_Enums() { |
38 | // OpCode_Add_Types.Add(51, typeof(String)); | 38 | // OpCode_Add_Types.Add(51, typeof(String)); |
39 | // OpCode_Add_Types.Add(17, typeof(UInt32)); | 39 | // OpCode_Add_Types.Add(17, typeof(UInt32)); |
40 | //} | 40 | //} |
41 | 41 | ||
42 | [Serializable] | 42 | [Serializable] |
43 | public enum OpCode_Add_TypeDefs | 43 | public enum OpCode_Add_TypeDefs |
44 | { | 44 | { |
45 | String = 51, | 45 | String = 51, |
46 | UInt32 = 17 | 46 | UInt32 = 17 |
47 | } | 47 | } |
48 | 48 | ||
49 | [Serializable] | 49 | [Serializable] |
50 | public enum OpCode_Cast_TypeDefs | 50 | public enum OpCode_Cast_TypeDefs |
51 | { | 51 | { |
52 | String = 19 | 52 | String = 19 |
53 | } | 53 | } |
54 | 54 | ||
55 | [Serializable] | 55 | [Serializable] |
56 | public struct Key | 56 | public struct Key |
57 | { | 57 | { |
58 | public string KeyString; | 58 | public string KeyString; |
59 | } | 59 | } |
60 | 60 | ||
61 | [Serializable] | 61 | [Serializable] |
62 | public struct Vector | 62 | public struct Vector |
63 | { | 63 | { |
64 | public UInt32 Z; | 64 | public UInt32 Z; |
65 | public UInt32 Y; | 65 | public UInt32 Y; |
66 | public UInt32 X; | 66 | public UInt32 X; |
67 | } | 67 | } |
68 | 68 | ||
69 | [Serializable] | 69 | [Serializable] |
70 | public struct Rotation | 70 | public struct Rotation |
71 | { | 71 | { |
72 | public UInt32 S; | 72 | public UInt32 S; |
73 | public UInt32 Z; | 73 | public UInt32 Z; |
74 | public UInt32 Y; | 74 | public UInt32 Y; |
75 | public UInt32 X; | 75 | public UInt32 X; |
76 | } | 76 | } |
77 | 77 | ||
78 | [Serializable] | 78 | [Serializable] |
79 | public enum Variable_Type_Codes | 79 | public enum Variable_Type_Codes |
80 | { | 80 | { |
81 | Void = 0, | 81 | Void = 0, |
82 | Integer = 1, | 82 | Integer = 1, |
83 | Float = 2, | 83 | Float = 2, |
84 | String = 3, | 84 | String = 3, |
85 | Key = 4, | 85 | Key = 4, |
86 | Vector = 5, | 86 | Vector = 5, |
87 | Rotation = 6, | 87 | Rotation = 6, |
88 | List = 7, | 88 | List = 7, |
89 | Null = 8 | 89 | Null = 8 |
90 | } | 90 | } |
91 | 91 | ||
92 | [Serializable] | 92 | [Serializable] |
93 | public enum Event_Mask_Values | 93 | public enum Event_Mask_Values |
94 | { | 94 | { |
95 | state_entry = 0, | 95 | state_entry = 0, |
96 | state_exit = 1, | 96 | state_exit = 1, |
97 | touch_start = 2, | 97 | touch_start = 2, |
98 | touch = 3, | 98 | touch = 3, |
99 | touch_end = 4, | 99 | touch_end = 4, |
100 | collision_start = 5, | 100 | collision_start = 5, |
101 | collision = 6, | 101 | collision = 6, |
102 | collision_end = 7, | 102 | collision_end = 7, |
103 | land_collision_start = 8, | 103 | land_collision_start = 8, |
104 | land_collision = 9, | 104 | land_collision = 9, |
105 | land_collision_end = 10, | 105 | land_collision_end = 10, |
106 | timer = 11, | 106 | timer = 11, |
107 | listen = 12, | 107 | listen = 12, |
108 | on_rez = 13, | 108 | on_rez = 13, |
109 | sensor = 14, | 109 | sensor = 14, |
110 | no_sensor = 15, | 110 | no_sensor = 15, |
111 | control = 16, | 111 | control = 16, |
112 | money = 17, | 112 | money = 17, |
113 | email = 18, | 113 | email = 18, |
114 | at_target = 19, | 114 | at_target = 19, |
115 | not_at_target = 20, | 115 | not_at_target = 20, |
116 | at_rot_target = 21, | 116 | at_rot_target = 21, |
117 | not_at_rot_target = 22, | 117 | not_at_rot_target = 22, |
118 | run_time_permissions = 23, | 118 | run_time_permissions = 23, |
119 | changed = 24, | 119 | changed = 24, |
120 | attach = 25, | 120 | attach = 25, |
121 | dataserver = 26, | 121 | dataserver = 26, |
122 | link_message = 27, | 122 | link_message = 27, |
123 | moving_start = 28, | 123 | moving_start = 28, |
124 | moving_end = 29, | 124 | moving_end = 29, |
125 | object_rez = 30, | 125 | object_rez = 30, |
126 | remote_data = 31, | 126 | remote_data = 31, |
127 | http_response = 32 | 127 | http_response = 32 |
128 | } | 128 | } |
129 | 129 | ||
130 | [Serializable] | 130 | [Serializable] |
131 | public enum Operation_Table | 131 | public enum Operation_Table |
132 | { | 132 | { |
133 | NOOP = 0x0, | 133 | NOOP = 0x0, |
134 | POP = 0x1, | 134 | POP = 0x1, |
135 | POPS = 0x2, | 135 | POPS = 0x2, |
136 | POPL = 0x3, | 136 | POPL = 0x3, |
137 | POPV = 0x4, | 137 | POPV = 0x4, |
138 | POPQ = 0x5, | 138 | POPQ = 0x5, |
139 | POPARG = 0x6, | 139 | POPARG = 0x6, |
140 | POPIP = 0x7, | 140 | POPIP = 0x7, |
141 | POPBP = 0x8, | 141 | POPBP = 0x8, |
142 | POPSP = 0x9, | 142 | POPSP = 0x9, |
143 | POPSLR = 0xa, | 143 | POPSLR = 0xa, |
144 | DUP = 0x20, | 144 | DUP = 0x20, |
145 | DUPS = 0x21, | 145 | DUPS = 0x21, |
146 | DUPL = 0x22, | 146 | DUPL = 0x22, |
147 | DUPV = 0x23, | 147 | DUPV = 0x23, |
148 | DUPQ = 0x24, | 148 | DUPQ = 0x24, |
149 | STORE = 0x30, | 149 | STORE = 0x30, |
150 | STORES = 0x31, | 150 | STORES = 0x31, |
151 | STOREL = 0x32, | 151 | STOREL = 0x32, |
152 | STOREV = 0x33, | 152 | STOREV = 0x33, |
153 | STOREQ = 0x34, | 153 | STOREQ = 0x34, |
154 | STOREG = 0x35, | 154 | STOREG = 0x35, |
155 | STOREGS = 0x36, | 155 | STOREGS = 0x36, |
156 | STOREGL = 0x37, | 156 | STOREGL = 0x37, |
157 | STOREGV = 0x38, | 157 | STOREGV = 0x38, |
158 | STOREGQ = 0x39, | 158 | STOREGQ = 0x39, |
159 | LOADP = 0x3a, | 159 | LOADP = 0x3a, |
160 | LOADSP = 0x3b, | 160 | LOADSP = 0x3b, |
161 | LOADLP = 0x3c, | 161 | LOADLP = 0x3c, |
162 | LOADVP = 0x3d, | 162 | LOADVP = 0x3d, |
163 | LOADQP = 0x3e, | 163 | LOADQP = 0x3e, |
164 | LOADGP = 0x3f, | 164 | LOADGP = 0x3f, |
165 | LOADGSP = 0x40, | 165 | LOADGSP = 0x40, |
166 | LOADGLP = 0x41, | 166 | LOADGLP = 0x41, |
167 | LOADGVP = 0x42, | 167 | LOADGVP = 0x42, |
168 | LOADGQP = 0x43, | 168 | LOADGQP = 0x43, |
169 | PUSH = 0x50, | 169 | PUSH = 0x50, |
170 | PUSHS = 0x51, | 170 | PUSHS = 0x51, |
171 | PUSHL = 0x52, | 171 | PUSHL = 0x52, |
172 | PUSHV = 0x53, | 172 | PUSHV = 0x53, |
173 | PUSHQ = 0x54, | 173 | PUSHQ = 0x54, |
174 | PUSHG = 0x55, | 174 | PUSHG = 0x55, |
175 | PUSHGS = 0x56, | 175 | PUSHGS = 0x56, |
176 | PUSHGL = 0x57, | 176 | PUSHGL = 0x57, |
177 | PUSHGV = 0x58, | 177 | PUSHGV = 0x58, |
178 | PUSHGQ = 0x59, | 178 | PUSHGQ = 0x59, |
179 | PUSHIP = 0x5a, | 179 | PUSHIP = 0x5a, |
180 | PUSHBP = 0x5b, | 180 | PUSHBP = 0x5b, |
181 | PUSHSP = 0x5c, | 181 | PUSHSP = 0x5c, |
182 | PUSHARGB = 0x5d, | 182 | PUSHARGB = 0x5d, |
183 | PUSHARGI = 0x5e, | 183 | PUSHARGI = 0x5e, |
184 | PUSHARGF = 0x5f, | 184 | PUSHARGF = 0x5f, |
185 | PUSHARGS = 0x60, | 185 | PUSHARGS = 0x60, |
186 | PUSHARGV = 0x61, | 186 | PUSHARGV = 0x61, |
187 | PUSHARGQ = 0x62, | 187 | PUSHARGQ = 0x62, |
188 | PUSHE = 0x63, | 188 | PUSHE = 0x63, |
189 | PUSHEV = 0x64, | 189 | PUSHEV = 0x64, |
190 | PUSHEQ = 0x65, | 190 | PUSHEQ = 0x65, |
191 | PUSHARGE = 0x66, | 191 | PUSHARGE = 0x66, |
192 | ADD = 0x70, | 192 | ADD = 0x70, |
193 | SUB = 0x71, | 193 | SUB = 0x71, |
194 | MUL = 0x72, | 194 | MUL = 0x72, |
195 | DIV = 0x73, | 195 | DIV = 0x73, |
196 | MOD = 0x74, | 196 | MOD = 0x74, |
197 | EQ = 0x75, | 197 | EQ = 0x75, |
198 | NEQ = 0x76, | 198 | NEQ = 0x76, |
199 | LEQ = 0x77, | 199 | LEQ = 0x77, |
200 | GEQ = 0x78, | 200 | GEQ = 0x78, |
201 | LESS = 0x79, | 201 | LESS = 0x79, |
202 | GREATER = 0x7a, | 202 | GREATER = 0x7a, |
203 | BITAND = 0x7b, | 203 | BITAND = 0x7b, |
204 | BITOR = 0x7c, | 204 | BITOR = 0x7c, |
205 | BITXOR = 0x7d, | 205 | BITXOR = 0x7d, |
206 | BOOLAND = 0x7e, | 206 | BOOLAND = 0x7e, |
207 | BOOLOR = 0x7f, | 207 | BOOLOR = 0x7f, |
208 | NEG = 0x80, | 208 | NEG = 0x80, |
209 | BITNOT = 0x81, | 209 | BITNOT = 0x81, |
210 | BOOLNOT = 0x82, | 210 | BOOLNOT = 0x82, |
211 | JUMP = 0x90, | 211 | JUMP = 0x90, |
212 | JUMPIF = 0x91, | 212 | JUMPIF = 0x91, |
213 | JUMPNIF = 0x92, | 213 | JUMPNIF = 0x92, |
214 | STATE = 0x93, | 214 | STATE = 0x93, |
215 | CALL = 0x94, | 215 | CALL = 0x94, |
216 | RETURN = 0x95, | 216 | RETURN = 0x95, |
217 | CAST = 0xa0, | 217 | CAST = 0xa0, |
218 | STACKTOS = 0xb0, | 218 | STACKTOS = 0xb0, |
219 | STACKTOL = 0xb1, | 219 | STACKTOL = 0xb1, |
220 | PRINT = 0xc0, | 220 | PRINT = 0xc0, |
221 | CALLLIB = 0xd0, | 221 | CALLLIB = 0xd0, |
222 | CALLLIB_TWO_BYTE = 0xd1, | 222 | CALLLIB_TWO_BYTE = 0xd1, |
223 | SHL = 0xe0, | 223 | SHL = 0xe0, |
224 | SHR = 0xe1 | 224 | SHR = 0xe1 |
225 | } | 225 | } |
226 | 226 | ||
227 | [Serializable] | 227 | [Serializable] |
228 | public enum BuiltIn_Functions | 228 | public enum BuiltIn_Functions |
229 | { | 229 | { |
230 | llSin = 0, | 230 | llSin = 0, |
231 | llCos = 1, | 231 | llCos = 1, |
232 | llTan = 2, | 232 | llTan = 2, |
233 | llAtan2 = 3, | 233 | llAtan2 = 3, |
234 | llSqrt = 4, | 234 | llSqrt = 4, |
235 | llPow = 5, | 235 | llPow = 5, |
236 | llAbs = 6, | 236 | llAbs = 6, |
237 | llFabs = 7, | 237 | llFabs = 7, |
238 | llFrand = 8, | 238 | llFrand = 8, |
239 | llFloor = 9, | 239 | llFloor = 9, |
240 | llCeil = 10, | 240 | llCeil = 10, |
241 | llRound = 11, | 241 | llRound = 11, |
242 | llVecMag = 12, | 242 | llVecMag = 12, |
243 | llVecNorm = 13, | 243 | llVecNorm = 13, |
244 | llVecDist = 14, | 244 | llVecDist = 14, |
245 | llRot2Euler = 15, | 245 | llRot2Euler = 15, |
246 | llEuler2Rot = 16, | 246 | llEuler2Rot = 16, |
247 | llAxes2Rot = 17, | 247 | llAxes2Rot = 17, |
248 | llRot2Fwd = 18, | 248 | llRot2Fwd = 18, |
249 | llRot2Left = 19, | 249 | llRot2Left = 19, |
250 | llRot2Up = 20, | 250 | llRot2Up = 20, |
251 | llRotBetween = 21, | 251 | llRotBetween = 21, |
252 | llWhisper = 22, | 252 | llWhisper = 22, |
253 | llSay = 23, | 253 | llSay = 23, |
254 | llShout = 24, | 254 | llShout = 24, |
255 | llListen = 25, | 255 | llListen = 25, |
256 | llListenControl = 26, | 256 | llListenControl = 26, |
257 | llListenRemove = 27, | 257 | llListenRemove = 27, |
258 | llSensor = 28, | 258 | llSensor = 28, |
259 | llSensorRepeat = 29, | 259 | llSensorRepeat = 29, |
260 | llSensorRemove = 30, | 260 | llSensorRemove = 30, |
261 | llDetectedName = 31, | 261 | llDetectedName = 31, |
262 | llDetectedKey = 32, | 262 | llDetectedKey = 32, |
263 | llDetectedOwner = 33, | 263 | llDetectedOwner = 33, |
264 | llDetectedType = 34, | 264 | llDetectedType = 34, |
265 | llDetectedPos = 35, | 265 | llDetectedPos = 35, |
266 | llDetectedVel = 36, | 266 | llDetectedVel = 36, |
267 | llDetectedGrab = 37, | 267 | llDetectedGrab = 37, |
268 | llDetectedRot = 38, | 268 | llDetectedRot = 38, |
269 | llDetectedGroup = 39, | 269 | llDetectedGroup = 39, |
270 | llDetectedLinkNumber = 40, | 270 | llDetectedLinkNumber = 40, |
271 | llDie = 41, | 271 | llDie = 41, |
272 | llGround = 42, | 272 | llGround = 42, |
273 | llCloud = 43, | 273 | llCloud = 43, |
274 | llWind = 44, | 274 | llWind = 44, |
275 | llSetStatus = 45, | 275 | llSetStatus = 45, |
276 | llGetStatus = 46, | 276 | llGetStatus = 46, |
277 | llSetScale = 47, | 277 | llSetScale = 47, |
278 | llGetScale = 48, | 278 | llGetScale = 48, |
279 | llSetColor = 49, | 279 | llSetColor = 49, |
280 | llGetAlpha = 50, | 280 | llGetAlpha = 50, |
281 | llSetAlpha = 51, | 281 | llSetAlpha = 51, |
282 | llGetColor = 52, | 282 | llGetColor = 52, |
283 | llSetTexture = 53, | 283 | llSetTexture = 53, |
284 | llScaleTexture = 54, | 284 | llScaleTexture = 54, |
285 | llOffsetTexture = 55, | 285 | llOffsetTexture = 55, |
286 | llRotateTexture = 56, | 286 | llRotateTexture = 56, |
287 | llGetTexture = 57, | 287 | llGetTexture = 57, |
288 | llSetPos = 58, | 288 | llSetPos = 58, |
289 | llGetPos = 59, | 289 | llGetPos = 59, |
290 | llGetLocalPos = 60, | 290 | llGetLocalPos = 60, |
291 | llSetRot = 61, | 291 | llSetRot = 61, |
292 | llGetRot = 62, | 292 | llGetRot = 62, |
293 | llGetLocalRot = 63, | 293 | llGetLocalRot = 63, |
294 | llSetForce = 64, | 294 | llSetForce = 64, |
295 | llGetForce = 65, | 295 | llGetForce = 65, |
296 | llTarget = 66, | 296 | llTarget = 66, |
297 | llTargetRemove = 67, | 297 | llTargetRemove = 67, |
298 | llRotTarget = 68, | 298 | llRotTarget = 68, |
299 | llRotTargetRemove = 69, | 299 | llRotTargetRemove = 69, |
300 | llMoveToTarget = 70, | 300 | llMoveToTarget = 70, |
301 | llStopMoveToTarget = 71, | 301 | llStopMoveToTarget = 71, |
302 | llApplyImpulse = 72, | 302 | llApplyImpulse = 72, |
303 | llApplyRotationalImpulse = 73, | 303 | llApplyRotationalImpulse = 73, |
304 | llSetTorque = 74, | 304 | llSetTorque = 74, |
305 | llGetTorque = 75, | 305 | llGetTorque = 75, |
306 | llSetForceAndTorque = 76, | 306 | llSetForceAndTorque = 76, |
307 | llGetVel = 77, | 307 | llGetVel = 77, |
308 | llGetAccel = 78, | 308 | llGetAccel = 78, |
309 | llGetOmega = 79, | 309 | llGetOmega = 79, |
310 | llGetTimeOfDay = 80, | 310 | llGetTimeOfDay = 80, |
311 | llGetWallclock = 81, | 311 | llGetWallclock = 81, |
312 | llGetTime = 82, | 312 | llGetTime = 82, |
313 | llResetTime = 83, | 313 | llResetTime = 83, |
314 | llGetAndResetTime = 84, | 314 | llGetAndResetTime = 84, |
315 | llSound = 85, | 315 | llSound = 85, |
316 | llPlaySound = 86, | 316 | llPlaySound = 86, |
317 | llLoopSound = 87, | 317 | llLoopSound = 87, |
318 | llLoopSoundMaster = 88, | 318 | llLoopSoundMaster = 88, |
319 | llLoopSoundSlave = 89, | 319 | llLoopSoundSlave = 89, |
320 | llPlaySoundSlave = 90, | 320 | llPlaySoundSlave = 90, |
321 | llTriggerSound = 91, | 321 | llTriggerSound = 91, |
322 | llStopSound = 92, | 322 | llStopSound = 92, |
323 | llPreloadSound = 93, | 323 | llPreloadSound = 93, |
324 | llGetSubString = 94, | 324 | llGetSubString = 94, |
325 | llDeleteSubString = 95, | 325 | llDeleteSubString = 95, |
326 | llInsertString = 96, | 326 | llInsertString = 96, |
327 | llToUpper = 97, | 327 | llToUpper = 97, |
328 | llToLower = 98, | 328 | llToLower = 98, |
329 | llGiveMoney = 99, | 329 | llGiveMoney = 99, |
330 | llMakeExplosion = 100, | 330 | llMakeExplosion = 100, |
331 | llMakeFountain = 101, | 331 | llMakeFountain = 101, |
332 | llMakeSmoke = 102, | 332 | llMakeSmoke = 102, |
333 | llMakeFire = 103, | 333 | llMakeFire = 103, |
334 | llRezObject = 104, | 334 | llRezObject = 104, |
335 | llLookAt = 105, | 335 | llLookAt = 105, |
336 | llStopLookAt = 106, | 336 | llStopLookAt = 106, |
337 | llSetTimerEvent = 107, | 337 | llSetTimerEvent = 107, |
338 | llSleep = 108, | 338 | llSleep = 108, |
339 | llGetMass = 109, | 339 | llGetMass = 109, |
340 | llCollisionFilter = 110, | 340 | llCollisionFilter = 110, |
341 | llTakeControls = 111, | 341 | llTakeControls = 111, |
342 | llReleaseControls = 112, | 342 | llReleaseControls = 112, |
343 | llAttachToAvatar = 113, | 343 | llAttachToAvatar = 113, |
344 | llDetachFromAvatar = 114, | 344 | llDetachFromAvatar = 114, |
345 | llTakeCamera = 115, | 345 | llTakeCamera = 115, |
346 | llReleaseCamera = 116, | 346 | llReleaseCamera = 116, |
347 | llGetOwner = 117, | 347 | llGetOwner = 117, |
348 | llInstantMessage = 118, | 348 | llInstantMessage = 118, |
349 | llEmail = 119, | 349 | llEmail = 119, |
350 | llGetNextEmail = 120, | 350 | llGetNextEmail = 120, |
351 | llGetKey = 121, | 351 | llGetKey = 121, |
352 | llSetBuoyancy = 122, | 352 | llSetBuoyancy = 122, |
353 | llSetHoverHeight = 123, | 353 | llSetHoverHeight = 123, |
354 | llStopHover = 124, | 354 | llStopHover = 124, |
355 | llMinEventDelay = 125, | 355 | llMinEventDelay = 125, |
356 | llSoundPreload = 126, | 356 | llSoundPreload = 126, |
357 | llRotLookAt = 127, | 357 | llRotLookAt = 127, |
358 | llStringLength = 128, | 358 | llStringLength = 128, |
359 | llStartAnimation = 129, | 359 | llStartAnimation = 129, |
360 | llStopAnimation = 130, | 360 | llStopAnimation = 130, |
361 | llPointAt = 131, | 361 | llPointAt = 131, |
362 | llStopPointAt = 132, | 362 | llStopPointAt = 132, |
363 | llTargetOmega = 133, | 363 | llTargetOmega = 133, |
364 | llGetStartParameter = 134, | 364 | llGetStartParameter = 134, |
365 | llGodLikeRezObject = 135, | 365 | llGodLikeRezObject = 135, |
366 | llRequestPermissions = 136, | 366 | llRequestPermissions = 136, |
367 | llGetPermissionsKey = 137, | 367 | llGetPermissionsKey = 137, |
368 | llGetPermissions = 138, | 368 | llGetPermissions = 138, |
369 | llGetLinkNumber = 139, | 369 | llGetLinkNumber = 139, |
370 | llSetLinkColor = 140, | 370 | llSetLinkColor = 140, |
371 | llCreateLink = 141, | 371 | llCreateLink = 141, |
372 | llBreakLink = 142, | 372 | llBreakLink = 142, |
373 | llBreakAllLinks = 143, | 373 | llBreakAllLinks = 143, |
374 | llGetLinkKey = 144, | 374 | llGetLinkKey = 144, |
375 | llGetLinkName = 145, | 375 | llGetLinkName = 145, |
376 | llGetInventoryNumber = 146, | 376 | llGetInventoryNumber = 146, |
377 | llGetInventoryName = 147, | 377 | llGetInventoryName = 147, |
378 | llSetScriptState = 148, | 378 | llSetScriptState = 148, |
379 | llGetEnergy = 149, | 379 | llGetEnergy = 149, |
380 | llGiveInventory = 150, | 380 | llGiveInventory = 150, |
381 | llRemoveInventory = 151, | 381 | llRemoveInventory = 151, |
382 | llSetText = 152, | 382 | llSetText = 152, |
383 | llWater = 153, | 383 | llWater = 153, |
384 | llPassTouches = 154, | 384 | llPassTouches = 154, |
385 | llRequestAgentData = 155, | 385 | llRequestAgentData = 155, |
386 | llRequestInventoryData = 156, | 386 | llRequestInventoryData = 156, |
387 | llSetDamage = 157, | 387 | llSetDamage = 157, |
388 | llTeleportAgentHome = 158, | 388 | llTeleportAgentHome = 158, |
389 | llModifyLand = 159, | 389 | llModifyLand = 159, |
390 | llCollisionSound = 160, | 390 | llCollisionSound = 160, |
391 | llCollisionSprite = 161, | 391 | llCollisionSprite = 161, |
392 | llGetAnimation = 162, | 392 | llGetAnimation = 162, |
393 | llResetScript = 163, | 393 | llResetScript = 163, |
394 | llMessageLinked = 164, | 394 | llMessageLinked = 164, |
395 | llPushObject = 165, | 395 | llPushObject = 165, |
396 | llPassCollisions = 166, | 396 | llPassCollisions = 166, |
397 | llGetScriptName = 167, | 397 | llGetScriptName = 167, |
398 | llGetNumberOfSides = 168, | 398 | llGetNumberOfSides = 168, |
399 | llAxisAngle2Rot = 169, | 399 | llAxisAngle2Rot = 169, |
400 | llRot2Axis = 170, | 400 | llRot2Axis = 170, |
401 | llRot2Angle = 171, | 401 | llRot2Angle = 171, |
402 | llAcos = 172, | 402 | llAcos = 172, |
403 | llAsin = 173, | 403 | llAsin = 173, |
404 | llAngleBetween = 174, | 404 | llAngleBetween = 174, |
405 | llGetInventoryKey = 175, | 405 | llGetInventoryKey = 175, |
406 | llAllowInventoryDrop = 176, | 406 | llAllowInventoryDrop = 176, |
407 | llGetSunDirection = 177, | 407 | llGetSunDirection = 177, |
408 | llGetTextureOffset = 178, | 408 | llGetTextureOffset = 178, |
409 | llGetTextureScale = 179, | 409 | llGetTextureScale = 179, |
410 | llGetTextureRot = 180, | 410 | llGetTextureRot = 180, |
411 | llSubStringIndex = 181, | 411 | llSubStringIndex = 181, |
412 | llGetOwnerKey = 182, | 412 | llGetOwnerKey = 182, |
413 | llGetCenterOfMass = 183, | 413 | llGetCenterOfMass = 183, |
414 | llListSort = 184, | 414 | llListSort = 184, |
415 | llGetListLength = 185, | 415 | llGetListLength = 185, |
416 | llList2Integer = 186, | 416 | llList2Integer = 186, |
417 | llList2Float = 187, | 417 | llList2Float = 187, |
418 | llList2String = 188, | 418 | llList2String = 188, |
419 | llList2Key = 189, | 419 | llList2Key = 189, |
420 | llList2Vector = 190, | 420 | llList2Vector = 190, |
421 | llList2Rot = 191, | 421 | llList2Rot = 191, |
422 | llList2List = 192, | 422 | llList2List = 192, |
423 | llDeleteSubList = 193, | 423 | llDeleteSubList = 193, |
424 | llGetListEntryType = 194, | 424 | llGetListEntryType = 194, |
425 | llList2CSV = 195, | 425 | llList2CSV = 195, |
426 | llCSV2List = 196, | 426 | llCSV2List = 196, |
427 | llListRandomize = 197, | 427 | llListRandomize = 197, |
428 | llList2ListStrided = 198, | 428 | llList2ListStrided = 198, |
429 | llGetRegionCorner = 199, | 429 | llGetRegionCorner = 199, |
430 | llListInsertList = 200, | 430 | llListInsertList = 200, |
431 | llListFindList = 201, | 431 | llListFindList = 201, |
432 | llGetObjectName = 202, | 432 | llGetObjectName = 202, |
433 | llSetObjectName = 203, | 433 | llSetObjectName = 203, |
434 | llGetDate = 204, | 434 | llGetDate = 204, |
435 | llEdgeOfWorld = 205, | 435 | llEdgeOfWorld = 205, |
436 | llGetAgentInfo = 206, | 436 | llGetAgentInfo = 206, |
437 | llAdjustSoundVolume = 207, | 437 | llAdjustSoundVolume = 207, |
438 | llSetSoundQueueing = 208, | 438 | llSetSoundQueueing = 208, |
439 | llSetSoundRadius = 209, | 439 | llSetSoundRadius = 209, |
440 | llKey2Name = 210, | 440 | llKey2Name = 210, |
441 | llSetTextureAnim = 211, | 441 | llSetTextureAnim = 211, |
442 | llTriggerSoundLimited = 212, | 442 | llTriggerSoundLimited = 212, |
443 | llEjectFromLand = 213, | 443 | llEjectFromLand = 213, |
444 | llParseString2List = 214, | 444 | llParseString2List = 214, |
445 | llOverMyLand = 215, | 445 | llOverMyLand = 215, |
446 | llGetLandOwnerAt = 216, | 446 | llGetLandOwnerAt = 216, |
447 | llGetNotecardLine = 217, | 447 | llGetNotecardLine = 217, |
448 | llGetAgentSize = 218, | 448 | llGetAgentSize = 218, |
449 | llSameGroup = 219, | 449 | llSameGroup = 219, |
450 | llUnSit = 220, | 450 | llUnSit = 220, |
451 | llGroundSlope = 221, | 451 | llGroundSlope = 221, |
452 | llGroundNormal = 222, | 452 | llGroundNormal = 222, |
453 | llGroundContour = 223, | 453 | llGroundContour = 223, |
454 | llGetAttached = 224, | 454 | llGetAttached = 224, |
455 | llGetFreeMemory = 225, | 455 | llGetFreeMemory = 225, |
456 | llGetRegionName = 226, | 456 | llGetRegionName = 226, |
457 | llGetRegionTimeDilation = 227, | 457 | llGetRegionTimeDilation = 227, |
458 | llGetRegionFPS = 228, | 458 | llGetRegionFPS = 228, |
459 | llParticleSystem = 229, | 459 | llParticleSystem = 229, |
460 | llGroundRepel = 230, | 460 | llGroundRepel = 230, |
461 | llGiveInventoryList = 231, | 461 | llGiveInventoryList = 231, |
462 | llSetVehicleType = 232, | 462 | llSetVehicleType = 232, |
463 | llSetVehicleFloatParam = 233, | 463 | llSetVehicleFloatParam = 233, |
464 | llSetVehicleVectorParam = 234, | 464 | llSetVehicleVectorParam = 234, |
465 | llSetVehicleRotationParam = 235, | 465 | llSetVehicleRotationParam = 235, |
466 | llSetVehicleFlags = 236, | 466 | llSetVehicleFlags = 236, |
467 | llRemoveVehicleFlags = 237, | 467 | llRemoveVehicleFlags = 237, |
468 | llSitTarget = 238, | 468 | llSitTarget = 238, |
469 | llAvatarOnSitTarget = 239, | 469 | llAvatarOnSitTarget = 239, |
470 | llAddToLandPassList = 240, | 470 | llAddToLandPassList = 240, |
471 | llSetTouchText = 241, | 471 | llSetTouchText = 241, |
472 | llSetSitText = 242, | 472 | llSetSitText = 242, |
473 | llSetCameraEyeOffset = 243, | 473 | llSetCameraEyeOffset = 243, |
474 | llSetCameraAtOffset = 244, | 474 | llSetCameraAtOffset = 244, |
475 | llDumpList2String = 245, | 475 | llDumpList2String = 245, |
476 | llScriptDanger = 246, | 476 | llScriptDanger = 246, |
477 | llDialog = 247, | 477 | llDialog = 247, |
478 | llVolumeDetect = 248, | 478 | llVolumeDetect = 248, |
479 | llResetOtherScript = 249, | 479 | llResetOtherScript = 249, |
480 | llGetScriptState = 250, | 480 | llGetScriptState = 250, |
481 | llRemoteLoadScript = 251, | 481 | llRemoteLoadScript = 251, |
482 | llSetRemoteScriptAccessPin = 252, | 482 | llSetRemoteScriptAccessPin = 252, |
483 | llRemoteLoadScriptPin = 253, | 483 | llRemoteLoadScriptPin = 253, |
484 | llOpenRemoteDataChannel = 254, | 484 | llOpenRemoteDataChannel = 254, |
485 | llSendRemoteData = 255, | 485 | llSendRemoteData = 255, |
486 | llRemoteDataReply = 256, | 486 | llRemoteDataReply = 256, |
487 | llCloseRemoteDataChannel = 257, | 487 | llCloseRemoteDataChannel = 257, |
488 | llMD5String = 258, | 488 | llMD5String = 258, |
489 | llSetPrimitiveParams = 259, | 489 | llSetPrimitiveParams = 259, |
490 | llStringToBase64 = 260, | 490 | llStringToBase64 = 260, |
491 | llBase64ToString = 261, | 491 | llBase64ToString = 261, |
492 | llXorBase64Strings = 262, | 492 | llXorBase64Strings = 262, |
493 | llRemoteDataSetRegion = 263, | 493 | llRemoteDataSetRegion = 263, |
494 | llLog10 = 264, | 494 | llLog10 = 264, |
495 | llLog = 265, | 495 | llLog = 265, |
496 | llGetAnimationList = 266, | 496 | llGetAnimationList = 266, |
497 | llSetParcelMusicURL = 267, | 497 | llSetParcelMusicURL = 267, |
498 | llGetRootPosition = 268, | 498 | llGetRootPosition = 268, |
499 | llGetRootRotation = 269, | 499 | llGetRootRotation = 269, |
500 | llGetObjectDesc = 270, | 500 | llGetObjectDesc = 270, |
501 | llSetObjectDesc = 271, | 501 | llSetObjectDesc = 271, |
502 | llGetCreator = 272, | 502 | llGetCreator = 272, |
503 | llGetTimestamp = 273, | 503 | llGetTimestamp = 273, |
504 | llSetLinkAlpha = 274, | 504 | llSetLinkAlpha = 274, |
505 | llGetNumberOfPrims = 275, | 505 | llGetNumberOfPrims = 275, |
506 | llGetNumberOfNotecardLines = 276, | 506 | llGetNumberOfNotecardLines = 276, |
507 | llGetBoundingBox = 277, | 507 | llGetBoundingBox = 277, |
508 | llGetGeometricCenter = 278, | 508 | llGetGeometricCenter = 278, |
509 | llGetPrimitiveParams = 279, | 509 | llGetPrimitiveParams = 279, |
510 | llIntegerToBase64 = 280, | 510 | llIntegerToBase64 = 280, |
511 | llBase64ToInteger = 281, | 511 | llBase64ToInteger = 281, |
512 | llGetGMTclock = 282, | 512 | llGetGMTclock = 282, |
513 | llGetSimulatorHostname = 283, | 513 | llGetSimulatorHostname = 283, |
514 | llSetLocalRot = 284, | 514 | llSetLocalRot = 284, |
515 | llParseStringKeepNulls = 285, | 515 | llParseStringKeepNulls = 285, |
516 | llRezAtRoot = 286, | 516 | llRezAtRoot = 286, |
517 | llGetObjectPermMask = 287, | 517 | llGetObjectPermMask = 287, |
518 | llSetObjectPermMask = 288, | 518 | llSetObjectPermMask = 288, |
519 | llGetInventoryPermMask = 289, | 519 | llGetInventoryPermMask = 289, |
520 | llSetInventoryPermMask = 290, | 520 | llSetInventoryPermMask = 290, |
521 | llGetInventoryCreator = 291, | 521 | llGetInventoryCreator = 291, |
522 | llOwnerSay = 292, | 522 | llOwnerSay = 292, |
523 | llRequestSimulatorData = 293, | 523 | llRequestSimulatorData = 293, |
524 | llForceMouselook = 294, | 524 | llForceMouselook = 294, |
525 | llGetObjectMass = 295, | 525 | llGetObjectMass = 295, |
526 | llListReplaceList = 296, | 526 | llListReplaceList = 296, |
527 | llLoadURL = 297, | 527 | llLoadURL = 297, |
528 | llParcelMediaCommandList = 298, | 528 | llParcelMediaCommandList = 298, |
529 | llParcelMediaQuery = 299, | 529 | llParcelMediaQuery = 299, |
530 | llModPow = 300, | 530 | llModPow = 300, |
531 | llGetInventoryType = 301, | 531 | llGetInventoryType = 301, |
532 | llSetPayPrice = 302, | 532 | llSetPayPrice = 302, |
533 | llGetCameraPos = 303, | 533 | llGetCameraPos = 303, |
534 | llGetCameraRot = 304, | 534 | llGetCameraRot = 304, |
535 | llSetPrimURL = 305, | 535 | llSetPrimURL = 305, |
536 | llRefreshPrimURL = 306, | 536 | llRefreshPrimURL = 306, |
537 | llEscapeURL = 307, | 537 | llEscapeURL = 307, |
538 | llUnescapeURL = 308, | 538 | llUnescapeURL = 308, |
539 | llMapDestination = 309, | 539 | llMapDestination = 309, |
540 | llAddToLandBanList = 310, | 540 | llAddToLandBanList = 310, |
541 | llRemoveFromLandPassList = 311, | 541 | llRemoveFromLandPassList = 311, |
542 | llRemoveFromLandBanList = 312, | 542 | llRemoveFromLandBanList = 312, |
543 | llSetCameraParams = 313, | 543 | llSetCameraParams = 313, |
544 | llClearCameraParams = 314, | 544 | llClearCameraParams = 314, |
545 | llListStatistics = 315, | 545 | llListStatistics = 315, |
546 | llGetUnixTime = 316, | 546 | llGetUnixTime = 316, |
547 | llGetParcelFlags = 317, | 547 | llGetParcelFlags = 317, |
548 | llGetRegionFlags = 318, | 548 | llGetRegionFlags = 318, |
549 | llXorBase64StringsCorrect = 319, | 549 | llXorBase64StringsCorrect = 319, |
550 | llHTTPRequest = 320, | 550 | llHTTPRequest = 320, |
551 | llResetLandBanList = 321, | 551 | llResetLandBanList = 321, |
552 | llResetLandPassList = 322, | 552 | llResetLandPassList = 322, |
553 | llGetParcelPrimCount = 323, | 553 | llGetParcelPrimCount = 323, |
554 | llGetParcelPrimOwners = 324, | 554 | llGetParcelPrimOwners = 324, |
555 | llGetObjectPrimCount = 325, | 555 | llGetObjectPrimCount = 325, |
556 | llGetParcelMaxPrims = 326, | 556 | llGetParcelMaxPrims = 326, |
557 | llGetParcelDetails = 327 | 557 | llGetParcelDetails = 327 |
558 | } | 558 | } |
559 | } | 559 | } |
560 | } \ No newline at end of file | 560 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs index 1d3992f..d0cc0f9 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs | |||
@@ -1,729 +1,729 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Reflection.Emit; | 34 | using System.Reflection.Emit; |
35 | using System.Text; | 35 | using System.Text; |
36 | using OpenSim.Region.ScriptEngine.LSOEngine.LSO; | 36 | using OpenSim.Region.ScriptEngine.LSOEngine.LSO; |
37 | 37 | ||
38 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 38 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
39 | { | 39 | { |
40 | internal partial class LSO_Parser | 40 | internal partial class LSO_Parser |
41 | { | 41 | { |
42 | private string FileName; | 42 | private string FileName; |
43 | private FileStream fs; | 43 | private FileStream fs; |
44 | private BinaryReader br; | 44 | private BinaryReader br; |
45 | internal LSO_Struct.Header myHeader; | 45 | internal LSO_Struct.Header myHeader; |
46 | internal Dictionary<long, LSO_Struct.StaticBlock> StaticBlocks = new Dictionary<long, LSO_Struct.StaticBlock>(); | 46 | internal Dictionary<long, LSO_Struct.StaticBlock> StaticBlocks = new Dictionary<long, LSO_Struct.StaticBlock>(); |
47 | //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); | 47 | //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); |
48 | 48 | ||
49 | private TypeBuilder typeBuilder; | 49 | private TypeBuilder typeBuilder; |
50 | private List<string> EventList = new List<string>(); | 50 | private List<string> EventList = new List<string>(); |
51 | 51 | ||
52 | public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) | 52 | public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) |
53 | { | 53 | { |
54 | FileName = _FileName; | 54 | FileName = _FileName; |
55 | typeBuilder = _typeBuilder; | 55 | typeBuilder = _typeBuilder; |
56 | } | 56 | } |
57 | 57 | ||
58 | internal void OpenFile() | 58 | internal void OpenFile() |
59 | { | 59 | { |
60 | // Open | 60 | // Open |
61 | Common.SendToDebug("Opening filename: " + FileName); | 61 | Common.SendToDebug("Opening filename: " + FileName); |
62 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); | 62 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); |
63 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); | 63 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); |
64 | } | 64 | } |
65 | 65 | ||
66 | internal void CloseFile() | 66 | internal void CloseFile() |
67 | { | 67 | { |
68 | // Close | 68 | // Close |
69 | br.Close(); | 69 | br.Close(); |
70 | fs.Close(); | 70 | fs.Close(); |
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Parse LSO file. | 75 | /// Parse LSO file. |
76 | /// </summary> | 76 | /// </summary> |
77 | public void Parse() | 77 | public void Parse() |
78 | { | 78 | { |
79 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. | 79 | // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. |
80 | 80 | ||
81 | 81 | ||
82 | // HEADER BLOCK | 82 | // HEADER BLOCK |
83 | Common.SendToDebug("Reading HEADER BLOCK at: 0"); | 83 | Common.SendToDebug("Reading HEADER BLOCK at: 0"); |
84 | fs.Seek(0, SeekOrigin.Begin); | 84 | fs.Seek(0, SeekOrigin.Begin); |
85 | myHeader = new LSO_Struct.Header(); | 85 | myHeader = new LSO_Struct.Header(); |
86 | myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); | 86 | myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); |
87 | myHeader.IP = BitConverter.ToUInt32(br_read(4), 0); | 87 | myHeader.IP = BitConverter.ToUInt32(br_read(4), 0); |
88 | myHeader.VN = BitConverter.ToUInt32(br_read(4), 0); | 88 | myHeader.VN = BitConverter.ToUInt32(br_read(4), 0); |
89 | myHeader.BP = BitConverter.ToUInt32(br_read(4), 0); | 89 | myHeader.BP = BitConverter.ToUInt32(br_read(4), 0); |
90 | myHeader.SP = BitConverter.ToUInt32(br_read(4), 0); | 90 | myHeader.SP = BitConverter.ToUInt32(br_read(4), 0); |
91 | myHeader.HR = BitConverter.ToUInt32(br_read(4), 0); | 91 | myHeader.HR = BitConverter.ToUInt32(br_read(4), 0); |
92 | myHeader.HP = BitConverter.ToUInt32(br_read(4), 0); | 92 | myHeader.HP = BitConverter.ToUInt32(br_read(4), 0); |
93 | myHeader.CS = BitConverter.ToUInt32(br_read(4), 0); | 93 | myHeader.CS = BitConverter.ToUInt32(br_read(4), 0); |
94 | myHeader.NS = BitConverter.ToUInt32(br_read(4), 0); | 94 | myHeader.NS = BitConverter.ToUInt32(br_read(4), 0); |
95 | myHeader.CE = BitConverter.ToUInt32(br_read(4), 0); | 95 | myHeader.CE = BitConverter.ToUInt32(br_read(4), 0); |
96 | myHeader.IE = BitConverter.ToUInt32(br_read(4), 0); | 96 | myHeader.IE = BitConverter.ToUInt32(br_read(4), 0); |
97 | myHeader.ER = BitConverter.ToUInt32(br_read(4), 0); | 97 | myHeader.ER = BitConverter.ToUInt32(br_read(4), 0); |
98 | myHeader.FR = BitConverter.ToUInt32(br_read(4), 0); | 98 | myHeader.FR = BitConverter.ToUInt32(br_read(4), 0); |
99 | myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0); | 99 | myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0); |
100 | myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0); | 100 | myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0); |
101 | myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0); | 101 | myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0); |
102 | myHeader.PR = BitConverter.ToUInt32(br_read(4), 0); | 102 | myHeader.PR = BitConverter.ToUInt32(br_read(4), 0); |
103 | myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0); | 103 | myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0); |
104 | myHeader.SR = BitConverter.ToUInt32(br_read(4), 0); | 104 | myHeader.SR = BitConverter.ToUInt32(br_read(4), 0); |
105 | myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0); | 105 | myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0); |
106 | myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0); | 106 | myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0); |
107 | myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); | 107 | myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); |
108 | 108 | ||
109 | // Print Header Block to debug | 109 | // Print Header Block to debug |
110 | Common.SendToDebug("TM - Top of memory (size): " + myHeader.TM); | 110 | Common.SendToDebug("TM - Top of memory (size): " + myHeader.TM); |
111 | Common.SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); | 111 | Common.SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); |
112 | Common.SendToDebug("VN - Version number: " + myHeader.VN); | 112 | Common.SendToDebug("VN - Version number: " + myHeader.VN); |
113 | Common.SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); | 113 | Common.SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); |
114 | Common.SendToDebug("SP - Stack Pointer: " + myHeader.SP); | 114 | Common.SendToDebug("SP - Stack Pointer: " + myHeader.SP); |
115 | Common.SendToDebug("HR - Heap Register: " + myHeader.HR); | 115 | Common.SendToDebug("HR - Heap Register: " + myHeader.HR); |
116 | Common.SendToDebug("HP - Heap Pointer: " + myHeader.HP); | 116 | Common.SendToDebug("HP - Heap Pointer: " + myHeader.HP); |
117 | Common.SendToDebug("CS - Current State: " + myHeader.CS); | 117 | Common.SendToDebug("CS - Current State: " + myHeader.CS); |
118 | Common.SendToDebug("NS - Next State: " + myHeader.NS); | 118 | Common.SendToDebug("NS - Next State: " + myHeader.NS); |
119 | Common.SendToDebug("CE - Current Events: " + myHeader.CE); | 119 | Common.SendToDebug("CE - Current Events: " + myHeader.CE); |
120 | Common.SendToDebug("IE - In Event: " + myHeader.IE); | 120 | Common.SendToDebug("IE - In Event: " + myHeader.IE); |
121 | Common.SendToDebug("ER - Event Register: " + myHeader.ER); | 121 | Common.SendToDebug("ER - Event Register: " + myHeader.ER); |
122 | Common.SendToDebug("FR - Fault Register: " + myHeader.FR); | 122 | Common.SendToDebug("FR - Fault Register: " + myHeader.FR); |
123 | Common.SendToDebug("SLR - Sleep Register: " + myHeader.SLR); | 123 | Common.SendToDebug("SLR - Sleep Register: " + myHeader.SLR); |
124 | Common.SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); | 124 | Common.SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); |
125 | Common.SendToDebug("GFR - Global Function Register: " + myHeader.GFR); | 125 | Common.SendToDebug("GFR - Global Function Register: " + myHeader.GFR); |
126 | Common.SendToDebug("PR - Parameter Register: " + myHeader.PR); | 126 | Common.SendToDebug("PR - Parameter Register: " + myHeader.PR); |
127 | Common.SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); | 127 | Common.SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); |
128 | Common.SendToDebug("SR - State Register: " + myHeader.SR); | 128 | Common.SendToDebug("SR - State Register: " + myHeader.SR); |
129 | Common.SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); | 129 | Common.SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); |
130 | Common.SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); | 130 | Common.SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); |
131 | Common.SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); | 131 | Common.SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); |
132 | Common.SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); | 132 | Common.SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); |
133 | 133 | ||
134 | // STATIC BLOCK | 134 | // STATIC BLOCK |
135 | Common.SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); | 135 | Common.SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); |
136 | fs.Seek(myHeader.GVR, SeekOrigin.Begin); | 136 | fs.Seek(myHeader.GVR, SeekOrigin.Begin); |
137 | int StaticBlockCount = 0; | 137 | int StaticBlockCount = 0; |
138 | // Read function blocks until we hit GFR | 138 | // Read function blocks until we hit GFR |
139 | while (fs.Position < myHeader.GFR) | 139 | while (fs.Position < myHeader.GFR) |
140 | { | 140 | { |
141 | StaticBlockCount++; | 141 | StaticBlockCount++; |
142 | long startReadPos = fs.Position; | 142 | long startReadPos = fs.Position; |
143 | Common.SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + startReadPos); | 143 | Common.SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + startReadPos); |
144 | 144 | ||
145 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); | 145 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); |
146 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 146 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
147 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 147 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
148 | myStaticBlock.ObjectType = br_read(1)[0]; | 148 | myStaticBlock.ObjectType = br_read(1)[0]; |
149 | Common.SendToDebug("Static Block ObjectType: " + | 149 | Common.SendToDebug("Static Block ObjectType: " + |
150 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); | 150 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); |
151 | myStaticBlock.Unknown = br_read(1)[0]; | 151 | myStaticBlock.Unknown = br_read(1)[0]; |
152 | // Size of datatype varies -- what about strings? | 152 | // Size of datatype varies -- what about strings? |
153 | if (myStaticBlock.ObjectType != 0) | 153 | if (myStaticBlock.ObjectType != 0) |
154 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); | 154 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); |
155 | 155 | ||
156 | StaticBlocks.Add((UInt32) startReadPos, myStaticBlock); | 156 | StaticBlocks.Add((UInt32) startReadPos, myStaticBlock); |
157 | } | 157 | } |
158 | Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); | 158 | Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); |
159 | 159 | ||
160 | 160 | ||
161 | // FUNCTION BLOCK | 161 | // FUNCTION BLOCK |
162 | // Always right after STATIC BLOCK | 162 | // Always right after STATIC BLOCK |
163 | LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); | 163 | LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); |
164 | if (myHeader.GFR == myHeader.SR) | 164 | if (myHeader.GFR == myHeader.SR) |
165 | { | 165 | { |
166 | // If GFR and SR are at same position then there is no fuction block | 166 | // If GFR and SR are at same position then there is no fuction block |
167 | Common.SendToDebug("No FUNCTION BLOCK found"); | 167 | Common.SendToDebug("No FUNCTION BLOCK found"); |
168 | } | 168 | } |
169 | else | 169 | else |
170 | { | 170 | { |
171 | Common.SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); | 171 | Common.SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); |
172 | fs.Seek(myHeader.GFR, SeekOrigin.Begin); | 172 | fs.Seek(myHeader.GFR, SeekOrigin.Begin); |
173 | myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); | 173 | myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); |
174 | Common.SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); | 174 | Common.SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); |
175 | if (myFunctionBlock.FunctionCount > 0) | 175 | if (myFunctionBlock.FunctionCount > 0) |
176 | { | 176 | { |
177 | myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; | 177 | myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; |
178 | for (int i = 0; i < myFunctionBlock.FunctionCount; i++) | 178 | for (int i = 0; i < myFunctionBlock.FunctionCount; i++) |
179 | { | 179 | { |
180 | Common.SendToDebug("Reading function " + i + " at: " + fs.Position); | 180 | Common.SendToDebug("Reading function " + i + " at: " + fs.Position); |
181 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) | 181 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) |
182 | // Note! Absolute position | 182 | // Note! Absolute position |
183 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; | 183 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; |
184 | Common.SendToDebug("Fuction " + i + " code chunk position: " + | 184 | Common.SendToDebug("Fuction " + i + " code chunk position: " + |
185 | myFunctionBlock.CodeChunkPointer[i]); | 185 | myFunctionBlock.CodeChunkPointer[i]); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | 190 | ||
191 | // STATE FRAME BLOCK | 191 | // STATE FRAME BLOCK |
192 | // Always right after FUNCTION BLOCK | 192 | // Always right after FUNCTION BLOCK |
193 | Common.SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); | 193 | Common.SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); |
194 | fs.Seek(myHeader.SR, SeekOrigin.Begin); | 194 | fs.Seek(myHeader.SR, SeekOrigin.Begin); |
195 | LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); | 195 | LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); |
196 | myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); | 196 | myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); |
197 | if (myStateFrameBlock.StateCount > 0) | 197 | if (myStateFrameBlock.StateCount > 0) |
198 | { | 198 | { |
199 | // Initialize array | 199 | // Initialize array |
200 | myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; | 200 | myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; |
201 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 201 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
202 | { | 202 | { |
203 | Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); | 203 | Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); |
204 | // Position is relative to state frame | 204 | // Position is relative to state frame |
205 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); | 205 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); |
206 | myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8)); | 206 | myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8)); |
207 | Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); | 207 | Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); |
208 | Common.SendToDebug("Total potential EventMask bits: " + | 208 | Common.SendToDebug("Total potential EventMask bits: " + |
209 | myStateFrameBlock.StatePointer[i].EventMask.Count); | 209 | myStateFrameBlock.StatePointer[i].EventMask.Count); |
210 | 210 | ||
211 | //// Read STATE BLOCK | 211 | //// Read STATE BLOCK |
212 | //long CurPos = fs.Position; | 212 | //long CurPos = fs.Position; |
213 | //fs.Seek(CurPos, SeekOrigin.Begin); | 213 | //fs.Seek(CurPos, SeekOrigin.Begin); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | // STATE BLOCK | 218 | // STATE BLOCK |
219 | // For each StateFrameBlock there is one StateBlock with multiple event handlers | 219 | // For each StateFrameBlock there is one StateBlock with multiple event handlers |
220 | 220 | ||
221 | if (myStateFrameBlock.StateCount > 0) | 221 | if (myStateFrameBlock.StateCount > 0) |
222 | { | 222 | { |
223 | // Go through all State Frame Pointers found | 223 | // Go through all State Frame Pointers found |
224 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 224 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
225 | { | 225 | { |
226 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); | 226 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); |
227 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); | 227 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); |
228 | 228 | ||
229 | // READ: STATE BLOCK HEADER | 229 | // READ: STATE BLOCK HEADER |
230 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); | 230 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); |
231 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note | 231 | myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note |
232 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 232 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
233 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; | 233 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; |
234 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note | 234 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note |
235 | Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); | 235 | Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); |
236 | Common.SendToDebug("State block Header Size: " + | 236 | Common.SendToDebug("State block Header Size: " + |
237 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); | 237 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); |
238 | Common.SendToDebug("State block Header End Pos: " + | 238 | Common.SendToDebug("State block Header End Pos: " + |
239 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos); | 239 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos); |
240 | 240 | ||
241 | // We need to count number of bits flagged in EventMask? | 241 | // We need to count number of bits flagged in EventMask? |
242 | 242 | ||
243 | 243 | ||
244 | // for each bit in myStateFrameBlock.StatePointer[i].EventMask | 244 | // for each bit in myStateFrameBlock.StatePointer[i].EventMask |
245 | 245 | ||
246 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE | 246 | // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE |
247 | //TODO: Create event hooks | 247 | //TODO: Create event hooks |
248 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = | 248 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = |
249 | new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; | 249 | new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; |
250 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 250 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
251 | { | 251 | { |
252 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) | 252 | if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) |
253 | { | 253 | { |
254 | // We got an event | 254 | // We got an event |
255 | // READ: STATE BLOCK HANDLER | 255 | // READ: STATE BLOCK HANDLER |
256 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + | 256 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + |
257 | " (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " + | 257 | " (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " + |
258 | fs.Position); | 258 | fs.Position); |
259 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = | 259 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = |
260 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos + | 260 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos + |
261 | BitConverter.ToUInt32(br_read(4), 0); | 261 | BitConverter.ToUInt32(br_read(4), 0); |
262 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = | 262 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = |
263 | BitConverter.ToUInt32(br_read(4), 0); | 263 | BitConverter.ToUInt32(br_read(4), 0); |
264 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + | 264 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + |
265 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Code Chunk Pointer: " + | 265 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Code Chunk Pointer: " + |
266 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. | 266 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. |
267 | CodeChunkPointer); | 267 | CodeChunkPointer); |
268 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + | 268 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + |
269 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Call Frame Size: " + | 269 | ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Call Frame Size: " + |
270 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. | 270 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii]. |
271 | CallFrameSize); | 271 | CallFrameSize); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | //// READ FUNCTION CODE CHUNKS | 278 | //// READ FUNCTION CODE CHUNKS |
279 | //// Functions + Function start pos (GFR) | 279 | //// Functions + Function start pos (GFR) |
280 | //// TODO: Somehow be able to identify and reference this | 280 | //// TODO: Somehow be able to identify and reference this |
281 | //LSO_Struct.CodeChunk[] myFunctionCodeChunk; | 281 | //LSO_Struct.CodeChunk[] myFunctionCodeChunk; |
282 | //if (myFunctionBlock.FunctionCount > 0) | 282 | //if (myFunctionBlock.FunctionCount > 0) |
283 | //{ | 283 | //{ |
284 | // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; | 284 | // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; |
285 | // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) | 285 | // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) |
286 | // { | 286 | // { |
287 | // Common.SendToDebug("Reading Function Code Chunk " + i); | 287 | // Common.SendToDebug("Reading Function Code Chunk " + i); |
288 | // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); | 288 | // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); |
289 | // } | 289 | // } |
290 | 290 | ||
291 | //} | 291 | //} |
292 | // READ EVENT CODE CHUNKS | 292 | // READ EVENT CODE CHUNKS |
293 | LSO_Struct.CodeChunk[] myEventCodeChunk; | 293 | LSO_Struct.CodeChunk[] myEventCodeChunk; |
294 | if (myStateFrameBlock.StateCount > 0) | 294 | if (myStateFrameBlock.StateCount > 0) |
295 | { | 295 | { |
296 | myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; | 296 | myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount]; |
297 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 297 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
298 | { | 298 | { |
299 | // TODO: Somehow organize events and functions so they can be found again, | 299 | // TODO: Somehow organize events and functions so they can be found again, |
300 | // two level search ain't no good | 300 | // two level search ain't no good |
301 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) | 301 | for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) |
302 | { | 302 | { |
303 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) | 303 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) |
304 | { | 304 | { |
305 | Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + | 305 | Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + |
306 | (LSO_Enums.Event_Mask_Values) ii); | 306 | (LSO_Enums.Event_Mask_Values) ii); |
307 | 307 | ||
308 | 308 | ||
309 | // Override a Method / Function | 309 | // Override a Method / Function |
310 | string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii; | 310 | string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii; |
311 | Common.SendToDebug("Event Name: " + eventname); | 311 | Common.SendToDebug("Event Name: " + eventname); |
312 | if (Common.IL_ProcessCodeChunks) | 312 | if (Common.IL_ProcessCodeChunks) |
313 | { | 313 | { |
314 | EventList.Add(eventname); | 314 | EventList.Add(eventname); |
315 | 315 | ||
316 | // JUMP TO CODE PROCESSOR | 316 | // JUMP TO CODE PROCESSOR |
317 | ProcessCodeChunk( | 317 | ProcessCodeChunk( |
318 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, | 318 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, |
319 | typeBuilder, eventname); | 319 | typeBuilder, eventname); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | } | 322 | } |
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
327 | if (Common.IL_CreateFunctionList) | 327 | if (Common.IL_CreateFunctionList) |
328 | IL_INSERT_FUNCTIONLIST(); | 328 | IL_INSERT_FUNCTIONLIST(); |
329 | } | 329 | } |
330 | 330 | ||
331 | internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) | 331 | internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) |
332 | { | 332 | { |
333 | // HEAP BLOCK | 333 | // HEAP BLOCK |
334 | // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) | 334 | // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) |
335 | Common.SendToDebug("Reading HEAP BLOCK at: " + pos); | 335 | Common.SendToDebug("Reading HEAP BLOCK at: " + pos); |
336 | fs.Seek(pos, SeekOrigin.Begin); | 336 | fs.Seek(pos, SeekOrigin.Begin); |
337 | 337 | ||
338 | LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); | 338 | LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); |
339 | myHeapBlock.DataBlockSize = BitConverter.ToInt32(br_read(4), 0); | 339 | myHeapBlock.DataBlockSize = BitConverter.ToInt32(br_read(4), 0); |
340 | myHeapBlock.ObjectType = br_read(1)[0]; | 340 | myHeapBlock.ObjectType = br_read(1)[0]; |
341 | myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); | 341 | myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); |
342 | //myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); | 342 | //myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); |
343 | // Don't read it reversed | 343 | // Don't read it reversed |
344 | myHeapBlock.Data = new byte[myHeapBlock.DataBlockSize - 1]; | 344 | myHeapBlock.Data = new byte[myHeapBlock.DataBlockSize - 1]; |
345 | br.Read(myHeapBlock.Data, 0, myHeapBlock.DataBlockSize - 1); | 345 | br.Read(myHeapBlock.Data, 0, myHeapBlock.DataBlockSize - 1); |
346 | 346 | ||
347 | 347 | ||
348 | Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); | 348 | Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); |
349 | Common.SendToDebug("Heap Block ObjectType: " + | 349 | Common.SendToDebug("Heap Block ObjectType: " + |
350 | ((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString()); | 350 | ((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString()); |
351 | Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); | 351 | Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); |
352 | 352 | ||
353 | return myHeapBlock; | 353 | return myHeapBlock; |
354 | } | 354 | } |
355 | 355 | ||
356 | private byte[] br_read(int len) | 356 | private byte[] br_read(int len) |
357 | { | 357 | { |
358 | if (len <= 0) | 358 | if (len <= 0) |
359 | return null; | 359 | return null; |
360 | 360 | ||
361 | try | 361 | try |
362 | { | 362 | { |
363 | byte[] bytes = new byte[len]; | 363 | byte[] bytes = new byte[len]; |
364 | for (int i = len - 1; i > -1; i--) | 364 | for (int i = len - 1; i > -1; i--) |
365 | bytes[i] = br.ReadByte(); | 365 | bytes[i] = br.ReadByte(); |
366 | return bytes; | 366 | return bytes; |
367 | } | 367 | } |
368 | catch (Exception e) | 368 | catch (Exception e) |
369 | { | 369 | { |
370 | Common.SendToDebug("Exception: " + e.ToString()); | 370 | Common.SendToDebug("Exception: " + e.ToString()); |
371 | throw (e); | 371 | throw (e); |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | //private byte[] br_read_smallendian(int len) | 375 | //private byte[] br_read_smallendian(int len) |
376 | //{ | 376 | //{ |
377 | // byte[] bytes = new byte[len]; | 377 | // byte[] bytes = new byte[len]; |
378 | // br.Read(bytes,0, len); | 378 | // br.Read(bytes,0, len); |
379 | // return bytes; | 379 | // return bytes; |
380 | //} | 380 | //} |
381 | private Type getLLObjectType(byte objectCode) | 381 | private Type getLLObjectType(byte objectCode) |
382 | { | 382 | { |
383 | switch ((LSO_Enums.Variable_Type_Codes) objectCode) | 383 | switch ((LSO_Enums.Variable_Type_Codes) objectCode) |
384 | { | 384 | { |
385 | case LSO_Enums.Variable_Type_Codes.Void: | 385 | case LSO_Enums.Variable_Type_Codes.Void: |
386 | return typeof (void); | 386 | return typeof (void); |
387 | case LSO_Enums.Variable_Type_Codes.Integer: | 387 | case LSO_Enums.Variable_Type_Codes.Integer: |
388 | return typeof (UInt32); | 388 | return typeof (UInt32); |
389 | case LSO_Enums.Variable_Type_Codes.Float: | 389 | case LSO_Enums.Variable_Type_Codes.Float: |
390 | return typeof (float); | 390 | return typeof (float); |
391 | case LSO_Enums.Variable_Type_Codes.String: | 391 | case LSO_Enums.Variable_Type_Codes.String: |
392 | return typeof (string); | 392 | return typeof (string); |
393 | case LSO_Enums.Variable_Type_Codes.Key: | 393 | case LSO_Enums.Variable_Type_Codes.Key: |
394 | return typeof (string); | 394 | return typeof (string); |
395 | case LSO_Enums.Variable_Type_Codes.Vector: | 395 | case LSO_Enums.Variable_Type_Codes.Vector: |
396 | return typeof (LSO_Enums.Vector); | 396 | return typeof (LSO_Enums.Vector); |
397 | case LSO_Enums.Variable_Type_Codes.Rotation: | 397 | case LSO_Enums.Variable_Type_Codes.Rotation: |
398 | return typeof (LSO_Enums.Rotation); | 398 | return typeof (LSO_Enums.Rotation); |
399 | case LSO_Enums.Variable_Type_Codes.List: | 399 | case LSO_Enums.Variable_Type_Codes.List: |
400 | Common.SendToDebug("TODO: List datatype not implemented yet!"); | 400 | Common.SendToDebug("TODO: List datatype not implemented yet!"); |
401 | return typeof (ArrayList); | 401 | return typeof (ArrayList); |
402 | case LSO_Enums.Variable_Type_Codes.Null: | 402 | case LSO_Enums.Variable_Type_Codes.Null: |
403 | Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); | 403 | Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); |
404 | return typeof (string); | 404 | return typeof (string); |
405 | default: | 405 | default: |
406 | Common.SendToDebug("Lookup of LSL datatype " + objectCode + | 406 | Common.SendToDebug("Lookup of LSL datatype " + objectCode + |
407 | " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); | 407 | " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); |
408 | return typeof (object); | 408 | return typeof (object); |
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
412 | private int getObjectSize(byte ObjectType) | 412 | private int getObjectSize(byte ObjectType) |
413 | { | 413 | { |
414 | switch ((LSO_Enums.Variable_Type_Codes) ObjectType) | 414 | switch ((LSO_Enums.Variable_Type_Codes) ObjectType) |
415 | { | 415 | { |
416 | case LSO_Enums.Variable_Type_Codes.Integer: | 416 | case LSO_Enums.Variable_Type_Codes.Integer: |
417 | case LSO_Enums.Variable_Type_Codes.Float: | 417 | case LSO_Enums.Variable_Type_Codes.Float: |
418 | case LSO_Enums.Variable_Type_Codes.String: | 418 | case LSO_Enums.Variable_Type_Codes.String: |
419 | case LSO_Enums.Variable_Type_Codes.Key: | 419 | case LSO_Enums.Variable_Type_Codes.Key: |
420 | case LSO_Enums.Variable_Type_Codes.List: | 420 | case LSO_Enums.Variable_Type_Codes.List: |
421 | return 4; | 421 | return 4; |
422 | case LSO_Enums.Variable_Type_Codes.Vector: | 422 | case LSO_Enums.Variable_Type_Codes.Vector: |
423 | return 12; | 423 | return 12; |
424 | case LSO_Enums.Variable_Type_Codes.Rotation: | 424 | case LSO_Enums.Variable_Type_Codes.Rotation: |
425 | return 16; | 425 | return 16; |
426 | default: | 426 | default: |
427 | return 0; | 427 | return 0; |
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | private string Read_String() | 431 | private string Read_String() |
432 | { | 432 | { |
433 | string ret = ""; | 433 | string ret = ""; |
434 | byte reader = br_read(1)[0]; | 434 | byte reader = br_read(1)[0]; |
435 | while (reader != 0x000) | 435 | while (reader != 0x000) |
436 | { | 436 | { |
437 | ret += (char) reader; | 437 | ret += (char) reader; |
438 | reader = br_read(1)[0]; | 438 | reader = br_read(1)[0]; |
439 | } | 439 | } |
440 | return ret; | 440 | return ret; |
441 | } | 441 | } |
442 | 442 | ||
443 | /// <summary> | 443 | /// <summary> |
444 | /// Reads a code chunk and creates IL | 444 | /// Reads a code chunk and creates IL |
445 | /// </summary> | 445 | /// </summary> |
446 | /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> | 446 | /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> |
447 | /// <param name="typeBuilder">TypeBuilder for assembly</param> | 447 | /// <param name="typeBuilder">TypeBuilder for assembly</param> |
448 | /// <param name="eventname">Name of event (function) to generate</param> | 448 | /// <param name="eventname">Name of event (function) to generate</param> |
449 | private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) | 449 | private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) |
450 | { | 450 | { |
451 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); | 451 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); |
452 | 452 | ||
453 | Common.SendToDebug("Reading Function Code Chunk at: " + pos); | 453 | Common.SendToDebug("Reading Function Code Chunk at: " + pos); |
454 | fs.Seek(pos, SeekOrigin.Begin); | 454 | fs.Seek(pos, SeekOrigin.Begin); |
455 | myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 455 | myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
456 | Common.SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize); | 456 | Common.SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize); |
457 | // Read until null | 457 | // Read until null |
458 | myCodeChunk.Comment = Read_String(); | 458 | myCodeChunk.Comment = Read_String(); |
459 | Common.SendToDebug("Function comment: " + myCodeChunk.Comment); | 459 | Common.SendToDebug("Function comment: " + myCodeChunk.Comment); |
460 | myCodeChunk.ReturnTypePos = br_read(1)[0]; | 460 | myCodeChunk.ReturnTypePos = br_read(1)[0]; |
461 | myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR); | 461 | myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR); |
462 | Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + | 462 | Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + |
463 | ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString()); | 463 | ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString()); |
464 | 464 | ||
465 | 465 | ||
466 | // TODO: How to determine number of codechunks -- does this method work? | 466 | // TODO: How to determine number of codechunks -- does this method work? |
467 | myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>(); | 467 | myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>(); |
468 | byte reader = br_read(1)[0]; | 468 | byte reader = br_read(1)[0]; |
469 | reader = br_read(1)[0]; | 469 | reader = br_read(1)[0]; |
470 | 470 | ||
471 | // NOTE ON CODE CHUNK ARGUMENTS | 471 | // NOTE ON CODE CHUNK ARGUMENTS |
472 | // This determins type definition | 472 | // This determins type definition |
473 | int ccount = 0; | 473 | int ccount = 0; |
474 | while (reader != 0x000) | 474 | while (reader != 0x000) |
475 | { | 475 | { |
476 | ccount++; | 476 | ccount++; |
477 | Common.SendToDebug("Reading Code Chunk Argument " + ccount); | 477 | Common.SendToDebug("Reading Code Chunk Argument " + ccount); |
478 | LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); | 478 | LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); |
479 | CCA.FunctionReturnTypePos = reader; | 479 | CCA.FunctionReturnTypePos = reader; |
480 | reader = br_read(1)[0]; | 480 | reader = br_read(1)[0]; |
481 | CCA.NullString = reader; | 481 | CCA.NullString = reader; |
482 | CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); | 482 | CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); |
483 | myCodeChunk.CodeChunkArguments.Add(CCA); | 483 | myCodeChunk.CodeChunkArguments.Add(CCA); |
484 | Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + | 484 | Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + |
485 | ": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType); | 485 | ": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType); |
486 | } | 486 | } |
487 | // Create string array | 487 | // Create string array |
488 | Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; | 488 | Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; |
489 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) | 489 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) |
490 | { | 490 | { |
491 | MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); | 491 | MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); |
492 | Common.SendToDebug("Method argument " + _ic + ": " + | 492 | Common.SendToDebug("Method argument " + _ic + ": " + |
493 | getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType). | 493 | getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType). |
494 | ToString()); | 494 | ToString()); |
495 | } | 495 | } |
496 | // End marker is 0x000 | 496 | // End marker is 0x000 |
497 | myCodeChunk.EndMarker = reader; | 497 | myCodeChunk.EndMarker = reader; |
498 | 498 | ||
499 | 499 | ||
500 | // | 500 | // |
501 | // Emit: START OF METHOD (FUNCTION) | 501 | // Emit: START OF METHOD (FUNCTION) |
502 | // | 502 | // |
503 | 503 | ||
504 | Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); | 504 | Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); |
505 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 505 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, |
506 | MethodAttributes.Public, | 506 | MethodAttributes.Public, |
507 | typeof (void), | 507 | typeof (void), |
508 | new Type[] {typeof (object)}); | 508 | new Type[] {typeof (object)}); |
509 | //MethodArgs); | 509 | //MethodArgs); |
510 | //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), | 510 | //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), |
511 | // new Type[] { typeof(object) }, //); | 511 | // new Type[] { typeof(object) }, //); |
512 | 512 | ||
513 | //Common.SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); | 513 | //Common.SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); |
514 | //typeBuilder.DefineMethodOverride(methodBuilder, | 514 | //typeBuilder.DefineMethodOverride(methodBuilder, |
515 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | 515 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); |
516 | 516 | ||
517 | // Create the IL generator | 517 | // Create the IL generator |
518 | 518 | ||
519 | Common.SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); | 519 | Common.SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); |
520 | ILGenerator il = methodBuilder.GetILGenerator(); | 520 | ILGenerator il = methodBuilder.GetILGenerator(); |
521 | 521 | ||
522 | 522 | ||
523 | if (Common.IL_UseTryCatch) | 523 | if (Common.IL_UseTryCatch) |
524 | IL_INSERT_TRY(il, eventname); | 524 | IL_INSERT_TRY(il, eventname); |
525 | 525 | ||
526 | 526 | ||
527 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | 527 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); |
528 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 528 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
529 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod | 529 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod |
530 | // ("WriteLine", new Type[] { typeof(string) })); | 530 | // ("WriteLine", new Type[] { typeof(string) })); |
531 | 531 | ||
532 | //Common.SendToDebug("STARTUP: il.Emit(OpCodes.Ldc_I4_S, 0);"); | 532 | //Common.SendToDebug("STARTUP: il.Emit(OpCodes.Ldc_I4_S, 0);"); |
533 | 533 | ||
534 | //il.Emit(OpCodes.Ldc_I4_S, 0); | 534 | //il.Emit(OpCodes.Ldc_I4_S, 0); |
535 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) | 535 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) |
536 | { | 536 | { |
537 | Common.SendToDebug("PARAMS: il.Emit(OpCodes.Ldarg, " + _ic + ");"); | 537 | Common.SendToDebug("PARAMS: il.Emit(OpCodes.Ldarg, " + _ic + ");"); |
538 | il.Emit(OpCodes.Ldarg, _ic); | 538 | il.Emit(OpCodes.Ldarg, _ic); |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | // | 542 | // |
543 | // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL | 543 | // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL |
544 | // | 544 | // |
545 | bool FoundRet = false; | 545 | bool FoundRet = false; |
546 | while (FoundRet == false) | 546 | while (FoundRet == false) |
547 | { | 547 | { |
548 | FoundRet = LSL_PROCESS_OPCODE(il); | 548 | FoundRet = LSL_PROCESS_OPCODE(il); |
549 | } | 549 | } |
550 | 550 | ||
551 | 551 | ||
552 | if (Common.IL_UseTryCatch) | 552 | if (Common.IL_UseTryCatch) |
553 | IL_INSERT_END_TRY(il, eventname); | 553 | IL_INSERT_END_TRY(il, eventname); |
554 | 554 | ||
555 | // Emit: RETURN FROM METHOD | 555 | // Emit: RETURN FROM METHOD |
556 | il.Emit(OpCodes.Ret); | 556 | il.Emit(OpCodes.Ret); |
557 | 557 | ||
558 | return; | 558 | return; |
559 | } | 559 | } |
560 | 560 | ||
561 | private void IL_INSERT_FUNCTIONLIST() | 561 | private void IL_INSERT_FUNCTIONLIST() |
562 | { | 562 | { |
563 | Common.SendToDebug("Creating function list"); | 563 | Common.SendToDebug("Creating function list"); |
564 | 564 | ||
565 | 565 | ||
566 | string eventname = "GetFunctions"; | 566 | string eventname = "GetFunctions"; |
567 | 567 | ||
568 | Common.SendToDebug("Creating IL " + eventname); | 568 | Common.SendToDebug("Creating IL " + eventname); |
569 | // Define a private String field. | 569 | // Define a private String field. |
570 | //FieldBuilder myField = myTypeBuilder.DefineField("EventList", typeof(String[]), FieldAttributes.Public); | 570 | //FieldBuilder myField = myTypeBuilder.DefineField("EventList", typeof(String[]), FieldAttributes.Public); |
571 | 571 | ||
572 | 572 | ||
573 | //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); | 573 | //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); |
574 | 574 | ||
575 | 575 | ||
576 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 576 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, |
577 | MethodAttributes.Public, | 577 | MethodAttributes.Public, |
578 | typeof (string[]), | 578 | typeof (string[]), |
579 | null); | 579 | null); |
580 | 580 | ||
581 | //typeBuilder.DefineMethodOverride(methodBuilder, | 581 | //typeBuilder.DefineMethodOverride(methodBuilder, |
582 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | 582 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); |
583 | 583 | ||
584 | ILGenerator il = methodBuilder.GetILGenerator(); | 584 | ILGenerator il = methodBuilder.GetILGenerator(); |
585 | 585 | ||
586 | 586 | ||
587 | // IL_INSERT_TRY(il, eventname); | 587 | // IL_INSERT_TRY(il, eventname); |
588 | 588 | ||
589 | // // Push string to stack | 589 | // // Push string to stack |
590 | // il.Emit(OpCodes.Ldstr, "Inside " + eventname); | 590 | // il.Emit(OpCodes.Ldstr, "Inside " + eventname); |
591 | 591 | ||
592 | //// Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | 592 | //// Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); |
593 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod | 593 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod |
594 | // ("WriteLine", new Type[] { typeof(string) })); | 594 | // ("WriteLine", new Type[] { typeof(string) })); |
595 | 595 | ||
596 | //initIL.Emit(OpCodes.Newobj, typeof(string[])); | 596 | //initIL.Emit(OpCodes.Newobj, typeof(string[])); |
597 | 597 | ||
598 | //string[] MyArray = new string[2] { "TestItem1" , "TestItem2" }; | 598 | //string[] MyArray = new string[2] { "TestItem1" , "TestItem2" }; |
599 | 599 | ||
600 | ////il.Emit(OpCodes.Ldarg_0); | 600 | ////il.Emit(OpCodes.Ldarg_0); |
601 | 601 | ||
602 | il.DeclareLocal(typeof (string[])); | 602 | il.DeclareLocal(typeof (string[])); |
603 | 603 | ||
604 | ////il.Emit(OpCodes.Ldarg_0); | 604 | ////il.Emit(OpCodes.Ldarg_0); |
605 | il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length | 605 | il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length |
606 | il.Emit(OpCodes.Newarr, typeof (String)); // create new string array | 606 | il.Emit(OpCodes.Newarr, typeof (String)); // create new string array |
607 | il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack | 607 | il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack |
608 | ////SetFunctionList | 608 | ////SetFunctionList |
609 | 609 | ||
610 | for (int lv = 0; lv < EventList.Count; lv++) | 610 | for (int lv = 0; lv < EventList.Count; lv++) |
611 | { | 611 | { |
612 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | 612 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack |
613 | il.Emit(OpCodes.Ldc_I4, lv); // Push index position | 613 | il.Emit(OpCodes.Ldc_I4, lv); // Push index position |
614 | il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value | 614 | il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value |
615 | il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value | 615 | il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value |
616 | 616 | ||
617 | //il.Emit(OpCodes.Ldarg_0); | 617 | //il.Emit(OpCodes.Ldarg_0); |
618 | //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value | 618 | //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value |
619 | //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); | 619 | //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); |
620 | } | 620 | } |
621 | 621 | ||
622 | 622 | ||
623 | // IL_INSERT_END_TRY(il, eventname); | 623 | // IL_INSERT_END_TRY(il, eventname); |
624 | 624 | ||
625 | 625 | ||
626 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | 626 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack |
627 | // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); | 627 | // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); |
628 | 628 | ||
629 | il.Emit(OpCodes.Ret); // Return | 629 | il.Emit(OpCodes.Ret); // Return |
630 | } | 630 | } |
631 | 631 | ||
632 | 632 | ||
633 | private void IL_INSERT_TRY(ILGenerator il, string eventname) | 633 | private void IL_INSERT_TRY(ILGenerator il, string eventname) |
634 | { | 634 | { |
635 | /* | 635 | /* |
636 | * CLR TRY | 636 | * CLR TRY |
637 | */ | 637 | */ |
638 | //Common.SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); | 638 | //Common.SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); |
639 | il.BeginExceptionBlock(); | 639 | il.BeginExceptionBlock(); |
640 | 640 | ||
641 | // Push "Hello World!" string to stack | 641 | // Push "Hello World!" string to stack |
642 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 642 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
643 | //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); | 643 | //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); |
644 | } | 644 | } |
645 | 645 | ||
646 | private void IL_INSERT_END_TRY(ILGenerator il, string eventname) | 646 | private void IL_INSERT_END_TRY(ILGenerator il, string eventname) |
647 | { | 647 | { |
648 | /* | 648 | /* |
649 | * CATCH | 649 | * CATCH |
650 | */ | 650 | */ |
651 | Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); | 651 | Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); |
652 | il.BeginCatchBlock(typeof (Exception)); | 652 | il.BeginCatchBlock(typeof (Exception)); |
653 | 653 | ||
654 | // Push "Hello World!" string to stack | 654 | // Push "Hello World!" string to stack |
655 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 655 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
656 | il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); | 656 | il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); |
657 | 657 | ||
658 | //call void [mscorlib]System.Console::WriteLine(string) | 658 | //call void [mscorlib]System.Console::WriteLine(string) |
659 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 659 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
660 | il.Emit(OpCodes.Call, typeof (Console).GetMethod | 660 | il.Emit(OpCodes.Call, typeof (Console).GetMethod |
661 | ("Write", new Type[] {typeof (string)})); | 661 | ("Write", new Type[] {typeof (string)})); |
662 | 662 | ||
663 | //callvirt instance string [mscorlib]System.Exception::get_Message() | 663 | //callvirt instance string [mscorlib]System.Exception::get_Message() |
664 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); | 664 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); |
665 | il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod | 665 | il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod |
666 | ("get_Message")); | 666 | ("get_Message")); |
667 | 667 | ||
668 | //call void [mscorlib]System.Console::WriteLine(string) | 668 | //call void [mscorlib]System.Console::WriteLine(string) |
669 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 669 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
670 | il.Emit(OpCodes.Call, typeof (Console).GetMethod | 670 | il.Emit(OpCodes.Call, typeof (Console).GetMethod |
671 | ("WriteLine", new Type[] {typeof (string)})); | 671 | ("WriteLine", new Type[] {typeof (string)})); |
672 | 672 | ||
673 | /* | 673 | /* |
674 | * CLR END TRY | 674 | * CLR END TRY |
675 | */ | 675 | */ |
676 | //Common.SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); | 676 | //Common.SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); |
677 | il.EndExceptionBlock(); | 677 | il.EndExceptionBlock(); |
678 | } | 678 | } |
679 | 679 | ||
680 | private LSO_Struct.StaticBlock GetStaticBlock(long pos) | 680 | private LSO_Struct.StaticBlock GetStaticBlock(long pos) |
681 | { | 681 | { |
682 | long FirstPos = fs.Position; | 682 | long FirstPos = fs.Position; |
683 | try | 683 | try |
684 | { | 684 | { |
685 | UInt32 position = (UInt32) pos; | 685 | UInt32 position = (UInt32) pos; |
686 | // STATIC BLOCK | 686 | // STATIC BLOCK |
687 | Common.SendToDebug("Reading STATIC BLOCK at: " + position); | 687 | Common.SendToDebug("Reading STATIC BLOCK at: " + position); |
688 | fs.Seek(position, SeekOrigin.Begin); | 688 | fs.Seek(position, SeekOrigin.Begin); |
689 | 689 | ||
690 | if (StaticBlocks.ContainsKey(position) == true) | 690 | if (StaticBlocks.ContainsKey(position) == true) |
691 | { | 691 | { |
692 | Common.SendToDebug("Found cached STATIC BLOCK"); | 692 | Common.SendToDebug("Found cached STATIC BLOCK"); |
693 | 693 | ||
694 | 694 | ||
695 | return StaticBlocks[pos]; | 695 | return StaticBlocks[pos]; |
696 | } | 696 | } |
697 | 697 | ||
698 | //int StaticBlockCount = 0; | 698 | //int StaticBlockCount = 0; |
699 | // Read function blocks until we hit GFR | 699 | // Read function blocks until we hit GFR |
700 | //while (fs.Position < myHeader.GFR) | 700 | //while (fs.Position < myHeader.GFR) |
701 | //{ | 701 | //{ |
702 | //StaticBlockCount++; | 702 | //StaticBlockCount++; |
703 | 703 | ||
704 | //Common.SendToDebug("Reading Static Block at: " + position); | 704 | //Common.SendToDebug("Reading Static Block at: " + position); |
705 | 705 | ||
706 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); | 706 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); |
707 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 707 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
708 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 708 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
709 | myStaticBlock.ObjectType = br_read(1)[0]; | 709 | myStaticBlock.ObjectType = br_read(1)[0]; |
710 | Common.SendToDebug("Static Block ObjectType: " + | 710 | Common.SendToDebug("Static Block ObjectType: " + |
711 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); | 711 | ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString()); |
712 | myStaticBlock.Unknown = br_read(1)[0]; | 712 | myStaticBlock.Unknown = br_read(1)[0]; |
713 | // Size of datatype varies | 713 | // Size of datatype varies |
714 | if (myStaticBlock.ObjectType != 0) | 714 | if (myStaticBlock.ObjectType != 0) |
715 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); | 715 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); |
716 | 716 | ||
717 | StaticBlocks.Add(position, myStaticBlock); | 717 | StaticBlocks.Add(position, myStaticBlock); |
718 | //} | 718 | //} |
719 | Common.SendToDebug("Done reading Static Block."); | 719 | Common.SendToDebug("Done reading Static Block."); |
720 | return myStaticBlock; | 720 | return myStaticBlock; |
721 | } | 721 | } |
722 | finally | 722 | finally |
723 | { | 723 | { |
724 | // Go back to original read pos | 724 | // Go back to original read pos |
725 | fs.Seek(FirstPos, SeekOrigin.Begin); | 725 | fs.Seek(FirstPos, SeekOrigin.Begin); |
726 | } | 726 | } |
727 | } | 727 | } |
728 | } | 728 | } |
729 | } \ No newline at end of file | 729 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Struct.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Struct.cs index 915280c..b38b099 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Struct.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Struct.cs | |||
@@ -1,143 +1,143 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | 33 | ||
34 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO | 34 | namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO |
35 | { | 35 | { |
36 | internal static class LSO_Struct | 36 | internal static class LSO_Struct |
37 | { | 37 | { |
38 | public struct Header | 38 | public struct Header |
39 | { | 39 | { |
40 | public UInt32 TM; | 40 | public UInt32 TM; |
41 | public UInt32 IP; | 41 | public UInt32 IP; |
42 | public UInt32 VN; | 42 | public UInt32 VN; |
43 | public UInt32 BP; | 43 | public UInt32 BP; |
44 | public UInt32 SP; | 44 | public UInt32 SP; |
45 | public UInt32 HR; | 45 | public UInt32 HR; |
46 | public UInt32 HP; | 46 | public UInt32 HP; |
47 | public UInt32 CS; | 47 | public UInt32 CS; |
48 | public UInt32 NS; | 48 | public UInt32 NS; |
49 | public UInt32 CE; | 49 | public UInt32 CE; |
50 | public UInt32 IE; | 50 | public UInt32 IE; |
51 | public UInt32 ER; | 51 | public UInt32 ER; |
52 | public UInt32 FR; | 52 | public UInt32 FR; |
53 | public UInt32 SLR; | 53 | public UInt32 SLR; |
54 | public UInt32 GVR; | 54 | public UInt32 GVR; |
55 | public UInt32 GFR; | 55 | public UInt32 GFR; |
56 | public UInt32 PR; | 56 | public UInt32 PR; |
57 | public UInt32 ESR; | 57 | public UInt32 ESR; |
58 | public UInt32 SR; | 58 | public UInt32 SR; |
59 | public UInt64 NCE; | 59 | public UInt64 NCE; |
60 | public UInt64 NIE; | 60 | public UInt64 NIE; |
61 | public UInt64 NER; | 61 | public UInt64 NER; |
62 | } | 62 | } |
63 | 63 | ||
64 | public struct StaticBlock | 64 | public struct StaticBlock |
65 | { | 65 | { |
66 | public UInt32 Static_Chunk_Header_Size; | 66 | public UInt32 Static_Chunk_Header_Size; |
67 | public byte ObjectType; | 67 | public byte ObjectType; |
68 | public byte Unknown; | 68 | public byte Unknown; |
69 | public byte[] BlockVariable; | 69 | public byte[] BlockVariable; |
70 | } | 70 | } |
71 | 71 | ||
72 | /* Not actually a structure | 72 | /* Not actually a structure |
73 | public struct StaticBlockVariable | 73 | public struct StaticBlockVariable |
74 | { | 74 | { |
75 | public UInt32 Integer1; | 75 | public UInt32 Integer1; |
76 | public UInt32 Float1; | 76 | public UInt32 Float1; |
77 | public UInt32 HeapPointer_String; | 77 | public UInt32 HeapPointer_String; |
78 | public UInt32 HeapPointer_Key; | 78 | public UInt32 HeapPointer_Key; |
79 | public byte[] Vector_12; | 79 | public byte[] Vector_12; |
80 | public byte[] Rotation_16; | 80 | public byte[] Rotation_16; |
81 | public UInt32 Pointer_List_Structure; | 81 | public UInt32 Pointer_List_Structure; |
82 | } */ | 82 | } */ |
83 | 83 | ||
84 | public struct HeapBlock | 84 | public struct HeapBlock |
85 | { | 85 | { |
86 | public Int32 DataBlockSize; | 86 | public Int32 DataBlockSize; |
87 | public byte ObjectType; | 87 | public byte ObjectType; |
88 | public UInt16 ReferenceCount; | 88 | public UInt16 ReferenceCount; |
89 | public byte[] Data; | 89 | public byte[] Data; |
90 | } | 90 | } |
91 | 91 | ||
92 | public struct StateFrameBlock | 92 | public struct StateFrameBlock |
93 | { | 93 | { |
94 | public UInt32 StateCount; | 94 | public UInt32 StateCount; |
95 | public StatePointerBlock[] StatePointer; | 95 | public StatePointerBlock[] StatePointer; |
96 | } | 96 | } |
97 | 97 | ||
98 | public struct StatePointerBlock | 98 | public struct StatePointerBlock |
99 | { | 99 | { |
100 | public UInt32 Location; | 100 | public UInt32 Location; |
101 | public BitArray EventMask; | 101 | public BitArray EventMask; |
102 | public StateBlock StateBlock; | 102 | public StateBlock StateBlock; |
103 | } | 103 | } |
104 | 104 | ||
105 | public struct StateBlock | 105 | public struct StateBlock |
106 | { | 106 | { |
107 | public UInt32 StartPos; | 107 | public UInt32 StartPos; |
108 | public UInt32 EndPos; | 108 | public UInt32 EndPos; |
109 | public UInt32 HeaderSize; | 109 | public UInt32 HeaderSize; |
110 | public byte Unknown; | 110 | public byte Unknown; |
111 | public StateBlockHandler[] StateBlockHandlers; | 111 | public StateBlockHandler[] StateBlockHandlers; |
112 | } | 112 | } |
113 | 113 | ||
114 | public struct StateBlockHandler | 114 | public struct StateBlockHandler |
115 | { | 115 | { |
116 | public UInt32 CodeChunkPointer; | 116 | public UInt32 CodeChunkPointer; |
117 | public UInt32 CallFrameSize; | 117 | public UInt32 CallFrameSize; |
118 | } | 118 | } |
119 | 119 | ||
120 | public struct FunctionBlock | 120 | public struct FunctionBlock |
121 | { | 121 | { |
122 | public UInt32 FunctionCount; | 122 | public UInt32 FunctionCount; |
123 | public UInt32[] CodeChunkPointer; | 123 | public UInt32[] CodeChunkPointer; |
124 | } | 124 | } |
125 | 125 | ||
126 | public struct CodeChunk | 126 | public struct CodeChunk |
127 | { | 127 | { |
128 | public UInt32 CodeChunkHeaderSize; | 128 | public UInt32 CodeChunkHeaderSize; |
129 | public string Comment; | 129 | public string Comment; |
130 | public List<CodeChunkArgument> CodeChunkArguments; | 130 | public List<CodeChunkArgument> CodeChunkArguments; |
131 | public byte EndMarker; | 131 | public byte EndMarker; |
132 | public byte ReturnTypePos; | 132 | public byte ReturnTypePos; |
133 | public StaticBlock ReturnType; | 133 | public StaticBlock ReturnType; |
134 | } | 134 | } |
135 | 135 | ||
136 | public struct CodeChunkArgument | 136 | public struct CodeChunkArgument |
137 | { | 137 | { |
138 | public byte FunctionReturnTypePos; | 138 | public byte FunctionReturnTypePos; |
139 | public byte NullString; | 139 | public byte NullString; |
140 | public StaticBlock FunctionReturnType; | 140 | public StaticBlock FunctionReturnType; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } \ No newline at end of file | 143 | } \ No newline at end of file |