From 5e63206018d6d24671ad59d77951082b77f02618 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Tue, 1 Jul 2008 07:16:02 +0000 Subject: From: kurt taylor (krtaylor) Another new OSSL function for returning the name of the script engine currently running, osGetScriptEngineName, added to both DotNet and XEngine OSSL API. --- .../Common/BuiltIn_Commands_BaseClass.cs | 5 +++++ .../ScriptEngine/Common/OSSL_BuilIn_Commands.cs | 26 ++++++++++++++++++++++ .../Common/OSSL_BuilIn_Commands_Interface.cs | 2 ++ .../ScriptEngine/Interfaces/IScriptEngine.cs | 1 + .../Shared/Api/Implementation/OSSL_Api.cs | 26 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 ++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 7 files changed, 67 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index 47588b6..90eb8c7 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs @@ -2022,6 +2022,11 @@ namespace OpenSim.Region.ScriptEngine.Common m_LSL_Functions.osOpenRemoteDataChannel(channel); } + public string osGetScriptEngineName() + { + return m_LSL_Functions.osGetScriptEngineName(); + } + // public double llList2Float(LSL_Types.list src, int index) diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs index bd7ad82..fc62b02 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs @@ -543,5 +543,31 @@ namespace OpenSim.Region.ScriptEngine.Common m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); } } + + public string osGetScriptEngineName() + { + m_host.AddScriptLPS(1); + + int scriptEngineNameIndex = 0; + + if (!String.IsNullOrEmpty(m_ScriptEngine.ScriptEngineName)) + { + // parse off the "ScriptEngine." + scriptEngineNameIndex = m_ScriptEngine.ScriptEngineName.IndexOf(".", scriptEngineNameIndex); + scriptEngineNameIndex++; // get past delimiter + + int scriptEngineNameLength = m_ScriptEngine.ScriptEngineName.Length - scriptEngineNameIndex; + + // create char array then a string that is only the script engine name + Char[] scriptEngineNameCharArray = m_ScriptEngine.ScriptEngineName.ToCharArray(scriptEngineNameIndex, scriptEngineNameLength); + String scriptEngineName = new String(scriptEngineNameCharArray); + + return scriptEngineName; + } + else + { + return String.Empty; + } + } } } diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs index 171bffd..4f7b56e 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs @@ -64,5 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common void osOpenRemoteDataChannel(string channel); + string osGetScriptEngineName(); + } } diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 579af31..856f228 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs @@ -46,6 +46,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces IConfig Config { get; } Object AsyncCommands { get; } ILog Log { get; } + string ScriptEngineName { get; } bool PostScriptEvent(LLUUID itemID, EventParams parms); bool PostObjectEvent(uint localID, EventParams parms); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index dbb78a4..5414b95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -549,5 +549,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { throw new Exception("OSSL Runtime Error: " + msg); } + + public string osGetScriptEngineName() + { + m_host.AddScriptLPS(1); + + int scriptEngineNameIndex = 0; + + if (!String.IsNullOrEmpty(m_ScriptEngine.ScriptEngineName)) + { + // parse off the "ScriptEngine." + scriptEngineNameIndex = m_ScriptEngine.ScriptEngineName.IndexOf(".", scriptEngineNameIndex); + scriptEngineNameIndex++; // get past delimiter + + int scriptEngineNameLength = m_ScriptEngine.ScriptEngineName.Length - scriptEngineNameIndex; + + // create char array then a string that is only the script engine name + Char[] scriptEngineNameCharArray = m_ScriptEngine.ScriptEngineName.ToCharArray(scriptEngineNameIndex, scriptEngineNameLength); + String scriptEngineName = new String(scriptEngineNameCharArray); + + return scriptEngineName; + } + else + { + return String.Empty; + } + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1e14c63..d55491c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -64,5 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces double osList2Double(LSL_Types.list src, int index); void osSetRegionWaterHeight(double height); + + string osGetScriptEngineName(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 34e2fb1..90c4419 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -195,5 +195,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osSetStateEvents(events); } + + public string osGetScriptEngineName() + { + return m_OSSL_Functions.osGetScriptEngineName(); + } } } -- cgit v1.1