diff options
Diffstat (limited to 'OpenSim')
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; | |||
43 | using OpenSim.Region.ScriptEngine.Interfaces; | 43 | using OpenSim.Region.ScriptEngine.Interfaces; |
44 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | 44 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; |
45 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 45 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
46 | using System.Text.RegularExpressions; | ||
46 | 47 | ||
47 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | 48 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
48 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | 49 | using 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; | |||
31 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | 31 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
32 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | 32 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
33 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | 33 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
34 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
35 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
34 | 36 | ||
35 | namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | 37 | namespace 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; | |||
38 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | 38 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
39 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | 39 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
40 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | 40 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
41 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
42 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
41 | 43 | ||
42 | namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | 44 | namespace 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] |