From 05e8b4e72c440e19c54fbcb17e2120834a27c3ab Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Dec 2009 06:25:32 +0100 Subject: Add a data path for error messages Committed from my other box where git is not configured properly Signed-off-by: Melanie --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 25a4cd6..035686e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1470,5 +1470,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine return true; } + + public ArrayList GetScriptErrors(UUID itemID) + { + return new ArrayList(); + } } } -- cgit v1.1 From b53b87166940ca0fca4ae2190649e18102c886ec Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Dec 2009 06:25:32 +0100 Subject: Add a data path for error messages --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 2a9a2db..31684ae 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1552,5 +1552,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine return true; } + + public ArrayList GetScriptErrors(UUID itemID) + { + return new ArrayList(); + } } } -- cgit v1.1 From 1876ce90af98722a205d1c7181ef66b6a2b54fc5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Dec 2009 09:24:01 +0000 Subject: FINALLY! Script compile errors now appear in the script error pane, not in a funky debug window. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 163 ++++++++++++++----------- 1 file changed, 93 insertions(+), 70 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 035686e..11b02e1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -77,6 +77,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine private string m_ScriptErrorMessage; private Dictionary m_uniqueScripts = new Dictionary(); private bool m_AppDomainLoading; + private Dictionary m_ScriptErrors = + new Dictionary(); // disable warning: need to keep a reference to XEngine.EventManager // alive to avoid it being garbage collected @@ -589,87 +591,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine Dictionary, KeyValuePair> linemap; - try + lock(m_ScriptErrors) { - lock (m_AddingAssemblies) + try { - m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); - if (!m_AddingAssemblies.ContainsKey(assembly)) { - m_AddingAssemblies[assembly] = 1; - } else { - m_AddingAssemblies[assembly]++; + lock (m_AddingAssemblies) + { + m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); + if (!m_AddingAssemblies.ContainsKey(assembly)) { + m_AddingAssemblies[assembly] = 1; + } else { + m_AddingAssemblies[assembly]++; + } } - } - string[] warnings = m_Compiler.GetWarnings(); + string[] warnings = m_Compiler.GetWarnings(); - if (warnings != null && warnings.Length != 0) - { - foreach (string warning in warnings) + if (warnings != null && warnings.Length != 0) { - try + foreach (string warning in warnings) { - // DISPLAY WARNING INWORLD - string text = "Warning:\n" + warning; - if (text.Length > 1000) - text = text.Substring(0, 1000); - if (!ShowScriptSaveResponse(item.OwnerID, - assetID, text, true)) - { - if (presence != null && (!postOnRez)) - presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false); - - World.SimChat(Utils.StringToBytes(text), - ChatTypeEnum.DebugChannel, 2147483647, - part.AbsolutePosition, - part.Name, part.UUID, false); - } - } - catch (Exception e2) // LEGIT: User Scripting - { - m_log.Error("[XEngine]: " + - "Error displaying warning in-world: " + - e2.ToString()); - m_log.Error("[XEngine]: " + - "Warning:\r\n" + - warning); + if (!m_ScriptErrors.ContainsKey(itemID)) + m_ScriptErrors[itemID] = new ArrayList(); + + m_ScriptErrors[itemID].Add(warning); + // try + // { + // // DISPLAY WARNING INWORLD + // string text = "Warning:\n" + warning; + // if (text.Length > 1000) + // text = text.Substring(0, 1000); + // if (!ShowScriptSaveResponse(item.OwnerID, + // assetID, text, true)) + // { + // if (presence != null && (!postOnRez)) + // presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false); + // + // World.SimChat(Utils.StringToBytes(text), + // ChatTypeEnum.DebugChannel, 2147483647, + // part.AbsolutePosition, + // part.Name, part.UUID, false); + // } + // } + // catch (Exception e2) // LEGIT: User Scripting + // { + // m_log.Error("[XEngine]: " + + // "Error displaying warning in-world: " + + // e2.ToString()); + // m_log.Error("[XEngine]: " + + // "Warning:\r\n" + + // warning); + // } } } } - } - catch (Exception e) - { - try + catch (Exception e) { - // DISPLAY ERROR INWORLD - m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString(); - - m_ScriptFailCount++; - string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString(); - if (text.Length > 1000) - text = text.Substring(0, 1000); - if (!ShowScriptSaveResponse(item.OwnerID, - assetID, text, false)) - { - if (presence != null && (!postOnRez)) - presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false); - World.SimChat(Utils.StringToBytes(text), - ChatTypeEnum.DebugChannel, 2147483647, - part.AbsolutePosition, - part.Name, part.UUID, false); - } - } - catch (Exception e2) // LEGIT: User Scripting - { - m_log.Error("[XEngine]: "+ - "Error displaying error in-world: " + - e2.ToString()); - m_log.Error("[XEngine]: " + - "Errormessage: Error compiling script:\r\n" + - e.Message.ToString()); - } + // try + // { + if (!m_ScriptErrors.ContainsKey(itemID)) + m_ScriptErrors[itemID] = new ArrayList(); + // DISPLAY ERROR INWORLD + // m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString(); + // + m_ScriptFailCount++; + m_ScriptErrors[itemID].Add(e.Message.ToString()); + // string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString(); + // if (text.Length > 1000) + // text = text.Substring(0, 1000); + // if (!ShowScriptSaveResponse(item.OwnerID, + // assetID, text, false)) + // { + // if (presence != null && (!postOnRez)) + // presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false); + // World.SimChat(Utils.StringToBytes(text), + // ChatTypeEnum.DebugChannel, 2147483647, + // part.AbsolutePosition, + // part.Name, part.UUID, false); + // } + // } + // catch (Exception e2) // LEGIT: User Scripting + // { + // m_log.Error("[XEngine]: "+ + // "Error displaying error in-world: " + + // e2.ToString()); + // m_log.Error("[XEngine]: " + + // "Errormessage: Error compiling script:\r\n" + + // e.Message.ToString()); + // } - return false; + return false; + } } lock (m_Scripts) @@ -1473,7 +1485,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine public ArrayList GetScriptErrors(UUID itemID) { - return new ArrayList(); + System.Threading.Thread.Sleep(1000); + + lock (m_ScriptErrors) + { + if (m_ScriptErrors.ContainsKey(itemID)) + { + ArrayList ret = m_ScriptErrors[itemID]; + m_ScriptErrors.Remove(itemID); + return ret; + } + return new ArrayList(); + } } } } -- cgit v1.1 From 33d5018e94e52cb875bf43bced623bdc6aa41ef0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Dec 2009 15:35:39 +0000 Subject: Remove an insterface member that was never used --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 11b02e1..4512e98 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1182,21 +1182,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine return UUID.Zero; } - public void SetState(UUID itemID, string newState) - { - IScriptInstance instance = GetInstance(itemID); - if (instance == null) - return; - instance.SetState(newState); - } - public string GetState(UUID itemID) - { - IScriptInstance instance = GetInstance(itemID); - if (instance == null) - return "default"; - return instance.State; - } - public int GetStartParameter(UUID itemID) { IScriptInstance instance = GetInstance(itemID); -- cgit v1.1 From a24d9bff0394e98ef474430c39b3b4c917f102fb Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Dec 2009 15:45:56 +0000 Subject: Revert "Remove an insterface member that was never used" It was used. By the API, which is dynamically loaded. So it didn't complain until it hit Bamboo This reverts commit 33d5018e94e52cb875bf43bced623bdc6aa41ef0. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 4512e98..11b02e1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1182,6 +1182,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine return UUID.Zero; } + public void SetState(UUID itemID, string newState) + { + IScriptInstance instance = GetInstance(itemID); + if (instance == null) + return; + instance.SetState(newState); + } + public string GetState(UUID itemID) + { + IScriptInstance instance = GetInstance(itemID); + if (instance == null) + return "default"; + return instance.State; + } + public int GetStartParameter(UUID itemID) { IScriptInstance instance = GetInstance(itemID); -- cgit v1.1 From c11f259e154eb7e42bbe522681a5561e626622a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Dec 2009 15:46:55 +0000 Subject: Remove GetState. It is really unused and was reinstated by the revert --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 11b02e1..95f7852 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1189,13 +1189,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine return; instance.SetState(newState); } - public string GetState(UUID itemID) - { - IScriptInstance instance = GetInstance(itemID); - if (instance == null) - return "default"; - return instance.State; - } public int GetStartParameter(UUID itemID) { -- cgit v1.1