From 4d652c704186e9e399ffc6fc1bdf1f1dca056370 Mon Sep 17 00:00:00 2001
From: Talun
Date: Sat, 14 Apr 2012 00:37:55 +0100
Subject: Missing or unimplemented LSL memory functions.

Implemented to behave as if scripts were LSO.

Signed-off-by: nebadon <michael@osgrid.org>
---
 .../Shared/Api/Implementation/LSL_Api.cs           | 40 +++++++++++++++-------
 .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs  |  7 +++-
 .../Shared/Api/Runtime/LSL_Constants.cs            |  3 ++
 .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs    | 25 ++++++++++++++
 4 files changed, 62 insertions(+), 13 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 078a22a..a19427d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10949,34 +10949,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
             return 1;
         }
 
-        #region Not Implemented
-        //
-        // Listing the unimplemented lsl functions here, please move
-        // them from this region as they are completed
-        //
+        public LSL_Integer llGetMemoryLimit()
+        {
+            m_host.AddScriptLPS(1);
+            // The value returned for LSO scripts in SL
+            return 16384;
+        }
 
-        public void llGetEnv(LSL_String name)
+        public LSL_Integer llSetMemoryLimit(LSL_Integer limit)
         {
             m_host.AddScriptLPS(1);
-            NotImplemented("llGetEnv");
+            // Treat as an LSO script
+            return ScriptBaseClass.FALSE;
         }
 
-        public void llGetSPMaxMemory()
+        public LSL_Integer llGetSPMaxMemory()
         {
             m_host.AddScriptLPS(1);
-            NotImplemented("llGetSPMaxMemory");
+            // The value returned for LSO scripts in SL
+            return 16384;
         }
 
-        public void llGetUsedMemory()
+        public LSL_Integer llGetUsedMemory()
         {
             m_host.AddScriptLPS(1);
-            NotImplemented("llGetUsedMemory");
+            // The value returned for LSO scripts in SL
+            return 16384;
         }
 
         public void llScriptProfiler(LSL_Integer flags)
         {
             m_host.AddScriptLPS(1);
-            NotImplemented("llScriptProfiler");
+            // This does nothing for LSO scripts in SL
+        }
+
+        #region Not Implemented
+        //
+        // Listing the unimplemented lsl functions here, please move
+        // them from this region as they are completed
+        //
+
+        public void llGetEnv(LSL_String name)
+        {
+            m_host.AddScriptLPS(1);
+            NotImplemented("llGetEnv");
         }
 
         public void llSetSoundQueueing(int queue)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 0f53bc3..11b21d4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -147,7 +147,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
         LSL_Vector llGetLocalPos();
       LSL_Rotation llGetLocalRot();
          LSL_Float llGetMass();
-              void llGetNextEmail(string address, string subject);
+       LSL_Integer llGetMemoryLimit();
+      void llGetNextEmail(string address, string subject);
         LSL_String llGetNotecardLine(string name, int line);
            LSL_Key llGetNumberOfNotecardLines(string name);
        LSL_Integer llGetNumberOfPrims();
@@ -185,6 +186,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
         LSL_String llGetScriptName();
        LSL_Integer llGetScriptState(string name);
         LSL_String llGetSimulatorHostname();
+       LSL_Integer llGetSPMaxMemory();
        LSL_Integer llGetStartParameter();
        LSL_Integer llGetStatus(int status);
         LSL_String llGetSubString(string src, int start, int end);
@@ -198,6 +200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
         LSL_String llGetTimestamp();
         LSL_Vector llGetTorque();
        LSL_Integer llGetUnixTime();
+       LSL_Integer llGetUsedMemory();
         LSL_Vector llGetVel();
          LSL_Float llGetWallclock();
               void llGiveInventory(string destination, string inventory);
@@ -319,6 +322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
               void llSay(int channelID, string text);
               void llScaleTexture(double u, double v, int face);
        LSL_Integer llScriptDanger(LSL_Vector pos);
+              void llScriptProfiler(LSL_Integer flag);
            LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata);
               void llSensor(string name, string id, int type, double range, double arc);
               void llSensorRemove();
@@ -342,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
               void llSetLinkTexture(int linknumber, string texture, int face);
               void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
               void llSetLocalRot(LSL_Rotation rot);
+       LSL_Integer llSetMemoryLimit(LSL_Integer limit);
               void llSetObjectDesc(string desc);
               void llSetObjectName(string name);
               void llSetObjectPermMask(int mask, int value);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index f58f9d6..fd7c41e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -381,6 +381,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
         public const int PRIM_SCULPT_FLAG_INVERT = 64;
         public const int PRIM_SCULPT_FLAG_MIRROR = 128;
 
+        public const int PROFILE_NONE = 0;
+        public const int PROFILE_SCRIPT_MEMORY = 1;
+
         public const int MASK_BASE = 0;
         public const int MASK_OWNER = 1;
         public const int MASK_GROUP = 2;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index f8e3c36..3c2f7bd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -569,6 +569,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
             return m_LSL_Functions.llGetMass();
         }
 
+        public LSL_Integer llGetMemoryLimit()
+        {
+            return m_LSL_Functions.llGetMemoryLimit();
+        }
+
         public void llGetNextEmail(string address, string subject)
         {
             m_LSL_Functions.llGetNextEmail(address, subject);
@@ -759,6 +764,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
             return m_LSL_Functions.llGetSimulatorHostname();
         }
 
+        public LSL_Integer llGetSPMaxMemory()
+        {
+            return m_LSL_Functions.llGetSPMaxMemory();
+        }
+
         public LSL_Integer llGetStartParameter()
         {
             return m_LSL_Functions.llGetStartParameter();
@@ -824,6 +834,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
             return m_LSL_Functions.llGetUnixTime();
         }
 
+        public LSL_Integer llGetUsedMemory()
+        {
+            return m_LSL_Functions.llGetUsedMemory();
+        }
+
         public LSL_Vector llGetVel()
         {
             return m_LSL_Functions.llGetVel();
@@ -1423,6 +1438,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
             return m_LSL_Functions.llScriptDanger(pos);
         }
 
+        public void llScriptProfiler(LSL_Integer flags)
+        {
+            m_LSL_Functions.llScriptProfiler(flags);
+        }
+
         public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata)
         {
             return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata);
@@ -1533,6 +1553,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
             m_LSL_Functions.llSetLocalRot(rot);
         }
 
+        public LSL_Integer llSetMemoryLimit(LSL_Integer limit)
+        {
+            return m_LSL_Functions.llSetMemoryLimit(limit);
+        }
+
         public void llSetObjectDesc(string desc)
         {
             m_LSL_Functions.llSetObjectDesc(desc);
-- 
cgit v1.1


From 4bdd9d51bc0ccfa5b15a6e77228f69dafada03b7 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 14 Apr 2012 01:04:26 +0100
Subject: Correct whitespace error introduced by previous commit

---
 OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 11b21d4..69df392 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -148,7 +148,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
       LSL_Rotation llGetLocalRot();
          LSL_Float llGetMass();
        LSL_Integer llGetMemoryLimit();
-      void llGetNextEmail(string address, string subject);
+              void llGetNextEmail(string address, string subject);
         LSL_String llGetNotecardLine(string name, int line);
            LSL_Key llGetNumberOfNotecardLines(string name);
        LSL_Integer llGetNumberOfPrims();
-- 
cgit v1.1