aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2009-02-16 01:58:26 +0000
committerMelanie Thielker2009-02-16 01:58:26 +0000
commit37a00427bc86bbff660f1d87643740fecf5b17a9 (patch)
treeae775ddcd9032cadf810aae7e1e0ed7c8ac564e7 /OpenSim
parentThank you, patnad, for a patch that adds 3 new discovery functions (diff)
downloadopensim-SC_OLD-37a00427bc86bbff660f1d87643740fecf5b17a9.zip
opensim-SC_OLD-37a00427bc86bbff660f1d87643740fecf5b17a9.tar.gz
opensim-SC_OLD-37a00427bc86bbff660f1d87643740fecf5b17a9.tar.bz2
opensim-SC_OLD-37a00427bc86bbff660f1d87643740fecf5b17a9.tar.xz
Thank you, cmickeyb, for a patch to ass two string functions
to OSSL. Fixes Mantis #3173
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs12
3 files changed, 67 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 697fdb4..9658376 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -43,6 +43,7 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
43using OpenSim.Region.ScriptEngine.Interfaces; 43using OpenSim.Region.ScriptEngine.Interfaces;
44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 44using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
45using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 45using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
46using System.Text.RegularExpressions;
46 47
47using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 48using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
48using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 49using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
@@ -1105,5 +1106,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1105 loginURI = config.Configs["GridInfo"].GetString("login", loginURI); 1106 loginURI = config.Configs["GridInfo"].GetString("login", loginURI);
1106 return loginURI; 1107 return loginURI;
1107 } 1108 }
1109
1110 public LSL_String osFormatString(string str, LSL_List strings)
1111 {
1112 CheckThreatLevel(ThreatLevel.Low, "osFormatString");
1113 m_host.AddScriptLPS(1);
1114
1115 return String.Format(str, strings.Data);
1116 }
1117
1118 public LSL_List osMatchString(string src, string pattern, int start)
1119 {
1120 CheckThreatLevel(ThreatLevel.High, "osMatchString");
1121 m_host.AddScriptLPS(1);
1122
1123 LSL_List result = new LSL_List();
1124
1125 // Normalize indices (if negative).
1126 // After normlaization they may still be
1127 // negative, but that is now relative to
1128 // the start, rather than the end, of the
1129 // sequence.
1130 if (start < 0)
1131 {
1132 start = src.Length + start;
1133 }
1134
1135 if (start < 0 || start >= src.Length)
1136 {
1137 return result; // empty list
1138 }
1139
1140 // Find matches beginning at start position
1141 Regex matcher = new Regex(pattern);
1142 Match match = matcher.Match(src, start);
1143 if (match.Success)
1144 {
1145 foreach (System.Text.RegularExpressions.Group g in match.Groups)
1146 {
1147 if (g.Success)
1148 {
1149 result.Add(g.Value);
1150 result.Add(g.Index);
1151 }
1152 }
1153 }
1154
1155 return result;
1156 }
1108 } 1157 }
1109} 1158}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index aab91df..72bb60c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -31,6 +31,8 @@ using OpenSim.Region.ScriptEngine.Interfaces;
31using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 31using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
32using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 32using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
33using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 33using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
34using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
35using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
34 36
35namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces 37namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
36{ 38{
@@ -104,5 +106,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
104 string osGetGridNick(); 106 string osGetGridNick();
105 string osGetGridName(); 107 string osGetGridName();
106 string osGetGridLoginURI(); 108 string osGetGridLoginURI();
109
110 LSL_String osFormatString(string str, LSL_List strings);
111 LSL_List osMatchString(string src, string pattern, int start);
112
107 } 113 }
108} 114}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 50acc1e..a92f046 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -38,6 +38,8 @@ using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
38using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 38using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
39using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 39using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
40using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 40using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
41using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
42using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
41 43
42namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase 44namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
43{ 45{
@@ -262,6 +264,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
262 return m_OSSL_Functions.osGetGridLoginURI(); 264 return m_OSSL_Functions.osGetGridLoginURI();
263 } 265 }
264 266
267 public LSL_String osFormatString(string str, LSL_List strings)
268 {
269 return m_OSSL_Functions.osFormatString(str, strings);
270 }
271
272 public LSL_List osMatchString(string src, string pattern, int start)
273 {
274 return m_OSSL_Functions.osMatchString(src, pattern, start);
275 }
276
265 public OSSLPrim Prim; 277 public OSSLPrim Prim;
266 278
267 [Serializable] 279 [Serializable]