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