From 4f3975f04e7bbaf7b7b8e286831714240ced5e6d Mon Sep 17 00:00:00 2001 From: Rob Smart Date: Fri, 18 Sep 2009 14:11:38 +0100 Subject: addition of a new script function osSetParcelSIPAddress(string SIPAddress), now including iVoiceModule This patch allows the land owner to dynamically set the SIP address of a particular land parcel from script. This allows predetermined SIP addresses to be used, making it easier to allow non OpenSim users to join a regions voice channel. Signed-off-by: dr scofield (aka dirk husemann) --- .../Shared/Api/Implementation/OSSL_Api.cs | 29 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 3 files changed, 35 insertions(+) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 726b37a..ccdd4c5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1164,6 +1164,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api land.SetMediaUrl(url); } + + public void osSetParcelSIPAddress(string SIPAddress) + { + // What actually is the difference to the LL function? + // + CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); + + m_host.AddScriptLPS(1); + + + ILandObject land + = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.landData.OwnerID != m_host.ObjectOwner) + { + OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); + return; + } + + // get the voice module + IVoiceModule voiceModule = World.RequestModuleInterface(); + + if (voiceModule != null) + voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID); + else + OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); + + + } public string osGetScriptEngineName() { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 49aa45a..d8d3c31 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -75,6 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces bool osConsoleCommand(string Command); void osSetParcelMediaURL(string url); void osSetPrimFloatOnWater(int floatYN); + void osSetParcelSIPAddress(string SIPAddress); // Avatar Info Commands string osGetAgentIP(string agent); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 8f52d99..d0df390 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -183,6 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osSetParcelMediaURL(url); } + + public void osSetParcelSIPAddress(string SIPAddress) + { + m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress); + } public void osSetPrimFloatOnWater(int floatYN) { -- cgit v1.1 From d835485a1fac7594f30ebc3a648eb70dcc2c20d8 Mon Sep 17 00:00:00 2001 From: BlueWall (James Hughes) Date: Fri, 18 Sep 2009 16:32:46 -0400 Subject: Updatate llOpenRemoteDataChannel to provide the external hostname configured in the Regions.ini (or xml) to the XmlRpcGridRouterModule --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ba42678..02be983 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6321,9 +6321,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface(); if (xmlRpcRouter != null) + { + string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; + xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, - m_itemID, String.Format("http://{0}:{1}/", System.Environment.MachineName, + m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, xmlrpcMod.Port.ToString())); + } object[] resobj = new object[] { new LSL_Integer(1), -- cgit v1.1 From 97c18caa766e2dd72b152b78827ef554f2054f8c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Sep 2009 17:04:34 +0100 Subject: Thank you, Intari, for a patch that implements the missing pieces of Http-in and makes the host name for URL generation configurable. Applied with changes: llGetSimulatorHostname was not changed, because the change breaks existing behavior and carries a data exposure risk. That value needs to be configurable, the proposed fixed change is not acceptable. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +++++++++----- .../Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 02be983..b631478 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7838,8 +7838,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) { m_host.AddScriptLPS(1); - NotImplemented("llGetHTTPHeader"); - return String.Empty; + + if (m_UrlModule != null) + return m_UrlModule.GetHttpHeader(new UUID(request_id), header); + return String.Empty; } @@ -9117,13 +9119,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - public void llHTTPResponse(string url, int status, string body) + public void llHTTPResponse(LSL_Key id, int status, string body) { // Partial implementation: support for parameter flags needed // see http://wiki.secondlife.com/wiki/llHTTPResponse - m_host.AddScriptLPS(1); - NotImplemented("llHTTPResponse"); + m_host.AddScriptLPS(1); + + if (m_UrlModule != null) + m_UrlModule.HttpResponse(new UUID(id), status,body); } public void llResetLandBanList() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 41358e5..a74e8da 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -201,7 +201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llGroundRepel(double height, int water, double tau); LSL_Vector llGroundSlope(LSL_Vector offset); LSL_String llHTTPRequest(string url, LSL_List parameters, string body); - void llHTTPResponse(string url, int status, string body); + void llHTTPResponse(LSL_Key id, int status, string body); LSL_String llInsertString(string dst, int position, string src); void llInstantMessage(string user, string message); LSL_String llIntegerToBase64(int number); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 02ae281..a28e97b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -864,9 +864,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llHTTPRequest(url, parameters, body); } - public void llHTTPResponse(string url, int status, string body) + public void llHTTPResponse(LSL_Key id, int status, string body) { - m_LSL_Functions.llHTTPResponse(url, status, body); + m_LSL_Functions.llHTTPResponse(id, status, body); } public LSL_String llInsertString(string dst, int position, string src) -- cgit v1.1 From b7265abfaeb256ebc8421ee1d647dd68f08ff77a Mon Sep 17 00:00:00 2001 From: Alan M Webb Date: Mon, 21 Sep 2009 08:42:01 -0400 Subject: Added delay loop to give a newly created assembly time to appear. On Linux (as an example), it is possible for the existence check to fail because the file is not yet recognized by the file system. Although the loop has a 250mS delay, in practise, the existence test in the for loop is successful and no delay is introduced. Next, this takes care of the two, unpredictable, situations where a script fails to compile. The first is caused by an occasional SEGV in the underlying mono VM while mcs is running, the second is caused by file system latency. Signed-off-by: dr scofield (aka dirk husemann) --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 103 ++++++++++++++------- 1 file changed, 71 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index cb5664b..5a94957 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -542,11 +542,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools break; case enumCompileType.cs: case enumCompileType.lsl: - lock (CScodeProvider) + bool complete = false; + bool retried = false; + do { - results = CScodeProvider.CompileAssemblyFromSource( - parameters, Script); + lock (CScodeProvider) + { + results = CScodeProvider.CompileAssemblyFromSource( + parameters, Script); + } + // Deal with an occasional segv in the compiler. + // Rarely, if ever, occurs twice in succession. + // Line # == 0 and no file name are indications that + // this is a native stack trace rather than a normal + // error log. + if (results.Errors.Count > 0) + { + if (!retried && (results.Errors[0].FileName == null || results.Errors[0].FileName == String.Empty) && + results.Errors[0].Line == 0) + { + // System.Console.WriteLine("retrying failed compilation"); + retried = true; + } + else + { + complete = true; + } + } + else + { + complete = true; + } } + while(!complete); break; case enumCompileType.js: results = JScodeProvider.CompileAssemblyFromSource( @@ -567,17 +595,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // // WARNINGS AND ERRORS // - int display = 5; + bool hadErrors = false; + string errtext = String.Empty; + if (results.Errors.Count > 0) { - string errtext = String.Empty; foreach (CompilerError CompErr in results.Errors) { - // Show 5 errors max - // - if (display <= 0) - break; - display--; string severity = "Error"; if (CompErr.IsWarning) @@ -587,36 +611,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools KeyValuePair lslPos; - lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); + // Show 5 errors max, but check entire list for errors + + if (severity == "Error") + { + lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); + string text = CompErr.ErrorText; + + // Use LSL type names + if (lang == enumCompileType.lsl) + text = ReplaceTypes(CompErr.ErrorText); + + // The Second Life viewer's script editor begins + // countingn lines and columns at 0, so we subtract 1. + errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", + lslPos.Key - 1, lslPos.Value - 1, + CompErr.ErrorNumber, text, severity); + hadErrors = true; + } + } + } - string text = CompErr.ErrorText; + if (hadErrors) + { + throw new Exception(errtext); + } - // Use LSL type names - if (lang == enumCompileType.lsl) - text = ReplaceTypes(CompErr.ErrorText); + // On today's highly asynchronous systems, the result of + // the compile may not be immediately apparent. Wait a + // reasonable amount of time before giving up on it. - // The Second Life viewer's script editor begins - // countingn lines and columns at 0, so we subtract 1. - errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", - lslPos.Key - 1, lslPos.Value - 1, - CompErr.ErrorNumber, text, severity); + if (!File.Exists(OutFile)) + { + for (int i=0; i<20 && !File.Exists(OutFile); i++) + { + System.Threading.Thread.Sleep(250); } - + // One final chance... if (!File.Exists(OutFile)) { + errtext = String.Empty; + errtext += "No compile error. But not able to locate compiled file."; throw new Exception(errtext); } } - // - // NO ERRORS, BUT NO COMPILED FILE - // - if (!File.Exists(OutFile)) - { - string errtext = String.Empty; - errtext += "No compile error. But not able to locate compiled file."; - throw new Exception(errtext); - } // m_log.DebugFormat("[Compiler] Compiled new assembly "+ // "for {0}", asset); @@ -629,7 +668,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (fi == null) { - string errtext = String.Empty; + errtext = String.Empty; errtext += "No compile error. But not able to stat file."; throw new Exception(errtext); } @@ -644,7 +683,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } catch (Exception) { - string errtext = String.Empty; + errtext = String.Empty; errtext += "No compile error. But not able to open file."; throw new Exception(errtext); } -- cgit v1.1 From 9c2ffa8f2e49aa70e0b2c6afff875bbdb84ba0dc Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Wed, 23 Sep 2009 14:55:22 -0400 Subject: * fix endlines in LSL_api.cs --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b631478..4c52b11 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + using System; using System.Collections; using System.Collections.Generic; @@ -7838,8 +7838,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) { m_host.AddScriptLPS(1); - - if (m_UrlModule != null) + + if (m_UrlModule != null) return m_UrlModule.GetHttpHeader(new UUID(request_id), header); return String.Empty; } @@ -9124,9 +9124,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Partial implementation: support for parameter flags needed // see http://wiki.secondlife.com/wiki/llHTTPResponse - m_host.AddScriptLPS(1); - - if (m_UrlModule != null) + m_host.AddScriptLPS(1); + + if (m_UrlModule != null) m_UrlModule.HttpResponse(new UUID(id), status,body); } -- cgit v1.1 From 5757afe7665543e8b3ed4a322a7d6e095dafcdb3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 26 Sep 2009 07:48:21 -0700 Subject: First pass at the heart surgery for grid services. Compiles and runs minimally. A few bugs to catch now. --- .../Shared/Api/Implementation/LSL_Api.cs | 11 ++++++---- .../Shared/Api/Implementation/OSSL_Api.cs | 25 +++++++++++++--------- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4c52b11..1ebe24e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -50,6 +50,9 @@ 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 OpenSim.Services.Interfaces; + +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using AssetLandmark = OpenSim.Framework.AssetLandmark; @@ -5226,12 +5229,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - List neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); + List neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID); uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; - foreach (SimpleRegionInfo sri in neighbors) + foreach (GridRegion sri in neighbors) { if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) return 0; @@ -8181,7 +8184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string reply = String.Empty; - RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); + GridRegion info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); switch (data) { @@ -8208,7 +8211,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ConditionalScriptSleep(1000); return UUID.Zero.ToString(); } - int access = info.RegionSettings.Maturity; + int access = info.Maturity; if (access == 0) reply = "PG"; else if (access == 1) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ccdd4c5..0b95abc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -48,6 +48,8 @@ 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.Services.Interfaces; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using System.Text.RegularExpressions; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; @@ -599,17 +601,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (regionName.Contains(".") && regionName.Contains(":")) { // Try to link the region - RegionInfo regInfo = HGHyperlink.TryLinkRegion(World, - presence.ControllingClient, - regionName); - // Get the region name - if (regInfo != null) + IHyperlinkService hyperService = World.RequestModuleInterface(); + if (hyperService != null) { - regionName = regInfo.RegionName; - } - else - { - // Might need to ping the client here in case of failure?? + GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient, + regionName); + // Get the region name + if (regInfo != null) + { + regionName = regInfo.RegionName; + } + else + { + // Might need to ping the client here in case of failure?? + } } } presence.ControllingClient.SendTeleportLocationStart(); -- cgit v1.1 From f00126dc2dfc9e23aa50227f02ee9adbe1efdfa6 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 29 Sep 2009 08:32:59 +0900 Subject: Add copyright header. Formatting cleanup. --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 50 ++++++++++------------ 1 file changed, 22 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 5a94957..fe26429 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -546,11 +546,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools bool retried = false; do { - lock (CScodeProvider) - { - results = CScodeProvider.CompileAssemblyFromSource( - parameters, Script); - } + lock (CScodeProvider) + { + results = CScodeProvider.CompileAssemblyFromSource( + parameters, Script); + } // Deal with an occasional segv in the compiler. // Rarely, if ever, occurs twice in succession. // Line # == 0 and no file name are indications that @@ -573,20 +573,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools { complete = true; } - } - while(!complete); + } while (!complete); break; case enumCompileType.js: results = JScodeProvider.CompileAssemblyFromSource( - parameters, Script); + parameters, Script); break; case enumCompileType.yp: results = YPcodeProvider.CompileAssemblyFromSource( - parameters, Script); + parameters, Script); break; default: throw new Exception("Compiler is not able to recongnize "+ - "language type \"" + lang.ToString() + "\""); + "language type \"" + lang.ToString() + "\""); } // Check result @@ -602,12 +601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools { foreach (CompilerError CompErr in results.Errors) { - - string severity = "Error"; - if (CompErr.IsWarning) - { - severity = "Warning"; - } + string severity = CompErr.IsWarning ? "Warning" : "Error"; KeyValuePair lslPos; @@ -615,18 +609,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (severity == "Error") { - lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); - string text = CompErr.ErrorText; - - // Use LSL type names - if (lang == enumCompileType.lsl) - text = ReplaceTypes(CompErr.ErrorText); - - // The Second Life viewer's script editor begins - // countingn lines and columns at 0, so we subtract 1. - errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", - lslPos.Key - 1, lslPos.Value - 1, - CompErr.ErrorNumber, text, severity); + lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); + string text = CompErr.ErrorText; + + // Use LSL type names + if (lang == enumCompileType.lsl) + text = ReplaceTypes(CompErr.ErrorText); + + // The Second Life viewer's script editor begins + // countingn lines and columns at 0, so we subtract 1. + errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", + lslPos.Key - 1, lslPos.Value - 1, + CompErr.ErrorNumber, text, severity); hadErrors = true; } } -- cgit v1.1 From a43706862c13944c92b3762ed8742415a0363275 Mon Sep 17 00:00:00 2001 From: Alan M Webb Date: Tue, 29 Sep 2009 07:10:54 -0400 Subject: Given the perverse way that strided works, if there is only one element in the range, it must also coincide with the specified stride. The existing code assumes that the stride starts at start ( which is the expected and most useful behavior). Signed-off-by: dr scofield (aka dirk husemann) --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1ebe24e..0bd6546 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4999,6 +4999,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (end > src.Length) end = src.Length; + if (stride == 0) + stride = 1; + // There may be one or two ranges to be considered if (start != end) @@ -5025,9 +5028,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // A negative stride reverses the direction of the // scan producing an inverted list as a result. - if (stride == 0) - stride = 1; - if (stride > 0) { for (int i = 0; i < src.Length; i += stride) @@ -5051,7 +5051,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - result.Add(src.Data[start]); + if (start%stride == 0) + { + result.Add(src.Data[start]); + } } return result; -- cgit v1.1 From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 Oct 2009 01:00:09 +0900 Subject: Formatting cleanup. --- OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs | 2 +- OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | 6 +++--- OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 8 ++++---- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs index 569009e..0feb967 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs @@ -225,7 +225,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened m_log.ErrorFormat( "[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}", - ScriptEngineName, e); + ScriptEngineName, e); } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 8ad916c..3c91b29 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -418,7 +418,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { InstanceData id = m_ScriptManager.GetScript(localID, itemID); if (id == null) - return; + return; if (!id.Disabled) id.Running = true; @@ -428,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { InstanceData id = m_ScriptManager.GetScript(localID, itemID); if (id == null) - return; + return; id.Running = false; } @@ -442,7 +442,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine InstanceData id = m_ScriptManager.GetScript(localID, itemID); if (id == null) - return; + return; IEventQueue eq = World.RequestModuleInterface(); if (eq == null) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 9c1cd4d..6ac209e 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -520,13 +520,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine ExeStage = 5; // ;^) Ewe Loon, for debuging } catch (Exception e) // ;^) Ewe Loon, From here down tis fix - { + { if ((ExeStage == 3)&&(qParams.Length>0)) detparms.Remove(id); SceneObjectPart ob = m_scriptEngine.World.GetSceneObjectPart(localID); m_log.InfoFormat("[Script Error] ,{0},{1},@{2},{3},{4},{5}", ob.Name , FunctionName, ExeStage, e.Message, qParams.Length, detparms.Count); if (ExeStage != 2) throw e; - } + } } public uint GetLocalID(UUID itemID) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index d0df390..8dcb1f5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osWindActiveModelPluginName(); } -// Not yet plugged in as available OSSL functions, so commented out +// Not yet plugged in as available OSSL functions, so commented out // void osWindParamSet(string plugin, string param, float value) // { // m_OSSL_Functions.osWindParamSet(plugin, param, value); @@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public string osGetSimulatorVersion() { - return m_OSSL_Functions.osGetSimulatorVersion(); + return m_OSSL_Functions.osGetSimulatorVersion(); } public Hashtable osParseJSON(string JSON) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 650d9fa..97166cf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance "SecondLife.Script"); //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); - RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); + RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); // lease.Register(this); } catch (Exception) @@ -430,7 +430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance permsGranter = part.TaskInventory[m_ItemID].PermsGranter; permsMask = part.TaskInventory[m_ItemID].PermsMask; - } + } if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) { @@ -630,7 +630,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance /// /// Process the next event queued for this script /// - /// + /// public object EventProcessor() { lock (m_Script) @@ -925,7 +925,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance public override string ToString() { - return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName); + return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName); } string FormatException(Exception e) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 9a972c2..e695133 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -554,7 +554,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine // We must look for the part outside the m_Scripts lock because GetSceneObjectPart later triggers the // m_parts lock on SOG. At the same time, a scene object that is being deleted will take the m_parts lock - // and then later on try to take the m_scripts lock in this class when it calls OnRemoveScript() + // and then later on try to take the m_scripts lock in this class when it calls OnRemoveScript() SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); if (part == null) { @@ -562,7 +562,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n"; m_ScriptFailCount++; return false; - } + } TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); if (item == null) @@ -692,7 +692,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine AppDomain.CreateDomain( m_Scene.RegionInfo.RegionID.ToString(), evidence, appSetup); -/* +/* PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet"); @@ -925,7 +925,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine return new XWorkItem(m_ThreadPool.QueueWorkItem( new WorkItemCallback(this.ProcessEventHandler), parms)); - } + } /// /// Process a previously posted script event. -- cgit v1.1