diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs | 186 |
1 files changed, 101 insertions, 85 deletions
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs index 8a43cc1..0b6970a 100644 --- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs +++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs | |||
@@ -27,8 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | 30 | ||
33 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | 31 | namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO |
34 | { | 32 | { |
@@ -53,6 +51,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
53 | LocalVariables.Remove(index); | 51 | LocalVariables.Remove(index); |
54 | LocalVariables.Add(index, LSLStack.Peek()); | 52 | LocalVariables.Add(index, LSLStack.Peek()); |
55 | } | 53 | } |
54 | |||
56 | public void StoreToGlobal(UInt32 index) | 55 | public void StoreToGlobal(UInt32 index) |
57 | { | 56 | { |
58 | Common.SendToDebug("::StoreToGlobal " + index); | 57 | Common.SendToDebug("::StoreToGlobal " + index); |
@@ -60,6 +59,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
60 | GlobalVariables.Remove(index); | 59 | GlobalVariables.Remove(index); |
61 | GlobalVariables.Add(index, LSLStack.Peek()); | 60 | GlobalVariables.Add(index, LSLStack.Peek()); |
62 | } | 61 | } |
62 | |||
63 | public void StoreToStatic(UInt32 index) | 63 | public void StoreToStatic(UInt32 index) |
64 | { | 64 | { |
65 | Common.SendToDebug("::StoreToStatic " + index); | 65 | Common.SendToDebug("::StoreToStatic " + index); |
@@ -67,6 +67,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
67 | // StaticVariables.Remove(index); | 67 | // StaticVariables.Remove(index); |
68 | StaticVariables.Add(index, LSLStack.Peek()); | 68 | StaticVariables.Add(index, LSLStack.Peek()); |
69 | } | 69 | } |
70 | |||
70 | public void GetFromLocal(UInt32 index) | 71 | public void GetFromLocal(UInt32 index) |
71 | { | 72 | { |
72 | // TODO: How to determine local? | 73 | // TODO: How to determine local? |
@@ -76,6 +77,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
76 | LSLStack.Push(ret); | 77 | LSLStack.Push(ret); |
77 | //return ret; | 78 | //return ret; |
78 | } | 79 | } |
80 | |||
79 | public void GetFromGlobal(UInt32 index) | 81 | public void GetFromGlobal(UInt32 index) |
80 | { | 82 | { |
81 | Common.SendToDebug("::GetFromGlobal " + index); | 83 | Common.SendToDebug("::GetFromGlobal " + index); |
@@ -84,6 +86,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
84 | LSLStack.Push(ret); | 86 | LSLStack.Push(ret); |
85 | //return ret; | 87 | //return ret; |
86 | } | 88 | } |
89 | |||
87 | public void GetFromStatic(UInt32 index) | 90 | public void GetFromStatic(UInt32 index) |
88 | { | 91 | { |
89 | Common.SendToDebug("::GetFromStatic " + index); | 92 | Common.SendToDebug("::GetFromStatic " + index); |
@@ -99,22 +102,22 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
99 | Common.SendToDebug("::POPToStack"); | 102 | Common.SendToDebug("::POPToStack"); |
100 | //return LSLStack.Pop(); | 103 | //return LSLStack.Pop(); |
101 | object p = LSLStack.Pop(); | 104 | object p = LSLStack.Pop(); |
102 | if (p.GetType() == typeof(UInt32)) | 105 | if (p.GetType() == typeof (UInt32)) |
103 | return (UInt32)p; | 106 | return (UInt32) p; |
104 | if (p.GetType() == typeof(string)) | 107 | if (p.GetType() == typeof (string)) |
105 | return (string)p; | 108 | return (string) p; |
106 | if (p.GetType() == typeof(Int32)) | 109 | if (p.GetType() == typeof (Int32)) |
107 | return (Int32)p; | 110 | return (Int32) p; |
108 | if (p.GetType() == typeof(UInt16)) | 111 | if (p.GetType() == typeof (UInt16)) |
109 | return (UInt16)p; | 112 | return (UInt16) p; |
110 | if (p.GetType() == typeof(float)) | 113 | if (p.GetType() == typeof (float)) |
111 | return (float)p; | 114 | return (float) p; |
112 | if (p.GetType() == typeof(LSO_Enums.Vector)) | 115 | if (p.GetType() == typeof (LSO_Enums.Vector)) |
113 | return (LSO_Enums.Vector)p; | 116 | return (LSO_Enums.Vector) p; |
114 | if (p.GetType() == typeof(LSO_Enums.Rotation)) | 117 | if (p.GetType() == typeof (LSO_Enums.Rotation)) |
115 | return (LSO_Enums.Rotation)p; | 118 | return (LSO_Enums.Rotation) p; |
116 | if (p.GetType() == typeof(LSO_Enums.Key)) | 119 | if (p.GetType() == typeof (LSO_Enums.Key)) |
117 | return (LSO_Enums.Key)p; | 120 | return (LSO_Enums.Key) p; |
118 | 121 | ||
119 | return p; | 122 | return p; |
120 | } | 123 | } |
@@ -151,6 +154,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
151 | LSLStack.Pop(); | 154 | LSLStack.Pop(); |
152 | } | 155 | } |
153 | } | 156 | } |
157 | |||
154 | public void PUSH(object Param) | 158 | public void PUSH(object Param) |
155 | { | 159 | { |
156 | if (Param == null) | 160 | if (Param == null) |
@@ -159,205 +163,218 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
159 | } | 163 | } |
160 | else | 164 | else |
161 | { | 165 | { |
162 | |||
163 | //Common.SendToDebug("::PUSH: " + Param.GetType()); | 166 | //Common.SendToDebug("::PUSH: " + Param.GetType()); |
164 | } | 167 | } |
165 | 168 | ||
166 | LSLStack.Push(Param); | 169 | LSLStack.Push(Param); |
167 | } | 170 | } |
171 | |||
168 | public void ADD(UInt32 Param) | 172 | public void ADD(UInt32 Param) |
169 | { | 173 | { |
170 | Common.SendToDebug("::ADD: " + Param); | 174 | Common.SendToDebug("::ADD: " + Param); |
171 | object o2 = LSLStack.Pop(); | 175 | object o2 = LSLStack.Pop(); |
172 | object o1 = LSLStack.Pop(); | 176 | object o1 = LSLStack.Pop(); |
173 | Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + " (" + o2.ToString() + ")"); | 177 | Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + |
174 | if (o2.GetType() == typeof(string)) | 178 | " (" + o2.ToString() + ")"); |
179 | if (o2.GetType() == typeof (string)) | ||
175 | { | 180 | { |
176 | LSLStack.Push((string)o1 + (string)o2); | 181 | LSLStack.Push((string) o1 + (string) o2); |
177 | return; | 182 | return; |
178 | } | 183 | } |
179 | if (o2.GetType() == typeof(UInt32)) | 184 | if (o2.GetType() == typeof (UInt32)) |
180 | { | 185 | { |
181 | LSLStack.Push((UInt32)o1 + (UInt32)o2); | 186 | LSLStack.Push((UInt32) o1 + (UInt32) o2); |
182 | return; | 187 | return; |
183 | } | 188 | } |
184 | |||
185 | } | 189 | } |
190 | |||
186 | public void SUB(UInt32 Param) | 191 | public void SUB(UInt32 Param) |
187 | { | 192 | { |
188 | Common.SendToDebug("::SUB: " + Param); | 193 | Common.SendToDebug("::SUB: " + Param); |
189 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 194 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
190 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 195 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
191 | LSLStack.Push((UInt32)(i1 - i2)); | 196 | LSLStack.Push((UInt32) (i1 - i2)); |
192 | } | 197 | } |
198 | |||
193 | public void MUL(UInt32 Param) | 199 | public void MUL(UInt32 Param) |
194 | { | 200 | { |
195 | Common.SendToDebug("::SUB: " + Param); | 201 | Common.SendToDebug("::SUB: " + Param); |
196 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 202 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
197 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 203 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
198 | LSLStack.Push((UInt32)(i1 * i2)); | 204 | LSLStack.Push((UInt32) (i1*i2)); |
199 | } | 205 | } |
206 | |||
200 | public void DIV(UInt32 Param) | 207 | public void DIV(UInt32 Param) |
201 | { | 208 | { |
202 | Common.SendToDebug("::DIV: " + Param); | 209 | Common.SendToDebug("::DIV: " + Param); |
203 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 210 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
204 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 211 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
205 | LSLStack.Push((UInt32)(i1 / i2)); | 212 | LSLStack.Push((UInt32) (i1/i2)); |
206 | } | 213 | } |
207 | 214 | ||
208 | 215 | ||
209 | public void MOD(UInt32 Param) | 216 | public void MOD(UInt32 Param) |
210 | { | 217 | { |
211 | Common.SendToDebug("::MOD: " + Param); | 218 | Common.SendToDebug("::MOD: " + Param); |
212 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 219 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
213 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 220 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
214 | LSLStack.Push((UInt32)(i1 % i2)); | 221 | LSLStack.Push((UInt32) (i1%i2)); |
215 | } | 222 | } |
223 | |||
216 | public void EQ(UInt32 Param) | 224 | public void EQ(UInt32 Param) |
217 | { | 225 | { |
218 | Common.SendToDebug("::EQ: " + Param); | 226 | Common.SendToDebug("::EQ: " + Param); |
219 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 227 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
220 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 228 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
221 | if (i1 == i2) | 229 | if (i1 == i2) |
222 | { | 230 | { |
223 | LSLStack.Push((UInt32)1); | 231 | LSLStack.Push((UInt32) 1); |
224 | } | 232 | } |
225 | else | 233 | else |
226 | { | 234 | { |
227 | LSLStack.Push((UInt32)0); | 235 | LSLStack.Push((UInt32) 0); |
228 | } | 236 | } |
229 | } | 237 | } |
238 | |||
230 | public void NEQ(UInt32 Param) | 239 | public void NEQ(UInt32 Param) |
231 | { | 240 | { |
232 | Common.SendToDebug("::NEQ: " + Param); | 241 | Common.SendToDebug("::NEQ: " + Param); |
233 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 242 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
234 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 243 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
235 | if (i1 != i2) | 244 | if (i1 != i2) |
236 | { | 245 | { |
237 | LSLStack.Push((UInt32)1); | 246 | LSLStack.Push((UInt32) 1); |
238 | } | 247 | } |
239 | else | 248 | else |
240 | { | 249 | { |
241 | LSLStack.Push((UInt32)0); | 250 | LSLStack.Push((UInt32) 0); |
242 | } | 251 | } |
243 | } | 252 | } |
253 | |||
244 | public void LEQ(UInt32 Param) | 254 | public void LEQ(UInt32 Param) |
245 | { | 255 | { |
246 | Common.SendToDebug("::LEQ: " + Param); | 256 | Common.SendToDebug("::LEQ: " + Param); |
247 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 257 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
248 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 258 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
249 | if (i1 <= i2) | 259 | if (i1 <= i2) |
250 | { | 260 | { |
251 | LSLStack.Push((UInt32)1); | 261 | LSLStack.Push((UInt32) 1); |
252 | } | 262 | } |
253 | else | 263 | else |
254 | { | 264 | { |
255 | LSLStack.Push((UInt32)0); | 265 | LSLStack.Push((UInt32) 0); |
256 | } | 266 | } |
257 | } | 267 | } |
268 | |||
258 | public void GEQ(UInt32 Param) | 269 | public void GEQ(UInt32 Param) |
259 | { | 270 | { |
260 | Common.SendToDebug("::GEQ: " + Param); | 271 | Common.SendToDebug("::GEQ: " + Param); |
261 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 272 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
262 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 273 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
263 | if (i1 >= i2) | 274 | if (i1 >= i2) |
264 | { | 275 | { |
265 | LSLStack.Push((UInt32)1); | 276 | LSLStack.Push((UInt32) 1); |
266 | } | 277 | } |
267 | else | 278 | else |
268 | { | 279 | { |
269 | LSLStack.Push((UInt32)0); | 280 | LSLStack.Push((UInt32) 0); |
270 | } | 281 | } |
271 | } | 282 | } |
283 | |||
272 | public void LESS(UInt32 Param) | 284 | public void LESS(UInt32 Param) |
273 | { | 285 | { |
274 | Common.SendToDebug("::LESS: " + Param); | 286 | Common.SendToDebug("::LESS: " + Param); |
275 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 287 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
276 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 288 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
277 | if (i1 < i2) | 289 | if (i1 < i2) |
278 | { | 290 | { |
279 | LSLStack.Push((UInt32)1); | 291 | LSLStack.Push((UInt32) 1); |
280 | } | 292 | } |
281 | else | 293 | else |
282 | { | 294 | { |
283 | LSLStack.Push((UInt32)0); | 295 | LSLStack.Push((UInt32) 0); |
284 | } | 296 | } |
285 | } | 297 | } |
298 | |||
286 | public void GREATER(UInt32 Param) | 299 | public void GREATER(UInt32 Param) |
287 | { | 300 | { |
288 | Common.SendToDebug("::GREATER: " + Param); | 301 | Common.SendToDebug("::GREATER: " + Param); |
289 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 302 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
290 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 303 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
291 | if (i1 > i2) | 304 | if (i1 > i2) |
292 | { | 305 | { |
293 | LSLStack.Push((UInt32)1); | 306 | LSLStack.Push((UInt32) 1); |
294 | } | 307 | } |
295 | else | 308 | else |
296 | { | 309 | { |
297 | LSLStack.Push((UInt32)0); | 310 | LSLStack.Push((UInt32) 0); |
298 | } | 311 | } |
299 | } | 312 | } |
300 | 313 | ||
301 | 314 | ||
302 | |||
303 | public void BITAND() | 315 | public void BITAND() |
304 | { | 316 | { |
305 | Common.SendToDebug("::BITAND"); | 317 | Common.SendToDebug("::BITAND"); |
306 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 318 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
307 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 319 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
308 | LSLStack.Push((UInt32)(i1 & i2)); | 320 | LSLStack.Push((UInt32) (i1 & i2)); |
309 | } | 321 | } |
322 | |||
310 | public void BITOR() | 323 | public void BITOR() |
311 | { | 324 | { |
312 | Common.SendToDebug("::BITOR"); | 325 | Common.SendToDebug("::BITOR"); |
313 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 326 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
314 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 327 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
315 | LSLStack.Push((UInt32)(i1 | i2)); | 328 | LSLStack.Push((UInt32) (i1 | i2)); |
316 | } | 329 | } |
330 | |||
317 | public void BITXOR() | 331 | public void BITXOR() |
318 | { | 332 | { |
319 | Common.SendToDebug("::BITXOR"); | 333 | Common.SendToDebug("::BITXOR"); |
320 | UInt32 i2 = (UInt32)LSLStack.Pop(); | 334 | UInt32 i2 = (UInt32) LSLStack.Pop(); |
321 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 335 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
322 | LSLStack.Push((UInt32)(i1 ^ i2)); | 336 | LSLStack.Push((UInt32) (i1 ^ i2)); |
323 | } | 337 | } |
338 | |||
324 | public void BOOLAND() | 339 | public void BOOLAND() |
325 | { | 340 | { |
326 | Common.SendToDebug("::BOOLAND"); | 341 | Common.SendToDebug("::BOOLAND"); |
327 | bool b2 = bool.Parse((string)LSLStack.Pop()); | 342 | bool b2 = bool.Parse((string) LSLStack.Pop()); |
328 | bool b1 = bool.Parse((string)LSLStack.Pop()); | 343 | bool b1 = bool.Parse((string) LSLStack.Pop()); |
329 | if (b1 && b2) | 344 | if (b1 && b2) |
330 | { | 345 | { |
331 | LSLStack.Push((UInt32)1); | 346 | LSLStack.Push((UInt32) 1); |
332 | } | 347 | } |
333 | else | 348 | else |
334 | { | 349 | { |
335 | LSLStack.Push((UInt32)0); | 350 | LSLStack.Push((UInt32) 0); |
336 | } | 351 | } |
337 | } | 352 | } |
353 | |||
338 | public void BOOLOR() | 354 | public void BOOLOR() |
339 | { | 355 | { |
340 | Common.SendToDebug("::BOOLOR"); | 356 | Common.SendToDebug("::BOOLOR"); |
341 | bool b2 = bool.Parse((string)LSLStack.Pop()); | 357 | bool b2 = bool.Parse((string) LSLStack.Pop()); |
342 | bool b1 = bool.Parse((string)LSLStack.Pop()); | 358 | bool b1 = bool.Parse((string) LSLStack.Pop()); |
343 | 359 | ||
344 | if (b1 || b2) | 360 | if (b1 || b2) |
345 | { | 361 | { |
346 | LSLStack.Push((UInt32)1); | 362 | LSLStack.Push((UInt32) 1); |
347 | } | 363 | } |
348 | else | 364 | else |
349 | { | 365 | { |
350 | LSLStack.Push((UInt32)0); | 366 | LSLStack.Push((UInt32) 0); |
351 | } | 367 | } |
352 | |||
353 | } | 368 | } |
369 | |||
354 | public void NEG(UInt32 Param) | 370 | public void NEG(UInt32 Param) |
355 | { | 371 | { |
356 | Common.SendToDebug("::NEG: " + Param); | 372 | Common.SendToDebug("::NEG: " + Param); |
357 | //UInt32 i2 = (UInt32)LSLStack.Pop(); | 373 | //UInt32 i2 = (UInt32)LSLStack.Pop(); |
358 | UInt32 i1 = (UInt32)LSLStack.Pop(); | 374 | UInt32 i1 = (UInt32) LSLStack.Pop(); |
359 | LSLStack.Push((UInt32)(i1 * -1)); | 375 | LSLStack.Push((UInt32) (i1*-1)); |
360 | } | 376 | } |
377 | |||
361 | public void BITNOT() | 378 | public void BITNOT() |
362 | { | 379 | { |
363 | //Common.SendToDebug("::BITNOT"); | 380 | //Common.SendToDebug("::BITNOT"); |
@@ -365,6 +382,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
365 | //UInt32 i1 = (UInt32)LSLStack.Pop(); | 382 | //UInt32 i1 = (UInt32)LSLStack.Pop(); |
366 | //LSLStack.Push((UInt32)(i1 / i2)); | 383 | //LSLStack.Push((UInt32)(i1 / i2)); |
367 | } | 384 | } |
385 | |||
368 | public void BOOLNOT() | 386 | public void BOOLNOT() |
369 | { | 387 | { |
370 | //Common.SendToDebug("::BOOLNOT"); | 388 | //Common.SendToDebug("::BOOLNOT"); |
@@ -372,7 +390,5 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO | |||
372 | //UInt32 i1 = (UInt32)LSLStack.Pop(); | 390 | //UInt32 i1 = (UInt32)LSLStack.Pop(); |
373 | //LSLStack.Push((UInt32)(i1)); | 391 | //LSLStack.Push((UInt32)(i1)); |
374 | } | 392 | } |
375 | |||
376 | |||
377 | } | 393 | } |
378 | } | 394 | } \ No newline at end of file |