aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs600
1 files changed, 300 insertions, 300 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
index a0c900f..f060f06 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
@@ -1,300 +1,300 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Reflection; 30using System.Reflection;
31using System.Reflection.Emit; 31using System.Reflection.Emit;
32using System.Threading; 32using System.Threading;
33 33
34 34
35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
36{ 36{
37 37
38 38
39 public class Engine 39 public class Engine
40 { 40 {
41 //private string LSO_FileName = @"LSO\AdditionTest.lso"; 41 //private string LSO_FileName = @"LSO\AdditionTest.lso";
42 private string LSO_FileName;// = @"LSO\CloseToDefault.lso"; 42 private string LSO_FileName;// = @"LSO\CloseToDefault.lso";
43 AppDomain appDomain; 43 AppDomain appDomain;
44 44
45 public string Compile(string LSOFileName) 45 public string Compile(string LSOFileName)
46 { 46 {
47 LSO_FileName = LSOFileName; 47 LSO_FileName = LSOFileName;
48 48
49 49
50 //appDomain = AppDomain.CreateDomain("AlternateAppDomain"); 50 //appDomain = AppDomain.CreateDomain("AlternateAppDomain");
51 appDomain = Thread.GetDomain(); 51 appDomain = Thread.GetDomain();
52 52
53 // Create Assembly Name 53 // Create Assembly Name
54 AssemblyName asmName = new AssemblyName(); 54 AssemblyName asmName = new AssemblyName();
55 asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName); 55 asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName);
56 //asmName.Name = "TestAssembly"; 56 //asmName.Name = "TestAssembly";
57 57
58 string DLL_FileName = asmName.Name + ".dll"; 58 string DLL_FileName = asmName.Name + ".dll";
59 string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; 59 string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName;
60 60
61 Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(LSO_FileName)); 61 Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(LSO_FileName));
62 Common.SendToLog("Assembly name: " + asmName.Name); 62 Common.SendToLog("Assembly name: " + asmName.Name);
63 Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); 63 Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll");
64 Common.SendToLog("Starting processing of LSL ByteCode..."); 64 Common.SendToLog("Starting processing of LSL ByteCode...");
65 Common.SendToLog(""); 65 Common.SendToLog("");
66 66
67 67
68 68
69 // Create Assembly 69 // Create Assembly
70 AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( 70 AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly(
71 asmName, 71 asmName,
72 AssemblyBuilderAccess.RunAndSave 72 AssemblyBuilderAccess.RunAndSave
73 ); 73 );
74 //// Create Assembly 74 //// Create Assembly
75 //AssemblyBuilder asmBuilder = 75 //AssemblyBuilder asmBuilder =
76 // Thread.GetDomain().DefineDynamicAssembly 76 // Thread.GetDomain().DefineDynamicAssembly
77 //(asmName, AssemblyBuilderAccess.RunAndSave); 77 //(asmName, AssemblyBuilderAccess.RunAndSave);
78 78
79 // Create a module (and save to disk) 79 // Create a module (and save to disk)
80 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule 80 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
81 (asmName.Name, 81 (asmName.Name,
82 DLL_FileName); 82 DLL_FileName);
83 83
84 //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); 84 //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\"");
85 // Create a Class (/Type) 85 // Create a Class (/Type)
86 TypeBuilder typeBuilder = modBuilder.DefineType( 86 TypeBuilder typeBuilder = modBuilder.DefineType(
87 "LSL_ScriptObject", 87 "LSL_ScriptObject",
88 TypeAttributes.Public | TypeAttributes.BeforeFieldInit, 88 TypeAttributes.Public | TypeAttributes.BeforeFieldInit,
89 typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass)); 89 typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass));
90 //, 90 //,
91 // typeof()); 91 // typeof());
92 //, typeof(LSL_BuiltIn_Commands_Interface)); 92 //, typeof(LSL_BuiltIn_Commands_Interface));
93 //, 93 //,
94 // typeof(object), 94 // typeof(object),
95 // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); 95 // new Type[] { typeof(LSL_CLRInterface.LSLScript) });
96 96
97 97
98 98
99 /* 99 /*
100 * Generate the IL itself 100 * Generate the IL itself
101 */ 101 */
102 102
103 LSO_Parser LSOP = new LSO_Parser(LSO_FileName, typeBuilder); 103 LSO_Parser LSOP = new LSO_Parser(LSO_FileName, typeBuilder);
104 LSOP.OpenFile(); 104 LSOP.OpenFile();
105 LSOP.Parse(); 105 LSOP.Parse();
106 106
107 // Constructor has to be created AFTER LSO_Parser because of accumulated variables 107 // Constructor has to be created AFTER LSO_Parser because of accumulated variables
108 if (Common.IL_CreateConstructor) 108 if (Common.IL_CreateConstructor)
109 IL_CREATE_CONSTRUCTOR(typeBuilder, LSOP); 109 IL_CREATE_CONSTRUCTOR(typeBuilder, LSOP);
110 110
111 LSOP.CloseFile(); 111 LSOP.CloseFile();
112 /* 112 /*
113 * Done generating. Create a type and run it. 113 * Done generating. Create a type and run it.
114 */ 114 */
115 115
116 116
117 Common.SendToLog("Attempting to compile assembly..."); 117 Common.SendToLog("Attempting to compile assembly...");
118 // Compile it 118 // Compile it
119 Type type = typeBuilder.CreateType(); 119 Type type = typeBuilder.CreateType();
120 Common.SendToLog("Compilation successful!"); 120 Common.SendToLog("Compilation successful!");
121 121
122 Common.SendToLog("Saving assembly: " + DLL_FileName); 122 Common.SendToLog("Saving assembly: " + DLL_FileName);
123 asmBuilder.Save(DLL_FileName); 123 asmBuilder.Save(DLL_FileName);
124 124
125 Common.SendToLog("Returning assembly filename: " + DLL_FileName); 125 Common.SendToLog("Returning assembly filename: " + DLL_FileName);
126 126
127 127
128 return DLL_FileName; 128 return DLL_FileName;
129 129
130 130
131 //Common.SendToLog("Creating an instance of new assembly..."); 131 //Common.SendToLog("Creating an instance of new assembly...");
132 //// Create an instance we can play with 132 //// Create an instance we can play with
133 ////LSLScript hello = (LSLScript)Activator.CreateInstance(type); 133 ////LSLScript hello = (LSLScript)Activator.CreateInstance(type);
134 ////LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type); 134 ////LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type);
135 //object MyScript = (object)Activator.CreateInstance(type); 135 //object MyScript = (object)Activator.CreateInstance(type);
136 136
137 137
138 138
139 139
140 140
141 //System.Reflection.MemberInfo[] Members = type.GetMembers(); 141 //System.Reflection.MemberInfo[] Members = type.GetMembers();
142 142
143 //Common.SendToLog("Members of assembly " + type.ToString() + ":"); 143 //Common.SendToLog("Members of assembly " + type.ToString() + ":");
144 //foreach (MemberInfo member in Members) 144 //foreach (MemberInfo member in Members)
145 // Common.SendToLog(member.ToString()); 145 // Common.SendToLog(member.ToString());
146 146
147 147
148 //// Play with it 148 //// Play with it
149 ////MyScript.event_state_entry("Test"); 149 ////MyScript.event_state_entry("Test");
150 //object[] args = { null }; 150 //object[] args = { null };
151 ////System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); 151 ////System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null);
152 152
153 //string[] ret = { }; 153 //string[] ret = { };
154 //if (Common.IL_CreateFunctionList) 154 //if (Common.IL_CreateFunctionList)
155 // ret = (string[])type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null); 155 // ret = (string[])type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null);
156 156
157 //foreach (string s in ret) 157 //foreach (string s in ret)
158 //{ 158 //{
159 // Common.SendToLog(""); 159 // Common.SendToLog("");
160 // Common.SendToLog("*** Executing LSL Server Event: " + s); 160 // Common.SendToLog("*** Executing LSL Server Event: " + s);
161 // //object test = type.GetMember(s); 161 // //object test = type.GetMember(s);
162 // //object runner = type.InvokeMember(s, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, MyScript, args); 162 // //object runner = type.InvokeMember(s, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, MyScript, args);
163 // //runner(); 163 // //runner();
164 // //objBooks_Late = type.InvokeMember(s, BindingFlags.CreateInstance, null, objApp_Late, null); 164 // //objBooks_Late = type.InvokeMember(s, BindingFlags.CreateInstance, null, objApp_Late, null);
165 // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); 165 // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" });
166 166
167 //} 167 //}
168 168
169 169
170 } 170 }
171 171
172 172
173 private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) 173 private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP)
174 { 174 {
175 175
176 176
177 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); 177 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()");
178 //ConstructorBuilder constructor = typeBuilder.DefineConstructor( 178 //ConstructorBuilder constructor = typeBuilder.DefineConstructor(
179 // MethodAttributes.Public, 179 // MethodAttributes.Public,
180 // CallingConventions.Standard, 180 // CallingConventions.Standard,
181 // new Type[0]); 181 // new Type[0]);
182 ConstructorBuilder constructor = typeBuilder.DefineConstructor( 182 ConstructorBuilder constructor = typeBuilder.DefineConstructor(
183 MethodAttributes.Public | 183 MethodAttributes.Public |
184 MethodAttributes.SpecialName | 184 MethodAttributes.SpecialName |
185 MethodAttributes.RTSpecialName, 185 MethodAttributes.RTSpecialName,
186 CallingConventions.Standard, 186 CallingConventions.Standard,
187 new Type[0]); 187 new Type[0]);
188 188
189 //Define the reflection ConstructorInfor for System.Object 189 //Define the reflection ConstructorInfor for System.Object
190 ConstructorInfo conObj = typeof(LSL_BaseClass).GetConstructor(new Type[0]); 190 ConstructorInfo conObj = typeof(LSL_BaseClass).GetConstructor(new Type[0]);
191 191
192 //call constructor of base object 192 //call constructor of base object
193 ILGenerator il = constructor.GetILGenerator(); 193 ILGenerator il = constructor.GetILGenerator();
194 194
195 il.Emit(OpCodes.Ldarg_0); 195 il.Emit(OpCodes.Ldarg_0);
196 il.Emit(OpCodes.Call, conObj); 196 il.Emit(OpCodes.Call, conObj);
197 197
198 198
199 //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: UInt32 State = 0;"); 199 //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: UInt32 State = 0;");
200 //string FieldName; 200 //string FieldName;
201 //// Create state object 201 //// Create state object
202 //FieldName = "State"; 202 //FieldName = "State";
203 //FieldBuilder State_fb = typeBuilder.DefineField( 203 //FieldBuilder State_fb = typeBuilder.DefineField(
204 // FieldName, 204 // FieldName,
205 // typeof(UInt32), 205 // typeof(UInt32),
206 // FieldAttributes.Public); 206 // FieldAttributes.Public);
207 //il.Emit(OpCodes.Ldarg_0); 207 //il.Emit(OpCodes.Ldarg_0);
208 //il.Emit(OpCodes.Ldc_I4, 0); 208 //il.Emit(OpCodes.Ldc_I4, 0);
209 //il.Emit(OpCodes.Stfld, State_fb); 209 //il.Emit(OpCodes.Stfld, State_fb);
210 210
211 211
212 //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: LSL_BuiltIn_Commands_TestImplementation LSL_BuiltIns = New LSL_BuiltIn_Commands_TestImplementation();"); 212 //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: LSL_BuiltIn_Commands_TestImplementation LSL_BuiltIns = New LSL_BuiltIn_Commands_TestImplementation();");
213 ////Type objType1 = typeof(object); 213 ////Type objType1 = typeof(object);
214 //Type objType1 = typeof(LSL_BuiltIn_Commands_TestImplementation); 214 //Type objType1 = typeof(LSL_BuiltIn_Commands_TestImplementation);
215 215
216 //FieldName = "LSL_BuiltIns"; 216 //FieldName = "LSL_BuiltIns";
217 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField( 217 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField(
218 // FieldName, 218 // FieldName,
219 // objType1, 219 // objType1,
220 // FieldAttributes.Public); 220 // FieldAttributes.Public);
221 221
222 ////LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation(); 222 ////LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation();
223 //il.Emit(OpCodes.Ldarg_0); 223 //il.Emit(OpCodes.Ldarg_0);
224 ////il.Emit(OpCodes.Ldstr, "Test 123"); 224 ////il.Emit(OpCodes.Ldstr, "Test 123");
225 //il.Emit(OpCodes.Newobj, objType1.GetConstructor(new Type[] { })); 225 //il.Emit(OpCodes.Newobj, objType1.GetConstructor(new Type[] { }));
226 //il.Emit(OpCodes.Stfld, LSL_BuiltIns_fb); 226 //il.Emit(OpCodes.Stfld, LSL_BuiltIns_fb);
227 227
228 foreach (UInt32 pos in LSOP.StaticBlocks.Keys) 228 foreach (UInt32 pos in LSOP.StaticBlocks.Keys)
229 { 229 {
230 LSO_Struct.StaticBlock sb; 230 LSO_Struct.StaticBlock sb;
231 LSOP.StaticBlocks.TryGetValue(pos, out sb); 231 LSOP.StaticBlocks.TryGetValue(pos, out sb);
232 232
233 if (sb.ObjectType > 0 && sb.ObjectType < 8) { // We don't want void or null's 233 if (sb.ObjectType > 0 && sb.ObjectType < 8) { // We don't want void or null's
234 234
235 il.Emit(OpCodes.Ldarg_0); 235 il.Emit(OpCodes.Ldarg_0);
236 // Push position to stack 236 // Push position to stack
237 il.Emit(OpCodes.Ldc_I4, pos); 237 il.Emit(OpCodes.Ldc_I4, pos);
238 //il.Emit(OpCodes.Box, typeof(UInt32)); 238 //il.Emit(OpCodes.Box, typeof(UInt32));
239 239
240 240
241 Type datatype = null; 241 Type datatype = null;
242 242
243 // Push data to stack 243 // Push data to stack
244 Common.SendToDebug("Adding to static (" + pos + ") type: " + ((LSO_Enums.Variable_Type_Codes)sb.ObjectType).ToString() + " (" + sb.ObjectType + ")"); 244 Common.SendToDebug("Adding to static (" + pos + ") type: " + ((LSO_Enums.Variable_Type_Codes)sb.ObjectType).ToString() + " (" + sb.ObjectType + ")");
245 switch ((LSO_Enums.Variable_Type_Codes)sb.ObjectType) 245 switch ((LSO_Enums.Variable_Type_Codes)sb.ObjectType)
246 { 246 {
247 case LSO_Enums.Variable_Type_Codes.Float: 247 case LSO_Enums.Variable_Type_Codes.Float:
248 case LSO_Enums.Variable_Type_Codes.Integer: 248 case LSO_Enums.Variable_Type_Codes.Integer:
249 //UInt32 249 //UInt32
250 il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); 250 il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0));
251 datatype = typeof(UInt32); 251 datatype = typeof(UInt32);
252 il.Emit(OpCodes.Box, datatype); 252 il.Emit(OpCodes.Box, datatype);
253 break; 253 break;
254 case LSO_Enums.Variable_Type_Codes.String: 254 case LSO_Enums.Variable_Type_Codes.String:
255 case LSO_Enums.Variable_Type_Codes.Key: 255 case LSO_Enums.Variable_Type_Codes.Key:
256 //String 256 //String
257 LSO_Struct.HeapBlock hb = LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); 257 LSO_Struct.HeapBlock hb = LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1);
258 il.Emit(OpCodes.Ldstr, System.Text.Encoding.UTF8.GetString(hb.Data)); 258 il.Emit(OpCodes.Ldstr, System.Text.Encoding.UTF8.GetString(hb.Data));
259 datatype = typeof(string); 259 datatype = typeof(string);
260 break; 260 break;
261 case LSO_Enums.Variable_Type_Codes.Vector: 261 case LSO_Enums.Variable_Type_Codes.Vector:
262 datatype = typeof(LSO_Enums.Vector); 262 datatype = typeof(LSO_Enums.Vector);
263 //TODO: Not implemented 263 //TODO: Not implemented
264 break; 264 break;
265 case LSO_Enums.Variable_Type_Codes.Rotation: 265 case LSO_Enums.Variable_Type_Codes.Rotation:
266 //Object 266 //Object
267 //TODO: Not implemented 267 //TODO: Not implemented
268 datatype = typeof(LSO_Enums.Rotation); 268 datatype = typeof(LSO_Enums.Rotation);
269 break; 269 break;
270 default: 270 default:
271 datatype = typeof(object); 271 datatype = typeof(object);
272 break; 272 break;
273 } 273 }
274 274
275 275
276 // Make call 276 // Make call
277 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype })); 277 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype }));
278 } 278 }
279 279
280 } 280 }
281 281
282 282
283 283
284 284
285 ////il.Emit(OpCodes.Newobj, typeof(UInt32)); 285 ////il.Emit(OpCodes.Newobj, typeof(UInt32));
286 //il.Emit(OpCodes.Starg_0); 286 //il.Emit(OpCodes.Starg_0);
287 //// Create LSL function library 287 //// Create LSL function library
288 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField("LSL_BuiltIns", typeof(LSL_BuiltIn_Commands_Interface), FieldAttributes.Public); 288 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField("LSL_BuiltIns", typeof(LSL_BuiltIn_Commands_Interface), FieldAttributes.Public);
289 //il.Emit(OpCodes.Newobj, typeof(LSL_BuiltIn_Commands_Interface)); 289 //il.Emit(OpCodes.Newobj, typeof(LSL_BuiltIn_Commands_Interface));
290 //il.Emit(OpCodes.Stloc_1); 290 //il.Emit(OpCodes.Stloc_1);
291 291
292 il.Emit(OpCodes.Ret); 292 il.Emit(OpCodes.Ret);
293 } 293 }
294 294
295 295
296 296
297 297
298 // End of class 298 // End of class
299 } 299 }
300} 300}