aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
authorMelanie2009-12-22 09:24:01 +0000
committerMelanie2009-12-22 09:24:01 +0000
commit1876ce90af98722a205d1c7181ef66b6a2b54fc5 (patch)
tree2929090816713fac73d3567314ba8727498d02c4 /OpenSim/Region/ScriptEngine/XEngine
parentAdd missing file (diff)
downloadopensim-SC_OLD-1876ce90af98722a205d1c7181ef66b6a2b54fc5.zip
opensim-SC_OLD-1876ce90af98722a205d1c7181ef66b6a2b54fc5.tar.gz
opensim-SC_OLD-1876ce90af98722a205d1c7181ef66b6a2b54fc5.tar.bz2
opensim-SC_OLD-1876ce90af98722a205d1c7181ef66b6a2b54fc5.tar.xz
FINALLY! Script compile errors now appear in the script error pane,
not in a funky debug window.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs163
1 files changed, 93 insertions, 70 deletions
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
77 private string m_ScriptErrorMessage; 77 private string m_ScriptErrorMessage;
78 private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>(); 78 private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>();
79 private bool m_AppDomainLoading; 79 private bool m_AppDomainLoading;
80 private Dictionary<UUID,ArrayList> m_ScriptErrors =
81 new Dictionary<UUID,ArrayList>();
80 82
81 // disable warning: need to keep a reference to XEngine.EventManager 83 // disable warning: need to keep a reference to XEngine.EventManager
82 // alive to avoid it being garbage collected 84 // alive to avoid it being garbage collected
@@ -589,87 +591,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine
589 591
590 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; 592 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
591 593
592 try 594 lock(m_ScriptErrors)
593 { 595 {
594 lock (m_AddingAssemblies) 596 try
595 { 597 {
596 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); 598 lock (m_AddingAssemblies)
597 if (!m_AddingAssemblies.ContainsKey(assembly)) { 599 {
598 m_AddingAssemblies[assembly] = 1; 600 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
599 } else { 601 if (!m_AddingAssemblies.ContainsKey(assembly)) {
600 m_AddingAssemblies[assembly]++; 602 m_AddingAssemblies[assembly] = 1;
603 } else {
604 m_AddingAssemblies[assembly]++;
605 }
601 } 606 }
602 }
603 607
604 string[] warnings = m_Compiler.GetWarnings(); 608 string[] warnings = m_Compiler.GetWarnings();
605 609
606 if (warnings != null && warnings.Length != 0) 610 if (warnings != null && warnings.Length != 0)
607 {
608 foreach (string warning in warnings)
609 { 611 {
610 try 612 foreach (string warning in warnings)
611 { 613 {
612 // DISPLAY WARNING INWORLD 614 if (!m_ScriptErrors.ContainsKey(itemID))
613 string text = "Warning:\n" + warning; 615 m_ScriptErrors[itemID] = new ArrayList();
614 if (text.Length > 1000) 616
615 text = text.Substring(0, 1000); 617 m_ScriptErrors[itemID].Add(warning);
616 if (!ShowScriptSaveResponse(item.OwnerID, 618 // try
617 assetID, text, true)) 619 // {
618 { 620 // // DISPLAY WARNING INWORLD
619 if (presence != null && (!postOnRez)) 621 // string text = "Warning:\n" + warning;
620 presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false); 622 // if (text.Length > 1000)
621 623 // text = text.Substring(0, 1000);
622 World.SimChat(Utils.StringToBytes(text), 624 // if (!ShowScriptSaveResponse(item.OwnerID,
623 ChatTypeEnum.DebugChannel, 2147483647, 625 // assetID, text, true))
624 part.AbsolutePosition, 626 // {
625 part.Name, part.UUID, false); 627 // if (presence != null && (!postOnRez))
626 } 628 // presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
627 } 629 //
628 catch (Exception e2) // LEGIT: User Scripting 630 // World.SimChat(Utils.StringToBytes(text),
629 { 631 // ChatTypeEnum.DebugChannel, 2147483647,
630 m_log.Error("[XEngine]: " + 632 // part.AbsolutePosition,
631 "Error displaying warning in-world: " + 633 // part.Name, part.UUID, false);
632 e2.ToString()); 634 // }
633 m_log.Error("[XEngine]: " + 635 // }
634 "Warning:\r\n" + 636 // catch (Exception e2) // LEGIT: User Scripting
635 warning); 637 // {
638 // m_log.Error("[XEngine]: " +
639 // "Error displaying warning in-world: " +
640 // e2.ToString());
641 // m_log.Error("[XEngine]: " +
642 // "Warning:\r\n" +
643 // warning);
644 // }
636 } 645 }
637 } 646 }
638 } 647 }
639 } 648 catch (Exception e)
640 catch (Exception e)
641 {
642 try
643 { 649 {
644 // DISPLAY ERROR INWORLD 650 // try
645 m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString(); 651 // {
646 652 if (!m_ScriptErrors.ContainsKey(itemID))
647 m_ScriptFailCount++; 653 m_ScriptErrors[itemID] = new ArrayList();
648 string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString(); 654 // DISPLAY ERROR INWORLD
649 if (text.Length > 1000) 655 // m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
650 text = text.Substring(0, 1000); 656 //
651 if (!ShowScriptSaveResponse(item.OwnerID, 657 m_ScriptFailCount++;
652 assetID, text, false)) 658 m_ScriptErrors[itemID].Add(e.Message.ToString());
653 { 659 // string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
654 if (presence != null && (!postOnRez)) 660 // if (text.Length > 1000)
655 presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false); 661 // text = text.Substring(0, 1000);
656 World.SimChat(Utils.StringToBytes(text), 662 // if (!ShowScriptSaveResponse(item.OwnerID,
657 ChatTypeEnum.DebugChannel, 2147483647, 663 // assetID, text, false))
658 part.AbsolutePosition, 664 // {
659 part.Name, part.UUID, false); 665 // if (presence != null && (!postOnRez))
660 } 666 // presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
661 } 667 // World.SimChat(Utils.StringToBytes(text),
662 catch (Exception e2) // LEGIT: User Scripting 668 // ChatTypeEnum.DebugChannel, 2147483647,
663 { 669 // part.AbsolutePosition,
664 m_log.Error("[XEngine]: "+ 670 // part.Name, part.UUID, false);
665 "Error displaying error in-world: " + 671 // }
666 e2.ToString()); 672 // }
667 m_log.Error("[XEngine]: " + 673 // catch (Exception e2) // LEGIT: User Scripting
668 "Errormessage: Error compiling script:\r\n" + 674 // {
669 e.Message.ToString()); 675 // m_log.Error("[XEngine]: "+
670 } 676 // "Error displaying error in-world: " +
677 // e2.ToString());
678 // m_log.Error("[XEngine]: " +
679 // "Errormessage: Error compiling script:\r\n" +
680 // e.Message.ToString());
681 // }
671 682
672 return false; 683 return false;
684 }
673 } 685 }
674 686
675 lock (m_Scripts) 687 lock (m_Scripts)
@@ -1473,7 +1485,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1473 1485
1474 public ArrayList GetScriptErrors(UUID itemID) 1486 public ArrayList GetScriptErrors(UUID itemID)
1475 { 1487 {
1476 return new ArrayList(); 1488 System.Threading.Thread.Sleep(1000);
1489
1490 lock (m_ScriptErrors)
1491 {
1492 if (m_ScriptErrors.ContainsKey(itemID))
1493 {
1494 ArrayList ret = m_ScriptErrors[itemID];
1495 m_ScriptErrors.Remove(itemID);
1496 return ret;
1497 }
1498 return new ArrayList();
1499 }
1477 } 1500 }
1478 } 1501 }
1479} 1502}