diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
8 files changed, 161 insertions, 74 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 39f620b..bf83a49 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 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
@@ -50,6 +50,9 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | |||
50 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 50 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
51 | using OpenSim.Region.ScriptEngine.Interfaces; | 51 | using OpenSim.Region.ScriptEngine.Interfaces; |
52 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 52 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
53 | using OpenSim.Services.Interfaces; | ||
54 | |||
55 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
53 | 56 | ||
54 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 57 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
55 | 58 | ||
@@ -4996,6 +4999,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4996 | if (end > src.Length) | 4999 | if (end > src.Length) |
4997 | end = src.Length; | 5000 | end = src.Length; |
4998 | 5001 | ||
5002 | if (stride == 0) | ||
5003 | stride = 1; | ||
5004 | |||
4999 | // There may be one or two ranges to be considered | 5005 | // There may be one or two ranges to be considered |
5000 | 5006 | ||
5001 | if (start != end) | 5007 | if (start != end) |
@@ -5022,9 +5028,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5022 | // A negative stride reverses the direction of the | 5028 | // A negative stride reverses the direction of the |
5023 | // scan producing an inverted list as a result. | 5029 | // scan producing an inverted list as a result. |
5024 | 5030 | ||
5025 | if (stride == 0) | ||
5026 | stride = 1; | ||
5027 | |||
5028 | if (stride > 0) | 5031 | if (stride > 0) |
5029 | { | 5032 | { |
5030 | for (int i = 0; i < src.Length; i += stride) | 5033 | for (int i = 0; i < src.Length; i += stride) |
@@ -5048,7 +5051,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5048 | } | 5051 | } |
5049 | else | 5052 | else |
5050 | { | 5053 | { |
5051 | result.Add(src.Data[start]); | 5054 | if (start%stride == 0) |
5055 | { | ||
5056 | result.Add(src.Data[start]); | ||
5057 | } | ||
5052 | } | 5058 | } |
5053 | 5059 | ||
5054 | return result; | 5060 | return result; |
@@ -5226,12 +5232,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5226 | } | 5232 | } |
5227 | } | 5233 | } |
5228 | 5234 | ||
5229 | List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); | 5235 | List<GridRegion> neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID); |
5230 | 5236 | ||
5231 | uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; | 5237 | uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; |
5232 | uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; | 5238 | uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; |
5233 | 5239 | ||
5234 | foreach (SimpleRegionInfo sri in neighbors) | 5240 | foreach (GridRegion sri in neighbors) |
5235 | { | 5241 | { |
5236 | if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) | 5242 | if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) |
5237 | return 0; | 5243 | return 0; |
@@ -6321,9 +6327,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6321 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); | 6327 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); |
6322 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | 6328 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); |
6323 | if (xmlRpcRouter != null) | 6329 | if (xmlRpcRouter != null) |
6330 | { | ||
6331 | string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; | ||
6332 | |||
6324 | xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, | 6333 | xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, |
6325 | m_itemID, String.Format("http://{0}:{1}/", System.Environment.MachineName, | 6334 | m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, |
6326 | xmlrpcMod.Port.ToString())); | 6335 | xmlrpcMod.Port.ToString())); |
6336 | } | ||
6327 | object[] resobj = new object[] | 6337 | object[] resobj = new object[] |
6328 | { | 6338 | { |
6329 | new LSL_Integer(1), | 6339 | new LSL_Integer(1), |
@@ -7834,8 +7844,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7834 | public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) | 7844 | public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) |
7835 | { | 7845 | { |
7836 | m_host.AddScriptLPS(1); | 7846 | m_host.AddScriptLPS(1); |
7837 | NotImplemented("llGetHTTPHeader"); | 7847 | |
7838 | return String.Empty; | 7848 | if (m_UrlModule != null) |
7849 | return m_UrlModule.GetHttpHeader(new UUID(request_id), header); | ||
7850 | return String.Empty; | ||
7839 | } | 7851 | } |
7840 | 7852 | ||
7841 | 7853 | ||
@@ -8175,7 +8187,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8175 | 8187 | ||
8176 | string reply = String.Empty; | 8188 | string reply = String.Empty; |
8177 | 8189 | ||
8178 | RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); | 8190 | GridRegion info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); |
8179 | 8191 | ||
8180 | switch (data) | 8192 | switch (data) |
8181 | { | 8193 | { |
@@ -8202,7 +8214,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8202 | ConditionalScriptSleep(1000); | 8214 | ConditionalScriptSleep(1000); |
8203 | return UUID.Zero.ToString(); | 8215 | return UUID.Zero.ToString(); |
8204 | } | 8216 | } |
8205 | int access = info.RegionSettings.Maturity; | 8217 | int access = info.Maturity; |
8206 | if (access == 0) | 8218 | if (access == 0) |
8207 | reply = "PG"; | 8219 | reply = "PG"; |
8208 | else if (access == 1) | 8220 | else if (access == 1) |
@@ -9113,13 +9125,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9113 | } | 9125 | } |
9114 | 9126 | ||
9115 | 9127 | ||
9116 | public void llHTTPResponse(string url, int status, string body) | 9128 | public void llHTTPResponse(LSL_Key id, int status, string body) |
9117 | { | 9129 | { |
9118 | // Partial implementation: support for parameter flags needed | 9130 | // Partial implementation: support for parameter flags needed |
9119 | // see http://wiki.secondlife.com/wiki/llHTTPResponse | 9131 | // see http://wiki.secondlife.com/wiki/llHTTPResponse |
9120 | 9132 | ||
9121 | m_host.AddScriptLPS(1); | 9133 | m_host.AddScriptLPS(1); |
9122 | NotImplemented("llHTTPResponse"); | 9134 | |
9135 | if (m_UrlModule != null) | ||
9136 | m_UrlModule.HttpResponse(new UUID(id), status,body); | ||
9123 | } | 9137 | } |
9124 | 9138 | ||
9125 | public void llResetLandBanList() | 9139 | public void llResetLandBanList() |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 726b37a..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; | |||
48 | using OpenSim.Region.ScriptEngine.Interfaces; | 48 | using OpenSim.Region.ScriptEngine.Interfaces; |
49 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 49 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
50 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 50 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
51 | using OpenSim.Services.Interfaces; | ||
52 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
51 | using System.Text.RegularExpressions; | 53 | using System.Text.RegularExpressions; |
52 | 54 | ||
53 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | 55 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
@@ -599,17 +601,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
599 | if (regionName.Contains(".") && regionName.Contains(":")) | 601 | if (regionName.Contains(".") && regionName.Contains(":")) |
600 | { | 602 | { |
601 | // Try to link the region | 603 | // Try to link the region |
602 | RegionInfo regInfo = HGHyperlink.TryLinkRegion(World, | 604 | IHyperlinkService hyperService = World.RequestModuleInterface<IHyperlinkService>(); |
603 | presence.ControllingClient, | 605 | if (hyperService != null) |
604 | regionName); | ||
605 | // Get the region name | ||
606 | if (regInfo != null) | ||
607 | { | 606 | { |
608 | regionName = regInfo.RegionName; | 607 | GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient, |
609 | } | 608 | regionName); |
610 | else | 609 | // Get the region name |
611 | { | 610 | if (regInfo != null) |
612 | // Might need to ping the client here in case of failure?? | 611 | { |
612 | regionName = regInfo.RegionName; | ||
613 | } | ||
614 | else | ||
615 | { | ||
616 | // Might need to ping the client here in case of failure?? | ||
617 | } | ||
613 | } | 618 | } |
614 | } | 619 | } |
615 | presence.ControllingClient.SendTeleportLocationStart(); | 620 | presence.ControllingClient.SendTeleportLocationStart(); |
@@ -1164,6 +1169,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1164 | 1169 | ||
1165 | land.SetMediaUrl(url); | 1170 | land.SetMediaUrl(url); |
1166 | } | 1171 | } |
1172 | |||
1173 | public void osSetParcelSIPAddress(string SIPAddress) | ||
1174 | { | ||
1175 | // What actually is the difference to the LL function? | ||
1176 | // | ||
1177 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); | ||
1178 | |||
1179 | m_host.AddScriptLPS(1); | ||
1180 | |||
1181 | |||
1182 | ILandObject land | ||
1183 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1184 | |||
1185 | if (land.landData.OwnerID != m_host.ObjectOwner) | ||
1186 | { | ||
1187 | OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); | ||
1188 | return; | ||
1189 | } | ||
1190 | |||
1191 | // get the voice module | ||
1192 | IVoiceModule voiceModule = World.RequestModuleInterface<IVoiceModule>(); | ||
1193 | |||
1194 | if (voiceModule != null) | ||
1195 | voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID); | ||
1196 | else | ||
1197 | OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); | ||
1198 | |||
1199 | |||
1200 | } | ||
1167 | 1201 | ||
1168 | public string osGetScriptEngineName() | 1202 | public string osGetScriptEngineName() |
1169 | { | 1203 | { |
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/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 | |||
75 | bool osConsoleCommand(string Command); | 75 | bool osConsoleCommand(string Command); |
76 | void osSetParcelMediaURL(string url); | 76 | void osSetParcelMediaURL(string url); |
77 | void osSetPrimFloatOnWater(int floatYN); | 77 | void osSetPrimFloatOnWater(int floatYN); |
78 | void osSetParcelSIPAddress(string SIPAddress); | ||
78 | 79 | ||
79 | // Avatar Info Commands | 80 | // Avatar Info Commands |
80 | string osGetAgentIP(string agent); | 81 | string osGetAgentIP(string agent); |
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/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 8f52d99..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 | |||
95 | return m_OSSL_Functions.osWindActiveModelPluginName(); | 95 | return m_OSSL_Functions.osWindActiveModelPluginName(); |
96 | } | 96 | } |
97 | 97 | ||
98 | // Not yet plugged in as available OSSL functions, so commented out | 98 | // Not yet plugged in as available OSSL functions, so commented out |
99 | // void osWindParamSet(string plugin, string param, float value) | 99 | // void osWindParamSet(string plugin, string param, float value) |
100 | // { | 100 | // { |
101 | // m_OSSL_Functions.osWindParamSet(plugin, param, value); | 101 | // m_OSSL_Functions.osWindParamSet(plugin, param, value); |
@@ -183,6 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
183 | { | 183 | { |
184 | m_OSSL_Functions.osSetParcelMediaURL(url); | 184 | m_OSSL_Functions.osSetParcelMediaURL(url); |
185 | } | 185 | } |
186 | |||
187 | public void osSetParcelSIPAddress(string SIPAddress) | ||
188 | { | ||
189 | m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress); | ||
190 | } | ||
186 | 191 | ||
187 | public void osSetPrimFloatOnWater(int floatYN) | 192 | public void osSetPrimFloatOnWater(int floatYN) |
188 | { | 193 | { |
@@ -324,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
324 | 329 | ||
325 | public string osGetSimulatorVersion() | 330 | public string osGetSimulatorVersion() |
326 | { | 331 | { |
327 | return m_OSSL_Functions.osGetSimulatorVersion(); | 332 | return m_OSSL_Functions.osGetSimulatorVersion(); |
328 | } | 333 | } |
329 | 334 | ||
330 | public Hashtable osParseJSON(string JSON) | 335 | public Hashtable osParseJSON(string JSON) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index cb5664b..fe26429 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -542,23 +542,50 @@ 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) |
550 | { | ||
551 | results = CScodeProvider.CompileAssemblyFromSource( | ||
548 | parameters, Script); | 552 | parameters, Script); |
549 | } | 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 | } | ||
576 | } while (!complete); | ||
550 | break; | 577 | break; |
551 | case enumCompileType.js: | 578 | case enumCompileType.js: |
552 | results = JScodeProvider.CompileAssemblyFromSource( | 579 | results = JScodeProvider.CompileAssemblyFromSource( |
553 | parameters, Script); | 580 | parameters, Script); |
554 | break; | 581 | break; |
555 | case enumCompileType.yp: | 582 | case enumCompileType.yp: |
556 | results = YPcodeProvider.CompileAssemblyFromSource( | 583 | results = YPcodeProvider.CompileAssemblyFromSource( |
557 | parameters, Script); | 584 | parameters, Script); |
558 | break; | 585 | break; |
559 | default: | 586 | default: |
560 | throw new Exception("Compiler is not able to recongnize "+ | 587 | throw new Exception("Compiler is not able to recongnize "+ |
561 | "language type \"" + lang.ToString() + "\""); | 588 | "language type \"" + lang.ToString() + "\""); |
562 | } | 589 | } |
563 | 590 | ||
564 | // Check result | 591 | // Check result |
@@ -567,56 +594,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
567 | // | 594 | // |
568 | // WARNINGS AND ERRORS | 595 | // WARNINGS AND ERRORS |
569 | // | 596 | // |
570 | int display = 5; | 597 | bool hadErrors = false; |
598 | string errtext = String.Empty; | ||
599 | |||
571 | if (results.Errors.Count > 0) | 600 | if (results.Errors.Count > 0) |
572 | { | 601 | { |
573 | string errtext = String.Empty; | ||
574 | foreach (CompilerError CompErr in results.Errors) | 602 | foreach (CompilerError CompErr in results.Errors) |
575 | { | 603 | { |
576 | // Show 5 errors max | 604 | string severity = CompErr.IsWarning ? "Warning" : "Error"; |
577 | // | ||
578 | if (display <= 0) | ||
579 | break; | ||
580 | display--; | ||
581 | |||
582 | string severity = "Error"; | ||
583 | if (CompErr.IsWarning) | ||
584 | { | ||
585 | severity = "Warning"; | ||
586 | } | ||
587 | 605 | ||
588 | KeyValuePair<int, int> lslPos; | 606 | KeyValuePair<int, int> lslPos; |
589 | 607 | ||
590 | lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); | 608 | // Show 5 errors max, but check entire list for errors |
591 | 609 | ||
592 | string text = CompErr.ErrorText; | 610 | if (severity == "Error") |
611 | { | ||
612 | lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); | ||
613 | string text = CompErr.ErrorText; | ||
614 | |||
615 | // Use LSL type names | ||
616 | if (lang == enumCompileType.lsl) | ||
617 | text = ReplaceTypes(CompErr.ErrorText); | ||
618 | |||
619 | // The Second Life viewer's script editor begins | ||
620 | // countingn lines and columns at 0, so we subtract 1. | ||
621 | errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", | ||
622 | lslPos.Key - 1, lslPos.Value - 1, | ||
623 | CompErr.ErrorNumber, text, severity); | ||
624 | hadErrors = true; | ||
625 | } | ||
626 | } | ||
627 | } | ||
628 | |||
629 | if (hadErrors) | ||
630 | { | ||
631 | throw new Exception(errtext); | ||
632 | } | ||
593 | 633 | ||
594 | // Use LSL type names | 634 | // On today's highly asynchronous systems, the result of |
595 | if (lang == enumCompileType.lsl) | 635 | // the compile may not be immediately apparent. Wait a |
596 | text = ReplaceTypes(CompErr.ErrorText); | 636 | // reasonable amount of time before giving up on it. |
597 | 637 | ||
598 | // The Second Life viewer's script editor begins | 638 | if (!File.Exists(OutFile)) |
599 | // countingn lines and columns at 0, so we subtract 1. | 639 | { |
600 | errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", | 640 | for (int i=0; i<20 && !File.Exists(OutFile); i++) |
601 | lslPos.Key - 1, lslPos.Value - 1, | 641 | { |
602 | CompErr.ErrorNumber, text, severity); | 642 | System.Threading.Thread.Sleep(250); |
603 | } | 643 | } |
604 | 644 | // One final chance... | |
605 | if (!File.Exists(OutFile)) | 645 | if (!File.Exists(OutFile)) |
606 | { | 646 | { |
647 | errtext = String.Empty; | ||
648 | errtext += "No compile error. But not able to locate compiled file."; | ||
607 | throw new Exception(errtext); | 649 | throw new Exception(errtext); |
608 | } | 650 | } |
609 | } | 651 | } |
610 | 652 | ||
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 "+ | 653 | // m_log.DebugFormat("[Compiler] Compiled new assembly "+ |
621 | // "for {0}", asset); | 654 | // "for {0}", asset); |
622 | 655 | ||
@@ -629,7 +662,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
629 | 662 | ||
630 | if (fi == null) | 663 | if (fi == null) |
631 | { | 664 | { |
632 | string errtext = String.Empty; | 665 | errtext = String.Empty; |
633 | errtext += "No compile error. But not able to stat file."; | 666 | errtext += "No compile error. But not able to stat file."; |
634 | throw new Exception(errtext); | 667 | throw new Exception(errtext); |
635 | } | 668 | } |
@@ -644,7 +677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
644 | } | 677 | } |
645 | catch (Exception) | 678 | catch (Exception) |
646 | { | 679 | { |
647 | string errtext = String.Empty; | 680 | errtext = String.Empty; |
648 | errtext += "No compile error. But not able to open file."; | 681 | errtext += "No compile error. But not able to open file."; |
649 | throw new Exception(errtext); | 682 | throw new Exception(errtext); |
650 | } | 683 | } |
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 | |||
261 | "SecondLife.Script"); | 261 | "SecondLife.Script"); |
262 | 262 | ||
263 | //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); | 263 | //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); |
264 | RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); | 264 | RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); |
265 | // lease.Register(this); | 265 | // lease.Register(this); |
266 | } | 266 | } |
267 | catch (Exception) | 267 | catch (Exception) |
@@ -430,7 +430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
430 | 430 | ||
431 | permsGranter = part.TaskInventory[m_ItemID].PermsGranter; | 431 | permsGranter = part.TaskInventory[m_ItemID].PermsGranter; |
432 | permsMask = part.TaskInventory[m_ItemID].PermsMask; | 432 | permsMask = part.TaskInventory[m_ItemID].PermsMask; |
433 | } | 433 | } |
434 | 434 | ||
435 | if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 435 | if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
436 | { | 436 | { |
@@ -630,7 +630,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
630 | /// <summary> | 630 | /// <summary> |
631 | /// Process the next event queued for this script | 631 | /// Process the next event queued for this script |
632 | /// </summary> | 632 | /// </summary> |
633 | /// <returns></returns> | 633 | /// <returns></returns> |
634 | public object EventProcessor() | 634 | public object EventProcessor() |
635 | { | 635 | { |
636 | lock (m_Script) | 636 | lock (m_Script) |
@@ -925,7 +925,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
925 | 925 | ||
926 | public override string ToString() | 926 | public override string ToString() |
927 | { | 927 | { |
928 | return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName); | 928 | return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName); |
929 | } | 929 | } |
930 | 930 | ||
931 | string FormatException(Exception e) | 931 | string FormatException(Exception e) |