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