aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs394
1 files changed, 0 insertions, 394 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
deleted file mode 100644
index c805a01..0000000
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
+++ /dev/null
@@ -1,394 +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
29using System;
30
31namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
32{
33 public partial class LSL_BaseClass
34 {
35 /*
36 * OPCODES
37 *
38 * These are internal "assembly" commands,
39 * basic operators like "ADD", "PUSH" and "POP"
40 *
41 * It also contains managed stack and keeps track of internal variables, etc.
42 *
43 */
44
45
46 public void StoreToLocal(UInt32 index)
47 {
48 // TODO: How to determine local?
49 Common.SendToDebug("::StoreToLocal " + index);
50 if (LocalVariables.ContainsKey(index))
51 LocalVariables.Remove(index);
52 LocalVariables.Add(index, LSLStack.Peek());
53 }
54
55 public void StoreToGlobal(UInt32 index)
56 {
57 Common.SendToDebug("::StoreToGlobal " + index);
58 if (GlobalVariables.ContainsKey(index))
59 GlobalVariables.Remove(index);
60 GlobalVariables.Add(index, LSLStack.Peek());
61 }
62
63 public void StoreToStatic(UInt32 index)
64 {
65 Common.SendToDebug("::StoreToStatic " + index);
66 //if (StaticVariables.ContainsKey(index))
67 // StaticVariables.Remove(index);
68 StaticVariables.Add(index, LSLStack.Peek());
69 }
70
71 public void GetFromLocal(UInt32 index)
72 {
73 // TODO: How to determine local?
74 Common.SendToDebug("::GetFromLocal " + index);
75 object ret;
76 LocalVariables.TryGetValue(index, out ret);
77 LSLStack.Push(ret);
78 //return ret;
79 }
80
81 public void GetFromGlobal(UInt32 index)
82 {
83 Common.SendToDebug("::GetFromGlobal " + index);
84 object ret;
85 GlobalVariables.TryGetValue(index, out ret);
86 LSLStack.Push(ret);
87 //return ret;
88 }
89
90 public void GetFromStatic(UInt32 index)
91 {
92 Common.SendToDebug("::GetFromStatic " + index);
93 object ret;
94 StaticVariables.TryGetValue(index, out ret);
95 Common.SendToDebug("::GetFromStatic - ObjectType: " + ret.GetType().ToString());
96 LSLStack.Push(ret);
97 //return ret;
98 }
99
100 public object POPToStack()
101 {
102 Common.SendToDebug("::POPToStack");
103 //return LSLStack.Pop();
104 object p = LSLStack.Pop();
105 if (p.GetType() == typeof (UInt32))
106 return (UInt32) p;
107 if (p.GetType() == typeof (string))
108 return (string) p;
109 if (p.GetType() == typeof (Int32))
110 return (Int32) p;
111 if (p.GetType() == typeof (UInt16))
112 return (UInt16) p;
113 if (p.GetType() == typeof (float))
114 return (float) p;
115 if (p.GetType() == typeof (LSO_Enums.Vector))
116 return (LSO_Enums.Vector) p;
117 if (p.GetType() == typeof (LSO_Enums.Rotation))
118 return (LSO_Enums.Rotation) p;
119 if (p.GetType() == typeof (LSO_Enums.Key))
120 return (LSO_Enums.Key) p;
121
122 return p;
123 }
124
125 //public object POPToStack(UInt32 count)
126 //{
127 // // POP NUMBER FROM TOP OF STACK
128 // //LSLStack.SetLength(LSLStack.Length - 4);
129 // Common.SendToDebug("::POPToStack " + count);
130 // if (count < 2)
131 // return LSLStack.Pop();
132
133 // Stack<object> s = new Stack<object>();
134 // for (int i = 0; i < count; i++)
135 // {
136 // s.Push(LSLStack.Pop);
137
138 // }
139
140 //}
141
142 public void POP()
143 {
144 // POP NUMBER FROM TOP OF STACK
145 //LSLStack.SetLength(LSLStack.Length - 4);
146 Common.SendToDebug("::POP");
147 if (LSLStack.Count < 1)
148 {
149 //TODO: Temporary fix
150 Common.SendToDebug("ERROR: TRYING TO POP EMPTY STACK!");
151 }
152 else
153 {
154 LSLStack.Pop();
155 }
156 }
157
158 public void PUSH(object Param)
159 {
160 if (Param == null)
161 {
162 Common.SendToDebug("::PUSH: <null>");
163 }
164 else
165 {
166 //Common.SendToDebug("::PUSH: " + Param.GetType());
167 }
168
169 LSLStack.Push(Param);
170 }
171
172 public void ADD(UInt32 Param)
173 {
174 Common.SendToDebug("::ADD: " + Param);
175 object o2 = LSLStack.Pop();
176 object o1 = LSLStack.Pop();
177 Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() +
178 " (" + o2.ToString() + ")");
179 if (o2.GetType() == typeof (string))
180 {
181 LSLStack.Push((string) o1 + (string) o2);
182 return;
183 }
184 if (o2.GetType() == typeof (UInt32))
185 {
186 LSLStack.Push((UInt32) o1 + (UInt32) o2);
187 return;
188 }
189 }
190
191 public void SUB(UInt32 Param)
192 {
193 Common.SendToDebug("::SUB: " + Param);
194 UInt32 i2 = (UInt32) LSLStack.Pop();
195 UInt32 i1 = (UInt32) LSLStack.Pop();
196 LSLStack.Push((UInt32) (i1 - i2));
197 }
198
199 public void MUL(UInt32 Param)
200 {
201 Common.SendToDebug("::SUB: " + Param);
202 UInt32 i2 = (UInt32) LSLStack.Pop();
203 UInt32 i1 = (UInt32) LSLStack.Pop();
204 LSLStack.Push((UInt32) (i1*i2));
205 }
206
207 public void DIV(UInt32 Param)
208 {
209 Common.SendToDebug("::DIV: " + Param);
210 UInt32 i2 = (UInt32) LSLStack.Pop();
211 UInt32 i1 = (UInt32) LSLStack.Pop();
212 LSLStack.Push((UInt32) (i1/i2));
213 }
214
215
216 public void MOD(UInt32 Param)
217 {
218 Common.SendToDebug("::MOD: " + Param);
219 UInt32 i2 = (UInt32) LSLStack.Pop();
220 UInt32 i1 = (UInt32) LSLStack.Pop();
221 LSLStack.Push((UInt32) (i1%i2));
222 }
223
224 public void EQ(UInt32 Param)
225 {
226 Common.SendToDebug("::EQ: " + Param);
227 UInt32 i2 = (UInt32) LSLStack.Pop();
228 UInt32 i1 = (UInt32) LSLStack.Pop();
229 if (i1 == i2)
230 {
231 LSLStack.Push((UInt32) 1);
232 }
233 else
234 {
235 LSLStack.Push((UInt32) 0);
236 }
237 }
238
239 public void NEQ(UInt32 Param)
240 {
241 Common.SendToDebug("::NEQ: " + Param);
242 UInt32 i2 = (UInt32) LSLStack.Pop();
243 UInt32 i1 = (UInt32) LSLStack.Pop();
244 if (i1 != i2)
245 {
246 LSLStack.Push((UInt32) 1);
247 }
248 else
249 {
250 LSLStack.Push((UInt32) 0);
251 }
252 }
253
254 public void LEQ(UInt32 Param)
255 {
256 Common.SendToDebug("::LEQ: " + Param);
257 UInt32 i2 = (UInt32) LSLStack.Pop();
258 UInt32 i1 = (UInt32) LSLStack.Pop();
259 if (i1 <= i2)
260 {
261 LSLStack.Push((UInt32) 1);
262 }
263 else
264 {
265 LSLStack.Push((UInt32) 0);
266 }
267 }
268
269 public void GEQ(UInt32 Param)
270 {
271 Common.SendToDebug("::GEQ: " + Param);
272 UInt32 i2 = (UInt32) LSLStack.Pop();
273 UInt32 i1 = (UInt32) LSLStack.Pop();
274 if (i1 >= i2)
275 {
276 LSLStack.Push((UInt32) 1);
277 }
278 else
279 {
280 LSLStack.Push((UInt32) 0);
281 }
282 }
283
284 public void LESS(UInt32 Param)
285 {
286 Common.SendToDebug("::LESS: " + Param);
287 UInt32 i2 = (UInt32) LSLStack.Pop();
288 UInt32 i1 = (UInt32) LSLStack.Pop();
289 if (i1 < i2)
290 {
291 LSLStack.Push((UInt32) 1);
292 }
293 else
294 {
295 LSLStack.Push((UInt32) 0);
296 }
297 }
298
299 public void GREATER(UInt32 Param)
300 {
301 Common.SendToDebug("::GREATER: " + Param);
302 UInt32 i2 = (UInt32) LSLStack.Pop();
303 UInt32 i1 = (UInt32) LSLStack.Pop();
304 if (i1 > i2)
305 {
306 LSLStack.Push((UInt32) 1);
307 }
308 else
309 {
310 LSLStack.Push((UInt32) 0);
311 }
312 }
313
314
315 public void BITAND()
316 {
317 Common.SendToDebug("::BITAND");
318 UInt32 i2 = (UInt32) LSLStack.Pop();
319 UInt32 i1 = (UInt32) LSLStack.Pop();
320 LSLStack.Push((UInt32) (i1 & i2));
321 }
322
323 public void BITOR()
324 {
325 Common.SendToDebug("::BITOR");
326 UInt32 i2 = (UInt32) LSLStack.Pop();
327 UInt32 i1 = (UInt32) LSLStack.Pop();
328 LSLStack.Push((UInt32) (i1 | i2));
329 }
330
331 public void BITXOR()
332 {
333 Common.SendToDebug("::BITXOR");
334 UInt32 i2 = (UInt32) LSLStack.Pop();
335 UInt32 i1 = (UInt32) LSLStack.Pop();
336 LSLStack.Push((UInt32) (i1 ^ i2));
337 }
338
339 public void BOOLAND()
340 {
341 Common.SendToDebug("::BOOLAND");
342 bool b2 = bool.Parse((string) LSLStack.Pop());
343 bool b1 = bool.Parse((string) LSLStack.Pop());
344 if (b1 && b2)
345 {
346 LSLStack.Push((UInt32) 1);
347 }
348 else
349 {
350 LSLStack.Push((UInt32) 0);
351 }
352 }
353
354 public void BOOLOR()
355 {
356 Common.SendToDebug("::BOOLOR");
357 bool b2 = bool.Parse((string) LSLStack.Pop());
358 bool b1 = bool.Parse((string) LSLStack.Pop());
359
360 if (b1 || b2)
361 {
362 LSLStack.Push((UInt32) 1);
363 }
364 else
365 {
366 LSLStack.Push((UInt32) 0);
367 }
368 }
369
370 public void NEG(UInt32 Param)
371 {
372 Common.SendToDebug("::NEG: " + Param);
373 //UInt32 i2 = (UInt32)LSLStack.Pop();
374 UInt32 i1 = (UInt32) LSLStack.Pop();
375 LSLStack.Push((UInt32) (i1*-1));
376 }
377
378 public void BITNOT()
379 {
380 //Common.SendToDebug("::BITNOT");
381 //UInt32 i2 = (UInt32)LSLStack.Pop();
382 //UInt32 i1 = (UInt32)LSLStack.Pop();
383 //LSLStack.Push((UInt32)(i1 / i2));
384 }
385
386 public void BOOLNOT()
387 {
388 //Common.SendToDebug("::BOOLNOT");
389 ////UInt32 i2 = (UInt32)LSLStack.Pop();
390 //UInt32 i1 = (UInt32)LSLStack.Pop();
391 //LSLStack.Push((UInt32)(i1));
392 }
393 }
394} \ No newline at end of file