add LSL_Integer osIsNotValidNumber(LSL_Float v)

0.9.1.0-post-fixes
UbitUmarov 2019-10-17 23:33:11 +01:00
parent d6abf2a2fe
commit 2a90f78fe1
6 changed files with 77 additions and 56 deletions

View File

@ -25,38 +25,29 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 log4net;
using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using Nini.Config;
using OpenSim;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Scripting; 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.Interfaces;
using OpenSim.Region.ScriptEngine.Shared.Api.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 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.Text.RegularExpressions;
using System.Threading;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 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_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
using PermissionMask = OpenSim.Framework.PermissionMask; using PermissionMask = OpenSim.Framework.PermissionMask;
using OpenSim.Services.Connectors.Hypergrid; using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
namespace OpenSim.Region.ScriptEngine.Shared.Api namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
@ -187,10 +178,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(m_osslconfig == null) if(m_osslconfig == null)
m_osslconfig = m_ScriptEngine.Config; m_osslconfig = m_ScriptEngine.Config;
if (m_osslconfig.GetBoolean("AllowOSFunctions", false)) if (m_osslconfig.GetBoolean("AllowOSFunctions", true))
{ {
m_OSFunctionsEnabled = true; m_OSFunctionsEnabled = true;
// m_log.Warn("[OSSL] OSSL FUNCTIONS ENABLED"); // m_log.Warn("[OSSL] OSSL FUNCTIONS ENABLED");
} }
m_PermissionErrortoOwner = m_osslconfig.GetBoolean("PermissionErrorToOwner", m_PermissionErrortoOwner); m_PermissionErrortoOwner = m_osslconfig.GetBoolean("PermissionErrorToOwner", m_PermissionErrortoOwner);
@ -5674,5 +5665,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_ScriptEngine.ApiResetScript(me); 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;
}
} }
} }

View File

@ -558,5 +558,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Rotation osSlerp(LSL_Rotation a, LSL_Rotation b, LSL_Float amount); LSL_Rotation osSlerp(LSL_Rotation a, LSL_Rotation b, LSL_Float amount);
void osResetAllScripts(LSL_Integer AllLinkset); void osResetAllScripts(LSL_Integer AllLinkset);
LSL_Integer osIsNotValidNumber(LSL_Float v);
} }
} }

View File

@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public partial class ScriptBaseClass public partial class ScriptBaseClass
{ {
// SCRIPTS CONSTANTS // 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 TRUE = 1;
public static readonly LSLInteger FALSE = 0; public static readonly LSLInteger FALSE = 0;

View File

@ -1416,5 +1416,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
m_OSSL_Functions.osResetAllScripts(allLinkSet); m_OSSL_Functions.osResetAllScripts(allLinkSet);
} }
public LSL_Integer osIsNotValidNumber(LSL_Float v)
{
return m_OSSL_Functions.osIsNotValidNumber(v);
}
} }
} }

View File

@ -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. // has an effect - without it tests will fail due to a 120 second wait for the event to finish.
xEngineConfig.Set("WaitForEventCompletionOnScriptStop", 120000); 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); m_scene = new SceneHelpers().SetupScene("My Test", TestHelpers.ParseTail(0x9999), 1000, 1000, configSource);
SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine); SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine);
m_scene.StartScripts(); m_scene.StartScripts();

View File

@ -1,4 +1,4 @@
dfadabce-becc-8749-2b74-781332befa2e 7ddea7b6-2c1f-1bf6-d0b1-8e99955c9587
<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer> <llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>
<key>controls</key> <key>controls</key>
<map> <map>
@ -1557,7 +1557,7 @@ dfadabce-becc-8749-2b74-781332befa2e
</map> </map>
<key>OS_APIVERSION</key><map> <key>OS_APIVERSION</key><map>
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
<key>value</key><string>9</string> <key>value</key><string>10</string>
</map> </map>
<key>OS_ATTACH_MSG_ALL</key><map> <key>OS_ATTACH_MSG_ALL</key><map>
<key>type</key><string>integer</string> <key>type</key><string>integer</string>
@ -6196,17 +6196,16 @@ dfadabce-becc-8749-2b74-781332befa2e
<map> <map>
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>ra</key><map><key>type</key><string>rotation</string></map></map> <map><key>a</key><map><key>type</key><string>float</string></map></map>
<map><key>rb</key><map><key>type</key><string>rotation</string></map></map> <map><key>b</key><map><key>type</key><string>float</string></map></map>
<map><key>margin</key><map><key>type</key><string>float</string></map></map>
</array> </array>
</map> </map>
<key>osApproxEquals</key> <key>osApproxEquals</key>
<map> <map>
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>ra</key><map><key>type</key><string>rotation</string></map></map> <map><key>va</key><map><key>type</key><string>vector</string></map></map>
<map><key>rb</key><map><key>type</key><string>rotation</string></map></map> <map><key>vb</key><map><key>type</key><string>vector</string></map></map>
</array> </array>
</map> </map>
<key>osApproxEquals</key> <key>osApproxEquals</key>
@ -6222,8 +6221,8 @@ dfadabce-becc-8749-2b74-781332befa2e
<map> <map>
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>va</key><map><key>type</key><string>vector</string></map></map> <map><key>ra</key><map><key>type</key><string>rotation</string></map></map>
<map><key>vb</key><map><key>type</key><string>vector</string></map></map> <map><key>rb</key><map><key>type</key><string>rotation</string></map></map>
</array> </array>
</map> </map>
<key>osApproxEquals</key> <key>osApproxEquals</key>
@ -6239,8 +6238,9 @@ dfadabce-becc-8749-2b74-781332befa2e
<map> <map>
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>a</key><map><key>type</key><string>float</string></map></map> <map><key>ra</key><map><key>type</key><string>rotation</string></map></map>
<map><key>b</key><map><key>type</key><string>float</string></map></map> <map><key>rb</key><map><key>type</key><string>rotation</string></map></map>
<map><key>margin</key><map><key>type</key><string>float</string></map></map>
</array> </array>
</map> </map>
<key>osAvatarName2Key</key> <key>osAvatarName2Key</key>
@ -6366,8 +6366,6 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>return</key><string>string</string> <key>return</key><string>string</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>drawList</key><map><key>type</key><string>string</string></map></map> <map><key>drawList</key><map><key>type</key><string>string</string></map></map>
<map><key>startX</key><map><key>type</key><string>integer</string></map></map>
<map><key>startY</key><map><key>type</key><string>integer</string></map></map>
<map><key>endX</key><map><key>type</key><string>integer</string></map></map> <map><key>endX</key><map><key>type</key><string>integer</string></map></map>
<map><key>endY</key><map><key>type</key><string>integer</string></map></map> <map><key>endY</key><map><key>type</key><string>integer</string></map></map>
</array> </array>
@ -6377,6 +6375,8 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>return</key><string>string</string> <key>return</key><string>string</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>drawList</key><map><key>type</key><string>string</string></map></map> <map><key>drawList</key><map><key>type</key><string>string</string></map></map>
<map><key>startX</key><map><key>type</key><string>integer</string></map></map>
<map><key>startY</key><map><key>type</key><string>integer</string></map></map>
<map><key>endX</key><map><key>type</key><string>integer</string></map></map> <map><key>endX</key><map><key>type</key><string>integer</string></map></map>
<map><key>endY</key><map><key>type</key><string>integer</string></map></map> <map><key>endY</key><map><key>type</key><string>integer</string></map></map>
</array> </array>
@ -6826,6 +6826,13 @@ dfadabce-becc-8749-2b74-781332befa2e
<map><key>agentId</key><map><key>type</key><string>key</string></map></map> <map><key>agentId</key><map><key>type</key><string>key</string></map></map>
</array> </array>
</map> </map>
<key>osIsNotValidNumber</key>
<map>
<key>return</key><string>integer</string>
<key>arguments</key><array>
<map><key>v</key><map><key>type</key><string>float</string></map></map>
</array>
</map>
<key>osIsNpc</key> <key>osIsNpc</key>
<map> <map>
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
@ -7057,6 +7064,7 @@ dfadabce-becc-8749-2b74-781332befa2e
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>npc</key><map><key>type</key><string>key</string></map></map> <map><key>npc</key><map><key>type</key><string>key</string></map></map>
<map><key>channel</key><map><key>type</key><string>integer</string></map></map>
<map><key>message</key><map><key>type</key><string>string</string></map></map> <map><key>message</key><map><key>type</key><string>string</string></map></map>
</array> </array>
</map> </map>
@ -7064,7 +7072,6 @@ dfadabce-becc-8749-2b74-781332befa2e
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>npc</key><map><key>type</key><string>key</string></map></map> <map><key>npc</key><map><key>type</key><string>key</string></map></map>
<map><key>channel</key><map><key>type</key><string>integer</string></map></map>
<map><key>message</key><map><key>type</key><string>string</string></map></map> <map><key>message</key><map><key>type</key><string>string</string></map></map>
</array> </array>
</map> </map>
@ -7211,13 +7218,13 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>osRegionNotice</key> <key>osRegionNotice</key>
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>agentID</key><map><key>type</key><string>key</string></map></map>
<map><key>msg</key><map><key>type</key><string>string</string></map></map> <map><key>msg</key><map><key>type</key><string>string</string></map></map>
</array> </array>
</map> </map>
<key>osRegionNotice</key> <key>osRegionNotice</key>
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>agentID</key><map><key>type</key><string>key</string></map></map>
<map><key>msg</key><map><key>type</key><string>string</string></map></map> <map><key>msg</key><map><key>type</key><string>string</string></map></map>
</array> </array>
</map> </map>
@ -7226,7 +7233,6 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>seconds</key><map><key>type</key><string>float</string></map></map> <map><key>seconds</key><map><key>type</key><string>float</string></map></map>
<map><key>msg</key><map><key>type</key><string>string</string></map></map>
</array> </array>
</map> </map>
<key>osRegionRestart</key> <key>osRegionRestart</key>
@ -7234,6 +7240,7 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>seconds</key><map><key>type</key><string>float</string></map></map> <map><key>seconds</key><map><key>type</key><string>float</string></map></map>
<map><key>msg</key><map><key>type</key><string>string</string></map></map>
</array> </array>
</map> </map>
<key>osReplaceString</key> <key>osReplaceString</key>
@ -7463,7 +7470,7 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>osSetProjectionParams</key> <key>osSetProjectionParams</key>
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>linknumber</key><map><key>type</key><string>integer</string></map></map> <map><key>prim</key><map><key>type</key><string>key</string></map></map>
<map><key>projection</key><map><key>type</key><string>integer</string></map></map> <map><key>projection</key><map><key>type</key><string>integer</string></map></map>
<map><key>texture</key><map><key>type</key><string>key</string></map></map> <map><key>texture</key><map><key>type</key><string>key</string></map></map>
<map><key>fov</key><map><key>type</key><string>float</string></map></map> <map><key>fov</key><map><key>type</key><string>float</string></map></map>
@ -7474,7 +7481,7 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>osSetProjectionParams</key> <key>osSetProjectionParams</key>
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>prim</key><map><key>type</key><string>key</string></map></map> <map><key>linknumber</key><map><key>type</key><string>integer</string></map></map>
<map><key>projection</key><map><key>type</key><string>integer</string></map></map> <map><key>projection</key><map><key>type</key><string>integer</string></map></map>
<map><key>texture</key><map><key>type</key><string>key</string></map></map> <map><key>texture</key><map><key>type</key><string>key</string></map></map>
<map><key>fov</key><map><key>type</key><string>float</string></map></map> <map><key>fov</key><map><key>type</key><string>float</string></map></map>
@ -7662,6 +7669,7 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>arguments</key><array> <key>arguments</key><array>
<map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>src</key><map><key>type</key><string>string</string></map></map>
<map><key>start</key><map><key>type</key><string>integer</string></map></map> <map><key>start</key><map><key>type</key><string>integer</string></map></map>
<map><key>length</key><map><key>type</key><string>integer</string></map></map>
</array> </array>
</map> </map>
<key>osStringSubString</key> <key>osStringSubString</key>
@ -7670,7 +7678,6 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>arguments</key><array> <key>arguments</key><array>
<map><key>src</key><map><key>type</key><string>string</string></map></map> <map><key>src</key><map><key>type</key><string>string</string></map></map>
<map><key>start</key><map><key>type</key><string>integer</string></map></map> <map><key>start</key><map><key>type</key><string>integer</string></map></map>
<map><key>length</key><map><key>type</key><string>integer</string></map></map>
</array> </array>
</map> </map>
<key>osSunGetParam</key> <key>osSunGetParam</key>
@ -7688,14 +7695,6 @@ dfadabce-becc-8749-2b74-781332befa2e
</array> </array>
</map> </map>
<key>osTeleportAgent</key> <key>osTeleportAgent</key>
<map>
<key>arguments</key><array>
<map><key>agent</key><map><key>type</key><string>string</string></map></map>
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array>
</map>
<key>osTeleportAgent</key>
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>agent</key><map><key>type</key><string>string</string></map></map> <map><key>agent</key><map><key>type</key><string>string</string></map></map>
@ -7714,6 +7713,14 @@ dfadabce-becc-8749-2b74-781332befa2e
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array> </array>
</map> </map>
<key>osTeleportAgent</key>
<map>
<key>arguments</key><array>
<map><key>agent</key><map><key>type</key><string>string</string></map></map>
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array>
</map>
<key>osTeleportObject</key> <key>osTeleportObject</key>
<map> <map>
<key>return</key><string>integer</string> <key>return</key><string>integer</string>
@ -7734,7 +7741,8 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>osTeleportOwner</key> <key>osTeleportOwner</key>
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>regionName</key><map><key>type</key><string>string</string></map></map> <map><key>regionX</key><map><key>type</key><string>integer</string></map></map>
<map><key>regionY</key><map><key>type</key><string>integer</string></map></map>
<map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array> </array>
@ -7742,8 +7750,7 @@ dfadabce-becc-8749-2b74-781332befa2e
<key>osTeleportOwner</key> <key>osTeleportOwner</key>
<map> <map>
<key>arguments</key><array> <key>arguments</key><array>
<map><key>regionX</key><map><key>type</key><string>integer</string></map></map> <map><key>regionName</key><map><key>type</key><string>string</string></map></map>
<map><key>regionY</key><map><key>type</key><string>integer</string></map></map>
<map><key>position</key><map><key>type</key><string>vector</string></map></map> <map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map> <map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array> </array>