mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 05:45:37 +08:00
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
This commit is contained in:
@@ -27,31 +27,32 @@
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
public static class Common
|
||||
{
|
||||
static public bool Debug = true;
|
||||
static public bool IL_UseTryCatch = true;
|
||||
static public bool IL_CreateConstructor = true;
|
||||
static public bool IL_CreateFunctionList = true;
|
||||
static public bool IL_ProcessCodeChunks = true;
|
||||
public static bool Debug = true;
|
||||
public static bool IL_UseTryCatch = true;
|
||||
public static bool IL_CreateConstructor = true;
|
||||
public static bool IL_CreateFunctionList = true;
|
||||
public static bool IL_ProcessCodeChunks = true;
|
||||
|
||||
public delegate void SendToDebugEventDelegate(string Message);
|
||||
public delegate void SendToLogEventDelegate(string Message);
|
||||
static public event SendToDebugEventDelegate SendToDebugEvent;
|
||||
static public event SendToLogEventDelegate SendToLogEvent;
|
||||
|
||||
static public void SendToDebug(string Message)
|
||||
public delegate void SendToLogEventDelegate(string Message);
|
||||
|
||||
public static event SendToDebugEventDelegate SendToDebugEvent;
|
||||
public static event SendToLogEventDelegate SendToLogEvent;
|
||||
|
||||
public static void SendToDebug(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
Console.WriteLine("COMPILER:Debug: " + Message);
|
||||
SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
static public void SendToLog(string Message)
|
||||
|
||||
public static void SendToLog(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
Console.WriteLine("COMPILER:LOG: " + Message);
|
||||
@@ -68,6 +69,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("ReverseFormatString format: " + format);
|
||||
return string.Format(format, text1);
|
||||
}
|
||||
|
||||
public static string ReverseFormatString(string text1, UInt32 text2, string format)
|
||||
{
|
||||
Common.SendToDebug("ReverseFormatString text1: " + text1);
|
||||
@@ -75,10 +77,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("ReverseFormatString format: " + format);
|
||||
return string.Format(format, text1, text2.ToString());
|
||||
}
|
||||
|
||||
public static string Cast_ToString(object obj)
|
||||
{
|
||||
Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString());
|
||||
return "ABCDEFGIHJKLMNOPQ123";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,20 +27,19 @@
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
|
||||
|
||||
public class Engine
|
||||
{
|
||||
//private string LSO_FileName = @"LSO\AdditionTest.lso";
|
||||
private string LSO_FileName;// = @"LSO\CloseToDefault.lso";
|
||||
AppDomain appDomain;
|
||||
private string LSO_FileName; // = @"LSO\CloseToDefault.lso";
|
||||
private AppDomain appDomain;
|
||||
|
||||
public string Compile(string LSOFileName)
|
||||
{
|
||||
@@ -52,20 +51,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
// Create Assembly Name
|
||||
AssemblyName asmName = new AssemblyName();
|
||||
asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName);
|
||||
asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName);
|
||||
//asmName.Name = "TestAssembly";
|
||||
|
||||
string DLL_FileName = asmName.Name + ".dll";
|
||||
string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName;
|
||||
string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName;
|
||||
|
||||
Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(LSO_FileName));
|
||||
Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName));
|
||||
Common.SendToLog("Assembly name: " + asmName.Name);
|
||||
Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll");
|
||||
Common.SendToLog("Starting processing of LSL ByteCode...");
|
||||
Common.SendToLog("");
|
||||
|
||||
|
||||
|
||||
// Create Assembly
|
||||
AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly(
|
||||
asmName,
|
||||
@@ -78,15 +76,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
// Create a module (and save to disk)
|
||||
ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
|
||||
(asmName.Name,
|
||||
DLL_FileName);
|
||||
(asmName.Name,
|
||||
DLL_FileName);
|
||||
|
||||
//Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\"");
|
||||
// Create a Class (/Type)
|
||||
TypeBuilder typeBuilder = modBuilder.DefineType(
|
||||
"LSL_ScriptObject",
|
||||
TypeAttributes.Public | TypeAttributes.BeforeFieldInit,
|
||||
typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass));
|
||||
"LSL_ScriptObject",
|
||||
TypeAttributes.Public | TypeAttributes.BeforeFieldInit,
|
||||
typeof (LSL_BaseClass));
|
||||
//,
|
||||
// typeof());
|
||||
//, typeof(LSL_BuiltIn_Commands_Interface));
|
||||
@@ -95,7 +93,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// new Type[] { typeof(LSL_CLRInterface.LSLScript) });
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Generate the IL itself
|
||||
*/
|
||||
@@ -123,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
asmBuilder.Save(DLL_FileName);
|
||||
|
||||
Common.SendToLog("Returning assembly filename: " + DLL_FileName);
|
||||
|
||||
|
||||
|
||||
return DLL_FileName;
|
||||
|
||||
@@ -135,9 +132,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//object MyScript = (object)Activator.CreateInstance(type);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//System.Reflection.MemberInfo[] Members = type.GetMembers();
|
||||
|
||||
//Common.SendToLog("Members of assembly " + type.ToString() + ":");
|
||||
@@ -165,29 +159,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" });
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP)
|
||||
{
|
||||
|
||||
|
||||
Common.SendToDebug("IL_CREATE_CONSTRUCTOR()");
|
||||
//ConstructorBuilder constructor = typeBuilder.DefineConstructor(
|
||||
// MethodAttributes.Public,
|
||||
// CallingConventions.Standard,
|
||||
// new Type[0]);
|
||||
ConstructorBuilder constructor = typeBuilder.DefineConstructor(
|
||||
MethodAttributes.Public |
|
||||
MethodAttributes.SpecialName |
|
||||
MethodAttributes.RTSpecialName,
|
||||
CallingConventions.Standard,
|
||||
new Type[0]);
|
||||
MethodAttributes.Public |
|
||||
MethodAttributes.SpecialName |
|
||||
MethodAttributes.RTSpecialName,
|
||||
CallingConventions.Standard,
|
||||
new Type[0]);
|
||||
|
||||
//Define the reflection ConstructorInfor for System.Object
|
||||
ConstructorInfo conObj = typeof(LSL_BaseClass).GetConstructor(new Type[0]);
|
||||
ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]);
|
||||
|
||||
//call constructor of base object
|
||||
ILGenerator il = constructor.GetILGenerator();
|
||||
@@ -230,58 +220,61 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
LSO_Struct.StaticBlock sb;
|
||||
LSOP.StaticBlocks.TryGetValue(pos, out sb);
|
||||
|
||||
if (sb.ObjectType > 0 && sb.ObjectType < 8) { // We don't want void or null's
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
// Push position to stack
|
||||
il.Emit(OpCodes.Ldc_I4, pos);
|
||||
//il.Emit(OpCodes.Box, typeof(UInt32));
|
||||
|
||||
|
||||
Type datatype = null;
|
||||
|
||||
// Push data to stack
|
||||
Common.SendToDebug("Adding to static (" + pos + ") type: " + ((LSO_Enums.Variable_Type_Codes)sb.ObjectType).ToString() + " (" + sb.ObjectType + ")");
|
||||
switch ((LSO_Enums.Variable_Type_Codes)sb.ObjectType)
|
||||
if (sb.ObjectType > 0 && sb.ObjectType < 8)
|
||||
{
|
||||
case LSO_Enums.Variable_Type_Codes.Float:
|
||||
case LSO_Enums.Variable_Type_Codes.Integer:
|
||||
//UInt32
|
||||
il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0));
|
||||
datatype = typeof(UInt32);
|
||||
il.Emit(OpCodes.Box, datatype);
|
||||
break;
|
||||
case LSO_Enums.Variable_Type_Codes.String:
|
||||
case LSO_Enums.Variable_Type_Codes.Key:
|
||||
//String
|
||||
LSO_Struct.HeapBlock hb = LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1);
|
||||
il.Emit(OpCodes.Ldstr, System.Text.Encoding.UTF8.GetString(hb.Data));
|
||||
datatype = typeof(string);
|
||||
break;
|
||||
case LSO_Enums.Variable_Type_Codes.Vector:
|
||||
datatype = typeof(LSO_Enums.Vector);
|
||||
//TODO: Not implemented
|
||||
break;
|
||||
case LSO_Enums.Variable_Type_Codes.Rotation:
|
||||
//Object
|
||||
//TODO: Not implemented
|
||||
datatype = typeof(LSO_Enums.Rotation);
|
||||
break;
|
||||
default:
|
||||
datatype = typeof(object);
|
||||
break;
|
||||
// We don't want void or null's
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
// Push position to stack
|
||||
il.Emit(OpCodes.Ldc_I4, pos);
|
||||
//il.Emit(OpCodes.Box, typeof(UInt32));
|
||||
|
||||
|
||||
Type datatype = null;
|
||||
|
||||
// Push data to stack
|
||||
Common.SendToDebug("Adding to static (" + pos + ") type: " +
|
||||
((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType +
|
||||
")");
|
||||
switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType)
|
||||
{
|
||||
case LSO_Enums.Variable_Type_Codes.Float:
|
||||
case LSO_Enums.Variable_Type_Codes.Integer:
|
||||
//UInt32
|
||||
il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0));
|
||||
datatype = typeof (UInt32);
|
||||
il.Emit(OpCodes.Box, datatype);
|
||||
break;
|
||||
case LSO_Enums.Variable_Type_Codes.String:
|
||||
case LSO_Enums.Variable_Type_Codes.Key:
|
||||
//String
|
||||
LSO_Struct.HeapBlock hb =
|
||||
LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1);
|
||||
il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data));
|
||||
datatype = typeof (string);
|
||||
break;
|
||||
case LSO_Enums.Variable_Type_Codes.Vector:
|
||||
datatype = typeof (LSO_Enums.Vector);
|
||||
//TODO: Not implemented
|
||||
break;
|
||||
case LSO_Enums.Variable_Type_Codes.Rotation:
|
||||
//Object
|
||||
//TODO: Not implemented
|
||||
datatype = typeof (LSO_Enums.Rotation);
|
||||
break;
|
||||
default:
|
||||
datatype = typeof (object);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Make call
|
||||
il.Emit(OpCodes.Call,
|
||||
typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype}));
|
||||
}
|
||||
|
||||
|
||||
// Make call
|
||||
il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype }));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
////il.Emit(OpCodes.Newobj, typeof(UInt32));
|
||||
//il.Emit(OpCodes.Starg_0);
|
||||
//// Create LSL function library
|
||||
@@ -293,8 +286,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// End of class
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,30 +27,25 @@
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
partial class LSO_Parser
|
||||
internal partial class LSO_Parser
|
||||
{
|
||||
private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName)
|
||||
{
|
||||
TypeBuilder typeBuilder = modBuilder.DefineType(typeName,
|
||||
TypeAttributes.Public |
|
||||
TypeAttributes.Class |
|
||||
TypeAttributes.AutoClass |
|
||||
TypeAttributes.AnsiClass |
|
||||
TypeAttributes.BeforeFieldInit |
|
||||
TypeAttributes.AutoLayout,
|
||||
typeof(object),
|
||||
new Type[] { typeof(object) });
|
||||
TypeAttributes.Public |
|
||||
TypeAttributes.Class |
|
||||
TypeAttributes.AutoClass |
|
||||
TypeAttributes.AnsiClass |
|
||||
TypeAttributes.BeforeFieldInit |
|
||||
TypeAttributes.AutoLayout,
|
||||
typeof (object),
|
||||
new Type[] {typeof (object)});
|
||||
return typeBuilder;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
@@ -39,9 +36,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
//public MemoryStream LSLStack = new MemoryStream();
|
||||
public Stack<object> LSLStack = new Stack<object>();
|
||||
public Dictionary<UInt32, object> StaticVariables = new Dictionary<UInt32, object>();
|
||||
public Dictionary<UInt32, object> GlobalVariables = new Dictionary<UInt32, object>();
|
||||
public Dictionary<UInt32, object> LocalVariables = new Dictionary<UInt32, object>();
|
||||
public Dictionary<uint, object> StaticVariables = new Dictionary<uint, object>();
|
||||
public Dictionary<uint, object> GlobalVariables = new Dictionary<uint, object>();
|
||||
public Dictionary<uint, object> LocalVariables = new Dictionary<uint, object>();
|
||||
//public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>();
|
||||
//public void AddFunction(String x) {
|
||||
// FunctionList.Add(x);
|
||||
@@ -54,19 +51,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//}
|
||||
public UInt32 State = 0;
|
||||
public LSL_BuiltIn_Commands_Interface LSL_Builtins;
|
||||
|
||||
public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn()
|
||||
{
|
||||
return LSL_Builtins;
|
||||
}
|
||||
|
||||
|
||||
public LSL_BaseClass() { }
|
||||
public LSL_BaseClass()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public virtual int OverrideMe()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins)
|
||||
{
|
||||
LSL_Builtins = LSLBuiltins;
|
||||
@@ -81,8 +82,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType());
|
||||
StaticVariables.Add(index, obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,6 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
@@ -53,6 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
LocalVariables.Remove(index);
|
||||
LocalVariables.Add(index, LSLStack.Peek());
|
||||
}
|
||||
|
||||
public void StoreToGlobal(UInt32 index)
|
||||
{
|
||||
Common.SendToDebug("::StoreToGlobal " + index);
|
||||
@@ -60,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
GlobalVariables.Remove(index);
|
||||
GlobalVariables.Add(index, LSLStack.Peek());
|
||||
}
|
||||
|
||||
public void StoreToStatic(UInt32 index)
|
||||
{
|
||||
Common.SendToDebug("::StoreToStatic " + index);
|
||||
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// StaticVariables.Remove(index);
|
||||
StaticVariables.Add(index, LSLStack.Peek());
|
||||
}
|
||||
|
||||
public void GetFromLocal(UInt32 index)
|
||||
{
|
||||
// TODO: How to determine local?
|
||||
@@ -76,6 +77,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
LSLStack.Push(ret);
|
||||
//return ret;
|
||||
}
|
||||
|
||||
public void GetFromGlobal(UInt32 index)
|
||||
{
|
||||
Common.SendToDebug("::GetFromGlobal " + index);
|
||||
@@ -84,6 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
LSLStack.Push(ret);
|
||||
//return ret;
|
||||
}
|
||||
|
||||
public void GetFromStatic(UInt32 index)
|
||||
{
|
||||
Common.SendToDebug("::GetFromStatic " + index);
|
||||
@@ -99,22 +102,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("::POPToStack");
|
||||
//return LSLStack.Pop();
|
||||
object p = LSLStack.Pop();
|
||||
if (p.GetType() == typeof(UInt32))
|
||||
return (UInt32)p;
|
||||
if (p.GetType() == typeof(string))
|
||||
return (string)p;
|
||||
if (p.GetType() == typeof(Int32))
|
||||
return (Int32)p;
|
||||
if (p.GetType() == typeof(UInt16))
|
||||
return (UInt16)p;
|
||||
if (p.GetType() == typeof(float))
|
||||
return (float)p;
|
||||
if (p.GetType() == typeof(LSO_Enums.Vector))
|
||||
return (LSO_Enums.Vector)p;
|
||||
if (p.GetType() == typeof(LSO_Enums.Rotation))
|
||||
return (LSO_Enums.Rotation)p;
|
||||
if (p.GetType() == typeof(LSO_Enums.Key))
|
||||
return (LSO_Enums.Key)p;
|
||||
if (p.GetType() == typeof (UInt32))
|
||||
return (UInt32) p;
|
||||
if (p.GetType() == typeof (string))
|
||||
return (string) p;
|
||||
if (p.GetType() == typeof (Int32))
|
||||
return (Int32) p;
|
||||
if (p.GetType() == typeof (UInt16))
|
||||
return (UInt16) p;
|
||||
if (p.GetType() == typeof (float))
|
||||
return (float) p;
|
||||
if (p.GetType() == typeof (LSO_Enums.Vector))
|
||||
return (LSO_Enums.Vector) p;
|
||||
if (p.GetType() == typeof (LSO_Enums.Rotation))
|
||||
return (LSO_Enums.Rotation) p;
|
||||
if (p.GetType() == typeof (LSO_Enums.Key))
|
||||
return (LSO_Enums.Key) p;
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -151,6 +154,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
LSLStack.Pop();
|
||||
}
|
||||
}
|
||||
|
||||
public void PUSH(object Param)
|
||||
{
|
||||
if (Param == null)
|
||||
@@ -159,205 +163,218 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//Common.SendToDebug("::PUSH: " + Param.GetType());
|
||||
}
|
||||
|
||||
LSLStack.Push(Param);
|
||||
}
|
||||
|
||||
public void ADD(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::ADD: " + Param);
|
||||
object o2 = LSLStack.Pop();
|
||||
object o1 = LSLStack.Pop();
|
||||
Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + " (" + o2.ToString() + ")");
|
||||
if (o2.GetType() == typeof(string))
|
||||
Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() +
|
||||
" (" + o2.ToString() + ")");
|
||||
if (o2.GetType() == typeof (string))
|
||||
{
|
||||
LSLStack.Push((string)o1 + (string)o2);
|
||||
LSLStack.Push((string) o1 + (string) o2);
|
||||
return;
|
||||
}
|
||||
if (o2.GetType() == typeof(UInt32))
|
||||
if (o2.GetType() == typeof (UInt32))
|
||||
{
|
||||
LSLStack.Push((UInt32)o1 + (UInt32)o2);
|
||||
LSLStack.Push((UInt32) o1 + (UInt32) o2);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SUB(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::SUB: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 - i2));
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1 - i2));
|
||||
}
|
||||
|
||||
public void MUL(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::SUB: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 * i2));
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1*i2));
|
||||
}
|
||||
|
||||
public void DIV(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::DIV: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 / i2));
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1/i2));
|
||||
}
|
||||
|
||||
|
||||
public void MOD(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::MOD: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 % i2));
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1%i2));
|
||||
}
|
||||
|
||||
public void EQ(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::EQ: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
if (i1 == i2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
}
|
||||
}
|
||||
public void NEQ(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::NEQ: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
if (i1 != i2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
}
|
||||
}
|
||||
public void LEQ(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::LEQ: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
if (i1 <= i2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
}
|
||||
}
|
||||
public void GEQ(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::GEQ: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
if (i1 >= i2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
}
|
||||
}
|
||||
public void LESS(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::LESS: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
if (i1 < i2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
}
|
||||
}
|
||||
public void GREATER(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::GREATER: " + Param);
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
if (i1 > i2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void NEQ(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::NEQ: " + Param);
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
if (i1 != i2)
|
||||
{
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void LEQ(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::LEQ: " + Param);
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
if (i1 <= i2)
|
||||
{
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void GEQ(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::GEQ: " + Param);
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
if (i1 >= i2)
|
||||
{
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void LESS(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::LESS: " + Param);
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
if (i1 < i2)
|
||||
{
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void GREATER(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::GREATER: " + Param);
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
if (i1 > i2)
|
||||
{
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void BITAND()
|
||||
{
|
||||
Common.SendToDebug("::BITAND");
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 & i2));
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1 & i2));
|
||||
}
|
||||
|
||||
public void BITOR()
|
||||
{
|
||||
Common.SendToDebug("::BITOR");
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 | i2));
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1 | i2));
|
||||
}
|
||||
|
||||
public void BITXOR()
|
||||
{
|
||||
Common.SendToDebug("::BITXOR");
|
||||
UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 ^ i2));
|
||||
UInt32 i2 = (UInt32) LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1 ^ i2));
|
||||
}
|
||||
|
||||
public void BOOLAND()
|
||||
{
|
||||
Common.SendToDebug("::BOOLAND");
|
||||
bool b2 = bool.Parse((string)LSLStack.Pop());
|
||||
bool b1 = bool.Parse((string)LSLStack.Pop());
|
||||
bool b2 = bool.Parse((string) LSLStack.Pop());
|
||||
bool b1 = bool.Parse((string) LSLStack.Pop());
|
||||
if (b1 && b2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void BOOLOR()
|
||||
{
|
||||
Common.SendToDebug("::BOOLOR");
|
||||
bool b2 = bool.Parse((string)LSLStack.Pop());
|
||||
bool b1 = bool.Parse((string)LSLStack.Pop());
|
||||
bool b2 = bool.Parse((string) LSLStack.Pop());
|
||||
bool b1 = bool.Parse((string) LSLStack.Pop());
|
||||
|
||||
if (b1 || b2)
|
||||
{
|
||||
LSLStack.Push((UInt32)1);
|
||||
LSLStack.Push((UInt32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLStack.Push((UInt32)0);
|
||||
LSLStack.Push((UInt32) 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void NEG(UInt32 Param)
|
||||
{
|
||||
Common.SendToDebug("::NEG: " + Param);
|
||||
//UInt32 i2 = (UInt32)LSLStack.Pop();
|
||||
UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
LSLStack.Push((UInt32)(i1 * -1));
|
||||
UInt32 i1 = (UInt32) LSLStack.Pop();
|
||||
LSLStack.Push((UInt32) (i1*-1));
|
||||
}
|
||||
|
||||
public void BITNOT()
|
||||
{
|
||||
//Common.SendToDebug("::BITNOT");
|
||||
@@ -365,6 +382,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
//LSLStack.Push((UInt32)(i1 / i2));
|
||||
}
|
||||
|
||||
public void BOOLNOT()
|
||||
{
|
||||
//Common.SendToDebug("::BOOLNOT");
|
||||
@@ -372,7 +390,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//UInt32 i1 = (UInt32)LSLStack.Pop();
|
||||
//LSLStack.Push((UInt32)(i1));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,6 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
public class LSL_CLRInterface
|
||||
@@ -76,4 +72,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//void event_http_response();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,32 +27,28 @@
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
partial class LSO_Parser
|
||||
internal partial class LSO_Parser
|
||||
{
|
||||
//internal Stack<Type> ILStack = new Stack<Type>();
|
||||
//LSO_Enums MyLSO_Enums = new LSO_Enums();
|
||||
|
||||
internal bool LSL_PROCESS_OPCODE(ILGenerator il)
|
||||
{
|
||||
|
||||
byte bp1;
|
||||
UInt32 u32p1;
|
||||
float fp1;
|
||||
UInt16 opcode = br_read(1)[0];
|
||||
Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString());
|
||||
string idesc = ((LSO_Enums.Operation_Table)opcode).ToString();
|
||||
switch ((LSO_Enums.Operation_Table)opcode)
|
||||
Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString());
|
||||
string idesc = ((LSO_Enums.Operation_Table) opcode).ToString();
|
||||
switch ((LSO_Enums.Operation_Table) opcode)
|
||||
{
|
||||
|
||||
/***************
|
||||
/***************
|
||||
* IMPLEMENTED *
|
||||
***************/
|
||||
case LSO_Enums.Operation_Table.NOOP:
|
||||
@@ -60,33 +56,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
case LSO_Enums.Operation_Table.PUSHSP:
|
||||
// Push Stack Top (Memory Address) to stack
|
||||
Common.SendToDebug("Instruction " + idesc);
|
||||
Common.SendToDebug("Instruction " + idesc + ": Description: Pushing Stack Top (Memory Address from header) to stack");
|
||||
IL_Push(il, (UInt32)myHeader.SP);
|
||||
Common.SendToDebug("Instruction " + idesc +
|
||||
": Description: Pushing Stack Top (Memory Address from header) to stack");
|
||||
IL_Push(il, (UInt32) myHeader.SP);
|
||||
break;
|
||||
// BYTE
|
||||
// BYTE
|
||||
case LSO_Enums.Operation_Table.PUSHARGB:
|
||||
Common.SendToDebug("Param1: " + br_read(1)[0]);
|
||||
break;
|
||||
// INTEGER
|
||||
// INTEGER
|
||||
case LSO_Enums.Operation_Table.PUSHARGI:
|
||||
u32p1 = BitConverter.ToUInt32(br_read(4), 0);
|
||||
Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1);
|
||||
IL_Push(il, u32p1);
|
||||
break;
|
||||
// FLOAT
|
||||
// FLOAT
|
||||
case LSO_Enums.Operation_Table.PUSHARGF:
|
||||
fp1 = BitConverter.ToUInt32(br_read(4), 0);
|
||||
Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1);
|
||||
IL_Push(il, fp1);
|
||||
break;
|
||||
// STRING
|
||||
// STRING
|
||||
case LSO_Enums.Operation_Table.PUSHARGS:
|
||||
string s = Read_String();
|
||||
Common.SendToDebug("Instruction " + idesc + ", Param1: " + s);
|
||||
IL_Debug(il, "OPCODE: " + idesc + ":" + s);
|
||||
IL_Push(il, s);
|
||||
break;
|
||||
// VECTOR z,y,x
|
||||
// VECTOR z,y,x
|
||||
case LSO_Enums.Operation_Table.PUSHARGV:
|
||||
LSO_Enums.Vector v = new LSO_Enums.Vector();
|
||||
v.Z = BitConverter.ToUInt32(br_read(4), 0);
|
||||
@@ -97,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("Param1 X: " + v.X);
|
||||
IL_Push(il, v);
|
||||
break;
|
||||
// ROTATION s,z,y,x
|
||||
// ROTATION s,z,y,x
|
||||
case LSO_Enums.Operation_Table.PUSHARGQ:
|
||||
LSO_Enums.Rotation r = new LSO_Enums.Rotation();
|
||||
r.S = BitConverter.ToUInt32(br_read(4), 0);
|
||||
@@ -112,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
break;
|
||||
|
||||
case LSO_Enums.Operation_Table.PUSHE:
|
||||
IL_Push(il, (UInt32)0);
|
||||
IL_Push(il, (UInt32) 0);
|
||||
break;
|
||||
|
||||
case LSO_Enums.Operation_Table.PUSHARGE:
|
||||
@@ -121,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1)));
|
||||
IL_Push(il, u32p1);
|
||||
break;
|
||||
// BYTE
|
||||
// BYTE
|
||||
case LSO_Enums.Operation_Table.ADD:
|
||||
case LSO_Enums.Operation_Table.SUB:
|
||||
case LSO_Enums.Operation_Table.MUL:
|
||||
@@ -136,10 +133,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
case LSO_Enums.Operation_Table.MOD:
|
||||
bp1 = br_read(1)[0];
|
||||
Common.SendToDebug("Param1: " + bp1);
|
||||
IL_CallBaseFunction(il, idesc, (UInt32)bp1);
|
||||
IL_CallBaseFunction(il, idesc, (UInt32) bp1);
|
||||
break;
|
||||
|
||||
// NO ARGUMENTS
|
||||
// NO ARGUMENTS
|
||||
case LSO_Enums.Operation_Table.BITAND:
|
||||
case LSO_Enums.Operation_Table.BITOR:
|
||||
case LSO_Enums.Operation_Table.BITXOR:
|
||||
@@ -149,22 +146,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
case LSO_Enums.Operation_Table.BOOLNOT:
|
||||
IL_CallBaseFunction(il, idesc);
|
||||
break;
|
||||
// SHORT
|
||||
// SHORT
|
||||
case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE:
|
||||
// TODO: What is size of short?
|
||||
UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0);
|
||||
Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString());
|
||||
Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " +
|
||||
((LSO_Enums.BuiltIn_Functions) U16p1).ToString());
|
||||
//Common.SendToDebug("Param1: " + U16p1);
|
||||
string fname = ((LSO_Enums.BuiltIn_Functions)U16p1).ToString();
|
||||
string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString();
|
||||
|
||||
bool cmdFound = false;
|
||||
foreach (MethodInfo mi in typeof(LSL_BuiltIn_Commands_Interface).GetMethods())
|
||||
foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods())
|
||||
{
|
||||
// Found command
|
||||
if (mi.Name == fname)
|
||||
{
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] { }));
|
||||
il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {}));
|
||||
// Pop required number of items from my stack to .Net stack
|
||||
IL_PopToStack(il, mi.GetParameters().Length);
|
||||
il.Emit(OpCodes.Callvirt, mi);
|
||||
@@ -179,7 +177,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
break;
|
||||
|
||||
// RETURN
|
||||
// RETURN
|
||||
case LSO_Enums.Operation_Table.RETURN:
|
||||
|
||||
Common.SendToDebug("OPCODE: RETURN");
|
||||
@@ -195,7 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
IL_Pop(il);
|
||||
break;
|
||||
|
||||
// LONG
|
||||
// LONG
|
||||
case LSO_Enums.Operation_Table.STORE:
|
||||
case LSO_Enums.Operation_Table.STORES:
|
||||
case LSO_Enums.Operation_Table.STOREL:
|
||||
@@ -238,7 +236,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
IL_Pop(il);
|
||||
break;
|
||||
|
||||
// PUSH FROM LOCAL FRAME
|
||||
// PUSH FROM LOCAL FRAME
|
||||
case LSO_Enums.Operation_Table.PUSH:
|
||||
case LSO_Enums.Operation_Table.PUSHS:
|
||||
case LSO_Enums.Operation_Table.PUSHL:
|
||||
@@ -250,7 +248,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
break;
|
||||
|
||||
// PUSH FROM STATIC FRAME
|
||||
// PUSH FROM STATIC FRAME
|
||||
case LSO_Enums.Operation_Table.PUSHG:
|
||||
case LSO_Enums.Operation_Table.PUSHGS:
|
||||
case LSO_Enums.Operation_Table.PUSHGL:
|
||||
@@ -262,26 +260,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
break;
|
||||
|
||||
|
||||
/***********************
|
||||
/***********************
|
||||
* NOT IMPLEMENTED YET *
|
||||
***********************/
|
||||
|
||||
|
||||
|
||||
case LSO_Enums.Operation_Table.POPIP:
|
||||
case LSO_Enums.Operation_Table.POPSP:
|
||||
case LSO_Enums.Operation_Table.POPSLR:
|
||||
case LSO_Enums.Operation_Table.POPARG:
|
||||
case LSO_Enums.Operation_Table.POPBP:
|
||||
//Common.SendToDebug("Instruction " + idesc + ": Ignored");
|
||||
Common.SendToDebug("Instruction " + idesc + ": Description: Drop x bytes from the stack (TODO: Only popping 1)");
|
||||
Common.SendToDebug("Instruction " + idesc +
|
||||
": Description: Drop x bytes from the stack (TODO: Only popping 1)");
|
||||
//Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
|
||||
IL_Pop(il);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
// None
|
||||
// None
|
||||
case LSO_Enums.Operation_Table.PUSHIP:
|
||||
// PUSH INSTRUCTION POINTER
|
||||
break;
|
||||
@@ -293,17 +290,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
break;
|
||||
|
||||
|
||||
// LONG
|
||||
// LONG
|
||||
case LSO_Enums.Operation_Table.JUMP:
|
||||
Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
|
||||
break;
|
||||
// BYTE, LONG
|
||||
// BYTE, LONG
|
||||
case LSO_Enums.Operation_Table.JUMPIF:
|
||||
case LSO_Enums.Operation_Table.JUMPNIF:
|
||||
Common.SendToDebug("Param1: " + br_read(1)[0]);
|
||||
Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0));
|
||||
break;
|
||||
// LONG
|
||||
// LONG
|
||||
case LSO_Enums.Operation_Table.STATE:
|
||||
bp1 = br_read(1)[0];
|
||||
//il.Emit(OpCodes.Ld); // Load local variable 0 onto stack
|
||||
@@ -315,12 +312,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
|
||||
Common.SendToDebug("ERROR: Function CALL not implemented yet.");
|
||||
break;
|
||||
// BYTE
|
||||
// BYTE
|
||||
case LSO_Enums.Operation_Table.CAST:
|
||||
bp1 = br_read(1)[0];
|
||||
Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + ((LSO_Enums.OpCode_Cast_TypeDefs)bp1));
|
||||
Common.SendToDebug("Instruction " + idesc + ": Cast to type: " +
|
||||
((LSO_Enums.OpCode_Cast_TypeDefs) bp1));
|
||||
Common.SendToDebug("Param1: " + bp1);
|
||||
switch ((LSO_Enums.OpCode_Cast_TypeDefs)bp1)
|
||||
switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)
|
||||
{
|
||||
case LSO_Enums.OpCode_Cast_TypeDefs.String:
|
||||
Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());");
|
||||
@@ -330,12 +328,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// LONG
|
||||
// LONG
|
||||
case LSO_Enums.Operation_Table.STACKTOS:
|
||||
case LSO_Enums.Operation_Table.STACKTOL:
|
||||
Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
|
||||
break;
|
||||
// BYTE
|
||||
// BYTE
|
||||
case LSO_Enums.Operation_Table.PRINT:
|
||||
case LSO_Enums.Operation_Table.CALLLIB:
|
||||
Common.SendToDebug("Param1: " + br_read(1)[0]);
|
||||
@@ -348,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
IL_PopToStack(il, 1);
|
||||
}
|
||||
|
||||
private void IL_PopToStack(ILGenerator il, int count)
|
||||
{
|
||||
Common.SendToDebug("IL_PopToStack();");
|
||||
@@ -360,31 +359,35 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// new Type[] { }));
|
||||
}
|
||||
}
|
||||
|
||||
private void IL_Pop(ILGenerator il)
|
||||
{
|
||||
Common.SendToDebug("IL_Pop();");
|
||||
IL_CallBaseFunction(il, "POP");
|
||||
}
|
||||
|
||||
private void IL_Debug(ILGenerator il, string text)
|
||||
{
|
||||
il.Emit(OpCodes.Ldstr, text);
|
||||
il.Emit(OpCodes.Call, typeof(Common).GetMethod("SendToDebug",
|
||||
new Type[] { typeof(string) }
|
||||
));
|
||||
il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug",
|
||||
new Type[] {typeof (string)}
|
||||
));
|
||||
}
|
||||
|
||||
private void IL_CallBaseFunction(ILGenerator il, string methodname)
|
||||
{
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { }));
|
||||
il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {}));
|
||||
}
|
||||
|
||||
private void IL_CallBaseFunction(ILGenerator il, string methodname, object data)
|
||||
{
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
if (data.GetType() == typeof(string))
|
||||
il.Emit(OpCodes.Ldstr, (string)data);
|
||||
if (data.GetType() == typeof(UInt32))
|
||||
il.Emit(OpCodes.Ldc_I4, (UInt32)data);
|
||||
il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { data.GetType() }));
|
||||
if (data.GetType() == typeof (string))
|
||||
il.Emit(OpCodes.Ldstr, (string) data);
|
||||
if (data.GetType() == typeof (UInt32))
|
||||
il.Emit(OpCodes.Ldc_I4, (UInt32) data);
|
||||
il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()}));
|
||||
}
|
||||
|
||||
private void IL_Push(ILGenerator il, object data)
|
||||
@@ -394,43 +397,39 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
IL_PushDataTypeToILStack(il, data);
|
||||
|
||||
il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("PUSH", new Type[] { data.GetType() }));
|
||||
|
||||
il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()}));
|
||||
}
|
||||
|
||||
private void IL_PushDataTypeToILStack(ILGenerator il, object data)
|
||||
{
|
||||
if (data.GetType() == typeof(UInt16))
|
||||
if (data.GetType() == typeof (UInt16))
|
||||
{
|
||||
il.Emit(OpCodes.Ldc_I4, (UInt16)data);
|
||||
il.Emit(OpCodes.Ldc_I4, (UInt16) data);
|
||||
il.Emit(OpCodes.Box, data.GetType());
|
||||
}
|
||||
if (data.GetType() == typeof(UInt32))
|
||||
if (data.GetType() == typeof (UInt32))
|
||||
{
|
||||
il.Emit(OpCodes.Ldc_I4, (UInt32)data);
|
||||
il.Emit(OpCodes.Ldc_I4, (UInt32) data);
|
||||
il.Emit(OpCodes.Box, data.GetType());
|
||||
}
|
||||
if (data.GetType() == typeof(Int32))
|
||||
if (data.GetType() == typeof (Int32))
|
||||
{
|
||||
il.Emit(OpCodes.Ldc_I4, (Int32)data);
|
||||
il.Emit(OpCodes.Ldc_I4, (Int32) data);
|
||||
il.Emit(OpCodes.Box, data.GetType());
|
||||
}
|
||||
if (data.GetType() == typeof(float))
|
||||
if (data.GetType() == typeof (float))
|
||||
{
|
||||
il.Emit(OpCodes.Ldc_I4, (float)data);
|
||||
il.Emit(OpCodes.Ldc_I4, (float) data);
|
||||
il.Emit(OpCodes.Box, data.GetType());
|
||||
}
|
||||
if (data.GetType() == typeof(string))
|
||||
il.Emit(OpCodes.Ldstr, (string)data);
|
||||
if (data.GetType() == typeof (string))
|
||||
il.Emit(OpCodes.Ldstr, (string) data);
|
||||
//if (data.GetType() == typeof(LSO_Enums.Rotation))
|
||||
// il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data);
|
||||
//if (data.GetType() == typeof(LSO_Enums.Vector))
|
||||
// il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data);
|
||||
//if (data.GetType() == typeof(LSO_Enums.Key))
|
||||
// il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,6 @@
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
@@ -47,6 +45,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
String = 51,
|
||||
UInt32 = 17
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum OpCode_Cast_TypeDefs
|
||||
{
|
||||
@@ -66,6 +65,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
public UInt32 Y;
|
||||
public UInt32 X;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct Rotation
|
||||
{
|
||||
@@ -74,6 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
public UInt32 Y;
|
||||
public UInt32 X;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum Variable_Type_Codes
|
||||
{
|
||||
@@ -87,6 +88,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
List = 7,
|
||||
Null = 8
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum Event_Mask_Values
|
||||
{
|
||||
@@ -124,6 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
remote_data = 31,
|
||||
http_response = 32
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum Operation_Table
|
||||
{
|
||||
@@ -220,6 +223,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
SHL = 0xe0,
|
||||
SHR = 0xe1
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum BuiltIn_Functions
|
||||
{
|
||||
@@ -552,6 +556,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
llGetParcelMaxPrims = 326,
|
||||
llGetParcelDetails = 327
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,15 +27,16 @@
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
partial class LSO_Parser
|
||||
internal partial class LSO_Parser
|
||||
{
|
||||
private string FileName;
|
||||
private FileStream fs;
|
||||
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable();
|
||||
|
||||
private TypeBuilder typeBuilder;
|
||||
private System.Collections.Generic.List<string> EventList = new System.Collections.Generic.List<string>();
|
||||
private List<string> EventList = new List<string>();
|
||||
|
||||
public LSO_Parser(string _FileName, TypeBuilder _typeBuilder)
|
||||
{
|
||||
@@ -59,11 +60,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("Opening filename: " + FileName);
|
||||
fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
br = new BinaryReader(fs, Encoding.BigEndianUnicode);
|
||||
|
||||
}
|
||||
|
||||
internal void CloseFile()
|
||||
{
|
||||
|
||||
// Close
|
||||
br.Close();
|
||||
fs.Close();
|
||||
@@ -75,9 +75,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
/// </summary>
|
||||
public void Parse()
|
||||
{
|
||||
|
||||
|
||||
|
||||
// The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack.
|
||||
|
||||
|
||||
@@ -148,14 +145,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
|
||||
myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
|
||||
myStaticBlock.ObjectType = br_read(1)[0];
|
||||
Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString());
|
||||
Common.SendToDebug("Static Block ObjectType: " +
|
||||
((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
|
||||
myStaticBlock.Unknown = br_read(1)[0];
|
||||
// Size of datatype varies -- what about strings?
|
||||
if (myStaticBlock.ObjectType != 0)
|
||||
myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType));
|
||||
|
||||
StaticBlocks.Add((UInt32)startReadPos, myStaticBlock);
|
||||
|
||||
StaticBlocks.Add((UInt32) startReadPos, myStaticBlock);
|
||||
}
|
||||
Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount);
|
||||
|
||||
@@ -183,7 +180,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// TODO: ADD TO FUNCTION LIST (How do we identify it later?)
|
||||
// Note! Absolute position
|
||||
myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR;
|
||||
Common.SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]);
|
||||
Common.SendToDebug("Fuction " + i + " code chunk position: " +
|
||||
myFunctionBlock.CodeChunkPointer[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,14 +202,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position);
|
||||
// Position is relative to state frame
|
||||
myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
|
||||
myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8));
|
||||
myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8));
|
||||
Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location);
|
||||
Common.SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count);
|
||||
Common.SendToDebug("Total potential EventMask bits: " +
|
||||
myStateFrameBlock.StatePointer[i].EventMask.Count);
|
||||
|
||||
//// Read STATE BLOCK
|
||||
//long CurPos = fs.Position;
|
||||
//fs.Seek(CurPos, SeekOrigin.Begin);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,19 +222,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// Go through all State Frame Pointers found
|
||||
for (int i = 0; i < myStateFrameBlock.StateCount; i++)
|
||||
{
|
||||
|
||||
fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin);
|
||||
Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position);
|
||||
|
||||
// READ: STATE BLOCK HEADER
|
||||
myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock();
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0);
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0];
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note
|
||||
Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos);
|
||||
Common.SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize);
|
||||
Common.SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos);
|
||||
Common.SendToDebug("State block Header Size: " +
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize);
|
||||
Common.SendToDebug("State block Header End Pos: " +
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.EndPos);
|
||||
|
||||
// We need to count number of bits flagged in EventMask?
|
||||
|
||||
@@ -245,27 +244,36 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
// ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE
|
||||
//TODO: Create event hooks
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1];
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers =
|
||||
new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1];
|
||||
for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
|
||||
{
|
||||
|
||||
if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true)
|
||||
{
|
||||
// We got an event
|
||||
// READ: STATE BLOCK HANDLER
|
||||
Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position);
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0);
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0);
|
||||
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);
|
||||
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);
|
||||
Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii +
|
||||
" (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " +
|
||||
fs.Position);
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer =
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.EndPos +
|
||||
BitConverter.ToUInt32(br_read(4), 0);
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize =
|
||||
BitConverter.ToUInt32(br_read(4), 0);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//// READ FUNCTION CODE CHUNKS
|
||||
//// Functions + Function start pos (GFR)
|
||||
//// TODO: Somehow be able to identify and reference this
|
||||
@@ -291,37 +299,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// two level search ain't no good
|
||||
for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
|
||||
{
|
||||
|
||||
|
||||
if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0)
|
||||
{
|
||||
Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii);
|
||||
Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " +
|
||||
(LSO_Enums.Event_Mask_Values) ii);
|
||||
|
||||
|
||||
// Override a Method / Function
|
||||
string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values)ii;
|
||||
string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii;
|
||||
Common.SendToDebug("Event Name: " + eventname);
|
||||
if (Common.IL_ProcessCodeChunks)
|
||||
{
|
||||
EventList.Add(eventname);
|
||||
|
||||
// JUMP TO CODE PROCESSOR
|
||||
ProcessCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, typeBuilder, eventname);
|
||||
ProcessCodeChunk(
|
||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer,
|
||||
typeBuilder, eventname);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Common.IL_CreateFunctionList)
|
||||
IL_INSERT_FUNCTIONLIST();
|
||||
|
||||
}
|
||||
|
||||
internal LSO_Struct.HeapBlock GetHeap(UInt32 pos)
|
||||
@@ -342,11 +345,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
|
||||
Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize);
|
||||
Common.SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString());
|
||||
Common.SendToDebug("Heap Block ObjectType: " +
|
||||
((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString());
|
||||
Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount);
|
||||
|
||||
return myHeapBlock;
|
||||
}
|
||||
|
||||
private byte[] br_read(int len)
|
||||
{
|
||||
if (len <= 0)
|
||||
@@ -365,6 +370,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
throw (e);
|
||||
}
|
||||
}
|
||||
|
||||
//private byte[] br_read_smallendian(int len)
|
||||
//{
|
||||
// byte[] bytes = new byte[len];
|
||||
@@ -373,29 +379,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//}
|
||||
private Type getLLObjectType(byte objectCode)
|
||||
{
|
||||
switch ((LSO_Enums.Variable_Type_Codes)objectCode)
|
||||
switch ((LSO_Enums.Variable_Type_Codes) objectCode)
|
||||
{
|
||||
case LSO_Enums.Variable_Type_Codes.Void: return typeof(void);
|
||||
case LSO_Enums.Variable_Type_Codes.Integer: return typeof(UInt32);
|
||||
case LSO_Enums.Variable_Type_Codes.Float: return typeof(float);
|
||||
case LSO_Enums.Variable_Type_Codes.String: return typeof(string);
|
||||
case LSO_Enums.Variable_Type_Codes.Key: return typeof(string);
|
||||
case LSO_Enums.Variable_Type_Codes.Vector: return typeof(LSO_Enums.Vector);
|
||||
case LSO_Enums.Variable_Type_Codes.Rotation: return typeof(LSO_Enums.Rotation);
|
||||
case LSO_Enums.Variable_Type_Codes.Void:
|
||||
return typeof (void);
|
||||
case LSO_Enums.Variable_Type_Codes.Integer:
|
||||
return typeof (UInt32);
|
||||
case LSO_Enums.Variable_Type_Codes.Float:
|
||||
return typeof (float);
|
||||
case LSO_Enums.Variable_Type_Codes.String:
|
||||
return typeof (string);
|
||||
case LSO_Enums.Variable_Type_Codes.Key:
|
||||
return typeof (string);
|
||||
case LSO_Enums.Variable_Type_Codes.Vector:
|
||||
return typeof (LSO_Enums.Vector);
|
||||
case LSO_Enums.Variable_Type_Codes.Rotation:
|
||||
return typeof (LSO_Enums.Rotation);
|
||||
case LSO_Enums.Variable_Type_Codes.List:
|
||||
Common.SendToDebug("TODO: List datatype not implemented yet!");
|
||||
return typeof(System.Collections.ArrayList);
|
||||
return typeof (ArrayList);
|
||||
case LSO_Enums.Variable_Type_Codes.Null:
|
||||
Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!");
|
||||
return typeof(string);
|
||||
return typeof (string);
|
||||
default:
|
||||
Common.SendToDebug("Lookup of LSL datatype " + objectCode + " to .Net datatype failed: Unknown LSL datatype. Defaulting to object.");
|
||||
return typeof(object);
|
||||
Common.SendToDebug("Lookup of LSL datatype " + objectCode +
|
||||
" to .Net datatype failed: Unknown LSL datatype. Defaulting to object.");
|
||||
return typeof (object);
|
||||
}
|
||||
}
|
||||
|
||||
private int getObjectSize(byte ObjectType)
|
||||
{
|
||||
switch ((LSO_Enums.Variable_Type_Codes)ObjectType)
|
||||
switch ((LSO_Enums.Variable_Type_Codes) ObjectType)
|
||||
{
|
||||
case LSO_Enums.Variable_Type_Codes.Integer:
|
||||
case LSO_Enums.Variable_Type_Codes.Float:
|
||||
@@ -411,13 +426,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private string Read_String()
|
||||
{
|
||||
string ret = "";
|
||||
byte reader = br_read(1)[0];
|
||||
while (reader != 0x000)
|
||||
{
|
||||
ret += (char)reader;
|
||||
ret += (char) reader;
|
||||
reader = br_read(1)[0];
|
||||
}
|
||||
return ret;
|
||||
@@ -431,7 +447,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
/// <param name="eventname">Name of event (function) to generate</param>
|
||||
private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname)
|
||||
{
|
||||
|
||||
LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk();
|
||||
|
||||
Common.SendToDebug("Reading Function Code Chunk at: " + pos);
|
||||
@@ -442,12 +457,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
myCodeChunk.Comment = Read_String();
|
||||
Common.SendToDebug("Function comment: " + myCodeChunk.Comment);
|
||||
myCodeChunk.ReturnTypePos = br_read(1)[0];
|
||||
myCodeChunk.ReturnType = GetStaticBlock((long)myCodeChunk.ReturnTypePos + (long)myHeader.GVR);
|
||||
Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + ((LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType.ObjectType).ToString());
|
||||
myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR);
|
||||
Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " +
|
||||
((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString());
|
||||
|
||||
|
||||
// TODO: How to determine number of codechunks -- does this method work?
|
||||
myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>();
|
||||
myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>();
|
||||
byte reader = br_read(1)[0];
|
||||
reader = br_read(1)[0];
|
||||
|
||||
@@ -464,14 +480,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
CCA.NullString = reader;
|
||||
CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR);
|
||||
myCodeChunk.CodeChunkArguments.Add(CCA);
|
||||
Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + ": " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType.ObjectType);
|
||||
Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType +
|
||||
": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType);
|
||||
}
|
||||
// Create string array
|
||||
Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count];
|
||||
for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++)
|
||||
{
|
||||
MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType);
|
||||
Common.SendToDebug("Method argument " + _ic + ": " + getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).ToString());
|
||||
Common.SendToDebug("Method argument " + _ic + ": " +
|
||||
getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).
|
||||
ToString());
|
||||
}
|
||||
// End marker is 0x000
|
||||
myCodeChunk.EndMarker = reader;
|
||||
@@ -483,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod...");
|
||||
MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
|
||||
MethodAttributes.Public,
|
||||
typeof(void),
|
||||
new Type[] { typeof(object) });
|
||||
MethodAttributes.Public,
|
||||
typeof (void),
|
||||
new Type[] {typeof (object)});
|
||||
//MethodArgs);
|
||||
//typeof(void), //getLLObjectType(myCodeChunk.ReturnType),
|
||||
// new Type[] { typeof(object) }, //);
|
||||
@@ -504,7 +523,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
IL_INSERT_TRY(il, eventname);
|
||||
|
||||
|
||||
|
||||
// Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
|
||||
//Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
|
||||
//il.Emit(OpCodes.Call, typeof(Console).GetMethod
|
||||
@@ -520,7 +538,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL
|
||||
//
|
||||
@@ -538,12 +555,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
il.Emit(OpCodes.Ret);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
private void IL_INSERT_FUNCTIONLIST()
|
||||
{
|
||||
|
||||
Common.SendToDebug("Creating function list");
|
||||
|
||||
|
||||
@@ -557,11 +572,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
//FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private);
|
||||
|
||||
|
||||
|
||||
MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
|
||||
MethodAttributes.Public,
|
||||
typeof(string[]),
|
||||
null);
|
||||
MethodAttributes.Public,
|
||||
typeof (string[]),
|
||||
null);
|
||||
|
||||
//typeBuilder.DefineMethodOverride(methodBuilder,
|
||||
// typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname));
|
||||
@@ -569,8 +583,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
ILGenerator il = methodBuilder.GetILGenerator();
|
||||
|
||||
|
||||
|
||||
|
||||
// IL_INSERT_TRY(il, eventname);
|
||||
|
||||
// // Push string to stack
|
||||
@@ -586,37 +598,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
////il.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
il.DeclareLocal(typeof(string[]));
|
||||
il.DeclareLocal(typeof (string[]));
|
||||
|
||||
////il.Emit(OpCodes.Ldarg_0);
|
||||
il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length
|
||||
il.Emit(OpCodes.Newarr, typeof(String)); // create new string array
|
||||
il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack
|
||||
il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length
|
||||
il.Emit(OpCodes.Newarr, typeof (String)); // create new string array
|
||||
il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack
|
||||
////SetFunctionList
|
||||
|
||||
for (int lv = 0; lv < EventList.Count; lv++)
|
||||
{
|
||||
il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
|
||||
il.Emit(OpCodes.Ldc_I4, lv); // Push index position
|
||||
il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
|
||||
il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value
|
||||
il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
|
||||
il.Emit(OpCodes.Ldc_I4, lv); // Push index position
|
||||
il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
|
||||
il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value
|
||||
|
||||
//il.Emit(OpCodes.Ldarg_0);
|
||||
//il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
|
||||
//il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) }));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// IL_INSERT_END_TRY(il, eventname);
|
||||
|
||||
|
||||
il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
|
||||
il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
|
||||
// il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) }));
|
||||
|
||||
il.Emit(OpCodes.Ret); // Return
|
||||
|
||||
il.Emit(OpCodes.Ret); // Return
|
||||
}
|
||||
|
||||
|
||||
@@ -631,7 +640,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// Push "Hello World!" string to stack
|
||||
//Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
|
||||
//il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname);
|
||||
|
||||
}
|
||||
|
||||
private void IL_INSERT_END_TRY(ILGenerator il, string eventname)
|
||||
@@ -640,7 +648,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
* CATCH
|
||||
*/
|
||||
Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));");
|
||||
il.BeginCatchBlock(typeof(Exception));
|
||||
il.BeginCatchBlock(typeof (Exception));
|
||||
|
||||
// Push "Hello World!" string to stack
|
||||
Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
|
||||
@@ -648,18 +656,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
|
||||
//call void [mscorlib]System.Console::WriteLine(string)
|
||||
Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
|
||||
il.Emit(OpCodes.Call, typeof(Console).GetMethod
|
||||
("Write", new Type[] { typeof(string) }));
|
||||
il.Emit(OpCodes.Call, typeof (Console).GetMethod
|
||||
("Write", new Type[] {typeof (string)}));
|
||||
|
||||
//callvirt instance string [mscorlib]System.Exception::get_Message()
|
||||
Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt...");
|
||||
il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod
|
||||
("get_Message"));
|
||||
il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod
|
||||
("get_Message"));
|
||||
|
||||
//call void [mscorlib]System.Console::WriteLine(string)
|
||||
Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
|
||||
il.Emit(OpCodes.Call, typeof(Console).GetMethod
|
||||
("WriteLine", new Type[] { typeof(string) }));
|
||||
il.Emit(OpCodes.Call, typeof (Console).GetMethod
|
||||
("WriteLine", new Type[] {typeof (string)}));
|
||||
|
||||
/*
|
||||
* CLR END TRY
|
||||
@@ -673,7 +681,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
long FirstPos = fs.Position;
|
||||
try
|
||||
{
|
||||
UInt32 position = (UInt32)pos;
|
||||
UInt32 position = (UInt32) pos;
|
||||
// STATIC BLOCK
|
||||
Common.SendToDebug("Reading STATIC BLOCK at: " + position);
|
||||
fs.Seek(position, SeekOrigin.Begin);
|
||||
@@ -683,7 +691,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
Common.SendToDebug("Found cached STATIC BLOCK");
|
||||
|
||||
|
||||
|
||||
return StaticBlocks[pos];
|
||||
}
|
||||
|
||||
@@ -699,7 +706,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
|
||||
myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
|
||||
myStaticBlock.ObjectType = br_read(1)[0];
|
||||
Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString());
|
||||
Common.SendToDebug("Static Block ObjectType: " +
|
||||
((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
|
||||
myStaticBlock.Unknown = br_read(1)[0];
|
||||
// Size of datatype varies
|
||||
if (myStaticBlock.ObjectType != 0)
|
||||
@@ -715,8 +723,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
// Go back to original read pos
|
||||
fs.Seek(FirstPos, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,13 @@
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
{
|
||||
static class LSO_Struct
|
||||
internal static class LSO_Struct
|
||||
{
|
||||
|
||||
public struct Header
|
||||
{
|
||||
public UInt32 TM;
|
||||
@@ -69,6 +68,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
public byte Unknown;
|
||||
public byte[] BlockVariable;
|
||||
}
|
||||
|
||||
/* Not actually a structure
|
||||
public struct StaticBlockVariable
|
||||
{
|
||||
@@ -80,6 +80,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
public byte[] Rotation_16;
|
||||
public UInt32 Pointer_List_Structure;
|
||||
} */
|
||||
|
||||
public struct HeapBlock
|
||||
{
|
||||
public Int32 DataBlockSize;
|
||||
@@ -87,17 +88,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
public UInt16 ReferenceCount;
|
||||
public byte[] Data;
|
||||
}
|
||||
|
||||
public struct StateFrameBlock
|
||||
{
|
||||
public UInt32 StateCount;
|
||||
public StatePointerBlock[] StatePointer;
|
||||
}
|
||||
|
||||
public struct StatePointerBlock
|
||||
{
|
||||
public UInt32 Location;
|
||||
public System.Collections.BitArray EventMask;
|
||||
public BitArray EventMask;
|
||||
public StateBlock StateBlock;
|
||||
}
|
||||
|
||||
public struct StateBlock
|
||||
{
|
||||
public UInt32 StartPos;
|
||||
@@ -106,25 +110,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
public byte Unknown;
|
||||
public StateBlockHandler[] StateBlockHandlers;
|
||||
}
|
||||
|
||||
public struct StateBlockHandler
|
||||
{
|
||||
public UInt32 CodeChunkPointer;
|
||||
public UInt32 CallFrameSize;
|
||||
}
|
||||
|
||||
public struct FunctionBlock
|
||||
{
|
||||
public UInt32 FunctionCount;
|
||||
public UInt32[] CodeChunkPointer;
|
||||
}
|
||||
|
||||
public struct CodeChunk
|
||||
{
|
||||
public UInt32 CodeChunkHeaderSize;
|
||||
public string Comment;
|
||||
public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments;
|
||||
public List<CodeChunkArgument> CodeChunkArguments;
|
||||
public byte EndMarker;
|
||||
public byte ReturnTypePos;
|
||||
public StaticBlock ReturnType;
|
||||
}
|
||||
|
||||
public struct CodeChunkArgument
|
||||
{
|
||||
public byte FunctionReturnTypePos;
|
||||
@@ -132,4 +140,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
|
||||
public StaticBlock FunctionReturnType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user