From 2a90f78fe16933fb33d5392610ff17046816ad04 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 Oct 2019 23:33:11 +0100 Subject: [PATCH] add LSL_Integer osIsNotValidNumber(LSL_Float v) --- .../Shared/Api/Implementation/OSSL_Api.cs | 53 ++++++++------- .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Constants.cs | 2 +- .../Shared/Api/Runtime/OSSL_Stub.cs | 5 ++ .../Instance/Tests/CoopTerminationTests.cs | 5 ++ bin/ScriptSyntax.xml | 67 ++++++++++--------- 6 files changed, 77 insertions(+), 56 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3360b8d721..641975adf4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -25,38 +25,29 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.IO; -using System.Reflection; -using System.Runtime.Remoting.Lifetime; -using System.Text; -using System.Net; -using System.Threading; -using System.Xml; using log4net; +using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; -using Nini.Config; -using OpenSim; using OpenSim.Framework; - -using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Scripting; -using OpenSim.Region.ScriptEngine.Shared; -using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; -using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; -using TPFlags = OpenSim.Framework.Constants.TeleportFlags; +using OpenSim.Region.ScriptEngine.Shared.ScriptBase; +using OpenSim.Services.Connectors.Hypergrid; using OpenSim.Services.Interfaces; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; +using System.Runtime.Remoting.Lifetime; +using System.Text; using System.Text.RegularExpressions; - +using System.Threading; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; @@ -65,7 +56,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using PermissionMask = OpenSim.Framework.PermissionMask; -using OpenSim.Services.Connectors.Hypergrid; +using TPFlags = OpenSim.Framework.Constants.TeleportFlags; namespace OpenSim.Region.ScriptEngine.Shared.Api { @@ -187,10 +178,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if(m_osslconfig == null) m_osslconfig = m_ScriptEngine.Config; - if (m_osslconfig.GetBoolean("AllowOSFunctions", false)) + if (m_osslconfig.GetBoolean("AllowOSFunctions", true)) { - m_OSFunctionsEnabled = true; - // m_log.Warn("[OSSL] OSSL FUNCTIONS ENABLED"); + m_OSFunctionsEnabled = true; + // m_log.Warn("[OSSL] OSSL FUNCTIONS ENABLED"); } m_PermissionErrortoOwner = m_osslconfig.GetBoolean("PermissionErrorToOwner", m_PermissionErrortoOwner); @@ -5674,5 +5665,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.ApiResetScript(me); } + + public LSL_Integer osIsNotValidNumber(LSL_Float v) + { + double d = v; + if (double.IsNaN(d)) + return 1; + if (double.IsNegativeInfinity(d)) + return 2; + if (double.IsPositiveInfinity(d)) + return 3; + return 0; + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index afbbe6f4ec..2bb71e9518 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -558,5 +558,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Rotation osSlerp(LSL_Rotation a, LSL_Rotation b, LSL_Float amount); void osResetAllScripts(LSL_Integer AllLinkset); + LSL_Integer osIsNotValidNumber(LSL_Float v); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index e1c421f97d..f7acafe380 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public partial class ScriptBaseClass { // SCRIPTS CONSTANTS - public static readonly LSLInteger OS_APIVERSION = 9; + public static readonly LSLInteger OS_APIVERSION = 10; public static readonly LSLInteger TRUE = 1; public static readonly LSLInteger FALSE = 0; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e13b6b06ad..9745403429 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -1416,5 +1416,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osResetAllScripts(allLinkSet); } + + public LSL_Integer osIsNotValidNumber(LSL_Float v) + { + return m_OSSL_Functions.osIsNotValidNumber(v); + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs index 8138117b10..a9671aeee7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs @@ -106,6 +106,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests // has an effect - without it tests will fail due to a 120 second wait for the event to finish. xEngineConfig.Set("WaitForEventCompletionOnScriptStop", 120000); + IConfig config = configSource.AddConfig("OSSL"); + config.Set("DebuggerSafe", false); + config.Set("AllowOSFunctions", "true"); + config.Set("OSFunctionThreatLevel", "Severe"); + m_scene = new SceneHelpers().SetupScene("My Test", TestHelpers.ParseTail(0x9999), 1000, 1000, configSource); SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine); m_scene.StartScripts(); diff --git a/bin/ScriptSyntax.xml b/bin/ScriptSyntax.xml index 135ded926b..e2ab46e686 100644 --- a/bin/ScriptSyntax.xml +++ b/bin/ScriptSyntax.xml @@ -1,4 +1,4 @@ -dfadabce-becc-8749-2b74-781332befa2e +7ddea7b6-2c1f-1bf6-d0b1-8e99955c9587 llsd-lsl-syntax-version2 controls @@ -1557,7 +1557,7 @@ dfadabce-becc-8749-2b74-781332befa2e OS_APIVERSION typeinteger - value9 + value10 OS_ATTACH_MSG_ALL typeinteger @@ -6196,17 +6196,16 @@ dfadabce-becc-8749-2b74-781332befa2e returninteger arguments - ratyperotation - rbtyperotation - margintypefloat + atypefloat + btypefloat osApproxEquals returninteger arguments - ratyperotation - rbtyperotation + vatypevector + vbtypevector osApproxEquals @@ -6222,8 +6221,8 @@ dfadabce-becc-8749-2b74-781332befa2e returninteger arguments - vatypevector - vbtypevector + ratyperotation + rbtyperotation osApproxEquals @@ -6239,8 +6238,9 @@ dfadabce-becc-8749-2b74-781332befa2e returninteger arguments - atypefloat - btypefloat + ratyperotation + rbtyperotation + margintypefloat osAvatarName2Key @@ -6366,8 +6366,6 @@ dfadabce-becc-8749-2b74-781332befa2e returnstring arguments drawListtypestring - startXtypeinteger - startYtypeinteger endXtypeinteger endYtypeinteger @@ -6377,6 +6375,8 @@ dfadabce-becc-8749-2b74-781332befa2e returnstring arguments drawListtypestring + startXtypeinteger + startYtypeinteger endXtypeinteger endYtypeinteger @@ -6826,6 +6826,13 @@ dfadabce-becc-8749-2b74-781332befa2e agentIdtypekey + osIsNotValidNumber + + returninteger + arguments + vtypefloat + + osIsNpc returninteger @@ -7057,6 +7064,7 @@ dfadabce-becc-8749-2b74-781332befa2e arguments npctypekey + channeltypeinteger messagetypestring @@ -7064,7 +7072,6 @@ dfadabce-becc-8749-2b74-781332befa2e arguments npctypekey - channeltypeinteger messagetypestring @@ -7211,13 +7218,13 @@ dfadabce-becc-8749-2b74-781332befa2e osRegionNotice arguments - agentIDtypekey msgtypestring osRegionNotice arguments + agentIDtypekey msgtypestring @@ -7226,7 +7233,6 @@ dfadabce-becc-8749-2b74-781332befa2e returninteger arguments secondstypefloat - msgtypestring osRegionRestart @@ -7234,6 +7240,7 @@ dfadabce-becc-8749-2b74-781332befa2e returninteger arguments secondstypefloat + msgtypestring osReplaceString @@ -7463,7 +7470,7 @@ dfadabce-becc-8749-2b74-781332befa2e osSetProjectionParams arguments - linknumbertypeinteger + primtypekey projectiontypeinteger texturetypekey fovtypefloat @@ -7474,7 +7481,7 @@ dfadabce-becc-8749-2b74-781332befa2e osSetProjectionParams arguments - primtypekey + linknumbertypeinteger projectiontypeinteger texturetypekey fovtypefloat @@ -7662,6 +7669,7 @@ dfadabce-becc-8749-2b74-781332befa2e arguments srctypestring starttypeinteger + lengthtypeinteger osStringSubString @@ -7670,7 +7678,6 @@ dfadabce-becc-8749-2b74-781332befa2e arguments srctypestring starttypeinteger - lengthtypeinteger osSunGetParam @@ -7688,14 +7695,6 @@ dfadabce-becc-8749-2b74-781332befa2e osTeleportAgent - - arguments - agenttypestring - positiontypevector - lookattypevector - - - osTeleportAgent arguments agenttypestring @@ -7714,6 +7713,14 @@ dfadabce-becc-8749-2b74-781332befa2e lookattypevector + osTeleportAgent + + arguments + agenttypestring + positiontypevector + lookattypevector + + osTeleportObject returninteger @@ -7734,7 +7741,8 @@ dfadabce-becc-8749-2b74-781332befa2e osTeleportOwner arguments - regionNametypestring + regionXtypeinteger + regionYtypeinteger positiontypevector lookattypevector @@ -7742,8 +7750,7 @@ dfadabce-becc-8749-2b74-781332befa2e osTeleportOwner arguments - regionXtypeinteger - regionYtypeinteger + regionNametypestring positiontypevector lookattypevector