aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTedd Hansen2008-01-01 11:28:56 +0000
committerTedd Hansen2008-01-01 11:28:56 +0000
commit9eba3d2f89110b5e3b8ce0f1c570cfd1a7c34e82 (patch)
treeb1964716ed844a358abd854f9f107ebe9f4f0a69 /OpenSim/Region
parent* You can add and remove a friend in standalone now within the same simulator... (diff)
downloadopensim-SC-9eba3d2f89110b5e3b8ce0f1c570cfd1a7c34e82.zip
opensim-SC-9eba3d2f89110b5e3b8ce0f1c570cfd1a7c34e82.tar.gz
opensim-SC-9eba3d2f89110b5e3b8ce0f1c570cfd1a7c34e82.tar.bz2
opensim-SC-9eba3d2f89110b5e3b8ce0f1c570cfd1a7c34e82.tar.xz
Fixed string issue in compiler
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs82
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs2
2 files changed, 49 insertions, 35 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 48523e4..612dae1 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -31,7 +31,7 @@ using System;
31namespace OpenSim.Region.ScriptEngine.Common 31namespace OpenSim.Region.ScriptEngine.Common
32{ 32{
33 [Serializable] 33 [Serializable]
34 public class LSL_Types 34 public partial class LSL_Types
35 { 35 {
36 36
37 // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain 37 // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain
@@ -47,9 +47,9 @@ namespace OpenSim.Region.ScriptEngine.Common
47 47
48 public Vector3(Vector3 vector) 48 public Vector3(Vector3 vector)
49 { 49 {
50 x = (float) vector.x; 50 x = (float)vector.x;
51 y = (float) vector.y; 51 y = (float)vector.y;
52 z = (float) vector.z; 52 z = (float)vector.z;
53 } 53 }
54 54
55 public Vector3(double X, double Y, double Z) 55 public Vector3(double X, double Y, double Z)
@@ -98,7 +98,7 @@ namespace OpenSim.Region.ScriptEngine.Common
98 { 98 {
99 if (!(o is Vector3)) return false; 99 if (!(o is Vector3)) return false;
100 100
101 Vector3 vector = (Vector3) o; 101 Vector3 vector = (Vector3)o;
102 102
103 return (x == vector.x && x == vector.x && z == vector.z); 103 return (x == vector.x && x == vector.x && z == vector.z);
104 } 104 }
@@ -120,16 +120,16 @@ namespace OpenSim.Region.ScriptEngine.Common
120 120
121 public static Vector3 operator *(Vector3 lhs, Vector3 rhs) 121 public static Vector3 operator *(Vector3 lhs, Vector3 rhs)
122 { 122 {
123 return new Vector3(lhs.x*rhs.x, lhs.y*rhs.y, lhs.z*rhs.z); 123 return new Vector3(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z);
124 } 124 }
125 125
126 public static Vector3 operator %(Vector3 v1, Vector3 v2) 126 public static Vector3 operator %(Vector3 v1, Vector3 v2)
127 { 127 {
128 //Cross product 128 //Cross product
129 Vector3 tv; 129 Vector3 tv;
130 tv.x = (v1.y*v2.z) - (v1.z*v2.y); 130 tv.x = (v1.y * v2.z) - (v1.z * v2.y);
131 tv.y = (v1.z*v2.x) - (v1.x*v2.z); 131 tv.y = (v1.z * v2.x) - (v1.x * v2.z);
132 tv.z = (v1.x*v2.y) - (v1.y*v2.x); 132 tv.z = (v1.x * v2.y) - (v1.y * v2.x);
133 return tv; 133 return tv;
134 } 134 }
135 135
@@ -140,19 +140,19 @@ namespace OpenSim.Region.ScriptEngine.Common
140 // Vector-Float and Float-Vector Math 140 // Vector-Float and Float-Vector Math
141 public static Vector3 operator *(Vector3 vec, float val) 141 public static Vector3 operator *(Vector3 vec, float val)
142 { 142 {
143 return new Vector3(vec.x*val, vec.y*val, vec.z*val); 143 return new Vector3(vec.x * val, vec.y * val, vec.z * val);
144 } 144 }
145 145
146 public static Vector3 operator *(float val, Vector3 vec) 146 public static Vector3 operator *(float val, Vector3 vec)
147 { 147 {
148 return new Vector3(vec.x*val, vec.y*val, vec.z*val); 148 return new Vector3(vec.x * val, vec.y * val, vec.z * val);
149 } 149 }
150 150
151 public static Vector3 operator /(Vector3 v, float f) 151 public static Vector3 operator /(Vector3 v, float f)
152 { 152 {
153 v.x = v.x/f; 153 v.x = v.x / f;
154 v.y = v.y/f; 154 v.y = v.y / f;
155 v.z = v.z/f; 155 v.z = v.z / f;
156 return v; 156 return v;
157 } 157 }
158 158
@@ -188,7 +188,7 @@ namespace OpenSim.Region.ScriptEngine.Common
188 Quaternion vq = new Quaternion(v.x, v.y, v.z, 0); 188 Quaternion vq = new Quaternion(v.x, v.y, v.z, 0);
189 Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s); 189 Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s);
190 190
191 Quaternion result = (r*vq)*nq; 191 Quaternion result = (r * vq) * nq;
192 192
193 return new Vector3(result.x, result.y, result.z); 193 return new Vector3(result.x, result.y, result.z);
194 } 194 }
@@ -200,7 +200,7 @@ namespace OpenSim.Region.ScriptEngine.Common
200 Quaternion vq = new Quaternion(vec.x, vec.y, vec.z, 0); 200 Quaternion vq = new Quaternion(vec.x, vec.y, vec.z, 0);
201 Quaternion nq = new Quaternion(-quat.x, -quat.y, -quat.z, quat.s); 201 Quaternion nq = new Quaternion(-quat.x, -quat.y, -quat.z, quat.s);
202 202
203 Quaternion result = (quat*vq)*nq; 203 Quaternion result = (quat * vq) * nq;
204 204
205 return new Vector3(result.x, result.y, result.z); 205 return new Vector3(result.x, result.y, result.z);
206 } 206 }
@@ -211,28 +211,28 @@ namespace OpenSim.Region.ScriptEngine.Common
211 211
212 public static double Dot(Vector3 v1, Vector3 v2) 212 public static double Dot(Vector3 v1, Vector3 v2)
213 { 213 {
214 return (v1.x*v2.x) + (v1.y*v2.y) + (v1.z*v2.z); 214 return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z);
215 } 215 }
216 216
217 public static Vector3 Cross(Vector3 v1, Vector3 v2) 217 public static Vector3 Cross(Vector3 v1, Vector3 v2)
218 { 218 {
219 return new Vector3 219 return new Vector3
220 ( 220 (
221 v1.y*v2.z - v1.z*v2.y, 221 v1.y * v2.z - v1.z * v2.y,
222 v1.z*v2.x - v1.x*v2.z, 222 v1.z * v2.x - v1.x * v2.z,
223 v1.x*v2.y - v1.y*v2.x 223 v1.x * v2.y - v1.y * v2.x
224 ); 224 );
225 } 225 }
226 226
227 public static float Mag(Vector3 v) 227 public static float Mag(Vector3 v)
228 { 228 {
229 return (float) Math.Sqrt(v.x*v.y + v.y*v.y + v.z*v.z); 229 return (float)Math.Sqrt(v.x * v.y + v.y * v.y + v.z * v.z);
230 } 230 }
231 231
232 public static Vector3 Norm(Vector3 vector) 232 public static Vector3 Norm(Vector3 vector)
233 { 233 {
234 float mag = Mag(vector); 234 float mag = Mag(vector);
235 return new Vector3(vector.x/mag, vector.y/mag, vector.z/mag); 235 return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag);
236 } 236 }
237 237
238 #endregion 238 #endregion
@@ -250,10 +250,10 @@ namespace OpenSim.Region.ScriptEngine.Common
250 250
251 public Quaternion(Quaternion Quat) 251 public Quaternion(Quaternion Quat)
252 { 252 {
253 x = (float) Quat.x; 253 x = (float)Quat.x;
254 y = (float) Quat.y; 254 y = (float)Quat.y;
255 z = (float) Quat.z; 255 z = (float)Quat.z;
256 s = (float) Quat.s; 256 s = (float)Quat.s;
257 } 257 }
258 258
259 public Quaternion(double X, double Y, double Z, double S) 259 public Quaternion(double X, double Y, double Z, double S)
@@ -276,7 +276,7 @@ namespace OpenSim.Region.ScriptEngine.Common
276 res = res & Double.TryParse(tmps[3], out s); 276 res = res & Double.TryParse(tmps[3], out s);
277 } 277 }
278 278
279 #endregion 279 #endregion
280 280
281 #region Overriders 281 #region Overriders
282 282
@@ -289,7 +289,7 @@ namespace OpenSim.Region.ScriptEngine.Common
289 { 289 {
290 if (!(o is Quaternion)) return false; 290 if (!(o is Quaternion)) return false;
291 291
292 Quaternion quaternion = (Quaternion) o; 292 Quaternion quaternion = (Quaternion)o;
293 293
294 return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s; 294 return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s;
295 } 295 }
@@ -315,10 +315,10 @@ namespace OpenSim.Region.ScriptEngine.Common
315 public static Quaternion operator *(Quaternion a, Quaternion b) 315 public static Quaternion operator *(Quaternion a, Quaternion b)
316 { 316 {
317 Quaternion c; 317 Quaternion c;
318 c.x = a.s*b.x + a.x*b.s + a.y*b.z - a.z*b.y; 318 c.x = a.s * b.x + a.x * b.s + a.y * b.z - a.z * b.y;
319 c.y = a.s*b.y + a.y*b.s + a.z*b.x - a.x*b.z; 319 c.y = a.s * b.y + a.y * b.s + a.z * b.x - a.x * b.z;
320 c.z = a.s*b.z + a.z*b.s + a.x*b.y - a.y*b.x; 320 c.z = a.s * b.z + a.z * b.s + a.x * b.y - a.y * b.x;
321 c.s = a.s*b.s - a.x*b.x - a.y*b.y - a.z*b.z; 321 c.s = a.s * b.s - a.x * b.x - a.y * b.y - a.z * b.z;
322 return c; 322 return c;
323 } 323 }
324 } 324 }
@@ -411,7 +411,7 @@ namespace OpenSim.Region.ScriptEngine.Common
411 output = "["; 411 output = "[";
412 foreach (object o in m_data) 412 foreach (object o in m_data)
413 { 413 {
414 if (o.GetType().ToString() == "System.String") 414 if (o is System.String)
415 { 415 {
416 output = output + "\"" + o + "\", "; 416 output = output + "\"" + o + "\", ";
417 } 417 }
@@ -438,12 +438,26 @@ namespace OpenSim.Region.ScriptEngine.Common
438 output = output + o.ToString(); 438 output = output + o.ToString();
439 } 439 }
440 return output; 440 return output;
441
441 } 442 }
442 443
443 public class String 444 public struct String
444 { 445 {
446 // Our own little string
447 internal string actualString;
448 public static implicit operator bool(String mString)
449 {
450 if (mString.actualString.Length == 0)
451 return true;
452 return false;
453 }
454 public override string ToString()
455 {
456 return actualString;
457 }
445 458
446 } 459 }
460
447 } 461 }
448 } 462 }
449} 463}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 109b8e2..dfdf8f4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
47 dataTypes.Add("void", "void"); 47 dataTypes.Add("void", "void");
48 dataTypes.Add("integer", "int"); 48 dataTypes.Add("integer", "int");
49 dataTypes.Add("float", "double"); 49 dataTypes.Add("float", "double");
50 dataTypes.Add("string", "LSL_Types.String"); 50 dataTypes.Add("string", "string");
51 dataTypes.Add("key", "string"); 51 dataTypes.Add("key", "string");
52 dataTypes.Add("vector", "LSL_Types.Vector3"); 52 dataTypes.Add("vector", "LSL_Types.Vector3");
53 dataTypes.Add("rotation", "LSL_Types.Quaternion"); 53 dataTypes.Add("rotation", "LSL_Types.Quaternion");