diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
21 files changed, 557 insertions, 114 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 61e4934..3cbdde5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
137 | if (cmdHandlerThread == null) | 137 | if (cmdHandlerThread == null) |
138 | { | 138 | { |
139 | // Start the thread that will be doing the work | 139 | // Start the thread that will be doing the work |
140 | cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); | 140 | cmdHandlerThread |
141 | = Watchdog.StartThread( | ||
142 | CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); | ||
141 | } | 143 | } |
142 | } | 144 | } |
143 | 145 | ||
@@ -245,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
245 | 247 | ||
246 | // Remove Sensors | 248 | // Remove Sensors |
247 | m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); | 249 | m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); |
250 | } | ||
251 | |||
252 | /// <summary> | ||
253 | /// Get the sensor repeat plugin for this script engine. | ||
254 | /// </summary> | ||
255 | /// <param name="engine"></param> | ||
256 | /// <returns></returns> | ||
257 | public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine) | ||
258 | { | ||
259 | if (m_SensorRepeat.ContainsKey(engine)) | ||
260 | return m_SensorRepeat[engine]; | ||
261 | else | ||
262 | return null; | ||
263 | } | ||
248 | 264 | ||
265 | /// <summary> | ||
266 | /// Get the dataserver plugin for this script engine. | ||
267 | /// </summary> | ||
268 | /// <param name="engine"></param> | ||
269 | /// <returns></returns> | ||
270 | public static Dataserver GetDataserverPlugin(IScriptEngine engine) | ||
271 | { | ||
272 | if (m_Dataserver.ContainsKey(engine)) | ||
273 | return m_Dataserver[engine]; | ||
274 | else | ||
275 | return null; | ||
276 | } | ||
277 | |||
278 | /// <summary> | ||
279 | /// Get the timer plugin for this script engine. | ||
280 | /// </summary> | ||
281 | /// <param name="engine"></param> | ||
282 | /// <returns></returns> | ||
283 | public static Timer GetTimerPlugin(IScriptEngine engine) | ||
284 | { | ||
285 | if (m_Timer.ContainsKey(engine)) | ||
286 | return m_Timer[engine]; | ||
287 | else | ||
288 | return null; | ||
289 | } | ||
290 | |||
291 | /// <summary> | ||
292 | /// Get the listener plugin for this script engine. | ||
293 | /// </summary> | ||
294 | /// <param name="engine"></param> | ||
295 | /// <returns></returns> | ||
296 | public static Listener GetListenerPlugin(IScriptEngine engine) | ||
297 | { | ||
298 | if (m_Listener.ContainsKey(engine)) | ||
299 | return m_Listener[engine]; | ||
300 | else | ||
301 | return null; | ||
249 | } | 302 | } |
250 | 303 | ||
251 | public static void StateChange(IScriptEngine engine, uint localID, UUID itemID) | 304 | public static void StateChange(IScriptEngine engine, uint localID, UUID itemID) |
@@ -288,7 +341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
288 | data.AddRange(timers); | 341 | data.AddRange(timers); |
289 | } | 342 | } |
290 | 343 | ||
291 | Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID); | 344 | Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID); |
292 | if (sensors.Length > 0) | 345 | if (sensors.Length > 0) |
293 | { | 346 | { |
294 | data.Add("sensor"); | 347 | data.Add("sensor"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0cc8829..e2d17a7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -4213,7 +4213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4213 | List<String> nametable = new List<String>(); | 4213 | List<String> nametable = new List<String>(); |
4214 | World.ForEachRootScenePresence(delegate(ScenePresence presence) | 4214 | World.ForEachRootScenePresence(delegate(ScenePresence presence) |
4215 | { | 4215 | { |
4216 | if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) | 4216 | SceneObjectPart sitPart = presence.ParentPart; |
4217 | if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId)) | ||
4217 | nametable.Add(presence.ControllingClient.Name); | 4218 | nametable.Add(presence.ControllingClient.Name); |
4218 | }); | 4219 | }); |
4219 | 4220 | ||
@@ -4450,7 +4451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4450 | Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), | 4451 | Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), |
4451 | Util.Clip((float)color.y, 0.0f, 1.0f), | 4452 | Util.Clip((float)color.y, 0.0f, 1.0f), |
4452 | Util.Clip((float)color.z, 0.0f, 1.0f)); | 4453 | Util.Clip((float)color.z, 0.0f, 1.0f)); |
4453 | m_host.SetText(text.Length > 254 ? text.Remove(255) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); | 4454 | m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); |
4454 | //m_host.ParentGroup.HasGroupChanged = true; | 4455 | //m_host.ParentGroup.HasGroupChanged = true; |
4455 | //m_host.ParentGroup.ScheduleGroupForFullUpdate(); | 4456 | //m_host.ParentGroup.ScheduleGroupForFullUpdate(); |
4456 | } | 4457 | } |
@@ -4844,22 +4845,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4844 | 4845 | ||
4845 | // Find pushee position | 4846 | // Find pushee position |
4846 | // Pushee Linked? | 4847 | // Pushee Linked? |
4847 | if (pusheeav.ParentID != 0) | 4848 | SceneObjectPart sitPart = pusheeav.ParentPart; |
4848 | { | 4849 | if (sitPart != null) |
4849 | SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); | 4850 | PusheePos = sitPart.AbsolutePosition; |
4850 | if (parentobj != null) | ||
4851 | { | ||
4852 | PusheePos = parentobj.AbsolutePosition; | ||
4853 | } | ||
4854 | else | ||
4855 | { | ||
4856 | PusheePos = pusheeav.AbsolutePosition; | ||
4857 | } | ||
4858 | } | ||
4859 | else | 4851 | else |
4860 | { | ||
4861 | PusheePos = pusheeav.AbsolutePosition; | 4852 | PusheePos = pusheeav.AbsolutePosition; |
4862 | } | ||
4863 | } | 4853 | } |
4864 | 4854 | ||
4865 | if (!pusheeIsAvatar) | 4855 | if (!pusheeIsAvatar) |
@@ -6067,7 +6057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6067 | flags |= ScriptBaseClass.AGENT_IN_AIR; | 6057 | flags |= ScriptBaseClass.AGENT_IN_AIR; |
6068 | } | 6058 | } |
6069 | 6059 | ||
6070 | if (agent.ParentID != 0) | 6060 | if (agent.ParentPart != null) |
6071 | { | 6061 | { |
6072 | flags |= ScriptBaseClass.AGENT_ON_OBJECT; | 6062 | flags |= ScriptBaseClass.AGENT_ON_OBJECT; |
6073 | flags |= ScriptBaseClass.AGENT_SITTING; | 6063 | flags |= ScriptBaseClass.AGENT_SITTING; |
@@ -6866,16 +6856,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6866 | } | 6856 | } |
6867 | } | 6857 | } |
6868 | 6858 | ||
6869 | public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) | 6859 | protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot) |
6870 | { | 6860 | { |
6871 | m_host.AddScriptLPS(1); | ||
6872 | // LSL quaternions can normalize to 0, normal Quaternions can't. | 6861 | // LSL quaternions can normalize to 0, normal Quaternions can't. |
6873 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) | 6862 | if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) |
6874 | rot.z = 1; // ZERO_ROTATION = 0,0,0,1 | 6863 | rot.z = 1; // ZERO_ROTATION = 0,0,0,1 |
6875 | 6864 | ||
6876 | m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); | 6865 | part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); |
6877 | m_host.SitTargetOrientation = Rot2Quaternion(rot); | 6866 | part.SitTargetOrientation = Rot2Quaternion(rot); |
6878 | m_host.ParentGroup.HasGroupChanged = true; | 6867 | part.ParentGroup.HasGroupChanged = true; |
6868 | } | ||
6869 | |||
6870 | public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) | ||
6871 | { | ||
6872 | m_host.AddScriptLPS(1); | ||
6873 | SitTarget(m_host, offset, rot); | ||
6874 | } | ||
6875 | |||
6876 | public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) | ||
6877 | { | ||
6878 | m_host.AddScriptLPS(1); | ||
6879 | if (link == ScriptBaseClass.LINK_ROOT) | ||
6880 | SitTarget(m_host.ParentGroup.RootPart, offset, rot); | ||
6881 | else if (link == ScriptBaseClass.LINK_THIS) | ||
6882 | SitTarget(m_host, offset, rot); | ||
6883 | else | ||
6884 | { | ||
6885 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
6886 | if (null != part) | ||
6887 | { | ||
6888 | SitTarget(part, offset, rot); | ||
6889 | } | ||
6890 | } | ||
6879 | } | 6891 | } |
6880 | 6892 | ||
6881 | public LSL_String llAvatarOnSitTarget() | 6893 | public LSL_String llAvatarOnSitTarget() |
@@ -7560,10 +7572,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7560 | shapeBlock.PathScaleX = 100; | 7572 | shapeBlock.PathScaleX = 100; |
7561 | shapeBlock.PathScaleY = 150; | 7573 | shapeBlock.PathScaleY = 150; |
7562 | 7574 | ||
7563 | if ((type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER) == 0 && | 7575 | int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR); |
7564 | (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE) == 0 && | 7576 | |
7565 | (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE) == 0 && | 7577 | if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) && |
7566 | (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) == 0) | 7578 | type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) && |
7579 | type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) && | ||
7580 | type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag)) | ||
7567 | { | 7581 | { |
7568 | // default | 7582 | // default |
7569 | type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; | 7583 | type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; |
@@ -8851,23 +8865,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8851 | { | 8865 | { |
8852 | m_host.AddScriptLPS(1); | 8866 | m_host.AddScriptLPS(1); |
8853 | ScriptSleep(1000); | 8867 | ScriptSleep(1000); |
8868 | return GetPrimMediaParams(m_host, face, rules); | ||
8869 | } | ||
8870 | |||
8871 | public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) | ||
8872 | { | ||
8873 | m_host.AddScriptLPS(1); | ||
8874 | ScriptSleep(1000); | ||
8875 | if (link == ScriptBaseClass.LINK_ROOT) | ||
8876 | return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); | ||
8877 | else if (link == ScriptBaseClass.LINK_THIS) | ||
8878 | return GetPrimMediaParams(m_host, face, rules); | ||
8879 | else | ||
8880 | { | ||
8881 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
8882 | if (null != part) | ||
8883 | return GetPrimMediaParams(part, face, rules); | ||
8884 | } | ||
8854 | 8885 | ||
8886 | return new LSL_List(); | ||
8887 | } | ||
8888 | |||
8889 | private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) | ||
8890 | { | ||
8855 | // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid | 8891 | // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid |
8856 | // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). | 8892 | // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). |
8857 | // Assuming silently fail means give back an empty list. Ideally, need to check this. | 8893 | // Assuming silently fail means give back an empty list. Ideally, need to check this. |
8858 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 8894 | if (face < 0 || face > part.GetNumberOfSides() - 1) |
8859 | return new LSL_List(); | 8895 | return new LSL_List(); |
8860 | 8896 | ||
8861 | return GetPrimMediaParams(face, rules); | ||
8862 | } | ||
8863 | |||
8864 | private LSL_List GetPrimMediaParams(int face, LSL_List rules) | ||
8865 | { | ||
8866 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 8897 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
8867 | if (null == module) | 8898 | if (null == module) |
8868 | throw new Exception("Media on a prim functions not available"); | 8899 | return new LSL_List(); |
8869 | 8900 | ||
8870 | MediaEntry me = module.GetMediaEntry(m_host, face); | 8901 | MediaEntry me = module.GetMediaEntry(part, face); |
8871 | 8902 | ||
8872 | // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams | 8903 | // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams |
8873 | if (null == me) | 8904 | if (null == me) |
@@ -8949,33 +8980,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8949 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: | 8980 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: |
8950 | res.Add(new LSL_Integer((int)me.ControlPermissions)); | 8981 | res.Add(new LSL_Integer((int)me.ControlPermissions)); |
8951 | break; | 8982 | break; |
8983 | |||
8984 | default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; | ||
8952 | } | 8985 | } |
8953 | } | 8986 | } |
8954 | 8987 | ||
8955 | return res; | 8988 | return res; |
8956 | } | 8989 | } |
8957 | 8990 | ||
8958 | public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) | 8991 | public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) |
8959 | { | 8992 | { |
8960 | m_host.AddScriptLPS(1); | 8993 | m_host.AddScriptLPS(1); |
8961 | ScriptSleep(1000); | 8994 | ScriptSleep(1000); |
8995 | return SetPrimMediaParams(m_host, face, rules); | ||
8996 | } | ||
8962 | 8997 | ||
8963 | // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid | 8998 | public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) |
8964 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | 8999 | { |
8965 | // Don't perform the media check directly | 9000 | m_host.AddScriptLPS(1); |
8966 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 9001 | ScriptSleep(1000); |
8967 | return ScriptBaseClass.LSL_STATUS_OK; | 9002 | if (link == ScriptBaseClass.LINK_ROOT) |
9003 | return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); | ||
9004 | else if (link == ScriptBaseClass.LINK_THIS) | ||
9005 | return SetPrimMediaParams(m_host, face, rules); | ||
9006 | else | ||
9007 | { | ||
9008 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
9009 | if (null != part) | ||
9010 | return SetPrimMediaParams(part, face, rules); | ||
9011 | } | ||
8968 | 9012 | ||
8969 | return SetPrimMediaParams(face, rules); | 9013 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; |
8970 | } | 9014 | } |
8971 | 9015 | ||
8972 | private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) | 9016 | private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules) |
8973 | { | 9017 | { |
9018 | // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid | ||
9019 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | ||
9020 | // Don't perform the media check directly | ||
9021 | if (face < 0 || face > part.GetNumberOfSides() - 1) | ||
9022 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; | ||
9023 | |||
8974 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 9024 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
8975 | if (null == module) | 9025 | if (null == module) |
8976 | throw new Exception("Media on a prim functions not available"); | 9026 | return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; |
8977 | 9027 | ||
8978 | MediaEntry me = module.GetMediaEntry(m_host, face); | 9028 | MediaEntry me = module.GetMediaEntry(part, face); |
8979 | if (null == me) | 9029 | if (null == me) |
8980 | me = new MediaEntry(); | 9030 | me = new MediaEntry(); |
8981 | 9031 | ||
@@ -9054,10 +9104,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9054 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: | 9104 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: |
9055 | me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); | 9105 | me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); |
9056 | break; | 9106 | break; |
9107 | |||
9108 | default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; | ||
9057 | } | 9109 | } |
9058 | } | 9110 | } |
9059 | 9111 | ||
9060 | module.SetMediaEntry(m_host, face, me); | 9112 | module.SetMediaEntry(part, face, me); |
9061 | 9113 | ||
9062 | return ScriptBaseClass.LSL_STATUS_OK; | 9114 | return ScriptBaseClass.LSL_STATUS_OK; |
9063 | } | 9115 | } |
@@ -9066,18 +9118,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9066 | { | 9118 | { |
9067 | m_host.AddScriptLPS(1); | 9119 | m_host.AddScriptLPS(1); |
9068 | ScriptSleep(1000); | 9120 | ScriptSleep(1000); |
9121 | return ClearPrimMedia(m_host, face); | ||
9122 | } | ||
9069 | 9123 | ||
9124 | public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) | ||
9125 | { | ||
9126 | m_host.AddScriptLPS(1); | ||
9127 | ScriptSleep(1000); | ||
9128 | if (link == ScriptBaseClass.LINK_ROOT) | ||
9129 | return ClearPrimMedia(m_host.ParentGroup.RootPart, face); | ||
9130 | else if (link == ScriptBaseClass.LINK_THIS) | ||
9131 | return ClearPrimMedia(m_host, face); | ||
9132 | else | ||
9133 | { | ||
9134 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); | ||
9135 | if (null != part) | ||
9136 | return ClearPrimMedia(part, face); | ||
9137 | } | ||
9138 | |||
9139 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; | ||
9140 | } | ||
9141 | |||
9142 | private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face) | ||
9143 | { | ||
9070 | // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid | 9144 | // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid |
9071 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. | 9145 | // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. |
9072 | // FIXME: Don't perform the media check directly | 9146 | // FIXME: Don't perform the media check directly |
9073 | if (face < 0 || face > m_host.GetNumberOfSides() - 1) | 9147 | if (face < 0 || face > part.GetNumberOfSides() - 1) |
9074 | return ScriptBaseClass.LSL_STATUS_OK; | 9148 | return ScriptBaseClass.LSL_STATUS_NOT_FOUND; |
9075 | 9149 | ||
9076 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | 9150 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); |
9077 | if (null == module) | 9151 | if (null == module) |
9078 | throw new Exception("Media on a prim functions not available"); | 9152 | return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; |
9079 | 9153 | ||
9080 | module.ClearMediaEntry(m_host, face); | 9154 | module.ClearMediaEntry(part, face); |
9081 | 9155 | ||
9082 | return ScriptBaseClass.LSL_STATUS_OK; | 9156 | return ScriptBaseClass.LSL_STATUS_OK; |
9083 | } | 9157 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a9b8e04..ecc5fb5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2169,6 +2169,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2169 | return result; | 2169 | return result; |
2170 | } | 2170 | } |
2171 | 2171 | ||
2172 | public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) | ||
2173 | { | ||
2174 | CheckThreatLevel(ThreatLevel.High, "osReplaceString"); | ||
2175 | m_host.AddScriptLPS(1); | ||
2176 | |||
2177 | // Normalize indices (if negative). | ||
2178 | // After normlaization they may still be | ||
2179 | // negative, but that is now relative to | ||
2180 | // the start, rather than the end, of the | ||
2181 | // sequence. | ||
2182 | if (start < 0) | ||
2183 | { | ||
2184 | start = src.Length + start; | ||
2185 | } | ||
2186 | |||
2187 | if (start < 0 || start >= src.Length) | ||
2188 | { | ||
2189 | return src; | ||
2190 | } | ||
2191 | |||
2192 | // Find matches beginning at start position | ||
2193 | Regex matcher = new Regex(pattern); | ||
2194 | return matcher.Replace(src,replace,count,start); | ||
2195 | } | ||
2196 | |||
2172 | public string osLoadedCreationDate() | 2197 | public string osLoadedCreationDate() |
2173 | { | 2198 | { |
2174 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); | 2199 | CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); |
@@ -2786,7 +2811,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2786 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); | 2811 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); |
2787 | m_host.AddScriptLPS(1); | 2812 | m_host.AddScriptLPS(1); |
2788 | ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); | 2813 | ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); |
2789 | avatar.SpeedModifier = (float)SpeedModifier; | 2814 | |
2815 | if (avatar != null) | ||
2816 | avatar.SpeedModifier = (float)SpeedModifier; | ||
2790 | } | 2817 | } |
2791 | 2818 | ||
2792 | public void osKickAvatar(string FirstName,string SurName,string alert) | 2819 | public void osKickAvatar(string FirstName,string SurName,string alert) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs index 7fa19b1..9f78a49 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs | |||
@@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
38 | { | 38 | { |
39 | public AsyncCommandManager m_CmdManager; | 39 | public AsyncCommandManager m_CmdManager; |
40 | 40 | ||
41 | public int DataserverRequestsCount | ||
42 | { | ||
43 | get | ||
44 | { | ||
45 | lock (DataserverRequests) | ||
46 | return DataserverRequests.Count; | ||
47 | } | ||
48 | } | ||
49 | |||
41 | private Dictionary<string, DataserverRequest> DataserverRequests = | 50 | private Dictionary<string, DataserverRequest> DataserverRequests = |
42 | new Dictionary<string, DataserverRequest>(); | 51 | new Dictionary<string, DataserverRequest>(); |
43 | 52 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index 740816f..93e0261 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs | |||
@@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
42 | 42 | ||
43 | public AsyncCommandManager m_CmdManager; | 43 | public AsyncCommandManager m_CmdManager; |
44 | 44 | ||
45 | private IWorldComm m_commsPlugin; | ||
46 | |||
47 | public int ListenerCount | ||
48 | { | ||
49 | get { return m_commsPlugin.ListenerCount; } | ||
50 | } | ||
51 | |||
45 | public Listener(AsyncCommandManager CmdManager) | 52 | public Listener(AsyncCommandManager CmdManager) |
46 | { | 53 | { |
47 | m_CmdManager = CmdManager; | 54 | m_CmdManager = CmdManager; |
55 | m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | ||
48 | } | 56 | } |
49 | 57 | ||
50 | public void CheckListeners() | 58 | public void CheckListeners() |
51 | { | 59 | { |
52 | if (m_CmdManager.m_ScriptEngine.World == null) | 60 | if (m_CmdManager.m_ScriptEngine.World == null) |
53 | return; | 61 | return; |
54 | IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | ||
55 | 62 | ||
56 | if (comms != null) | 63 | if (m_commsPlugin != null) |
57 | { | 64 | { |
58 | while (comms.HasMessages()) | 65 | while (m_commsPlugin.HasMessages()) |
59 | { | 66 | { |
60 | ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage(); | 67 | ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage(); |
61 | 68 | ||
62 | //Deliver data to prim's listen handler | 69 | //Deliver data to prim's listen handler |
63 | object[] resobj = new object[] | 70 | object[] resobj = new object[] |
@@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
81 | 88 | ||
82 | public Object[] GetSerializationData(UUID itemID) | 89 | public Object[] GetSerializationData(UUID itemID) |
83 | { | 90 | { |
84 | IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 91 | return m_commsPlugin.GetSerializationData(itemID); |
85 | |||
86 | return comms.GetSerializationData(itemID); | ||
87 | } | 92 | } |
88 | 93 | ||
89 | public void CreateFromData(uint localID, UUID itemID, UUID hostID, | 94 | public void CreateFromData(uint localID, UUID itemID, UUID hostID, |
90 | Object[] data) | 95 | Object[] data) |
91 | { | 96 | { |
92 | IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 97 | m_commsPlugin.CreateFromData(localID, itemID, hostID, data); |
93 | |||
94 | comms.CreateFromData(localID, itemID, hostID, data); | ||
95 | } | 98 | } |
96 | } | 99 | } |
97 | } | 100 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 83da204..1373971 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
44 | 44 | ||
45 | public AsyncCommandManager m_CmdManager; | 45 | public AsyncCommandManager m_CmdManager; |
46 | 46 | ||
47 | /// <summary> | ||
48 | /// Number of sensors active. | ||
49 | /// </summary> | ||
50 | public int SensorsCount | ||
51 | { | ||
52 | get | ||
53 | { | ||
54 | lock (SenseRepeatListLock) | ||
55 | return SenseRepeaters.Count; | ||
56 | } | ||
57 | } | ||
58 | |||
47 | public SensorRepeat(AsyncCommandManager CmdManager) | 59 | public SensorRepeat(AsyncCommandManager CmdManager) |
48 | { | 60 | { |
49 | m_CmdManager = CmdManager; | 61 | m_CmdManager = CmdManager; |
@@ -157,12 +169,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
157 | 169 | ||
158 | public void CheckSenseRepeaterEvents() | 170 | public void CheckSenseRepeaterEvents() |
159 | { | 171 | { |
160 | // Nothing to do here? | ||
161 | if (SenseRepeaters.Count == 0) | ||
162 | return; | ||
163 | |||
164 | lock (SenseRepeatListLock) | 172 | lock (SenseRepeatListLock) |
165 | { | 173 | { |
174 | // Nothing to do here? | ||
175 | if (SenseRepeaters.Count == 0) | ||
176 | return; | ||
177 | |||
166 | // Go through all timers | 178 | // Go through all timers |
167 | foreach (SenseRepeatClass ts in SenseRepeaters) | 179 | foreach (SenseRepeatClass ts in SenseRepeaters) |
168 | { | 180 | { |
@@ -640,7 +652,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
640 | ts.next = | 652 | ts.next = |
641 | DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); | 653 | DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); |
642 | 654 | ||
643 | SenseRepeaters.Add(ts); | 655 | lock (SenseRepeatListLock) |
656 | SenseRepeaters.Add(ts); | ||
657 | |||
644 | idx += 6; | 658 | idx += 6; |
645 | } | 659 | } |
646 | } | 660 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index 2fd33fe..9ee6946 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
37 | { | 37 | { |
38 | public AsyncCommandManager m_CmdManager; | 38 | public AsyncCommandManager m_CmdManager; |
39 | 39 | ||
40 | public int TimersCount | ||
41 | { | ||
42 | get | ||
43 | { | ||
44 | lock (TimerListLock) | ||
45 | return Timers.Count; | ||
46 | } | ||
47 | } | ||
48 | |||
40 | public Timer(AsyncCommandManager CmdManager) | 49 | public Timer(AsyncCommandManager CmdManager) |
41 | { | 50 | { |
42 | m_CmdManager = CmdManager; | 51 | m_CmdManager = CmdManager; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 5b8c316..8d97a7c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
64 | LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); | 64 | LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); |
65 | LSL_Integer llCeil(double f); | 65 | LSL_Integer llCeil(double f); |
66 | void llClearCameraParams(); | 66 | void llClearCameraParams(); |
67 | LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face); | ||
67 | LSL_Integer llClearPrimMedia(LSL_Integer face); | 68 | LSL_Integer llClearPrimMedia(LSL_Integer face); |
68 | void llCloseRemoteDataChannel(string channel); | 69 | void llCloseRemoteDataChannel(string channel); |
69 | LSL_Float llCloud(LSL_Vector offset); | 70 | LSL_Float llCloud(LSL_Vector offset); |
@@ -140,7 +141,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
140 | LSL_String llGetLinkName(int linknum); | 141 | LSL_String llGetLinkName(int linknum); |
141 | LSL_Integer llGetLinkNumber(); | 142 | LSL_Integer llGetLinkNumber(); |
142 | LSL_Integer llGetLinkNumberOfSides(int link); | 143 | LSL_Integer llGetLinkNumberOfSides(int link); |
143 | LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); | 144 | LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); |
145 | LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); | ||
144 | LSL_Integer llGetListEntryType(LSL_List src, int index); | 146 | LSL_Integer llGetListEntryType(LSL_List src, int index); |
145 | LSL_Integer llGetListLength(LSL_List src); | 147 | LSL_Integer llGetListLength(LSL_List src); |
146 | LSL_Vector llGetLocalPos(); | 148 | LSL_Vector llGetLocalPos(); |
@@ -220,6 +222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
220 | LSL_String llGetDisplayName(string id); | 222 | LSL_String llGetDisplayName(string id); |
221 | LSL_String llRequestDisplayName(string id); | 223 | LSL_String llRequestDisplayName(string id); |
222 | void llLinkParticleSystem(int linknum, LSL_List rules); | 224 | void llLinkParticleSystem(int linknum, LSL_List rules); |
225 | void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot); | ||
223 | LSL_String llList2CSV(LSL_List src); | 226 | LSL_String llList2CSV(LSL_List src); |
224 | LSL_Float llList2Float(LSL_List src, int index); | 227 | LSL_Float llList2Float(LSL_List src, int index); |
225 | LSL_Integer llList2Integer(LSL_List src, int index); | 228 | LSL_Integer llList2Integer(LSL_List src, int index); |
@@ -336,6 +339,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
336 | void llSetInventoryPermMask(string item, int mask, int value); | 339 | void llSetInventoryPermMask(string item, int mask, int value); |
337 | void llSetLinkAlpha(int linknumber, double alpha, int face); | 340 | void llSetLinkAlpha(int linknumber, double alpha, int face); |
338 | void llSetLinkColor(int linknumber, LSL_Vector color, int face); | 341 | void llSetLinkColor(int linknumber, LSL_Vector color, int face); |
342 | LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); | ||
339 | void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); | 343 | void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); |
340 | void llSetLinkTexture(int linknumber, string texture, int face); | 344 | void llSetLinkTexture(int linknumber, string texture, int face); |
341 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | 345 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); |
@@ -347,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
347 | void llSetPayPrice(int price, LSL_List quick_pay_buttons); | 351 | void llSetPayPrice(int price, LSL_List quick_pay_buttons); |
348 | void llSetPos(LSL_Vector pos); | 352 | void llSetPos(LSL_Vector pos); |
349 | LSL_Integer llSetRegionPos(LSL_Vector pos); | 353 | LSL_Integer llSetRegionPos(LSL_Vector pos); |
350 | LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); | 354 | LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules); |
351 | void llSetPrimitiveParams(LSL_List rules); | 355 | void llSetPrimitiveParams(LSL_List rules); |
352 | void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); | 356 | void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); |
353 | void llSetPrimURL(string url); | 357 | void llSetPrimURL(string url); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index ca24051..fb52600 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -165,6 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
165 | 165 | ||
166 | LSL_String osFormatString(string str, LSL_List strings); | 166 | LSL_String osFormatString(string str, LSL_List strings); |
167 | LSL_List osMatchString(string src, string pattern, int start); | 167 | LSL_List osMatchString(string src, string pattern, int start); |
168 | LSL_String osReplaceString(string src, string pattern, string replace, int count, int start); | ||
168 | 169 | ||
169 | // Information about data loaded into the region | 170 | // Information about data loaded into the region |
170 | string osLoadedCreationDate(); | 171 | string osLoadedCreationDate(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 1366141..a8d1ddb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1710,6 +1710,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1710 | m_LSL_Functions.llSitTarget(offset, rot); | 1710 | m_LSL_Functions.llSitTarget(offset, rot); |
1711 | } | 1711 | } |
1712 | 1712 | ||
1713 | public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) | ||
1714 | { | ||
1715 | m_LSL_Functions.llLinkSitTarget(link, offset, rot); | ||
1716 | } | ||
1717 | |||
1713 | public void llSleep(double sec) | 1718 | public void llSleep(double sec) |
1714 | { | 1719 | { |
1715 | m_LSL_Functions.llSleep(sec); | 1720 | m_LSL_Functions.llSleep(sec); |
@@ -1909,17 +1914,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1909 | { | 1914 | { |
1910 | return m_LSL_Functions.llGetPrimMediaParams(face, rules); | 1915 | return m_LSL_Functions.llGetPrimMediaParams(face, rules); |
1911 | } | 1916 | } |
1912 | 1917 | ||
1918 | public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) | ||
1919 | { | ||
1920 | return m_LSL_Functions.llGetLinkMedia(link, face, rules); | ||
1921 | } | ||
1922 | |||
1913 | public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) | 1923 | public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) |
1914 | { | 1924 | { |
1915 | return m_LSL_Functions.llSetPrimMediaParams(face, rules); | 1925 | return m_LSL_Functions.llSetPrimMediaParams(face, rules); |
1916 | } | 1926 | } |
1917 | 1927 | ||
1928 | public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) | ||
1929 | { | ||
1930 | return m_LSL_Functions.llSetLinkMedia(link, face, rules); | ||
1931 | } | ||
1932 | |||
1918 | public LSL_Integer llClearPrimMedia(LSL_Integer face) | 1933 | public LSL_Integer llClearPrimMedia(LSL_Integer face) |
1919 | { | 1934 | { |
1920 | return m_LSL_Functions.llClearPrimMedia(face); | 1935 | return m_LSL_Functions.llClearPrimMedia(face); |
1921 | } | 1936 | } |
1922 | 1937 | ||
1938 | public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) | ||
1939 | { | ||
1940 | return m_LSL_Functions.llClearLinkMedia(link, face); | ||
1941 | } | ||
1942 | |||
1923 | public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) | 1943 | public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) |
1924 | { | 1944 | { |
1925 | return m_LSL_Functions.llGetLinkNumberOfSides(link); | 1945 | return m_LSL_Functions.llGetLinkNumberOfSides(link); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index cc8d417..4341246 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -472,6 +472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
472 | return m_OSSL_Functions.osMatchString(src, pattern, start); | 472 | return m_OSSL_Functions.osMatchString(src, pattern, start); |
473 | } | 473 | } |
474 | 474 | ||
475 | public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) | ||
476 | { | ||
477 | return m_OSSL_Functions.osReplaceString(src,pattern,replace,count,start); | ||
478 | } | ||
479 | |||
480 | |||
475 | // Information about data loaded into the region | 481 | // Information about data loaded into the region |
476 | public string osLoadedCreationDate() | 482 | public string osLoadedCreationDate() |
477 | { | 483 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 8b88588..65d3b9b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
118 | emessage = emessage.Substring(slinfo.Length+2); | 118 | emessage = emessage.Substring(slinfo.Length+2); |
119 | 119 | ||
120 | message = String.Format("({0},{1}) {2}", | 120 | message = String.Format("({0},{1}) {2}", |
121 | e.slInfo.lineNumber - 2, | 121 | e.slInfo.lineNumber - 1, |
122 | e.slInfo.charPosition - 1, emessage); | 122 | e.slInfo.charPosition - 1, emessage); |
123 | 123 | ||
124 | throw new Exception(message); | 124 | throw new Exception(message); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 63afb0b..7763619 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Text.RegularExpressions; | 29 | using System.Text.RegularExpressions; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 31 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
32 | using OpenSim.Tests.Common; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 34 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
34 | { | 35 | { |
@@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
43 | [Test] | 44 | [Test] |
44 | public void TestDefaultState() | 45 | public void TestDefaultState() |
45 | { | 46 | { |
47 | TestHelpers.InMethod(); | ||
48 | |||
46 | string input = @"default | 49 | string input = @"default |
47 | { | 50 | { |
48 | state_entry() | 51 | state_entry() |
@@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
63 | [Test] | 66 | [Test] |
64 | public void TestCustomState() | 67 | public void TestCustomState() |
65 | { | 68 | { |
69 | TestHelpers.InMethod(); | ||
70 | |||
66 | string input = @"default | 71 | string input = @"default |
67 | { | 72 | { |
68 | state_entry() | 73 | state_entry() |
@@ -93,6 +98,8 @@ state another_state | |||
93 | [Test] | 98 | [Test] |
94 | public void TestEventWithArguments() | 99 | public void TestEventWithArguments() |
95 | { | 100 | { |
101 | TestHelpers.InMethod(); | ||
102 | |||
96 | string input = @"default | 103 | string input = @"default |
97 | { | 104 | { |
98 | at_rot_target(integer tnum, rotation targetrot, rotation ourrot) | 105 | at_rot_target(integer tnum, rotation targetrot, rotation ourrot) |
@@ -113,6 +120,8 @@ state another_state | |||
113 | [Test] | 120 | [Test] |
114 | public void TestIntegerDeclaration() | 121 | public void TestIntegerDeclaration() |
115 | { | 122 | { |
123 | TestHelpers.InMethod(); | ||
124 | |||
116 | string input = @"default | 125 | string input = @"default |
117 | { | 126 | { |
118 | touch_start(integer num_detected) | 127 | touch_start(integer num_detected) |
@@ -135,6 +144,8 @@ state another_state | |||
135 | [Test] | 144 | [Test] |
136 | public void TestLoneIdent() | 145 | public void TestLoneIdent() |
137 | { | 146 | { |
147 | TestHelpers.InMethod(); | ||
148 | |||
138 | // A lone ident should be removed completely as it's an error in C# | 149 | // A lone ident should be removed completely as it's an error in C# |
139 | // (MONO at least). | 150 | // (MONO at least). |
140 | string input = @"default | 151 | string input = @"default |
@@ -161,6 +172,8 @@ state another_state | |||
161 | [Test] | 172 | [Test] |
162 | public void TestAssignments() | 173 | public void TestAssignments() |
163 | { | 174 | { |
175 | TestHelpers.InMethod(); | ||
176 | |||
164 | string input = @"default | 177 | string input = @"default |
165 | { | 178 | { |
166 | touch_start(integer num_detected) | 179 | touch_start(integer num_detected) |
@@ -187,6 +200,8 @@ state another_state | |||
187 | [Test] | 200 | [Test] |
188 | public void TestAdditionSubtractionOperator() | 201 | public void TestAdditionSubtractionOperator() |
189 | { | 202 | { |
203 | TestHelpers.InMethod(); | ||
204 | |||
190 | string input = @"default | 205 | string input = @"default |
191 | { | 206 | { |
192 | touch_start(integer num_detected) | 207 | touch_start(integer num_detected) |
@@ -215,6 +230,8 @@ state another_state | |||
215 | [Test] | 230 | [Test] |
216 | public void TestStrings() | 231 | public void TestStrings() |
217 | { | 232 | { |
233 | TestHelpers.InMethod(); | ||
234 | |||
218 | string input = @"default | 235 | string input = @"default |
219 | { | 236 | { |
220 | touch_start(integer num_detected) | 237 | touch_start(integer num_detected) |
@@ -242,6 +259,8 @@ state another_state | |||
242 | [Test] | 259 | [Test] |
243 | public void TestBinaryExpression() | 260 | public void TestBinaryExpression() |
244 | { | 261 | { |
262 | TestHelpers.InMethod(); | ||
263 | |||
245 | string input = @"default | 264 | string input = @"default |
246 | { | 265 | { |
247 | touch_start(integer num_detected) | 266 | touch_start(integer num_detected) |
@@ -284,6 +303,8 @@ state another_state | |||
284 | [Test] | 303 | [Test] |
285 | public void TestFloatConstants() | 304 | public void TestFloatConstants() |
286 | { | 305 | { |
306 | TestHelpers.InMethod(); | ||
307 | |||
287 | string input = @"default | 308 | string input = @"default |
288 | { | 309 | { |
289 | touch_start(integer num_detected) | 310 | touch_start(integer num_detected) |
@@ -336,6 +357,8 @@ state another_state | |||
336 | [Test] | 357 | [Test] |
337 | public void TestComments() | 358 | public void TestComments() |
338 | { | 359 | { |
360 | TestHelpers.InMethod(); | ||
361 | |||
339 | string input = @"// this test tests comments | 362 | string input = @"// this test tests comments |
340 | default | 363 | default |
341 | { | 364 | { |
@@ -358,6 +381,8 @@ default | |||
358 | [Test] | 381 | [Test] |
359 | public void TestStringsWithEscapedQuotesAndComments() | 382 | public void TestStringsWithEscapedQuotesAndComments() |
360 | { | 383 | { |
384 | TestHelpers.InMethod(); | ||
385 | |||
361 | string input = @"// this test tests strings, with escaped quotes and comments in strings | 386 | string input = @"// this test tests strings, with escaped quotes and comments in strings |
362 | default | 387 | default |
363 | { | 388 | { |
@@ -397,6 +422,8 @@ default | |||
397 | [Test] | 422 | [Test] |
398 | public void TestCStyleComments() | 423 | public void TestCStyleComments() |
399 | { | 424 | { |
425 | TestHelpers.InMethod(); | ||
426 | |||
400 | string input = @"/* this test tests comments | 427 | string input = @"/* this test tests comments |
401 | of the C variety | 428 | of the C variety |
402 | */ | 429 | */ |
@@ -426,6 +453,8 @@ default | |||
426 | [Test] | 453 | [Test] |
427 | public void TestGlobalDefinedFunctions() | 454 | public void TestGlobalDefinedFunctions() |
428 | { | 455 | { |
456 | TestHelpers.InMethod(); | ||
457 | |||
429 | string input = @"// this test tests custom defined functions | 458 | string input = @"// this test tests custom defined functions |
430 | 459 | ||
431 | string onefunc() | 460 | string onefunc() |
@@ -470,6 +499,8 @@ default | |||
470 | [Test] | 499 | [Test] |
471 | public void TestGlobalDeclaredVariables() | 500 | public void TestGlobalDeclaredVariables() |
472 | { | 501 | { |
502 | TestHelpers.InMethod(); | ||
503 | |||
473 | string input = @"// this test tests custom defined functions and global variables | 504 | string input = @"// this test tests custom defined functions and global variables |
474 | 505 | ||
475 | string globalString; | 506 | string globalString; |
@@ -525,6 +556,8 @@ default | |||
525 | [Test] | 556 | [Test] |
526 | public void TestMoreAssignments() | 557 | public void TestMoreAssignments() |
527 | { | 558 | { |
559 | TestHelpers.InMethod(); | ||
560 | |||
528 | string input = @"// this test tests +=, -=, *=, /=, %= | 561 | string input = @"// this test tests +=, -=, *=, /=, %= |
529 | 562 | ||
530 | string globalString; | 563 | string globalString; |
@@ -579,6 +612,8 @@ default | |||
579 | [Test] | 612 | [Test] |
580 | public void TestVectorConstantNotation() | 613 | public void TestVectorConstantNotation() |
581 | { | 614 | { |
615 | TestHelpers.InMethod(); | ||
616 | |||
582 | string input = @"default | 617 | string input = @"default |
583 | { | 618 | { |
584 | touch_start(integer num_detected) | 619 | touch_start(integer num_detected) |
@@ -606,6 +641,8 @@ default | |||
606 | [Test] | 641 | [Test] |
607 | public void TestVectorMemberAccess() | 642 | public void TestVectorMemberAccess() |
608 | { | 643 | { |
644 | TestHelpers.InMethod(); | ||
645 | |||
609 | string input = @"default | 646 | string input = @"default |
610 | { | 647 | { |
611 | touch_start(integer num_detected) | 648 | touch_start(integer num_detected) |
@@ -632,6 +669,8 @@ default | |||
632 | [Test] | 669 | [Test] |
633 | public void TestExpressionInParentheses() | 670 | public void TestExpressionInParentheses() |
634 | { | 671 | { |
672 | TestHelpers.InMethod(); | ||
673 | |||
635 | string input = @"default | 674 | string input = @"default |
636 | { | 675 | { |
637 | touch_start(integer num_detected) | 676 | touch_start(integer num_detected) |
@@ -660,6 +699,8 @@ default | |||
660 | [Test] | 699 | [Test] |
661 | public void TestIncrementDecrementOperator() | 700 | public void TestIncrementDecrementOperator() |
662 | { | 701 | { |
702 | TestHelpers.InMethod(); | ||
703 | |||
663 | string input = @"// here we'll test the ++ and -- operators | 704 | string input = @"// here we'll test the ++ and -- operators |
664 | 705 | ||
665 | default | 706 | default |
@@ -690,6 +731,8 @@ default | |||
690 | [Test] | 731 | [Test] |
691 | public void TestLists() | 732 | public void TestLists() |
692 | { | 733 | { |
734 | TestHelpers.InMethod(); | ||
735 | |||
693 | string input = @"// testing lists | 736 | string input = @"// testing lists |
694 | 737 | ||
695 | default | 738 | default |
@@ -718,6 +761,8 @@ default | |||
718 | [Test] | 761 | [Test] |
719 | public void TestIfStatement() | 762 | public void TestIfStatement() |
720 | { | 763 | { |
764 | TestHelpers.InMethod(); | ||
765 | |||
721 | string input = @"// let's test if statements | 766 | string input = @"// let's test if statements |
722 | 767 | ||
723 | default | 768 | default |
@@ -822,6 +867,8 @@ default | |||
822 | [Test] | 867 | [Test] |
823 | public void TestIfElseStatement() | 868 | public void TestIfElseStatement() |
824 | { | 869 | { |
870 | TestHelpers.InMethod(); | ||
871 | |||
825 | string input = @"// let's test complex logical expressions | 872 | string input = @"// let's test complex logical expressions |
826 | 873 | ||
827 | default | 874 | default |
@@ -928,6 +975,8 @@ default | |||
928 | [Test] | 975 | [Test] |
929 | public void TestWhileLoop() | 976 | public void TestWhileLoop() |
930 | { | 977 | { |
978 | TestHelpers.InMethod(); | ||
979 | |||
931 | string input = @"// let's test while loops | 980 | string input = @"// let's test while loops |
932 | 981 | ||
933 | default | 982 | default |
@@ -968,6 +1017,8 @@ default | |||
968 | [Test] | 1017 | [Test] |
969 | public void TestDoWhileLoop() | 1018 | public void TestDoWhileLoop() |
970 | { | 1019 | { |
1020 | TestHelpers.InMethod(); | ||
1021 | |||
971 | string input = @"// let's test do-while loops | 1022 | string input = @"// let's test do-while loops |
972 | 1023 | ||
973 | default | 1024 | default |
@@ -1012,6 +1063,8 @@ default | |||
1012 | [Test] | 1063 | [Test] |
1013 | public void TestForLoop() | 1064 | public void TestForLoop() |
1014 | { | 1065 | { |
1066 | TestHelpers.InMethod(); | ||
1067 | |||
1015 | string input = @"// let's test for loops | 1068 | string input = @"// let's test for loops |
1016 | 1069 | ||
1017 | default | 1070 | default |
@@ -1056,6 +1109,8 @@ default | |||
1056 | [Test] | 1109 | [Test] |
1057 | public void TestFloatsWithTrailingDecimal() | 1110 | public void TestFloatsWithTrailingDecimal() |
1058 | { | 1111 | { |
1112 | TestHelpers.InMethod(); | ||
1113 | |||
1059 | string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot | 1114 | string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot |
1060 | 1115 | ||
1061 | default | 1116 | default |
@@ -1108,6 +1163,8 @@ default | |||
1108 | [Test] | 1163 | [Test] |
1109 | public void TestUnaryAndBinaryOperators() | 1164 | public void TestUnaryAndBinaryOperators() |
1110 | { | 1165 | { |
1166 | TestHelpers.InMethod(); | ||
1167 | |||
1111 | string input = @"// let's test a few more operators | 1168 | string input = @"// let's test a few more operators |
1112 | 1169 | ||
1113 | default | 1170 | default |
@@ -1144,6 +1201,8 @@ default | |||
1144 | [Test] | 1201 | [Test] |
1145 | public void TestTypecasts() | 1202 | public void TestTypecasts() |
1146 | { | 1203 | { |
1204 | TestHelpers.InMethod(); | ||
1205 | |||
1147 | string input = @"// let's test typecasts | 1206 | string input = @"// let's test typecasts |
1148 | 1207 | ||
1149 | default | 1208 | default |
@@ -1189,6 +1248,8 @@ default | |||
1189 | [Test] | 1248 | [Test] |
1190 | public void TestStates() | 1249 | public void TestStates() |
1191 | { | 1250 | { |
1251 | TestHelpers.InMethod(); | ||
1252 | |||
1192 | string input = @"// let's test states | 1253 | string input = @"// let's test states |
1193 | 1254 | ||
1194 | default | 1255 | default |
@@ -1229,6 +1290,8 @@ state statetwo | |||
1229 | [Test] | 1290 | [Test] |
1230 | public void TestHexIntegerConstants() | 1291 | public void TestHexIntegerConstants() |
1231 | { | 1292 | { |
1293 | TestHelpers.InMethod(); | ||
1294 | |||
1232 | string input = @"// let's test hex integers | 1295 | string input = @"// let's test hex integers |
1233 | 1296 | ||
1234 | default | 1297 | default |
@@ -1261,6 +1324,8 @@ default | |||
1261 | [Test] | 1324 | [Test] |
1262 | public void TestJumps() | 1325 | public void TestJumps() |
1263 | { | 1326 | { |
1327 | TestHelpers.InMethod(); | ||
1328 | |||
1264 | string input = @"// let's test jumps | 1329 | string input = @"// let's test jumps |
1265 | 1330 | ||
1266 | default | 1331 | default |
@@ -1291,6 +1356,8 @@ default | |||
1291 | [Test] | 1356 | [Test] |
1292 | public void TestImplicitVariableInitialization() | 1357 | public void TestImplicitVariableInitialization() |
1293 | { | 1358 | { |
1359 | TestHelpers.InMethod(); | ||
1360 | |||
1294 | string input = @"// let's test implicitly initializing variables | 1361 | string input = @"// let's test implicitly initializing variables |
1295 | 1362 | ||
1296 | default | 1363 | default |
@@ -1334,6 +1401,8 @@ default | |||
1334 | [Test] | 1401 | [Test] |
1335 | public void TestMultipleEqualsExpression() | 1402 | public void TestMultipleEqualsExpression() |
1336 | { | 1403 | { |
1404 | TestHelpers.InMethod(); | ||
1405 | |||
1337 | string input = @"// let's test x = y = 5 type expressions | 1406 | string input = @"// let's test x = y = 5 type expressions |
1338 | 1407 | ||
1339 | default | 1408 | default |
@@ -1366,6 +1435,8 @@ default | |||
1366 | [Test] | 1435 | [Test] |
1367 | public void TestUnaryExpressionLastInVectorConstant() | 1436 | public void TestUnaryExpressionLastInVectorConstant() |
1368 | { | 1437 | { |
1438 | TestHelpers.InMethod(); | ||
1439 | |||
1369 | string input = @"// let's test unary expressions some more | 1440 | string input = @"// let's test unary expressions some more |
1370 | 1441 | ||
1371 | default | 1442 | default |
@@ -1390,6 +1461,8 @@ default | |||
1390 | [Test] | 1461 | [Test] |
1391 | public void TestVectorMemberPlusEquals() | 1462 | public void TestVectorMemberPlusEquals() |
1392 | { | 1463 | { |
1464 | TestHelpers.InMethod(); | ||
1465 | |||
1393 | string input = @"// let's test unary expressions some more | 1466 | string input = @"// let's test unary expressions some more |
1394 | 1467 | ||
1395 | default | 1468 | default |
@@ -1424,6 +1497,8 @@ default | |||
1424 | [Test] | 1497 | [Test] |
1425 | public void TestWhileLoopWithNoBody() | 1498 | public void TestWhileLoopWithNoBody() |
1426 | { | 1499 | { |
1500 | TestHelpers.InMethod(); | ||
1501 | |||
1427 | string input = @"default | 1502 | string input = @"default |
1428 | { | 1503 | { |
1429 | state_entry() | 1504 | state_entry() |
@@ -1447,6 +1522,8 @@ default | |||
1447 | [Test] | 1522 | [Test] |
1448 | public void TestDoWhileLoopWithNoBody() | 1523 | public void TestDoWhileLoopWithNoBody() |
1449 | { | 1524 | { |
1525 | TestHelpers.InMethod(); | ||
1526 | |||
1450 | string input = @"default | 1527 | string input = @"default |
1451 | { | 1528 | { |
1452 | state_entry() | 1529 | state_entry() |
@@ -1472,6 +1549,8 @@ default | |||
1472 | [Test] | 1549 | [Test] |
1473 | public void TestIfWithNoBody() | 1550 | public void TestIfWithNoBody() |
1474 | { | 1551 | { |
1552 | TestHelpers.InMethod(); | ||
1553 | |||
1475 | string input = @"default | 1554 | string input = @"default |
1476 | { | 1555 | { |
1477 | state_entry() | 1556 | state_entry() |
@@ -1495,6 +1574,8 @@ default | |||
1495 | [Test] | 1574 | [Test] |
1496 | public void TestIfElseWithNoBody() | 1575 | public void TestIfElseWithNoBody() |
1497 | { | 1576 | { |
1577 | TestHelpers.InMethod(); | ||
1578 | |||
1498 | string input = @"default | 1579 | string input = @"default |
1499 | { | 1580 | { |
1500 | state_entry() | 1581 | state_entry() |
@@ -1521,6 +1602,8 @@ default | |||
1521 | [Test] | 1602 | [Test] |
1522 | public void TestForLoopWithNoBody() | 1603 | public void TestForLoopWithNoBody() |
1523 | { | 1604 | { |
1605 | TestHelpers.InMethod(); | ||
1606 | |||
1524 | string input = @"default | 1607 | string input = @"default |
1525 | { | 1608 | { |
1526 | state_entry() | 1609 | state_entry() |
@@ -1544,6 +1627,8 @@ default | |||
1544 | [Test] | 1627 | [Test] |
1545 | public void TestForLoopWithNoAssignment() | 1628 | public void TestForLoopWithNoAssignment() |
1546 | { | 1629 | { |
1630 | TestHelpers.InMethod(); | ||
1631 | |||
1547 | string input = @"default | 1632 | string input = @"default |
1548 | { | 1633 | { |
1549 | state_entry() | 1634 | state_entry() |
@@ -1569,6 +1654,8 @@ default | |||
1569 | [Test] | 1654 | [Test] |
1570 | public void TestForLoopWithOnlyIdentInAssignment() | 1655 | public void TestForLoopWithOnlyIdentInAssignment() |
1571 | { | 1656 | { |
1657 | TestHelpers.InMethod(); | ||
1658 | |||
1572 | string input = @"default | 1659 | string input = @"default |
1573 | { | 1660 | { |
1574 | state_entry() | 1661 | state_entry() |
@@ -1594,6 +1681,8 @@ default | |||
1594 | [Test] | 1681 | [Test] |
1595 | public void TestAssignmentInIfWhileDoWhile() | 1682 | public void TestAssignmentInIfWhileDoWhile() |
1596 | { | 1683 | { |
1684 | TestHelpers.InMethod(); | ||
1685 | |||
1597 | string input = @"default | 1686 | string input = @"default |
1598 | { | 1687 | { |
1599 | state_entry() | 1688 | state_entry() |
@@ -1631,6 +1720,8 @@ default | |||
1631 | [Test] | 1720 | [Test] |
1632 | public void TestLSLListHack() | 1721 | public void TestLSLListHack() |
1633 | { | 1722 | { |
1723 | TestHelpers.InMethod(); | ||
1724 | |||
1634 | string input = @"default | 1725 | string input = @"default |
1635 | { | 1726 | { |
1636 | state_entry() | 1727 | state_entry() |
@@ -1653,9 +1744,12 @@ default | |||
1653 | } | 1744 | } |
1654 | 1745 | ||
1655 | [Test] | 1746 | [Test] |
1656 | [ExpectedException(typeof(System.Exception))] | ||
1657 | public void TestSyntaxError() | 1747 | public void TestSyntaxError() |
1658 | { | 1748 | { |
1749 | TestHelpers.InMethod(); | ||
1750 | |||
1751 | bool gotException = false; | ||
1752 | |||
1659 | string input = @"default | 1753 | string input = @"default |
1660 | { | 1754 | { |
1661 | state_entry() | 1755 | state_entry() |
@@ -1671,17 +1765,22 @@ default | |||
1671 | } | 1765 | } |
1672 | catch (System.Exception e) | 1766 | catch (System.Exception e) |
1673 | { | 1767 | { |
1674 | // The syntax error is on line 6, char 5 (expected ';', found | 1768 | // The syntax error is on line 5, char 4 (expected ';', found |
1675 | // '}'). | 1769 | // '}'). |
1676 | Assert.AreEqual("(4,4) syntax error", e.Message); | 1770 | Assert.AreEqual("(5,4) syntax error", e.Message); |
1677 | throw; | 1771 | gotException = true; |
1678 | } | 1772 | } |
1773 | |||
1774 | Assert.That(gotException, Is.True); | ||
1679 | } | 1775 | } |
1680 | 1776 | ||
1681 | [Test] | 1777 | [Test] |
1682 | [ExpectedException(typeof(System.Exception))] | ||
1683 | public void TestSyntaxErrorDeclaringVariableInForLoop() | 1778 | public void TestSyntaxErrorDeclaringVariableInForLoop() |
1684 | { | 1779 | { |
1780 | TestHelpers.InMethod(); | ||
1781 | |||
1782 | bool gotException = false; | ||
1783 | |||
1685 | string input = @"default | 1784 | string input = @"default |
1686 | { | 1785 | { |
1687 | state_entry() | 1786 | state_entry() |
@@ -1697,11 +1796,13 @@ default | |||
1697 | } | 1796 | } |
1698 | catch (System.Exception e) | 1797 | catch (System.Exception e) |
1699 | { | 1798 | { |
1700 | // The syntax error is on line 5, char 14 (Syntax error) | 1799 | // The syntax error is on line 4, char 13 (Syntax error) |
1701 | Assert.AreEqual("(3,13) syntax error", e.Message); | 1800 | Assert.AreEqual("(4,13) syntax error", e.Message); |
1702 | 1801 | ||
1703 | throw; | 1802 | gotException = true; |
1704 | } | 1803 | } |
1804 | |||
1805 | Assert.That(gotException, Is.True); | ||
1705 | } | 1806 | } |
1706 | } | 1807 | } |
1707 | } | 1808 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index c5483c8..1fa6954 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using Microsoft.CSharp; | 31 | using Microsoft.CSharp; |
32 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
34 | using OpenSim.Tests.Common; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 36 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
36 | { | 37 | { |
@@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
92 | //[Test] | 93 | //[Test] |
93 | public void TestUseUndeclaredVariable() | 94 | public void TestUseUndeclaredVariable() |
94 | { | 95 | { |
96 | TestHelpers.InMethod(); | ||
97 | |||
95 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); | 98 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); |
96 | 99 | ||
97 | string input = @"default | 100 | string input = @"default |
@@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
124 | //[Test] | 127 | //[Test] |
125 | public void TestCastAndConcatString() | 128 | public void TestCastAndConcatString() |
126 | { | 129 | { |
130 | TestHelpers.InMethod(); | ||
131 | |||
127 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); | 132 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); |
128 | 133 | ||
129 | string input = @"string s = "" a string""; | 134 | string input = @"string s = "" a string""; |
@@ -150,4 +155,4 @@ default | |||
150 | Assert.AreEqual(0, m_compilerResults.Errors.Count); | 155 | Assert.AreEqual(0, m_compilerResults.Errors.Count); |
151 | } | 156 | } |
152 | } | 157 | } |
153 | } | 158 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 3baa723..9cf9258 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -46,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
46 | [TestFixture, LongRunning] | 46 | [TestFixture, LongRunning] |
47 | public class LSL_ApiTest | 47 | public class LSL_ApiTest |
48 | { | 48 | { |
49 | |||
50 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; | 49 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; |
51 | private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; | 50 | private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; |
52 | private const float FLOAT_ACCURACY = 0.00005f; | 51 | private const float FLOAT_ACCURACY = 0.00005f; |
@@ -55,7 +54,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
55 | [SetUp] | 54 | [SetUp] |
56 | public void SetUp() | 55 | public void SetUp() |
57 | { | 56 | { |
58 | |||
59 | IConfigSource initConfigSource = new IniConfigSource(); | 57 | IConfigSource initConfigSource = new IniConfigSource(); |
60 | IConfig config = initConfigSource.AddConfig("XEngine"); | 58 | IConfig config = initConfigSource.AddConfig("XEngine"); |
61 | config.Set("Enabled", "true"); | 59 | config.Set("Enabled", "true"); |
@@ -75,6 +73,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
75 | [Test] | 73 | [Test] |
76 | public void TestllAngleBetween() | 74 | public void TestllAngleBetween() |
77 | { | 75 | { |
76 | TestHelpers.InMethod(); | ||
77 | |||
78 | CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1); | 78 | CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1); |
79 | CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1); | 79 | CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1); |
80 | CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1); | 80 | CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1); |
@@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
158 | // llRot2Euler test. | 158 | // llRot2Euler test. |
159 | public void TestllRot2Euler() | 159 | public void TestllRot2Euler() |
160 | { | 160 | { |
161 | TestHelpers.InMethod(); | ||
162 | |||
161 | // 180, 90 and zero degree rotations. | 163 | // 180, 90 and zero degree rotations. |
162 | CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); | 164 | CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); |
163 | CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f)); | 165 | CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f)); |
@@ -256,6 +258,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
256 | // llSetPrimitiveParams and llGetPrimitiveParams test. | 258 | // llSetPrimitiveParams and llGetPrimitiveParams test. |
257 | public void TestllSetPrimitiveParams() | 259 | public void TestllSetPrimitiveParams() |
258 | { | 260 | { |
261 | TestHelpers.InMethod(); | ||
262 | |||
259 | // Create Prim1. | 263 | // Create Prim1. |
260 | Scene scene = SceneHelpers.SetupScene(); | 264 | Scene scene = SceneHelpers.SetupScene(); |
261 | string obj1Name = "Prim1"; | 265 | string obj1Name = "Prim1"; |
@@ -486,9 +490,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
486 | } | 490 | } |
487 | 491 | ||
488 | [Test] | 492 | [Test] |
489 | // llVecNorm test. | ||
490 | public void TestllVecNorm() | 493 | public void TestllVecNorm() |
491 | { | 494 | { |
495 | TestHelpers.InMethod(); | ||
496 | |||
492 | // Check special case for normalizing zero vector. | 497 | // Check special case for normalizing zero vector. |
493 | CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); | 498 | CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); |
494 | // Check various vectors. | 499 | // Check various vectors. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs index 10b52cf..3ed2562 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs | |||
@@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
213 | [Test] | 213 | [Test] |
214 | public void TestConstructFromInt() | 214 | public void TestConstructFromInt() |
215 | { | 215 | { |
216 | TestHelpers.InMethod(); | ||
217 | |||
216 | LSL_Types.LSLFloat testFloat; | 218 | LSL_Types.LSLFloat testFloat; |
217 | 219 | ||
218 | foreach (KeyValuePair<int, double> number in m_intDoubleSet) | 220 | foreach (KeyValuePair<int, double> number in m_intDoubleSet) |
@@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
228 | [Test] | 230 | [Test] |
229 | public void TestConstructFromDouble() | 231 | public void TestConstructFromDouble() |
230 | { | 232 | { |
233 | TestHelpers.InMethod(); | ||
234 | |||
231 | LSL_Types.LSLFloat testFloat; | 235 | LSL_Types.LSLFloat testFloat; |
232 | 236 | ||
233 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 237 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
243 | [Test] | 247 | [Test] |
244 | public void TestExplicitCastLSLFloatToInt() | 248 | public void TestExplicitCastLSLFloatToInt() |
245 | { | 249 | { |
250 | TestHelpers.InMethod(); | ||
251 | |||
246 | int testNumber; | 252 | int testNumber; |
247 | 253 | ||
248 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) | 254 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) |
@@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
258 | [Test] | 264 | [Test] |
259 | public void TestExplicitCastLSLFloatToUint() | 265 | public void TestExplicitCastLSLFloatToUint() |
260 | { | 266 | { |
267 | TestHelpers.InMethod(); | ||
268 | |||
261 | uint testNumber; | 269 | uint testNumber; |
262 | 270 | ||
263 | foreach (KeyValuePair<double, int> number in m_doubleUintSet) | 271 | foreach (KeyValuePair<double, int> number in m_doubleUintSet) |
@@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
273 | [Test] | 281 | [Test] |
274 | public void TestImplicitCastLSLFloatToBooleanTrue() | 282 | public void TestImplicitCastLSLFloatToBooleanTrue() |
275 | { | 283 | { |
284 | TestHelpers.InMethod(); | ||
285 | |||
276 | LSL_Types.LSLFloat testFloat; | 286 | LSL_Types.LSLFloat testFloat; |
277 | bool testBool; | 287 | bool testBool; |
278 | 288 | ||
@@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
291 | [Test] | 301 | [Test] |
292 | public void TestImplicitCastLSLFloatToBooleanFalse() | 302 | public void TestImplicitCastLSLFloatToBooleanFalse() |
293 | { | 303 | { |
304 | TestHelpers.InMethod(); | ||
305 | |||
294 | LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); | 306 | LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); |
295 | bool testBool = testFloat; | 307 | bool testBool = testFloat; |
296 | 308 | ||
@@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
303 | [Test] | 315 | [Test] |
304 | public void TestImplicitCastIntToLSLFloat() | 316 | public void TestImplicitCastIntToLSLFloat() |
305 | { | 317 | { |
318 | TestHelpers.InMethod(); | ||
319 | |||
306 | LSL_Types.LSLFloat testFloat; | 320 | LSL_Types.LSLFloat testFloat; |
307 | 321 | ||
308 | foreach (int number in m_intList) | 322 | foreach (int number in m_intList) |
@@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
318 | [Test] | 332 | [Test] |
319 | public void TestImplicitCastLSLIntegerToLSLFloat() | 333 | public void TestImplicitCastLSLIntegerToLSLFloat() |
320 | { | 334 | { |
335 | TestHelpers.InMethod(); | ||
336 | |||
321 | LSL_Types.LSLFloat testFloat; | 337 | LSL_Types.LSLFloat testFloat; |
322 | 338 | ||
323 | foreach (int number in m_intList) | 339 | foreach (int number in m_intList) |
@@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
333 | [Test] | 349 | [Test] |
334 | public void TestExplicitCastLSLIntegerToLSLFloat() | 350 | public void TestExplicitCastLSLIntegerToLSLFloat() |
335 | { | 351 | { |
352 | TestHelpers.InMethod(); | ||
353 | |||
336 | LSL_Types.LSLFloat testFloat; | 354 | LSL_Types.LSLFloat testFloat; |
337 | 355 | ||
338 | foreach (int number in m_intList) | 356 | foreach (int number in m_intList) |
@@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
348 | [Test] | 366 | [Test] |
349 | public void TestExplicitCastStringToLSLFloat() | 367 | public void TestExplicitCastStringToLSLFloat() |
350 | { | 368 | { |
369 | TestHelpers.InMethod(); | ||
370 | |||
351 | LSL_Types.LSLFloat testFloat; | 371 | LSL_Types.LSLFloat testFloat; |
352 | 372 | ||
353 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) | 373 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) |
@@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
363 | [Test] | 383 | [Test] |
364 | public void TestExplicitCastLSLStringToLSLFloat() | 384 | public void TestExplicitCastLSLStringToLSLFloat() |
365 | { | 385 | { |
386 | TestHelpers.InMethod(); | ||
387 | |||
366 | LSL_Types.LSLFloat testFloat; | 388 | LSL_Types.LSLFloat testFloat; |
367 | 389 | ||
368 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) | 390 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) |
@@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
378 | [Test] | 400 | [Test] |
379 | public void TestImplicitCastDoubleToLSLFloat() | 401 | public void TestImplicitCastDoubleToLSLFloat() |
380 | { | 402 | { |
403 | TestHelpers.InMethod(); | ||
404 | |||
381 | LSL_Types.LSLFloat testFloat; | 405 | LSL_Types.LSLFloat testFloat; |
382 | 406 | ||
383 | foreach (double number in m_doubleList) | 407 | foreach (double number in m_doubleList) |
@@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
393 | [Test] | 417 | [Test] |
394 | public void TestImplicitCastLSLFloatToDouble() | 418 | public void TestImplicitCastLSLFloatToDouble() |
395 | { | 419 | { |
420 | TestHelpers.InMethod(); | ||
421 | |||
396 | double testNumber; | 422 | double testNumber; |
397 | LSL_Types.LSLFloat testFloat; | 423 | LSL_Types.LSLFloat testFloat; |
398 | 424 | ||
@@ -411,19 +437,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
411 | [Test] | 437 | [Test] |
412 | public void TestExplicitCastLSLFloatToFloat() | 438 | public void TestExplicitCastLSLFloatToFloat() |
413 | { | 439 | { |
414 | float testFloat; | 440 | TestHelpers.InMethod(); |
415 | float numberAsFloat; | 441 | |
416 | LSL_Types.LSLFloat testLSLFloat; | 442 | float testFloat; |
417 | foreach (double number in m_doubleList) | 443 | float numberAsFloat; |
418 | { | 444 | LSL_Types.LSLFloat testLSLFloat; |
419 | testLSLFloat = new LSL_Types.LSLFloat(number); | ||
420 | numberAsFloat = (float)number; | ||
421 | testFloat = (float)testLSLFloat; | ||
422 | |||
423 | Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); | ||
424 | } | ||
425 | } | ||
426 | 445 | ||
446 | foreach (double number in m_doubleList) | ||
447 | { | ||
448 | testLSLFloat = new LSL_Types.LSLFloat(number); | ||
449 | numberAsFloat = (float)number; | ||
450 | testFloat = (float)testLSLFloat; | ||
451 | |||
452 | Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); | ||
453 | } | ||
454 | } | ||
427 | 455 | ||
428 | /// <summary> | 456 | /// <summary> |
429 | /// Tests the equality (==) operator. | 457 | /// Tests the equality (==) operator. |
@@ -431,6 +459,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
431 | [Test] | 459 | [Test] |
432 | public void TestEqualsOperator() | 460 | public void TestEqualsOperator() |
433 | { | 461 | { |
462 | TestHelpers.InMethod(); | ||
463 | |||
434 | LSL_Types.LSLFloat testFloatA, testFloatB; | 464 | LSL_Types.LSLFloat testFloatA, testFloatB; |
435 | 465 | ||
436 | foreach (double number in m_doubleList) | 466 | foreach (double number in m_doubleList) |
@@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
450 | [Test] | 480 | [Test] |
451 | public void TestNotEqualOperator() | 481 | public void TestNotEqualOperator() |
452 | { | 482 | { |
483 | TestHelpers.InMethod(); | ||
484 | |||
453 | LSL_Types.LSLFloat testFloatA, testFloatB; | 485 | LSL_Types.LSLFloat testFloatA, testFloatB; |
454 | 486 | ||
455 | foreach (double number in m_doubleList) | 487 | foreach (double number in m_doubleList) |
@@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
469 | [Test] | 501 | [Test] |
470 | public void TestIncrementOperator() | 502 | public void TestIncrementOperator() |
471 | { | 503 | { |
504 | TestHelpers.InMethod(); | ||
505 | |||
472 | LSL_Types.LSLFloat testFloat; | 506 | LSL_Types.LSLFloat testFloat; |
473 | double testNumber; | 507 | double testNumber; |
474 | 508 | ||
@@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
493 | [Test] | 527 | [Test] |
494 | public void TestDecrementOperator() | 528 | public void TestDecrementOperator() |
495 | { | 529 | { |
530 | TestHelpers.InMethod(); | ||
531 | |||
496 | LSL_Types.LSLFloat testFloat; | 532 | LSL_Types.LSLFloat testFloat; |
497 | double testNumber; | 533 | double testNumber; |
498 | 534 | ||
@@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
517 | [Test] | 553 | [Test] |
518 | public void TestToString() | 554 | public void TestToString() |
519 | { | 555 | { |
556 | TestHelpers.InMethod(); | ||
557 | |||
520 | LSL_Types.LSLFloat testFloat; | 558 | LSL_Types.LSLFloat testFloat; |
521 | 559 | ||
522 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) | 560 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) |
@@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
532 | [Test] | 570 | [Test] |
533 | public void TestAddTwoLSLFloats() | 571 | public void TestAddTwoLSLFloats() |
534 | { | 572 | { |
573 | TestHelpers.InMethod(); | ||
574 | |||
535 | LSL_Types.LSLFloat testResult; | 575 | LSL_Types.LSLFloat testResult; |
536 | 576 | ||
537 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 577 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
547 | [Test] | 587 | [Test] |
548 | public void TestSubtractTwoLSLFloats() | 588 | public void TestSubtractTwoLSLFloats() |
549 | { | 589 | { |
590 | TestHelpers.InMethod(); | ||
591 | |||
550 | LSL_Types.LSLFloat testResult; | 592 | LSL_Types.LSLFloat testResult; |
551 | 593 | ||
552 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 594 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
562 | [Test] | 604 | [Test] |
563 | public void TestMultiplyTwoLSLFloats() | 605 | public void TestMultiplyTwoLSLFloats() |
564 | { | 606 | { |
607 | TestHelpers.InMethod(); | ||
608 | |||
565 | LSL_Types.LSLFloat testResult; | 609 | LSL_Types.LSLFloat testResult; |
566 | 610 | ||
567 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 611 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
577 | [Test] | 621 | [Test] |
578 | public void TestDivideTwoLSLFloats() | 622 | public void TestDivideTwoLSLFloats() |
579 | { | 623 | { |
624 | TestHelpers.InMethod(); | ||
625 | |||
580 | LSL_Types.LSLFloat testResult; | 626 | LSL_Types.LSLFloat testResult; |
581 | 627 | ||
582 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 628 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
595 | [Test] | 641 | [Test] |
596 | public void TestImplicitCastBooleanToLSLFloat() | 642 | public void TestImplicitCastBooleanToLSLFloat() |
597 | { | 643 | { |
644 | TestHelpers.InMethod(); | ||
645 | |||
598 | LSL_Types.LSLFloat testFloat; | 646 | LSL_Types.LSLFloat testFloat; |
599 | 647 | ||
600 | testFloat = (1 == 0); | 648 | testFloat = (1 == 0); |
@@ -610,4 +658,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
610 | Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); | 658 | Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); |
611 | } | 659 | } |
612 | } | 660 | } |
613 | } | 661 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs index 3ad673b..8d1169a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs | |||
@@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
79 | [Test] | 79 | [Test] |
80 | public void TestExplicitCastLSLFloatToLSLInteger() | 80 | public void TestExplicitCastLSLFloatToLSLInteger() |
81 | { | 81 | { |
82 | TestHelpers.InMethod(); | ||
83 | |||
82 | LSL_Types.LSLInteger testInteger; | 84 | LSL_Types.LSLInteger testInteger; |
83 | 85 | ||
84 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) | 86 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) |
@@ -94,6 +96,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
94 | [Test] | 96 | [Test] |
95 | public void TestExplicitCastStringToLSLInteger() | 97 | public void TestExplicitCastStringToLSLInteger() |
96 | { | 98 | { |
99 | TestHelpers.InMethod(); | ||
100 | |||
97 | LSL_Types.LSLInteger testInteger; | 101 | LSL_Types.LSLInteger testInteger; |
98 | 102 | ||
99 | foreach (KeyValuePair<string, int> number in m_stringIntSet) | 103 | foreach (KeyValuePair<string, int> number in m_stringIntSet) |
@@ -109,6 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
109 | [Test] | 113 | [Test] |
110 | public void TestExplicitCastLSLStringToLSLInteger() | 114 | public void TestExplicitCastLSLStringToLSLInteger() |
111 | { | 115 | { |
116 | TestHelpers.InMethod(); | ||
117 | |||
112 | LSL_Types.LSLInteger testInteger; | 118 | LSL_Types.LSLInteger testInteger; |
113 | 119 | ||
114 | foreach (KeyValuePair<string, int> number in m_stringIntSet) | 120 | foreach (KeyValuePair<string, int> number in m_stringIntSet) |
@@ -124,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
124 | [Test] | 130 | [Test] |
125 | public void TestImplicitCastBooleanToLSLInteger() | 131 | public void TestImplicitCastBooleanToLSLInteger() |
126 | { | 132 | { |
133 | TestHelpers.InMethod(); | ||
134 | |||
127 | LSL_Types.LSLInteger testInteger; | 135 | LSL_Types.LSLInteger testInteger; |
128 | 136 | ||
129 | testInteger = (1 == 0); | 137 | testInteger = (1 == 0); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs index fa976ed..c4ca1a8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs | |||
@@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
71 | [Test] | 71 | [Test] |
72 | public void TestConstructFromLSLFloat() | 72 | public void TestConstructFromLSLFloat() |
73 | { | 73 | { |
74 | TestHelpers.InMethod(); | ||
75 | |||
74 | LSL_Types.LSLString testString; | 76 | LSL_Types.LSLString testString; |
75 | 77 | ||
76 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) | 78 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) |
@@ -86,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
86 | [Test] | 88 | [Test] |
87 | public void TestExplicitCastLSLFloatToLSLString() | 89 | public void TestExplicitCastLSLFloatToLSLString() |
88 | { | 90 | { |
91 | TestHelpers.InMethod(); | ||
92 | |||
89 | LSL_Types.LSLString testString; | 93 | LSL_Types.LSLString testString; |
90 | 94 | ||
91 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) | 95 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) |
@@ -101,6 +105,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
101 | [Test] | 105 | [Test] |
102 | public void TestExplicitCastLSLStringToQuaternion() | 106 | public void TestExplicitCastLSLStringToQuaternion() |
103 | { | 107 | { |
108 | TestHelpers.InMethod(); | ||
109 | |||
104 | string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>"; | 110 | string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>"; |
105 | LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString); | 111 | LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString); |
106 | 112 | ||
@@ -118,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
118 | [Test] | 124 | [Test] |
119 | public void TestImplicitCastBooleanToLSLFloat() | 125 | public void TestImplicitCastBooleanToLSLFloat() |
120 | { | 126 | { |
127 | TestHelpers.InMethod(); | ||
128 | |||
121 | LSL_Types.LSLString testString; | 129 | LSL_Types.LSLString testString; |
122 | 130 | ||
123 | testString = (LSL_Types.LSLString) (1 == 0); | 131 | testString = (LSL_Types.LSLString) (1 == 0); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs index 66a7329..b81225f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs | |||
@@ -44,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
44 | [Test] | 44 | [Test] |
45 | public void TestConcatenateString() | 45 | public void TestConcatenateString() |
46 | { | 46 | { |
47 | TestHelpers.InMethod(); | ||
48 | |||
47 | LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); | 49 | LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); |
48 | testList += new LSL_Types.LSLString("addition"); | 50 | testList += new LSL_Types.LSLString("addition"); |
49 | 51 | ||
@@ -64,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
64 | [Test] | 66 | [Test] |
65 | public void TestConcatenateInteger() | 67 | public void TestConcatenateInteger() |
66 | { | 68 | { |
69 | TestHelpers.InMethod(); | ||
70 | |||
67 | LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); | 71 | LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); |
68 | testList += new LSL_Types.LSLInteger(20); | 72 | testList += new LSL_Types.LSLInteger(20); |
69 | 73 | ||
@@ -84,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
84 | [Test] | 88 | [Test] |
85 | public void TestConcatenateDouble() | 89 | public void TestConcatenateDouble() |
86 | { | 90 | { |
91 | TestHelpers.InMethod(); | ||
92 | |||
87 | LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); | 93 | LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); |
88 | testList += new LSL_Types.LSLFloat(2.0f); | 94 | testList += new LSL_Types.LSLFloat(2.0f); |
89 | 95 | ||
@@ -104,6 +110,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
104 | [Test] | 110 | [Test] |
105 | public void TestCastLSLIntegerItemToLSLInteger() | 111 | public void TestCastLSLIntegerItemToLSLInteger() |
106 | { | 112 | { |
113 | TestHelpers.InMethod(); | ||
114 | |||
107 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123); | 115 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123); |
108 | LSL_Types.list testList = new LSL_Types.list(testValue); | 116 | LSL_Types.list testList = new LSL_Types.list(testValue); |
109 | 117 | ||
@@ -116,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
116 | [Test] | 124 | [Test] |
117 | public void TestCastLSLFloatItemToLSLFloat() | 125 | public void TestCastLSLFloatItemToLSLFloat() |
118 | { | 126 | { |
127 | TestHelpers.InMethod(); | ||
128 | |||
119 | LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987); | 129 | LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987); |
120 | LSL_Types.list testList = new LSL_Types.list(testValue); | 130 | LSL_Types.list testList = new LSL_Types.list(testValue); |
121 | 131 | ||
@@ -128,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
128 | [Test] | 138 | [Test] |
129 | public void TestCastLSLStringItemToLSLString() | 139 | public void TestCastLSLStringItemToLSLString() |
130 | { | 140 | { |
141 | TestHelpers.InMethod(); | ||
142 | |||
131 | LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there"); | 143 | LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there"); |
132 | LSL_Types.list testList = new LSL_Types.list(testValue); | 144 | LSL_Types.list testList = new LSL_Types.list(testValue); |
133 | 145 | ||
@@ -140,6 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
140 | [Test] | 152 | [Test] |
141 | public void TestCastVector3ItemToVector3() | 153 | public void TestCastVector3ItemToVector3() |
142 | { | 154 | { |
155 | TestHelpers.InMethod(); | ||
156 | |||
143 | LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987); | 157 | LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987); |
144 | LSL_Types.list testList = new LSL_Types.list(testValue); | 158 | LSL_Types.list testList = new LSL_Types.list(testValue); |
145 | 159 | ||
@@ -151,6 +165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
151 | [Test] | 165 | [Test] |
152 | public void TestCastQuaternionItemToQuaternion() | 166 | public void TestCastQuaternionItemToQuaternion() |
153 | { | 167 | { |
168 | TestHelpers.InMethod(); | ||
169 | |||
154 | LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987); | 170 | LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987); |
155 | LSL_Types.list testList = new LSL_Types.list(testValue); | 171 | LSL_Types.list testList = new LSL_Types.list(testValue); |
156 | 172 | ||
@@ -165,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
165 | [Test] | 181 | [Test] |
166 | public void TestGetLSLIntegerItemForLSLIntegerItem() | 182 | public void TestGetLSLIntegerItemForLSLIntegerItem() |
167 | { | 183 | { |
184 | TestHelpers.InMethod(); | ||
185 | |||
168 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911); | 186 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911); |
169 | LSL_Types.list testList = new LSL_Types.list(testValue); | 187 | LSL_Types.list testList = new LSL_Types.list(testValue); |
170 | 188 | ||
@@ -177,6 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
177 | [Test] | 195 | [Test] |
178 | public void TestGetLSLFloatItemForLSLFloatItem() | 196 | public void TestGetLSLFloatItemForLSLFloatItem() |
179 | { | 197 | { |
198 | TestHelpers.InMethod(); | ||
199 | |||
180 | LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876); | 200 | LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876); |
181 | LSL_Types.list testList = new LSL_Types.list(testValue); | 201 | LSL_Types.list testList = new LSL_Types.list(testValue); |
182 | 202 | ||
@@ -189,11 +209,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
189 | [Test] | 209 | [Test] |
190 | public void TestGetLSLFloatItemForLSLIntegerItem() | 210 | public void TestGetLSLFloatItemForLSLIntegerItem() |
191 | { | 211 | { |
192 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); | 212 | TestHelpers.InMethod(); |
193 | LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); | 213 | |
194 | LSL_Types.list testList = new LSL_Types.list(testValue); | 214 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); |
215 | LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); | ||
216 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
195 | 217 | ||
196 | Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); | 218 | Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); |
197 | } | 219 | } |
198 | 220 | ||
199 | /// <summary> | 221 | /// <summary> |
@@ -202,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
202 | [Test] | 224 | [Test] |
203 | public void TestGetLSLStringItemForLSLStringItem() | 225 | public void TestGetLSLStringItemForLSLStringItem() |
204 | { | 226 | { |
227 | TestHelpers.InMethod(); | ||
228 | |||
205 | LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all"); | 229 | LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all"); |
206 | LSL_Types.list testList = new LSL_Types.list(testValue); | 230 | LSL_Types.list testList = new LSL_Types.list(testValue); |
207 | 231 | ||
@@ -214,6 +238,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
214 | [Test] | 238 | [Test] |
215 | public void TestGetLSLStringItemForKeyItem() | 239 | public void TestGetLSLStringItemForKeyItem() |
216 | { | 240 | { |
241 | TestHelpers.InMethod(); | ||
242 | |||
217 | LSL_Types.key testValue | 243 | LSL_Types.key testValue |
218 | = new LSL_Types.key("98000000-0000-2222-3333-100000001000"); | 244 | = new LSL_Types.key("98000000-0000-2222-3333-100000001000"); |
219 | LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue); | 245 | LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue); |
@@ -228,6 +254,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
228 | [Test] | 254 | [Test] |
229 | public void TestGetVector3ItemForVector3Item() | 255 | public void TestGetVector3ItemForVector3Item() |
230 | { | 256 | { |
257 | TestHelpers.InMethod(); | ||
258 | |||
231 | LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987); | 259 | LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987); |
232 | LSL_Types.list testList = new LSL_Types.list(testValue); | 260 | LSL_Types.list testList = new LSL_Types.list(testValue); |
233 | 261 | ||
@@ -239,6 +267,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
239 | [Test] | 267 | [Test] |
240 | public void TestGetQuaternionItemForQuaternionItem() | 268 | public void TestGetQuaternionItemForQuaternionItem() |
241 | { | 269 | { |
270 | TestHelpers.InMethod(); | ||
271 | |||
242 | LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); | 272 | LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); |
243 | LSL_Types.list testList = new LSL_Types.list(testValue); | 273 | LSL_Types.list testList = new LSL_Types.list(testValue); |
244 | 274 | ||
@@ -251,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
251 | [Test] | 281 | [Test] |
252 | public void TestGetKeyItemForKeyItem() | 282 | public void TestGetKeyItemForKeyItem() |
253 | { | 283 | { |
284 | TestHelpers.InMethod(); | ||
285 | |||
254 | LSL_Types.key testValue | 286 | LSL_Types.key testValue |
255 | = new LSL_Types.key("00000000-0000-2222-3333-100000001012"); | 287 | = new LSL_Types.key("00000000-0000-2222-3333-100000001012"); |
256 | LSL_Types.list testList = new LSL_Types.list(testValue); | 288 | LSL_Types.list testList = new LSL_Types.list(testValue); |
@@ -258,4 +290,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
258 | Assert.AreEqual(testValue, testList.GetKeyItem(0)); | 290 | Assert.AreEqual(testValue, testList.GetKeyItem(0)); |
259 | } | 291 | } |
260 | } | 292 | } |
261 | } | 293 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs index 195af7f..ebf8001 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs | |||
@@ -32,16 +32,17 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | 33 | namespace OpenSim.Region.ScriptEngine.Shared.Tests |
34 | { | 34 | { |
35 | /// <summary> | ||
36 | /// Tests for Vector3 | ||
37 | /// </summary> | ||
35 | [TestFixture] | 38 | [TestFixture] |
36 | public class LSL_TypesTestVector3 | 39 | public class LSL_TypesTestVector3 |
37 | { | 40 | { |
38 | /// <summary> | ||
39 | /// Tests for Vector3 | ||
40 | /// </summary> | ||
41 | [Test] | 41 | [Test] |
42 | |||
43 | public void TestDotProduct() | 42 | public void TestDotProduct() |
44 | { | 43 | { |
44 | TestHelpers.InMethod(); | ||
45 | |||
45 | // The numbers we test for. | 46 | // The numbers we test for. |
46 | Dictionary<string, double> expectsSet = new Dictionary<string, double>(); | 47 | Dictionary<string, double> expectsSet = new Dictionary<string, double>(); |
47 | expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0); | 48 | expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0); |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 02d47bd..db6a407 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -50,7 +50,10 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
50 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 50 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
51 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 51 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
52 | using OpenSim.Region.ScriptEngine.Shared.Instance; | 52 | using OpenSim.Region.ScriptEngine.Shared.Instance; |
53 | using OpenSim.Region.ScriptEngine.Shared.Api; | ||
54 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | ||
53 | using OpenSim.Region.ScriptEngine.Interfaces; | 55 | using OpenSim.Region.ScriptEngine.Interfaces; |
56 | using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; | ||
54 | 57 | ||
55 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; | 58 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; |
56 | 59 | ||
@@ -342,22 +345,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
342 | } | 345 | } |
343 | 346 | ||
344 | MainConsole.Instance.Commands.AddCommand( | 347 | MainConsole.Instance.Commands.AddCommand( |
345 | "scripts", false, "xengine status", "xengine status", "Show status information", | 348 | "Scripts", false, "xengine status", "xengine status", "Show status information", |
346 | "Show status information on the script engine.", | 349 | "Show status information on the script engine.", |
347 | HandleShowStatus); | 350 | HandleShowStatus); |
348 | 351 | ||
349 | MainConsole.Instance.Commands.AddCommand( | 352 | MainConsole.Instance.Commands.AddCommand( |
350 | "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", | 353 | "Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", |
351 | "Show information on all scripts known to the script engine." | 354 | "Show information on all scripts known to the script engine." |
352 | + "If a <script-item-uuid> is given then only information on that script will be shown.", | 355 | + "If a <script-item-uuid> is given then only information on that script will be shown.", |
353 | HandleShowScripts); | 356 | HandleShowScripts); |
354 | 357 | ||
355 | MainConsole.Instance.Commands.AddCommand( | 358 | MainConsole.Instance.Commands.AddCommand( |
356 | "scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information", | 359 | "Scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information", |
357 | "Synonym for scripts show command", HandleShowScripts); | 360 | "Synonym for scripts show command", HandleShowScripts); |
358 | 361 | ||
359 | MainConsole.Instance.Commands.AddCommand( | 362 | MainConsole.Instance.Commands.AddCommand( |
360 | "scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts", | 363 | "Scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts", |
361 | "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a" | 364 | "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a" |
362 | + " script that is currently processing an event.\n" | 365 | + " script that is currently processing an event.\n" |
363 | + "Suspended scripts will continue to accumulate events but won't process them.\n" | 366 | + "Suspended scripts will continue to accumulate events but won't process them.\n" |
@@ -365,20 +368,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
365 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript)); | 368 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript)); |
366 | 369 | ||
367 | MainConsole.Instance.Commands.AddCommand( | 370 | MainConsole.Instance.Commands.AddCommand( |
368 | "scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts", | 371 | "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts", |
369 | "Resumes all currently suspended scripts.\n" | 372 | "Resumes all currently suspended scripts.\n" |
370 | + "Resumed scripts will process all events accumulated whilst suspended." | 373 | + "Resumed scripts will process all events accumulated whilst suspended." |
371 | + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.", | 374 | + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.", |
372 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript)); | 375 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript)); |
373 | 376 | ||
374 | MainConsole.Instance.Commands.AddCommand( | 377 | MainConsole.Instance.Commands.AddCommand( |
375 | "scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts", | 378 | "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts", |
376 | "Stops all running scripts." | 379 | "Stops all running scripts." |
377 | + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.", | 380 | + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.", |
378 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript)); | 381 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript)); |
379 | 382 | ||
380 | MainConsole.Instance.Commands.AddCommand( | 383 | MainConsole.Instance.Commands.AddCommand( |
381 | "scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts", | 384 | "Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts", |
382 | "Starts all stopped scripts." | 385 | "Starts all stopped scripts." |
383 | + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", | 386 | + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", |
384 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); | 387 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); |
@@ -454,6 +457,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
454 | sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); | 457 | sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); |
455 | // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); | 458 | // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); |
456 | 459 | ||
460 | SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this); | ||
461 | sb.AppendFormat("Sensors : {0}\n", sr.SensorsCount); | ||
462 | |||
463 | Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this); | ||
464 | sb.AppendFormat("Dataserver requests : {0}\n", ds.DataserverRequestsCount); | ||
465 | |||
466 | Timer t = AsyncCommandManager.GetTimerPlugin(this); | ||
467 | sb.AppendFormat("Timers : {0}\n", t.TimersCount); | ||
468 | |||
469 | Listener l = AsyncCommandManager.GetListenerPlugin(this); | ||
470 | sb.AppendFormat("Listeners : {0}\n", l.ListenerCount); | ||
471 | |||
457 | MainConsole.Instance.OutputFormat(sb.ToString()); | 472 | MainConsole.Instance.OutputFormat(sb.ToString()); |
458 | } | 473 | } |
459 | 474 | ||