diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
20 files changed, 36 insertions, 2889 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index 44011de..7b0e75a 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs | |||
@@ -31,13 +31,13 @@ using System.Threading; | |||
31 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 32 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
33 | 33 | ||
34 | using LSL_Float = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLFloat; | 34 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
35 | using LSL_Integer = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLInteger; | 35 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; |
36 | using LSL_Key = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString; | 36 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
37 | using LSL_List = OpenSim.Region.ScriptEngine.Common.LSL_Types.list; | 37 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; |
38 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion; | 38 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
39 | using LSL_String = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString; | 39 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
40 | using LSL_Vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; | 40 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
41 | 41 | ||
42 | namespace OpenSim.Region.ScriptEngine.Common | 42 | namespace OpenSim.Region.ScriptEngine.Common |
43 | { | 43 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 1017fd8..bbf8426 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -45,13 +45,13 @@ using OpenSim.Region.Environment.Scenes; | |||
45 | using OpenSim.Region.Physics.Manager; | 45 | using OpenSim.Region.Physics.Manager; |
46 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 46 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
47 | 47 | ||
48 | using LSL_Float = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLFloat; | 48 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
49 | using LSL_Integer = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLInteger; | 49 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; |
50 | using LSL_Key = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString; | 50 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
51 | using LSL_List = OpenSim.Region.ScriptEngine.Common.LSL_Types.list; | 51 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; |
52 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion; | 52 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
53 | using LSL_String = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString; | 53 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
54 | using LSL_Vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; | 54 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
55 | 55 | ||
56 | namespace OpenSim.Region.ScriptEngine.Common | 56 | namespace OpenSim.Region.ScriptEngine.Common |
57 | { | 57 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index fa468bd..e05849d 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -27,13 +27,13 @@ | |||
27 | 27 | ||
28 | using OpenSim.Region.Environment.Interfaces; | 28 | using OpenSim.Region.Environment.Interfaces; |
29 | 29 | ||
30 | using LSL_Float = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLFloat; | 30 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
31 | using LSL_Integer = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLInteger; | 31 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; |
32 | using LSL_Key = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString; | 32 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
33 | using LSL_List = OpenSim.Region.ScriptEngine.Common.LSL_Types.list; | 33 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; |
34 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion; | 34 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; |
35 | using LSL_String = OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString; | 35 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
36 | using LSL_Vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; | 36 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
37 | 37 | ||
38 | namespace OpenSim.Region.ScriptEngine.Common | 38 | namespace OpenSim.Region.ScriptEngine.Common |
39 | { | 39 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs deleted file mode 100644 index 21646ea..0000000 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ /dev/null | |||
@@ -1,1834 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Text.RegularExpressions; | ||
31 | |||
32 | namespace OpenSim.Region.ScriptEngine.Common | ||
33 | { | ||
34 | [Serializable] | ||
35 | public partial class LSL_Types | ||
36 | { | ||
37 | // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain | ||
38 | |||
39 | [Serializable] | ||
40 | public struct Vector3 | ||
41 | { | ||
42 | public double x; | ||
43 | public double y; | ||
44 | public double z; | ||
45 | |||
46 | #region Constructors | ||
47 | |||
48 | public Vector3(Vector3 vector) | ||
49 | { | ||
50 | x = (float)vector.x; | ||
51 | y = (float)vector.y; | ||
52 | z = (float)vector.z; | ||
53 | } | ||
54 | |||
55 | public Vector3(double X, double Y, double Z) | ||
56 | { | ||
57 | x = X; | ||
58 | y = Y; | ||
59 | z = Z; | ||
60 | } | ||
61 | |||
62 | public Vector3(string str) | ||
63 | { | ||
64 | str = str.Replace('<', ' '); | ||
65 | str = str.Replace('>', ' '); | ||
66 | string[] tmps = str.Split(new Char[] { ',', '<', '>' }); | ||
67 | if (tmps.Length < 3) | ||
68 | { | ||
69 | x=y=z=0; | ||
70 | return; | ||
71 | } | ||
72 | bool res; | ||
73 | res = Double.TryParse(tmps[0], out x); | ||
74 | res = res & Double.TryParse(tmps[1], out y); | ||
75 | res = res & Double.TryParse(tmps[2], out z); | ||
76 | } | ||
77 | |||
78 | #endregion | ||
79 | |||
80 | #region Overriders | ||
81 | |||
82 | public override string ToString() | ||
83 | { | ||
84 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z); | ||
85 | return s; | ||
86 | } | ||
87 | |||
88 | public static explicit operator LSLString(Vector3 vec) | ||
89 | { | ||
90 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); | ||
91 | return new LSLString(s); | ||
92 | } | ||
93 | |||
94 | public static explicit operator string(Vector3 vec) | ||
95 | { | ||
96 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); | ||
97 | return s; | ||
98 | } | ||
99 | |||
100 | public static explicit operator Vector3(string s) | ||
101 | { | ||
102 | return new Vector3(s); | ||
103 | } | ||
104 | |||
105 | public static bool operator ==(Vector3 lhs, Vector3 rhs) | ||
106 | { | ||
107 | return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z); | ||
108 | } | ||
109 | |||
110 | public static bool operator !=(Vector3 lhs, Vector3 rhs) | ||
111 | { | ||
112 | return !(lhs == rhs); | ||
113 | } | ||
114 | |||
115 | public override int GetHashCode() | ||
116 | { | ||
117 | return (x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode()); | ||
118 | } | ||
119 | |||
120 | public override bool Equals(object o) | ||
121 | { | ||
122 | if (!(o is Vector3)) return false; | ||
123 | |||
124 | Vector3 vector = (Vector3)o; | ||
125 | |||
126 | return (x == vector.x && y == vector.y && z == vector.z); | ||
127 | } | ||
128 | |||
129 | public static Vector3 operator -(Vector3 vector) | ||
130 | { | ||
131 | return new Vector3(-vector.x, -vector.y, -vector.z); | ||
132 | } | ||
133 | |||
134 | #endregion | ||
135 | |||
136 | #region Vector & Vector Math | ||
137 | |||
138 | // Vector-Vector Math | ||
139 | public static Vector3 operator +(Vector3 lhs, Vector3 rhs) | ||
140 | { | ||
141 | return new Vector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z); | ||
142 | } | ||
143 | |||
144 | public static Vector3 operator -(Vector3 lhs, Vector3 rhs) | ||
145 | { | ||
146 | return new Vector3(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); | ||
147 | } | ||
148 | |||
149 | public static LSLFloat operator *(Vector3 lhs, Vector3 rhs) | ||
150 | { | ||
151 | return Dot(lhs, rhs); | ||
152 | } | ||
153 | |||
154 | public static Vector3 operator %(Vector3 v1, Vector3 v2) | ||
155 | { | ||
156 | //Cross product | ||
157 | Vector3 tv; | ||
158 | tv.x = (v1.y * v2.z) - (v1.z * v2.y); | ||
159 | tv.y = (v1.z * v2.x) - (v1.x * v2.z); | ||
160 | tv.z = (v1.x * v2.y) - (v1.y * v2.x); | ||
161 | return tv; | ||
162 | } | ||
163 | |||
164 | #endregion | ||
165 | |||
166 | #region Vector & Float Math | ||
167 | |||
168 | // Vector-Float and Float-Vector Math | ||
169 | public static Vector3 operator *(Vector3 vec, float val) | ||
170 | { | ||
171 | return new Vector3(vec.x * val, vec.y * val, vec.z * val); | ||
172 | } | ||
173 | |||
174 | public static Vector3 operator *(float val, Vector3 vec) | ||
175 | { | ||
176 | return new Vector3(vec.x * val, vec.y * val, vec.z * val); | ||
177 | } | ||
178 | |||
179 | public static Vector3 operator /(Vector3 v, float f) | ||
180 | { | ||
181 | v.x = v.x / f; | ||
182 | v.y = v.y / f; | ||
183 | v.z = v.z / f; | ||
184 | return v; | ||
185 | } | ||
186 | |||
187 | #endregion | ||
188 | |||
189 | #region Vector & Double Math | ||
190 | |||
191 | public static Vector3 operator *(Vector3 vec, double val) | ||
192 | { | ||
193 | return new Vector3(vec.x * val, vec.y * val, vec.z * val); | ||
194 | } | ||
195 | |||
196 | public static Vector3 operator *(double val, Vector3 vec) | ||
197 | { | ||
198 | return new Vector3(vec.x * val, vec.y * val, vec.z * val); | ||
199 | } | ||
200 | |||
201 | public static Vector3 operator /(Vector3 v, double f) | ||
202 | { | ||
203 | v.x = v.x / f; | ||
204 | v.y = v.y / f; | ||
205 | v.z = v.z / f; | ||
206 | return v; | ||
207 | } | ||
208 | |||
209 | #endregion | ||
210 | |||
211 | #region Vector & Rotation Math | ||
212 | |||
213 | // Vector-Rotation Math | ||
214 | public static Vector3 operator *(Vector3 v, Quaternion r) | ||
215 | { | ||
216 | Quaternion vq = new Quaternion(v.x, v.y, v.z, 0); | ||
217 | Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s); | ||
218 | |||
219 | // adapted for operator * computing "b * a" | ||
220 | Quaternion result = nq * (vq * r); | ||
221 | |||
222 | return new Vector3(result.x, result.y, result.z); | ||
223 | } | ||
224 | |||
225 | public static Vector3 operator /(Vector3 v, Quaternion r) | ||
226 | { | ||
227 | r.s = -r.s; | ||
228 | return v * r; | ||
229 | } | ||
230 | |||
231 | #endregion | ||
232 | |||
233 | #region Static Helper Functions | ||
234 | |||
235 | public static double Dot(Vector3 v1, Vector3 v2) | ||
236 | { | ||
237 | return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z); | ||
238 | } | ||
239 | |||
240 | public static Vector3 Cross(Vector3 v1, Vector3 v2) | ||
241 | { | ||
242 | return new Vector3 | ||
243 | ( | ||
244 | v1.y * v2.z - v1.z * v2.y, | ||
245 | v1.z * v2.x - v1.x * v2.z, | ||
246 | v1.x * v2.y - v1.y * v2.x | ||
247 | ); | ||
248 | } | ||
249 | |||
250 | public static double Mag(Vector3 v) | ||
251 | { | ||
252 | return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); | ||
253 | } | ||
254 | |||
255 | public static Vector3 Norm(Vector3 vector) | ||
256 | { | ||
257 | double mag = Mag(vector); | ||
258 | return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); | ||
259 | } | ||
260 | |||
261 | #endregion | ||
262 | } | ||
263 | |||
264 | [Serializable] | ||
265 | public struct Quaternion | ||
266 | { | ||
267 | public double x; | ||
268 | public double y; | ||
269 | public double z; | ||
270 | public double s; | ||
271 | |||
272 | #region Constructors | ||
273 | |||
274 | public Quaternion(Quaternion Quat) | ||
275 | { | ||
276 | x = (float)Quat.x; | ||
277 | y = (float)Quat.y; | ||
278 | z = (float)Quat.z; | ||
279 | s = (float)Quat.s; | ||
280 | if (x == 0 && y == 0 && z == 0 && s == 0) | ||
281 | s = 1; | ||
282 | } | ||
283 | |||
284 | public Quaternion(double X, double Y, double Z, double S) | ||
285 | { | ||
286 | x = X; | ||
287 | y = Y; | ||
288 | z = Z; | ||
289 | s = S; | ||
290 | if (x == 0 && y == 0 && z == 0 && s == 0) | ||
291 | s = 1; | ||
292 | } | ||
293 | |||
294 | public Quaternion(string str) | ||
295 | { | ||
296 | str = str.Replace('<', ' '); | ||
297 | str = str.Replace('>', ' '); | ||
298 | string[] tmps = str.Split(new Char[] { ',', '<', '>' }); | ||
299 | if (tmps.Length < 4) | ||
300 | { | ||
301 | x=y=z=s=0; | ||
302 | return; | ||
303 | } | ||
304 | bool res; | ||
305 | res = Double.TryParse(tmps[0], out x); | ||
306 | res = res & Double.TryParse(tmps[1], out y); | ||
307 | res = res & Double.TryParse(tmps[2], out z); | ||
308 | res = res & Double.TryParse(tmps[3], out s); | ||
309 | if (x == 0 && y == 0 && z == 0 && s == 0) | ||
310 | s = 1; | ||
311 | } | ||
312 | |||
313 | #endregion | ||
314 | |||
315 | #region Overriders | ||
316 | |||
317 | public override int GetHashCode() | ||
318 | { | ||
319 | return (x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode() ^ s.GetHashCode()); | ||
320 | } | ||
321 | |||
322 | public override bool Equals(object o) | ||
323 | { | ||
324 | if (!(o is Quaternion)) return false; | ||
325 | |||
326 | Quaternion quaternion = (Quaternion)o; | ||
327 | |||
328 | return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s; | ||
329 | } | ||
330 | |||
331 | public override string ToString() | ||
332 | { | ||
333 | string st=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s); | ||
334 | return st; | ||
335 | } | ||
336 | |||
337 | public static explicit operator string(Quaternion r) | ||
338 | { | ||
339 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s); | ||
340 | return s; | ||
341 | } | ||
342 | |||
343 | public static explicit operator LSLString(Quaternion r) | ||
344 | { | ||
345 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s); | ||
346 | return new LSLString(s); | ||
347 | } | ||
348 | |||
349 | public static explicit operator Quaternion(string s) | ||
350 | { | ||
351 | return new Quaternion(s); | ||
352 | } | ||
353 | |||
354 | public static bool operator ==(Quaternion lhs, Quaternion rhs) | ||
355 | { | ||
356 | // Return true if the fields match: | ||
357 | return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z && lhs.s == rhs.s; | ||
358 | } | ||
359 | |||
360 | public static bool operator !=(Quaternion lhs, Quaternion rhs) | ||
361 | { | ||
362 | return !(lhs == rhs); | ||
363 | } | ||
364 | |||
365 | #endregion | ||
366 | |||
367 | public static Quaternion operator +(Quaternion a, Quaternion b) | ||
368 | { | ||
369 | return new Quaternion(a.x + b.x, a.y + b.y, a.z + b.z, a.s + b.s); | ||
370 | } | ||
371 | |||
372 | public static Quaternion operator /(Quaternion a, Quaternion b) | ||
373 | { | ||
374 | b.s = -b.s; | ||
375 | return a * b; | ||
376 | } | ||
377 | |||
378 | public static Quaternion operator -(Quaternion a, Quaternion b) | ||
379 | { | ||
380 | return new Quaternion(a.x - b.x, a.y - b.y, a.z - b.z, a.s - b.s); | ||
381 | } | ||
382 | |||
383 | // using the equations below, we need to do "b * a" to be compatible with LSL | ||
384 | public static Quaternion operator *(Quaternion b, Quaternion a) | ||
385 | { | ||
386 | Quaternion c; | ||
387 | c.x = a.s * b.x + a.x * b.s + a.y * b.z - a.z * b.y; | ||
388 | c.y = a.s * b.y + a.y * b.s + a.z * b.x - a.x * b.z; | ||
389 | c.z = a.s * b.z + a.z * b.s + a.x * b.y - a.y * b.x; | ||
390 | c.s = a.s * b.s - a.x * b.x - a.y * b.y - a.z * b.z; | ||
391 | return c; | ||
392 | } | ||
393 | } | ||
394 | |||
395 | [Serializable] | ||
396 | public class list | ||
397 | { | ||
398 | private object[] m_data; | ||
399 | |||
400 | public list(params object[] args) | ||
401 | { | ||
402 | m_data = new object[args.Length]; | ||
403 | m_data = args; | ||
404 | } | ||
405 | |||
406 | public int Length | ||
407 | { | ||
408 | get { | ||
409 | if (m_data == null) | ||
410 | m_data=new Object[0]; | ||
411 | return m_data.Length; | ||
412 | } | ||
413 | } | ||
414 | |||
415 | public object[] Data | ||
416 | { | ||
417 | get { | ||
418 | if (m_data == null) | ||
419 | m_data=new Object[0]; | ||
420 | return m_data; | ||
421 | } | ||
422 | |||
423 | set {m_data = value; } | ||
424 | } | ||
425 | |||
426 | // Member functions to obtain item as specific types. | ||
427 | // For cases where implicit conversions would apply if items | ||
428 | // were not in a list (e.g. integer to float, but not float | ||
429 | // to integer) functions check for alternate types so as to | ||
430 | // down-cast from Object to the correct type. | ||
431 | // Note: no checks for item index being valid are performed | ||
432 | |||
433 | public LSL_Types.LSLFloat GetLSLFloatItem( int itemIndex ) | ||
434 | { | ||
435 | if (m_data[itemIndex] is LSL_Types.LSLInteger) | ||
436 | { | ||
437 | return (LSL_Types.LSLInteger)m_data[itemIndex]; | ||
438 | } | ||
439 | else if (m_data[itemIndex] is Int32) | ||
440 | { | ||
441 | return new LSL_Types.LSLFloat((int)m_data[itemIndex]); | ||
442 | } | ||
443 | else if (m_data[itemIndex] is float) | ||
444 | { | ||
445 | return new LSL_Types.LSLFloat((float)m_data[itemIndex]); | ||
446 | } | ||
447 | else if (m_data[itemIndex] is Double) | ||
448 | { | ||
449 | return new LSL_Types.LSLFloat((Double)m_data[itemIndex]); | ||
450 | } | ||
451 | else | ||
452 | { | ||
453 | return (LSL_Types.LSLFloat)m_data[itemIndex]; | ||
454 | } | ||
455 | } | ||
456 | |||
457 | public LSL_Types.LSLString GetLSLStringItem(int itemIndex) | ||
458 | { | ||
459 | if (m_data[itemIndex] is LSL_Types.key) | ||
460 | { | ||
461 | return (LSL_Types.key)m_data[itemIndex]; | ||
462 | } | ||
463 | else if (m_data[itemIndex] is String) | ||
464 | { | ||
465 | return new LSL_Types.LSLString((string)m_data[itemIndex]); | ||
466 | } | ||
467 | else | ||
468 | { | ||
469 | return (LSL_Types.LSLString)m_data[itemIndex]; | ||
470 | } | ||
471 | } | ||
472 | |||
473 | public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) | ||
474 | { | ||
475 | if (m_data[itemIndex] is LSL_Types.LSLInteger) | ||
476 | return (LSL_Types.LSLInteger)m_data[itemIndex]; | ||
477 | else if (m_data[itemIndex] is Int32) | ||
478 | return new LSLInteger((int)m_data[itemIndex]); | ||
479 | else | ||
480 | throw new InvalidCastException(); | ||
481 | } | ||
482 | |||
483 | public LSL_Types.Vector3 GetVector3Item(int itemIndex) | ||
484 | { | ||
485 | return (LSL_Types.Vector3)m_data[itemIndex]; | ||
486 | } | ||
487 | |||
488 | public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) | ||
489 | { | ||
490 | return (LSL_Types.Quaternion)m_data[itemIndex]; | ||
491 | } | ||
492 | |||
493 | public LSL_Types.key GetKeyItem(int itemIndex) | ||
494 | { | ||
495 | return (LSL_Types.key)m_data[itemIndex]; | ||
496 | } | ||
497 | |||
498 | public static list operator +(list a, list b) | ||
499 | { | ||
500 | object[] tmp; | ||
501 | tmp = new object[a.Length + b.Length]; | ||
502 | a.Data.CopyTo(tmp, 0); | ||
503 | b.Data.CopyTo(tmp, a.Length); | ||
504 | return new list(tmp); | ||
505 | } | ||
506 | |||
507 | private void ExtendAndAdd(object o) | ||
508 | { | ||
509 | Array.Resize(ref m_data, Length + 1); | ||
510 | m_data.SetValue(o, Length - 1); | ||
511 | } | ||
512 | |||
513 | public static list operator +(list a, LSLString s) | ||
514 | { | ||
515 | a.ExtendAndAdd(s); | ||
516 | return a; | ||
517 | } | ||
518 | |||
519 | public static list operator +(list a, LSLInteger i) | ||
520 | { | ||
521 | a.ExtendAndAdd(i); | ||
522 | return a; | ||
523 | } | ||
524 | |||
525 | public static list operator +(list a, LSLFloat d) | ||
526 | { | ||
527 | a.ExtendAndAdd(d); | ||
528 | return a; | ||
529 | } | ||
530 | |||
531 | public void Add(object o) | ||
532 | { | ||
533 | object[] tmp; | ||
534 | tmp = new object[m_data.Length + 1]; | ||
535 | m_data.CopyTo(tmp, 0); | ||
536 | tmp[m_data.Length] = o; | ||
537 | m_data = tmp; | ||
538 | } | ||
539 | |||
540 | public bool Contains(object o) | ||
541 | { | ||
542 | bool ret = false; | ||
543 | foreach (object i in Data) | ||
544 | { | ||
545 | if (i == o) | ||
546 | { | ||
547 | ret = true; | ||
548 | break; | ||
549 | } | ||
550 | } | ||
551 | return ret; | ||
552 | } | ||
553 | |||
554 | public list DeleteSublist(int start, int end) | ||
555 | { | ||
556 | // Not an easy one | ||
557 | // If start <= end, remove that part | ||
558 | // if either is negative, count from the end of the array | ||
559 | // if the resulting start > end, remove all BUT that part | ||
560 | |||
561 | Object[] ret; | ||
562 | |||
563 | if (start < 0) | ||
564 | start=m_data.Length-start; | ||
565 | |||
566 | if (start < 0) | ||
567 | start=0; | ||
568 | |||
569 | if (end < 0) | ||
570 | end=m_data.Length-end; | ||
571 | if (end < 0) | ||
572 | end=0; | ||
573 | |||
574 | if (start > end) | ||
575 | { | ||
576 | if (end >= m_data.Length) | ||
577 | return new list(new Object[0]); | ||
578 | |||
579 | if (start >= m_data.Length) | ||
580 | start=m_data.Length-1; | ||
581 | |||
582 | return GetSublist(end, start); | ||
583 | } | ||
584 | |||
585 | // start >= 0 && end >= 0 here | ||
586 | if (start >= m_data.Length) | ||
587 | { | ||
588 | ret=new Object[m_data.Length]; | ||
589 | Array.Copy(m_data, 0, ret, 0, m_data.Length); | ||
590 | |||
591 | return new list(ret); | ||
592 | } | ||
593 | |||
594 | if (end >= m_data.Length) | ||
595 | end=m_data.Length-1; | ||
596 | |||
597 | // now, this makes the math easier | ||
598 | int remove=end+1-start; | ||
599 | |||
600 | ret=new Object[m_data.Length-remove]; | ||
601 | if (ret.Length == 0) | ||
602 | return new list(ret); | ||
603 | |||
604 | int src; | ||
605 | int dest=0; | ||
606 | |||
607 | for (src = 0; src < m_data.Length; src++) | ||
608 | { | ||
609 | if (src < start || src > end) | ||
610 | ret[dest++]=m_data[src]; | ||
611 | } | ||
612 | |||
613 | return new list(ret); | ||
614 | } | ||
615 | |||
616 | public list GetSublist(int start, int end) | ||
617 | { | ||
618 | |||
619 | object[] ret; | ||
620 | |||
621 | // Take care of neg start or end's | ||
622 | // NOTE that either index may still be negative after | ||
623 | // adding the length, so we must take additional | ||
624 | // measures to protect against this. Note also that | ||
625 | // after normalisation the negative indices are no | ||
626 | // longer relative to the end of the list. | ||
627 | |||
628 | if (start < 0) | ||
629 | { | ||
630 | start = m_data.Length + start; | ||
631 | } | ||
632 | |||
633 | if (end < 0) | ||
634 | { | ||
635 | end = m_data.Length + end; | ||
636 | } | ||
637 | |||
638 | // The conventional case is start <= end | ||
639 | // NOTE that the case of an empty list is | ||
640 | // dealt with by the initial test. Start | ||
641 | // less than end is taken to be the most | ||
642 | // common case. | ||
643 | |||
644 | if (start <= end) | ||
645 | { | ||
646 | |||
647 | // Start sublist beyond length | ||
648 | // Also deals with start AND end still negative | ||
649 | if (start >= m_data.Length || end < 0) | ||
650 | { | ||
651 | return new list(); | ||
652 | } | ||
653 | |||
654 | // Sublist extends beyond the end of the supplied list | ||
655 | if (end >= m_data.Length) | ||
656 | { | ||
657 | end = m_data.Length - 1; | ||
658 | } | ||
659 | |||
660 | // Sublist still starts before the beginning of the list | ||
661 | if (start < 0) | ||
662 | { | ||
663 | start = 0; | ||
664 | } | ||
665 | |||
666 | ret = new object[end - start + 1]; | ||
667 | |||
668 | Array.Copy(m_data, start, ret, 0, end - start + 1); | ||
669 | |||
670 | return new list(ret); | ||
671 | |||
672 | } | ||
673 | |||
674 | // Deal with the segmented case: 0->end + start->EOL | ||
675 | |||
676 | else | ||
677 | { | ||
678 | |||
679 | list result = null; | ||
680 | |||
681 | // If end is negative, then prefix list is empty | ||
682 | if (end < 0) | ||
683 | { | ||
684 | result = new list(); | ||
685 | // If start is still negative, then the whole of | ||
686 | // the existing list is returned. This case is | ||
687 | // only admitted if end is also still negative. | ||
688 | if (start < 0) | ||
689 | { | ||
690 | return this; | ||
691 | } | ||
692 | |||
693 | } | ||
694 | else | ||
695 | { | ||
696 | result = GetSublist(0,end); | ||
697 | } | ||
698 | |||
699 | // If start is outside of list, then just return | ||
700 | // the prefix, whatever it is. | ||
701 | if (start >= m_data.Length) | ||
702 | { | ||
703 | return result; | ||
704 | } | ||
705 | |||
706 | return result + GetSublist(start, Data.Length); | ||
707 | |||
708 | } | ||
709 | } | ||
710 | |||
711 | private class AlphanumComparatorFast : IComparer | ||
712 | { | ||
713 | public int Compare(object x, object y) | ||
714 | { | ||
715 | string s1 = x as string; | ||
716 | if (s1 == null) | ||
717 | { | ||
718 | return 0; | ||
719 | } | ||
720 | string s2 = y as string; | ||
721 | if (s2 == null) | ||
722 | { | ||
723 | return 0; | ||
724 | } | ||
725 | |||
726 | int len1 = s1.Length; | ||
727 | int len2 = s2.Length; | ||
728 | int marker1 = 0; | ||
729 | int marker2 = 0; | ||
730 | |||
731 | // Walk through two the strings with two markers. | ||
732 | while (marker1 < len1 && marker2 < len2) | ||
733 | { | ||
734 | char ch1 = s1[marker1]; | ||
735 | char ch2 = s2[marker2]; | ||
736 | |||
737 | // Some buffers we can build up characters in for each chunk. | ||
738 | char[] space1 = new char[len1]; | ||
739 | int loc1 = 0; | ||
740 | char[] space2 = new char[len2]; | ||
741 | int loc2 = 0; | ||
742 | |||
743 | // Walk through all following characters that are digits or | ||
744 | // characters in BOTH strings starting at the appropriate marker. | ||
745 | // Collect char arrays. | ||
746 | do | ||
747 | { | ||
748 | space1[loc1++] = ch1; | ||
749 | marker1++; | ||
750 | |||
751 | if (marker1 < len1) | ||
752 | { | ||
753 | ch1 = s1[marker1]; | ||
754 | } | ||
755 | else | ||
756 | { | ||
757 | break; | ||
758 | } | ||
759 | } while (char.IsDigit(ch1) == char.IsDigit(space1[0])); | ||
760 | |||
761 | do | ||
762 | { | ||
763 | space2[loc2++] = ch2; | ||
764 | marker2++; | ||
765 | |||
766 | if (marker2 < len2) | ||
767 | { | ||
768 | ch2 = s2[marker2]; | ||
769 | } | ||
770 | else | ||
771 | { | ||
772 | break; | ||
773 | } | ||
774 | } while (char.IsDigit(ch2) == char.IsDigit(space2[0])); | ||
775 | |||
776 | // If we have collected numbers, compare them numerically. | ||
777 | // Otherwise, if we have strings, compare them alphabetically. | ||
778 | string str1 = new string(space1); | ||
779 | string str2 = new string(space2); | ||
780 | |||
781 | int result; | ||
782 | |||
783 | if (char.IsDigit(space1[0]) && char.IsDigit(space2[0])) | ||
784 | { | ||
785 | int thisNumericChunk = int.Parse(str1); | ||
786 | int thatNumericChunk = int.Parse(str2); | ||
787 | result = thisNumericChunk.CompareTo(thatNumericChunk); | ||
788 | } | ||
789 | else | ||
790 | { | ||
791 | result = str1.CompareTo(str2); | ||
792 | } | ||
793 | |||
794 | if (result != 0) | ||
795 | { | ||
796 | return result; | ||
797 | } | ||
798 | } | ||
799 | return len1 - len2; | ||
800 | } | ||
801 | } | ||
802 | |||
803 | public list Sort(int stride, int ascending) | ||
804 | { | ||
805 | if (Data.Length == 0) | ||
806 | return new list(); // Don't even bother | ||
807 | |||
808 | string[] keys; | ||
809 | |||
810 | if (stride == 1) // The simple case | ||
811 | { | ||
812 | Object[] ret=new Object[Data.Length]; | ||
813 | |||
814 | Array.Copy(Data, 0, ret, 0, Data.Length); | ||
815 | |||
816 | keys=new string[Data.Length]; | ||
817 | |||
818 | for (int k = 0; k < Data.Length; k++) | ||
819 | keys[k] = Data[k].ToString(); | ||
820 | |||
821 | Array.Sort( keys, ret, new AlphanumComparatorFast() ); | ||
822 | |||
823 | if (ascending == 0) | ||
824 | Array.Reverse(ret); | ||
825 | return new list(ret); | ||
826 | } | ||
827 | |||
828 | int src=0; | ||
829 | |||
830 | int len=(Data.Length+stride-1)/stride; | ||
831 | |||
832 | keys=new string[len]; | ||
833 | Object[][] vals=new Object[len][]; | ||
834 | |||
835 | int i; | ||
836 | |||
837 | while (src < Data.Length) | ||
838 | { | ||
839 | Object[] o=new Object[stride]; | ||
840 | |||
841 | for (i = 0; i < stride; i++) | ||
842 | { | ||
843 | if (src < Data.Length) | ||
844 | o[i]=Data[src++]; | ||
845 | else | ||
846 | { | ||
847 | o[i]=new Object(); | ||
848 | src++; | ||
849 | } | ||
850 | } | ||
851 | |||
852 | int idx=src/stride-1; | ||
853 | keys[idx]=o[0].ToString(); | ||
854 | vals[idx]=o; | ||
855 | } | ||
856 | |||
857 | Array.Sort(keys, vals, new AlphanumComparatorFast()); | ||
858 | if (ascending == 0) | ||
859 | { | ||
860 | Array.Reverse(vals); | ||
861 | } | ||
862 | |||
863 | Object[] sorted=new Object[stride*vals.Length]; | ||
864 | |||
865 | for (i = 0; i < vals.Length; i++) | ||
866 | for (int j = 0; j < stride; j++) | ||
867 | sorted[i*stride+j] = vals[i][j]; | ||
868 | |||
869 | return new list(sorted); | ||
870 | } | ||
871 | |||
872 | #region CSV Methods | ||
873 | |||
874 | public static list FromCSV(string csv) | ||
875 | { | ||
876 | return new list(csv.Split(',')); | ||
877 | } | ||
878 | |||
879 | public string ToCSV() | ||
880 | { | ||
881 | string ret = ""; | ||
882 | foreach (object o in this.Data) | ||
883 | { | ||
884 | if (ret == "") | ||
885 | { | ||
886 | ret = o.ToString(); | ||
887 | } | ||
888 | else | ||
889 | { | ||
890 | ret = ret + ", " + o.ToString(); | ||
891 | } | ||
892 | } | ||
893 | return ret; | ||
894 | } | ||
895 | |||
896 | private string ToSoup() | ||
897 | { | ||
898 | string output; | ||
899 | output = String.Empty; | ||
900 | if (m_data.Length == 0) | ||
901 | { | ||
902 | return String.Empty; | ||
903 | } | ||
904 | foreach (object o in m_data) | ||
905 | { | ||
906 | output = output + o.ToString(); | ||
907 | } | ||
908 | return output; | ||
909 | } | ||
910 | |||
911 | public static explicit operator String(list l) | ||
912 | { | ||
913 | return l.ToSoup(); | ||
914 | } | ||
915 | |||
916 | public static explicit operator LSLString(list l) | ||
917 | { | ||
918 | return new LSLString(l.ToSoup()); | ||
919 | } | ||
920 | |||
921 | public override string ToString() | ||
922 | { | ||
923 | return ToSoup(); | ||
924 | } | ||
925 | |||
926 | #endregion | ||
927 | |||
928 | #region Statistic Methods | ||
929 | |||
930 | public double Min() | ||
931 | { | ||
932 | double minimum = double.PositiveInfinity; | ||
933 | double entry; | ||
934 | for (int i = 0; i < Data.Length; i++) | ||
935 | { | ||
936 | if (double.TryParse(Data[i].ToString(), out entry)) | ||
937 | { | ||
938 | if (entry < minimum) minimum = entry; | ||
939 | } | ||
940 | } | ||
941 | return minimum; | ||
942 | } | ||
943 | |||
944 | public double Max() | ||
945 | { | ||
946 | double maximum = double.NegativeInfinity; | ||
947 | double entry; | ||
948 | for (int i = 0; i < Data.Length; i++) | ||
949 | { | ||
950 | if (double.TryParse(Data[i].ToString(), out entry)) | ||
951 | { | ||
952 | if (entry > maximum) maximum = entry; | ||
953 | } | ||
954 | } | ||
955 | return maximum; | ||
956 | } | ||
957 | |||
958 | public double Range() | ||
959 | { | ||
960 | return (this.Max() / this.Min()); | ||
961 | } | ||
962 | |||
963 | public int NumericLength() | ||
964 | { | ||
965 | int count = 0; | ||
966 | double entry; | ||
967 | for (int i = 0; i < Data.Length; i++) | ||
968 | { | ||
969 | if (double.TryParse(Data[i].ToString(), out entry)) | ||
970 | { | ||
971 | count++; | ||
972 | } | ||
973 | } | ||
974 | return count; | ||
975 | } | ||
976 | |||
977 | public static list ToDoubleList(list src) | ||
978 | { | ||
979 | list ret = new list(); | ||
980 | double entry; | ||
981 | for (int i = 0; i < src.Data.Length - 1; i++) | ||
982 | { | ||
983 | if (double.TryParse(src.Data[i].ToString(), out entry)) | ||
984 | { | ||
985 | ret.Add(entry); | ||
986 | } | ||
987 | } | ||
988 | return ret; | ||
989 | } | ||
990 | |||
991 | public double Sum() | ||
992 | { | ||
993 | double sum = 0; | ||
994 | double entry; | ||
995 | for (int i = 0; i < Data.Length; i++) | ||
996 | { | ||
997 | if (double.TryParse(Data[i].ToString(), out entry)) | ||
998 | { | ||
999 | sum = sum + entry; | ||
1000 | } | ||
1001 | } | ||
1002 | return sum; | ||
1003 | } | ||
1004 | |||
1005 | public double SumSqrs() | ||
1006 | { | ||
1007 | double sum = 0; | ||
1008 | double entry; | ||
1009 | for (int i = 0; i < Data.Length; i++) | ||
1010 | { | ||
1011 | if (double.TryParse(Data[i].ToString(), out entry)) | ||
1012 | { | ||
1013 | sum = sum + Math.Pow(entry, 2); | ||
1014 | } | ||
1015 | } | ||
1016 | return sum; | ||
1017 | } | ||
1018 | |||
1019 | public double Mean() | ||
1020 | { | ||
1021 | return (this.Sum() / this.NumericLength()); | ||
1022 | } | ||
1023 | |||
1024 | public void NumericSort() | ||
1025 | { | ||
1026 | IComparer Numeric = new NumericComparer(); | ||
1027 | Array.Sort(Data, Numeric); | ||
1028 | } | ||
1029 | |||
1030 | public void AlphaSort() | ||
1031 | { | ||
1032 | IComparer Alpha = new AlphaCompare(); | ||
1033 | Array.Sort(Data, Alpha); | ||
1034 | } | ||
1035 | |||
1036 | public double Median() | ||
1037 | { | ||
1038 | return Qi(0.5); | ||
1039 | } | ||
1040 | |||
1041 | public double GeometricMean() | ||
1042 | { | ||
1043 | double ret = 1.0; | ||
1044 | list nums = ToDoubleList(this); | ||
1045 | for (int i = 0; i < nums.Data.Length; i++) | ||
1046 | { | ||
1047 | ret *= (double)nums.Data[i]; | ||
1048 | } | ||
1049 | return Math.Exp(Math.Log(ret) / (double)nums.Data.Length); | ||
1050 | } | ||
1051 | |||
1052 | public double HarmonicMean() | ||
1053 | { | ||
1054 | double ret = 0.0; | ||
1055 | list nums = ToDoubleList(this); | ||
1056 | for (int i = 0; i < nums.Data.Length; i++) | ||
1057 | { | ||
1058 | ret += 1.0 / (double)nums.Data[i]; | ||
1059 | } | ||
1060 | return ((double)nums.Data.Length / ret); | ||
1061 | } | ||
1062 | |||
1063 | public double Variance() | ||
1064 | { | ||
1065 | double s = 0; | ||
1066 | list num = ToDoubleList(this); | ||
1067 | for (int i = 0; i < num.Data.Length; i++) | ||
1068 | { | ||
1069 | s += Math.Pow((double)num.Data[i], 2); | ||
1070 | } | ||
1071 | return (s - num.Data.Length * Math.Pow(num.Mean(), 2)) / (num.Data.Length - 1); | ||
1072 | } | ||
1073 | |||
1074 | public double StdDev() | ||
1075 | { | ||
1076 | return Math.Sqrt(this.Variance()); | ||
1077 | } | ||
1078 | |||
1079 | public double Qi(double i) | ||
1080 | { | ||
1081 | list j = this; | ||
1082 | j.NumericSort(); | ||
1083 | |||
1084 | if (Math.Ceiling(this.Length * i) == this.Length * i) | ||
1085 | { | ||
1086 | return (double)((double)j.Data[(int)(this.Length * i - 1)] + (double)j.Data[(int)(this.Length * i)]) / 2; | ||
1087 | } | ||
1088 | else | ||
1089 | { | ||
1090 | return (double)j.Data[((int)(Math.Ceiling(this.Length * i))) - 1]; | ||
1091 | } | ||
1092 | } | ||
1093 | |||
1094 | #endregion | ||
1095 | |||
1096 | public string ToPrettyString() | ||
1097 | { | ||
1098 | string output; | ||
1099 | if (m_data.Length == 0) | ||
1100 | { | ||
1101 | return "[]"; | ||
1102 | } | ||
1103 | output = "["; | ||
1104 | foreach (object o in m_data) | ||
1105 | { | ||
1106 | if (o is String) | ||
1107 | { | ||
1108 | output = output + "\"" + o + "\", "; | ||
1109 | } | ||
1110 | else | ||
1111 | { | ||
1112 | output = output + o.ToString() + ", "; | ||
1113 | } | ||
1114 | } | ||
1115 | output = output.Substring(0, output.Length - 2); | ||
1116 | output = output + "]"; | ||
1117 | return output; | ||
1118 | } | ||
1119 | |||
1120 | public class AlphaCompare : IComparer | ||
1121 | { | ||
1122 | int IComparer.Compare(object x, object y) | ||
1123 | { | ||
1124 | return string.Compare(x.ToString(), y.ToString()); | ||
1125 | } | ||
1126 | } | ||
1127 | |||
1128 | public class NumericComparer : IComparer | ||
1129 | { | ||
1130 | int IComparer.Compare(object x, object y) | ||
1131 | { | ||
1132 | double a; | ||
1133 | double b; | ||
1134 | if (!double.TryParse(x.ToString(), out a)) | ||
1135 | { | ||
1136 | a = 0.0; | ||
1137 | } | ||
1138 | if (!double.TryParse(y.ToString(), out b)) | ||
1139 | { | ||
1140 | b = 0.0; | ||
1141 | } | ||
1142 | if (a < b) | ||
1143 | { | ||
1144 | return -1; | ||
1145 | } | ||
1146 | else if (a == b) | ||
1147 | { | ||
1148 | return 0; | ||
1149 | } | ||
1150 | else | ||
1151 | { | ||
1152 | return 1; | ||
1153 | } | ||
1154 | } | ||
1155 | } | ||
1156 | |||
1157 | } | ||
1158 | |||
1159 | // | ||
1160 | // BELOW IS WORK IN PROGRESS... IT WILL CHANGE, SO DON'T USE YET! :) | ||
1161 | // | ||
1162 | |||
1163 | public struct StringTest | ||
1164 | { | ||
1165 | // Our own little string | ||
1166 | internal string actualString; | ||
1167 | public static implicit operator bool(StringTest mString) | ||
1168 | { | ||
1169 | if (mString.actualString.Length == 0) | ||
1170 | return true; | ||
1171 | return false; | ||
1172 | } | ||
1173 | public override string ToString() | ||
1174 | { | ||
1175 | return actualString; | ||
1176 | } | ||
1177 | |||
1178 | } | ||
1179 | |||
1180 | [Serializable] | ||
1181 | public struct key | ||
1182 | { | ||
1183 | public string value; | ||
1184 | |||
1185 | #region Constructors | ||
1186 | public key(string s) | ||
1187 | { | ||
1188 | value = s; | ||
1189 | } | ||
1190 | |||
1191 | #endregion | ||
1192 | |||
1193 | #region Methods | ||
1194 | |||
1195 | static public bool Parse2Key(string s) | ||
1196 | { | ||
1197 | Regex isuuid = new Regex(@"^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$", RegexOptions.Compiled); | ||
1198 | if (isuuid.IsMatch(s)) | ||
1199 | { | ||
1200 | return true; | ||
1201 | } | ||
1202 | else | ||
1203 | { | ||
1204 | return false; | ||
1205 | } | ||
1206 | } | ||
1207 | |||
1208 | #endregion | ||
1209 | |||
1210 | #region Operators | ||
1211 | |||
1212 | static public implicit operator Boolean(key k) | ||
1213 | { | ||
1214 | if (k.value.Length == 0) | ||
1215 | { | ||
1216 | return false; | ||
1217 | } | ||
1218 | |||
1219 | if (k.value == "00000000-0000-0000-0000-000000000000") | ||
1220 | { | ||
1221 | return false; | ||
1222 | } | ||
1223 | Regex isuuid = new Regex(@"^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$", RegexOptions.Compiled); | ||
1224 | if (isuuid.IsMatch(k.value)) | ||
1225 | { | ||
1226 | return true; | ||
1227 | } | ||
1228 | else | ||
1229 | { | ||
1230 | return false; | ||
1231 | } | ||
1232 | } | ||
1233 | |||
1234 | static public implicit operator key(string s) | ||
1235 | { | ||
1236 | return new key(s); | ||
1237 | } | ||
1238 | |||
1239 | static public implicit operator String(key k) | ||
1240 | { | ||
1241 | return k.value; | ||
1242 | } | ||
1243 | |||
1244 | static public implicit operator LSLString(key k) | ||
1245 | { | ||
1246 | return k.value; | ||
1247 | } | ||
1248 | |||
1249 | public static bool operator ==(key k1, key k2) | ||
1250 | { | ||
1251 | return k1.value == k2.value; | ||
1252 | } | ||
1253 | public static bool operator !=(key k1, key k2) | ||
1254 | { | ||
1255 | return k1.value != k2.value; | ||
1256 | } | ||
1257 | |||
1258 | #endregion | ||
1259 | |||
1260 | #region Overriders | ||
1261 | |||
1262 | public override bool Equals(object o) | ||
1263 | { | ||
1264 | return o.ToString() == value; | ||
1265 | } | ||
1266 | |||
1267 | public override int GetHashCode() | ||
1268 | { | ||
1269 | return value.GetHashCode(); | ||
1270 | } | ||
1271 | |||
1272 | public override string ToString() | ||
1273 | { | ||
1274 | return value; | ||
1275 | } | ||
1276 | |||
1277 | #endregion | ||
1278 | } | ||
1279 | |||
1280 | [Serializable] | ||
1281 | public struct LSLString | ||
1282 | { | ||
1283 | public string m_string; | ||
1284 | #region Constructors | ||
1285 | public LSLString(string s) | ||
1286 | { | ||
1287 | m_string = s; | ||
1288 | } | ||
1289 | |||
1290 | public LSLString(double d) | ||
1291 | { | ||
1292 | string s=String.Format("{0:0.000000}", d); | ||
1293 | m_string=s; | ||
1294 | } | ||
1295 | |||
1296 | public LSLString(LSLFloat f) | ||
1297 | { | ||
1298 | string s=String.Format("{0:0.000000}", f.value); | ||
1299 | m_string=s; | ||
1300 | } | ||
1301 | |||
1302 | #endregion | ||
1303 | |||
1304 | #region Operators | ||
1305 | static public implicit operator Boolean(LSLString s) | ||
1306 | { | ||
1307 | if (s.m_string.Length == 0) | ||
1308 | { | ||
1309 | return false; | ||
1310 | } | ||
1311 | else | ||
1312 | { | ||
1313 | return true; | ||
1314 | } | ||
1315 | } | ||
1316 | |||
1317 | |||
1318 | |||
1319 | static public implicit operator String(LSLString s) | ||
1320 | { | ||
1321 | return s.m_string; | ||
1322 | } | ||
1323 | |||
1324 | static public implicit operator LSLString(string s) | ||
1325 | { | ||
1326 | return new LSLString(s); | ||
1327 | } | ||
1328 | |||
1329 | public static string ToString(LSLString s) | ||
1330 | { | ||
1331 | return s.m_string; | ||
1332 | } | ||
1333 | |||
1334 | public override string ToString() | ||
1335 | { | ||
1336 | return m_string; | ||
1337 | } | ||
1338 | |||
1339 | public static bool operator ==(LSLString s1, string s2) | ||
1340 | { | ||
1341 | return s1.m_string == s2; | ||
1342 | } | ||
1343 | |||
1344 | public static bool operator !=(LSLString s1, string s2) | ||
1345 | { | ||
1346 | return s1.m_string != s2; | ||
1347 | } | ||
1348 | |||
1349 | public static explicit operator double(LSLString s) | ||
1350 | { | ||
1351 | return Convert.ToDouble(s.m_string); | ||
1352 | } | ||
1353 | |||
1354 | public static explicit operator LSLInteger(LSLString s) | ||
1355 | { | ||
1356 | return new LSLInteger(s.m_string); | ||
1357 | } | ||
1358 | |||
1359 | public static explicit operator LSLString(double d) | ||
1360 | { | ||
1361 | return new LSLString(d); | ||
1362 | } | ||
1363 | |||
1364 | public static explicit operator LSLString(LSLFloat f) | ||
1365 | { | ||
1366 | return new LSLString(f); | ||
1367 | } | ||
1368 | |||
1369 | static public explicit operator LSLString(bool b) | ||
1370 | { | ||
1371 | if (b) | ||
1372 | return new LSLString("1"); | ||
1373 | else | ||
1374 | return new LSLString("0"); | ||
1375 | } | ||
1376 | |||
1377 | public static implicit operator Vector3(LSLString s) | ||
1378 | { | ||
1379 | return new Vector3(s.m_string); | ||
1380 | } | ||
1381 | |||
1382 | public static implicit operator Quaternion(LSLString s) | ||
1383 | { | ||
1384 | return new Quaternion(s.m_string); | ||
1385 | } | ||
1386 | |||
1387 | public static implicit operator LSLFloat(LSLString s) | ||
1388 | { | ||
1389 | return new LSLFloat(Convert.ToDouble(s.m_string)); | ||
1390 | } | ||
1391 | |||
1392 | #endregion | ||
1393 | |||
1394 | #region Overriders | ||
1395 | public override bool Equals(object o) | ||
1396 | { | ||
1397 | return m_string == o.ToString(); | ||
1398 | } | ||
1399 | |||
1400 | public override int GetHashCode() | ||
1401 | { | ||
1402 | return m_string.GetHashCode(); | ||
1403 | } | ||
1404 | |||
1405 | #endregion | ||
1406 | |||
1407 | #region " Standard string functions " | ||
1408 | //Clone,CompareTo,Contains | ||
1409 | //CopyTo,EndsWith,Equals,GetEnumerator,GetHashCode,GetType,GetTypeCode | ||
1410 | //IndexOf,IndexOfAny,Insert,IsNormalized,LastIndexOf,LastIndexOfAny | ||
1411 | //Length,Normalize,PadLeft,PadRight,Remove,Replace,Split,StartsWith,Substring,ToCharArray,ToLowerInvariant | ||
1412 | //ToString,ToUpper,ToUpperInvariant,Trim,TrimEnd,TrimStart | ||
1413 | public bool Contains(string value) { return m_string.Contains(value); } | ||
1414 | public int IndexOf(string value) { return m_string.IndexOf(value); } | ||
1415 | public int Length { get { return m_string.Length; } } | ||
1416 | |||
1417 | |||
1418 | #endregion | ||
1419 | } | ||
1420 | |||
1421 | [Serializable] | ||
1422 | public struct LSLInteger | ||
1423 | { | ||
1424 | public int value; | ||
1425 | |||
1426 | #region Constructors | ||
1427 | public LSLInteger(int i) | ||
1428 | { | ||
1429 | value = i; | ||
1430 | } | ||
1431 | |||
1432 | public LSLInteger(double d) | ||
1433 | { | ||
1434 | value = (int)d; | ||
1435 | } | ||
1436 | |||
1437 | public LSLInteger(string s) | ||
1438 | { | ||
1439 | Regex r = new Regex("^[ ]*-?[0-9][0-9xX]?[0-9a-fA-F]*"); | ||
1440 | Match m = r.Match(s); | ||
1441 | string v = m.Groups[0].Value; | ||
1442 | |||
1443 | if (v == String.Empty) | ||
1444 | { | ||
1445 | value = 0; | ||
1446 | } | ||
1447 | else | ||
1448 | { | ||
1449 | try | ||
1450 | { | ||
1451 | if (v.Contains("x") || v.Contains("X")) | ||
1452 | { | ||
1453 | value = int.Parse(v.Substring(2), System.Globalization.NumberStyles.HexNumber); | ||
1454 | } | ||
1455 | else | ||
1456 | { | ||
1457 | value = int.Parse(v, System.Globalization.NumberStyles.Integer); | ||
1458 | } | ||
1459 | } | ||
1460 | catch (OverflowException) | ||
1461 | { | ||
1462 | value = -1; | ||
1463 | } | ||
1464 | } | ||
1465 | } | ||
1466 | |||
1467 | #endregion | ||
1468 | |||
1469 | #region Operators | ||
1470 | |||
1471 | static public implicit operator int(LSLInteger i) | ||
1472 | { | ||
1473 | return i.value; | ||
1474 | } | ||
1475 | |||
1476 | static public implicit operator uint(LSLInteger i) | ||
1477 | { | ||
1478 | return (uint)i.value; | ||
1479 | } | ||
1480 | |||
1481 | static public explicit operator LSLString(LSLInteger i) | ||
1482 | { | ||
1483 | return new LSLString(i.ToString()); | ||
1484 | } | ||
1485 | |||
1486 | static public implicit operator Boolean(LSLInteger i) | ||
1487 | { | ||
1488 | if (i.value == 0) | ||
1489 | { | ||
1490 | return false; | ||
1491 | } | ||
1492 | else | ||
1493 | { | ||
1494 | return true; | ||
1495 | } | ||
1496 | } | ||
1497 | |||
1498 | static public implicit operator LSLInteger(int i) | ||
1499 | { | ||
1500 | return new LSLInteger(i); | ||
1501 | } | ||
1502 | |||
1503 | static public explicit operator LSLInteger(string s) | ||
1504 | { | ||
1505 | return new LSLInteger(s); | ||
1506 | } | ||
1507 | |||
1508 | static public implicit operator LSLInteger(uint u) | ||
1509 | { | ||
1510 | return new LSLInteger(u); | ||
1511 | } | ||
1512 | |||
1513 | static public explicit operator LSLInteger(double d) | ||
1514 | { | ||
1515 | return new LSLInteger(d); | ||
1516 | } | ||
1517 | |||
1518 | static public explicit operator LSLInteger(LSLFloat f) | ||
1519 | { | ||
1520 | return new LSLInteger(f.value); | ||
1521 | } | ||
1522 | |||
1523 | static public implicit operator LSLInteger(bool b) | ||
1524 | { | ||
1525 | if (b) | ||
1526 | return new LSLInteger(1); | ||
1527 | else | ||
1528 | return new LSLInteger(0); | ||
1529 | } | ||
1530 | |||
1531 | static public bool operator ==(LSLInteger i1, LSLInteger i2) | ||
1532 | { | ||
1533 | bool ret = i1.value == i2.value; | ||
1534 | return ret; | ||
1535 | } | ||
1536 | |||
1537 | static public bool operator !=(LSLInteger i1, LSLInteger i2) | ||
1538 | { | ||
1539 | bool ret = i1.value != i2.value; | ||
1540 | return ret; | ||
1541 | } | ||
1542 | |||
1543 | static public LSLInteger operator +(LSLInteger i1, int i2) | ||
1544 | { | ||
1545 | return new LSLInteger(i1.value + i2); | ||
1546 | } | ||
1547 | |||
1548 | static public LSLInteger operator -(LSLInteger i1, int i2) | ||
1549 | { | ||
1550 | return new LSLInteger(i1.value - i2); | ||
1551 | } | ||
1552 | |||
1553 | static public LSLInteger operator *(LSLInteger i1, int i2) | ||
1554 | { | ||
1555 | return new LSLInteger(i1.value * i2); | ||
1556 | } | ||
1557 | |||
1558 | static public LSLInteger operator /(LSLInteger i1, int i2) | ||
1559 | { | ||
1560 | return new LSLInteger(i1.value / i2); | ||
1561 | } | ||
1562 | |||
1563 | // static public LSLFloat operator +(LSLInteger i1, double f) | ||
1564 | // { | ||
1565 | // return new LSLFloat((double)i1.value + f); | ||
1566 | // } | ||
1567 | // | ||
1568 | // static public LSLFloat operator -(LSLInteger i1, double f) | ||
1569 | // { | ||
1570 | // return new LSLFloat((double)i1.value - f); | ||
1571 | // } | ||
1572 | // | ||
1573 | // static public LSLFloat operator *(LSLInteger i1, double f) | ||
1574 | // { | ||
1575 | // return new LSLFloat((double)i1.value * f); | ||
1576 | // } | ||
1577 | // | ||
1578 | // static public LSLFloat operator /(LSLInteger i1, double f) | ||
1579 | // { | ||
1580 | // return new LSLFloat((double)i1.value / f); | ||
1581 | // } | ||
1582 | |||
1583 | static public LSLInteger operator -(LSLInteger i) | ||
1584 | { | ||
1585 | return new LSLInteger(-i.value); | ||
1586 | } | ||
1587 | |||
1588 | public override bool Equals(Object o) | ||
1589 | { | ||
1590 | if (!(o is LSLInteger)) | ||
1591 | return false; | ||
1592 | return value == ((LSLInteger)o).value; | ||
1593 | } | ||
1594 | |||
1595 | public override int GetHashCode() | ||
1596 | { | ||
1597 | return value; | ||
1598 | } | ||
1599 | |||
1600 | static public LSLInteger operator &(LSLInteger i1, LSLInteger i2) | ||
1601 | { | ||
1602 | int ret = i1.value & i2.value; | ||
1603 | return ret; | ||
1604 | } | ||
1605 | |||
1606 | public static LSLInteger operator ++(LSLInteger i) | ||
1607 | { | ||
1608 | i.value++; | ||
1609 | return i; | ||
1610 | } | ||
1611 | |||
1612 | |||
1613 | public static LSLInteger operator --(LSLInteger i) | ||
1614 | { | ||
1615 | i.value--; | ||
1616 | return i; | ||
1617 | } | ||
1618 | |||
1619 | static public implicit operator System.Double(LSLInteger i) | ||
1620 | { | ||
1621 | return (double)i.value; | ||
1622 | } | ||
1623 | |||
1624 | public static bool operator true(LSLInteger i) | ||
1625 | { | ||
1626 | return i.value != 0; | ||
1627 | } | ||
1628 | |||
1629 | public static bool operator false(LSLInteger i) | ||
1630 | { | ||
1631 | return i.value == 0; | ||
1632 | } | ||
1633 | |||
1634 | #endregion | ||
1635 | |||
1636 | #region Overriders | ||
1637 | |||
1638 | public override string ToString() | ||
1639 | { | ||
1640 | return this.value.ToString(); | ||
1641 | } | ||
1642 | |||
1643 | #endregion | ||
1644 | } | ||
1645 | |||
1646 | [Serializable] | ||
1647 | public struct LSLFloat | ||
1648 | { | ||
1649 | public double value; | ||
1650 | |||
1651 | #region Constructors | ||
1652 | |||
1653 | public LSLFloat(int i) | ||
1654 | { | ||
1655 | this.value = (double)i; | ||
1656 | } | ||
1657 | |||
1658 | public LSLFloat(double d) | ||
1659 | { | ||
1660 | this.value = d; | ||
1661 | } | ||
1662 | |||
1663 | public LSLFloat(string s) | ||
1664 | { | ||
1665 | this.value = double.Parse(s); | ||
1666 | } | ||
1667 | |||
1668 | #endregion | ||
1669 | |||
1670 | #region Operators | ||
1671 | |||
1672 | static public explicit operator float(LSLFloat f) | ||
1673 | { | ||
1674 | return (float)f.value; | ||
1675 | } | ||
1676 | |||
1677 | static public explicit operator int(LSLFloat f) | ||
1678 | { | ||
1679 | return (int)f.value; | ||
1680 | } | ||
1681 | |||
1682 | static public explicit operator uint(LSLFloat f) | ||
1683 | { | ||
1684 | return (uint) Math.Abs(f.value); | ||
1685 | } | ||
1686 | |||
1687 | static public implicit operator Boolean(LSLFloat f) | ||
1688 | { | ||
1689 | if (f.value == 0.0) | ||
1690 | { | ||
1691 | return false; | ||
1692 | } | ||
1693 | else | ||
1694 | { | ||
1695 | return true; | ||
1696 | } | ||
1697 | } | ||
1698 | |||
1699 | static public implicit operator LSLFloat(int i) | ||
1700 | { | ||
1701 | return new LSLFloat(i); | ||
1702 | } | ||
1703 | |||
1704 | static public implicit operator LSLFloat(LSLInteger i) | ||
1705 | { | ||
1706 | return new LSLFloat(i.value); | ||
1707 | } | ||
1708 | |||
1709 | static public explicit operator LSLFloat(string s) | ||
1710 | { | ||
1711 | Regex r = new Regex("^[ ]*-?[0-9]*\\.?[0-9]*[eE]?-?[0-9]*"); | ||
1712 | Match m = r.Match(s); | ||
1713 | string v = m.Groups[0].Value; | ||
1714 | |||
1715 | while (v.Length > 0 && v.Substring(0, 1) == " ") | ||
1716 | v = v.Substring(1); | ||
1717 | |||
1718 | if (v == String.Empty) | ||
1719 | v = "0"; | ||
1720 | |||
1721 | return new LSLFloat(double.Parse(v)); | ||
1722 | } | ||
1723 | |||
1724 | static public implicit operator LSLFloat(double d) | ||
1725 | { | ||
1726 | return new LSLFloat(d); | ||
1727 | } | ||
1728 | |||
1729 | static public implicit operator LSLFloat(bool b) | ||
1730 | { | ||
1731 | if (b) | ||
1732 | return new LSLFloat(1.0); | ||
1733 | else | ||
1734 | return new LSLFloat(0.0); | ||
1735 | } | ||
1736 | |||
1737 | static public bool operator ==(LSLFloat f1, LSLFloat f2) | ||
1738 | { | ||
1739 | return f1.value == f2.value; | ||
1740 | } | ||
1741 | |||
1742 | static public bool operator !=(LSLFloat f1, LSLFloat f2) | ||
1743 | { | ||
1744 | return f1.value != f2.value; | ||
1745 | } | ||
1746 | |||
1747 | static public LSLFloat operator ++(LSLFloat f) | ||
1748 | { | ||
1749 | f.value++; | ||
1750 | return f; | ||
1751 | } | ||
1752 | |||
1753 | static public LSLFloat operator --(LSLFloat f) | ||
1754 | { | ||
1755 | f.value--; | ||
1756 | return f; | ||
1757 | } | ||
1758 | |||
1759 | static public LSLFloat operator +(LSLFloat f, int i) | ||
1760 | { | ||
1761 | return new LSLFloat(f.value + (double)i); | ||
1762 | } | ||
1763 | |||
1764 | static public LSLFloat operator -(LSLFloat f, int i) | ||
1765 | { | ||
1766 | return new LSLFloat(f.value - (double)i); | ||
1767 | } | ||
1768 | |||
1769 | static public LSLFloat operator *(LSLFloat f, int i) | ||
1770 | { | ||
1771 | return new LSLFloat(f.value * (double)i); | ||
1772 | } | ||
1773 | |||
1774 | static public LSLFloat operator /(LSLFloat f, int i) | ||
1775 | { | ||
1776 | return new LSLFloat(f.value / (double)i); | ||
1777 | } | ||
1778 | |||
1779 | static public LSLFloat operator +(LSLFloat lhs, LSLFloat rhs) | ||
1780 | { | ||
1781 | return new LSLFloat(lhs.value + rhs.value); | ||
1782 | } | ||
1783 | |||
1784 | static public LSLFloat operator -(LSLFloat lhs, LSLFloat rhs) | ||
1785 | { | ||
1786 | return new LSLFloat(lhs.value - rhs.value); | ||
1787 | } | ||
1788 | |||
1789 | static public LSLFloat operator *(LSLFloat lhs, LSLFloat rhs) | ||
1790 | { | ||
1791 | return new LSLFloat(lhs.value * rhs.value); | ||
1792 | } | ||
1793 | |||
1794 | static public LSLFloat operator /(LSLFloat lhs, LSLFloat rhs) | ||
1795 | { | ||
1796 | return new LSLFloat(lhs.value / rhs.value); | ||
1797 | } | ||
1798 | |||
1799 | static public LSLFloat operator -(LSLFloat f) | ||
1800 | { | ||
1801 | return new LSLFloat(-f.value); | ||
1802 | } | ||
1803 | |||
1804 | static public implicit operator System.Double(LSLFloat f) | ||
1805 | { | ||
1806 | return f.value; | ||
1807 | } | ||
1808 | |||
1809 | #endregion | ||
1810 | |||
1811 | #region Overriders | ||
1812 | |||
1813 | public override string ToString() | ||
1814 | { | ||
1815 | return String.Format("{0:0.000000}", this.value); | ||
1816 | } | ||
1817 | |||
1818 | public override bool Equals(Object o) | ||
1819 | { | ||
1820 | if (!(o is LSLFloat)) | ||
1821 | return false; | ||
1822 | return value == ((LSLFloat)o).value; | ||
1823 | } | ||
1824 | |||
1825 | public override int GetHashCode() | ||
1826 | { | ||
1827 | return Convert.ToInt32(value); | ||
1828 | } | ||
1829 | |||
1830 | |||
1831 | #endregion | ||
1832 | } | ||
1833 | } | ||
1834 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs index c9551ae..5ca3e7d 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Region.Environment.Scenes; | |||
34 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 34 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
35 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 35 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
36 | //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; | 36 | //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; |
37 | using OpenSim.Region.ScriptEngine.Shared; | ||
37 | 38 | ||
38 | namespace OpenSim.Region.ScriptEngine.Common | 39 | namespace OpenSim.Region.ScriptEngine.Common |
39 | { | 40 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs index 9c1587d..49f92b5 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs | |||
@@ -24,6 +24,7 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using OpenSim.Region.ScriptEngine.Shared; | ||
27 | 28 | ||
28 | namespace OpenSim.Region.ScriptEngine.Common | 29 | namespace OpenSim.Region.ScriptEngine.Common |
29 | { | 30 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs index 378610a..96d7b30 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Dataserver.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Region.ScriptEngine.Shared; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins | 34 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins |
34 | 35 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs index 097f3b4..5b4cb83 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Modules.Scripting.HttpRequest; | 30 | using OpenSim.Region.Environment.Modules.Scripting.HttpRequest; |
31 | using OpenSim.Region.ScriptEngine.Shared; | ||
31 | 32 | ||
32 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins | 33 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins |
33 | { | 34 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs index 6a1235b..0bac22c 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using OpenSim.Region.Environment.Interfaces; | 28 | using OpenSim.Region.Environment.Interfaces; |
29 | using OpenSim.Region.Environment.Modules.Scripting.WorldComm; | 29 | using OpenSim.Region.Environment.Modules.Scripting.WorldComm; |
30 | using OpenSim.Region.ScriptEngine.Shared; | ||
30 | 31 | ||
31 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins | 32 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins |
32 | { | 33 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs index 0fce1f2..7059a1b 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs | |||
@@ -31,6 +31,7 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Environment.Scenes; | 32 | using OpenSim.Region.Environment.Scenes; |
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Region.ScriptEngine.Shared; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins | 36 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins |
36 | { | 37 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs index ba6a98c..9a01cc4 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Modules.Scripting.XMLRPC; | 30 | using OpenSim.Region.Environment.Modules.Scripting.XMLRPC; |
31 | using OpenSim.Region.ScriptEngine.Shared; | ||
31 | 32 | ||
32 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins | 33 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins |
33 | { | 34 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index c72be7c..d52b642 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Region.Interfaces; | |||
35 | using OpenSim.Region; | 35 | using OpenSim.Region; |
36 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.ScriptEngine.Shared; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | 40 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase |
40 | { | 41 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index 282559a..d0af720 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Region.ScriptEngine.Shared; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | 34 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase |
34 | { | 35 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLFloat.cs b/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLFloat.cs deleted file mode 100644 index d89bb87..0000000 --- a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLFloat.cs +++ /dev/null | |||
@@ -1,583 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Tests.Common; | ||
31 | using OpenSim.Region.ScriptEngine.Common; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.Common.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class LSL_TypesTestLSLFloat | ||
37 | { | ||
38 | // Used for testing equality of two floats. | ||
39 | private double _lowPrecisionTolerance = 0.000001; | ||
40 | |||
41 | private Dictionary<int, double> m_intDoubleSet; | ||
42 | private Dictionary<double, double> m_doubleDoubleSet; | ||
43 | private Dictionary<double, int> m_doubleIntSet; | ||
44 | private Dictionary<double, int> m_doubleUintSet; | ||
45 | private Dictionary<string, double> m_stringDoubleSet; | ||
46 | private Dictionary<double, string> m_doubleStringSet; | ||
47 | private List<int> m_intList; | ||
48 | private List<double> m_doubleList; | ||
49 | |||
50 | /// <summary> | ||
51 | /// Sets up dictionaries and arrays used in the tests. | ||
52 | /// </summary> | ||
53 | [TestFixtureSetUp] | ||
54 | public void SetUpDataSets() | ||
55 | { | ||
56 | m_intDoubleSet = new Dictionary<int, double>(); | ||
57 | m_intDoubleSet.Add(2, 2.0); | ||
58 | m_intDoubleSet.Add(-2, -2.0); | ||
59 | m_intDoubleSet.Add(0, 0.0); | ||
60 | m_intDoubleSet.Add(1, 1.0); | ||
61 | m_intDoubleSet.Add(-1, -1.0); | ||
62 | m_intDoubleSet.Add(999999999, 999999999.0); | ||
63 | m_intDoubleSet.Add(-99999999, -99999999.0); | ||
64 | |||
65 | m_doubleDoubleSet = new Dictionary<double, double>(); | ||
66 | m_doubleDoubleSet.Add(2.0, 2.0); | ||
67 | m_doubleDoubleSet.Add(-2.0, -2.0); | ||
68 | m_doubleDoubleSet.Add(0.0, 0.0); | ||
69 | m_doubleDoubleSet.Add(1.0, 1.0); | ||
70 | m_doubleDoubleSet.Add(-1.0, -1.0); | ||
71 | m_doubleDoubleSet.Add(999999999.0, 999999999.0); | ||
72 | m_doubleDoubleSet.Add(-99999999.0, -99999999.0); | ||
73 | m_doubleDoubleSet.Add(0.5, 0.5); | ||
74 | m_doubleDoubleSet.Add(0.0005, 0.0005); | ||
75 | m_doubleDoubleSet.Add(0.6805, 0.6805); | ||
76 | m_doubleDoubleSet.Add(-0.5, -0.5); | ||
77 | m_doubleDoubleSet.Add(-0.0005, -0.0005); | ||
78 | m_doubleDoubleSet.Add(-0.6805, -0.6805); | ||
79 | m_doubleDoubleSet.Add(548.5, 548.5); | ||
80 | m_doubleDoubleSet.Add(2.0005, 2.0005); | ||
81 | m_doubleDoubleSet.Add(349485435.6805, 349485435.6805); | ||
82 | m_doubleDoubleSet.Add(-548.5, -548.5); | ||
83 | m_doubleDoubleSet.Add(-2.0005, -2.0005); | ||
84 | m_doubleDoubleSet.Add(-349485435.6805, -349485435.6805); | ||
85 | |||
86 | m_doubleIntSet = new Dictionary<double, int>(); | ||
87 | m_doubleIntSet.Add(2.0, 2); | ||
88 | m_doubleIntSet.Add(-2.0, -2); | ||
89 | m_doubleIntSet.Add(0.0, 0); | ||
90 | m_doubleIntSet.Add(1.0, 1); | ||
91 | m_doubleIntSet.Add(-1.0, -1); | ||
92 | m_doubleIntSet.Add(999999999.0, 999999999); | ||
93 | m_doubleIntSet.Add(-99999999.0, -99999999); | ||
94 | m_doubleIntSet.Add(0.5, 0); | ||
95 | m_doubleIntSet.Add(0.0005, 0); | ||
96 | m_doubleIntSet.Add(0.6805, 0); | ||
97 | m_doubleIntSet.Add(-0.5, 0); | ||
98 | m_doubleIntSet.Add(-0.0005, 0); | ||
99 | m_doubleIntSet.Add(-0.6805, 0); | ||
100 | m_doubleIntSet.Add(548.5, 548); | ||
101 | m_doubleIntSet.Add(2.0005, 2); | ||
102 | m_doubleIntSet.Add(349485435.6805, 349485435); | ||
103 | m_doubleIntSet.Add(-548.5, -548); | ||
104 | m_doubleIntSet.Add(-2.0005, -2); | ||
105 | m_doubleIntSet.Add(-349485435.6805, -349485435); | ||
106 | |||
107 | m_doubleUintSet = new Dictionary<double, int>(); | ||
108 | m_doubleUintSet.Add(2.0, 2); | ||
109 | m_doubleUintSet.Add(-2.0, 2); | ||
110 | m_doubleUintSet.Add(0.0, 0); | ||
111 | m_doubleUintSet.Add(1.0, 1); | ||
112 | m_doubleUintSet.Add(-1.0, 1); | ||
113 | m_doubleUintSet.Add(999999999.0, 999999999); | ||
114 | m_doubleUintSet.Add(-99999999.0, 99999999); | ||
115 | m_doubleUintSet.Add(0.5, 0); | ||
116 | m_doubleUintSet.Add(0.0005, 0); | ||
117 | m_doubleUintSet.Add(0.6805, 0); | ||
118 | m_doubleUintSet.Add(-0.5, 0); | ||
119 | m_doubleUintSet.Add(-0.0005, 0); | ||
120 | m_doubleUintSet.Add(-0.6805, 0); | ||
121 | m_doubleUintSet.Add(548.5, 548); | ||
122 | m_doubleUintSet.Add(2.0005, 2); | ||
123 | m_doubleUintSet.Add(349485435.6805, 349485435); | ||
124 | m_doubleUintSet.Add(-548.5, 548); | ||
125 | m_doubleUintSet.Add(-2.0005, 2); | ||
126 | m_doubleUintSet.Add(-349485435.6805, 349485435); | ||
127 | |||
128 | m_stringDoubleSet = new Dictionary<string, double>(); | ||
129 | m_stringDoubleSet.Add("2", 2.0); | ||
130 | m_stringDoubleSet.Add("-2", -2.0); | ||
131 | m_stringDoubleSet.Add("1", 1.0); | ||
132 | m_stringDoubleSet.Add("-1", -1.0); | ||
133 | m_stringDoubleSet.Add("0", 0.0); | ||
134 | m_stringDoubleSet.Add("999999999.0", 999999999.0); | ||
135 | m_stringDoubleSet.Add("-99999999.0", -99999999.0); | ||
136 | m_stringDoubleSet.Add("0.5", 0.5); | ||
137 | m_stringDoubleSet.Add("0.0005", 0.0005); | ||
138 | m_stringDoubleSet.Add("0.6805", 0.6805); | ||
139 | m_stringDoubleSet.Add("-0.5", -0.5); | ||
140 | m_stringDoubleSet.Add("-0.0005", -0.0005); | ||
141 | m_stringDoubleSet.Add("-0.6805", -0.6805); | ||
142 | m_stringDoubleSet.Add("548.5", 548.5); | ||
143 | m_stringDoubleSet.Add("2.0005", 2.0005); | ||
144 | m_stringDoubleSet.Add("349485435.6805", 349485435.6805); | ||
145 | m_stringDoubleSet.Add("-548.5", -548.5); | ||
146 | m_stringDoubleSet.Add("-2.0005", -2.0005); | ||
147 | m_stringDoubleSet.Add("-349485435.6805", -349485435.6805); | ||
148 | |||
149 | m_doubleStringSet = new Dictionary<double, string>(); | ||
150 | m_doubleStringSet.Add(2.0, "2.000000"); | ||
151 | m_doubleStringSet.Add(-2.0, "-2.000000"); | ||
152 | m_doubleStringSet.Add(1.0, "1.000000"); | ||
153 | m_doubleStringSet.Add(-1.0, "-1.000000"); | ||
154 | m_doubleStringSet.Add(0.0, "0.000000"); | ||
155 | m_doubleStringSet.Add(999999999.0, "999999999.000000"); | ||
156 | m_doubleStringSet.Add(-99999999.0, "-99999999.000000"); | ||
157 | m_doubleStringSet.Add(0.5, "0.500000"); | ||
158 | m_doubleStringSet.Add(0.0005, "0.000500"); | ||
159 | m_doubleStringSet.Add(0.6805, "0.680500"); | ||
160 | m_doubleStringSet.Add(-0.5, "-0.500000"); | ||
161 | m_doubleStringSet.Add(-0.0005, "-0.000500"); | ||
162 | m_doubleStringSet.Add(-0.6805, "-0.680500"); | ||
163 | m_doubleStringSet.Add(548.5, "548.500000"); | ||
164 | m_doubleStringSet.Add(2.0005, "2.000500"); | ||
165 | m_doubleStringSet.Add(349485435.6805, "349485435.680500"); | ||
166 | m_doubleStringSet.Add(-548.5, "-548.500000"); | ||
167 | m_doubleStringSet.Add(-2.0005, "-2.000500"); | ||
168 | m_doubleStringSet.Add(-349485435.6805, "-349485435.680500"); | ||
169 | |||
170 | m_doubleList = new List<double>(); | ||
171 | m_doubleList.Add(2.0); | ||
172 | m_doubleList.Add(-2.0); | ||
173 | m_doubleList.Add(1.0); | ||
174 | m_doubleList.Add(-1.0); | ||
175 | m_doubleList.Add(999999999.0); | ||
176 | m_doubleList.Add(-99999999.0); | ||
177 | m_doubleList.Add(0.5); | ||
178 | m_doubleList.Add(0.0005); | ||
179 | m_doubleList.Add(0.6805); | ||
180 | m_doubleList.Add(-0.5); | ||
181 | m_doubleList.Add(-0.0005); | ||
182 | m_doubleList.Add(-0.6805); | ||
183 | m_doubleList.Add(548.5); | ||
184 | m_doubleList.Add(2.0005); | ||
185 | m_doubleList.Add(349485435.6805); | ||
186 | m_doubleList.Add(-548.5); | ||
187 | m_doubleList.Add(-2.0005); | ||
188 | m_doubleList.Add(-349485435.6805); | ||
189 | |||
190 | m_intList = new List<int>(); | ||
191 | m_intList.Add(2); | ||
192 | m_intList.Add(-2); | ||
193 | m_intList.Add(0); | ||
194 | m_intList.Add(1); | ||
195 | m_intList.Add(-1); | ||
196 | m_intList.Add(999999999); | ||
197 | m_intList.Add(-99999999); | ||
198 | } | ||
199 | |||
200 | /// <summary> | ||
201 | /// Tests constructing a LSLFloat from an integer. | ||
202 | /// </summary> | ||
203 | [Test] | ||
204 | public void TestConstructFromInt() | ||
205 | { | ||
206 | LSL_Types.LSLFloat testFloat; | ||
207 | |||
208 | foreach (KeyValuePair<int, double> number in m_intDoubleSet) | ||
209 | { | ||
210 | testFloat = new LSL_Types.LSLFloat(number.Key); | ||
211 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | /// <summary> | ||
216 | /// Tests constructing a LSLFloat from a double. | ||
217 | /// </summary> | ||
218 | [Test] | ||
219 | public void TestConstructFromDouble() | ||
220 | { | ||
221 | LSL_Types.LSLFloat testFloat; | ||
222 | |||
223 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | ||
224 | { | ||
225 | testFloat = new LSL_Types.LSLFloat(number.Key); | ||
226 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /// <summary> | ||
231 | /// Tests LSLFloat is correctly cast explicitly to integer. | ||
232 | /// </summary> | ||
233 | [Test] | ||
234 | public void TestExplicitCastLSLFloatToInt() | ||
235 | { | ||
236 | int testNumber; | ||
237 | |||
238 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) | ||
239 | { | ||
240 | testNumber = (int) new LSL_Types.LSLFloat(number.Key); | ||
241 | Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); | ||
242 | } | ||
243 | } | ||
244 | |||
245 | /// <summary> | ||
246 | /// Tests LSLFloat is correctly cast explicitly to unsigned integer. | ||
247 | /// </summary> | ||
248 | [Test] | ||
249 | public void TestExplicitCastLSLFloatToUint() | ||
250 | { | ||
251 | uint testNumber; | ||
252 | |||
253 | foreach (KeyValuePair<double, int> number in m_doubleUintSet) | ||
254 | { | ||
255 | testNumber = (uint) new LSL_Types.LSLFloat(number.Key); | ||
256 | Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); | ||
257 | } | ||
258 | } | ||
259 | |||
260 | /// <summary> | ||
261 | /// Tests LSLFloat is correctly cast implicitly to Boolean if non-zero. | ||
262 | /// </summary> | ||
263 | [Test] | ||
264 | public void TestImplicitCastLSLFloatToBooleanTrue() | ||
265 | { | ||
266 | LSL_Types.LSLFloat testFloat; | ||
267 | bool testBool; | ||
268 | |||
269 | foreach (double number in m_doubleList) | ||
270 | { | ||
271 | testFloat = new LSL_Types.LSLFloat(number); | ||
272 | testBool = testFloat; | ||
273 | |||
274 | Assert.IsTrue(testBool); | ||
275 | } | ||
276 | } | ||
277 | |||
278 | /// <summary> | ||
279 | /// Tests LSLFloat is correctly cast implicitly to Boolean if zero. | ||
280 | /// </summary> | ||
281 | [Test] | ||
282 | public void TestImplicitCastLSLFloatToBooleanFalse() | ||
283 | { | ||
284 | LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); | ||
285 | bool testBool = testFloat; | ||
286 | |||
287 | Assert.IsFalse(testBool); | ||
288 | } | ||
289 | |||
290 | /// <summary> | ||
291 | /// Tests integer is correctly cast implicitly to LSLFloat. | ||
292 | /// </summary> | ||
293 | [Test] | ||
294 | public void TestImplicitCastIntToLSLFloat() | ||
295 | { | ||
296 | LSL_Types.LSLFloat testFloat; | ||
297 | |||
298 | foreach (int number in m_intList) | ||
299 | { | ||
300 | testFloat = number; | ||
301 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); | ||
302 | } | ||
303 | } | ||
304 | |||
305 | /// <summary> | ||
306 | /// Tests LSLInteger is correctly cast implicitly to LSLFloat. | ||
307 | /// </summary> | ||
308 | [Test] | ||
309 | public void TestImplicitCastLSLIntegerToLSLFloat() | ||
310 | { | ||
311 | LSL_Types.LSLFloat testFloat; | ||
312 | |||
313 | foreach (int number in m_intList) | ||
314 | { | ||
315 | testFloat = new LSL_Types.LSLInteger(number); | ||
316 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); | ||
317 | } | ||
318 | } | ||
319 | |||
320 | /// <summary> | ||
321 | /// Tests LSLInteger is correctly cast explicitly to LSLFloat. | ||
322 | /// </summary> | ||
323 | [Test] | ||
324 | public void TestExplicitCastLSLIntegerToLSLFloat() | ||
325 | { | ||
326 | LSL_Types.LSLFloat testFloat; | ||
327 | |||
328 | foreach (int number in m_intList) | ||
329 | { | ||
330 | testFloat = (LSL_Types.LSLFloat) new LSL_Types.LSLInteger(number); | ||
331 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); | ||
332 | } | ||
333 | } | ||
334 | |||
335 | /// <summary> | ||
336 | /// Tests string is correctly cast explicitly to LSLFloat. | ||
337 | /// </summary> | ||
338 | [Test] | ||
339 | public void TestExplicitCastStringToLSLFloat() | ||
340 | { | ||
341 | LSL_Types.LSLFloat testFloat; | ||
342 | |||
343 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) | ||
344 | { | ||
345 | testFloat = (LSL_Types.LSLFloat) number.Key; | ||
346 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); | ||
347 | } | ||
348 | } | ||
349 | |||
350 | /// <summary> | ||
351 | /// Tests LSLString is correctly cast implicitly to LSLFloat. | ||
352 | /// </summary> | ||
353 | [Test] | ||
354 | public void TestExplicitCastLSLStringToLSLFloat() | ||
355 | { | ||
356 | LSL_Types.LSLFloat testFloat; | ||
357 | |||
358 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) | ||
359 | { | ||
360 | testFloat = (LSL_Types.LSLFloat) new LSL_Types.LSLString(number.Key); | ||
361 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); | ||
362 | } | ||
363 | } | ||
364 | |||
365 | /// <summary> | ||
366 | /// Tests double is correctly cast implicitly to LSLFloat. | ||
367 | /// </summary> | ||
368 | [Test] | ||
369 | public void TestImplicitCastDoubleToLSLFloat() | ||
370 | { | ||
371 | LSL_Types.LSLFloat testFloat; | ||
372 | |||
373 | foreach (double number in m_doubleList) | ||
374 | { | ||
375 | testFloat = number; | ||
376 | Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); | ||
377 | } | ||
378 | } | ||
379 | |||
380 | /// <summary> | ||
381 | /// Tests LSLFloat is correctly cast implicitly to double. | ||
382 | /// </summary> | ||
383 | [Test] | ||
384 | public void TestImplicitCastLSLFloatToDouble() | ||
385 | { | ||
386 | double testNumber; | ||
387 | LSL_Types.LSLFloat testFloat; | ||
388 | |||
389 | foreach (double number in m_doubleList) | ||
390 | { | ||
391 | testFloat = new LSL_Types.LSLFloat(number); | ||
392 | testNumber = testFloat; | ||
393 | |||
394 | Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); | ||
395 | } | ||
396 | } | ||
397 | |||
398 | /// <summary> | ||
399 | /// Tests the equality (==) operator. | ||
400 | /// </summary> | ||
401 | [Test] | ||
402 | public void TestEqualsOperator() | ||
403 | { | ||
404 | LSL_Types.LSLFloat testFloatA, testFloatB; | ||
405 | |||
406 | foreach (double number in m_doubleList) | ||
407 | { | ||
408 | testFloatA = new LSL_Types.LSLFloat(number); | ||
409 | testFloatB = new LSL_Types.LSLFloat(number); | ||
410 | Assert.IsTrue(testFloatA == testFloatB); | ||
411 | |||
412 | testFloatB = new LSL_Types.LSLFloat(number + 1.0); | ||
413 | Assert.IsFalse(testFloatA == testFloatB); | ||
414 | } | ||
415 | } | ||
416 | |||
417 | /// <summary> | ||
418 | /// Tests the inequality (!=) operator. | ||
419 | /// </summary> | ||
420 | [Test] | ||
421 | public void TestNotEqualOperator() | ||
422 | { | ||
423 | LSL_Types.LSLFloat testFloatA, testFloatB; | ||
424 | |||
425 | foreach (double number in m_doubleList) | ||
426 | { | ||
427 | testFloatA = new LSL_Types.LSLFloat(number); | ||
428 | testFloatB = new LSL_Types.LSLFloat(number + 1.0); | ||
429 | Assert.IsTrue(testFloatA != testFloatB); | ||
430 | |||
431 | testFloatB = new LSL_Types.LSLFloat(number); | ||
432 | Assert.IsFalse(testFloatA != testFloatB); | ||
433 | } | ||
434 | } | ||
435 | |||
436 | /// <summary> | ||
437 | /// Tests the increment operator. | ||
438 | /// </summary> | ||
439 | [Test] | ||
440 | public void TestIncrementOperator() | ||
441 | { | ||
442 | LSL_Types.LSLFloat testFloat; | ||
443 | double testNumber; | ||
444 | |||
445 | foreach (double number in m_doubleList) | ||
446 | { | ||
447 | testFloat = new LSL_Types.LSLFloat(number); | ||
448 | |||
449 | testNumber = testFloat++; | ||
450 | Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); | ||
451 | |||
452 | testNumber = testFloat; | ||
453 | Assert.That(testNumber, new DoubleToleranceConstraint(number + 1.0, _lowPrecisionTolerance)); | ||
454 | |||
455 | testNumber = ++testFloat; | ||
456 | Assert.That(testNumber, new DoubleToleranceConstraint(number + 2.0, _lowPrecisionTolerance)); | ||
457 | } | ||
458 | } | ||
459 | |||
460 | /// <summary> | ||
461 | /// Tests the decrement operator. | ||
462 | /// </summary> | ||
463 | [Test] | ||
464 | public void TestDecrementOperator() | ||
465 | { | ||
466 | LSL_Types.LSLFloat testFloat; | ||
467 | double testNumber; | ||
468 | |||
469 | foreach (double number in m_doubleList) | ||
470 | { | ||
471 | testFloat = new LSL_Types.LSLFloat(number); | ||
472 | |||
473 | testNumber = testFloat--; | ||
474 | Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); | ||
475 | |||
476 | testNumber = testFloat; | ||
477 | Assert.That(testNumber, new DoubleToleranceConstraint(number - 1.0, _lowPrecisionTolerance)); | ||
478 | |||
479 | testNumber = --testFloat; | ||
480 | Assert.That(testNumber, new DoubleToleranceConstraint(number - 2.0, _lowPrecisionTolerance)); | ||
481 | } | ||
482 | } | ||
483 | |||
484 | /// <summary> | ||
485 | /// Tests LSLFloat.ToString(). | ||
486 | /// </summary> | ||
487 | [Test] | ||
488 | public void TestToString() | ||
489 | { | ||
490 | LSL_Types.LSLFloat testFloat; | ||
491 | |||
492 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) | ||
493 | { | ||
494 | testFloat = new LSL_Types.LSLFloat(number.Key); | ||
495 | Assert.AreEqual(number.Value, testFloat.ToString()); | ||
496 | } | ||
497 | } | ||
498 | |||
499 | /// <summary> | ||
500 | /// Tests addition of two LSLFloats. | ||
501 | /// </summary> | ||
502 | [Test] | ||
503 | public void TestAddTwoLSLFloats() | ||
504 | { | ||
505 | LSL_Types.LSLFloat testResult; | ||
506 | |||
507 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | ||
508 | { | ||
509 | testResult = new LSL_Types.LSLFloat(number.Key) + new LSL_Types.LSLFloat(number.Value); | ||
510 | Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key + number.Value, _lowPrecisionTolerance)); | ||
511 | } | ||
512 | } | ||
513 | |||
514 | /// <summary> | ||
515 | /// Tests subtraction of two LSLFloats. | ||
516 | /// </summary> | ||
517 | [Test] | ||
518 | public void TestSubtractTwoLSLFloats() | ||
519 | { | ||
520 | LSL_Types.LSLFloat testResult; | ||
521 | |||
522 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | ||
523 | { | ||
524 | testResult = new LSL_Types.LSLFloat(number.Key) - new LSL_Types.LSLFloat(number.Value); | ||
525 | Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key - number.Value, _lowPrecisionTolerance)); | ||
526 | } | ||
527 | } | ||
528 | |||
529 | /// <summary> | ||
530 | /// Tests multiplication of two LSLFloats. | ||
531 | /// </summary> | ||
532 | [Test] | ||
533 | public void TestMultiplyTwoLSLFloats() | ||
534 | { | ||
535 | LSL_Types.LSLFloat testResult; | ||
536 | |||
537 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | ||
538 | { | ||
539 | testResult = new LSL_Types.LSLFloat(number.Key) * new LSL_Types.LSLFloat(number.Value); | ||
540 | Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key * number.Value, _lowPrecisionTolerance)); | ||
541 | } | ||
542 | } | ||
543 | |||
544 | /// <summary> | ||
545 | /// Tests division of two LSLFloats. | ||
546 | /// </summary> | ||
547 | [Test] | ||
548 | public void TestDivideTwoLSLFloats() | ||
549 | { | ||
550 | LSL_Types.LSLFloat testResult; | ||
551 | |||
552 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | ||
553 | { | ||
554 | if (number.Value != 0.0) // Let's avoid divide by zero. | ||
555 | { | ||
556 | testResult = new LSL_Types.LSLFloat(number.Key) / new LSL_Types.LSLFloat(number.Value); | ||
557 | Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key / number.Value, _lowPrecisionTolerance)); | ||
558 | } | ||
559 | } | ||
560 | } | ||
561 | |||
562 | /// <summary> | ||
563 | /// Tests boolean correctly cast implicitly to LSLFloat. | ||
564 | /// </summary> | ||
565 | [Test] | ||
566 | public void TestImplicitCastBooleanToLSLFloat() | ||
567 | { | ||
568 | LSL_Types.LSLFloat testFloat; | ||
569 | |||
570 | testFloat = (1 == 0); | ||
571 | Assert.That(testFloat.value, new DoubleToleranceConstraint(0.0, _lowPrecisionTolerance)); | ||
572 | |||
573 | testFloat = (1 == 1); | ||
574 | Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); | ||
575 | |||
576 | testFloat = false; | ||
577 | Assert.That(testFloat.value, new DoubleToleranceConstraint(0.0, _lowPrecisionTolerance)); | ||
578 | |||
579 | testFloat = true; | ||
580 | Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); | ||
581 | } | ||
582 | } | ||
583 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLInteger.cs b/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLInteger.cs deleted file mode 100644 index a769608..0000000 --- a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLInteger.cs +++ /dev/null | |||
@@ -1,141 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Tests.Common; | ||
31 | using OpenSim.Region.ScriptEngine.Common; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.Common.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class LSL_TypesTestLSLInteger | ||
37 | { | ||
38 | private Dictionary<double, int> m_doubleIntSet; | ||
39 | private Dictionary<string, int> m_stringIntSet; | ||
40 | |||
41 | /// <summary> | ||
42 | /// Sets up dictionaries and arrays used in the tests. | ||
43 | /// </summary> | ||
44 | [TestFixtureSetUp] | ||
45 | public void SetUpDataSets() | ||
46 | { | ||
47 | m_doubleIntSet = new Dictionary<double, int>(); | ||
48 | m_doubleIntSet.Add(2.0, 2); | ||
49 | m_doubleIntSet.Add(-2.0, -2); | ||
50 | m_doubleIntSet.Add(0.0, 0); | ||
51 | m_doubleIntSet.Add(1.0, 1); | ||
52 | m_doubleIntSet.Add(-1.0, -1); | ||
53 | m_doubleIntSet.Add(999999999.0, 999999999); | ||
54 | m_doubleIntSet.Add(-99999999.0, -99999999); | ||
55 | |||
56 | m_stringIntSet = new Dictionary<string, int>(); | ||
57 | m_stringIntSet.Add("2", 2); | ||
58 | m_stringIntSet.Add("-2", -2); | ||
59 | m_stringIntSet.Add("0", 0); | ||
60 | m_stringIntSet.Add("1", 1); | ||
61 | m_stringIntSet.Add("-1", -1); | ||
62 | m_stringIntSet.Add("123.9", 123); | ||
63 | m_stringIntSet.Add("999999999", 999999999); | ||
64 | m_stringIntSet.Add("-99999999", -99999999); | ||
65 | m_stringIntSet.Add("", 0); | ||
66 | m_stringIntSet.Add("aa", 0); | ||
67 | m_stringIntSet.Add("42", 42); | ||
68 | m_stringIntSet.Add("42 is the answer", 42); | ||
69 | m_stringIntSet.Add(" 42", 42); | ||
70 | m_stringIntSet.Add("42,123,456", 42); | ||
71 | m_stringIntSet.Add("0xff", 255); | ||
72 | m_stringIntSet.Add("12345678900000", -1); | ||
73 | } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Tests LSLFloat is correctly cast explicitly to LSLInteger. | ||
77 | /// </summary> | ||
78 | [Test] | ||
79 | public void TestExplicitCastLSLFloatToLSLInteger() | ||
80 | { | ||
81 | LSL_Types.LSLInteger testInteger; | ||
82 | |||
83 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) | ||
84 | { | ||
85 | testInteger = (LSL_Types.LSLInteger) new LSL_Types.LSLFloat(number.Key); | ||
86 | Assert.AreEqual(testInteger.value, number.Value); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
91 | /// Tests string is correctly cast explicitly to LSLInteger. | ||
92 | /// </summary> | ||
93 | [Test] | ||
94 | public void TestExplicitCastStringToLSLInteger() | ||
95 | { | ||
96 | LSL_Types.LSLInteger testInteger; | ||
97 | |||
98 | foreach (KeyValuePair<string, int> number in m_stringIntSet) | ||
99 | { | ||
100 | testInteger = (LSL_Types.LSLInteger) number.Key; | ||
101 | Assert.AreEqual(testInteger.value, number.Value); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Tests LSLString is correctly cast explicitly to LSLInteger. | ||
107 | /// </summary> | ||
108 | [Test] | ||
109 | public void TestExplicitCastLSLStringToLSLInteger() | ||
110 | { | ||
111 | LSL_Types.LSLInteger testInteger; | ||
112 | |||
113 | foreach (KeyValuePair<string, int> number in m_stringIntSet) | ||
114 | { | ||
115 | testInteger = (LSL_Types.LSLInteger) new LSL_Types.LSLString(number.Key); | ||
116 | Assert.AreEqual(testInteger.value, number.Value); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | /// <summary> | ||
121 | /// Tests boolean correctly cast implicitly to LSLInteger. | ||
122 | /// </summary> | ||
123 | [Test] | ||
124 | public void TestImplicitCastBooleanToLSLInteger() | ||
125 | { | ||
126 | LSL_Types.LSLInteger testInteger; | ||
127 | |||
128 | testInteger = (1 == 0); | ||
129 | Assert.AreEqual(0, testInteger.value); | ||
130 | |||
131 | testInteger = (1 == 1); | ||
132 | Assert.AreEqual(1, testInteger.value); | ||
133 | |||
134 | testInteger = false; | ||
135 | Assert.AreEqual(0, testInteger.value); | ||
136 | |||
137 | testInteger = true; | ||
138 | Assert.AreEqual(1, testInteger.value); | ||
139 | } | ||
140 | } | ||
141 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLString.cs b/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLString.cs deleted file mode 100644 index 3aa52cb..0000000 --- a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestLSLString.cs +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Tests.Common; | ||
31 | using OpenSim.Region.ScriptEngine.Common; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.Common.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class LSL_TypesTestLSLString | ||
37 | { | ||
38 | private Dictionary<double, string> m_doubleStringSet; | ||
39 | |||
40 | /// <summary> | ||
41 | /// Sets up dictionaries and arrays used in the tests. | ||
42 | /// </summary> | ||
43 | [TestFixtureSetUp] | ||
44 | public void SetUpDataSets() | ||
45 | { | ||
46 | m_doubleStringSet = new Dictionary<double, string>(); | ||
47 | m_doubleStringSet.Add(2, "2.000000"); | ||
48 | m_doubleStringSet.Add(-2, "-2.000000"); | ||
49 | m_doubleStringSet.Add(0, "0.000000"); | ||
50 | m_doubleStringSet.Add(1, "1.000000"); | ||
51 | m_doubleStringSet.Add(-1, "-1.000000"); | ||
52 | m_doubleStringSet.Add(999999999, "999999999.000000"); | ||
53 | m_doubleStringSet.Add(-99999999, "-99999999.000000"); | ||
54 | m_doubleStringSet.Add(0.5, "0.500000"); | ||
55 | m_doubleStringSet.Add(0.0005, "0.000500"); | ||
56 | m_doubleStringSet.Add(0.6805, "0.680500"); | ||
57 | m_doubleStringSet.Add(-0.5, "-0.500000"); | ||
58 | m_doubleStringSet.Add(-0.0005, "-0.000500"); | ||
59 | m_doubleStringSet.Add(-0.6805, "-0.680500"); | ||
60 | m_doubleStringSet.Add(548.5, "548.500000"); | ||
61 | m_doubleStringSet.Add(2.0005, "2.000500"); | ||
62 | m_doubleStringSet.Add(349485435.6805, "349485435.680500"); | ||
63 | m_doubleStringSet.Add(-548.5, "-548.500000"); | ||
64 | m_doubleStringSet.Add(-2.0005, "-2.000500"); | ||
65 | m_doubleStringSet.Add(-349485435.6805, "-349485435.680500"); | ||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Tests constructing a LSLString from an LSLFloat. | ||
70 | /// </summary> | ||
71 | [Test] | ||
72 | public void TestConstructFromLSLFloat() | ||
73 | { | ||
74 | LSL_Types.LSLString testString; | ||
75 | |||
76 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) | ||
77 | { | ||
78 | testString = new LSL_Types.LSLString(new LSL_Types.LSLFloat(number.Key)); | ||
79 | Assert.AreEqual(number.Value, testString.m_string); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | /// <summary> | ||
84 | /// Tests constructing a LSLString from an LSLFloat. | ||
85 | /// </summary> | ||
86 | [Test] | ||
87 | public void TestExplicitCastLSLFloatToLSLString() | ||
88 | { | ||
89 | LSL_Types.LSLString testString; | ||
90 | |||
91 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) | ||
92 | { | ||
93 | testString = (LSL_Types.LSLString) new LSL_Types.LSLFloat(number.Key); | ||
94 | Assert.AreEqual(number.Value, testString.m_string); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Test constructing a Quaternion from a string. | ||
100 | /// </summary> | ||
101 | [Test] | ||
102 | public void TestExplicitCastLSLStringToQuaternion() | ||
103 | { | ||
104 | string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>"; | ||
105 | LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString); | ||
106 | |||
107 | LSL_Types.Quaternion expectedQuaternion = new LSL_Types.Quaternion(0.0, 0.70711, 0.0, 0.70711); | ||
108 | LSL_Types.Quaternion stringQuaternion = (LSL_Types.Quaternion) quaternionString; | ||
109 | LSL_Types.Quaternion LSLStringQuaternion = (LSL_Types.Quaternion) quaternionLSLString; | ||
110 | |||
111 | Assert.AreEqual(expectedQuaternion, stringQuaternion); | ||
112 | Assert.AreEqual(expectedQuaternion, LSLStringQuaternion); | ||
113 | } | ||
114 | |||
115 | /// <summary> | ||
116 | /// Tests boolean correctly cast explicitly to LSLString. | ||
117 | /// </summary> | ||
118 | [Test] | ||
119 | public void TestImplicitCastBooleanToLSLFloat() | ||
120 | { | ||
121 | LSL_Types.LSLString testString; | ||
122 | |||
123 | testString = (LSL_Types.LSLString) (1 == 0); | ||
124 | Assert.AreEqual("0", testString.m_string); | ||
125 | |||
126 | testString = (LSL_Types.LSLString) (1 == 1); | ||
127 | Assert.AreEqual("1", testString.m_string); | ||
128 | |||
129 | testString = (LSL_Types.LSLString) false; | ||
130 | Assert.AreEqual("0", testString.m_string); | ||
131 | |||
132 | testString = (LSL_Types.LSLString) true; | ||
133 | Assert.AreEqual("1", testString.m_string); | ||
134 | } | ||
135 | } | ||
136 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestList.cs deleted file mode 100644 index 500d19a..0000000 --- a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestList.cs +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Tests.Common; | ||
31 | using OpenSim.Region.ScriptEngine.Common; | ||
32 | |||
33 | namespace OpenSim.Region.ScriptEngine.Common.Tests | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Tests the LSL_Types.list class. | ||
37 | /// </summary> | ||
38 | [TestFixture] | ||
39 | public class LSL_TypesTestList | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Tests concatenating a string to a list. | ||
43 | /// </summary> | ||
44 | [Test] | ||
45 | public void TestConcatenateString() | ||
46 | { | ||
47 | LSL_Types.list testList = new LSL_Types.list(1, 'a', "test"); | ||
48 | testList += new LSL_Types.LSLString("addition"); | ||
49 | |||
50 | Assert.AreEqual(4, testList.Length); | ||
51 | Assert.AreEqual(new LSL_Types.LSLString("addition"), testList.Data[3]); | ||
52 | Assert.AreEqual(typeof(LSL_Types.LSLString), testList.Data[3].GetType()); | ||
53 | |||
54 | LSL_Types.list secondTestList = testList + new LSL_Types.LSLString("more"); | ||
55 | |||
56 | Assert.AreEqual(5, secondTestList.Length); | ||
57 | Assert.AreEqual(new LSL_Types.LSLString("more"), secondTestList.Data[4]); | ||
58 | Assert.AreEqual(typeof(LSL_Types.LSLString), secondTestList.Data[4].GetType()); | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Tests concatenating an integer to a list. | ||
63 | /// </summary> | ||
64 | [Test] | ||
65 | public void TestConcatenateInteger() | ||
66 | { | ||
67 | LSL_Types.list testList = new LSL_Types.list(1, 'a', "test"); | ||
68 | testList += new LSL_Types.LSLInteger(20); | ||
69 | |||
70 | Assert.AreEqual(4, testList.Length); | ||
71 | Assert.AreEqual(new LSL_Types.LSLInteger(20), testList.Data[3]); | ||
72 | Assert.AreEqual(typeof(LSL_Types.LSLInteger), testList.Data[3].GetType()); | ||
73 | |||
74 | LSL_Types.list secondTestList = testList + new LSL_Types.LSLInteger(2); | ||
75 | |||
76 | Assert.AreEqual(5, secondTestList.Length); | ||
77 | Assert.AreEqual(new LSL_Types.LSLInteger(2), secondTestList.Data[4]); | ||
78 | Assert.AreEqual(typeof(LSL_Types.LSLInteger), secondTestList.Data[4].GetType()); | ||
79 | } | ||
80 | |||
81 | /// <summary> | ||
82 | /// Tests concatenating a double to a list. | ||
83 | /// </summary> | ||
84 | [Test] | ||
85 | public void TestConcatenateDouble() | ||
86 | { | ||
87 | LSL_Types.list testList = new LSL_Types.list(1, 'a', "test"); | ||
88 | testList += new LSL_Types.LSLFloat(2.0); | ||
89 | |||
90 | Assert.AreEqual(4, testList.Length); | ||
91 | Assert.AreEqual(new LSL_Types.LSLFloat(2.0), testList.Data[3]); | ||
92 | Assert.AreEqual(typeof(LSL_Types.LSLFloat), testList.Data[3].GetType()); | ||
93 | |||
94 | LSL_Types.list secondTestList = testList + new LSL_Types.LSLFloat(0.04); | ||
95 | |||
96 | Assert.AreEqual(5, secondTestList.Length); | ||
97 | Assert.AreEqual(new LSL_Types.LSLFloat(0.04), secondTestList.Data[4]); | ||
98 | Assert.AreEqual(typeof(LSL_Types.LSLFloat), secondTestList.Data[4].GetType()); | ||
99 | } | ||
100 | } | ||
101 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestVector3.cs b/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestVector3.cs deleted file mode 100644 index 0a41f92..0000000 --- a/OpenSim/Region/ScriptEngine/Common/Tests/LSL_TypesTestVector3.cs +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Tests.Common; | ||
31 | using OpenSim.Region.ScriptEngine.Common; | ||
32 | using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; | ||
33 | |||
34 | namespace OpenSim.Region.ScriptEngine.Common.Tests | ||
35 | { | ||
36 | [TestFixture] | ||
37 | public class LSL_TypesTestVector3 | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Tests for Vector3 | ||
41 | /// </summary> | ||
42 | [Test] | ||
43 | public void TestDotProduct() | ||
44 | { | ||
45 | // The numbers we test for. | ||
46 | 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> * <0, 0, 0>", 0.0); | ||
49 | |||
50 | double result; | ||
51 | string[] parts; | ||
52 | string[] delim = { "*" }; | ||
53 | |||
54 | foreach (KeyValuePair<string, double> ex in expectsSet) | ||
55 | { | ||
56 | parts = ex.Key.Split(delim, System.StringSplitOptions.None); | ||
57 | result = new vector(parts[0]) * new vector(parts[1]); | ||
58 | Assert.AreEqual(ex.Value, result); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | [Test] | ||
63 | public void TestUnaryMinusOperator() | ||
64 | { | ||
65 | Assert.AreEqual(new vector(-1, -1, -1), - (new vector(1, 1, 1))); | ||
66 | Assert.AreEqual(new vector(0, 0, 0), - (new vector(0, 0, 0))); | ||
67 | } | ||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index d689f93..803fdb1 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -332,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
332 | private static string CreateJSCompilerScript(string compileScript) | 332 | private static string CreateJSCompilerScript(string compileScript) |
333 | { | 333 | { |
334 | compileScript = String.Empty + | 334 | compileScript = String.Empty + |
335 | "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" + | 335 | "import OpenSim.Region.ScriptEngine.Common; import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" + |
336 | "package SecondLife {\r\n" + | 336 | "package SecondLife {\r\n" + |
337 | "class Script extends OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" + | 337 | "class Script extends OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" + |
338 | compileScript + | 338 | compileScript + |
@@ -343,7 +343,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
343 | private static string CreateCSCompilerScript(string compileScript) | 343 | private static string CreateCSCompilerScript(string compileScript) |
344 | { | 344 | { |
345 | compileScript = String.Empty + | 345 | compileScript = String.Empty + |
346 | "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + | 346 | "using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + |
347 | String.Empty + "namespace SecondLife { " + | 347 | String.Empty + "namespace SecondLife { " + |
348 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" + | 348 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" + |
349 | @"public Script() { } " + | 349 | @"public Script() { } " + |
@@ -356,7 +356,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
356 | { | 356 | { |
357 | compileScript = String.Empty + | 357 | compileScript = String.Empty + |
358 | "using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " + | 358 | "using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " + |
359 | "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" + | 359 | "using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" + |
360 | String.Empty + "namespace SecondLife { " + | 360 | String.Empty + "namespace SecondLife { " + |
361 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" + | 361 | String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass { \r\n" + |
362 | //@"public Script() { } " + | 362 | //@"public Script() { } " + |
@@ -371,7 +371,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
371 | private static string CreateVBCompilerScript(string compileScript) | 371 | private static string CreateVBCompilerScript(string compileScript) |
372 | { | 372 | { |
373 | compileScript = String.Empty + | 373 | compileScript = String.Empty + |
374 | "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " + | 374 | "Imports OpenSim.Region.ScriptEngine.Common: Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + |
375 | String.Empty + "NameSpace SecondLife:" + | 375 | String.Empty + "NameSpace SecondLife:" + |
376 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass: " + | 376 | String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.BuiltIn_Commands_BaseClass: " + |
377 | "\r\nPublic Sub New()\r\nEnd Sub: " + | 377 | "\r\nPublic Sub New()\r\nEnd Sub: " + |
@@ -440,6 +440,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
440 | string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); | 440 | string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location); |
441 | //Console.WriteLine("Assembly location: " + rootPath); | 441 | //Console.WriteLine("Assembly location: " + rootPath); |
442 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); | 442 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); |
443 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); | ||
443 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); | 444 | parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); |
444 | 445 | ||
445 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); | 446 | //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index beba2e6..5bdc753 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -32,6 +32,7 @@ using OpenMetaverse; | |||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
34 | using OpenSim.Region.ScriptEngine.Common; | 34 | using OpenSim.Region.ScriptEngine.Common; |
35 | using OpenSim.Region.ScriptEngine.Shared; | ||
35 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 36 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
36 | 37 | ||
37 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 38 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |