diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting/Engines')
10 files changed, 1844 insertions, 387 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Common.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Common.cs new file mode 100644 index 0000000..790871b --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Common.cs | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.Scripting.LSL | ||
34 | { | ||
35 | public static class Common | ||
36 | { | ||
37 | static public bool Debug = true; | ||
38 | static public bool IL_UseTryCatch = true; | ||
39 | static public bool IL_CreateConstructor = true; | ||
40 | static public bool IL_CreateFunctionList = true; | ||
41 | static public bool IL_ProcessCodeChunks = true; | ||
42 | |||
43 | public delegate void SendToDebugEventDelegate(string Message); | ||
44 | public delegate void SendToLogEventDelegate(string Message); | ||
45 | static public event SendToDebugEventDelegate SendToDebugEvent; | ||
46 | static public event SendToLogEventDelegate SendToLogEvent; | ||
47 | |||
48 | static public void SendToDebug(string Message) | ||
49 | { | ||
50 | //if (Debug == true) | ||
51 | Console.WriteLine("Debug: " + Message); | ||
52 | SendToDebugEvent(DateTime.Now.ToString("[HH:mm:ss] ") + Message + "\r\n"); | ||
53 | } | ||
54 | static public void SendToLog(string Message) | ||
55 | { | ||
56 | //if (Debug == true) | ||
57 | Console.WriteLine("LOG: " + Message); | ||
58 | SendToLogEvent(DateTime.Now.ToString("[HH:mm:ss] ") + Message + "\r\n"); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | // TEMPORARY TEST THINGIES | ||
63 | public static class IL_Helper | ||
64 | { | ||
65 | public static string ReverseFormatString(string text1, string format) | ||
66 | { | ||
67 | Common.SendToDebug("ReverseFormatString text1: " + text1); | ||
68 | Common.SendToDebug("ReverseFormatString format: " + format); | ||
69 | return string.Format(format, text1); | ||
70 | } | ||
71 | public static string ReverseFormatString(string text1, UInt32 text2, string format) | ||
72 | { | ||
73 | Common.SendToDebug("ReverseFormatString text1: " + text1); | ||
74 | Common.SendToDebug("ReverseFormatString text2: " + text2.ToString()); | ||
75 | Common.SendToDebug("ReverseFormatString format: " + format); | ||
76 | return string.Format(format, text1, text2.ToString()); | ||
77 | } | ||
78 | public static string Cast_ToString(object obj) | ||
79 | { | ||
80 | Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); | ||
81 | return "ABCDEFGIHJKLMNOPQ123"; | ||
82 | } | ||
83 | } | ||
84 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs index 012a00e..5cd1f71 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Engine.cs | |||
@@ -1,140 +1,228 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 */ | ||
1 | using System; | 29 | using System; |
2 | using System.Reflection; | 30 | using System.Reflection; |
3 | using System.Reflection.Emit; | 31 | using System.Reflection.Emit; |
4 | using System.Threading; | 32 | using System.Threading; |
5 | 33 | ||
6 | using OpenSim.Region.Scripting; | 34 | namespace OpenSim.Region.Scripting.LSL |
7 | |||
8 | namespace OpenSim.ScriptEngines.LSL | ||
9 | { | ||
10 | |||
11 | |||
12 | public class Engine | ||
13 | { | 35 | { |
14 | public void Start(ScriptInfo WorldAPI) | ||
15 | { | ||
16 | |||
17 | |||
18 | |||
19 | // Create Assembly Name | ||
20 | AssemblyName asmName = new AssemblyName(); | ||
21 | asmName.Name = "TestAssembly"; | ||
22 | |||
23 | // Create Assembly | ||
24 | AssemblyBuilder asmBuilder = | ||
25 | Thread.GetDomain().DefineDynamicAssembly | ||
26 | (asmName, AssemblyBuilderAccess.RunAndSave); | ||
27 | |||
28 | // Create a module (and save to disk) | ||
29 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule | ||
30 | (asmName.Name, asmName.Name + ".dll"); | ||
31 | |||
32 | // Create a Class (/Type) | ||
33 | TypeBuilder typeBuilder = modBuilder.DefineType( | ||
34 | "MyClass", | ||
35 | TypeAttributes.Public, | ||
36 | typeof(object), | ||
37 | new Type[] { typeof(LSL_CLRInterface.LSLScript) }); | ||
38 | |||
39 | |||
40 | |||
41 | /* | ||
42 | * Generate the IL itself | ||
43 | */ | ||
44 | |||
45 | GenerateIL(WorldAPI, typeBuilder); | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Done generating, create a type and run it. | ||
50 | */ | ||
51 | 36 | ||
52 | // Create type object for the class (after defining fields and methods) | 37 | |
53 | Type type = typeBuilder.CreateType(); | 38 | public class Engine |
54 | |||
55 | asmBuilder.Save("TestAssembly.dll"); | ||
56 | |||
57 | // Create an instance we can play with | ||
58 | //LSLScript hello = (LSLScript)Activator.CreateInstance(type); | ||
59 | LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); | ||
60 | |||
61 | // Play with it | ||
62 | MyScript.event_state_entry("Test"); | ||
63 | } | ||
64 | |||
65 | private void GenerateIL(ScriptInfo WorldAPI, TypeBuilder typeBuilder) | ||
66 | { | 39 | { |
40 | //private string LSO_FileName = @"LSO\AdditionTest.lso"; | ||
41 | private string LSO_FileName;// = @"LSO\CloseToDefault.lso"; | ||
42 | AppDomain appDomain; | ||
67 | 43 | ||
44 | public void Start(string FileName) | ||
45 | { | ||
46 | LSO_FileName = FileName; | ||
68 | 47 | ||
69 | // For debug | ||
70 | LSO_Parser LSOP = new LSO_Parser(); | ||
71 | LSOP.ParseFile("LSO\\CloseToDefault.lso", WorldAPI, ref typeBuilder); | ||
72 | return; | ||
73 | |||
74 | |||
75 | // Override a Method / Function | ||
76 | MethodBuilder methodBuilder = typeBuilder.DefineMethod("event_state_entry", | ||
77 | MethodAttributes.Private | MethodAttributes.Virtual, | ||
78 | typeof(void), | ||
79 | new Type[] { typeof(object) }); | ||
80 | 48 | ||
81 | typeBuilder.DefineMethodOverride(methodBuilder, | 49 | //appDomain = AppDomain.CreateDomain("AlternateAppDomain"); |
82 | typeof(LSL_CLRInterface.LSLScript).GetMethod("event_state_entry")); | 50 | appDomain = Thread.GetDomain(); |
83 | |||
84 | // Create the IL generator | ||
85 | ILGenerator il = methodBuilder.GetILGenerator(); | ||
86 | 51 | ||
52 | // Create Assembly Name | ||
53 | AssemblyName asmName = new AssemblyName(); | ||
54 | asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName); | ||
55 | //asmName.Name = "TestAssembly"; | ||
87 | 56 | ||
88 | /* | 57 | string DLL_FileName = asmName.Name + ".dll"; |
89 | * TRY | 58 | string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(FileName) + @"\" + DLL_FileName; |
90 | */ | ||
91 | il.BeginExceptionBlock(); | ||
92 | 59 | ||
93 | // Push "Hello World!" string to stack | 60 | Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(FileName)); |
94 | il.Emit(OpCodes.Ldstr, "Hello World!"); | 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(""); | ||
95 | 65 | ||
96 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | ||
97 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | ||
98 | ("WriteLine", new Type[] { typeof(string) })); | ||
99 | 66 | ||
100 | //il.EmitCall(OpCodes.Callvirt | 67 | |
101 | //il.Emit(OpCodes.Call, typeof(WorldAPI).GetMethod | 68 | // Create Assembly |
102 | //("TestFunction")); | 69 | AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( |
70 | asmName, | ||
71 | AssemblyBuilderAccess.RunAndSave | ||
72 | ); | ||
73 | //// Create Assembly | ||
74 | //AssemblyBuilder asmBuilder = | ||
75 | // Thread.GetDomain().DefineDynamicAssembly | ||
76 | //(asmName, AssemblyBuilderAccess.RunAndSave); | ||
77 | |||
78 | // Create a module (and save to disk) | ||
79 | ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule | ||
80 | (asmName.Name, | ||
81 | DLL_FileName); | ||
82 | |||
83 | //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); | ||
84 | // Create a Class (/Type) | ||
85 | TypeBuilder typeBuilder = modBuilder.DefineType( | ||
86 | "LSL_ScriptObject", | ||
87 | TypeAttributes.Public | TypeAttributes.BeforeFieldInit); | ||
88 | //, | ||
89 | // typeof()); | ||
90 | //, typeof(LSL_BuiltIn_Commands_Interface)); | ||
91 | //, | ||
92 | // typeof(object), | ||
93 | // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); | ||
94 | |||
95 | |||
96 | if (Common.IL_CreateConstructor) | ||
97 | IL_CREATE_CONSTRUCTOR(typeBuilder); | ||
98 | |||
103 | 99 | ||
100 | /* | ||
101 | * Generate the IL itself | ||
102 | */ | ||
104 | 103 | ||
105 | //il.ThrowException(typeof(NotSupportedException)); | 104 | LSO_Parser LSOP = new LSO_Parser(); |
105 | LSOP.ParseFile(LSO_FileName, typeBuilder); | ||
106 | 106 | ||
107 | 107 | /* | |
108 | /* | 108 | * Done generating. Create a type and run it. |
109 | * CATCH | 109 | */ |
110 | */ | ||
111 | il.BeginCatchBlock(typeof(Exception)); | ||
112 | 110 | ||
113 | // Push "Hello World!" string to stack | ||
114 | il.Emit(OpCodes.Ldstr, "Something went wrong: "); | ||
115 | 111 | ||
116 | //call void [mscorlib]System.Console::WriteLine(string) | ||
117 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | ||
118 | ("Write", new Type[] { typeof(string) })); | ||
119 | 112 | ||
120 | //callvirt instance string [mscorlib]System.Exception::get_Message() | 113 | Common.SendToLog("Attempting to compile assembly..."); |
121 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod | 114 | // Compile it |
122 | ("get_Message")); | 115 | Type type = typeBuilder.CreateType(); |
123 | 116 | Common.SendToLog("Compilation successful!"); | |
124 | //call void [mscorlib]System.Console::WriteLine(string) | ||
125 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | ||
126 | ("WriteLine", new Type[] { typeof(string) })); | ||
127 | 117 | ||
128 | /* | 118 | Common.SendToLog("Saving assembly: " + DLL_FileName); |
129 | * END TRY | 119 | asmBuilder.Save(DLL_FileName); |
130 | */ | ||
131 | il.EndExceptionBlock(); | ||
132 | 120 | ||
133 | 121 | ||
134 | // Push "Return from current method, with return value if present" to stack | 122 | Common.SendToLog("Creating an instance of new assembly..."); |
135 | il.Emit(OpCodes.Ret); | 123 | // Create an instance we can play with |
124 | //LSLScript hello = (LSLScript)Activator.CreateInstance(type); | ||
125 | //LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); | ||
126 | object MyScript = (object)Activator.CreateInstance(type); | ||
136 | 127 | ||
137 | 128 | ||
129 | Common.SendToLog(""); | ||
130 | |||
131 | System.Reflection.MemberInfo[] Members = type.GetMembers(); | ||
132 | |||
133 | Common.SendToLog("Members of assembly " + type.ToString () + ":"); | ||
134 | foreach (MemberInfo member in Members ) | ||
135 | Common.SendToLog(member.ToString()); | ||
136 | |||
137 | |||
138 | // Play with it | ||
139 | //MyScript.event_state_entry("Test"); | ||
140 | object[] args = { null } ; | ||
141 | //System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); | ||
142 | |||
143 | string[] ret = { }; | ||
144 | if (Common.IL_CreateFunctionList) | ||
145 | ret = (string[])type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); | ||
146 | |||
147 | foreach (string s in ret) | ||
148 | { | ||
149 | Common.SendToLog(""); | ||
150 | Common.SendToLog("*** Executing LSL Server Event: " + s); | ||
151 | //object test = type.GetMember(s); | ||
152 | //object runner = type.InvokeMember(s, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, MyScript, args); | ||
153 | //runner(); | ||
154 | //objBooks_Late = type.InvokeMember(s, BindingFlags.CreateInstance, null, objApp_Late, null); | ||
155 | type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); | ||
156 | |||
157 | } | ||
158 | |||
159 | } | ||
160 | |||
161 | |||
162 | private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder) | ||
163 | { | ||
164 | |||
165 | |||
166 | Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); | ||
167 | //ConstructorBuilder constructor = typeBuilder.DefineConstructor( | ||
168 | // MethodAttributes.Public, | ||
169 | // CallingConventions.Standard, | ||
170 | // new Type[0]); | ||
171 | ConstructorBuilder constructor = typeBuilder.DefineConstructor( | ||
172 | MethodAttributes.Public | | ||
173 | MethodAttributes.SpecialName | | ||
174 | MethodAttributes.RTSpecialName, | ||
175 | CallingConventions.Standard, | ||
176 | new Type[0]); | ||
177 | |||
178 | //Define the reflection ConstructorInfor for System.Object | ||
179 | ConstructorInfo conObj = typeof(object).GetConstructor(new Type[0]); | ||
180 | |||
181 | //call constructor of base object | ||
182 | ILGenerator il = constructor.GetILGenerator(); | ||
183 | |||
184 | Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: UInt32 State = 0;"); | ||
185 | string FieldName; | ||
186 | // Create state object | ||
187 | FieldName = "State"; | ||
188 | FieldBuilder State_fb = typeBuilder.DefineField( | ||
189 | FieldName, | ||
190 | typeof(UInt32), | ||
191 | FieldAttributes.Public); | ||
192 | il.Emit(OpCodes.Ldarg_0); | ||
193 | il.Emit(OpCodes.Ldc_I4, 0); | ||
194 | il.Emit(OpCodes.Stfld, State_fb); | ||
195 | |||
196 | |||
197 | Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: LSL_BuiltIn_Commands_TestImplementation LSL_BuiltIns = New LSL_BuiltIn_Commands_TestImplementation();"); | ||
198 | //Type objType1 = typeof(object); | ||
199 | Type objType1 = typeof(LSL_BuiltIn_Commands_TestImplementation); | ||
200 | |||
201 | FieldName = "LSL_BuiltIns"; | ||
202 | FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField( | ||
203 | FieldName, | ||
204 | objType1, | ||
205 | FieldAttributes.Public); | ||
206 | |||
207 | //LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation(); | ||
208 | il.Emit(OpCodes.Ldarg_0); | ||
209 | //il.Emit(OpCodes.Ldstr, "Test 123"); | ||
210 | il.Emit(OpCodes.Newobj, objType1.GetConstructor(new Type[] { })); | ||
211 | il.Emit(OpCodes.Stfld, LSL_BuiltIns_fb); | ||
212 | |||
213 | il.Emit(OpCodes.Ldarg_0); | ||
214 | il.Emit(OpCodes.Call, conObj); | ||
215 | |||
216 | |||
217 | |||
218 | ////il.Emit(OpCodes.Newobj, typeof(UInt32)); | ||
219 | //il.Emit(OpCodes.Starg_0); | ||
220 | //// Create LSL function library | ||
221 | //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField("LSL_BuiltIns", typeof(LSL_BuiltIn_Commands_Interface), FieldAttributes.Public); | ||
222 | //il.Emit(OpCodes.Newobj, typeof(LSL_BuiltIn_Commands_Interface)); | ||
223 | //il.Emit(OpCodes.Stloc_1); | ||
224 | |||
225 | il.Emit(OpCodes.Ret); | ||
226 | } | ||
138 | } | 227 | } |
139 | } | 228 | } |
140 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/IL_common_functions.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/IL_common_functions.cs new file mode 100644 index 0000000..cae78b7 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/IL_common_functions.cs | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Generic; | ||
31 | using System.Text; | ||
32 | using System.Reflection; | ||
33 | using System.Reflection.Emit; | ||
34 | |||
35 | namespace OpenSim.Region.Scripting.LSL | ||
36 | { | ||
37 | partial class LSO_Parser | ||
38 | { | ||
39 | private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) | ||
40 | { | ||
41 | TypeBuilder typeBuilder = modBuilder.DefineType(typeName, | ||
42 | TypeAttributes.Public | | ||
43 | TypeAttributes.Class | | ||
44 | TypeAttributes.AutoClass | | ||
45 | TypeAttributes.AnsiClass | | ||
46 | TypeAttributes.BeforeFieldInit | | ||
47 | TypeAttributes.AutoLayout, | ||
48 | typeof(object), | ||
49 | new Type[] { typeof(object) }); | ||
50 | return typeBuilder; | ||
51 | |||
52 | } | ||
53 | |||
54 | |||
55 | } | ||
56 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs index 57bbf11..ed22c8c 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_CLRInterface.cs | |||
@@ -1,8 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 */ | ||
1 | using System; | 29 | using System; |
2 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
3 | using System.Text; | 31 | using System.Text; |
4 | 32 | ||
5 | namespace OpenSim.ScriptEngines.LSL | 33 | namespace OpenSim.Region.Scripting.LSL |
6 | { | 34 | { |
7 | public class LSL_CLRInterface | 35 | public class LSL_CLRInterface |
8 | { | 36 | { |
@@ -13,9 +41,9 @@ namespace OpenSim.ScriptEngines.LSL | |||
13 | //} | 41 | //} |
14 | //void Run(object arg); | 42 | //void Run(object arg); |
15 | 43 | ||
16 | void event_state_entry(object arg); | 44 | //void event_state_entry(object arg); |
17 | //void event_state_exit(); | 45 | //void event_state_exit(); |
18 | void event_touch_start(object arg); | 46 | //void event_touch_start(object arg); |
19 | //void event_touch(); | 47 | //void event_touch(); |
20 | //void event_touch_end(); | 48 | //void event_touch_end(); |
21 | //void event_collision_start(); | 49 | //void event_collision_start(); |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_OPCODE_IL_processor.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_OPCODE_IL_processor.cs new file mode 100644 index 0000000..3b0a1ff --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSL_OPCODE_IL_processor.cs | |||
@@ -0,0 +1,352 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Generic; | ||
31 | using System.Text; | ||
32 | using System.Reflection; | ||
33 | using System.Reflection.Emit; | ||
34 | |||
35 | namespace OpenSim.Region.Scripting.LSL | ||
36 | { | ||
37 | partial class LSO_Parser | ||
38 | { | ||
39 | //LSO_Enums MyLSO_Enums = new LSO_Enums(); | ||
40 | |||
41 | internal bool LSL_PROCESS_OPCODE(ILGenerator il) | ||
42 | { | ||
43 | |||
44 | byte bp1; | ||
45 | UInt32 u32p1; | ||
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 | case LSO_Enums.Operation_Table.POP: | ||
53 | case LSO_Enums.Operation_Table.POPL: | ||
54 | case LSO_Enums.Operation_Table.POPV: | ||
55 | case LSO_Enums.Operation_Table.POPQ: | ||
56 | case LSO_Enums.Operation_Table.POPIP: | ||
57 | case LSO_Enums.Operation_Table.POPBP: | ||
58 | case LSO_Enums.Operation_Table.POPSP: | ||
59 | case LSO_Enums.Operation_Table.POPSLR: | ||
60 | // ignore -- builds callframe | ||
61 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Pop);"); | ||
62 | il.Emit(OpCodes.Pop); | ||
63 | break; | ||
64 | case LSO_Enums.Operation_Table.POPARG: | ||
65 | Common.SendToDebug("Instruction " + idesc + ": Ignored"); | ||
66 | Common.SendToDebug("Instruction " + idesc + ": Description: Drop x bytes from the stack "); | ||
67 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
68 | break; | ||
69 | |||
70 | // LONG | ||
71 | case LSO_Enums.Operation_Table.STORE: | ||
72 | case LSO_Enums.Operation_Table.STORES: | ||
73 | case LSO_Enums.Operation_Table.STOREL: | ||
74 | case LSO_Enums.Operation_Table.STOREV: | ||
75 | case LSO_Enums.Operation_Table.STOREQ: | ||
76 | case LSO_Enums.Operation_Table.STOREG: | ||
77 | case LSO_Enums.Operation_Table.STOREGS: | ||
78 | case LSO_Enums.Operation_Table.STOREGL: | ||
79 | case LSO_Enums.Operation_Table.STOREGV: | ||
80 | case LSO_Enums.Operation_Table.STOREGQ: | ||
81 | case LSO_Enums.Operation_Table.LOADP: | ||
82 | case LSO_Enums.Operation_Table.LOADSP: | ||
83 | case LSO_Enums.Operation_Table.LOADLP: | ||
84 | case LSO_Enums.Operation_Table.LOADVP: | ||
85 | case LSO_Enums.Operation_Table.LOADQP: | ||
86 | case LSO_Enums.Operation_Table.PUSH: | ||
87 | case LSO_Enums.Operation_Table.PUSHS: | ||
88 | case LSO_Enums.Operation_Table.PUSHL: | ||
89 | case LSO_Enums.Operation_Table.PUSHV: | ||
90 | case LSO_Enums.Operation_Table.PUSHQ: | ||
91 | case LSO_Enums.Operation_Table.PUSHG: | ||
92 | case LSO_Enums.Operation_Table.PUSHGS: | ||
93 | case LSO_Enums.Operation_Table.PUSHGL: | ||
94 | case LSO_Enums.Operation_Table.PUSHGV: | ||
95 | case LSO_Enums.Operation_Table.PUSHGQ: | ||
96 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
97 | break; | ||
98 | // None | ||
99 | case LSO_Enums.Operation_Table.PUSHIP: | ||
100 | case LSO_Enums.Operation_Table.PUSHBP: | ||
101 | case LSO_Enums.Operation_Table.PUSHSP: | ||
102 | // Push Stack Top (Memory Address) to stack | ||
103 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldc_I4, " + myHeader.SP + ");"); | ||
104 | Common.SendToDebug("Instruction " + idesc + ": Description: Pushing Stack Top (Memory Address from header) to stack"); | ||
105 | il.Emit(OpCodes.Ldc_I4, myHeader.SP); | ||
106 | break; | ||
107 | // BYTE | ||
108 | case LSO_Enums.Operation_Table.PUSHARGB: | ||
109 | Common.SendToDebug("Param1: " + br_read(1)[0]); | ||
110 | break; | ||
111 | // INTEGER | ||
112 | case LSO_Enums.Operation_Table.PUSHARGI: | ||
113 | // TODO: What is size of integer? | ||
114 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | ||
115 | Common.SendToDebug("Instruction PUSHSP: il.Emit(OpCodes.Ldc_I4, " + u32p1 + ");"); | ||
116 | Common.SendToDebug("Param1: " + u32p1); | ||
117 | il.Emit(OpCodes.Ldc_I4, u32p1); | ||
118 | break; | ||
119 | // FLOAT | ||
120 | case LSO_Enums.Operation_Table.PUSHARGF: | ||
121 | // TODO: What is size of float? | ||
122 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
123 | break; | ||
124 | // STRING | ||
125 | case LSO_Enums.Operation_Table.PUSHARGS: | ||
126 | string s = Read_String(); | ||
127 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldstr, \"" + s + "\");"); | ||
128 | Common.SendToDebug("Param1: " + s); | ||
129 | il.Emit(OpCodes.Ldstr, s); | ||
130 | break; | ||
131 | // VECTOR z,y,x | ||
132 | case LSO_Enums.Operation_Table.PUSHARGV: | ||
133 | Common.SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
134 | Common.SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
135 | Common.SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
136 | break; | ||
137 | // ROTATION s,z,y,x | ||
138 | case LSO_Enums.Operation_Table.PUSHARGQ: | ||
139 | Common.SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
140 | Common.SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
141 | Common.SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
142 | Common.SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
143 | break; | ||
144 | // LONG | ||
145 | case LSO_Enums.Operation_Table.PUSHARGE: | ||
146 | u32p1 = BitConverter.ToUInt32(br_read(4), 0); | ||
147 | //Common.SendToDebug("Instruction PUSHSP: il.Emit(OpCodes., " + u32p1 + ");"); | ||
148 | Common.SendToDebug("Instruction " + idesc + ": Ignoring (not in use according to doc)"); | ||
149 | //Common.SendToDebug("Instruction " + idesc + ": Description: Pushes X bytes of $00 onto the stack (used to put space for local variable memory for a call)"); | ||
150 | Common.SendToDebug("Param1: " + u32p1); | ||
151 | //il.Emit(OpCodes.ldc_i4, u32p1); | ||
152 | //if (u32p1 > 0) { | ||
153 | //for (int _ic=0; _ic < u32p1; _ic++) | ||
154 | //{ | ||
155 | // Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldnull);"); | ||
156 | // il.Emit(OpCodes.Ldnull); | ||
157 | //} | ||
158 | break; | ||
159 | // BYTE | ||
160 | case LSO_Enums.Operation_Table.ADD: | ||
161 | bp1 = br_read(1)[0]; | ||
162 | Common.SendToDebug("Instruction " + idesc + ": Add type: " + ((LSO_Enums.OpCode_Add_TypeDefs)bp1).ToString()); | ||
163 | Common.SendToDebug("Param1: " + bp1); | ||
164 | switch ((LSO_Enums.OpCode_Add_TypeDefs)bp1) | ||
165 | { | ||
166 | case LSO_Enums.OpCode_Add_TypeDefs.String: | ||
167 | Common.SendToDebug("Instruction " + idesc | ||
168 | + ": il.Emit(OpCodes.Call, typeof(System.String).GetMethod(\"Concat\", new Type[] { typeof(object), typeof(object) }));"); | ||
169 | il.Emit(OpCodes.Call, typeof(System.String).GetMethod | ||
170 | ("Concat", new Type[] { typeof(object), typeof(object) })); | ||
171 | |||
172 | break; | ||
173 | case LSO_Enums.OpCode_Add_TypeDefs.UInt32: | ||
174 | default: | ||
175 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Add);"); | ||
176 | il.Emit(OpCodes.Add); | ||
177 | break; | ||
178 | } | ||
179 | |||
180 | |||
181 | //il.Emit(OpCodes.Add, p1); | ||
182 | break; | ||
183 | case LSO_Enums.Operation_Table.SUB: | ||
184 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Sub);"); | ||
185 | bp1 = br_read(1)[0]; | ||
186 | Common.SendToDebug("Param1: " + bp1); | ||
187 | il.Emit(OpCodes.Sub); | ||
188 | //il.Emit(OpCodes.Sub, p1); | ||
189 | break; | ||
190 | case LSO_Enums.Operation_Table.MUL: | ||
191 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Mul);"); | ||
192 | bp1 = br_read(1)[0]; | ||
193 | Common.SendToDebug("Param1: " + bp1); | ||
194 | il.Emit(OpCodes.Mul); | ||
195 | //il.Emit(OpCodes.Mul, p1); | ||
196 | break; | ||
197 | case LSO_Enums.Operation_Table.DIV: | ||
198 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Div);"); | ||
199 | bp1 = br_read(1)[0]; | ||
200 | Common.SendToDebug("Param1: " + bp1); | ||
201 | il.Emit(OpCodes.Div); | ||
202 | //il.Emit(OpCodes.Div, p1); | ||
203 | break; | ||
204 | case LSO_Enums.Operation_Table.EQ: | ||
205 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ceq);"); | ||
206 | bp1 = br_read(1)[0]; | ||
207 | Common.SendToDebug("Param1: " + bp1); | ||
208 | il.Emit(OpCodes.Ceq); | ||
209 | //il.Emit(OpCodes.Ceq, p1); | ||
210 | break; | ||
211 | case LSO_Enums.Operation_Table.NEQ: | ||
212 | case LSO_Enums.Operation_Table.LEQ: | ||
213 | case LSO_Enums.Operation_Table.GEQ: | ||
214 | case LSO_Enums.Operation_Table.LESS: | ||
215 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Clt_Un);"); | ||
216 | bp1 = br_read(1)[0]; | ||
217 | Common.SendToDebug("Param1: " + bp1); | ||
218 | il.Emit(OpCodes.Clt_Un); | ||
219 | //il.Emit(OpCodes.Clt, p1); | ||
220 | break; | ||
221 | case LSO_Enums.Operation_Table.GREATER: | ||
222 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Cgt_Un);"); | ||
223 | bp1 = br_read(1)[0]; | ||
224 | Common.SendToDebug("Param1: " + bp1); | ||
225 | il.Emit(OpCodes.Cgt_Un); | ||
226 | //il.Emit(OpCodes.Cgt, p1); | ||
227 | break; | ||
228 | case LSO_Enums.Operation_Table.MOD: | ||
229 | case LSO_Enums.Operation_Table.BOOLOR: | ||
230 | bp1 = br_read(1)[0]; | ||
231 | Common.SendToDebug("Param1: " + bp1); | ||
232 | break; | ||
233 | // LONG | ||
234 | case LSO_Enums.Operation_Table.JUMP: | ||
235 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
236 | break; | ||
237 | // BYTE, LONG | ||
238 | case LSO_Enums.Operation_Table.JUMPIF: | ||
239 | case LSO_Enums.Operation_Table.JUMPNIF: | ||
240 | Common.SendToDebug("Param1: " + br_read(1)[0]); | ||
241 | Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
242 | break; | ||
243 | // LONG | ||
244 | case LSO_Enums.Operation_Table.STATE: | ||
245 | bp1 = br_read(1)[0]; | ||
246 | //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack | ||
247 | //il.Emit(OpCodes.Ldc_I4, 0); // Push index position | ||
248 | //il.Emit(OpCodes.Ldstr, EventList[p1]); // Push value | ||
249 | //il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value | ||
250 | break; | ||
251 | case LSO_Enums.Operation_Table.CALL: | ||
252 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
253 | break; | ||
254 | // BYTE | ||
255 | case LSO_Enums.Operation_Table.CAST: | ||
256 | bp1 = br_read(1)[0]; | ||
257 | Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + ((LSO_Enums.OpCode_Cast_TypeDefs)bp1)); | ||
258 | Common.SendToDebug("Param1: " + bp1); | ||
259 | switch ((LSO_Enums.OpCode_Cast_TypeDefs)bp1) | ||
260 | { | ||
261 | case LSO_Enums.OpCode_Cast_TypeDefs.String: | ||
262 | Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Calli, typeof(System.Convert).GetMethod(\"ToString\", new Type[] { typeof(object) }));"); | ||
263 | //il.Emit(OpCodes.Box, typeof (UInt32)); | ||
264 | il.Emit(OpCodes.Calli, typeof(Common).GetMethod | ||
265 | ("Cast_ToString", new Type[] { typeof(object) })); | ||
266 | |||
267 | //il.Emit(OpCodes.Box, typeof(System.UInt32) ); | ||
268 | //il.Emit(OpCodes.Box, typeof(string)); | ||
269 | |||
270 | //il.Emit(OpCodes.Conv_R8); | ||
271 | //il.Emit(OpCodes.Call, typeof(System.Convert).GetMethod | ||
272 | // ("ToString", new Type[] { typeof(float) })); | ||
273 | |||
274 | break; | ||
275 | default: | ||
276 | Common.SendToDebug("Instruction " + idesc + ": Unknown cast type!"); | ||
277 | break; | ||
278 | } | ||
279 | break; | ||
280 | // LONG | ||
281 | case LSO_Enums.Operation_Table.STACKTOS: | ||
282 | case LSO_Enums.Operation_Table.STACKTOL: | ||
283 | Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); | ||
284 | break; | ||
285 | // BYTE | ||
286 | case LSO_Enums.Operation_Table.PRINT: | ||
287 | case LSO_Enums.Operation_Table.CALLLIB: | ||
288 | Common.SendToDebug("Param1: " + br_read(1)[0]); | ||
289 | break; | ||
290 | // SHORT | ||
291 | case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: | ||
292 | // TODO: What is size of short? | ||
293 | UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); | ||
294 | Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString()); | ||
295 | Common.SendToDebug("Param1: " + U16p1); | ||
296 | switch ((LSO_Enums.BuiltIn_Functions)U16p1) | ||
297 | { | ||
298 | case LSO_Enums.BuiltIn_Functions.llSay: | ||
299 | Common.SendToDebug("Instruction " + idesc + " " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString() | ||
300 | + ": Mapped to internal function"); | ||
301 | |||
302 | //il.Emit(OpCodes.Ldstr, "INTERNAL COMMAND: llSay({0}, \"{1}\""); | ||
303 | //il.Emit(OpCodes.Call, typeof(IL_Helper).GetMethod("ReverseFormatString", | ||
304 | // new Type[] { typeof(string), typeof(UInt32), typeof(string) } | ||
305 | //)); | ||
306 | |||
307 | |||
308 | //il.Emit(OpCodes.Pop); | ||
309 | //il.Emit(OpCodes.Call, | ||
310 | // typeof(Console).GetMethod("WriteLine", | ||
311 | // new Type[] { typeof(string) } | ||
312 | //)); | ||
313 | |||
314 | |||
315 | il.Emit(OpCodes.Call, | ||
316 | typeof(Common).GetMethod("SendToLog", | ||
317 | new Type[] { typeof(string) } | ||
318 | )); | ||
319 | |||
320 | |||
321 | |||
322 | //il.Emit(OpCodes.Pop); | ||
323 | |||
324 | //il.Emit(OpCodes.Ldind_I2, 0); | ||
325 | |||
326 | //il.Emit(OpCodes.Call, typeof(string).GetMethod("Format", new Type[] { typeof(string), typeof(object) })); | ||
327 | //il.EmitCalli(OpCodes.Calli, | ||
328 | //il.Emit(OpCodes.Call, typeof().GetMethod | ||
329 | // ("llSay", new Type[] { typeof(UInt32), typeof(string) })); | ||
330 | break; | ||
331 | default: | ||
332 | Common.SendToDebug("Instruction " + idesc + ": " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString() + ": INTERNAL COMMAND NOT IMPLEMENTED"); | ||
333 | break; | ||
334 | } | ||
335 | |||
336 | //Common.SendToDebug("Instruction " + idesc + ": DEBUG: Faking return code:"); | ||
337 | //Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Ldc_I4, 0);"); | ||
338 | //il.Emit(OpCodes.Ldc_I4, 0); | ||
339 | break; | ||
340 | |||
341 | // RETURN | ||
342 | case LSO_Enums.Operation_Table.RETURN: | ||
343 | |||
344 | Common.SendToDebug("Last OPCODE was return command. Code chunk execution complete."); | ||
345 | return true; | ||
346 | break; | ||
347 | } | ||
348 | return false; | ||
349 | } | ||
350 | |||
351 | } | ||
352 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs index b45abe0..6f93954 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Enums.cs | |||
@@ -1,11 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 */ | ||
1 | using System; | 29 | using System; |
2 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
3 | using System.Text; | 31 | using System.Text; |
4 | 32 | ||
5 | namespace OpenSim.ScriptEngines.LSL | 33 | namespace OpenSim.Region.Scripting.LSL |
6 | { | 34 | { |
7 | static class LSO_Enums | 35 | static class LSO_Enums |
8 | { | 36 | { |
37 | //public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types; | ||
38 | |||
39 | //LSO_Enums() { | ||
40 | // OpCode_Add_Types.Add(51, typeof(String)); | ||
41 | // OpCode_Add_Types.Add(17, typeof(UInt32)); | ||
42 | //} | ||
43 | |||
44 | public enum OpCode_Add_TypeDefs | ||
45 | { | ||
46 | String = 51, | ||
47 | UInt32 = 17 | ||
48 | } | ||
49 | public enum OpCode_Cast_TypeDefs | ||
50 | { | ||
51 | String = 19 | ||
52 | } | ||
53 | |||
54 | |||
55 | public struct Vector | ||
56 | { | ||
57 | public UInt32 Z; | ||
58 | public UInt32 Y; | ||
59 | public UInt32 X; | ||
60 | } | ||
61 | public struct Rotation | ||
62 | { | ||
63 | public UInt32 S; | ||
64 | public UInt32 Z; | ||
65 | public UInt32 Y; | ||
66 | public UInt32 X; | ||
67 | } | ||
9 | 68 | ||
10 | public enum Variable_Type_Codes | 69 | public enum Variable_Type_Codes |
11 | { | 70 | { |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs index ebe4465..18dca74 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Parser.cs | |||
@@ -1,22 +1,48 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.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; | ||
2 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
3 | using System.Text; | 31 | using System.Text; |
4 | using System.IO; | 32 | using System.IO; |
5 | using System.Reflection; | 33 | using System.Reflection; |
6 | using System.Reflection.Emit; | 34 | using System.Reflection.Emit; |
7 | using OpenSim.Region.Scripting; | ||
8 | 35 | ||
9 | namespace OpenSim.ScriptEngines.LSL | 36 | namespace OpenSim.Region.Scripting.LSL |
10 | { | 37 | { |
11 | class LSO_Parser | 38 | partial class LSO_Parser |
12 | { | 39 | { |
13 | private bool Debug = true; | ||
14 | private FileStream fs; | 40 | private FileStream fs; |
15 | private BinaryReader br; | 41 | private BinaryReader br; |
16 | private LSO_Struct.Header myHeader; | 42 | private LSO_Struct.Header myHeader; |
17 | 43 | ||
18 | private TypeBuilder typeBuilder; | 44 | private TypeBuilder typeBuilder; |
19 | private ScriptInfo WorldAPI; | 45 | private System.Collections.Generic.List<string> EventList = new System.Collections.Generic.List<string>(); |
20 | 46 | ||
21 | /// <summary> | 47 | /// <summary> |
22 | /// Parse LSO file. | 48 | /// Parse LSO file. |
@@ -24,12 +50,12 @@ using OpenSim.Region.Scripting; | |||
24 | /// TODO: What else does it do? | 50 | /// TODO: What else does it do? |
25 | /// </summary> | 51 | /// </summary> |
26 | /// <param name="FileName">FileName of LSO ByteCode file</param> | 52 | /// <param name="FileName">FileName of LSO ByteCode file</param> |
27 | public void ParseFile(string FileName, ScriptInfo _WorldAPI, ref TypeBuilder _typeBuilder) | 53 | public void ParseFile(string FileName, TypeBuilder _typeBuilder) |
28 | { | 54 | { |
29 | typeBuilder = _typeBuilder; | 55 | typeBuilder = _typeBuilder; |
30 | WorldAPI = _WorldAPI; | 56 | //WorldAPI = _WorldAPI; |
31 | // Open | 57 | // Open |
32 | SendToDebug("Opening filename: " + FileName); | 58 | Common.SendToDebug("Opening filename: " + FileName); |
33 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); | 59 | fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); |
34 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); | 60 | br = new BinaryReader(fs, Encoding.BigEndianUnicode); |
35 | 61 | ||
@@ -38,7 +64,7 @@ using OpenSim.Region.Scripting; | |||
38 | 64 | ||
39 | 65 | ||
40 | // HEADER BLOCK | 66 | // HEADER BLOCK |
41 | SendToDebug("Reading HEADER BLOCK at: 0"); | 67 | Common.SendToDebug("Reading HEADER BLOCK at: 0"); |
42 | fs.Seek(0, SeekOrigin.Begin); | 68 | fs.Seek(0, SeekOrigin.Begin); |
43 | myHeader = new LSO_Struct.Header(); | 69 | myHeader = new LSO_Struct.Header(); |
44 | myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); | 70 | myHeader.TM = BitConverter.ToUInt32(br_read(4), 0); |
@@ -65,50 +91,50 @@ using OpenSim.Region.Scripting; | |||
65 | myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); | 91 | myHeader.NER = BitConverter.ToUInt64(br_read(8), 0); |
66 | 92 | ||
67 | // Print Header Block to debug | 93 | // Print Header Block to debug |
68 | SendToDebug("TM - Top of memory (size): " + myHeader.TM); | 94 | Common.SendToDebug("TM - Top of memory (size): " + myHeader.TM); |
69 | SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); | 95 | Common.SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP); |
70 | SendToDebug("VN - Version number: " + myHeader.VN); | 96 | Common.SendToDebug("VN - Version number: " + myHeader.VN); |
71 | SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); | 97 | Common.SendToDebug("BP - Local Frame Pointer: " + myHeader.BP); |
72 | SendToDebug("SP - Stack Pointer: " + myHeader.SP); | 98 | Common.SendToDebug("SP - Stack Pointer: " + myHeader.SP); |
73 | SendToDebug("HR - Heap Register: " + myHeader.HR); | 99 | Common.SendToDebug("HR - Heap Register: " + myHeader.HR); |
74 | SendToDebug("HP - Heap Pointer: " + myHeader.HP); | 100 | Common.SendToDebug("HP - Heap Pointer: " + myHeader.HP); |
75 | SendToDebug("CS - Current State: " + myHeader.CS); | 101 | Common.SendToDebug("CS - Current State: " + myHeader.CS); |
76 | SendToDebug("NS - Next State: " + myHeader.NS); | 102 | Common.SendToDebug("NS - Next State: " + myHeader.NS); |
77 | SendToDebug("CE - Current Events: " + myHeader.CE); | 103 | Common.SendToDebug("CE - Current Events: " + myHeader.CE); |
78 | SendToDebug("IE - In Event: " + myHeader.IE); | 104 | Common.SendToDebug("IE - In Event: " + myHeader.IE); |
79 | SendToDebug("ER - Event Register: " + myHeader.ER); | 105 | Common.SendToDebug("ER - Event Register: " + myHeader.ER); |
80 | SendToDebug("FR - Fault Register: " + myHeader.FR); | 106 | Common.SendToDebug("FR - Fault Register: " + myHeader.FR); |
81 | SendToDebug("SLR - Sleep Register: " + myHeader.SLR); | 107 | Common.SendToDebug("SLR - Sleep Register: " + myHeader.SLR); |
82 | SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); | 108 | Common.SendToDebug("GVR - Global Variable Register: " + myHeader.GVR); |
83 | SendToDebug("GFR - Global Function Register: " + myHeader.GFR); | 109 | Common.SendToDebug("GFR - Global Function Register: " + myHeader.GFR); |
84 | SendToDebug("PR - Parameter Register: " + myHeader.PR); | 110 | Common.SendToDebug("PR - Parameter Register: " + myHeader.PR); |
85 | SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); | 111 | Common.SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR); |
86 | SendToDebug("SR - State Register: " + myHeader.SR); | 112 | Common.SendToDebug("SR - State Register: " + myHeader.SR); |
87 | SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); | 113 | Common.SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE); |
88 | SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); | 114 | Common.SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE); |
89 | SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); | 115 | Common.SendToDebug("NER - 64-bit Event Register: " + myHeader.NER); |
90 | SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); | 116 | Common.SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position); |
91 | 117 | ||
92 | // STATIC BLOCK | 118 | // STATIC BLOCK |
93 | SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); | 119 | Common.SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR); |
94 | fs.Seek(myHeader.GVR, SeekOrigin.Begin); | 120 | fs.Seek(myHeader.GVR, SeekOrigin.Begin); |
95 | int StaticBlockCount = 0; | 121 | int StaticBlockCount = 0; |
96 | // Read function blocks until we hit GFR | 122 | // Read function blocks until we hit GFR |
97 | while (fs.Position < myHeader.GFR) | 123 | while (fs.Position < myHeader.GFR) |
98 | { | 124 | { |
99 | StaticBlockCount++; | 125 | StaticBlockCount++; |
100 | SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position); | 126 | Common.SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + fs.Position); |
101 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); | 127 | //fs.Seek(myHeader.GVR, SeekOrigin.Begin); |
102 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); | 128 | LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); |
103 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); | 129 | myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); |
104 | myStaticBlock.ObjectType = br_read(1)[0]; | 130 | myStaticBlock.ObjectType = br_read(1)[0]; |
105 | SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); | 131 | Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); |
106 | myStaticBlock.Unknown = br_read(1)[0]; | 132 | myStaticBlock.Unknown = br_read(1)[0]; |
107 | // Size of datatype varies | 133 | // Size of datatype varies |
108 | if (myStaticBlock.ObjectType != 0) | 134 | if (myStaticBlock.ObjectType != 0) |
109 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); | 135 | myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); |
110 | } | 136 | } |
111 | SendToDebug("Number of Static Blocks read: " + StaticBlockCount); | 137 | Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); |
112 | 138 | ||
113 | 139 | ||
114 | // FUNCTION BLOCK | 140 | // FUNCTION BLOCK |
@@ -117,22 +143,22 @@ using OpenSim.Region.Scripting; | |||
117 | if (myHeader.GFR == myHeader.SR) | 143 | if (myHeader.GFR == myHeader.SR) |
118 | { | 144 | { |
119 | // If GFR and SR are at same position then there is no fuction block | 145 | // If GFR and SR are at same position then there is no fuction block |
120 | SendToDebug("No FUNCTION BLOCK found"); | 146 | Common.SendToDebug("No FUNCTION BLOCK found"); |
121 | } else { | 147 | } else { |
122 | SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); | 148 | Common.SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR); |
123 | fs.Seek(myHeader.GFR, SeekOrigin.Begin); | 149 | fs.Seek(myHeader.GFR, SeekOrigin.Begin); |
124 | myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); | 150 | myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0); |
125 | SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); | 151 | Common.SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount); |
126 | if (myFunctionBlock.FunctionCount > 0) | 152 | if (myFunctionBlock.FunctionCount > 0) |
127 | { | 153 | { |
128 | myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; | 154 | myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount]; |
129 | for (int i = 0; i < myFunctionBlock.FunctionCount; i++) | 155 | for (int i = 0; i < myFunctionBlock.FunctionCount; i++) |
130 | { | 156 | { |
131 | SendToDebug("Reading function " + i + " at: " + fs.Position); | 157 | Common.SendToDebug("Reading function " + i + " at: " + fs.Position); |
132 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) | 158 | // TODO: ADD TO FUNCTION LIST (How do we identify it later?) |
133 | // Note! Absolute position | 159 | // Note! Absolute position |
134 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; | 160 | myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; |
135 | SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); | 161 | Common.SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); |
136 | } | 162 | } |
137 | } | 163 | } |
138 | } | 164 | } |
@@ -140,7 +166,7 @@ using OpenSim.Region.Scripting; | |||
140 | 166 | ||
141 | // STATE FRAME BLOCK | 167 | // STATE FRAME BLOCK |
142 | // Always right after FUNCTION BLOCK | 168 | // Always right after FUNCTION BLOCK |
143 | SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); | 169 | Common.SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); |
144 | fs.Seek(myHeader.SR, SeekOrigin.Begin); | 170 | fs.Seek(myHeader.SR, SeekOrigin.Begin); |
145 | LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); | 171 | LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock(); |
146 | myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); | 172 | myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0); |
@@ -150,12 +176,12 @@ using OpenSim.Region.Scripting; | |||
150 | myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; | 176 | myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount]; |
151 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) | 177 | for (int i = 0; i < myStateFrameBlock.StateCount; i++) |
152 | { | 178 | { |
153 | SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position); | 179 | Common.SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position); |
154 | // Position is relative to state frame | 180 | // Position is relative to state frame |
155 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); | 181 | myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); |
156 | myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); | 182 | myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); |
157 | SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); | 183 | Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); |
158 | SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); | 184 | Common.SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); |
159 | 185 | ||
160 | //// Read STATE BLOCK | 186 | //// Read STATE BLOCK |
161 | //long CurPos = fs.Position; | 187 | //long CurPos = fs.Position; |
@@ -175,7 +201,7 @@ using OpenSim.Region.Scripting; | |||
175 | { | 201 | { |
176 | 202 | ||
177 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); | 203 | fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); |
178 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); | 204 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); |
179 | 205 | ||
180 | // READ: STATE BLOCK HEADER | 206 | // READ: STATE BLOCK HEADER |
181 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); | 207 | myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); |
@@ -183,9 +209,9 @@ using OpenSim.Region.Scripting; | |||
183 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 209 | myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
184 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; | 210 | myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; |
185 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note | 211 | myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note |
186 | SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); | 212 | Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); |
187 | SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); | 213 | Common.SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); |
188 | SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); | 214 | Common.SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); |
189 | 215 | ||
190 | // We need to count number of bits flagged in EventMask? | 216 | // We need to count number of bits flagged in EventMask? |
191 | 217 | ||
@@ -202,11 +228,11 @@ using OpenSim.Region.Scripting; | |||
202 | { | 228 | { |
203 | // We got an event | 229 | // We got an event |
204 | // READ: STATE BLOCK HANDLER | 230 | // READ: STATE BLOCK HANDLER |
205 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); | 231 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); |
206 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); | 232 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); |
207 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); | 233 | myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); |
208 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); | 234 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); |
209 | SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize ); | 235 | Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize ); |
210 | } | 236 | } |
211 | } | 237 | } |
212 | } | 238 | } |
@@ -224,7 +250,7 @@ using OpenSim.Region.Scripting; | |||
224 | // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; | 250 | // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount]; |
225 | // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) | 251 | // for (int i = 0; i < myFunctionBlock.FunctionCount; i++) |
226 | // { | 252 | // { |
227 | // SendToDebug("Reading Function Code Chunk " + i); | 253 | // Common.SendToDebug("Reading Function Code Chunk " + i); |
228 | // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); | 254 | // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]); |
229 | // } | 255 | // } |
230 | 256 | ||
@@ -244,32 +270,23 @@ using OpenSim.Region.Scripting; | |||
244 | 270 | ||
245 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) | 271 | if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) |
246 | { | 272 | { |
247 | SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); | 273 | Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); |
248 | 274 | ||
249 | 275 | ||
250 | // Override a Method / Function | 276 | // Override a Method / Function |
251 | string eventname = "event_" + (LSO_Enums.Event_Mask_Values)ii; | 277 | string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values)ii; |
252 | SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); | 278 | Common.SendToDebug("Event Name: " + eventname); |
253 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | 279 | if (Common.IL_ProcessCodeChunks) |
254 | MethodAttributes.Private | MethodAttributes.Virtual, | 280 | { |
255 | typeof(void), | 281 | EventList.Add(eventname); |
256 | new Type[] { typeof(object) }); | 282 | |
257 | 283 | // JUMP TO CODE PROCESSOR | |
258 | SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); | 284 | ProcessCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, typeBuilder, eventname); |
259 | typeBuilder.DefineMethodOverride(methodBuilder, | 285 | } |
260 | typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | ||
261 | |||
262 | // Create the IL generator | ||
263 | |||
264 | SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); | ||
265 | ILGenerator il = methodBuilder.GetILGenerator(); | ||
266 | |||
267 | |||
268 | LSO_Struct.CodeChunk myECC = | ||
269 | GetCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, il, eventname); | ||
270 | } | 286 | } |
271 | 287 | ||
272 | } | 288 | } |
289 | |||
273 | } | 290 | } |
274 | 291 | ||
275 | } | 292 | } |
@@ -279,13 +296,16 @@ using OpenSim.Region.Scripting; | |||
279 | br.Close(); | 296 | br.Close(); |
280 | fs.Close(); | 297 | fs.Close(); |
281 | 298 | ||
299 | if (Common.IL_CreateFunctionList) | ||
300 | IL_INSERT_FUNCTIONLIST(); | ||
301 | |||
282 | } | 302 | } |
283 | 303 | ||
284 | private LSO_Struct.HeapBlock GetHeap(UInt32 pos) | 304 | private LSO_Struct.HeapBlock GetHeap(UInt32 pos) |
285 | { | 305 | { |
286 | // HEAP BLOCK | 306 | // HEAP BLOCK |
287 | // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) | 307 | // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries) |
288 | SendToDebug("Reading HEAP BLOCK at: " + pos); | 308 | Common.SendToDebug("Reading HEAP BLOCK at: " + pos); |
289 | fs.Seek(pos, SeekOrigin.Begin); | 309 | fs.Seek(pos, SeekOrigin.Begin); |
290 | 310 | ||
291 | LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); | 311 | LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock(); |
@@ -294,15 +314,12 @@ using OpenSim.Region.Scripting; | |||
294 | myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); | 314 | myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0); |
295 | myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); | 315 | myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType)); |
296 | 316 | ||
297 | SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); | 317 | Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); |
298 | SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); | 318 | Common.SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); |
299 | SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); | 319 | Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); |
300 | 320 | ||
301 | return myHeapBlock; | 321 | return myHeapBlock; |
302 | } | 322 | } |
303 | |||
304 | |||
305 | |||
306 | private byte[] br_read(int len) | 323 | private byte[] br_read(int len) |
307 | { | 324 | { |
308 | if (len <= 0) | 325 | if (len <= 0) |
@@ -317,7 +334,7 @@ using OpenSim.Region.Scripting; | |||
317 | } | 334 | } |
318 | catch (Exception e) | 335 | catch (Exception e) |
319 | { | 336 | { |
320 | SendToDebug("Exception: " + e.ToString()); | 337 | Common.SendToDebug("Exception: " + e.ToString()); |
321 | throw (e); | 338 | throw (e); |
322 | } | 339 | } |
323 | } | 340 | } |
@@ -327,7 +344,25 @@ using OpenSim.Region.Scripting; | |||
327 | // br.Read(bytes,0, len); | 344 | // br.Read(bytes,0, len); |
328 | // return bytes; | 345 | // return bytes; |
329 | //} | 346 | //} |
330 | 347 | private Type getLLObjectType(byte objectCode) | |
348 | { | ||
349 | switch ((LSO_Enums.Variable_Type_Codes)objectCode) | ||
350 | { | ||
351 | case LSO_Enums.Variable_Type_Codes.Void: return typeof(void); | ||
352 | case LSO_Enums.Variable_Type_Codes.Integer: return typeof(UInt32); | ||
353 | case LSO_Enums.Variable_Type_Codes.Float: return typeof(float); | ||
354 | case LSO_Enums.Variable_Type_Codes.String: return typeof(string); | ||
355 | case LSO_Enums.Variable_Type_Codes.Key: return typeof(string); | ||
356 | case LSO_Enums.Variable_Type_Codes.Vector: return typeof(LSO_Enums.Vector); | ||
357 | case LSO_Enums.Variable_Type_Codes.Rotation: return typeof(LSO_Enums.Rotation); | ||
358 | case LSO_Enums.Variable_Type_Codes.List: | ||
359 | Common.SendToDebug("TODO: List datatype not implemented yet!"); | ||
360 | return typeof(System.Collections.ArrayList); | ||
361 | default: | ||
362 | Common.SendToDebug("Lookup of LSL datatype " + objectCode + " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); | ||
363 | return typeof(object); | ||
364 | } | ||
365 | } | ||
331 | private int getObjectSize(byte ObjectType) | 366 | private int getObjectSize(byte ObjectType) |
332 | { | 367 | { |
333 | switch (ObjectType) | 368 | switch (ObjectType) |
@@ -346,13 +381,6 @@ using OpenSim.Region.Scripting; | |||
346 | return 0; | 381 | return 0; |
347 | } | 382 | } |
348 | } | 383 | } |
349 | private void SendToDebug(string Message) | ||
350 | { | ||
351 | if (Debug == true) | ||
352 | Console.WriteLine("Debug: " + Message); | ||
353 | } | ||
354 | |||
355 | |||
356 | private string Read_String() | 384 | private string Read_String() |
357 | { | 385 | { |
358 | string ret = ""; | 386 | string ret = ""; |
@@ -365,244 +393,235 @@ using OpenSim.Region.Scripting; | |||
365 | return ret; | 393 | return ret; |
366 | } | 394 | } |
367 | 395 | ||
368 | /// <summary> | 396 | /// <summary> |
369 | /// Reads a code chunk into structure and returns it. | 397 | /// Reads a code chunk and creates IL |
370 | /// </summary> | 398 | /// </summary> |
371 | /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> | 399 | /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param> |
372 | /// <returns></returns> | 400 | /// <param name="typeBuilder">TypeBuilder for assembly</param> |
373 | private LSO_Struct.CodeChunk GetCodeChunk(UInt32 pos, ILGenerator il, string eventname) | 401 | /// <param name="eventname">Name of event (function) to generate</param> |
402 | private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) | ||
374 | { | 403 | { |
375 | 404 | ||
376 | /* | ||
377 | * CLR TRY | ||
378 | */ | ||
379 | //SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); | ||
380 | il.BeginExceptionBlock(); | ||
381 | |||
382 | // Push "Hello World!" string to stack | ||
383 | //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | ||
384 | il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); | ||
385 | |||
386 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | ||
387 | //SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | ||
388 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | ||
389 | ("WriteLine", new Type[] { typeof(string) })); | ||
390 | |||
391 | |||
392 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); | 405 | LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); |
393 | 406 | ||
394 | SendToDebug("Reading Function Code Chunk at: " + pos); | 407 | Common.SendToDebug("Reading Function Code Chunk at: " + pos); |
395 | fs.Seek(pos, SeekOrigin.Begin); | 408 | fs.Seek(pos, SeekOrigin.Begin); |
396 | myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); | 409 | myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0); |
397 | SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize ); | 410 | Common.SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize ); |
398 | // Read until null | 411 | // Read until null |
399 | myCodeChunk.Comment = Read_String(); | 412 | myCodeChunk.Comment = Read_String(); |
400 | SendToDebug("Function comment: " + myCodeChunk.Comment); | 413 | Common.SendToDebug("Function comment: " + myCodeChunk.Comment); |
401 | myCodeChunk.ReturnType = br_read(1)[0]; | 414 | myCodeChunk.ReturnType = br_read(1)[0]; |
402 | SendToDebug("Return type: " + (LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType); | 415 | Common.SendToDebug("Return type #" + myCodeChunk.ReturnType + ": " + (getLLObjectType(myCodeChunk.ReturnType).ToString())); |
416 | |||
403 | // TODO: How to determine number of codechunks -- does this method work? | 417 | // TODO: How to determine number of codechunks -- does this method work? |
404 | myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); | 418 | myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); |
405 | byte reader = br_read(1)[0]; | 419 | byte reader = br_read(1)[0]; |
406 | reader = br_read(1)[0]; | 420 | reader = br_read(1)[0]; |
421 | |||
422 | // NOTE ON CODE CHUNK ARGUMENTS | ||
423 | // This determins type definition | ||
407 | int ccount = 0; | 424 | int ccount = 0; |
408 | while (reader != 0x000) | 425 | while (reader != 0x000) |
409 | { | 426 | { |
410 | ccount++; | 427 | ccount++; |
411 | SendToDebug("Reading Code Chunk Argument " + ccount); | 428 | Common.SendToDebug("Reading Code Chunk Argument " + ccount); |
412 | LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); | 429 | LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument(); |
413 | CCA.FunctionReturnType = reader; | 430 | CCA.FunctionReturnType = reader; |
414 | reader = br_read(1)[0]; | 431 | reader = br_read(1)[0]; |
415 | CCA.NullString = reader; | 432 | CCA.NullString = reader; |
416 | myCodeChunk.CodeChunkArguments.Add(CCA); | 433 | myCodeChunk.CodeChunkArguments.Add(CCA); |
417 | SendToDebug("Code Chunk Argument " + ccount + " return type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType); | 434 | Common.SendToDebug("Code Chunk Argument " + ccount + " type: " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType); |
435 | } | ||
436 | // Create string array | ||
437 | Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; | ||
438 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) | ||
439 | { | ||
440 | MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType); | ||
441 | Common.SendToDebug("Method argument " + _ic + ": " + getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType).ToString()); | ||
418 | } | 442 | } |
419 | // End marker is 0x000 | 443 | // End marker is 0x000 |
420 | myCodeChunk.EndMarker = reader; | 444 | myCodeChunk.EndMarker = reader; |
421 | // TODO: How to read and identify following code | 445 | |
422 | // TODO: Code is read until a return of some sort is found | 446 | |
447 | // | ||
448 | // Emit: START OF METHOD (FUNCTION) | ||
449 | // | ||
450 | |||
451 | Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); | ||
452 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | ||
453 | MethodAttributes.Public, | ||
454 | typeof(void), | ||
455 | MethodArgs); | ||
456 | //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), | ||
457 | // new Type[] { typeof(object) }, //); | ||
458 | |||
459 | //Common.SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder..."); | ||
460 | //typeBuilder.DefineMethodOverride(methodBuilder, | ||
461 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | ||
462 | |||
463 | // Create the IL generator | ||
464 | |||
465 | Common.SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); | ||
466 | ILGenerator il = methodBuilder.GetILGenerator(); | ||
467 | |||
468 | |||
469 | if (Common.IL_UseTryCatch) | ||
470 | IL_INSERT_TRY(il, eventname); | ||
471 | |||
472 | |||
473 | |||
474 | // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | ||
475 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | ||
476 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod | ||
477 | // ("WriteLine", new Type[] { typeof(string) })); | ||
478 | |||
479 | //Common.SendToDebug("STARTUP: il.Emit(OpCodes.Ldc_I4_S, 0);"); | ||
480 | |||
481 | //il.Emit(OpCodes.Ldc_I4_S, 0); | ||
482 | for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) | ||
483 | { | ||
484 | Common.SendToDebug("PARAMS: il.Emit(OpCodes.Ldarg, " + _ic + ");"); | ||
485 | il.Emit(OpCodes.Ldarg, _ic); | ||
486 | } | ||
487 | |||
488 | |||
489 | |||
490 | // | ||
491 | // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL | ||
492 | // | ||
423 | bool FoundRet = false; | 493 | bool FoundRet = false; |
424 | while (FoundRet == false) | 494 | while (FoundRet == false) |
425 | { | 495 | { |
426 | //reader = br_read(1)[0]; | 496 | FoundRet = LSL_PROCESS_OPCODE(il); |
427 | //UInt16 opcode = BitConverter.ToUInt16(br_read(1),0); | 497 | } |
428 | UInt16 opcode = br_read(1)[0]; | ||
429 | //long rPos = fs.Position; | ||
430 | SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); | ||
431 | switch (opcode) | ||
432 | { | ||
433 | // LONG | ||
434 | case (UInt16)LSO_Enums.Operation_Table.POPARG: | ||
435 | case (UInt16)LSO_Enums.Operation_Table.STORE: | ||
436 | case (UInt16)LSO_Enums.Operation_Table.STORES: | ||
437 | case (UInt16)LSO_Enums.Operation_Table.STOREL: | ||
438 | case (UInt16)LSO_Enums.Operation_Table.STOREV: | ||
439 | case (UInt16)LSO_Enums.Operation_Table.STOREQ: | ||
440 | case (UInt16)LSO_Enums.Operation_Table.STOREG: | ||
441 | case (UInt16)LSO_Enums.Operation_Table.STOREGS: | ||
442 | case (UInt16)LSO_Enums.Operation_Table.STOREGL: | ||
443 | case (UInt16)LSO_Enums.Operation_Table.STOREGV: | ||
444 | case (UInt16)LSO_Enums.Operation_Table.STOREGQ: | ||
445 | case (UInt16)LSO_Enums.Operation_Table.LOADP: | ||
446 | case (UInt16)LSO_Enums.Operation_Table.LOADSP: | ||
447 | case (UInt16)LSO_Enums.Operation_Table.LOADLP: | ||
448 | case (UInt16)LSO_Enums.Operation_Table.LOADVP: | ||
449 | case (UInt16)LSO_Enums.Operation_Table.LOADQP: | ||
450 | case (UInt16)LSO_Enums.Operation_Table.PUSH: | ||
451 | case (UInt16)LSO_Enums.Operation_Table.PUSHS: | ||
452 | case (UInt16)LSO_Enums.Operation_Table.PUSHL: | ||
453 | case (UInt16)LSO_Enums.Operation_Table.PUSHV: | ||
454 | case (UInt16)LSO_Enums.Operation_Table.PUSHQ: | ||
455 | case (UInt16)LSO_Enums.Operation_Table.PUSHG: | ||
456 | case (UInt16)LSO_Enums.Operation_Table.PUSHGS: | ||
457 | case (UInt16)LSO_Enums.Operation_Table.PUSHGL: | ||
458 | case (UInt16)LSO_Enums.Operation_Table.PUSHGV: | ||
459 | case (UInt16)LSO_Enums.Operation_Table.PUSHGQ: | ||
460 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | ||
461 | break; | ||
462 | // BYTE | ||
463 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGB: | ||
464 | SendToDebug("Param1: " + br_read(1)[0]); | ||
465 | break; | ||
466 | // INTEGER | ||
467 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGI: | ||
468 | // TODO: What is size of integer? | ||
469 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | ||
470 | break; | ||
471 | // FLOAT | ||
472 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGF: | ||
473 | // TODO: What is size of float? | ||
474 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | ||
475 | break; | ||
476 | // STRING | ||
477 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGS: | ||
478 | string s = Read_String(); | ||
479 | SendToDebug("Param1: " + s); | ||
480 | il.Emit(OpCodes.Ldstr, s); | ||
481 | break; | ||
482 | // VECTOR z,y,x | ||
483 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGV: | ||
484 | SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); | ||
485 | SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); | ||
486 | SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); | ||
487 | break; | ||
488 | // ROTATION s,z,y,x | ||
489 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGQ: | ||
490 | SendToDebug("Param1 S: " + BitConverter.ToUInt32(br_read(4),0)); | ||
491 | SendToDebug("Param1 Z: " + BitConverter.ToUInt32(br_read(4),0)); | ||
492 | SendToDebug("Param1 Y: " + BitConverter.ToUInt32(br_read(4),0)); | ||
493 | SendToDebug("Param1 X: " + BitConverter.ToUInt32(br_read(4),0)); | ||
494 | break; | ||
495 | // LONG | ||
496 | case (UInt16)LSO_Enums.Operation_Table.PUSHARGE: | ||
497 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | ||
498 | break; | ||
499 | // BYTE | ||
500 | case (UInt16)LSO_Enums.Operation_Table.ADD: | ||
501 | case (UInt16)LSO_Enums.Operation_Table.SUB: | ||
502 | case (UInt16)LSO_Enums.Operation_Table.MUL: | ||
503 | case (UInt16)LSO_Enums.Operation_Table.DIV: | ||
504 | case (UInt16)LSO_Enums.Operation_Table.MOD: | ||
505 | case (UInt16)LSO_Enums.Operation_Table.EQ: | ||
506 | case (UInt16)LSO_Enums.Operation_Table.NEQ: | ||
507 | case (UInt16)LSO_Enums.Operation_Table.LEQ: | ||
508 | case (UInt16)LSO_Enums.Operation_Table.GEQ: | ||
509 | case (UInt16)LSO_Enums.Operation_Table.LESS: | ||
510 | case (UInt16)LSO_Enums.Operation_Table.GREATER: | ||
511 | case (UInt16)LSO_Enums.Operation_Table.BOOLOR: | ||
512 | SendToDebug("Param1: " + br_read(1)[0]); | ||
513 | break; | ||
514 | // LONG | ||
515 | case (UInt16)LSO_Enums.Operation_Table.JUMP: | ||
516 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | ||
517 | break; | ||
518 | // BYTE, LONG | ||
519 | case (UInt16)LSO_Enums.Operation_Table.JUMPIF: | ||
520 | case (UInt16)LSO_Enums.Operation_Table.JUMPNIF: | ||
521 | SendToDebug("Param1: " + br_read(1)[0]); | ||
522 | SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4),0)); | ||
523 | break; | ||
524 | // LONG | ||
525 | case (UInt16)LSO_Enums.Operation_Table.STATE: | ||
526 | case (UInt16)LSO_Enums.Operation_Table.CALL: | ||
527 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | ||
528 | break; | ||
529 | // BYTE | ||
530 | case (UInt16)LSO_Enums.Operation_Table.CAST: | ||
531 | SendToDebug("Param1: " + br_read(1)[0]); | ||
532 | break; | ||
533 | // LONG | ||
534 | case (UInt16)LSO_Enums.Operation_Table.STACKTOS: | ||
535 | case (UInt16)LSO_Enums.Operation_Table.STACKTOL: | ||
536 | SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4),0)); | ||
537 | break; | ||
538 | // BYTE | ||
539 | case (UInt16)LSO_Enums.Operation_Table.PRINT: | ||
540 | case (UInt16)LSO_Enums.Operation_Table.CALLLIB: | ||
541 | SendToDebug("Param1: " + br_read(1)[0]); | ||
542 | break; | ||
543 | // SHORT | ||
544 | case (UInt16)LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: | ||
545 | // TODO: What is size of short? | ||
546 | UInt16 _i = BitConverter.ToUInt16(br_read(2), 0); | ||
547 | SendToDebug("Param1: " + _i); | ||
548 | switch (_i) | ||
549 | { | ||
550 | case (UInt16)LSO_Enums.BuiltIn_Functions.llSay: | ||
551 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | ||
552 | ("WriteLine", new Type[] { typeof(string) })); | ||
553 | break; | ||
554 | } | ||
555 | break; | ||
556 | 498 | ||
557 | 499 | ||
558 | // RETURN | 500 | if (Common.IL_UseTryCatch) |
559 | case (UInt16)LSO_Enums.Operation_Table.RETURN: | 501 | IL_INSERT_END_TRY(il, eventname); |
560 | SendToDebug("Last OPCODE was return command. Code chunk execution complete."); | 502 | |
561 | FoundRet = true; | 503 | // Emit: RETURN FROM METHOD |
562 | break; | 504 | il.Emit(OpCodes.Ret); |
563 | } | 505 | |
564 | //fs.Seek(rPos, SeekOrigin.Begin); | 506 | return; |
507 | |||
508 | } | ||
509 | |||
510 | private void IL_INSERT_FUNCTIONLIST() | ||
511 | { | ||
512 | |||
513 | Common.SendToDebug("Creating function list"); | ||
514 | |||
515 | |||
516 | string eventname = "GetFunctions"; | ||
517 | |||
518 | Common.SendToDebug("Creating IL " + eventname); | ||
519 | // Define a private String field. | ||
520 | //FieldBuilder myField = myTypeBuilder.DefineField("EventList", typeof(String[]), FieldAttributes.Public); | ||
521 | |||
522 | |||
523 | //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); | ||
524 | |||
525 | |||
526 | |||
527 | MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, | ||
528 | MethodAttributes.Public, | ||
529 | typeof(string[]), | ||
530 | null); | ||
531 | |||
532 | //typeBuilder.DefineMethodOverride(methodBuilder, | ||
533 | // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); | ||
534 | |||
535 | ILGenerator il = methodBuilder.GetILGenerator(); | ||
536 | |||
537 | |||
538 | |||
539 | |||
540 | // IL_INSERT_TRY(il, eventname); | ||
541 | |||
542 | // // Push string to stack | ||
543 | // il.Emit(OpCodes.Ldstr, "Inside " + eventname); | ||
565 | 544 | ||
545 | //// Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); | ||
546 | //il.Emit(OpCodes.Call, typeof(Console).GetMethod | ||
547 | // ("WriteLine", new Type[] { typeof(string) })); | ||
548 | |||
549 | //initIL.Emit(OpCodes.Newobj, typeof(string[])); | ||
550 | |||
551 | //string[] MyArray = new string[2] { "TestItem1" , "TestItem2" }; | ||
552 | |||
553 | il.DeclareLocal(typeof(string[])); | ||
554 | |||
555 | //il.Emit(OpCodes.Ldarg_0); | ||
556 | il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length | ||
557 | il.Emit(OpCodes.Newarr, typeof(String)); // create new string array | ||
558 | il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack | ||
559 | |||
560 | for (int lv = 0; lv < EventList.Count; lv++) | ||
561 | { | ||
562 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | ||
563 | il.Emit(OpCodes.Ldc_I4, lv); // Push index position | ||
564 | il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value | ||
565 | il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value | ||
566 | } | 566 | } |
567 | 567 | ||
568 | |||
569 | |||
570 | // IL_INSERT_END_TRY(il, eventname); | ||
571 | |||
572 | il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack | ||
573 | il.Emit(OpCodes.Ret); // Return | ||
574 | |||
575 | } | ||
576 | |||
577 | |||
578 | private void IL_INSERT_TRY(ILGenerator il, string eventname) | ||
579 | { | ||
580 | /* | ||
581 | * CLR TRY | ||
582 | */ | ||
583 | //Common.SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()"); | ||
584 | il.BeginExceptionBlock(); | ||
585 | |||
586 | // Push "Hello World!" string to stack | ||
587 | //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | ||
588 | il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); | ||
568 | 589 | ||
590 | } | ||
591 | |||
592 | private void IL_INSERT_END_TRY(ILGenerator il, string eventname) | ||
593 | { | ||
569 | /* | 594 | /* |
570 | * CATCH | 595 | * CATCH |
571 | */ | 596 | */ |
572 | SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); | 597 | Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); |
573 | il.BeginCatchBlock(typeof(Exception)); | 598 | il.BeginCatchBlock(typeof(Exception)); |
574 | 599 | ||
575 | // Push "Hello World!" string to stack | 600 | // Push "Hello World!" string to stack |
576 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); | 601 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); |
577 | il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); | 602 | il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": "); |
578 | 603 | ||
579 | //call void [mscorlib]System.Console::WriteLine(string) | 604 | //call void [mscorlib]System.Console::WriteLine(string) |
580 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 605 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
581 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 606 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
582 | ("Write", new Type[] { typeof(string) })); | 607 | ("Write", new Type[] { typeof(string) })); |
583 | 608 | ||
584 | //callvirt instance string [mscorlib]System.Exception::get_Message() | 609 | //callvirt instance string [mscorlib]System.Exception::get_Message() |
585 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); | 610 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); |
586 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod | 611 | il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod |
587 | ("get_Message")); | 612 | ("get_Message")); |
588 | 613 | ||
589 | //call void [mscorlib]System.Console::WriteLine(string) | 614 | //call void [mscorlib]System.Console::WriteLine(string) |
590 | SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); | 615 | Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); |
591 | il.Emit(OpCodes.Call, typeof(Console).GetMethod | 616 | il.Emit(OpCodes.Call, typeof(Console).GetMethod |
592 | ("WriteLine", new Type[] { typeof(string) })); | 617 | ("WriteLine", new Type[] { typeof(string) })); |
593 | 618 | ||
594 | /* | 619 | /* |
595 | * CLR END TRY | 620 | * CLR END TRY |
596 | */ | 621 | */ |
597 | //SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); | 622 | //Common.SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();"); |
598 | il.EndExceptionBlock(); | 623 | il.EndExceptionBlock(); |
599 | // Push "Return from current method, with return value if present" to stack | ||
600 | il.Emit(OpCodes.Ret); | ||
601 | |||
602 | |||
603 | |||
604 | return myCodeChunk; | ||
605 | |||
606 | } | 624 | } |
625 | |||
607 | } | 626 | } |
608 | } | 627 | } |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs index 66c6c5e..4d9be5d 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/LSO_Struct.cs | |||
@@ -1,9 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 */ | ||
1 | 29 | ||
2 | using System; | 30 | using System; |
3 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
4 | using System.Text; | 32 | using System.Text; |
5 | 33 | ||
6 | namespace OpenSim.ScriptEngines.LSL | 34 | namespace OpenSim.Region.Scripting.LSL |
7 | { | 35 | { |
8 | static class LSO_Struct | 36 | static class LSO_Struct |
9 | { | 37 | { |
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Server API/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Server API/LSL_BuiltIn_Commands_Interface.cs new file mode 100644 index 0000000..cf603b0 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Server API/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -0,0 +1,366 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.Scripting.LSL | ||
34 | { | ||
35 | public interface LSL_BuiltIn_Commands_Interface | ||
36 | { | ||
37 | void llSin(); | ||
38 | void llCos(); | ||
39 | void llTan(); | ||
40 | void llAtan2(); | ||
41 | void llSqrt(); | ||
42 | void llPow(); | ||
43 | void llAbs(); | ||
44 | void llFabs(); | ||
45 | void llFrand(); | ||
46 | void llFloor(); | ||
47 | void llCeil(); | ||
48 | void llRound(); | ||
49 | void llVecMag(); | ||
50 | void llVecNorm(); | ||
51 | void llVecDist(); | ||
52 | void llRot2Euler(); | ||
53 | void llEuler2Rot(); | ||
54 | void llAxes2Rot(); | ||
55 | void llRot2Fwd(); | ||
56 | void llRot2Left(); | ||
57 | void llRot2Up(); | ||
58 | void llRotBetween(); | ||
59 | void llWhisper(); | ||
60 | void llSay(UInt32 channelID, string text); | ||
61 | void llShout(); | ||
62 | void llListen(); | ||
63 | void llListenControl(); | ||
64 | void llListenRemove(); | ||
65 | void llSensor(); | ||
66 | void llSensorRepeat(); | ||
67 | void llSensorRemove(); | ||
68 | void llDetectedName(); | ||
69 | void llDetectedKey(); | ||
70 | void llDetectedOwner(); | ||
71 | void llDetectedType(); | ||
72 | void llDetectedPos(); | ||
73 | void llDetectedVel(); | ||
74 | void llDetectedGrab(); | ||
75 | void llDetectedRot(); | ||
76 | void llDetectedGroup(); | ||
77 | void llDetectedLinkNumber(); | ||
78 | void llDie(); | ||
79 | void llGround(); | ||
80 | void llCloud(); | ||
81 | void llWind(); | ||
82 | void llSetStatus(); | ||
83 | void llGetStatus(); | ||
84 | void llSetScale(); | ||
85 | void llGetScale(); | ||
86 | void llSetColor(); | ||
87 | void llGetAlpha(); | ||
88 | void llSetAlpha(); | ||
89 | void llGetColor(); | ||
90 | void llSetTexture(); | ||
91 | void llScaleTexture(); | ||
92 | void llOffsetTexture(); | ||
93 | void llRotateTexture(); | ||
94 | void llGetTexture(); | ||
95 | void llSetPos(); | ||
96 | void llGetPos(); | ||
97 | void llGetLocalPos(); | ||
98 | void llSetRot(); | ||
99 | void llGetRot(); | ||
100 | void llGetLocalRot(); | ||
101 | void llSetForce(); | ||
102 | void llGetForce(); | ||
103 | void llTarget(); | ||
104 | void llTargetRemove(); | ||
105 | void llRotTarget(); | ||
106 | void llRotTargetRemove(); | ||
107 | void llMoveToTarget(); | ||
108 | void llStopMoveToTarget(); | ||
109 | void llApplyImpulse(); | ||
110 | void llApplyRotationalImpulse(); | ||
111 | void llSetTorque(); | ||
112 | void llGetTorque(); | ||
113 | void llSetForceAndTorque(); | ||
114 | void llGetVel(); | ||
115 | void llGetAccel(); | ||
116 | void llGetOmega(); | ||
117 | void llGetTimeOfDay(); | ||
118 | void llGetWallclock(); | ||
119 | void llGetTime(); | ||
120 | void llResetTime(); | ||
121 | void llGetAndResetTime(); | ||
122 | void llSound(); | ||
123 | void llPlaySound(); | ||
124 | void llLoopSound(); | ||
125 | void llLoopSoundMaster(); | ||
126 | void llLoopSoundSlave(); | ||
127 | void llPlaySoundSlave(); | ||
128 | void llTriggerSound(); | ||
129 | void llStopSound(); | ||
130 | void llPreloadSound(); | ||
131 | void llGetSubString(); | ||
132 | void llDeleteSubString(); | ||
133 | void llInsertString(); | ||
134 | void llToUpper(); | ||
135 | void llToLower(); | ||
136 | void llGiveMoney(); | ||
137 | void llMakeExplosion(); | ||
138 | void llMakeFountain(); | ||
139 | void llMakeSmoke(); | ||
140 | void llMakeFire(); | ||
141 | void llRezObject(); | ||
142 | void llLookAt(); | ||
143 | void llStopLookAt(); | ||
144 | void llSetTimerEvent(); | ||
145 | void llSleep(); | ||
146 | void llGetMass(); | ||
147 | void llCollisionFilter(); | ||
148 | void llTakeControls(); | ||
149 | void llReleaseControls(); | ||
150 | void llAttachToAvatar(); | ||
151 | void llDetachFromAvatar(); | ||
152 | void llTakeCamera(); | ||
153 | void llReleaseCamera(); | ||
154 | void llGetOwner(); | ||
155 | void llInstantMessage(); | ||
156 | void llEmail(); | ||
157 | void llGetNextEmail(); | ||
158 | void llGetKey(); | ||
159 | void llSetBuoyancy(); | ||
160 | void llSetHoverHeight(); | ||
161 | void llStopHover(); | ||
162 | void llMinEventDelay(); | ||
163 | void llSoundPreload(); | ||
164 | void llRotLookAt(); | ||
165 | void llStringLength(); | ||
166 | void llStartAnimation(); | ||
167 | void llStopAnimation(); | ||
168 | void llPointAt(); | ||
169 | void llStopPointAt(); | ||
170 | void llTargetOmega(); | ||
171 | void llGetStartParameter(); | ||
172 | void llGodLikeRezObject(); | ||
173 | void llRequestPermissions(); | ||
174 | void llGetPermissionsKey(); | ||
175 | void llGetPermissions(); | ||
176 | void llGetLinkNumber(); | ||
177 | void llSetLinkColor(); | ||
178 | void llCreateLink(); | ||
179 | void llBreakLink(); | ||
180 | void llBreakAllLinks(); | ||
181 | void llGetLinkKey(); | ||
182 | void llGetLinkName(); | ||
183 | void llGetInventoryNumber(); | ||
184 | void llGetInventoryName(); | ||
185 | void llSetScriptState(); | ||
186 | void llGetEnergy(); | ||
187 | void llGiveInventory(); | ||
188 | void llRemoveInventory(); | ||
189 | void llSetText(); | ||
190 | void llWater(); | ||
191 | void llPassTouches(); | ||
192 | void llRequestAgentData(); | ||
193 | void llRequestInventoryData(); | ||
194 | void llSetDamage(); | ||
195 | void llTeleportAgentHome(); | ||
196 | void llModifyLand(); | ||
197 | void llCollisionSound(); | ||
198 | void llCollisionSprite(); | ||
199 | void llGetAnimation(); | ||
200 | void llResetScript(); | ||
201 | void llMessageLinked(); | ||
202 | void llPushObject(); | ||
203 | void llPassCollisions(); | ||
204 | void llGetScriptName(); | ||
205 | void llGetNumberOfSides(); | ||
206 | void llAxisAngle2Rot(); | ||
207 | void llRot2Axis(); | ||
208 | void llRot2Angle(); | ||
209 | void llAcos(); | ||
210 | void llAsin(); | ||
211 | void llAngleBetween(); | ||
212 | void llGetInventoryKey(); | ||
213 | void llAllowInventoryDrop(); | ||
214 | void llGetSunDirection(); | ||
215 | void llGetTextureOffset(); | ||
216 | void llGetTextureScale(); | ||
217 | void llGetTextureRot(); | ||
218 | void llSubStringIndex(); | ||
219 | void llGetOwnerKey(); | ||
220 | void llGetCenterOfMass(); | ||
221 | void llListSort(); | ||
222 | void llGetListLength(); | ||
223 | void llList2Integer(); | ||
224 | void llList2Float(); | ||
225 | void llList2String(); | ||
226 | void llList2Key(); | ||
227 | void llList2Vector(); | ||
228 | void llList2Rot(); | ||
229 | void llList2List(); | ||
230 | void llDeleteSubList(); | ||
231 | void llGetListEntryType(); | ||
232 | void llList2CSV(); | ||
233 | void llCSV2List(); | ||
234 | void llListRandomize(); | ||
235 | void llList2ListStrided(); | ||
236 | void llGetRegionCorner(); | ||
237 | void llListInsertList(); | ||
238 | void llListFindList(); | ||
239 | void llGetObjectName(); | ||
240 | void llSetObjectName(); | ||
241 | void llGetDate(); | ||
242 | void llEdgeOfWorld(); | ||
243 | void llGetAgentInfo(); | ||
244 | void llAdjustSoundVolume(); | ||
245 | void llSetSoundQueueing(); | ||
246 | void llSetSoundRadius(); | ||
247 | void llKey2Name(); | ||
248 | void llSetTextureAnim(); | ||
249 | void llTriggerSoundLimited(); | ||
250 | void llEjectFromLand(); | ||
251 | void llParseString2List(); | ||
252 | void llOverMyLand(); | ||
253 | void llGetLandOwnerAt(); | ||
254 | void llGetNotecardLine(); | ||
255 | void llGetAgentSize(); | ||
256 | void llSameGroup(); | ||
257 | void llUnSit(); | ||
258 | void llGroundSlope(); | ||
259 | void llGroundNormal(); | ||
260 | void llGroundContour(); | ||
261 | void llGetAttached(); | ||
262 | void llGetFreeMemory(); | ||
263 | void llGetRegionName(); | ||
264 | void llGetRegionTimeDilation(); | ||
265 | void llGetRegionFPS(); | ||
266 | void llParticleSystem(); | ||
267 | void llGroundRepel(); | ||
268 | void llGiveInventoryList(); | ||
269 | void llSetVehicleType(); | ||
270 | void llSetVehicleFloatParam(); | ||
271 | void llSetVehicleVectorParam(); | ||
272 | void llSetVehicleRotationParam(); | ||
273 | void llSetVehicleFlags(); | ||
274 | void llRemoveVehicleFlags(); | ||
275 | void llSitTarget(); | ||
276 | void llAvatarOnSitTarget(); | ||
277 | void llAddToLandPassList(); | ||
278 | void llSetTouchText(); | ||
279 | void llSetSitText(); | ||
280 | void llSetCameraEyeOffset(); | ||
281 | void llSetCameraAtOffset(); | ||
282 | void llDumpList2String(); | ||
283 | void llScriptDanger(); | ||
284 | void llDialog(); | ||
285 | void llVolumeDetect(); | ||
286 | void llResetOtherScript(); | ||
287 | void llGetScriptState(); | ||
288 | void llRemoteLoadScript(); | ||
289 | void llSetRemoteScriptAccessPin(); | ||
290 | void llRemoteLoadScriptPin(); | ||
291 | void llOpenRemoteDataChannel(); | ||
292 | void llSendRemoteData(); | ||
293 | void llRemoteDataReply(); | ||
294 | void llCloseRemoteDataChannel(); | ||
295 | void llMD5String(); | ||
296 | void llSetPrimitiveParams(); | ||
297 | void llStringToBase64(); | ||
298 | void llBase64ToString(); | ||
299 | void llXorBase64Strings(); | ||
300 | void llRemoteDataSetRegion(); | ||
301 | void llLog10(); | ||
302 | void llLog(); | ||
303 | void llGetAnimationList(); | ||
304 | void llSetParcelMusicURL(); | ||
305 | void llGetRootPosition(); | ||
306 | void llGetRootRotation(); | ||
307 | void llGetObjectDesc(); | ||
308 | void llSetObjectDesc(); | ||
309 | void llGetCreator(); | ||
310 | void llGetTimestamp(); | ||
311 | void llSetLinkAlpha(); | ||
312 | void llGetNumberOfPrims(); | ||
313 | void llGetNumberOfNotecardLines(); | ||
314 | void llGetBoundingBox(); | ||
315 | void llGetGeometricCenter(); | ||
316 | void llGetPrimitiveParams(); | ||
317 | void llIntegerToBase64(); | ||
318 | void llBase64ToInteger(); | ||
319 | void llGetGMTclock(); | ||
320 | void llGetSimulatorHostname(); | ||
321 | void llSetLocalRot(); | ||
322 | void llParseStringKeepNulls(); | ||
323 | void llRezAtRoot(); | ||
324 | void llGetObjectPermMask(); | ||
325 | void llSetObjectPermMask(); | ||
326 | void llGetInventoryPermMask(); | ||
327 | void llSetInventoryPermMask(); | ||
328 | void llGetInventoryCreator(); | ||
329 | void llOwnerSay(); | ||
330 | void llRequestSimulatorData(); | ||
331 | void llForceMouselook(); | ||
332 | void llGetObjectMass(); | ||
333 | void llListReplaceList(); | ||
334 | void llLoadURL(); | ||
335 | void llParcelMediaCommandList(); | ||
336 | void llParcelMediaQuery(); | ||
337 | void llModPow(); | ||
338 | void llGetInventoryType(); | ||
339 | void llSetPayPrice(); | ||
340 | void llGetCameraPos(); | ||
341 | void llGetCameraRot(); | ||
342 | void llSetPrimURL(); | ||
343 | void llRefreshPrimURL(); | ||
344 | void llEscapeURL(); | ||
345 | void llUnescapeURL(); | ||
346 | void llMapDestination(); | ||
347 | void llAddToLandBanList(); | ||
348 | void llRemoveFromLandPassList(); | ||
349 | void llRemoveFromLandBanList(); | ||
350 | void llSetCameraParams(); | ||
351 | void llClearCameraParams(); | ||
352 | void llListStatistics(); | ||
353 | void llGetUnixTime(); | ||
354 | void llGetParcelFlags(); | ||
355 | void llGetRegionFlags(); | ||
356 | void llXorBase64StringsCorrect(); | ||
357 | void llHTTPRequest(); | ||
358 | void llResetLandBanList(); | ||
359 | void llResetLandPassList(); | ||
360 | void llGetParcelPrimCount(); | ||
361 | void llGetParcelPrimOwners(); | ||
362 | void llGetObjectPrimCount(); | ||
363 | void llGetParcelMaxPrims(); | ||
364 | void llGetParcelDetails(); | ||
365 | } | ||
366 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Server API/LSL_BuiltIn_Commands_TestImplementation.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Server API/LSL_BuiltIn_Commands_TestImplementation.cs new file mode 100644 index 0000000..08e7f95 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/LSLEngine/LSLHandler/Server API/LSL_BuiltIn_Commands_TestImplementation.cs | |||
@@ -0,0 +1,377 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.Scripting.LSL | ||
34 | { | ||
35 | public class LSL_BuiltIn_Commands_TestImplementation: LSL_BuiltIn_Commands_Interface | ||
36 | { | ||
37 | public LSL_BuiltIn_Commands_TestImplementation() | ||
38 | { | ||
39 | Common.SendToDebug("LSL_BuiltIn_Commands_TestImplementation: Creating object"); | ||
40 | } | ||
41 | |||
42 | public void llSin() { } | ||
43 | public void llCos() { } | ||
44 | public void llTan() { } | ||
45 | public void llAtan2() { } | ||
46 | public void llSqrt() { } | ||
47 | public void llPow() { } | ||
48 | public void llAbs() { } | ||
49 | public void llFabs() { } | ||
50 | public void llFrand() { } | ||
51 | public void llFloor() { } | ||
52 | public void llCeil() { } | ||
53 | public void llRound() { } | ||
54 | public void llVecMag() { } | ||
55 | public void llVecNorm() { } | ||
56 | public void llVecDist() { } | ||
57 | public void llRot2Euler() { } | ||
58 | public void llEuler2Rot() { } | ||
59 | public void llAxes2Rot() { } | ||
60 | public void llRot2Fwd() { } | ||
61 | public void llRot2Left() { } | ||
62 | public void llRot2Up() { } | ||
63 | public void llRotBetween() { } | ||
64 | public void llWhisper() { } | ||
65 | public void llSay(UInt32 channelID, string text) | ||
66 | { | ||
67 | Common.SendToDebug("INTERNAL FUNCTION llSay(" + channelID + ", \"" + text + "\");"); | ||
68 | } | ||
69 | public void llShout() { } | ||
70 | public void llListen() { } | ||
71 | public void llListenControl() { } | ||
72 | public void llListenRemove() { } | ||
73 | public void llSensor() { } | ||
74 | public void llSensorRepeat() { } | ||
75 | public void llSensorRemove() { } | ||
76 | public void llDetectedName() { } | ||
77 | public void llDetectedKey() { } | ||
78 | public void llDetectedOwner() { } | ||
79 | public void llDetectedType() { } | ||
80 | public void llDetectedPos() { } | ||
81 | public void llDetectedVel() { } | ||
82 | public void llDetectedGrab() { } | ||
83 | public void llDetectedRot() { } | ||
84 | public void llDetectedGroup() { } | ||
85 | public void llDetectedLinkNumber() { } | ||
86 | public void llDie() { } | ||
87 | public void llGround() { } | ||
88 | public void llCloud() { } | ||
89 | public void llWind() { } | ||
90 | public void llSetStatus() { } | ||
91 | public void llGetStatus() { } | ||
92 | public void llSetScale() { } | ||
93 | public void llGetScale() { } | ||
94 | public void llSetColor() { } | ||
95 | public void llGetAlpha() { } | ||
96 | public void llSetAlpha() { } | ||
97 | public void llGetColor() { } | ||
98 | public void llSetTexture() { } | ||
99 | public void llScaleTexture() { } | ||
100 | public void llOffsetTexture() { } | ||
101 | public void llRotateTexture() { } | ||
102 | public void llGetTexture() { } | ||
103 | public void llSetPos() { } | ||
104 | public void llGetPos() { } | ||
105 | public void llGetLocalPos() { } | ||
106 | public void llSetRot() { } | ||
107 | public void llGetRot() { } | ||
108 | public void llGetLocalRot() { } | ||
109 | public void llSetForce() { } | ||
110 | public void llGetForce() { } | ||
111 | public void llTarget() { } | ||
112 | public void llTargetRemove() { } | ||
113 | public void llRotTarget() { } | ||
114 | public void llRotTargetRemove() { } | ||
115 | public void llMoveToTarget() { } | ||
116 | public void llStopMoveToTarget() { } | ||
117 | public void llApplyImpulse() { } | ||
118 | public void llApplyRotationalImpulse() { } | ||
119 | public void llSetTorque() { } | ||
120 | public void llGetTorque() { } | ||
121 | public void llSetForceAndTorque() { } | ||
122 | public void llGetVel() { } | ||
123 | public void llGetAccel() { } | ||
124 | public void llGetOmega() { } | ||
125 | public void llGetTimeOfDay() { } | ||
126 | public void llGetWallclock() { } | ||
127 | public void llGetTime() { } | ||
128 | public void llResetTime() { } | ||
129 | public void llGetAndResetTime() { } | ||
130 | public void llSound() { } | ||
131 | public void llPlaySound() { } | ||
132 | public void llLoopSound() { } | ||
133 | public void llLoopSoundMaster() { } | ||
134 | public void llLoopSoundSlave() { } | ||
135 | public void llPlaySoundSlave() { } | ||
136 | public void llTriggerSound() { } | ||
137 | public void llStopSound() { } | ||
138 | public void llPreloadSound() { } | ||
139 | public void llGetSubString() { } | ||
140 | public void llDeleteSubString() { } | ||
141 | public void llInsertString() { } | ||
142 | public void llToUpper() { } | ||
143 | public void llToLower() { } | ||
144 | public void llGiveMoney() { } | ||
145 | public void llMakeExplosion() { } | ||
146 | public void llMakeFountain() { } | ||
147 | public void llMakeSmoke() { } | ||
148 | public void llMakeFire() { } | ||
149 | public void llRezObject() { } | ||
150 | public void llLookAt() { } | ||
151 | public void llStopLookAt() { } | ||
152 | public void llSetTimerEvent() { } | ||
153 | public void llSleep() { } | ||
154 | public void llGetMass() { } | ||
155 | public void llCollisionFilter() { } | ||
156 | public void llTakeControls() { } | ||
157 | public void llReleaseControls() { } | ||
158 | public void llAttachToAvatar() { } | ||
159 | public void llDetachFromAvatar() { } | ||
160 | public void llTakeCamera() { } | ||
161 | public void llReleaseCamera() { } | ||
162 | public void llGetOwner() { } | ||
163 | public void llInstantMessage() { } | ||
164 | public void llEmail() { } | ||
165 | public void llGetNextEmail() { } | ||
166 | public void llGetKey() { } | ||
167 | public void llSetBuoyancy() { } | ||
168 | public void llSetHoverHeight() { } | ||
169 | public void llStopHover() { } | ||
170 | public void llMinEventDelay() { } | ||
171 | public void llSoundPreload() { } | ||
172 | public void llRotLookAt() { } | ||
173 | public void llStringLength() { } | ||
174 | public void llStartAnimation() { } | ||
175 | public void llStopAnimation() { } | ||
176 | public void llPointAt() { } | ||
177 | public void llStopPointAt() { } | ||
178 | public void llTargetOmega() { } | ||
179 | public void llGetStartParameter() { } | ||
180 | public void llGodLikeRezObject() { } | ||
181 | public void llRequestPermissions() { } | ||
182 | public void llGetPermissionsKey() { } | ||
183 | public void llGetPermissions() { } | ||
184 | public void llGetLinkNumber() { } | ||
185 | public void llSetLinkColor() { } | ||
186 | public void llCreateLink() { } | ||
187 | public void llBreakLink() { } | ||
188 | public void llBreakAllLinks() { } | ||
189 | public void llGetLinkKey() { } | ||
190 | public void llGetLinkName() { } | ||
191 | public void llGetInventoryNumber() { } | ||
192 | public void llGetInventoryName() { } | ||
193 | public void llSetScriptState() { } | ||
194 | public void llGetEnergy() { } | ||
195 | public void llGiveInventory() { } | ||
196 | public void llRemoveInventory() { } | ||
197 | public void llSetText() { } | ||
198 | public void llWater() { } | ||
199 | public void llPassTouches() { } | ||
200 | public void llRequestAgentData() { } | ||
201 | public void llRequestInventoryData() { } | ||
202 | public void llSetDamage() { } | ||
203 | public void llTeleportAgentHome() { } | ||
204 | public void llModifyLand() { } | ||
205 | public void llCollisionSound() { } | ||
206 | public void llCollisionSprite() { } | ||
207 | public void llGetAnimation() { } | ||
208 | public void llResetScript() { } | ||
209 | public void llMessageLinked() { } | ||
210 | public void llPushObject() { } | ||
211 | public void llPassCollisions() { } | ||
212 | public void llGetScriptName() { } | ||
213 | public void llGetNumberOfSides() { } | ||
214 | public void llAxisAngle2Rot() { } | ||
215 | public void llRot2Axis() { } | ||
216 | public void llRot2Angle() { } | ||
217 | public void llAcos() { } | ||
218 | public void llAsin() { } | ||
219 | public void llAngleBetween() { } | ||
220 | public void llGetInventoryKey() { } | ||
221 | public void llAllowInventoryDrop() { } | ||
222 | public void llGetSunDirection() { } | ||
223 | public void llGetTextureOffset() { } | ||
224 | public void llGetTextureScale() { } | ||
225 | public void llGetTextureRot() { } | ||
226 | public void llSubStringIndex() { } | ||
227 | public void llGetOwnerKey() { } | ||
228 | public void llGetCenterOfMass() { } | ||
229 | public void llListSort() { } | ||
230 | public void llGetListLength() { } | ||
231 | public void llList2Integer() { } | ||
232 | public void llList2Float() { } | ||
233 | public void llList2String() { } | ||
234 | public void llList2Key() { } | ||
235 | public void llList2Vector() { } | ||
236 | public void llList2Rot() { } | ||
237 | public void llList2List() { } | ||
238 | public void llDeleteSubList() { } | ||
239 | public void llGetListEntryType() { } | ||
240 | public void llList2CSV() { } | ||
241 | public void llCSV2List() { } | ||
242 | public void llListRandomize() { } | ||
243 | public void llList2ListStrided() { } | ||
244 | public void llGetRegionCorner() { } | ||
245 | public void llListInsertList() { } | ||
246 | public void llListFindList() { } | ||
247 | public void llGetObjectName() { } | ||
248 | public void llSetObjectName() { } | ||
249 | public void llGetDate() { } | ||
250 | public void llEdgeOfWorld() { } | ||
251 | public void llGetAgentInfo() { } | ||
252 | public void llAdjustSoundVolume() { } | ||
253 | public void llSetSoundQueueing() { } | ||
254 | public void llSetSoundRadius() { } | ||
255 | public void llKey2Name() { } | ||
256 | public void llSetTextureAnim() { } | ||
257 | public void llTriggerSoundLimited() { } | ||
258 | public void llEjectFromLand() { } | ||
259 | public void llParseString2List() { } | ||
260 | public void llOverMyLand() { } | ||
261 | public void llGetLandOwnerAt() { } | ||
262 | public void llGetNotecardLine() { } | ||
263 | public void llGetAgentSize() { } | ||
264 | public void llSameGroup() { } | ||
265 | public void llUnSit() { } | ||
266 | public void llGroundSlope() { } | ||
267 | public void llGroundNormal() { } | ||
268 | public void llGroundContour() { } | ||
269 | public void llGetAttached() { } | ||
270 | public void llGetFreeMemory() { } | ||
271 | public void llGetRegionName() { } | ||
272 | public void llGetRegionTimeDilation() { } | ||
273 | public void llGetRegionFPS() { } | ||
274 | public void llParticleSystem() { } | ||
275 | public void llGroundRepel() { } | ||
276 | public void llGiveInventoryList() { } | ||
277 | public void llSetVehicleType() { } | ||
278 | public void llSetVehicleFloatParam() { } | ||
279 | public void llSetVehicleVectorParam() { } | ||
280 | public void llSetVehicleRotationParam() { } | ||
281 | public void llSetVehicleFlags() { } | ||
282 | public void llRemoveVehicleFlags() { } | ||
283 | public void llSitTarget() { } | ||
284 | public void llAvatarOnSitTarget() { } | ||
285 | public void llAddToLandPassList() { } | ||
286 | public void llSetTouchText() { } | ||
287 | public void llSetSitText() { } | ||
288 | public void llSetCameraEyeOffset() { } | ||
289 | public void llSetCameraAtOffset() { } | ||
290 | public void llDumpList2String() { } | ||
291 | public void llScriptDanger() { } | ||
292 | public void llDialog() { } | ||
293 | public void llVolumeDetect() { } | ||
294 | public void llResetOtherScript() { } | ||
295 | public void llGetScriptState() { } | ||
296 | public void llRemoteLoadScript() { } | ||
297 | public void llSetRemoteScriptAccessPin() { } | ||
298 | public void llRemoteLoadScriptPin() { } | ||
299 | public void llOpenRemoteDataChannel() { } | ||
300 | public void llSendRemoteData() { } | ||
301 | public void llRemoteDataReply() { } | ||
302 | public void llCloseRemoteDataChannel() { } | ||
303 | public void llMD5String() { } | ||
304 | public void llSetPrimitiveParams() { } | ||
305 | public void llStringToBase64() { } | ||
306 | public void llBase64ToString() { } | ||
307 | public void llXorBase64Strings() { } | ||
308 | public void llRemoteDataSetRegion() { } | ||
309 | public void llLog10() { } | ||
310 | public void llLog() { } | ||
311 | public void llGetAnimationList() { } | ||
312 | public void llSetParcelMusicURL() { } | ||
313 | public void llGetRootPosition() { } | ||
314 | public void llGetRootRotation() { } | ||
315 | public void llGetObjectDesc() { } | ||
316 | public void llSetObjectDesc() { } | ||
317 | public void llGetCreator() { } | ||
318 | public void llGetTimestamp() { } | ||
319 | public void llSetLinkAlpha() { } | ||
320 | public void llGetNumberOfPrims() { } | ||
321 | public void llGetNumberOfNotecardLines() { } | ||
322 | public void llGetBoundingBox() { } | ||
323 | public void llGetGeometricCenter() { } | ||
324 | public void llGetPrimitiveParams() { } | ||
325 | public void llIntegerToBase64() { } | ||
326 | public void llBase64ToInteger() { } | ||
327 | public void llGetGMTclock() { } | ||
328 | public void llGetSimulatorHostname() { } | ||
329 | public void llSetLocalRot() { } | ||
330 | public void llParseStringKeepNulls() { } | ||
331 | public void llRezAtRoot() { } | ||
332 | public void llGetObjectPermMask() { } | ||
333 | public void llSetObjectPermMask() { } | ||
334 | public void llGetInventoryPermMask() { } | ||
335 | public void llSetInventoryPermMask() { } | ||
336 | public void llGetInventoryCreator() { } | ||
337 | public void llOwnerSay() { } | ||
338 | public void llRequestSimulatorData() { } | ||
339 | public void llForceMouselook() { } | ||
340 | public void llGetObjectMass() { } | ||
341 | public void llListReplaceList() { } | ||
342 | public void llLoadURL() { } | ||
343 | public void llParcelMediaCommandList() { } | ||
344 | public void llParcelMediaQuery() { } | ||
345 | public void llModPow() { } | ||
346 | public void llGetInventoryType() { } | ||
347 | public void llSetPayPrice() { } | ||
348 | public void llGetCameraPos() { } | ||
349 | public void llGetCameraRot() { } | ||
350 | public void llSetPrimURL() { } | ||
351 | public void llRefreshPrimURL() { } | ||
352 | public void llEscapeURL() { } | ||
353 | public void llUnescapeURL() { } | ||
354 | public void llMapDestination() { } | ||
355 | public void llAddToLandBanList() { } | ||
356 | public void llRemoveFromLandPassList() { } | ||
357 | public void llRemoveFromLandBanList() { } | ||
358 | public void llSetCameraParams() { } | ||
359 | public void llClearCameraParams() { } | ||
360 | public void llListStatistics() { } | ||
361 | public void llGetUnixTime() { } | ||
362 | public void llGetParcelFlags() { } | ||
363 | public void llGetRegionFlags() { } | ||
364 | public void llXorBase64StringsCorrect() { } | ||
365 | public void llHTTPRequest() { } | ||
366 | public void llResetLandBanList() { } | ||
367 | public void llResetLandPassList() { } | ||
368 | public void llGetParcelPrimCount() { } | ||
369 | public void llGetParcelPrimOwners() { } | ||
370 | public void llGetObjectPrimCount() { } | ||
371 | public void llGetParcelMaxPrims() { } | ||
372 | public void llGetParcelDetails() { } | ||
373 | |||
374 | |||
375 | |||
376 | } | ||
377 | } | ||