aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorKitto Flora2009-09-30 19:07:18 +0200
committerKitto Flora2009-09-30 19:07:18 +0200
commit07df0e0ab0c69633a6afec8d05cccc117656d3d9 (patch)
tree3048cc38b313e255cbf03fa3e2900e28cadc47c9 /OpenSim/Region/ScriptEngine
parentAnd another merge issue (diff)
parentFix loading modules with alternate configurations and ports into ROBUST. (diff)
downloadopensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.zip
opensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.gz
opensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.bz2
opensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.xz
Merge branch '0.6.7-post-fixes' into vehicles
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs103
4 files changed, 83 insertions, 40 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index edcf11c..c41f2a5 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 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
@@ -7841,8 +7841,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7841 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) 7841 public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
7842 { 7842 {
7843 m_host.AddScriptLPS(1); 7843 m_host.AddScriptLPS(1);
7844 NotImplemented("llGetHTTPHeader"); 7844
7845 return String.Empty; 7845 if (m_UrlModule != null)
7846 return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
7847 return String.Empty;
7846 } 7848 }
7847 7849
7848 7850
@@ -9120,13 +9122,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9120 } 9122 }
9121 9123
9122 9124
9123 public void llHTTPResponse(string url, int status, string body) 9125 public void llHTTPResponse(LSL_Key id, int status, string body)
9124 { 9126 {
9125 // Partial implementation: support for parameter flags needed 9127 // Partial implementation: support for parameter flags needed
9126 // see http://wiki.secondlife.com/wiki/llHTTPResponse 9128 // see http://wiki.secondlife.com/wiki/llHTTPResponse
9127 9129
9128 m_host.AddScriptLPS(1); 9130 m_host.AddScriptLPS(1);
9129 NotImplemented("llHTTPResponse"); 9131
9132 if (m_UrlModule != null)
9133 m_UrlModule.HttpResponse(new UUID(id), status,body);
9130 } 9134 }
9131 9135
9132 public void llResetLandBanList() 9136 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
201 void llGroundRepel(double height, int water, double tau); 201 void llGroundRepel(double height, int water, double tau);
202 LSL_Vector llGroundSlope(LSL_Vector offset); 202 LSL_Vector llGroundSlope(LSL_Vector offset);
203 LSL_String llHTTPRequest(string url, LSL_List parameters, string body); 203 LSL_String llHTTPRequest(string url, LSL_List parameters, string body);
204 void llHTTPResponse(string url, int status, string body); 204 void llHTTPResponse(LSL_Key id, int status, string body);
205 LSL_String llInsertString(string dst, int position, string src); 205 LSL_String llInsertString(string dst, int position, string src);
206 void llInstantMessage(string user, string message); 206 void llInstantMessage(string user, string message);
207 LSL_String llIntegerToBase64(int number); 207 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
864 return m_LSL_Functions.llHTTPRequest(url, parameters, body); 864 return m_LSL_Functions.llHTTPRequest(url, parameters, body);
865 } 865 }
866 866
867 public void llHTTPResponse(string url, int status, string body) 867 public void llHTTPResponse(LSL_Key id, int status, string body)
868 { 868 {
869 m_LSL_Functions.llHTTPResponse(url, status, body); 869 m_LSL_Functions.llHTTPResponse(id, status, body);
870 } 870 }
871 871
872 public LSL_String llInsertString(string dst, int position, string src) 872 public LSL_String llInsertString(string dst, int position, string src)
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
542 break; 542 break;
543 case enumCompileType.cs: 543 case enumCompileType.cs:
544 case enumCompileType.lsl: 544 case enumCompileType.lsl:
545 lock (CScodeProvider) 545 bool complete = false;
546 bool retried = false;
547 do
546 { 548 {
547 results = CScodeProvider.CompileAssemblyFromSource( 549 lock (CScodeProvider)
548 parameters, Script); 550 {
551 results = CScodeProvider.CompileAssemblyFromSource(
552 parameters, Script);
553 }
554 // Deal with an occasional segv in the compiler.
555 // Rarely, if ever, occurs twice in succession.
556 // Line # == 0 and no file name are indications that
557 // this is a native stack trace rather than a normal
558 // error log.
559 if (results.Errors.Count > 0)
560 {
561 if (!retried && (results.Errors[0].FileName == null || results.Errors[0].FileName == String.Empty) &&
562 results.Errors[0].Line == 0)
563 {
564 // System.Console.WriteLine("retrying failed compilation");
565 retried = true;
566 }
567 else
568 {
569 complete = true;
570 }
571 }
572 else
573 {
574 complete = true;
575 }
549 } 576 }
577 while(!complete);
550 break; 578 break;
551 case enumCompileType.js: 579 case enumCompileType.js:
552 results = JScodeProvider.CompileAssemblyFromSource( 580 results = JScodeProvider.CompileAssemblyFromSource(
@@ -567,17 +595,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
567 // 595 //
568 // WARNINGS AND ERRORS 596 // WARNINGS AND ERRORS
569 // 597 //
570 int display = 5; 598 bool hadErrors = false;
599 string errtext = String.Empty;
600
571 if (results.Errors.Count > 0) 601 if (results.Errors.Count > 0)
572 { 602 {
573 string errtext = String.Empty;
574 foreach (CompilerError CompErr in results.Errors) 603 foreach (CompilerError CompErr in results.Errors)
575 { 604 {
576 // Show 5 errors max
577 //
578 if (display <= 0)
579 break;
580 display--;
581 605
582 string severity = "Error"; 606 string severity = "Error";
583 if (CompErr.IsWarning) 607 if (CompErr.IsWarning)
@@ -587,36 +611,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
587 611
588 KeyValuePair<int, int> lslPos; 612 KeyValuePair<int, int> lslPos;
589 613
590 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); 614 // Show 5 errors max, but check entire list for errors
615
616 if (severity == "Error")
617 {
618 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column);
619 string text = CompErr.ErrorText;
620
621 // Use LSL type names
622 if (lang == enumCompileType.lsl)
623 text = ReplaceTypes(CompErr.ErrorText);
624
625 // The Second Life viewer's script editor begins
626 // countingn lines and columns at 0, so we subtract 1.
627 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
628 lslPos.Key - 1, lslPos.Value - 1,
629 CompErr.ErrorNumber, text, severity);
630 hadErrors = true;
631 }
632 }
633 }
591 634
592 string text = CompErr.ErrorText; 635 if (hadErrors)
636 {
637 throw new Exception(errtext);
638 }
593 639
594 // Use LSL type names 640 // On today's highly asynchronous systems, the result of
595 if (lang == enumCompileType.lsl) 641 // the compile may not be immediately apparent. Wait a
596 text = ReplaceTypes(CompErr.ErrorText); 642 // reasonable amount of time before giving up on it.
597 643
598 // The Second Life viewer's script editor begins 644 if (!File.Exists(OutFile))
599 // countingn lines and columns at 0, so we subtract 1. 645 {
600 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", 646 for (int i=0; i<20 && !File.Exists(OutFile); i++)
601 lslPos.Key - 1, lslPos.Value - 1, 647 {
602 CompErr.ErrorNumber, text, severity); 648 System.Threading.Thread.Sleep(250);
603 } 649 }
604 650 // One final chance...
605 if (!File.Exists(OutFile)) 651 if (!File.Exists(OutFile))
606 { 652 {
653 errtext = String.Empty;
654 errtext += "No compile error. But not able to locate compiled file.";
607 throw new Exception(errtext); 655 throw new Exception(errtext);
608 } 656 }
609 } 657 }
610 658
611 //
612 // NO ERRORS, BUT NO COMPILED FILE
613 //
614 if (!File.Exists(OutFile))
615 {
616 string errtext = String.Empty;
617 errtext += "No compile error. But not able to locate compiled file.";
618 throw new Exception(errtext);
619 }
620// m_log.DebugFormat("[Compiler] Compiled new assembly "+ 659// m_log.DebugFormat("[Compiler] Compiled new assembly "+
621// "for {0}", asset); 660// "for {0}", asset);
622 661
@@ -629,7 +668,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
629 668
630 if (fi == null) 669 if (fi == null)
631 { 670 {
632 string errtext = String.Empty; 671 errtext = String.Empty;
633 errtext += "No compile error. But not able to stat file."; 672 errtext += "No compile error. But not able to stat file.";
634 throw new Exception(errtext); 673 throw new Exception(errtext);
635 } 674 }
@@ -644,7 +683,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
644 } 683 }
645 catch (Exception) 684 catch (Exception)
646 { 685 {
647 string errtext = String.Empty; 686 errtext = String.Empty;
648 errtext += "No compile error. But not able to open file."; 687 errtext += "No compile error. But not able to open file.";
649 throw new Exception(errtext); 688 throw new Exception(errtext);
650 } 689 }