From 67e12b95ea7b68f4904a7484d77ecfd787d16d0c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 30 Oct 2007 09:05:31 +0000 Subject: * Optimized usings * Shortened type references * Removed redundant 'this' qualifier --- OpenSim/Region/ScriptEngine/Common/Executor.cs | 88 +- OpenSim/Region/ScriptEngine/Common/IScript.cs | 6 +- .../Common/LSL_BuiltIn_Commands_Interface.cs | 15 +- OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 26 +- .../ScriptEngine/Common/Properties/AssemblyInfo.cs | 31 +- .../ScriptEngine/DotNetEngine/AppDomainManager.cs | 48 +- OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs | 16 +- .../DotNetEngine/Compiler/LSL/Compiler.cs | 38 +- .../DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 82 +- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 2173 ++++++++++++++++---- .../DotNetEngine/Compiler/LSO/Common.cs | 27 +- .../DotNetEngine/Compiler/LSO/Engine.cs | 149 +- .../Compiler/LSO/IL_common_functions.cs | 25 +- .../DotNetEngine/Compiler/LSO/LSL_BaseClass.cs | 20 +- .../Compiler/LSO/LSL_BaseClass_OPCODES.cs | 186 +- .../DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs | 6 +- .../Compiler/LSO/LSL_OPCODE_IL_processor.cs | 135 +- .../DotNetEngine/Compiler/LSO/LSO_Enums.cs | 11 +- .../DotNetEngine/Compiler/LSO/LSO_Parser.cs | 208 +- .../DotNetEngine/Compiler/LSO/LSO_Struct.cs | 20 +- .../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 2020 +++++++++++++----- .../ScriptEngine/DotNetEngine/EventManager.cs | 173 +- .../ScriptEngine/DotNetEngine/EventQueueManager.cs | 64 +- .../ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs | 74 +- .../DotNetEngine/Properties/AssemblyInfo.cs | 31 +- .../ScriptEngine/DotNetEngine/ScriptEngine.cs | 33 +- .../ScriptEngine/DotNetEngine/ScriptManager.cs | 101 +- .../TempDotNetMicroThreadingCodeInjector.cs | 20 +- 28 files changed, 4162 insertions(+), 1664 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs index a2148ea..c656e01 100644 --- a/OpenSim/Region/ScriptEngine/Common/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; -using System.Text; using System.Reflection; using System.Runtime.Remoting.Lifetime; @@ -53,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Common { //Console.WriteLine("Executor: InitializeLifetimeService()"); // return null; - ILease lease = (ILease)base.InitializeLifetimeService(); + ILease lease = (ILease) base.InitializeLifetimeService(); if (lease.CurrentState == LeaseState.Initial) { @@ -75,56 +74,56 @@ namespace OpenSim.Region.ScriptEngine.Common // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! //try //{ - if (m_Running == false) - { - // Script is inactive, do not execute! - return; - } + if (m_Running == false) + { + // Script is inactive, do not execute! + return; + } - string EventName = m_Script.State() + "_event_" + FunctionName; + string EventName = m_Script.State() + "_event_" + FunctionName; - //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); + //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); - //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); + //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); - if (Events.ContainsKey(EventName) == false) + if (Events.ContainsKey(EventName) == false) + { + // Not found, create + Type type = m_Script.GetType(); + try { - // Not found, create - Type type = m_Script.GetType(); - try - { - MethodInfo mi = type.GetMethod(EventName); - Events.Add(EventName, mi); - } - catch - { - // Event name not found, cache it as not found - Events.Add(EventName, null); - } + MethodInfo mi = type.GetMethod(EventName); + Events.Add(EventName, mi); } - - // Get event - MethodInfo ev = null; - Events.TryGetValue(EventName, out ev); - - if (ev == null) // No event by that name! + catch { - //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); - return; + // Event name not found, cache it as not found + Events.Add(EventName, null); } + } + + // Get event + MethodInfo ev = null; + Events.TryGetValue(EventName, out ev); + + if (ev == null) // No event by that name! + { + //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); + return; + } - // Found - //try - //{ - // Invoke it - ev.Invoke(m_Script, args); + // Found + //try + //{ + // Invoke it + ev.Invoke(m_Script, args); - //} - //catch (Exception e) - //{ - // // TODO: Send to correct place - // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); - //} + //} + //catch (Exception e) + //{ + // // TODO: Send to correct place + // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); + //} //} @@ -136,8 +135,5 @@ namespace OpenSim.Region.ScriptEngine.Common { m_Running = false; } - - } - -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs index df0e824..08c0e9c 100644 --- a/OpenSim/Region/ScriptEngine/Common/IScript.cs +++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs @@ -26,10 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.ScriptEngine.Common { public interface IScript @@ -37,4 +33,4 @@ namespace OpenSim.Region.ScriptEngine.Common string State(); Executor Exec { get; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index ff5c6bf..9cba882 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -26,15 +26,12 @@ * */ /* Original code: Tedd Hansen */ -using System; using System.Collections.Generic; -using System.Text; namespace OpenSim.Region.ScriptEngine.Common { public interface LSL_BuiltIn_Commands_Interface { - string State(); double llSin(double f); @@ -404,7 +401,9 @@ namespace OpenSim.Region.ScriptEngine.Common //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate) void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate); //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) - void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west); + void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, + LSL_Types.Vector3 bottom_south_west); + //wiki: llEjectFromLand(key pest) void llEjectFromLand(string pest); void llParseString2List(); @@ -437,7 +436,7 @@ namespace OpenSim.Region.ScriptEngine.Common //wiki: double llGetRegionFPS() double llGetRegionFPS(); //wiki: llParticleSystem(List rules - void llParticleSystem(List rules); + void llParticleSystem(List rules); //wiki: llGroundRepel(double height, integer water, double tau) void llGroundRepel(double height, int water, double tau); void llGiveInventoryList(); @@ -548,7 +547,9 @@ namespace OpenSim.Region.ScriptEngine.Common //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) List llParseStringKeepNulls(string src, List seperators, List spacers); //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) - void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param); + void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, + LSL_Types.Quaternion rot, int param); + //wiki: integer llGetObjectPermMask(integer mask) int llGetObjectPermMask(int mask); //wiki: llSetObjectPermMask(integer mask, integer value) @@ -632,4 +633,4 @@ namespace OpenSim.Region.ScriptEngine.Common //OpenSim functions string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index 7d69379..df3d752 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -41,11 +41,12 @@ namespace OpenSim.Region.ScriptEngine.Common public double Z; public Vector3(Vector3 vector) - { - X = (float)vector.X; - Y = (float)vector.Y; - Z = (float)vector.Z; - } + { + X = (float) vector.X; + Y = (float) vector.Y; + Z = (float) vector.Z; + } + public Vector3(double x, double y, double z) { X = x; @@ -53,6 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Common Z = z; } } + [Serializable] public struct Quaternion { @@ -62,12 +64,13 @@ namespace OpenSim.Region.ScriptEngine.Common public double R; public Quaternion(Quaternion Quat) - { - X = (float)Quat.X; - Y = (float)Quat.Y; - Z = (float)Quat.Z; - R = (float)Quat.R; + { + X = (float) Quat.X; + Y = (float) Quat.Y; + Z = (float) Quat.Z; + R = (float) Quat.R; } + public Quaternion(double x, double y, double z, double r) { X = x; @@ -75,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.Common Z = z; R = r; } - } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs index 98704d5..48cf45a 100644 --- a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs @@ -1,26 +1,28 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.Common")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.Common")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.Common")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.Common")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] + +[assembly : Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] // Version information for an assembly consists of the following four values: // @@ -29,5 +31,6 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly : AssemblyVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs index 391e3aa..bc241ce 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs @@ -27,27 +27,22 @@ */ using System; +using System.Collections; using System.Collections.Generic; -using System.Text; using System.Reflection; -using System.Threading; -using System.Runtime.Remoting; -using System.IO; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; -using OpenSim.Region.ScriptEngine.Common; -using libsecondlife; namespace OpenSim.Region.ScriptEngine.DotNetEngine { public class AppDomainManager { private int maxScriptsPerAppDomain = 1; + /// /// Internal list of all AppDomains /// private List appDomains = new List(); + /// /// Structure to keep track of data around AppDomain /// @@ -57,19 +52,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// The AppDomain itself /// public AppDomain CurrentAppDomain; + /// /// Number of scripts loaded into AppDomain /// public int ScriptsLoaded; + /// /// Number of dead scripts /// public int ScriptsWaitingUnload; } + /// /// Current AppDomain /// private AppDomainStructure currentAD; + private object getLock = new object(); // Mutex private object freeLock = new object(); // Mutex @@ -94,22 +93,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { // Add it to AppDomains list and empty current appDomains.Add(currentAD); - currentAD = null; + currentAD = null; } // No current if (currentAD == null) { // Create a new current AppDomain currentAD = new AppDomainStructure(); - currentAD.CurrentAppDomain = PrepareNewAppDomain(); + currentAD.CurrentAppDomain = PrepareNewAppDomain(); } - Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); + Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); return currentAD; } // lock } private int AppDomainNameCount; + /// /// Create and prepare a new AppDomain for scripts /// @@ -130,12 +130,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); - Console.WriteLine("Loading: " + AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); + Console.WriteLine("Loading: " + + AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); // Return the new AppDomain return AD; - } /// @@ -146,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine lock (freeLock) { // Go through all - foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) + foreach (AppDomainStructure ads in new ArrayList(appDomains)) { // Don't process current AppDomain if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) @@ -164,23 +164,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Unload AppDomain.Unload(ads.CurrentAppDomain); #if DEBUG - Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); + Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + + " bytes of memory"); #endif } } } // foreach } // lock } - - public OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadScript(string FileName) + public LSL_BaseClass LoadScript(string FileName) { // Find next available AppDomain to put it in AppDomainStructure FreeAppDomain = GetFreeAppDomain(); - + Console.WriteLine("Loading into AppDomain: " + FileName); - LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); + LSL_BaseClass mbrt = + (LSL_BaseClass) + FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); FreeAppDomain.ScriptsLoaded++; @@ -207,7 +209,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } // Lopp through all AppDomains - foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) + foreach (AppDomainStructure ads in new ArrayList(appDomains)) { if (ads.CurrentAppDomain == ad) { @@ -219,10 +221,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } // lock UnloadAppDomains(); // Outsite lock, has its own GetLock - - } - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs index 49ce8b8..e04a9ed 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs @@ -26,34 +26,30 @@ * */ /* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.ScriptEngine.DotNetEngine { public static class Common { - static public bool debug = true; - static public ScriptEngine mySE; + public static bool debug = true; + public static ScriptEngine mySE; //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 static void SendToDebug(string Message) { //if (Debug == true) mySE.Log.Verbose("ScriptEngine", "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) mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); } } - -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index a2eee66..7f452e0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs @@ -27,16 +27,13 @@ */ using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using Microsoft.CSharp; using System.CodeDom.Compiler; +using System.IO; using System.Reflection; +using Microsoft.CSharp; namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { - public class Compiler { private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); @@ -45,7 +42,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL //private ICodeCompiler icc = codeProvider.CreateCompiler(); public string CompileFromFile(string LSOFileName) { - switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) + switch (Path.GetExtension(LSOFileName).ToLower()) { case ".txt": case ".lsl": @@ -58,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL throw new Exception("Unknown script type."); } } + /// /// Converts script from LSL to CS and calls CompileFromCSText /// @@ -67,13 +65,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { if (Script.Substring(0, 4).ToLower() == "//c#") { - return CompileFromCSText( Script ); + return CompileFromCSText(Script); } else { return CompileFromCSText(LSL_Converter.Convert(Script)); } } + /// /// Compile CS script to .Net assembly (.dll) /// @@ -81,14 +80,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL /// Filename to .dll assembly public string CompileFromCSText(string Script) { - - // Output assembly name scriptCompileCounter++; string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); try { - System.IO.File.Delete(OutFile); + File.Delete(OutFile); } catch (Exception e) { @@ -99,12 +96,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // DEBUG - write source to disk try { - File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); + File.WriteAllText( + Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); + } + catch + { } - catch { } // Do actual compile - System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); + CompilerParameters parameters = new CompilerParameters(); parameters.IncludeDebugInformation = true; // Add all available assemblies foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) @@ -114,11 +114,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL } string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); - string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); + string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); //Console.WriteLine("Assembly location: " + rootPath); parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); - + //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); parameters.GenerateExecutable = false; parameters.OutputAssembly = OutFile; @@ -129,13 +129,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // TODO: Return errors to user somehow if (results.Errors.Count > 0) { - string errtext = ""; foreach (CompilerError CompErr in results.Errors) { errtext += "Line number " + (CompErr.Line - 1) + - ", Error Number: " + CompErr.ErrorNumber + - ", '" + CompErr.ErrorText + "'\r\n"; + ", Error Number: " + CompErr.ErrorNumber + + ", '" + CompErr.ErrorText + "'\r\n"; } throw new Exception(errtext); } @@ -143,6 +142,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL return OutFile; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 18eeaa3..0c28617 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs @@ -26,9 +26,7 @@ * */ -using System; using System.Collections.Generic; -using System.Text; using System.Text.RegularExpressions; namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL @@ -51,9 +49,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL dataTypes.Add("rotation", "LSL_Types.Quaternion"); dataTypes.Add("list", "list"); dataTypes.Add("null", "null"); - } - + public string Convert(string Script) { string Return = ""; @@ -81,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL int quote_replaced_count = 0; for (int p = 0; p < Script.Length; p++) { - C = Script.Substring(p, 1); while (true) { @@ -99,10 +95,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL if (quote == "") { // We didn't replace quote, probably because of empty string? - _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); + _Script += quote_replacement_string + + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); } // We just left a quote - quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); + quotes.Add( + quote_replacement_string + + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); quote = ""; } break; @@ -112,7 +111,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { // We are not inside a quote quote_replaced = false; - } else { @@ -120,7 +118,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL if (!quote_replaced) { // Replace quote - _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); + _Script += quote_replacement_string + + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); quote_replaced = true; } quote += C; @@ -141,7 +140,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // - // // PROCESS STATES // Remove state definitions and add state names to start of each event within state @@ -170,7 +168,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL if (ilevel == 1 && lastlevel == 0) { // 0 => 1: Get last - Match m = Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + Match m = + Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); in_state = false; if (m.Success) @@ -179,7 +179,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL in_state = true; current_statename = m.Groups[1].Captures[0].Value; //Console.WriteLine("Current statename: " + current_statename); - cache = Regex.Replace(cache, @"(?(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?[^a-zA-Z_\(\)]*){", "${s1}${s2}", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + cache = + Regex.Replace(cache, + @"(?(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?[^a-zA-Z_\(\)]*){", + "${s1}${s2}", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); } ret += cache; cache = ""; @@ -196,7 +200,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // void dataserver(key query_id, string data) { //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); //Console.WriteLine("Replacing using statename: " + current_statename); - cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1public " + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + cache = + Regex.Replace(cache, + @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", + @"$1public " + current_statename + "_event_$2", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); } ret += cache; @@ -216,32 +224,48 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL ret = ""; - foreach (string key in dataTypes.Keys) { string val; dataTypes.TryGetValue(key, out val); // Replace CAST - (integer) with (int) - Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline); + Script = + Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", + RegexOptions.Compiled | RegexOptions.Multiline); // Replace return types and function variables - integer a() and f(integer a, integer a) - Script = Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", RegexOptions.Compiled | RegexOptions.Multiline); + Script = + Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", + RegexOptions.Compiled | RegexOptions.Multiline); } // Add "void" in front of functions that needs it - Script = Regex.Replace(Script, @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + Script = + Regex.Replace(Script, + @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", + @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); // Replace and - Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); - Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + Script = + Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + Script = + Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); // Replace List []'s - Script = Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + Script = + Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); // Replace (string) to .ToString() // - Script = Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); - Script = Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + Script = + Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); + Script = + Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", + RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); // REPLACE BACK QUOTES @@ -256,7 +280,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // Add namespace, class name and inheritance Return = "" + - "using OpenSim.Region.ScriptEngine.Common;"; + "using OpenSim.Region.ScriptEngine.Common;"; //"using System; " + //"using System.Collections.Generic; " + //"using System.Text; " + @@ -278,17 +302,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL Return += "" + - "namespace SecondLife { "; - Return += "" + - //"[Serializable] " + - "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; + "namespace SecondLife { "; + Return += "" + + //"[Serializable] " + + "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; Return += @"public Script() { } "; Return += Script; Return += "} }\r\n"; return Return; } - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index ea05efc..f2774d6 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -28,476 +28,1788 @@ using System; using System.Collections.Generic; -using System.Text; -using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; -using OpenSim.Region.ScriptEngine.Common; -using System.Threading; -using System.Reflection; using System.Runtime.Remoting.Lifetime; +using System.Threading; +using OpenSim.Region.ScriptEngine.Common; using integer = System.Int32; using key = System.String; using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; using rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion; -namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL -{ - //[Serializable] - public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript - { +namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL +{ + //[Serializable] + public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript + { + // Object never expires + public override Object InitializeLifetimeService() + { + //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); + // return null; + ILease lease = (ILease) base.InitializeLifetimeService(); + + if (lease.CurrentState == LeaseState.Initial) + { + lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); + //lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); + //lease.RenewOnCallTime = TimeSpan.FromSeconds(2); + } + return lease; + } + + + private Executor m_Exec; + + public Executor Exec + { + get + { + if (m_Exec == null) + m_Exec = new Executor(this); + return m_Exec; + } + } + + public LSL_BuiltIn_Commands_Interface m_LSL_Functions; + public string SourceCode = ""; + + public LSL_BaseClass() + { + } + + public string State() + { + return m_LSL_Functions.State(); + } + + + public void Start(LSL_BuiltIn_Commands_Interface LSL_Functions) + { + m_LSL_Functions = LSL_Functions; + + //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called."); + + // Get this AppDomain's settings and display some of them. + AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; + Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", + ads.ApplicationName, + ads.ApplicationBase, + ads.ConfigurationFile + ); + + // Display the name of the calling AppDomain and the name + // of the second domain. + // NOTE: The application's thread has transitioned between + // AppDomains. + Console.WriteLine("Calling to '{0}'.", + Thread.GetDomain().FriendlyName + ); + + return; + } + + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + // They are only forwarders to LSL_BuiltIn_Commands.cs + // + public double llSin(double f) + { + return m_LSL_Functions.llSin(f); + } + + public double llCos(double f) + { + return m_LSL_Functions.llCos(f); + } + + public double llTan(double f) + { + return m_LSL_Functions.llTan(f); + } + + public double llAtan2(double x, double y) + { + return m_LSL_Functions.llAtan2(x, y); + } + + public double llSqrt(double f) + { + return m_LSL_Functions.llSqrt(f); + } + + public double llPow(double fbase, double fexponent) + { + return m_LSL_Functions.llPow(fbase, fexponent); + } + + public int llAbs(int i) + { + return m_LSL_Functions.llAbs(i); + } + + public double llFabs(double f) + { + return m_LSL_Functions.llFabs(f); + } + + public double llFrand(double mag) + { + return m_LSL_Functions.llFrand(mag); + } + + public int llFloor(double f) + { + return m_LSL_Functions.llFloor(f); + } + + public int llCeil(double f) + { + return m_LSL_Functions.llCeil(f); + } + + public int llRound(double f) + { + return m_LSL_Functions.llRound(f); + } + + public double llVecMag(vector v) + { + return m_LSL_Functions.llVecMag(v); + } + + public vector llVecNorm(vector v) + { + return m_LSL_Functions.llVecNorm(v); + } + + public double llVecDist(vector a, vector b) + { + return m_LSL_Functions.llVecDist(a, b); + } + + public vector llRot2Euler(rotation r) + { + return m_LSL_Functions.llRot2Euler(r); + } + + public rotation llEuler2Rot(vector v) + { + return m_LSL_Functions.llEuler2Rot(v); + } + + public rotation llAxes2Rot(vector fwd, vector left, vector up) + { + return m_LSL_Functions.llAxes2Rot(fwd, left, up); + } + + public vector llRot2Fwd(rotation r) + { + return m_LSL_Functions.llRot2Fwd(r); + } + + public vector llRot2Left(rotation r) + { + return m_LSL_Functions.llRot2Left(r); + } + + public vector llRot2Up(rotation r) + { + return m_LSL_Functions.llRot2Up(r); + } + + public rotation llRotBetween(vector start, vector end) + { + return m_LSL_Functions.llRotBetween(start, end); + } + + public void llWhisper(int channelID, string text) + { + m_LSL_Functions.llWhisper(channelID, text); + } + + public void llSay(int channelID, string text) + { + m_LSL_Functions.llSay(channelID, text); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llShout(int channelID, string text) + { + m_LSL_Functions.llShout(channelID, text); + } + + public int llListen(int channelID, string name, string ID, string msg) + { + return m_LSL_Functions.llListen(channelID, name, ID, msg); + } + + public void llListenControl(int number, int active) + { + m_LSL_Functions.llListenControl(number, active); + } + + public void llListenRemove(int number) + { + m_LSL_Functions.llListenRemove(number); + } + + public void llSensor(string name, string id, int type, double range, double arc) + { + m_LSL_Functions.llSensor(name, id, type, range, arc); + } + + public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) + { + m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); + } + + public void llSensorRemove() + { + m_LSL_Functions.llSensorRemove(); + } + + public string llDetectedName(int number) + { + return m_LSL_Functions.llDetectedName(number); + } + + public string llDetectedKey(int number) + { + return m_LSL_Functions.llDetectedKey(number); + } + + public string llDetectedOwner(int number) + { + return m_LSL_Functions.llDetectedOwner(number); + } + + public int llDetectedType(int number) + { + return m_LSL_Functions.llDetectedType(number); + } + + public vector llDetectedPos(int number) + { + return m_LSL_Functions.llDetectedPos(number); + } + + public vector llDetectedVel(int number) + { + return m_LSL_Functions.llDetectedVel(number); + } + + public vector llDetectedGrab(int number) + { + return m_LSL_Functions.llDetectedGrab(number); + } + + public rotation llDetectedRot(int number) + { + return m_LSL_Functions.llDetectedRot(number); + } + + public int llDetectedGroup(int number) + { + return m_LSL_Functions.llDetectedGroup(number); + } + + public int llDetectedLinkNumber(int number) + { + return m_LSL_Functions.llDetectedLinkNumber(number); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llDie() + { + m_LSL_Functions.llDie(); + } + + public double llGround(vector offset) + { + return m_LSL_Functions.llGround(offset); + } + + public double llCloud(vector offset) + { + return m_LSL_Functions.llCloud(offset); + } + + public vector llWind(vector offset) + { + return m_LSL_Functions.llWind(offset); + } + + public void llSetStatus(int status, int value) + { + m_LSL_Functions.llSetStatus(status, value); + } + + public int llGetStatus(int status) + { + return m_LSL_Functions.llGetStatus(status); + } + + public void llSetScale(vector scale) + { + m_LSL_Functions.llSetScale(scale); + } + + public vector llGetScale() + { + return m_LSL_Functions.llGetScale(); + } + + public void llSetColor(vector color, int face) + { + m_LSL_Functions.llSetColor(color, face); + } + + public double llGetAlpha(int face) + { + return m_LSL_Functions.llGetAlpha(face); + } + + public void llSetAlpha(double alpha, int face) + { + m_LSL_Functions.llSetAlpha(alpha, face); + } + + public vector llGetColor(int face) + { + return m_LSL_Functions.llGetColor(face); + } + + public void llSetTexture(string texture, int face) + { + m_LSL_Functions.llSetTexture(texture, face); + } + + public void llScaleTexture(double u, double v, int face) + { + m_LSL_Functions.llScaleTexture(u, v, face); + } + + public void llOffsetTexture(double u, double v, int face) + { + m_LSL_Functions.llOffsetTexture(u, v, face); + } + + public void llRotateTexture(double rotation, int face) + { + m_LSL_Functions.llRotateTexture(rotation, face); + } + + public string llGetTexture(int face) + { + return m_LSL_Functions.llGetTexture(face); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llSetPos(vector pos) + { + m_LSL_Functions.llSetPos(pos); + } + + public vector llGetPos() + { + return m_LSL_Functions.llGetPos(); + } + + public vector llGetLocalPos() + { + return m_LSL_Functions.llGetLocalPos(); + } + + public void llSetRot(rotation rot) + { + m_LSL_Functions.llSetRot(rot); + } + + public rotation llGetRot() + { + return m_LSL_Functions.llGetRot(); + } + + public rotation llGetLocalRot() + { + return m_LSL_Functions.llGetLocalRot(); + } + + public void llSetForce(vector force, int local) + { + m_LSL_Functions.llSetForce(force, local); + } + + public vector llGetForce() + { + return m_LSL_Functions.llGetForce(); + } + + public int llTarget(vector position, double range) + { + return m_LSL_Functions.llTarget(position, range); + } + + public void llTargetRemove(int number) + { + m_LSL_Functions.llTargetRemove(number); + } + + public int llRotTarget(rotation rot, double error) + { + return m_LSL_Functions.llRotTarget(rot, error); + } + + public void llRotTargetRemove(int number) + { + m_LSL_Functions.llRotTargetRemove(number); + } + + public void llMoveToTarget(vector target, double tau) + { + m_LSL_Functions.llMoveToTarget(target, tau); + } + + public void llStopMoveToTarget() + { + m_LSL_Functions.llStopMoveToTarget(); + } + + public void llApplyImpulse(vector force, int local) + { + m_LSL_Functions.llApplyImpulse(force, local); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llApplyRotationalImpulse(vector force, int local) + { + m_LSL_Functions.llApplyRotationalImpulse(force, local); + } + + public void llSetTorque(vector torque, int local) + { + m_LSL_Functions.llSetTorque(torque, local); + } + + public vector llGetTorque() + { + return m_LSL_Functions.llGetTorque(); + } + + public void llSetForceAndTorque(vector force, vector torque, int local) + { + m_LSL_Functions.llSetForceAndTorque(force, torque, local); + } + + public vector llGetVel() + { + return m_LSL_Functions.llGetVel(); + } + + public vector llGetAccel() + { + return m_LSL_Functions.llGetAccel(); + } + + public vector llGetOmega() + { + return m_LSL_Functions.llGetOmega(); + } + + public double llGetTimeOfDay() + { + return m_LSL_Functions.llGetTimeOfDay(); + } + + public double llGetWallclock() + { + return m_LSL_Functions.llGetWallclock(); + } + + public double llGetTime() + { + return m_LSL_Functions.llGetTime(); + } + + public void llResetTime() + { + m_LSL_Functions.llResetTime(); + } + + public double llGetAndResetTime() + { + return m_LSL_Functions.llGetAndResetTime(); + } + + public void llSound() + { + m_LSL_Functions.llSound(); + } + + public void llPlaySound(string sound, double volume) + { + m_LSL_Functions.llPlaySound(sound, volume); + } + + public void llLoopSound(string sound, double volume) + { + m_LSL_Functions.llLoopSound(sound, volume); + } + + public void llLoopSoundMaster(string sound, double volume) + { + m_LSL_Functions.llLoopSoundMaster(sound, volume); + } + + public void llLoopSoundSlave(string sound, double volume) + { + m_LSL_Functions.llLoopSoundSlave(sound, volume); + } + + public void llPlaySoundSlave(string sound, double volume) + { + m_LSL_Functions.llPlaySoundSlave(sound, volume); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llTriggerSound(string sound, double volume) + { + m_LSL_Functions.llTriggerSound(sound, volume); + } + + public void llStopSound() + { + m_LSL_Functions.llStopSound(); + } + + public void llPreloadSound(string sound) + { + m_LSL_Functions.llPreloadSound(sound); + } + + public string llGetSubString(string src, int start, int end) + { + return m_LSL_Functions.llGetSubString(src, start, end); + } + + public string llDeleteSubString(string src, int start, int end) + { + return m_LSL_Functions.llDeleteSubString(src, start, end); + } + + public string llInsertString(string dst, int position, string src) + { + return m_LSL_Functions.llInsertString(dst, position, src); + } + + public string llToUpper(string source) + { + return m_LSL_Functions.llToUpper(source); + } + + public string llToLower(string source) + { + return m_LSL_Functions.llToLower(source); + } + + public int llGiveMoney(string destination, int amount) + { + return m_LSL_Functions.llGiveMoney(destination, amount); + } + + public void llMakeExplosion() + { + m_LSL_Functions.llMakeExplosion(); + } + + public void llMakeFountain() + { + m_LSL_Functions.llMakeFountain(); + } + + public void llMakeSmoke() + { + m_LSL_Functions.llMakeSmoke(); + } + + public void llMakeFire() + { + m_LSL_Functions.llMakeFire(); + } + + public void llRezObject(string inventory, vector pos, rotation rot, int param) + { + m_LSL_Functions.llRezObject(inventory, pos, rot, param); + } + + public void llLookAt(vector target, double strength, double damping) + { + m_LSL_Functions.llLookAt(target, strength, damping); + } + + public void llStopLookAt() + { + m_LSL_Functions.llStopLookAt(); + } + + public void llSetTimerEvent(double sec) + { + m_LSL_Functions.llSetTimerEvent(sec); + } + + public void llSleep(double sec) + { + m_LSL_Functions.llSleep(sec); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public double llGetMass() + { + return m_LSL_Functions.llGetMass(); + } + + public void llCollisionFilter(string name, string id, int accept) + { + m_LSL_Functions.llCollisionFilter(name, id, accept); + } + + public void llTakeControls(int controls, int accept, int pass_on) + { + m_LSL_Functions.llTakeControls(controls, accept, pass_on); + } + + public void llReleaseControls() + { + m_LSL_Functions.llReleaseControls(); + } + + public void llAttachToAvatar(int attachment) + { + m_LSL_Functions.llAttachToAvatar(attachment); + } + + public void llDetachFromAvatar() + { + m_LSL_Functions.llDetachFromAvatar(); + } + + public void llTakeCamera() + { + m_LSL_Functions.llTakeCamera(); + } + + public void llReleaseCamera() + { + m_LSL_Functions.llReleaseCamera(); + } + + public string llGetOwner() + { + return m_LSL_Functions.llGetOwner(); + } + + public void llInstantMessage(string user, string message) + { + m_LSL_Functions.llInstantMessage(user, message); + } + + public void llEmail(string address, string subject, string message) + { + m_LSL_Functions.llEmail(address, subject, message); + } + + public void llGetNextEmail(string address, string subject) + { + m_LSL_Functions.llGetNextEmail(address, subject); + } + + public string llGetKey() + { + return m_LSL_Functions.llGetKey(); + } + + public void llSetBuoyancy(double buoyancy) + { + m_LSL_Functions.llSetBuoyancy(buoyancy); + } + + public void llSetHoverHeight(double height, int water, double tau) + { + m_LSL_Functions.llSetHoverHeight(height, water, tau); + } + + public void llStopHover() + { + m_LSL_Functions.llStopHover(); + } + + public void llMinEventDelay(double delay) + { + m_LSL_Functions.llMinEventDelay(delay); + } + + public void llSoundPreload() + { + m_LSL_Functions.llSoundPreload(); + } + + public void llRotLookAt(rotation target, double strength, double damping) + { + m_LSL_Functions.llRotLookAt(target, strength, damping); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public int llStringLength(string str) + { + return m_LSL_Functions.llStringLength(str); + } + + public void llStartAnimation(string anim) + { + m_LSL_Functions.llStartAnimation(anim); + } + + public void llStopAnimation(string anim) + { + m_LSL_Functions.llStopAnimation(anim); + } + + public void llPointAt() + { + m_LSL_Functions.llPointAt(); + } + + public void llStopPointAt() + { + m_LSL_Functions.llStopPointAt(); + } + + public void llTargetOmega(vector axis, double spinrate, double gain) + { + m_LSL_Functions.llTargetOmega(axis, spinrate, gain); + } + + public int llGetStartParameter() + { + return m_LSL_Functions.llGetStartParameter(); + } + + public void llGodLikeRezObject(string inventory, vector pos) + { + m_LSL_Functions.llGodLikeRezObject(inventory, pos); + } + + public void llRequestPermissions(string agent, int perm) + { + m_LSL_Functions.llRequestPermissions(agent, perm); + } + + public string llGetPermissionsKey() + { + return m_LSL_Functions.llGetPermissionsKey(); + } + + public int llGetPermissions() + { + return m_LSL_Functions.llGetPermissions(); + } + + public int llGetLinkNumber() + { + return m_LSL_Functions.llGetLinkNumber(); + } + + public void llSetLinkColor(int linknumber, vector color, int face) + { + m_LSL_Functions.llSetLinkColor(linknumber, color, face); + } + + public void llCreateLink(string target, int parent) + { + m_LSL_Functions.llCreateLink(target, parent); + } + + public void llBreakLink(int linknum) + { + m_LSL_Functions.llBreakLink(linknum); + } + + public void llBreakAllLinks() + { + m_LSL_Functions.llBreakAllLinks(); + } + + public string llGetLinkKey(int linknum) + { + return m_LSL_Functions.llGetLinkKey(linknum); + } + + public void llGetLinkName(int linknum) + { + m_LSL_Functions.llGetLinkName(linknum); + } + + public int llGetInventoryNumber(int type) + { + return m_LSL_Functions.llGetInventoryNumber(type); + } + + public string llGetInventoryName(int type, int number) + { + return m_LSL_Functions.llGetInventoryName(type, number); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llSetScriptState(string name, int run) + { + m_LSL_Functions.llSetScriptState(name, run); + } + + public double llGetEnergy() + { + return m_LSL_Functions.llGetEnergy(); + } + + public void llGiveInventory(string destination, string inventory) + { + m_LSL_Functions.llGiveInventory(destination, inventory); + } + + public void llRemoveInventory(string item) + { + m_LSL_Functions.llRemoveInventory(item); + } + + public void llSetText(string text, vector color, double alpha) + { + m_LSL_Functions.llSetText(text, color, alpha); + } + + public double llWater(vector offset) + { + return m_LSL_Functions.llWater(offset); + } + + public void llPassTouches(int pass) + { + m_LSL_Functions.llPassTouches(pass); + } + + public string llRequestAgentData(string id, int data) + { + return m_LSL_Functions.llRequestAgentData(id, data); + } + + public string llRequestInventoryData(string name) + { + return m_LSL_Functions.llRequestInventoryData(name); + } + + public void llSetDamage(double damage) + { + m_LSL_Functions.llSetDamage(damage); + } + + public void llTeleportAgentHome(string agent) + { + m_LSL_Functions.llTeleportAgentHome(agent); + } + + public void llModifyLand(int action, int brush) + { + m_LSL_Functions.llModifyLand(action, brush); + } + + public void llCollisionSound(string impact_sound, double impact_volume) + { + m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); + } + + public void llCollisionSprite(string impact_sprite) + { + m_LSL_Functions.llCollisionSprite(impact_sprite); + } + + public string llGetAnimation(string id) + { + return m_LSL_Functions.llGetAnimation(id); + } + + public void llResetScript() + { + m_LSL_Functions.llResetScript(); + } + + public void llMessageLinked(int linknum, int num, string str, string id) + { + m_LSL_Functions.llMessageLinked(linknum, num, str, id); + } + + public void llPushObject(string target, vector impulse, vector ang_impulse, int local) + { + m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); + } + + public void llPassCollisions(int pass) + { + m_LSL_Functions.llPassCollisions(pass); + } + + public string llGetScriptName() + { + return m_LSL_Functions.llGetScriptName(); + } + + public int llGetNumberOfSides() + { + return m_LSL_Functions.llGetNumberOfSides(); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public rotation llAxisAngle2Rot(vector axis, double angle) + { + return m_LSL_Functions.llAxisAngle2Rot(axis, angle); + } + + public vector llRot2Axis(rotation rot) + { + return m_LSL_Functions.llRot2Axis(rot); + } + + public void llRot2Angle() + { + m_LSL_Functions.llRot2Angle(); + } + + public double llAcos(double val) + { + return m_LSL_Functions.llAcos(val); + } + + public double llAsin(double val) + { + return m_LSL_Functions.llAsin(val); + } + + public double llAngleBetween(rotation a, rotation b) + { + return m_LSL_Functions.llAngleBetween(a, b); + } + + public string llGetInventoryKey(string name) + { + return m_LSL_Functions.llGetInventoryKey(name); + } + + public void llAllowInventoryDrop(int add) + { + m_LSL_Functions.llAllowInventoryDrop(add); + } + + public vector llGetSunDirection() + { + return m_LSL_Functions.llGetSunDirection(); + } + + public vector llGetTextureOffset(int face) + { + return m_LSL_Functions.llGetTextureOffset(face); + } + + public vector llGetTextureScale(int side) + { + return m_LSL_Functions.llGetTextureScale(side); + } + + public double llGetTextureRot(int side) + { + return m_LSL_Functions.llGetTextureRot(side); + } + + public int llSubStringIndex(string source, string pattern) + { + return m_LSL_Functions.llSubStringIndex(source, pattern); + } + + public string llGetOwnerKey(string id) + { + return m_LSL_Functions.llGetOwnerKey(id); + } + + public vector llGetCenterOfMass() + { + return m_LSL_Functions.llGetCenterOfMass(); + } + + public List llListSort(List src, int stride, int ascending) + { + return m_LSL_Functions.llListSort(src, stride, ascending); + } + + public int llGetListLength(List src) + { + return m_LSL_Functions.llGetListLength(src); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public int llList2Integer(List src, int index) + { + return m_LSL_Functions.llList2Integer(src, index); + } + + public double llList2double(List src, int index) + { + return m_LSL_Functions.llList2double(src, index); + } + + public string llList2String(List src, int index) + { + return m_LSL_Functions.llList2String(src, index); + } + + public string llList2Key(List src, int index) + { + return m_LSL_Functions.llList2Key(src, index); + } + + public vector llList2Vector(List src, int index) + { + return m_LSL_Functions.llList2Vector(src, index); + } + + public rotation llList2Rot(List src, int index) + { + return m_LSL_Functions.llList2Rot(src, index); + } + + public List llList2List(List src, int start, int end) + { + return m_LSL_Functions.llList2List(src, start, end); + } + + public List llDeleteSubList(List src, int start, int end) + { + return m_LSL_Functions.llDeleteSubList(src, start, end); + } + + public int llGetListEntryType(List src, int index) + { + return m_LSL_Functions.llGetListEntryType(src, index); + } + + public string llList2CSV(List src) + { + return m_LSL_Functions.llList2CSV(src); + } + + public List llCSV2List(string src) + { + return m_LSL_Functions.llCSV2List(src); + } + + public List llListRandomize(List src, int stride) + { + return m_LSL_Functions.llListRandomize(src, stride); + } + + public List llList2ListStrided(List src, int start, int end, int stride) + { + return m_LSL_Functions.llList2ListStrided(src, start, end, stride); + } + + public vector llGetRegionCorner() + { + return m_LSL_Functions.llGetRegionCorner(); + } + + public List llListInsertList(List dest, List src, int start) + { + return m_LSL_Functions.llListInsertList(dest, src, start); + } + + public int llListFindList(List src, List test) + { + return m_LSL_Functions.llListFindList(src, test); + } + + public string llGetObjectName() + { + return m_LSL_Functions.llGetObjectName(); + } + + public void llSetObjectName(string name) + { + m_LSL_Functions.llSetObjectName(name); + } + + public string llGetDate() + { + return m_LSL_Functions.llGetDate(); + } + + public int llEdgeOfWorld(vector pos, vector dir) + { + return m_LSL_Functions.llEdgeOfWorld(pos, dir); + } + + public int llGetAgentInfo(string id) + { + return m_LSL_Functions.llGetAgentInfo(id); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llAdjustSoundVolume(double volume) + { + m_LSL_Functions.llAdjustSoundVolume(volume); + } + + public void llSetSoundQueueing(int queue) + { + m_LSL_Functions.llSetSoundQueueing(queue); + } + + public void llSetSoundRadius(double radius) + { + m_LSL_Functions.llSetSoundRadius(radius); + } + + public string llKey2Name(string id) + { + return m_LSL_Functions.llKey2Name(id); + } + + public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) + { + m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); + } + + public void llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) + { + m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); + } + + public void llEjectFromLand(string pest) + { + m_LSL_Functions.llEjectFromLand(pest); + } + + public void llParseString2List() + { + m_LSL_Functions.llParseString2List(); + } + + public int llOverMyLand(string id) + { + return m_LSL_Functions.llOverMyLand(id); + } + + public string llGetLandOwnerAt(vector pos) + { + return m_LSL_Functions.llGetLandOwnerAt(pos); + } + + public string llGetNotecardLine(string name, int line) + { + return m_LSL_Functions.llGetNotecardLine(name, line); + } + + public vector llGetAgentSize(string id) + { + return m_LSL_Functions.llGetAgentSize(id); + } + + public int llSameGroup(string agent) + { + return m_LSL_Functions.llSameGroup(agent); + } + + public void llUnSit(string id) + { + m_LSL_Functions.llUnSit(id); + } + + public vector llGroundSlope(vector offset) + { + return m_LSL_Functions.llGroundSlope(offset); + } + + public vector llGroundNormal(vector offset) + { + return m_LSL_Functions.llGroundNormal(offset); + } + + public vector llGroundContour(vector offset) + { + return m_LSL_Functions.llGroundContour(offset); + } + + public int llGetAttached() + { + return m_LSL_Functions.llGetAttached(); + } + + public int llGetFreeMemory() + { + return m_LSL_Functions.llGetFreeMemory(); + } + + public string llGetRegionName() + { + return m_LSL_Functions.llGetRegionName(); + } + + public double llGetRegionTimeDilation() + { + return m_LSL_Functions.llGetRegionTimeDilation(); + } + + public double llGetRegionFPS() + { + return m_LSL_Functions.llGetRegionFPS(); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llParticleSystem(List rules) + { + m_LSL_Functions.llParticleSystem(rules); + } + + public void llGroundRepel(double height, int water, double tau) + { + m_LSL_Functions.llGroundRepel(height, water, tau); + } + + public void llGiveInventoryList() + { + m_LSL_Functions.llGiveInventoryList(); + } + + public void llSetVehicleType(int type) + { + m_LSL_Functions.llSetVehicleType(type); + } + + public void llSetVehicledoubleParam(int param, double value) + { + m_LSL_Functions.llSetVehicledoubleParam(param, value); + } + + public void llSetVehicleVectorParam(int param, vector vec) + { + m_LSL_Functions.llSetVehicleVectorParam(param, vec); + } + + public void llSetVehicleRotationParam(int param, rotation rot) + { + m_LSL_Functions.llSetVehicleRotationParam(param, rot); + } + + public void llSetVehicleFlags(int flags) + { + m_LSL_Functions.llSetVehicleFlags(flags); + } + + public void llRemoveVehicleFlags(int flags) + { + m_LSL_Functions.llRemoveVehicleFlags(flags); + } + + public void llSitTarget(vector offset, rotation rot) + { + m_LSL_Functions.llSitTarget(offset, rot); + } + + public string llAvatarOnSitTarget() + { + return m_LSL_Functions.llAvatarOnSitTarget(); + } + + public void llAddToLandPassList(string avatar, double hours) + { + m_LSL_Functions.llAddToLandPassList(avatar, hours); + } + + public void llSetTouchText(string text) + { + m_LSL_Functions.llSetTouchText(text); + } + + public void llSetSitText(string text) + { + m_LSL_Functions.llSetSitText(text); + } + + public void llSetCameraEyeOffset(vector offset) + { + m_LSL_Functions.llSetCameraEyeOffset(offset); + } + + public void llSetCameraAtOffset(vector offset) + { + m_LSL_Functions.llSetCameraAtOffset(offset); + } + + public void llDumpList2String() + { + m_LSL_Functions.llDumpList2String(); + } + + public void llScriptDanger(vector pos) + { + m_LSL_Functions.llScriptDanger(pos); + } + + public void llDialog(string avatar, string message, List buttons, int chat_channel) + { + m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); + } + + public void llVolumeDetect(int detect) + { + m_LSL_Functions.llVolumeDetect(detect); + } + + public void llResetOtherScript(string name) + { + m_LSL_Functions.llResetOtherScript(name); + } + + public int llGetScriptState(string name) + { + return m_LSL_Functions.llGetScriptState(name); + } + + public void llRemoteLoadScript() + { + m_LSL_Functions.llRemoteLoadScript(); + } + + public void llSetRemoteScriptAccessPin(int pin) + { + m_LSL_Functions.llSetRemoteScriptAccessPin(pin); + } + + public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) + { + m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); + } + + // + // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs + // + public void llOpenRemoteDataChannel() + { + m_LSL_Functions.llOpenRemoteDataChannel(); + } + + public string llSendRemoteData(string channel, string dest, int idata, string sdata) + { + return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); + } + + public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) + { + m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); + } + + public void llCloseRemoteDataChannel(string channel) + { + m_LSL_Functions.llCloseRemoteDataChannel(channel); + } + + public string llMD5String(string src, int nonce) + { + return m_LSL_Functions.llMD5String(src, nonce); + } + + public void llSetPrimitiveParams(List rules) + { + m_LSL_Functions.llSetPrimitiveParams(rules); + } + + public string llStringToBase64(string str) + { + return m_LSL_Functions.llStringToBase64(str); + } + + public string llBase64ToString(string str) + { + return m_LSL_Functions.llBase64ToString(str); + } + + public void llXorBase64Strings() + { + m_LSL_Functions.llXorBase64Strings(); + } + + public void llRemoteDataSetRegion() + { + m_LSL_Functions.llRemoteDataSetRegion(); + } + + public double llLog10(double val) + { + return m_LSL_Functions.llLog10(val); + } - // Object never expires - public override Object InitializeLifetimeService() + public double llLog(double val) { - //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); - // return null; - ILease lease = (ILease)base.InitializeLifetimeService(); + return m_LSL_Functions.llLog(val); + } - if (lease.CurrentState == LeaseState.Initial) - { - lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); - //lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); - //lease.RenewOnCallTime = TimeSpan.FromSeconds(2); - } - return lease; + public List llGetAnimationList(string id) + { + return m_LSL_Functions.llGetAnimationList(id); } + public void llSetParcelMusicURL(string url) + { + m_LSL_Functions.llSetParcelMusicURL(url); + } - private Executor m_Exec; - public Executor Exec + public vector llGetRootPosition() { - get - { - if (m_Exec == null) - m_Exec = new Executor(this); - return m_Exec; - } + return m_LSL_Functions.llGetRootPosition(); } - public LSL_BuiltIn_Commands_Interface m_LSL_Functions; - public string SourceCode = ""; + public rotation llGetRootRotation() + { + return m_LSL_Functions.llGetRootRotation(); + } - public LSL_BaseClass() + public string llGetObjectDesc() { + return m_LSL_Functions.llGetObjectDesc(); } - public string State() + + public void llSetObjectDesc(string desc) { - return m_LSL_Functions.State(); + m_LSL_Functions.llSetObjectDesc(desc); } + public string llGetCreator() + { + return m_LSL_Functions.llGetCreator(); + } - public void Start(LSL_BuiltIn_Commands_Interface LSL_Functions) + public string llGetTimestamp() { - m_LSL_Functions = LSL_Functions; + return m_LSL_Functions.llGetTimestamp(); + } - //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called."); + public void llSetLinkAlpha(int linknumber, double alpha, int face) + { + m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); + } - // Get this AppDomain's settings and display some of them. - AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; - Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", - ads.ApplicationName, - ads.ApplicationBase, - ads.ConfigurationFile - ); + public int llGetNumberOfPrims() + { + return m_LSL_Functions.llGetNumberOfPrims(); + } - // Display the name of the calling AppDomain and the name - // of the second domain. - // NOTE: The application's thread has transitioned between - // AppDomains. - Console.WriteLine("Calling to '{0}'.", - Thread.GetDomain().FriendlyName - ); + public string llGetNumberOfNotecardLines(string name) + { + return m_LSL_Functions.llGetNumberOfNotecardLines(name); + } - return; + public List llGetBoundingBox(string obj) + { + return m_LSL_Functions.llGetBoundingBox(obj); } + public vector llGetGeometricCenter() + { + return m_LSL_Functions.llGetGeometricCenter(); + } + public void llGetPrimitiveParams() + { + m_LSL_Functions.llGetPrimitiveParams(); + } // // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs // - // They are only forwarders to LSL_BuiltIn_Commands.cs - // - public double llSin(double f) { return m_LSL_Functions.llSin(f); } - public double llCos(double f) { return m_LSL_Functions.llCos(f); } - public double llTan(double f) { return m_LSL_Functions.llTan(f); } - public double llAtan2(double x, double y) { return m_LSL_Functions.llAtan2(x, y); } - public double llSqrt(double f) { return m_LSL_Functions.llSqrt(f); } - public double llPow(double fbase, double fexponent) { return m_LSL_Functions.llPow(fbase, fexponent); } - public int llAbs(int i) { return m_LSL_Functions.llAbs(i); } - public double llFabs(double f) { return m_LSL_Functions.llFabs(f); } - public double llFrand(double mag) { return m_LSL_Functions.llFrand(mag); } - public int llFloor(double f) { return m_LSL_Functions.llFloor(f); } - public int llCeil(double f) { return m_LSL_Functions.llCeil(f); } - public int llRound(double f) { return m_LSL_Functions.llRound(f); } - public double llVecMag(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecMag(v); } - public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecNorm(v); } - public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) { return m_LSL_Functions.llVecDist(a, b); } - public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Euler(r); } - public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) { return m_LSL_Functions.llEuler2Rot(v); } - public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return m_LSL_Functions.llAxes2Rot(fwd, left, up); } - public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Fwd(r); } - public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Left(r); } - public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Up(r); } - public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return m_LSL_Functions.llRotBetween(start, end); } - public void llWhisper(int channelID, string text) { m_LSL_Functions.llWhisper(channelID, text); } - public void llSay(int channelID, string text) { m_LSL_Functions.llSay(channelID, text); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llShout(int channelID, string text) { m_LSL_Functions.llShout(channelID, text); } - public int llListen(int channelID, string name, string ID, string msg) { return m_LSL_Functions.llListen(channelID, name, ID, msg); } - public void llListenControl(int number, int active) { m_LSL_Functions.llListenControl(number, active); } - public void llListenRemove(int number) { m_LSL_Functions.llListenRemove(number); } - public void llSensor(string name, string id, int type, double range, double arc) { m_LSL_Functions.llSensor(name, id, type, range, arc); } - public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); } - public void llSensorRemove() { m_LSL_Functions.llSensorRemove(); } - public string llDetectedName(int number) { return m_LSL_Functions.llDetectedName(number); } - public string llDetectedKey(int number) { return m_LSL_Functions.llDetectedKey(number); } - public string llDetectedOwner(int number) { return m_LSL_Functions.llDetectedOwner(number); } - public int llDetectedType(int number) { return m_LSL_Functions.llDetectedType(number); } - public LSL_Types.Vector3 llDetectedPos(int number) { return m_LSL_Functions.llDetectedPos(number); } - public LSL_Types.Vector3 llDetectedVel(int number) { return m_LSL_Functions.llDetectedVel(number); } - public LSL_Types.Vector3 llDetectedGrab(int number) { return m_LSL_Functions.llDetectedGrab(number); } - public LSL_Types.Quaternion llDetectedRot(int number) { return m_LSL_Functions.llDetectedRot(number); } - public int llDetectedGroup(int number) { return m_LSL_Functions.llDetectedGroup(number); } - public int llDetectedLinkNumber(int number) { return m_LSL_Functions.llDetectedLinkNumber(number); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llDie() { m_LSL_Functions.llDie(); } - public double llGround(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGround(offset); } - public double llCloud(LSL_Types.Vector3 offset) { return m_LSL_Functions.llCloud(offset); } - public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWind(offset); } - public void llSetStatus(int status, int value) { m_LSL_Functions.llSetStatus(status, value); } - public int llGetStatus(int status) { return m_LSL_Functions.llGetStatus(status); } - public void llSetScale(LSL_Types.Vector3 scale) { m_LSL_Functions.llSetScale(scale); } - public LSL_Types.Vector3 llGetScale() { return m_LSL_Functions.llGetScale(); } - public void llSetColor(LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetColor(color, face); } - public double llGetAlpha(int face) { return m_LSL_Functions.llGetAlpha(face); } - public void llSetAlpha(double alpha, int face) { m_LSL_Functions.llSetAlpha(alpha, face); } - public LSL_Types.Vector3 llGetColor(int face) { return m_LSL_Functions.llGetColor(face); } - public void llSetTexture(string texture, int face) { m_LSL_Functions.llSetTexture(texture, face); } - public void llScaleTexture(double u, double v, int face) { m_LSL_Functions.llScaleTexture(u, v, face); } - public void llOffsetTexture(double u, double v, int face) { m_LSL_Functions.llOffsetTexture(u, v, face); } - public void llRotateTexture(double rotation, int face) { m_LSL_Functions.llRotateTexture(rotation, face); } - public string llGetTexture(int face) { return m_LSL_Functions.llGetTexture(face); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llSetPos(LSL_Types.Vector3 pos) { m_LSL_Functions.llSetPos(pos); } - public LSL_Types.Vector3 llGetPos() { return m_LSL_Functions.llGetPos(); } - public LSL_Types.Vector3 llGetLocalPos() { return m_LSL_Functions.llGetLocalPos(); } - public void llSetRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetRot(rot); } - public LSL_Types.Quaternion llGetRot() { return m_LSL_Functions.llGetRot(); } - public LSL_Types.Quaternion llGetLocalRot() { return m_LSL_Functions.llGetLocalRot(); } - public void llSetForce(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llSetForce(force, local); } - public LSL_Types.Vector3 llGetForce() { return m_LSL_Functions.llGetForce(); } - public int llTarget(LSL_Types.Vector3 position, double range) { return m_LSL_Functions.llTarget(position, range); } - public void llTargetRemove(int number) { m_LSL_Functions.llTargetRemove(number); } - public int llRotTarget(LSL_Types.Quaternion rot, double error) { return m_LSL_Functions.llRotTarget(rot, error); } - public void llRotTargetRemove(int number) { m_LSL_Functions.llRotTargetRemove(number); } - public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { m_LSL_Functions.llMoveToTarget(target, tau); } - public void llStopMoveToTarget() { m_LSL_Functions.llStopMoveToTarget(); } - public void llApplyImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyImpulse(force, local); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyRotationalImpulse(force, local); } - public void llSetTorque(LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetTorque(torque, local); } - public LSL_Types.Vector3 llGetTorque() { return m_LSL_Functions.llGetTorque(); } - public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetForceAndTorque(force, torque, local); } - public LSL_Types.Vector3 llGetVel() { return m_LSL_Functions.llGetVel(); } - public LSL_Types.Vector3 llGetAccel() { return m_LSL_Functions.llGetAccel(); } - public LSL_Types.Vector3 llGetOmega() { return m_LSL_Functions.llGetOmega(); } - public double llGetTimeOfDay() { return m_LSL_Functions.llGetTimeOfDay(); } - public double llGetWallclock() { return m_LSL_Functions.llGetWallclock(); } - public double llGetTime() { return m_LSL_Functions.llGetTime(); } - public void llResetTime() { m_LSL_Functions.llResetTime(); } - public double llGetAndResetTime() { return m_LSL_Functions.llGetAndResetTime(); } - public void llSound() { m_LSL_Functions.llSound(); } - public void llPlaySound(string sound, double volume) { m_LSL_Functions.llPlaySound(sound, volume); } - public void llLoopSound(string sound, double volume) { m_LSL_Functions.llLoopSound(sound, volume); } - public void llLoopSoundMaster(string sound, double volume) { m_LSL_Functions.llLoopSoundMaster(sound, volume); } - public void llLoopSoundSlave(string sound, double volume) { m_LSL_Functions.llLoopSoundSlave(sound, volume); } - public void llPlaySoundSlave(string sound, double volume) { m_LSL_Functions.llPlaySoundSlave(sound, volume); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llTriggerSound(string sound, double volume) { m_LSL_Functions.llTriggerSound(sound, volume); } - public void llStopSound() { m_LSL_Functions.llStopSound(); } - public void llPreloadSound(string sound) { m_LSL_Functions.llPreloadSound(sound); } - public string llGetSubString(string src, int start, int end) { return m_LSL_Functions.llGetSubString(src, start, end); } - public string llDeleteSubString(string src, int start, int end) { return m_LSL_Functions.llDeleteSubString(src, start, end); } - public string llInsertString(string dst, int position, string src) { return m_LSL_Functions.llInsertString(dst, position, src); } - public string llToUpper(string source) { return m_LSL_Functions.llToUpper(source); } - public string llToLower(string source) { return m_LSL_Functions.llToLower(source); } - public int llGiveMoney(string destination, int amount) { return m_LSL_Functions.llGiveMoney(destination, amount); } - public void llMakeExplosion() { m_LSL_Functions.llMakeExplosion(); } - public void llMakeFountain() { m_LSL_Functions.llMakeFountain(); } - public void llMakeSmoke() { m_LSL_Functions.llMakeSmoke(); } - public void llMakeFire() { m_LSL_Functions.llMakeFire(); } - public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezObject(inventory, pos, rot, param); } - public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { m_LSL_Functions.llLookAt(target, strength, damping); } - public void llStopLookAt() { m_LSL_Functions.llStopLookAt(); } - public void llSetTimerEvent(double sec) { m_LSL_Functions.llSetTimerEvent(sec); } - public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public double llGetMass() { return m_LSL_Functions.llGetMass(); } - public void llCollisionFilter(string name, string id, int accept) { m_LSL_Functions.llCollisionFilter(name, id, accept); } - public void llTakeControls(int controls, int accept, int pass_on) { m_LSL_Functions.llTakeControls(controls, accept, pass_on); } - public void llReleaseControls() { m_LSL_Functions.llReleaseControls(); } - public void llAttachToAvatar(int attachment) { m_LSL_Functions.llAttachToAvatar(attachment); } - public void llDetachFromAvatar() { m_LSL_Functions.llDetachFromAvatar(); } - public void llTakeCamera() { m_LSL_Functions.llTakeCamera(); } - public void llReleaseCamera() { m_LSL_Functions.llReleaseCamera(); } - public string llGetOwner() { return m_LSL_Functions.llGetOwner(); } - public void llInstantMessage(string user, string message) { m_LSL_Functions.llInstantMessage(user, message); } - public void llEmail(string address, string subject, string message) { m_LSL_Functions.llEmail(address, subject, message); } - public void llGetNextEmail(string address, string subject) { m_LSL_Functions.llGetNextEmail(address, subject); } - public string llGetKey() { return m_LSL_Functions.llGetKey(); } - public void llSetBuoyancy(double buoyancy) { m_LSL_Functions.llSetBuoyancy(buoyancy); } - public void llSetHoverHeight(double height, int water, double tau) { m_LSL_Functions.llSetHoverHeight(height, water, tau); } - public void llStopHover() { m_LSL_Functions.llStopHover(); } - public void llMinEventDelay(double delay) { m_LSL_Functions.llMinEventDelay(delay); } - public void llSoundPreload() { m_LSL_Functions.llSoundPreload(); } - public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { m_LSL_Functions.llRotLookAt(target, strength, damping); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public int llStringLength(string str) { return m_LSL_Functions.llStringLength(str); } - public void llStartAnimation(string anim) { m_LSL_Functions.llStartAnimation(anim); } - public void llStopAnimation(string anim) { m_LSL_Functions.llStopAnimation(anim); } - public void llPointAt() { m_LSL_Functions.llPointAt(); } - public void llStopPointAt() { m_LSL_Functions.llStopPointAt(); } - public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { m_LSL_Functions.llTargetOmega(axis, spinrate, gain); } - public int llGetStartParameter() { return m_LSL_Functions.llGetStartParameter(); } - public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { m_LSL_Functions.llGodLikeRezObject(inventory, pos); } - public void llRequestPermissions(string agent, int perm) { m_LSL_Functions.llRequestPermissions(agent, perm); } - public string llGetPermissionsKey() { return m_LSL_Functions.llGetPermissionsKey(); } - public int llGetPermissions() { return m_LSL_Functions.llGetPermissions(); } - public int llGetLinkNumber() { return m_LSL_Functions.llGetLinkNumber(); } - public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetLinkColor(linknumber, color, face); } - public void llCreateLink(string target, int parent) { m_LSL_Functions.llCreateLink(target, parent); } - public void llBreakLink(int linknum) { m_LSL_Functions.llBreakLink(linknum); } - public void llBreakAllLinks() { m_LSL_Functions.llBreakAllLinks(); } - public string llGetLinkKey(int linknum) { return m_LSL_Functions.llGetLinkKey(linknum); } - public void llGetLinkName(int linknum) { m_LSL_Functions.llGetLinkName(linknum); } - public int llGetInventoryNumber(int type) { return m_LSL_Functions.llGetInventoryNumber(type); } - public string llGetInventoryName(int type, int number) { return m_LSL_Functions.llGetInventoryName(type, number); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llSetScriptState(string name, int run) { m_LSL_Functions.llSetScriptState(name, run); } - public double llGetEnergy() { return m_LSL_Functions.llGetEnergy(); } - public void llGiveInventory(string destination, string inventory) { m_LSL_Functions.llGiveInventory(destination, inventory); } - public void llRemoveInventory(string item) { m_LSL_Functions.llRemoveInventory(item); } - public void llSetText(string text, LSL_Types.Vector3 color, double alpha) { m_LSL_Functions.llSetText(text, color, alpha); } - public double llWater(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWater(offset); } - public void llPassTouches(int pass) { m_LSL_Functions.llPassTouches(pass); } - public string llRequestAgentData(string id, int data) { return m_LSL_Functions.llRequestAgentData(id, data); } - public string llRequestInventoryData(string name) { return m_LSL_Functions.llRequestInventoryData(name); } - public void llSetDamage(double damage) { m_LSL_Functions.llSetDamage(damage); } - public void llTeleportAgentHome(string agent) { m_LSL_Functions.llTeleportAgentHome(agent); } - public void llModifyLand(int action, int brush) { m_LSL_Functions.llModifyLand(action, brush); } - public void llCollisionSound(string impact_sound, double impact_volume) { m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); } - public void llCollisionSprite(string impact_sprite) { m_LSL_Functions.llCollisionSprite(impact_sprite); } - public string llGetAnimation(string id) { return m_LSL_Functions.llGetAnimation(id); } - public void llResetScript() { m_LSL_Functions.llResetScript(); } - public void llMessageLinked(int linknum, int num, string str, string id) { m_LSL_Functions.llMessageLinked(linknum, num, str, id); } - public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); } - public void llPassCollisions(int pass) { m_LSL_Functions.llPassCollisions(pass); } - public string llGetScriptName() { return m_LSL_Functions.llGetScriptName(); } - public int llGetNumberOfSides() { return m_LSL_Functions.llGetNumberOfSides(); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return m_LSL_Functions.llAxisAngle2Rot(axis, angle); } - public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return m_LSL_Functions.llRot2Axis(rot); } - public void llRot2Angle() { m_LSL_Functions.llRot2Angle(); } - public double llAcos(double val) { return m_LSL_Functions.llAcos(val); } - public double llAsin(double val) { return m_LSL_Functions.llAsin(val); } - public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return m_LSL_Functions.llAngleBetween(a, b); } - public string llGetInventoryKey(string name) { return m_LSL_Functions.llGetInventoryKey(name); } - public void llAllowInventoryDrop(int add) { m_LSL_Functions.llAllowInventoryDrop(add); } - public LSL_Types.Vector3 llGetSunDirection() { return m_LSL_Functions.llGetSunDirection(); } - public LSL_Types.Vector3 llGetTextureOffset(int face) { return m_LSL_Functions.llGetTextureOffset(face); } - public LSL_Types.Vector3 llGetTextureScale(int side) { return m_LSL_Functions.llGetTextureScale(side); } - public double llGetTextureRot(int side) { return m_LSL_Functions.llGetTextureRot(side); } - public int llSubStringIndex(string source, string pattern) { return m_LSL_Functions.llSubStringIndex(source, pattern); } - public string llGetOwnerKey(string id) { return m_LSL_Functions.llGetOwnerKey(id); } - public LSL_Types.Vector3 llGetCenterOfMass() { return m_LSL_Functions.llGetCenterOfMass(); } - public List llListSort(List src, int stride, int ascending) { return m_LSL_Functions.llListSort(src, stride, ascending); } - public int llGetListLength(List src) { return m_LSL_Functions.llGetListLength(src); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public int llList2Integer(List src, int index) { return m_LSL_Functions.llList2Integer(src, index); } - public double llList2double(List src, int index) { return m_LSL_Functions.llList2double(src, index); } - public string llList2String(List src, int index) { return m_LSL_Functions.llList2String(src, index); } - public string llList2Key(List src, int index) { return m_LSL_Functions.llList2Key(src, index); } - public LSL_Types.Vector3 llList2Vector(List src, int index) { return m_LSL_Functions.llList2Vector(src, index); } - public LSL_Types.Quaternion llList2Rot(List src, int index) { return m_LSL_Functions.llList2Rot(src, index); } - public List llList2List(List src, int start, int end) { return m_LSL_Functions.llList2List(src, start, end); } - public List llDeleteSubList(List src, int start, int end) { return m_LSL_Functions.llDeleteSubList(src, start, end); } - public int llGetListEntryType(List src, int index) { return m_LSL_Functions.llGetListEntryType(src, index); } - public string llList2CSV(List src) { return m_LSL_Functions.llList2CSV(src); } - public List llCSV2List(string src) { return m_LSL_Functions.llCSV2List(src); } - public List llListRandomize(List src, int stride) { return m_LSL_Functions.llListRandomize(src, stride); } - public List llList2ListStrided(List src, int start, int end, int stride) { return m_LSL_Functions.llList2ListStrided(src, start, end, stride); } - public LSL_Types.Vector3 llGetRegionCorner() { return m_LSL_Functions.llGetRegionCorner(); } - public List llListInsertList(List dest, List src, int start) { return m_LSL_Functions.llListInsertList(dest, src, start); } - public int llListFindList(List src, List test) { return m_LSL_Functions.llListFindList(src, test); } - public string llGetObjectName() { return m_LSL_Functions.llGetObjectName(); } - public void llSetObjectName(string name) { m_LSL_Functions.llSetObjectName(name); } - public string llGetDate() { return m_LSL_Functions.llGetDate(); } - public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return m_LSL_Functions.llEdgeOfWorld(pos, dir); } - public int llGetAgentInfo(string id) { return m_LSL_Functions.llGetAgentInfo(id); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llAdjustSoundVolume(double volume) { m_LSL_Functions.llAdjustSoundVolume(volume); } - public void llSetSoundQueueing(int queue) { m_LSL_Functions.llSetSoundQueueing(queue); } - public void llSetSoundRadius(double radius) { m_LSL_Functions.llSetSoundRadius(radius); } - public string llKey2Name(string id) { return m_LSL_Functions.llKey2Name(id); } - public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); } - public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); } - public void llEjectFromLand(string pest) { m_LSL_Functions.llEjectFromLand(pest); } - public void llParseString2List() { m_LSL_Functions.llParseString2List(); } - public int llOverMyLand(string id) { return m_LSL_Functions.llOverMyLand(id); } - public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetLandOwnerAt(pos); } - public string llGetNotecardLine(string name, int line) { return m_LSL_Functions.llGetNotecardLine(name, line); } - public LSL_Types.Vector3 llGetAgentSize(string id) { return m_LSL_Functions.llGetAgentSize(id); } - public int llSameGroup(string agent) { return m_LSL_Functions.llSameGroup(agent); } - public void llUnSit(string id) { m_LSL_Functions.llUnSit(id); } - public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundSlope(offset); } - public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundNormal(offset); } - public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundContour(offset); } - public int llGetAttached() { return m_LSL_Functions.llGetAttached(); } - public int llGetFreeMemory() { return m_LSL_Functions.llGetFreeMemory(); } - public string llGetRegionName() { return m_LSL_Functions.llGetRegionName(); } - public double llGetRegionTimeDilation() { return m_LSL_Functions.llGetRegionTimeDilation(); } - public double llGetRegionFPS() { return m_LSL_Functions.llGetRegionFPS(); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llParticleSystem(List rules) { m_LSL_Functions.llParticleSystem(rules); } - public void llGroundRepel(double height, int water, double tau) { m_LSL_Functions.llGroundRepel(height, water, tau); } - public void llGiveInventoryList() { m_LSL_Functions.llGiveInventoryList(); } - public void llSetVehicleType(int type) { m_LSL_Functions.llSetVehicleType(type); } - public void llSetVehicledoubleParam(int param, double value) { m_LSL_Functions.llSetVehicledoubleParam(param, value); } - public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { m_LSL_Functions.llSetVehicleVectorParam(param, vec); } - public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { m_LSL_Functions.llSetVehicleRotationParam(param, rot); } - public void llSetVehicleFlags(int flags) { m_LSL_Functions.llSetVehicleFlags(flags); } - public void llRemoveVehicleFlags(int flags) { m_LSL_Functions.llRemoveVehicleFlags(flags); } - public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { m_LSL_Functions.llSitTarget(offset, rot); } - public string llAvatarOnSitTarget() { return m_LSL_Functions.llAvatarOnSitTarget(); } - public void llAddToLandPassList(string avatar, double hours) { m_LSL_Functions.llAddToLandPassList(avatar, hours); } - public void llSetTouchText(string text) { m_LSL_Functions.llSetTouchText(text); } - public void llSetSitText(string text) { m_LSL_Functions.llSetSitText(text); } - public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraEyeOffset(offset); } - public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraAtOffset(offset); } - public void llDumpList2String() { m_LSL_Functions.llDumpList2String(); } - public void llScriptDanger(LSL_Types.Vector3 pos) { m_LSL_Functions.llScriptDanger(pos); } - public void llDialog(string avatar, string message, List buttons, int chat_channel) { m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); } - public void llVolumeDetect(int detect) { m_LSL_Functions.llVolumeDetect(detect); } - public void llResetOtherScript(string name) { m_LSL_Functions.llResetOtherScript(name); } - public int llGetScriptState(string name) { return m_LSL_Functions.llGetScriptState(name); } - public void llRemoteLoadScript() { m_LSL_Functions.llRemoteLoadScript(); } - public void llSetRemoteScriptAccessPin(int pin) { m_LSL_Functions.llSetRemoteScriptAccessPin(pin); } - public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public void llOpenRemoteDataChannel() { m_LSL_Functions.llOpenRemoteDataChannel(); } - public string llSendRemoteData(string channel, string dest, int idata, string sdata) { return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); } - public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); } - public void llCloseRemoteDataChannel(string channel) { m_LSL_Functions.llCloseRemoteDataChannel(channel); } - public string llMD5String(string src, int nonce) { return m_LSL_Functions.llMD5String(src, nonce); } - public void llSetPrimitiveParams(List rules) { m_LSL_Functions.llSetPrimitiveParams(rules); } - public string llStringToBase64(string str) { return m_LSL_Functions.llStringToBase64(str); } - public string llBase64ToString(string str) { return m_LSL_Functions.llBase64ToString(str); } - public void llXorBase64Strings() { m_LSL_Functions.llXorBase64Strings(); } - public void llRemoteDataSetRegion() { m_LSL_Functions.llRemoteDataSetRegion(); } - public double llLog10(double val) { return m_LSL_Functions.llLog10(val); } - public double llLog(double val) { return m_LSL_Functions.llLog(val); } - public List llGetAnimationList(string id) { return m_LSL_Functions.llGetAnimationList(id); } - public void llSetParcelMusicURL(string url) { m_LSL_Functions.llSetParcelMusicURL(url); } - public LSL_Types.Vector3 llGetRootPosition() { return m_LSL_Functions.llGetRootPosition(); } - public LSL_Types.Quaternion llGetRootRotation() { return m_LSL_Functions.llGetRootRotation(); } - public string llGetObjectDesc() { return m_LSL_Functions.llGetObjectDesc(); } - public void llSetObjectDesc(string desc) { m_LSL_Functions.llSetObjectDesc(desc); } - public string llGetCreator() { return m_LSL_Functions.llGetCreator(); } - public string llGetTimestamp() { return m_LSL_Functions.llGetTimestamp(); } - public void llSetLinkAlpha(int linknumber, double alpha, int face) { m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); } - public int llGetNumberOfPrims() { return m_LSL_Functions.llGetNumberOfPrims(); } - public string llGetNumberOfNotecardLines(string name) { return m_LSL_Functions.llGetNumberOfNotecardLines(name); } - public List llGetBoundingBox(string obj) { return m_LSL_Functions.llGetBoundingBox(obj); } - public LSL_Types.Vector3 llGetGeometricCenter() { return m_LSL_Functions.llGetGeometricCenter(); } - public void llGetPrimitiveParams() { m_LSL_Functions.llGetPrimitiveParams(); } - // - // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs - // - public string llIntegerToBase64(int number) { return m_LSL_Functions.llIntegerToBase64(number); } - public int llBase64ToInteger(string str) { return m_LSL_Functions.llBase64ToInteger(str); } - public double llGetGMTclock() { return m_LSL_Functions.llGetGMTclock(); } - public string llGetSimulatorHostname() { return m_LSL_Functions.llGetSimulatorHostname(); } - public void llSetLocalRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetLocalRot(rot); } - public List llParseStringKeepNulls(string src, List seperators, List spacers) { return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); } - public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); } - public int llGetObjectPermMask(int mask) { return m_LSL_Functions.llGetObjectPermMask(mask); } - public void llSetObjectPermMask(int mask, int value) { m_LSL_Functions.llSetObjectPermMask(mask, value); } - public void llGetInventoryPermMask(string item, int mask) { m_LSL_Functions.llGetInventoryPermMask(item, mask); } - public void llSetInventoryPermMask(string item, int mask, int value) { m_LSL_Functions.llSetInventoryPermMask(item, mask, value); } - public string llGetInventoryCreator(string item) { return m_LSL_Functions.llGetInventoryCreator(item); } - public void llOwnerSay(string msg) { m_LSL_Functions.llOwnerSay(msg); } - public void llRequestSimulatorData(string simulator, int data) { m_LSL_Functions.llRequestSimulatorData(simulator, data); } - public void llForceMouselook(int mouselook) { m_LSL_Functions.llForceMouselook(mouselook); } - public double llGetObjectMass(string id) { return m_LSL_Functions.llGetObjectMass(id); } - public void llListReplaceList() { m_LSL_Functions.llListReplaceList(); } - public void llLoadURL(string avatar_id, string message, string url) { m_LSL_Functions.llLoadURL(avatar_id, message, url); } - public void llParcelMediaCommandList(List commandList) { m_LSL_Functions.llParcelMediaCommandList(commandList); } - public void llParcelMediaQuery() { m_LSL_Functions.llParcelMediaQuery(); } - public int llModPow(int a, int b, int c) { return m_LSL_Functions.llModPow(a, b, c); } + public string llIntegerToBase64(int number) + { + return m_LSL_Functions.llIntegerToBase64(number); + } + + public int llBase64ToInteger(string str) + { + return m_LSL_Functions.llBase64ToInteger(str); + } + + public double llGetGMTclock() + { + return m_LSL_Functions.llGetGMTclock(); + } + + public string llGetSimulatorHostname() + { + return m_LSL_Functions.llGetSimulatorHostname(); + } + + public void llSetLocalRot(rotation rot) + { + m_LSL_Functions.llSetLocalRot(rot); + } + + public List llParseStringKeepNulls(string src, List seperators, List spacers) + { + return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); + } + + public void llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, int param) + { + m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); + } + + public int llGetObjectPermMask(int mask) + { + return m_LSL_Functions.llGetObjectPermMask(mask); + } + + public void llSetObjectPermMask(int mask, int value) + { + m_LSL_Functions.llSetObjectPermMask(mask, value); + } + + public void llGetInventoryPermMask(string item, int mask) + { + m_LSL_Functions.llGetInventoryPermMask(item, mask); + } + + public void llSetInventoryPermMask(string item, int mask, int value) + { + m_LSL_Functions.llSetInventoryPermMask(item, mask, value); + } + + public string llGetInventoryCreator(string item) + { + return m_LSL_Functions.llGetInventoryCreator(item); + } + + public void llOwnerSay(string msg) + { + m_LSL_Functions.llOwnerSay(msg); + } + + public void llRequestSimulatorData(string simulator, int data) + { + m_LSL_Functions.llRequestSimulatorData(simulator, data); + } + + public void llForceMouselook(int mouselook) + { + m_LSL_Functions.llForceMouselook(mouselook); + } + + public double llGetObjectMass(string id) + { + return m_LSL_Functions.llGetObjectMass(id); + } + + public void llListReplaceList() + { + m_LSL_Functions.llListReplaceList(); + } + + public void llLoadURL(string avatar_id, string message, string url) + { + m_LSL_Functions.llLoadURL(avatar_id, message, url); + } + + public void llParcelMediaCommandList(List commandList) + { + m_LSL_Functions.llParcelMediaCommandList(commandList); + } + + public void llParcelMediaQuery() + { + m_LSL_Functions.llParcelMediaQuery(); + } + + public int llModPow(int a, int b, int c) + { + return m_LSL_Functions.llModPow(a, b, c); + } + // // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs // - public int llGetInventoryType(string name) { return m_LSL_Functions.llGetInventoryType(name); } - public void llSetPayPrice(int price, List quick_pay_buttons) { m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); } - public LSL_Types.Vector3 llGetCameraPos() { return m_LSL_Functions.llGetCameraPos(); } - public LSL_Types.Quaternion llGetCameraRot() { return m_LSL_Functions.llGetCameraRot(); } - public void llSetPrimURL() { m_LSL_Functions.llSetPrimURL(); } - public void llRefreshPrimURL() { m_LSL_Functions.llRefreshPrimURL(); } - public string llEscapeURL(string url) { return m_LSL_Functions.llEscapeURL(url); } - public string llUnescapeURL(string url) { return m_LSL_Functions.llUnescapeURL(url); } - public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { m_LSL_Functions.llMapDestination(simname, pos, look_at); } - public void llAddToLandBanList(string avatar, double hours) { m_LSL_Functions.llAddToLandBanList(avatar, hours); } - public void llRemoveFromLandPassList(string avatar) { m_LSL_Functions.llRemoveFromLandPassList(avatar); } - public void llRemoveFromLandBanList(string avatar) { m_LSL_Functions.llRemoveFromLandBanList(avatar); } - public void llSetCameraParams(List rules) { m_LSL_Functions.llSetCameraParams(rules); } - public void llClearCameraParams() { m_LSL_Functions.llClearCameraParams(); } - public double llListStatistics(int operation, List src) { return m_LSL_Functions.llListStatistics(operation, src); } - public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } - public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } - public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } - public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } - public void llHTTPRequest(string url, List parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } - public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } - public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } - public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); } - public List llGetParcelPrimOwners(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelPrimOwners(pos); } - public int llGetObjectPrimCount(string object_id) { return m_LSL_Functions.llGetObjectPrimCount(object_id); } + public int llGetInventoryType(string name) + { + return m_LSL_Functions.llGetInventoryType(name); + } + + public void llSetPayPrice(int price, List quick_pay_buttons) + { + m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); + } + + public vector llGetCameraPos() + { + return m_LSL_Functions.llGetCameraPos(); + } + + public rotation llGetCameraRot() + { + return m_LSL_Functions.llGetCameraRot(); + } + + public void llSetPrimURL() + { + m_LSL_Functions.llSetPrimURL(); + } + + public void llRefreshPrimURL() + { + m_LSL_Functions.llRefreshPrimURL(); + } + + public string llEscapeURL(string url) + { + return m_LSL_Functions.llEscapeURL(url); + } + + public string llUnescapeURL(string url) + { + return m_LSL_Functions.llUnescapeURL(url); + } + + public void llMapDestination(string simname, vector pos, vector look_at) + { + m_LSL_Functions.llMapDestination(simname, pos, look_at); + } + + public void llAddToLandBanList(string avatar, double hours) + { + m_LSL_Functions.llAddToLandBanList(avatar, hours); + } + + public void llRemoveFromLandPassList(string avatar) + { + m_LSL_Functions.llRemoveFromLandPassList(avatar); + } + + public void llRemoveFromLandBanList(string avatar) + { + m_LSL_Functions.llRemoveFromLandBanList(avatar); + } + + public void llSetCameraParams(List rules) + { + m_LSL_Functions.llSetCameraParams(rules); + } + + public void llClearCameraParams() + { + m_LSL_Functions.llClearCameraParams(); + } + + public double llListStatistics(int operation, List src) + { + return m_LSL_Functions.llListStatistics(operation, src); + } + + public int llGetUnixTime() + { + return m_LSL_Functions.llGetUnixTime(); + } + + public int llGetParcelFlags(vector pos) + { + return m_LSL_Functions.llGetParcelFlags(pos); + } + + public int llGetRegionFlags() + { + return m_LSL_Functions.llGetRegionFlags(); + } + + public string llXorBase64StringsCorrect(string str1, string str2) + { + return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); + } + + public void llHTTPRequest(string url, List parameters, string body) + { + m_LSL_Functions.llHTTPRequest(url, parameters, body); + } + + public void llResetLandBanList() + { + m_LSL_Functions.llResetLandBanList(); + } + + public void llResetLandPassList() + { + m_LSL_Functions.llResetLandPassList(); + } + + public int llGetParcelPrimCount(vector pos, int category, int sim_wide) + { + return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); + } + + public List llGetParcelPrimOwners(vector pos) + { + return m_LSL_Functions.llGetParcelPrimOwners(pos); + } + + public int llGetObjectPrimCount(string object_id) + { + return m_LSL_Functions.llGetObjectPrimCount(object_id); + } + // // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs // - public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } - public List llGetParcelDetails(LSL_Types.Vector3 pos, List param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } + public int llGetParcelMaxPrims(vector pos, int sim_wide) + { + return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); + } + + public List llGetParcelDetails(vector pos, List param) + { + return m_LSL_Functions.llGetParcelDetails(pos, param); + } // // OpenSim Functions // - public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); } + public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, + int timer) + { + return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); + } // LSL CONSTANTS public const int TRUE = 1; @@ -803,10 +2115,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public const double SQRT2 = 1.414213538f; // Can not be public const? - public LSL_Types.Vector3 ZERO_VECTOR = new LSL_Types.Vector3(0, 0, 0); - public LSL_Types.Quaternion ZERO_ROTATION = new LSL_Types.Quaternion(0, 0, 0, 0); - - - + public vector ZERO_VECTOR = new vector(0, 0, 0); + public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs index 00eb899..190e6d7 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs @@ -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 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"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs index f060f06..97981cc 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs @@ -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; - } - - - // Make call - il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype })); + // 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})); } - } - - ////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 } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs index 65be5e3..2dc8055 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs @@ -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; - } - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs index 2fb8e45..b84400c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs @@ -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 LSLStack = new Stack(); - public Dictionary StaticVariables = new Dictionary(); - public Dictionary GlobalVariables = new Dictionary(); - public Dictionary LocalVariables = new Dictionary(); + public Dictionary StaticVariables = new Dictionary(); + public Dictionary GlobalVariables = new Dictionary(); + public Dictionary LocalVariables = new Dictionary(); //public System.Collections.Generic.List FunctionList = new System.Collections.Generic.List(); //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); } - - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs index a75b4c8..c805a01 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs @@ -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); + LSLStack.Push((UInt32) 0); } } + public void NEQ(UInt32 Param) { Common.SendToDebug("::NEQ: " + 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); + LSLStack.Push((UInt32) 0); } } + public void LEQ(UInt32 Param) { Common.SendToDebug("::LEQ: " + 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); + LSLStack.Push((UInt32) 0); } } + public void GEQ(UInt32 Param) { Common.SendToDebug("::GEQ: " + 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); + LSLStack.Push((UInt32) 0); } } + public void LESS(UInt32 Param) { Common.SendToDebug("::LESS: " + 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); + LSLStack.Push((UInt32) 0); } } + public void GREATER(UInt32 Param) { Common.SendToDebug("::GREATER: " + 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); + 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)); } - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs index 5f01bf5..8b233ba 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs @@ -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(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs index ee166a6..e1d7768 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs @@ -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 ILStack = new Stack(); //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); - } - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs index 30ce314..a7e3018 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs @@ -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 } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs index ba97375..a0b4977f 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs @@ -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 EventList = new System.Collections.Generic.List(); + private List EventList = new List(); 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 /// 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 /// Name of event (function) to generate 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(); + myCodeChunk.CodeChunkArguments = new List(); 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); } - } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs index baeda38..cf64638 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs @@ -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 CodeChunkArguments; + public List 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; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index b94cf90..737dee6 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs @@ -26,19 +26,18 @@ * */ -using Axiom.Math; using System; using System.Collections.Generic; +using System.Runtime.Remoting.Lifetime; using System.Text; +using System.Threading; +using Axiom.Math; using libsecondlife; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Environment.Scenes.Scripting; +using OpenSim.Framework; using OpenSim.Region.Environment.Interfaces; -using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; +using OpenSim.Region.Environment.Scenes; using OpenSim.Region.ScriptEngine.Common; -using OpenSim.Framework.Console; -using OpenSim.Framework; -using System.Runtime.Remoting.Lifetime; +using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler { @@ -53,8 +52,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler /// public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface { - - private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + private ASCIIEncoding enc = new ASCIIEncoding(); private ScriptEngine m_ScriptEngine; private SceneObjectPart m_host; private uint m_localID; @@ -86,7 +84,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler { //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); // return null; - ILease lease = (ILease)base.InitializeLifetimeService(); + ILease lease = (ILease) base.InitializeLifetimeService(); if (lease.CurrentState == LeaseState.Initial) { @@ -105,79 +103,130 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler //These are the implementations of the various ll-functions used by the LSL scripts. //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 - public double llSin(double f) { return (double)Math.Sin(f); } - public double llCos(double f) { return (double)Math.Cos(f); } - public double llTan(double f) { return (double)Math.Tan(f); } - public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } - public double llSqrt(double f) { return (double)Math.Sqrt(f); } - public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } - public int llAbs(int i) { return (int)Math.Abs(i); } - public double llFabs(double f) { return (double)Math.Abs(f); } + public double llSin(double f) + { + return (double) Math.Sin(f); + } + + public double llCos(double f) + { + return (double) Math.Cos(f); + } + + public double llTan(double f) + { + return (double) Math.Tan(f); + } + + public double llAtan2(double x, double y) + { + return (double) Math.Atan2(y, x); + } + + public double llSqrt(double f) + { + return (double) Math.Sqrt(f); + } + + public double llPow(double fbase, double fexponent) + { + return (double) Math.Pow(fbase, fexponent); + } + + public int llAbs(int i) + { + return (int) Math.Abs(i); + } + + public double llFabs(double f) + { + return (double) Math.Abs(f); + } public double llFrand(double mag) { lock (Util.RandomClass) { - return Util.RandomClass.Next((int)mag); + return Util.RandomClass.Next((int) mag); } } - public int llFloor(double f) { return (int)Math.Floor(f); } - public int llCeil(double f) { return (int)Math.Ceiling(f); } - public int llRound(double f) { return (int)Math.Round(f, 3); } + public int llFloor(double f) + { + return (int) Math.Floor(f); + } + + public int llCeil(double f) + { + return (int) Math.Ceiling(f); + } + + public int llRound(double f) + { + return (int) Math.Round(f, 3); + } //This next group are vector operations involving squaring and square root. ckrinke public double llVecMag(LSL_Types.Vector3 v) { - return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); + return (v.X*v.X + v.Y*v.Y + v.Z*v.Z); } public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) { - double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; + double mag = v.X*v.X + v.Y*v.Y + v.Z*v.Z; LSL_Types.Vector3 nor = new LSL_Types.Vector3(); - nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; + nor.X = v.X/mag; + nor.Y = v.Y/mag; + nor.Z = v.Z/mag; return nor; } public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) { - double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; - return Math.Sqrt(dx * dx + dy * dy + dz * dz); + double dx = a.X - b.X; + double dy = a.Y - b.Y; + double dz = a.Z - b.Z; + return Math.Sqrt(dx*dx + dy*dy + dz*dz); } //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) { //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke - LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); + LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X*r.X, r.Y*r.Y, r.Z*r.Z, r.R*r.R); double m = (t.X + t.Y + t.Z + t.R); if (m == 0) return new LSL_Types.Vector3(); - double n = 2 * (r.Y * r.R + r.X * r.Z); - double p = m * m - n * n; + double n = 2*(r.Y*r.R + r.X*r.Z); + double p = m*m - n*n; if (p > 0) - return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)), - Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R))); + return new LSL_Types.Vector3(Math.Atan2(2.0*(r.X*r.R - r.Y*r.Z), (-t.X - t.Y + t.Z + t.R)), + Math.Atan2(n, Math.Sqrt(p)), + Math.Atan2(2.0*(r.Z*r.R - r.X*r.Y), (t.X - t.Y - t.Z + t.R))); else if (n > 0) - return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); + return new LSL_Types.Vector3(0.0, Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z)); else - return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); + return new LSL_Types.Vector3(0.0, -Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z)); } public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) { //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 float err = 0.00001f; - double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); - double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); - double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); + double ax = Math.Sin(v.X/2); + double aw = Math.Cos(v.X/2); + double by = Math.Sin(v.Y/2); + double bw = Math.Cos(v.Y/2); + double cz = Math.Sin(v.Z/2); + double cw = Math.Cos(v.Z/2); LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); LSL_Types.Quaternion a = new LSL_Types.Quaternion(); //This multiplication doesnt compile, yet. a = a1 * a2 * a3; - LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, - aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); + LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz, + aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw, + aw*bw*cw - ax*by*cz); LSL_Types.Quaternion c = new LSL_Types.Quaternion(); //This addition doesnt compile yet c = a + b; LSL_Types.Quaternion d = new LSL_Types.Quaternion(); @@ -191,359 +240,946 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler // return b; // return a; } - return new LSL_Types.Quaternion(); + return new LSL_Types.Quaternion(); + } + + public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) + { + return new LSL_Types.Quaternion(); + } + + public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) + { + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) + { + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) + { + return new LSL_Types.Vector3(); + } + + public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) + { + return new LSL_Types.Quaternion(); + } + + public void llWhisper(int channelID, string text) + { + //type for whisper is 0 + World.SimChat(Helpers.StringToField(text), + 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); + + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + wComm.DeliverMessage(m_host.UUID.ToString(), 0, channelID, m_host.Name, text); + } + + public void llSay(int channelID, string text) + { + //type for say is 1 + World.SimChat(Helpers.StringToField(text), + 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); + + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text); + } + + public void llShout(int channelID, string text) + { + //type for shout is 2 + World.SimChat(Helpers.StringToField(text), + 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); + + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text); + } + + public int llListen(int channelID, string name, string ID, string msg) + { + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg); + } + + public void llListenControl(int number, int active) + { + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + wComm.ListenControl(number, active); + } + + public void llListenRemove(int number) + { + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + wComm.ListenRemove(number); + } + + public void llSensor(string name, string id, int type, double range, double arc) + { + NotImplemented("llSensor"); + return; + } + + public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) + { + NotImplemented("llSensorRepeat"); + return; + } + + public void llSensorRemove() + { + NotImplemented("llSensorRemove"); + return; + } + + public string llDetectedName(int number) + { + NotImplemented("llDetectedName"); + return ""; + } + + public string llDetectedKey(int number) + { + NotImplemented("llDetectedKey"); + return ""; + } + + public string llDetectedOwner(int number) + { + NotImplemented("llDetectedOwner"); + return ""; + } + + public int llDetectedType(int number) + { + NotImplemented("llDetectedType"); + return 0; + } + + public LSL_Types.Vector3 llDetectedPos(int number) + { + NotImplemented("llDetectedPos"); + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llDetectedVel(int number) + { + NotImplemented("llDetectedVel"); + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llDetectedGrab(int number) + { + NotImplemented("llDetectedGrab"); + return new LSL_Types.Vector3(); + } + + public LSL_Types.Quaternion llDetectedRot(int number) + { + NotImplemented("llDetectedRot"); + return new LSL_Types.Quaternion(); + } + + public int llDetectedGroup(int number) + { + NotImplemented("llDetectedGroup"); + return 0; + } + + public int llDetectedLinkNumber(int number) + { + NotImplemented("llDetectedLinkNumber"); + return 0; + } + + public void llDie() + { + NotImplemented("llDie"); + return; + } + + public double llGround(LSL_Types.Vector3 offset) + { + NotImplemented("llGround"); + return 0; + } + + public double llCloud(LSL_Types.Vector3 offset) + { + NotImplemented("llCloud"); + return 0; + } + + public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) + { + NotImplemented("llWind"); + return new LSL_Types.Vector3(); + } + + public void llSetStatus(int status, int value) + { + NotImplemented("llSetStatus"); + return; + } + + public int llGetStatus(int status) + { + NotImplemented("llGetStatus"); + return 0; + } + + public void llSetScale(LSL_Types.Vector3 scale) + { + // TODO: this needs to trigger a persistance save as well + LLVector3 tmp = m_host.Scale; + tmp.X = (float) scale.X; + tmp.Y = (float) scale.Y; + tmp.Z = (float) scale.Z; + m_host.Scale = tmp; + return; + } + + public LSL_Types.Vector3 llGetScale() + { + return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); + } + + public void llSetColor(LSL_Types.Vector3 color, int face) + { + NotImplemented("llSetColor"); + return; + } + + public double llGetAlpha(int face) + { + NotImplemented("llGetAlpha"); + return 0; + } + + public void llSetAlpha(double alpha, int face) + { + NotImplemented("llSetAlpha"); + return; + } + + public LSL_Types.Vector3 llGetColor(int face) + { + NotImplemented("llGetColor"); + return new LSL_Types.Vector3(); + } + + public void llSetTexture(string texture, int face) + { + NotImplemented("llSetTexture"); + return; + } + + public void llScaleTexture(double u, double v, int face) + { + NotImplemented("llScaleTexture"); + return; + } + + public void llOffsetTexture(double u, double v, int face) + { + NotImplemented("llOffsetTexture"); + return; + } + + public void llRotateTexture(double rotation, int face) + { + NotImplemented("llRotateTexture"); + return; + } + + public string llGetTexture(int face) + { + NotImplemented("llGetTexture"); + return ""; + } + + public void llSetPos(LSL_Types.Vector3 pos) + { + if (m_host.ParentID != 0) + { + m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); + } + else + { + m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z)); + } + } + + public LSL_Types.Vector3 llGetPos() + { + return new LSL_Types.Vector3(m_host.AbsolutePosition.X, + m_host.AbsolutePosition.Y, + m_host.AbsolutePosition.Z); + } + + public LSL_Types.Vector3 llGetLocalPos() + { + if (m_host.ParentID != 0) + { + return new LSL_Types.Vector3(m_host.OffsetPosition.X, + m_host.OffsetPosition.Y, + m_host.OffsetPosition.Z); + } + else + { + return new LSL_Types.Vector3(m_host.AbsolutePosition.X, + m_host.AbsolutePosition.Y, + m_host.AbsolutePosition.Z); + } + } + + public void llSetRot(LSL_Types.Quaternion rot) + { + m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R)); + } + + public LSL_Types.Quaternion llGetRot() + { + LLQuaternion q = m_host.RotationOffset; + return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); + } + + public LSL_Types.Quaternion llGetLocalRot() + { + NotImplemented("llGetLocalRot"); + return new LSL_Types.Quaternion(); + } + + public void llSetForce(LSL_Types.Vector3 force, int local) + { + NotImplemented("llSetForce"); + } + + public LSL_Types.Vector3 llGetForce() + { + NotImplemented("llGetForce"); + return new LSL_Types.Vector3(); + } + + public int llTarget(LSL_Types.Vector3 position, double range) + { + NotImplemented("llTarget"); + return 0; + } + + public void llTargetRemove(int number) + { + NotImplemented("llTargetRemove"); + } + + public int llRotTarget(LSL_Types.Quaternion rot, double error) + { + NotImplemented("llRotTarget"); + return 0; + } + + public void llRotTargetRemove(int number) + { + NotImplemented("llRotTargetRemove"); + } + + public void llMoveToTarget(LSL_Types.Vector3 target, double tau) + { + NotImplemented("llMoveToTarget"); + } + + public void llStopMoveToTarget() + { + NotImplemented("llStopMoveToTarget"); + } + + public void llApplyImpulse(LSL_Types.Vector3 force, int local) + { + NotImplemented("llApplyImpulse"); + } + + public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) + { + NotImplemented("llApplyRotationalImpulse"); + } + + public void llSetTorque(LSL_Types.Vector3 torque, int local) + { + NotImplemented("llSetTorque"); + } + + public LSL_Types.Vector3 llGetTorque() + { + NotImplemented("llGetTorque"); + return new LSL_Types.Vector3(); + } + + public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) + { + NotImplemented("llSetForceAndTorque"); + } + + public LSL_Types.Vector3 llGetVel() + { + NotImplemented("llGetVel"); + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llGetAccel() + { + NotImplemented("llGetAccel"); + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llGetOmega() + { + NotImplemented("llGetOmega"); + return new LSL_Types.Vector3(); + } + + public double llGetTimeOfDay() + { + NotImplemented("llGetTimeOfDay"); + return 0; + } + + public double llGetWallclock() + { + return DateTime.Now.TimeOfDay.TotalSeconds; + } + + public double llGetTime() + { + NotImplemented("llGetTime"); + return 0; + } + + public void llResetTime() + { + NotImplemented("llResetTime"); + } + + public double llGetAndResetTime() + { + NotImplemented("llGetAndResetTime"); + return 0; + } + + public void llSound() + { + NotImplemented("llSound"); + } + + public void llPlaySound(string sound, double volume) + { + NotImplemented("llPlaySound"); + } + + public void llLoopSound(string sound, double volume) + { + NotImplemented("llLoopSound"); + } + + public void llLoopSoundMaster(string sound, double volume) + { + NotImplemented("llLoopSoundMaster"); + } + + public void llLoopSoundSlave(string sound, double volume) + { + NotImplemented("llLoopSoundSlave"); + } + + public void llPlaySoundSlave(string sound, double volume) + { + NotImplemented("llPlaySoundSlave"); + } + + public void llTriggerSound(string sound, double volume) + { + NotImplemented("llTriggerSound"); + } + + public void llStopSound() + { + NotImplemented("llStopSound"); + } + + public void llPreloadSound(string sound) + { + NotImplemented("llPreloadSound"); + } + + public string llGetSubString(string src, int start, int end) + { + return src.Substring(start, end); + } + + public string llDeleteSubString(string src, int start, int end) + { + return src.Remove(start, end - start); + } + + public string llInsertString(string dst, int position, string src) + { + return dst.Insert(position, src); + } + + public string llToUpper(string src) + { + return src.ToUpper(); + } + + public string llToLower(string src) + { + return src.ToLower(); + } + + public int llGiveMoney(string destination, int amount) + { + NotImplemented("llGiveMoney"); + return 0; + } + + public void llMakeExplosion() + { + NotImplemented("llMakeExplosion"); + } + + public void llMakeFountain() + { + NotImplemented("llMakeFountain"); + } + + public void llMakeSmoke() + { + NotImplemented("llMakeSmoke"); + } + + public void llMakeFire() + { + NotImplemented("llMakeFire"); + } + + public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) + { + NotImplemented("llRezObject"); + } + + public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) + { + NotImplemented("llLookAt"); + } + + public void llStopLookAt() + { + NotImplemented("llStopLookAt"); + } + + public void llSetTimerEvent(double sec) + { + // Setting timer repeat + m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); + } + + public void llSleep(double sec) + { + Thread.Sleep((int) (sec*1000)); + } + + public double llGetMass() + { + NotImplemented("llGetMass"); + return 0; + } + + public void llCollisionFilter(string name, string id, int accept) + { + NotImplemented("llCollisionFilter"); + } + + public void llTakeControls(int controls, int accept, int pass_on) + { + NotImplemented("llTakeControls"); + } + + public void llReleaseControls() + { + NotImplemented("llReleaseControls"); + } + + public void llAttachToAvatar(int attachment) + { + NotImplemented("llAttachToAvatar"); + } + + public void llDetachFromAvatar() + { + NotImplemented("llDetachFromAvatar"); + } + + public void llTakeCamera() + { + NotImplemented("llTakeCamera"); + } + + public void llReleaseCamera() + { + NotImplemented("llReleaseCamera"); + } + + public string llGetOwner() + { + return m_host.ObjectOwner.ToStringHyphenated(); + } + + public void llInstantMessage(string user, string message) + { + NotImplemented("llInstantMessage"); + } + + public void llEmail(string address, string subject, string message) + { + NotImplemented("llEmail"); + } + + public void llGetNextEmail(string address, string subject) + { + NotImplemented("llGetNextEmail"); + } + + public string llGetKey() + { + return m_host.UUID.ToStringHyphenated(); + } + + public void llSetBuoyancy(double buoyancy) + { + NotImplemented("llSetBuoyancy"); + } + + public void llSetHoverHeight(double height, int water, double tau) + { + NotImplemented("llSetHoverHeight"); + } + + public void llStopHover() + { + NotImplemented("llStopHover"); + } + + public void llMinEventDelay(double delay) + { + NotImplemented("llMinEventDelay"); + } + + public void llSoundPreload() + { + NotImplemented("llSoundPreload"); + } + + public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) + { + NotImplemented("llRotLookAt"); + } + + public int llStringLength(string str) + { + if (str.Length > 0) + { + return str.Length; + } + else + { + return 0; + } } - public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } - public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } - public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } - - public void llWhisper(int channelID, string text) + public void llStartAnimation(string anim) { - //type for whisper is 0 - World.SimChat(Helpers.StringToField(text), - 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); + NotImplemented("llStartAnimation"); + } - IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.DeliverMessage(m_host.UUID.ToString(), 0, channelID, m_host.Name, text); + public void llStopAnimation(string anim) + { + NotImplemented("llStopAnimation"); } - public void llSay(int channelID, string text) + public void llPointAt() { - //type for say is 1 - World.SimChat(Helpers.StringToField(text), - 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); + NotImplemented("llPointAt"); + } - IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text); + public void llStopPointAt() + { + NotImplemented("llStopPointAt"); } - public void llShout(int channelID, string text) + public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { - //type for shout is 2 - World.SimChat(Helpers.StringToField(text), - 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); + NotImplemented("llTargetOmega"); + } - IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text); + public int llGetStartParameter() + { + NotImplemented("llGetStartParameter"); + return 0; } - public int llListen(int channelID, string name, string ID, string msg) { + public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) + { + NotImplemented("llGodLikeRezObject"); + } - IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg); - + public void llRequestPermissions(string agent, int perm) + { + NotImplemented("llRequestPermissions"); } - public void llListenControl(int number, int active) { + public string llGetPermissionsKey() + { + NotImplemented("llGetPermissionsKey"); + return ""; + } - IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.ListenControl(number, active); - + public int llGetPermissions() + { + NotImplemented("llGetPermissions"); + return 0; } - public void llListenRemove(int number) { + public int llGetLinkNumber() + { + NotImplemented("llGetLinkNumber"); + return 0; + } - IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.ListenRemove(number); - - } - - public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } - public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } - public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } - public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } - public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } - public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } - public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } - public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } - public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } - public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } - public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } - public void llDie() { NotImplemented("llDie"); return; } - public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } - public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } - public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } - public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } - public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } + public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) + { + NotImplemented("llSetLinkColor"); + } - public void llSetScale(LSL_Types.Vector3 scale) + public void llCreateLink(string target, int parent) { - // TODO: this needs to trigger a persistance save as well - LLVector3 tmp = m_host.Scale; - tmp.X = (float)scale.X; - tmp.Y = (float)scale.Y; - tmp.Z = (float)scale.Z; - m_host.Scale = tmp; - return; + NotImplemented("llCreateLink"); } - public LSL_Types.Vector3 llGetScale() + + public void llBreakLink(int linknum) { - return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); + NotImplemented("llBreakLink"); } - public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } - public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } - public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } - public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } - public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } - public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } - public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } - public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } + public void llBreakAllLinks() + { + NotImplemented("llBreakAllLinks"); + } - public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } + public string llGetLinkKey(int linknum) + { + NotImplemented("llGetLinkKey"); + return ""; + } - public void llSetPos(LSL_Types.Vector3 pos) + public void llGetLinkName(int linknum) { - if (m_host.ParentID != 0) - { - m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); - } - else - { - m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); - } + NotImplemented("llGetLinkName"); } - public LSL_Types.Vector3 llGetPos() + public int llGetInventoryNumber(int type) { - return new LSL_Types.Vector3(m_host.AbsolutePosition.X, - m_host.AbsolutePosition.Y, - m_host.AbsolutePosition.Z); + NotImplemented("llGetInventoryNumber"); + return 0; } - public LSL_Types.Vector3 llGetLocalPos() + public string llGetInventoryName(int type, int number) { - if (m_host.ParentID != 0) - { - return new LSL_Types.Vector3(m_host.OffsetPosition.X, - m_host.OffsetPosition.Y, - m_host.OffsetPosition.Z); - } - else - { - return new LSL_Types.Vector3(m_host.AbsolutePosition.X, - m_host.AbsolutePosition.Y, - m_host.AbsolutePosition.Z); - } + NotImplemented("llGetInventoryName"); + return ""; } - public void llSetRot(LSL_Types.Quaternion rot) + + public void llSetScriptState(string name, int run) { - m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); + NotImplemented("llSetScriptState"); } - public LSL_Types.Quaternion llGetRot() + + public double llGetEnergy() { - LLQuaternion q = m_host.RotationOffset; - return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); + return 1.0f; } - public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } - public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } - public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } - public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } - public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } - public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } - public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } - public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } - public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } - public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } - public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } - public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } - public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } - public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } - public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } - public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } - public double llGetWallclock() + public void llGiveInventory(string destination, string inventory) { - return DateTime.Now.TimeOfDay.TotalSeconds; + NotImplemented("llGiveInventory"); } - public double llGetTime() { NotImplemented("llGetTime"); return 0; } - public void llResetTime() { NotImplemented("llResetTime"); } - public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } - public void llSound() { NotImplemented("llSound"); } - public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } - public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } - public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } - public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } - public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } - public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } - public void llStopSound() { NotImplemented("llStopSound"); } - public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } + public void llRemoveInventory(string item) + { + NotImplemented("llRemoveInventory"); + } - public string llGetSubString(string src, int start, int end) + public void llSetText(string text, LSL_Types.Vector3 color, double alpha) { - return src.Substring(start, end); + Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z); + m_host.SetText(text, av3, alpha); } - public string llDeleteSubString(string src, int start, int end) + + public double llWater(LSL_Types.Vector3 offset) { - return src.Remove(start, end - start); + NotImplemented("llWater"); + return 0; } - public string llInsertString(string dst, int position, string src) + + public void llPassTouches(int pass) { - return dst.Insert(position, src); + NotImplemented("llPassTouches"); } - public string llToUpper(string src) + + public string llRequestAgentData(string id, int data) { - return src.ToUpper(); + NotImplemented("llRequestAgentData"); + return ""; } - public string llToLower(string src) + public string llRequestInventoryData(string name) { - return src.ToLower(); + NotImplemented("llRequestInventoryData"); + return ""; } - public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } - public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } - public void llMakeFountain() { NotImplemented("llMakeFountain"); } - public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } - public void llMakeFire() { NotImplemented("llMakeFire"); } - public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } - public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } - public void llStopLookAt() { NotImplemented("llStopLookAt"); } + public void llSetDamage(double damage) + { + NotImplemented("llSetDamage"); + } - public void llSetTimerEvent(double sec) + public void llTeleportAgentHome(string agent) { - // Setting timer repeat - m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); + NotImplemented("llTeleportAgentHome"); } - public void llSleep(double sec) + public void llModifyLand(int action, int brush) { - System.Threading.Thread.Sleep((int)(sec * 1000)); } - public double llGetMass() { NotImplemented("llGetMass"); return 0; } - public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } - public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } - public void llReleaseControls() { NotImplemented("llReleaseControls"); } - public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); } - public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); } - public void llTakeCamera() { NotImplemented("llTakeCamera"); } - public void llReleaseCamera() { NotImplemented("llReleaseCamera"); } + public void llCollisionSound(string impact_sound, double impact_volume) + { + NotImplemented("llCollisionSound"); + } - public string llGetOwner() + public void llCollisionSprite(string impact_sprite) { - return m_host.ObjectOwner.ToStringHyphenated(); + NotImplemented("llCollisionSprite"); } - public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } - public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } - public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } + public string llGetAnimation(string id) + { + NotImplemented("llGetAnimation"); + return ""; + } - public string llGetKey() + public void llResetScript() { - return m_host.UUID.ToStringHyphenated(); + m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); } - public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } - public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } - public void llStopHover() { NotImplemented("llStopHover"); } - public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } - public void llSoundPreload() { NotImplemented("llSoundPreload"); } - public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } + public void llMessageLinked(int linknum, int num, string str, string id) + { + } - public int llStringLength(string str) + public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { - if (str.Length > 0) - { - return str.Length; - } - else - { - return 0; - } } - public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } - public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } - public void llPointAt() { NotImplemented("llPointAt"); } - public void llStopPointAt() { NotImplemented("llStopPointAt"); } - public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } - public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } - public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } - public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } - public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } - public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } - public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } - public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } - public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } - public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } - public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } - public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } - public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } - public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } - public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } - public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } - public double llGetEnergy() { return 1.0f; } - public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } - public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } + public void llPassCollisions(int pass) + { + } - public void llSetText(string text, LSL_Types.Vector3 color, double alpha) + public string llGetScriptName() { - Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); - m_host.SetText(text, av3, alpha); + return ""; } + public int llGetNumberOfSides() + { + return 0; + } - public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } - public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } - public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } - public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } - public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } - public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } - public void llModifyLand(int action, int brush) { } - public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } - public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } - public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } - public void llResetScript() + public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { - m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); + return new LSL_Types.Quaternion(); } - public void llMessageLinked(int linknum, int num, string str, string id) { } - public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } - public void llPassCollisions(int pass) { } - public string llGetScriptName() { return ""; } - public int llGetNumberOfSides() { return 0; } + public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) + { + return new LSL_Types.Vector3(); + } - public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } - public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } - public void llRot2Angle() { } + public void llRot2Angle() + { + } public double llAcos(double val) { - return (double)Math.Acos(val); + return (double) Math.Acos(val); } public double llAsin(double val) { - return (double)Math.Asin(val); + return (double) Math.Asin(val); + } + + public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) + { + return 0; } - public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } - public string llGetInventoryKey(string name) { return ""; } - public void llAllowInventoryDrop(int add) { } - public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } - public double llGetTextureRot(int side) { return 0; } + public string llGetInventoryKey(string name) + { + return ""; + } + + public void llAllowInventoryDrop(int add) + { + } + + public LSL_Types.Vector3 llGetSunDirection() + { + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llGetTextureOffset(int face) + { + return new LSL_Types.Vector3(); + } + + public LSL_Types.Vector3 llGetTextureScale(int side) + { + return new LSL_Types.Vector3(); + } + + public double llGetTextureRot(int side) + { + return 0; + } public int llSubStringIndex(string source, string pattern) { return source.IndexOf(pattern); } - public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } + public string llGetOwnerKey(string id) + { + NotImplemented("llGetOwnerKey"); + return ""; + } - public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } + public LSL_Types.Vector3 llGetCenterOfMass() + { + NotImplemented("llGetCenterOfMass"); + return new LSL_Types.Vector3(); + } public List llListSort(List src, int stride, int ascending) { @@ -577,7 +1213,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler ret.AddRange(ls); } - if (ascending == LSL.LSL_BaseClass.TRUE) + if (ascending == LSL_BaseClass.TRUE) return ret; ret.Reverse(); return ret; @@ -616,12 +1252,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public LSL_Types.Vector3 llList2Vector(List src, int index) { - return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); + return + new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), + double.Parse(src[index + 2])); } + public LSL_Types.Quaternion llList2Rot(List src, int index) { - return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); + return + new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), + double.Parse(src[index + 2]), double.Parse(src[index + 3])); } + public List llList2List(List src, int start, int end) { if (end > start) @@ -638,18 +1280,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler ret.AddRange(src.GetRange(0, end)); return ret; } - - - - } + public List llDeleteSubList(List src, int start, int end) { List ret = new List(src); ret.RemoveRange(start, end - start); return ret; } - public int llGetListEntryType(List src, int index) { NotImplemented("llGetListEntryType"); return 0; } + + public int llGetListEntryType(List src, int index) + { + NotImplemented("llGetListEntryType"); + return 0; + } + public string llList2CSV(List src) { string ret = ""; @@ -661,6 +1306,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler } return ret; } + public List llCSV2List(string src) { List ret = new List(); @@ -670,6 +1316,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler } return ret; } + public List llListRandomize(List src, int stride) { int s = stride; @@ -711,9 +1358,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler } return ret; - - } + public List llList2ListStrided(List src, int start, int end, int stride) { List ret = new List(); @@ -739,12 +1385,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public LSL_Types.Vector3 llGetRegionCorner() { - return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); + return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0); } public List llListInsertList(List dest, List src, int start) { - List ret = new List(dest); //foreach (string s in src.Reverse()) for (int ci = src.Count - 1; ci > -1; ci--) @@ -753,68 +1398,170 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler } return ret; } + public int llListFindList(List src, List test) { - foreach (string s in test) - { - for (int ci = 0; ci < src.Count; ci++) - { + foreach (string s in test) + { + for (int ci = 0; ci < src.Count; ci++) + { + if (s == src[ci]) + return ci; + } + } + return -1; + } + + public string llGetObjectName() + { + return m_host.Name; + } + + public void llSetObjectName(string name) + { + m_host.Name = name; + } + + public string llGetDate() + { + DateTime date = DateTime.Now.ToUniversalTime(); + string result = date.ToString("yyyy-MM-dd"); + return result; + } + + public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) + { + NotImplemented("llEdgeOfWorld"); + return 0; + } + + public int llGetAgentInfo(string id) + { + NotImplemented("llGetAgentInfo"); + return 0; + } + + public void llAdjustSoundVolume(double volume) + { + NotImplemented("llAdjustSoundVolume"); + } + + public void llSetSoundQueueing(int queue) + { + NotImplemented("llSetSoundQueueing"); + } + + public void llSetSoundRadius(double radius) + { + NotImplemented("llSetSoundRadius"); + } + + public string llKey2Name(string id) + { + NotImplemented("llKey2Name"); + return ""; + } + + public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) + { + NotImplemented("llSetTextureAnim"); + } + + public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, + LSL_Types.Vector3 bottom_south_west) + { + NotImplemented("llTriggerSoundLimited"); + } + + public void llEjectFromLand(string pest) + { + NotImplemented("llEjectFromLand"); + } + + public void llParseString2List() + { + NotImplemented("llParseString2List"); + } + + public int llOverMyLand(string id) + { + NotImplemented("llOverMyLand"); + return 0; + } + + public string llGetLandOwnerAt(LSL_Types.Vector3 pos) + { + NotImplemented("llGetLandOwnerAt"); + return ""; + } + + public string llGetNotecardLine(string name, int line) + { + NotImplemented("llGetNotecardLine"); + return ""; + } + + public LSL_Types.Vector3 llGetAgentSize(string id) + { + NotImplemented("llGetAgentSize"); + return new LSL_Types.Vector3(); + } + + public int llSameGroup(string agent) + { + NotImplemented("llSameGroup"); + return 0; + } + + public void llUnSit(string id) + { + NotImplemented("llUnSit"); + } - if (s == src[ci]) - return ci; - } - } - return -1; + public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) + { + NotImplemented("llGroundSlope"); + return new LSL_Types.Vector3(); } - public string llGetObjectName() + public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { - return m_host.Name; + NotImplemented("llGroundNormal"); + return new LSL_Types.Vector3(); } - public void llSetObjectName(string name) + public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { - m_host.Name = name; + NotImplemented("llGroundContour"); + return new LSL_Types.Vector3(); } - public string llGetDate() + public int llGetAttached() { - DateTime date = DateTime.Now.ToUniversalTime(); - string result = date.ToString("yyyy-MM-dd"); - return result; + NotImplemented("llGetAttached"); + return 0; } - public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } - public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } - public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } - public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } - public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } - public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } - public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } - public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } - public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } - - public void llParseString2List() { NotImplemented("llParseString2List"); } - - public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } - public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } - public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } - public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } - public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } - public void llUnSit(string id) { NotImplemented("llUnSit"); } - public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } - public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } - public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } - public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } + public int llGetFreeMemory() + { + NotImplemented("llGetFreeMemory"); + return 0; + } public string llGetRegionName() { return World.RegionInfo.RegionName; } - public double llGetRegionTimeDilation() { return 1.0f; } - public double llGetRegionFPS() { return 10.0f; } + public double llGetRegionTimeDilation() + { + return 1.0f; + } + + public double llGetRegionFPS() + { + return 10.0f; + } /* particle system rules should be coming into this routine as doubles, that is rule[0] should be an integer from this list and rule[1] should be the arg @@ -824,6 +1571,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler We iterate through the list for 'Count' elements, incrementing by two for each iteration and set the members of Primitive.ParticleSystem, one at a time. */ + public enum PrimitiveRule : int { PSYS_PART_FLAGS = 0, @@ -854,109 +1602,152 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); for (int i = 0; i < rules.Count; i += 2) { - switch ((int)rules[i]) + switch ((int) rules[i]) { - case (int)PrimitiveRule.PSYS_PART_FLAGS: - prules.PartFlags = (uint)rules[i + 1]; + case (int) PrimitiveRule.PSYS_PART_FLAGS: + prules.PartFlags = (uint) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_PART_START_COLOR: - prules.PartStartColor = (LLColor)rules[i + 1]; + case (int) PrimitiveRule.PSYS_PART_START_COLOR: + prules.PartStartColor = (LLColor) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_PART_START_ALPHA: + case (int) PrimitiveRule.PSYS_PART_START_ALPHA: //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_PART_END_COLOR: - prules.PartEndColor = (LLColor)rules[i + 1]; + case (int) PrimitiveRule.PSYS_PART_END_COLOR: + prules.PartEndColor = (LLColor) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_PART_END_ALPHA: + case (int) PrimitiveRule.PSYS_PART_END_ALPHA: //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_PART_START_SCALE: + case (int) PrimitiveRule.PSYS_PART_START_SCALE: //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_PART_END_SCALE: + case (int) PrimitiveRule.PSYS_PART_END_SCALE: //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_PART_MAX_AGE: - prules.MaxAge = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_PART_MAX_AGE: + prules.MaxAge = (float) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_ACCEL: + case (int) PrimitiveRule.PSYS_SRC_ACCEL: //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_PATTERN: + case (int) PrimitiveRule.PSYS_SRC_PATTERN: //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_TEXTURE: - prules.Texture = (LLUUID)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_TEXTURE: + prules.Texture = (LLUUID) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: - prules.BurstRate = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_BURST_RATE: + prules.BurstRate = (float) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: - prules.BurstPartCount = (byte)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: + prules.BurstPartCount = (byte) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: - prules.BurstRadius = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS: + prules.BurstRadius = (float) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: - prules.BurstSpeedMin = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: + prules.BurstSpeedMin = (float) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: - prules.BurstSpeedMax = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: + prules.BurstSpeedMax = (float) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: - prules.MaxAge = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_MAX_AGE: + prules.MaxAge = (float) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: - prules.Target = (LLUUID)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY: + prules.Target = (LLUUID) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_OMEGA: + case (int) PrimitiveRule.PSYS_SRC_OMEGA: //cast?? prules.MaxAge = (float)rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: - prules.InnerAngle = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: + prules.InnerAngle = (float) rules[i + 1]; break; - case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: - prules.OuterAngle = (float)rules[i + 1]; + case (int) PrimitiveRule.PSYS_SRC_ANGLE_END: + prules.OuterAngle = (float) rules[i + 1]; break; - } } m_host.AddNewParticleSystem(prules); } - public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } - public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } - public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } - public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } - public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } - public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } - public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } - public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } - public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } - public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } - public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } + public void llGroundRepel(double height, int water, double tau) + { + NotImplemented("llGroundRepel"); + } + + public void llGiveInventoryList() + { + NotImplemented("llGiveInventoryList"); + } + + public void llSetVehicleType(int type) + { + NotImplemented("llSetVehicleType"); + } + + public void llSetVehicledoubleParam(int param, double value) + { + NotImplemented("llSetVehicledoubleParam"); + } + + public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) + { + NotImplemented("llSetVehicleVectorParam"); + } + + public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) + { + NotImplemented("llSetVehicleRotationParam"); + } + + public void llSetVehicleFlags(int flags) + { + NotImplemented("llSetVehicleFlags"); + } + + public void llRemoveVehicleFlags(int flags) + { + NotImplemented("llRemoveVehicleFlags"); + } + + public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) + { + NotImplemented("llSitTarget"); + } + + public string llAvatarOnSitTarget() + { + NotImplemented("llAvatarOnSitTarget"); + return ""; + } + + public void llAddToLandPassList(string avatar, double hours) + { + NotImplemented("llAddToLandPassList"); + } public void llSetTouchText(string text) { @@ -968,49 +1759,91 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler m_host.SitName = text; } - public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } - public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } - public void llDumpList2String() { NotImplemented("llDumpList2String"); } - public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } - public void llDialog(string avatar, string message, List buttons, int chat_channel) { NotImplemented("llDialog"); } - public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); } - public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); } + public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) + { + NotImplemented("llSetCameraEyeOffset"); + } + + public void llSetCameraAtOffset(LSL_Types.Vector3 offset) + { + NotImplemented("llSetCameraAtOffset"); + } + + public void llDumpList2String() + { + NotImplemented("llDumpList2String"); + } + + public void llScriptDanger(LSL_Types.Vector3 pos) + { + NotImplemented("llScriptDanger"); + } + + public void llDialog(string avatar, string message, List buttons, int chat_channel) + { + NotImplemented("llDialog"); + } + + public void llVolumeDetect(int detect) + { + NotImplemented("llVolumeDetect"); + } + + public void llResetOtherScript(string name) + { + NotImplemented("llResetOtherScript"); + } + + public int llGetScriptState(string name) + { + NotImplemented("llGetScriptState"); + return 0; + } - public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } + public void llRemoteLoadScript() + { + NotImplemented("llRemoteLoadScript"); + } + + public void llSetRemoteScriptAccessPin(int pin) + { + NotImplemented("llSetRemoteScriptAccessPin"); + } - public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } - public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } - public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } + public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) + { + NotImplemented("llRemoteLoadScriptPin"); + } // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) // Not sure where these constants should live: // REMOTE_DATA_CHANNEL = 1 // REMOTE_DATA_REQUEST = 2 // REMOTE_DATA_REPLY = 3 - public void llOpenRemoteDataChannel() { - + public void llOpenRemoteDataChannel() + { IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); - object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, "" }; + object[] resobj = new object[] {1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, ""}; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj); - } - public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } + public string llSendRemoteData(string channel, string dest, int idata, string sdata) + { + NotImplemented("llSendRemoteData"); + return ""; + } public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { - IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); - } - - public void llCloseRemoteDataChannel(string channel) { + public void llCloseRemoteDataChannel(string channel) + { IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); xmlrpcMod.CloseXMLRPCChannel(channel); - } public string llMD5String(string src, int nonce) @@ -1018,14 +1851,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler return Util.Md5Hash(src + ":" + nonce.ToString()); } - public void llSetPrimitiveParams(List rules) { NotImplemented("llSetPrimitiveParams"); } - public string llStringToBase64(string str) + public void llSetPrimitiveParams(List rules) { + NotImplemented("llSetPrimitiveParams"); + } + public string llStringToBase64(string str) + { try { byte[] encData_byte = new byte[str.Length]; - encData_byte = System.Text.Encoding.UTF8.GetBytes(str); + encData_byte = Encoding.UTF8.GetBytes(str); string encodedData = Convert.ToBase64String(encData_byte); return encodedData; } @@ -1037,11 +1873,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public string llBase64ToString(string str) { - System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); - System.Text.Decoder utf8Decode = encoder.GetDecoder(); + UTF8Encoding encoder = new UTF8Encoding(); + Decoder utf8Decode = encoder.GetDecoder(); try { - byte[] todecode_byte = Convert.FromBase64String(str); int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); char[] decoded_char = new char[charCount]; @@ -1054,16 +1889,49 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler throw new Exception("Error in base64Decode" + e.Message); } } - public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); } - public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } - public double llLog10(double val) { return (double)Math.Log10(val); } - public double llLog(double val) { return (double)Math.Log(val); } - public List llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List(); } - public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); } - public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } + public void llXorBase64Strings() + { + throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); + } + + public void llRemoteDataSetRegion() + { + NotImplemented("llRemoteDataSetRegion"); + } + + public double llLog10(double val) + { + return (double) Math.Log10(val); + } + + public double llLog(double val) + { + return (double) Math.Log(val); + } + + public List llGetAnimationList(string id) + { + NotImplemented("llGetAnimationList"); + return new List(); + } + + public void llSetParcelMusicURL(string url) + { + NotImplemented("llSetParcelMusicURL"); + } + + public LSL_Types.Vector3 llGetRootPosition() + { + NotImplemented("llGetRootPosition"); + return new LSL_Types.Vector3(); + } - public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } + public LSL_Types.Quaternion llGetRootRotation() + { + NotImplemented("llGetRootRotation"); + return new LSL_Types.Quaternion(); + } public string llGetObjectDesc() { @@ -1080,20 +1948,55 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler return m_host.ObjectCreator.ToStringHyphenated(); } - public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } - public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } - public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } - public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } - public List llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List(); } - public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } - public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } + public string llGetTimestamp() + { + return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); + } + + public void llSetLinkAlpha(int linknumber, double alpha, int face) + { + NotImplemented("llSetLinkAlpha"); + } + + public int llGetNumberOfPrims() + { + NotImplemented("llGetNumberOfPrims"); + return 0; + } + + public string llGetNumberOfNotecardLines(string name) + { + NotImplemented("llGetNumberOfNotecardLines"); + return ""; + } + + public List llGetBoundingBox(string obj) + { + NotImplemented("llGetBoundingBox"); + return new List(); + } + + public LSL_Types.Vector3 llGetGeometricCenter() + { + NotImplemented("llGetGeometricCenter"); + return new LSL_Types.Vector3(); + } + + public void llGetPrimitiveParams() + { + NotImplemented("llGetPrimitiveParams"); + } + public string llIntegerToBase64(int number) { - NotImplemented("llIntegerToBase64"); return ""; + NotImplemented("llIntegerToBase64"); + return ""; } + public int llBase64ToInteger(string str) { - NotImplemented("llBase64ToInteger"); return 0; + NotImplemented("llBase64ToInteger"); + return 0; } public double llGetGMTclock() @@ -1106,31 +2009,92 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler return System.Environment.MachineName; } - public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } - public List llParseStringKeepNulls(string src, List seperators, List spacers) { NotImplemented("llParseStringKeepNulls"); return new List(); } - public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } + public void llSetLocalRot(LSL_Types.Quaternion rot) + { + NotImplemented("llSetLocalRot"); + } + + public List llParseStringKeepNulls(string src, List seperators, List spacers) + { + NotImplemented("llParseStringKeepNulls"); + return new List(); + } + + public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, + LSL_Types.Quaternion rot, int param) + { + NotImplemented("llRezAtRoot"); + } + + public int llGetObjectPermMask(int mask) + { + NotImplemented("llGetObjectPermMask"); + return 0; + } + + public void llSetObjectPermMask(int mask, int value) + { + NotImplemented("llSetObjectPermMask"); + } + + public void llGetInventoryPermMask(string item, int mask) + { + NotImplemented("llGetInventoryPermMask"); + } + + public void llSetInventoryPermMask(string item, int mask, int value) + { + NotImplemented("llSetInventoryPermMask"); + } + + public string llGetInventoryCreator(string item) + { + NotImplemented("llGetInventoryCreator"); + return ""; + } + + public void llOwnerSay(string msg) + { + NotImplemented("llOwnerSay"); + } + + public void llRequestSimulatorData(string simulator, int data) + { + NotImplemented("llRequestSimulatorData"); + } - public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } + public void llForceMouselook(int mouselook) + { + NotImplemented("llForceMouselook"); + } - public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } + public double llGetObjectMass(string id) + { + NotImplemented("llGetObjectMass"); + return 0; + } - public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } - public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } - public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } - public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } - public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } - public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } - public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } - public void llListReplaceList() { NotImplemented("llListReplaceList"); } + public void llListReplaceList() + { + NotImplemented("llListReplaceList"); + } public void llLoadURL(string avatar_id, string message, string url) { LLUUID avatarId = new LLUUID(avatar_id); - m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); + m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, + url); } - public void llParcelMediaCommandList(List commandList) { NotImplemented("llParcelMediaCommandList"); } - public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } + public void llParcelMediaCommandList(List commandList) + { + NotImplemented("llParcelMediaCommandList"); + } + + public void llParcelMediaQuery() + { + NotImplemented("llParcelMediaQuery"); + } public int llModPow(int a, int b, int c) { @@ -1139,13 +2103,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler return Convert.ToInt32(tmp); } - public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } + public int llGetInventoryType(string name) + { + NotImplemented("llGetInventoryType"); + return 0; + } + + public void llSetPayPrice(int price, List quick_pay_buttons) + { + NotImplemented("llSetPayPrice"); + } + + public LSL_Types.Vector3 llGetCameraPos() + { + NotImplemented("llGetCameraPos"); + return new LSL_Types.Vector3(); + } + + public LSL_Types.Quaternion llGetCameraRot() + { + NotImplemented("llGetCameraRot"); + return new LSL_Types.Quaternion(); + } + + public void llSetPrimURL() + { + NotImplemented("llSetPrimURL"); + } - public void llSetPayPrice(int price, List quick_pay_buttons) { NotImplemented("llSetPayPrice"); } - public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } - public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } - public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } - public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); } + public void llRefreshPrimURL() + { + NotImplemented("llRefreshPrimURL"); + } public string llEscapeURL(string url) { @@ -1170,21 +2159,60 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler return "llUnescapeURL: " + ex.ToString(); } } - public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } - public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } - public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } - public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } - public void llSetCameraParams(List rules) { NotImplemented("llSetCameraParams"); } - public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } - public double llListStatistics(int operation, List src) { NotImplemented("llListStatistics"); return 0; } + + public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) + { + NotImplemented("llMapDestination"); + } + + public void llAddToLandBanList(string avatar, double hours) + { + NotImplemented("llAddToLandBanList"); + } + + public void llRemoveFromLandPassList(string avatar) + { + NotImplemented("llRemoveFromLandPassList"); + } + + public void llRemoveFromLandBanList(string avatar) + { + NotImplemented("llRemoveFromLandBanList"); + } + + public void llSetCameraParams(List rules) + { + NotImplemented("llSetCameraParams"); + } + + public void llClearCameraParams() + { + NotImplemented("llClearCameraParams"); + } + + public double llListStatistics(int operation, List src) + { + NotImplemented("llListStatistics"); + return 0; + } public int llGetUnixTime() { return Util.UnixTimeSinceEpoch(); } - public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } - public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } + public int llGetParcelFlags(LSL_Types.Vector3 pos) + { + NotImplemented("llGetParcelFlags"); + return 0; + } + + public int llGetRegionFlags() + { + NotImplemented("llGetRegionFlags"); + return 0; + } + public string llXorBase64StringsCorrect(string str1, string str2) { string ret = ""; @@ -1201,27 +2229,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler } return llStringToBase64(ret); } + public void llHTTPRequest(string url, List parameters, string body) { m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); } - public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } - public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } - public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } - public List llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List(); } - public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } - public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } - public List llGetParcelDetails(LSL_Types.Vector3 pos, List param) { NotImplemented("llGetParcelDetails"); return new List(); } + + public void llResetLandBanList() + { + NotImplemented("llResetLandBanList"); + } + + public void llResetLandPassList() + { + NotImplemented("llResetLandPassList"); + } + + public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) + { + NotImplemented("llGetParcelPrimCount"); + return 0; + } + + public List llGetParcelPrimOwners(LSL_Types.Vector3 pos) + { + NotImplemented("llGetParcelPrimOwners"); + return new List(); + } + + public int llGetObjectPrimCount(string object_id) + { + NotImplemented("llGetObjectPrimCount"); + return 0; + } + + public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) + { + NotImplemented("llGetParcelMaxPrims"); + return 0; + } + + public List llGetParcelDetails(LSL_Types.Vector3 pos, List param) + { + NotImplemented("llGetParcelDetails"); + return new List(); + } // // OpenSim functions // - public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) + public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, + int timer) { if (dynamicID == "") { - IDynamicTextureManager textureManager = this.World.RequestModuleInterface(); - LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, this.m_host.UUID, contentType, url, extraParams, timer); + IDynamicTextureManager textureManager = World.RequestModuleInterface(); + LLUUID createdTexture = + textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url, + extraParams, timer); return createdTexture.ToStringHyphenated(); } else @@ -1237,6 +2302,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler if (throwErrorOnNotImplemented) throw new NotImplementedException("Command not implemented: " + Command); } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index 8f0a591..85ac597 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs @@ -27,11 +27,8 @@ */ /* Original code: Tedd Hansen */ using System; -using System.Collections.Generic; -using System.Text; using libsecondlife; using OpenSim.Framework; -using OpenSim.Region.Environment.Scenes.Scripting; namespace OpenSim.Region.ScriptEngine.DotNetEngine { @@ -39,7 +36,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. /// [Serializable] - class EventManager + internal class EventManager { private ScriptEngine myScriptEngine; //public IScriptHost TEMP_OBJECT_ID; @@ -55,7 +52,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine myScriptEngine.World.EventManager.OnObjectGrab += touch_start; myScriptEngine.World.EventManager.OnRezScript += OnRezScript; myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; - } public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) @@ -63,17 +59,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Add to queue for all scripts in ObjectID object //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); //Console.WriteLine("touch_start localID: " + localID); - myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); + myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1}); } + public void OnRezScript(uint localID, LLUUID itemID, string script) { //myScriptEngine.myScriptManager.StartScript( // Path.Combine("ScriptEngines", "Default.lsl"), // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() //); - Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); + Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + + script.Length); myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); } + public void OnRemoveScript(uint localID, LLUUID itemID) { //myScriptEngine.myScriptManager.StartScript( @@ -84,48 +83,138 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine myScriptEngine.m_ScriptManager.StopScript( localID, itemID - ); - + ); } // TODO: Replace placeholders below // These needs to be hooked up to OpenSim during init of this class // then queued in EventQueueManager. // When queued in EventQueueManager they need to be LSL compatible (name and params) - + //public void state_entry() { } // - public void state_exit() { } + public void state_exit() + { + } + //public void touch_start() { } - public void touch() { } - public void touch_end() { } - public void collision_start() { } - public void collision() { } - public void collision_end() { } - public void land_collision_start() { } - public void land_collision() { } - public void land_collision_end() { } - public void timer() { } - public void listen() { } - public void on_rez() { } - public void sensor() { } - public void no_sensor() { } - public void control() { } - public void money() { } - public void email() { } - public void at_target() { } - public void not_at_target() { } - public void at_rot_target() { } - public void not_at_rot_target() { } - public void run_time_permissions() { } - public void changed() { } - public void attach() { } - public void dataserver() { } - public void link_message() { } - public void moving_start() { } - public void moving_end() { } - public void object_rez() { } - public void remote_data() { } - public void http_response() { } + public void touch() + { + } + + public void touch_end() + { + } + + public void collision_start() + { + } + + public void collision() + { + } + + public void collision_end() + { + } + + public void land_collision_start() + { + } + + public void land_collision() + { + } + + public void land_collision_end() + { + } + + public void timer() + { + } + + public void listen() + { + } + + public void on_rez() + { + } + + public void sensor() + { + } + + public void no_sensor() + { + } + + public void control() + { + } + + public void money() + { + } + + public void email() + { + } + + public void at_target() + { + } + + public void not_at_target() + { + } + + public void at_rot_target() + { + } + + public void not_at_rot_target() + { + } + + public void run_time_permissions() + { + } + + public void changed() + { + } + + public void attach() + { + } + + public void dataserver() + { + } + + public void link_message() + { + } + + public void moving_start() + { + } + + public void moving_end() + { + } + + public void object_rez() + { + } + + public void remote_data() + { + } + public void http_response() + { + } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index aa36ea2..d7491d9 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs @@ -27,12 +27,11 @@ */ /* Original code: Tedd Hansen */ using System; +using System.Collections; using System.Collections.Generic; -using System.Text; using System.Threading; -using System.Reflection; -using OpenSim.Region.Environment.Scenes.Scripting; using libsecondlife; +using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; namespace OpenSim.Region.ScriptEngine.DotNetEngine @@ -42,25 +41,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// Events are queued and executed in separate thread /// [Serializable] - class EventQueueManager + internal class EventQueueManager { /// /// List of threads processing event queue /// private List eventQueueThreads = new List(); + private object queueLock = new object(); // Mutex lock object + /// /// How many ms to sleep if queue is empty /// private int nothingToDoSleepms = 50; + /// /// How many threads to process queue with /// private int numberOfThreads = 2; + /// /// Queue containing events waiting to be executed /// private Queue eventQueue = new Queue(); + /// /// Queue item structure /// @@ -76,9 +80,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// List of localID locks for mutex processing of script events /// private List objectLocks = new List(); + private object tryLockLock = new object(); // Mutex lock object private ScriptEngine m_ScriptEngine; + public EventQueueManager(ScriptEngine _ScriptEngine) { m_ScriptEngine = _ScriptEngine; @@ -96,11 +102,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine EventQueueThread.Start(); } } + ~EventQueueManager() { - // Kill worker threads - foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads)) + foreach (Thread EventQueueThread in new ArrayList(eventQueueThreads)) { if (EventQueueThread != null && EventQueueThread.IsAlive == true) { @@ -118,7 +124,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine eventQueueThreads.Clear(); // Todo: Clean up our queues eventQueue.Clear(); - } /// @@ -176,18 +181,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Execute function try { - m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param); + m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, + QIS.functionName, QIS.param); } catch (Exception e) { // DISPLAY ERROR INWORLD string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; if (e.InnerException != null) - { // Send inner exception + { + // Send inner exception text += e.InnerException.Message.ToString(); } else - { // Send normal + { + // Send normal text += e.Message.ToString(); } try @@ -195,28 +203,33 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine if (text.Length > 1500) text = text.Substring(0, 1500); IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); - //if (m_host != null) - //{ - m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); - } catch { - //} - //else - //{ + //if (m_host != null) + //{ + m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, + m_host.AbsolutePosition, m_host.Name, m_host.UUID); + } + catch + { + //} + //else + //{ // T oconsole Console.WriteLine("Unable to send text in-world:\r\n" + text); } - } finally { ReleaseLock(QIS.localID); } } - } // Something in queue - } catch (ThreadAbortException tae) { + } + catch (ThreadAbortException tae) + { throw tae; - } catch (Exception e) { + } + catch (Exception e) + { Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString()); } } // while @@ -283,15 +296,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine return; } - Dictionary.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); + Dictionary.KeyCollection scriptKeys = + m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); - foreach ( LLUUID itemID in scriptKeys ) + foreach (LLUUID itemID in scriptKeys) { // Add to each script in that object // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? AddToScriptQueue(localID, itemID, FunctionName, param); } - } /// @@ -316,6 +329,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine eventQueue.Enqueue(QIS); } } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs index e6c2c47..5061629 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs @@ -28,24 +28,23 @@ using System; using System.Collections.Generic; -using System.Text; using System.Threading; using libsecondlife; -using OpenSim.Region.ScriptEngine.Common; -using OpenSim.Region.Environment.Modules; using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Environment.Modules; namespace OpenSim.Region.ScriptEngine.DotNetEngine { /// /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. /// - class LSLLongCmdHandler + internal class LSLLongCmdHandler { private Thread cmdHandlerThread; private int cmdHandlerThreadCycleSleepms = 100; private ScriptEngine m_ScriptEngine; + public LSLLongCmdHandler(ScriptEngine _ScriptEngine) { m_ScriptEngine = _ScriptEngine; @@ -56,8 +55,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine cmdHandlerThread.Priority = ThreadPriority.BelowNormal; cmdHandlerThread.IsBackground = true; cmdHandlerThread.Start(); - } + ~LSLLongCmdHandler() { // Shut down thread @@ -72,7 +71,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } } } - catch { } + catch + { + } } private void CmdHandlerThreadLoop() @@ -124,8 +125,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public double interval; public DateTime next; } + private List Timers = new List(); private object TimerListLock = new object(); + public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) { Console.WriteLine("SetTimerEvent"); @@ -146,6 +149,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine Timers.Add(ts); } } + public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) { // Remove from timer @@ -163,6 +167,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine Timers = NewTimers; } } + public void CheckTimerEvents() { // Nothing to do here? @@ -171,7 +176,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine lock (TimerListLock) { - // Go through all timers foreach (TimerClass ts in Timers) { @@ -179,7 +183,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) { // Add it to queue - m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", + new object[] {}); // set next interval @@ -188,6 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } } // lock } + #endregion #region HTTP REQUEST @@ -213,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { // TODO: SEND REQUEST!!! } + public void Stop() { // TODO: Cancel any ongoing request } + public bool CheckResponse() { // TODO: Check if we got a response yet, return true if so -- false if not @@ -227,11 +235,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine //response_status //response_metadata //response_body - } } + private List HttpRequests = new List(); private object HttpListLock = new object(); + public void StartHttpRequest(uint localID, LLUUID itemID, string url, List parameters, string body) { Console.WriteLine("StartHttpRequest"); @@ -244,11 +253,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine htc.body = body; lock (HttpListLock) { - //ADD REQUEST HttpRequests.Add(htc); } } + public void StopHttpRequest(uint m_localID, LLUUID m_itemID) { // Remove from list @@ -272,6 +281,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine HttpRequests = NewHttpList; } } + public void CheckHttpRequests() { // Nothing to do here? @@ -282,68 +292,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { foreach (HttpClass ts in HttpRequests) { - if (ts.CheckResponse() == true) { // Add it to event queue //key request_id, integer status, list metadata, string body - object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; - m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); + object[] resobj = + new object[] + {ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body}; + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", + resobj); // Now stop it StopHttpRequest(ts.localID, ts.itemID); } } } // lock } + #endregion public void CheckXMLRPCRequests() { - IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface(); while (xmlrpc.hasRequests()) { RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); - System.Console.WriteLine("PICKED REQUEST"); + Console.WriteLine("PICKED REQUEST"); //Deliver data to prim's remote_data handler - object[] resobj = new object[] { - 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), rInfo.GetStrVal() - }; + object[] resobj = new object[] + { + 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), + rInfo.GetStrVal() + }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj - ); - + ); } - } public void CheckListeners() { - IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface(); while (comms.HasMessages()) { ListenerInfo lInfo = comms.GetNextMessage(); - System.Console.WriteLine("PICKED LISTENER"); + Console.WriteLine("PICKED LISTENER"); //Deliver data to prim's listen handler - object[] resobj = new object[] { - lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() - }; + object[] resobj = new object[] + { + lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() + }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj - ); - + ); } - } - - - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs index 0aa1a0b..00027ca 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs @@ -1,26 +1,28 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] + +[assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] // Version information for an assembly consists of the following four values: // @@ -31,5 +33,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly : AssemblyVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 38bf746..eaa3a09 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -27,14 +27,10 @@ */ /* Original code: Tedd Hansen */ using System; -using System.Collections.Generic; -using System.Text; +using Nini.Config; using OpenSim.Framework.Console; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.Environment.Interfaces; -using libsecondlife; -using Nini.Config; +using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.ScriptEngine.DotNetEngine { @@ -42,17 +38,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// This is the root object for ScriptEngine /// [Serializable] - public class ScriptEngine :IRegionModule + public class ScriptEngine : IRegionModule { - - internal OpenSim.Region.Environment.Scenes.Scene World; - internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim - internal EventQueueManager m_EventQueueManager; // Executes events - internal ScriptManager m_ScriptManager; // Load, unload and execute scripts + internal Scene World; + internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim + internal EventQueueManager m_EventQueueManager; // Executes events + internal ScriptManager m_ScriptManager; // Load, unload and execute scripts internal AppDomainManager m_AppDomainManager; internal LSLLongCmdHandler m_LSLLongCmdHandler; - private OpenSim.Framework.Console.LogBase m_log; + private LogBase m_log; public ScriptEngine() { @@ -65,9 +60,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine get { return m_log; } } - public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) + public void InitializeEngine(Scene Sceneworld, LogBase logger) { - World = Sceneworld; m_log = logger; @@ -84,10 +78,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Should we iterate the region for scripts that needs starting? // Or can we assume we are loaded before anything else so we can use proper events? - - } - + public void Shutdown() { // We are shutting down @@ -106,12 +98,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public void Initialise(Scene scene, IConfigSource config) { - this.InitializeEngine(scene, MainLog.Instance); + InitializeEngine(scene, MainLog.Instance); } public void PostInitialise() { - } public void Close() @@ -130,4 +121,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 381fd8c..54a5ef5 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -28,19 +28,14 @@ /* Original code: Tedd Hansen */ using System; using System.Collections.Generic; -using System.Text; -using System.Threading; +using System.IO; using System.Reflection; -using System.Runtime.Remoting; -using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; +using System.Threading; +using libsecondlife; using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; -using OpenSim.Region.ScriptEngine.Common; -using libsecondlife; - namespace OpenSim.Region.ScriptEngine.DotNetEngine { @@ -53,16 +48,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public class ScriptManager { #region Declares + private Thread scriptLoadUnloadThread; private int scriptLoadUnloadThread_IdleSleepms = 100; private Queue loadQueue = new Queue(); private Queue unloadQueue = new Queue(); + private struct LoadStruct { public uint localID; public LLUUID itemID; public string script; } + private struct UnloadStruct { public uint localID; @@ -72,17 +70,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Object> // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! - internal Dictionary> Scripts = new Dictionary>(); + internal Dictionary> Scripts = + new Dictionary>(); + public Scene World { - get - { - return m_scriptEngine.World; - } + get { return m_scriptEngine.World; } } -#endregion + + #endregion + #region Object init/shutdown + private ScriptEngine m_scriptEngine; + public ScriptManager(ScriptEngine scriptEngine) { m_scriptEngine = scriptEngine; @@ -92,9 +93,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine scriptLoadUnloadThread.IsBackground = true; scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; scriptLoadUnloadThread.Start(); - } - ~ScriptManager () + + ~ScriptManager() { // Abort load/unload thread try @@ -112,8 +113,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { } } + #endregion + #region Load / Unload scripts (Thread loop) + private void ScriptLoadUnloadThreadLoop() { try @@ -134,9 +138,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine UnloadStruct item = unloadQueue.Dequeue(); _StopScript(item.localID, item.itemID); } - - - } } catch (ThreadAbortException tae) @@ -145,21 +146,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine a = ""; // Expected } - } + #endregion + #region Helper functions + private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { - //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name); return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null; - } - #endregion + #region Internal functions to keep track of script + internal Dictionary.KeyCollection GetScriptKeys(uint localID) { if (Scripts.ContainsKey(localID) == false) @@ -169,7 +171,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine Scripts.TryGetValue(localID, out Obj); return Obj.Keys; - } internal LSL_BaseClass GetScript(uint localID, LLUUID itemID) @@ -187,8 +188,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine Obj.TryGetValue(itemID, out Script); return Script; - } + internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script) { // Create object if it doesn't exist @@ -205,8 +206,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Add to object Obj.Add(itemID, Script); - } + internal void RemoveScript(uint localID, LLUUID itemID) { // Don't have that object? @@ -218,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine Scripts.TryGetValue(localID, out Obj); if (Obj.ContainsKey(itemID) == true) Obj.Remove(itemID); - } + #endregion + #region Start/Stop/Reset script + /// /// Fetches, loads and hooks up a script to an objects events /// @@ -235,6 +238,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine ls.script = Script; loadQueue.Enqueue(ls); } + /// /// Disables and unloads a script /// @@ -247,6 +251,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine ls.itemID = itemID; unloadQueue.Enqueue(ls); } + public void ResetScript(uint localID, LLUUID itemID) { string script = GetScript(localID, itemID).SourceCode; @@ -267,12 +272,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine try { - - - - // Create a new instance of the compiler (currently we don't want reuse) - OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); + Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); // Compile (We assume LSL) ScriptSource = LSLCompiler.CompileFromLSLText(Script); //Console.WriteLine("Compilation of " + FileName + " done"); @@ -289,10 +290,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); #if DEBUG - Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); + Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); #endif - CompiledScript.SourceCode = ScriptSource; + CompiledScript.SourceCode = ScriptSource; // Add it to our script memstruct SetScript(localID, itemID, CompiledScript); @@ -306,9 +307,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine CompiledScript.Start(LSLB); // Fire the first start-event - m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); - - + m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {}); } catch (Exception e) { @@ -326,9 +325,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); } } - - - } private void _StopScript(uint localID, LLUUID itemID) @@ -359,19 +355,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Tell AppDomain that we have stopped script m_scriptEngine.m_AppDomainManager.StopScript(ad); } - catch(Exception e) + catch (Exception e) { - Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + ": " + e.ToString()); + Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + + ": " + e.ToString()); } } - private string ProcessYield(string FileName) + + private string ProcessYield(string FileName) { // TODO: Create a new assembly and copy old but insert Yield Code //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); return FileName; } + #endregion + #region Perform event execution in script + /// /// Execute a LL-event-function in Script /// @@ -381,7 +382,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// Arguments to pass to function internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) { - // Execute a function in the script //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); @@ -390,28 +390,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Must be done in correct AppDomain, so leaving it up to the script itself Script.Exec.ExecuteEvent(FunctionName, args); - } + #endregion #region Script serialization/deserialization + public void GetSerializedScript(uint localID, LLUUID itemID) { // Serialize the script and return it // Should not be a problem - System.IO.FileStream fs = System.IO.File.Create("SERIALIZED_SCRIPT_" + itemID); + FileStream fs = File.Create("SERIALIZED_SCRIPT_" + itemID); BinaryFormatter b = new BinaryFormatter(); - b.Serialize(fs, GetScript(localID,itemID)); + b.Serialize(fs, GetScript(localID, itemID)); fs.Close(); - - } + public void PutSerializedScript(uint localID, LLUUID itemID) { // Deserialize the script and inject it into an AppDomain // How to inject into an AppDomain? } + #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs index 8f935f1..072c249 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs @@ -27,12 +27,9 @@ */ using System; -using System.Collections.Generic; -using System.Text; -using Rail.Transformation; +using System.IO; using Rail.Reflect; -using Rail.Exceptions; -using Rail.MSIL; +using Rail.Transformation; namespace OpenSim.Region.ScriptEngine.DotNetEngine { @@ -40,25 +37,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! /// Its offspring will be the actual implementation. /// - class TempDotNetMicroThreadingCodeInjector + internal class TempDotNetMicroThreadingCodeInjector { public static string TestFix(string FileName) { - string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); + string ret = Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); Console.WriteLine("Loading: \"" + FileName + "\""); RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); - + //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe - RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); + RTypeDef type = (RTypeDef) rAssembly.RModuleDef.GetType("SecondLife.Script"); //Get the methods in the type RMethod[] m = type.GetMethods(); //Create a MethodPrologueAdder visitor object with the method to add //and with the flag that enables local variable creation set to true - MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); + MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef) m[0], true); //Apply the changes to the assembly rAssembly.Accept(mpa); @@ -67,7 +64,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine rAssembly.SaveAssembly(ret); return ret; - } } -} +} \ No newline at end of file -- cgit v1.1