Overwrite the core version of the string parsing method with ours
parent
bdd4dcf69b
commit
3a760ad12b
|
@ -5949,6 +5949,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
ScriptSleep(5000);
|
ScriptSleep(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
|
||||||
|
{
|
||||||
|
return ParseString2List(str, separators, in_spacers, false);
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_Integer llOverMyLand(string id)
|
public LSL_Integer llOverMyLand(string id)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -8931,7 +8936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// garbage generation.
|
// garbage generation.
|
||||||
// </remarks>
|
// </remarks>
|
||||||
|
|
||||||
private LSL_List ParseString(string src, LSL_List separators, LSL_List spacers, bool keepNulls)
|
public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
|
||||||
{
|
{
|
||||||
return ParseString2List(src, separators, spacers, true);
|
return ParseString2List(src, separators, spacers, true);
|
||||||
}
|
}
|
||||||
|
@ -8952,19 +8957,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
int i, j;
|
int i, j;
|
||||||
string d;
|
string d;
|
||||||
|
|
||||||
// All entries are initially valid
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
for (int i = 0; i < mlen; i++)
|
/*
|
||||||
active[i] = true;
|
* Convert separator and spacer lists to C# strings.
|
||||||
|
* Also filter out null strings so we don't hang.
|
||||||
offset[mlen] = srclen;
|
*/
|
||||||
|
for (i = 0; i < seplen; i ++) {
|
||||||
while (beginning < srclen)
|
d = separray[i].ToString();
|
||||||
{
|
if (d.Length > 0) {
|
||||||
|
delarray[dellen++] = d;
|
||||||
best = mlen; // as bad as it gets
|
}
|
||||||
|
}
|
||||||
// Scan for separators
|
seplen = dellen;
|
||||||
|
|
||||||
for (i = 0; i < spclen; i ++) {
|
for (i = 0; i < spclen; i ++) {
|
||||||
d = spcarray[i].ToString();
|
d = spcarray[i].ToString();
|
||||||
|
@ -8999,45 +9004,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the normal exit from the scanning loop
|
/*
|
||||||
|
* Output source string starting at i through start of earliest delimeter.
|
||||||
if (best == mlen)
|
*/
|
||||||
{
|
if (keepNulls || (earliestSrc > i)) {
|
||||||
// no markers were found on this pass
|
outarray[outlen++] = src.Substring(i, earliestSrc - i);
|
||||||
// so we're pretty much done
|
|
||||||
if ((keepNulls) || ((!keepNulls) && (srclen - beginning) > 0))
|
|
||||||
tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning)));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise we just add the newly delimited token
|
/*
|
||||||
// and recalculate where the search should continue.
|
* If no delimeter found at or after i, we're done scanning.
|
||||||
if ((keepNulls) || ((!keepNulls) && (offset[best] - beginning) > 0))
|
*/
|
||||||
tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning)));
|
if (earliestDel < 0) break;
|
||||||
|
|
||||||
if (best < seplen)
|
/*
|
||||||
{
|
* If delimeter was a spacer, output the spacer.
|
||||||
beginning = offset[best] + (separray[best].ToString()).Length;
|
*/
|
||||||
}
|
if (earliestDel >= seplen) {
|
||||||
else
|
outarray[outlen++] = earliestStr;
|
||||||
{
|
|
||||||
beginning = offset[best] + (spcarray[best - seplen].ToString()).Length;
|
|
||||||
string str = spcarray[best - seplen].ToString();
|
|
||||||
if ((keepNulls) || ((!keepNulls) && (str.Length > 0)))
|
|
||||||
tokens.Add(new LSL_String(str));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This an awkward an not very intuitive boundary case. If the
|
/*
|
||||||
// last substring is a tokenizer, then there is an implied trailing
|
* Look at rest of src string following delimeter.
|
||||||
// null list entry. Hopefully the single comparison will not be too
|
*/
|
||||||
// arduous. Alternatively the 'break' could be replced with a return
|
i = earliestSrc + earliestStr.Length;
|
||||||
// but that's shabby programming.
|
|
||||||
|
|
||||||
if ((beginning == srclen) && (keepNulls))
|
|
||||||
{
|
|
||||||
if (srclen != 0)
|
|
||||||
tokens.Add(new LSL_String(""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9050,18 +9039,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return new LSL_List(outlist);
|
return new LSL_List(outlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers)
|
|
||||||
{
|
|
||||||
m_host.AddScriptLPS(1);
|
|
||||||
return this.ParseString(src, separators, spacers, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
|
|
||||||
{
|
|
||||||
m_host.AddScriptLPS(1);
|
|
||||||
return this.ParseString(src, separators, spacers, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LSL_Integer llGetObjectPermMask(int mask)
|
public LSL_Integer llGetObjectPermMask(int mask)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
Loading…
Reference in New Issue