aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorMelanie2010-09-17 22:12:48 +0100
committerMelanie2010-09-17 22:12:48 +0100
commitbdd4dcf69b6cb957025280689d28317b2f4b97b8 (patch)
treedeec0f3b684b933485000952ee4d3422e3ade4b6 /OpenSim/Region/ScriptEngine/Shared/Api
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentAdd LandServices to make landmarks work right in grids (diff)
downloadopensim-SC-bdd4dcf69b6cb957025280689d28317b2f4b97b8.zip
opensim-SC-bdd4dcf69b6cb957025280689d28317b2f4b97b8.tar.gz
opensim-SC-bdd4dcf69b6cb957025280689d28317b2f4b97b8.tar.bz2
opensim-SC-bdd4dcf69b6cb957025280689d28317b2f4b97b8.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs97
1 files changed, 60 insertions, 37 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index caa39ba..cd8353f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5949,11 +5949,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5949 ScriptSleep(5000); 5949 ScriptSleep(5000);
5950 } 5950 }
5951 5951
5952 public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
5953 {
5954 return ParseString2List(str, separators, in_spacers, false);
5955 }
5956
5957 public LSL_Integer llOverMyLand(string id) 5952 public LSL_Integer llOverMyLand(string id)
5958 { 5953 {
5959 m_host.AddScriptLPS(1); 5954 m_host.AddScriptLPS(1);
@@ -8936,7 +8931,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8936 // garbage generation. 8931 // garbage generation.
8937 // </remarks> 8932 // </remarks>
8938 8933
8939 public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers) 8934 private LSL_List ParseString(string src, LSL_List separators, LSL_List spacers, bool keepNulls)
8940 { 8935 {
8941 return ParseString2List(src, separators, spacers, true); 8936 return ParseString2List(src, separators, spacers, true);
8942 } 8937 }
@@ -8957,19 +8952,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8957 int i, j; 8952 int i, j;
8958 string d; 8953 string d;
8959 8954
8960 m_host.AddScriptLPS(1); 8955 // All entries are initially valid
8961 8956
8962 /* 8957 for (int i = 0; i < mlen; i++)
8963 * Convert separator and spacer lists to C# strings. 8958 active[i] = true;
8964 * Also filter out null strings so we don't hang. 8959
8965 */ 8960 offset[mlen] = srclen;
8966 for (i = 0; i < seplen; i ++) { 8961
8967 d = separray[i].ToString(); 8962 while (beginning < srclen)
8968 if (d.Length > 0) { 8963 {
8969 delarray[dellen++] = d; 8964
8970 } 8965 best = mlen; // as bad as it gets
8971 } 8966
8972 seplen = dellen; 8967 // Scan for separators
8973 8968
8974 for (i = 0; i < spclen; i ++) { 8969 for (i = 0; i < spclen; i ++) {
8975 d = spcarray[i].ToString(); 8970 d = spcarray[i].ToString();
@@ -9004,29 +8999,45 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9004 } 8999 }
9005 } 9000 }
9006 9001
9007 /* 9002 // This is the normal exit from the scanning loop
9008 * Output source string starting at i through start of earliest delimeter. 9003
9009 */ 9004 if (best == mlen)
9010 if (keepNulls || (earliestSrc > i)) { 9005 {
9011 outarray[outlen++] = src.Substring(i, earliestSrc - i); 9006 // no markers were found on this pass
9007 // so we're pretty much done
9008 if ((keepNulls) || ((!keepNulls) && (srclen - beginning) > 0))
9009 tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning)));
9010 break;
9012 } 9011 }
9013 9012
9014 /* 9013 // Otherwise we just add the newly delimited token
9015 * If no delimeter found at or after i, we're done scanning. 9014 // and recalculate where the search should continue.
9016 */ 9015 if ((keepNulls) || ((!keepNulls) && (offset[best] - beginning) > 0))
9017 if (earliestDel < 0) break; 9016 tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning)));
9018 9017
9019 /* 9018 if (best < seplen)
9020 * If delimeter was a spacer, output the spacer. 9019 {
9021 */ 9020 beginning = offset[best] + (separray[best].ToString()).Length;
9022 if (earliestDel >= seplen) { 9021 }
9023 outarray[outlen++] = earliestStr; 9022 else
9023 {
9024 beginning = offset[best] + (spcarray[best - seplen].ToString()).Length;
9025 string str = spcarray[best - seplen].ToString();
9026 if ((keepNulls) || ((!keepNulls) && (str.Length > 0)))
9027 tokens.Add(new LSL_String(str));
9024 } 9028 }
9029 }
9025 9030
9026 /* 9031 // This an awkward an not very intuitive boundary case. If the
9027 * Look at rest of src string following delimeter. 9032 // last substring is a tokenizer, then there is an implied trailing
9028 */ 9033 // null list entry. Hopefully the single comparison will not be too
9029 i = earliestSrc + earliestStr.Length; 9034 // arduous. Alternatively the 'break' could be replced with a return
9035 // but that's shabby programming.
9036
9037 if ((beginning == srclen) && (keepNulls))
9038 {
9039 if (srclen != 0)
9040 tokens.Add(new LSL_String(""));
9030 } 9041 }
9031 9042
9032 /* 9043 /*
@@ -9038,7 +9049,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9038 } 9049 }
9039 return new LSL_List(outlist); 9050 return new LSL_List(outlist);
9040 } 9051 }
9041 9052
9053 public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers)
9054 {
9055 m_host.AddScriptLPS(1);
9056 return this.ParseString(src, separators, spacers, false);
9057 }
9058
9059 public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
9060 {
9061 m_host.AddScriptLPS(1);
9062 return this.ParseString(src, separators, spacers, true);
9063 }
9064
9042 public LSL_Integer llGetObjectPermMask(int mask) 9065 public LSL_Integer llGetObjectPermMask(int mask)
9043 { 9066 {
9044 m_host.AddScriptLPS(1); 9067 m_host.AddScriptLPS(1);