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