aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/LSOEngine/LSO
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/LSOEngine/LSO')
-rw-r--r--OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs28
3 files changed, 10 insertions, 32 deletions
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs
index 0208350..f53772e 100644
--- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs
+++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/Engine.cs
@@ -168,7 +168,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
168 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); 168 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()");
169 //ConstructorBuilder constructor = typeBuilder.DefineConstructor( 169 //ConstructorBuilder constructor = typeBuilder.DefineConstructor(
170 // MethodAttributes.Public, 170 // MethodAttributes.Public,
171 // CallingConventions.Standard, 171 // CallingConventions.Standard,
172 // new Type[0]); 172 // new Type[0]);
173 ConstructorBuilder constructor = typeBuilder.DefineConstructor( 173 ConstructorBuilder constructor = typeBuilder.DefineConstructor(
174 MethodAttributes.Public | 174 MethodAttributes.Public |
@@ -192,8 +192,8 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
192 //// Create state object 192 //// Create state object
193 //FieldName = "State"; 193 //FieldName = "State";
194 //FieldBuilder State_fb = typeBuilder.DefineField( 194 //FieldBuilder State_fb = typeBuilder.DefineField(
195 // FieldName, 195 // FieldName,
196 // typeof(UInt32), 196 // typeof(UInt32),
197 // FieldAttributes.Public); 197 // FieldAttributes.Public);
198 //il.Emit(OpCodes.Ldarg_0); 198 //il.Emit(OpCodes.Ldarg_0);
199 //il.Emit(OpCodes.Ldc_I4, 0); 199 //il.Emit(OpCodes.Ldc_I4, 0);
@@ -206,8 +206,8 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
206 206
207 //FieldName = "LSL_BuiltIns"; 207 //FieldName = "LSL_BuiltIns";
208 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField( 208 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField(
209 // FieldName, 209 // FieldName,
210 // objType1, 210 // objType1,
211 // FieldAttributes.Public); 211 // FieldAttributes.Public);
212 212
213 ////LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation(); 213 ////LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation();
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs
index 1b73311..7805aa3 100644
--- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs
+++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSL_BaseClass_OPCODES.cs
@@ -34,9 +34,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
34 // * 34 // *
35 // * These are internal "assembly" commands, 35 // * These are internal "assembly" commands,
36 // * basic operators like "ADD", "PUSH" and "POP" 36 // * basic operators like "ADD", "PUSH" and "POP"
37 // * 37 // *
38 // * It also contains managed stack and keeps track of internal variables, etc. 38 // * It also contains managed stack and keeps track of internal variables, etc.
39 // * 39 // *
40 // */ 40 // */
41 41
42 42
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs
index 06ae1e9..b2a2f25 100644
--- a/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs
+++ b/OpenSim/Region/ScriptEngine/LSOEngine/LSO/LSO_Parser.cs
@@ -69,14 +69,12 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
69 fs.Close(); 69 fs.Close();
70 } 70 }
71 71
72
73 /// <summary> 72 /// <summary>
74 /// Parse LSO file. 73 /// Parse LSO file.
75 /// </summary> 74 /// </summary>
76 public void Parse() 75 public void Parse()
77 { 76 {
78 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. 77 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack.
79
80 78
81 // HEADER BLOCK 79 // HEADER BLOCK
82 Common.SendToDebug("Reading HEADER BLOCK at: 0"); 80 Common.SendToDebug("Reading HEADER BLOCK at: 0");
@@ -156,7 +154,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
156 } 154 }
157 Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); 155 Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount);
158 156
159
160 // FUNCTION BLOCK 157 // FUNCTION BLOCK
161 // Always right after STATIC BLOCK 158 // Always right after STATIC BLOCK
162 LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock(); 159 LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock();
@@ -186,7 +183,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
186 } 183 }
187 } 184 }
188 185
189
190 // STATE FRAME BLOCK 186 // STATE FRAME BLOCK
191 // Always right after FUNCTION BLOCK 187 // Always right after FUNCTION BLOCK
192 Common.SendToDebug("Reading STATE BLOCK at: " + myHeader.SR); 188 Common.SendToDebug("Reading STATE BLOCK at: " + myHeader.SR);
@@ -213,7 +209,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
213 } 209 }
214 } 210 }
215 211
216
217 // STATE BLOCK 212 // STATE BLOCK
218 // For each StateFrameBlock there is one StateBlock with multiple event handlers 213 // For each StateFrameBlock there is one StateBlock with multiple event handlers
219 214
@@ -239,7 +234,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
239 234
240 // We need to count number of bits flagged in EventMask? 235 // We need to count number of bits flagged in EventMask?
241 236
242
243 // for each bit in myStateFrameBlock.StatePointer[i].EventMask 237 // for each bit in myStateFrameBlock.StatePointer[i].EventMask
244 238
245 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE 239 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE
@@ -273,7 +267,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
273 } 267 }
274 } 268 }
275 269
276
277 //// READ FUNCTION CODE CHUNKS 270 //// READ FUNCTION CODE CHUNKS
278 //// Functions + Function start pos (GFR) 271 //// Functions + Function start pos (GFR)
279 //// TODO: Somehow be able to identify and reference this 272 //// TODO: Somehow be able to identify and reference this
@@ -293,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
293 { 286 {
294 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 287 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
295 { 288 {
296 // TODO: Somehow organize events and functions so they can be found again, 289 // TODO: Somehow organize events and functions so they can be found again,
297 // two level search ain't no good 290 // two level search ain't no good
298 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 291 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
299 { 292 {
@@ -320,7 +313,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
320 } 313 }
321 } 314 }
322 315
323
324 if (Common.IL_CreateFunctionList) 316 if (Common.IL_CreateFunctionList)
325 IL_INSERT_FUNCTIONLIST(); 317 IL_INSERT_FUNCTIONLIST();
326 } 318 }
@@ -371,7 +363,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
371 363
372 //private byte[] br_read_smallendian(int len) 364 //private byte[] br_read_smallendian(int len)
373 //{ 365 //{
374 // byte[] bytes = new byte[len]; 366 // byte[] bytes = new byte[len];
375 // br.Read(bytes,0, len); 367 // br.Read(bytes,0, len);
376 // return bytes; 368 // return bytes;
377 //} 369 //}
@@ -459,7 +451,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
459 Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + 451 Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " +
460 ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString()); 452 ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString());
461 453
462
463 // TODO: How to determine number of codechunks -- does this method work? 454 // TODO: How to determine number of codechunks -- does this method work?
464 myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>(); 455 myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>();
465 byte reader = br_read(1)[0]; 456 byte reader = br_read(1)[0];
@@ -492,7 +483,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
492 // End marker is 0x000 483 // End marker is 0x000
493 myCodeChunk.EndMarker = reader; 484 myCodeChunk.EndMarker = reader;
494 485
495
496 // 486 //
497 // Emit: START OF METHOD (FUNCTION) 487 // Emit: START OF METHOD (FUNCTION)
498 // 488 //
@@ -515,11 +505,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
515 Common.SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();"); 505 Common.SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();");
516 ILGenerator il = methodBuilder.GetILGenerator(); 506 ILGenerator il = methodBuilder.GetILGenerator();
517 507
518
519 if (Common.IL_UseTryCatch) 508 if (Common.IL_UseTryCatch)
520 IL_INSERT_TRY(il, eventname); 509 IL_INSERT_TRY(il, eventname);
521 510
522
523 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); 511 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
524 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 512 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
525 //il.Emit(OpCodes.Call, typeof(Console).GetMethod 513 //il.Emit(OpCodes.Call, typeof(Console).GetMethod
@@ -534,7 +522,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
534 il.Emit(OpCodes.Ldarg, _ic); 522 il.Emit(OpCodes.Ldarg, _ic);
535 } 523 }
536 524
537
538 // 525 //
539 // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL 526 // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL
540 // 527 //
@@ -544,7 +531,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
544 FoundRet = LSL_PROCESS_OPCODE(il); 531 FoundRet = LSL_PROCESS_OPCODE(il);
545 } 532 }
546 533
547
548 if (Common.IL_UseTryCatch) 534 if (Common.IL_UseTryCatch)
549 IL_INSERT_END_TRY(il, eventname); 535 IL_INSERT_END_TRY(il, eventname);
550 536
@@ -558,17 +544,14 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
558 { 544 {
559 Common.SendToDebug("Creating function list"); 545 Common.SendToDebug("Creating function list");
560 546
561
562 string eventname = "GetFunctions"; 547 string eventname = "GetFunctions";
563 548
564 Common.SendToDebug("Creating IL " + eventname); 549 Common.SendToDebug("Creating IL " + eventname);
565 // Define a private String field. 550 // Define a private String field.
566 //FieldBuilder myField = myTypeBuilder.DefineField("EventList", typeof(String[]), FieldAttributes.Public); 551 //FieldBuilder myField = myTypeBuilder.DefineField("EventList", typeof(String[]), FieldAttributes.Public);
567 552
568
569 //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); 553 //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private);
570 554
571
572 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, 555 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
573 MethodAttributes.Public, 556 MethodAttributes.Public,
574 typeof (string[]), 557 typeof (string[]),
@@ -579,7 +562,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
579 562
580 ILGenerator il = methodBuilder.GetILGenerator(); 563 ILGenerator il = methodBuilder.GetILGenerator();
581 564
582
583 // IL_INSERT_TRY(il, eventname); 565 // IL_INSERT_TRY(il, eventname);
584 566
585 // // Push string to stack 567 // // Push string to stack
@@ -615,17 +597,14 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
615 //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); 597 //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) }));
616 } 598 }
617 599
618
619 // IL_INSERT_END_TRY(il, eventname); 600 // IL_INSERT_END_TRY(il, eventname);
620 601
621
622 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack 602 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
623 // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); 603 // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) }));
624 604
625 il.Emit(OpCodes.Ret); // Return 605 il.Emit(OpCodes.Ret); // Return
626 } 606 }
627 607
628
629 private void IL_INSERT_TRY(ILGenerator il, string eventname) 608 private void IL_INSERT_TRY(ILGenerator il, string eventname)
630 { 609 {
631 /* 610 /*
@@ -687,7 +666,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine.LSO
687 { 666 {
688 Common.SendToDebug("Found cached STATIC BLOCK"); 667 Common.SendToDebug("Found cached STATIC BLOCK");
689 668
690
691 return StaticBlocks[pos]; 669 return StaticBlocks[pos];
692 } 670 }
693 671