From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 3 Nov 2016 21:44:39 +1000 Subject: Initial update to OpenSim 0.8.2.1 source code. --- .../Region/ScriptEngine/Interfaces/ICompiler.cs | 31 ++++++++++++++- .../Region/ScriptEngine/Interfaces/IScriptApi.cs | 17 ++++---- .../ScriptEngine/Interfaces/IScriptEngine.cs | 45 +++++++++++++++++++--- .../ScriptEngine/Interfaces/IScriptInstance.cs | 45 ++++++++++++++++++---- 4 files changed, 117 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Interfaces') diff --git a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs index e4ca635..a7fa502 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs @@ -34,7 +34,36 @@ namespace OpenSim.Region.ScriptEngine.Interfaces { public interface ICompiler { - void PerformScriptCompile(string source, string asset, UUID ownerID, out string assembly, out Dictionary, KeyValuePair> linemap); + /// + /// Performs the script compile. + /// + /// + /// + /// + /// + /// If set to true then always recompile the script, even if we have a DLL already cached. + /// + /// + /// + void PerformScriptCompile( + string source, string asset, UUID ownerID, + out string assembly, out Dictionary, KeyValuePair> linemap); + + /// + /// Performs the script compile. + /// + /// + /// + /// + /// + /// If set to true then always recompile the script, even if we have a DLL already cached. + /// + /// + /// + void PerformScriptCompile( + string source, string asset, UUID ownerID, bool alwaysRecompile, + out string assembly, out Dictionary, KeyValuePair> linemap); + string[] GetWarnings(); } } diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs index 2027ca6..b9970bf 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs @@ -26,9 +26,11 @@ */ using System; +using System.Threading; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.ScriptEngine.Shared; namespace OpenSim.Region.ScriptEngine.Interfaces { @@ -38,11 +40,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces /// Initialize the API /// /// - /// Each API has an identifier, which is used to load the - /// proper runtime assembly at load time. - /// /param> - /// - /// - void Initialize(IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item); + /// Each API has an identifier, which is used to load the proper runtime assembly at load time. + /// /param> + /// /param> + /// /param> + /// /param> + void Initialize( + IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 17c2708..6355669 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs @@ -25,16 +25,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using log4net; using System; -using OpenSim.Region.ScriptEngine.Shared; +using System.Reflection; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; -using OpenMetaverse; -using Nini.Config; using OpenSim.Region.ScriptEngine.Interfaces; +using OpenSim.Region.ScriptEngine.Shared; using Amib.Threading; -using OpenSim.Framework; +using log4net; +using Nini.Config; +using OpenMetaverse; namespace OpenSim.Region.ScriptEngine.Interfaces { @@ -76,6 +77,40 @@ namespace OpenSim.Region.ScriptEngine.Interfaces IConfigSource ConfigSource { get; } string ScriptEngineName { get; } string ScriptEnginePath { get; } + + /// + /// Return the name of the class that will be used for all running scripts. + /// + /// + /// Each class goes in its own assembly so we don't need to otherwise distinguish the class name. + /// + string ScriptClassName { get; } + + /// + /// Return the name of the base class that will be used for all running scripts. + /// + string ScriptBaseClassName { get; } + + /// + /// Assemblies that need to be referenced when compiling scripts. + /// + /// + /// These are currently additional to those always referenced by the compiler, BUT THIS MAY CHANGE IN THE + /// FUTURE. + /// This can be null if there are no additional assemblies. + /// + string[] ScriptReferencedAssemblies { get; } + + /// + /// Parameters for the generated script's constructor. + /// + /// + /// Can be null if there are no parameters + /// + ParameterInfo[] ScriptBaseClassParameters { get; } + IScriptApi GetApi(UUID itemID, string name); + + void SleepScript(UUID itemID, int delay); } } diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 2f5b526..e4297c4 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs @@ -28,9 +28,12 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Threading; +using System.Diagnostics; using OpenMetaverse; using log4net; using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Interfaces; @@ -49,8 +52,13 @@ namespace OpenSim.Region.ScriptEngine.Interfaces public interface IScriptWorkItem { bool Cancel(); - void Abort(); - bool Wait(TimeSpan t); + bool Abort(); + + /// + /// Wait for the work item to complete. + /// + /// The number of milliseconds to wait. Must be >= -1 (Timeout.Infinite). + bool Wait(int t); } /// @@ -86,24 +94,35 @@ namespace OpenSim.Region.ScriptEngine.Interfaces bool ShuttingDown { get; set; } /// + /// When stopping the script: should it remain stopped permanently (i.e., save !Running in its state)? + /// + bool StayStopped { get; set; } + + /// /// Script state /// string State { get; set; } /// + /// If true then the engine is responsible for persisted state. If false then some other component may + /// persist state (e.g. attachments persisting in assets). + /// + bool StatePersistedHere { get; } + + /// /// Time the script was last started /// DateTime TimeStarted { get; } /// - /// Tick the last measurement period was started. + /// Collects information about how long the script was executed. /// - long MeasurementPeriodTickStart { get; } + MetricsCollectorTime ExecutionTime { get; } /// - /// Ticks spent executing in the last measurement period. + /// Scene part in which this script instance is contained. /// - long MeasurementPeriodExecutionTime { get; } + SceneObjectPart Part { get; } IScriptEngine Engine { get; } UUID AppDomain { get; set; } @@ -124,6 +143,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces uint LocalID { get; } UUID AssetID { get; } + + /// + /// Inventory item containing the script used. + /// + TaskInventoryItem ScriptTask { get; } + Queue EventQueue { get; } /// @@ -139,6 +164,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces void ClearQueue(); int StartParam { get; set; } + WaitHandle CoopWaitHandle { get; } + Stopwatch ExecutionTimer { get; } + void RemoveState(); void Init(); @@ -154,8 +182,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces /// /// How many milliseconds we will wait for an existing script event to finish before /// forcibly aborting that event. + /// If true then the event queue is also cleared /// true if the script was successfully stopped, false otherwise - bool Stop(int timeout); + bool Stop(int timeout, bool clearEventQueue = false); void SetState(string state); @@ -204,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces void SetVars(Dictionary vars); DetectParams GetDetectParams(int idx); UUID GetDetectID(int idx); - void SaveState(string assembly); + void SaveState(); void DestroyScriptInstance(); IScriptApi GetApi(string name); -- cgit v1.1