diff options
author | Adam Frisby | 2007-07-11 08:02:47 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:02:47 +0000 |
commit | 5c7ffdde0b9642a42e8f5987e06eb01220ff7776 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs | |
parent | Who would have known that the only way of specifying utf-8 without preamble, ... (diff) | |
download | opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.zip opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.gz opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.bz2 opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.xz |
* Wiping trunk in prep for Sugilite
Diffstat (limited to '')
-rw-r--r-- | OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs deleted file mode 100644 index 8e34de7..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
32 | using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | ||
33 | using OpenSim.Framework.Interfaces; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Types; | ||
36 | |||
37 | namespace OpenSim.Scripting.EmbeddedJVM | ||
38 | { | ||
39 | partial class Thread | ||
40 | { | ||
41 | private partial class Interpreter | ||
42 | { | ||
43 | private bool IsMethodOpCode(byte opcode) | ||
44 | { | ||
45 | bool result = false; | ||
46 | switch (opcode) | ||
47 | { | ||
48 | case 184: | ||
49 | short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); | ||
50 | if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | ||
51 | { | ||
52 | string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value; | ||
53 | string typeparam = ""; | ||
54 | string typereturn = ""; | ||
55 | int firstbrak = 0; | ||
56 | int secondbrak = 0; | ||
57 | firstbrak = typ.LastIndexOf('('); | ||
58 | secondbrak = typ.LastIndexOf(')'); | ||
59 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); | ||
60 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); | ||
61 | if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value) | ||
62 | { | ||
63 | //calling a method in this class | ||
64 | if (typeparam.Length == 0) | ||
65 | { | ||
66 | this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2)); | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2)); | ||
71 | } | ||
72 | } | ||
73 | else | ||
74 | { | ||
75 | //calling a method of a different class | ||
76 | |||
77 | //for now we will have a built in OpenSimAPI class, but this should be a java class that then calls native methods | ||
78 | if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") | ||
79 | { | ||
80 | switch (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value) | ||
81 | { | ||
82 | case "GetEntityID": | ||
83 | Int entityID = new Int(); | ||
84 | entityID.mValue =(int) this._mThread.EntityId; | ||
85 | this._mThread.currentFrame.OpStack.Push(entityID); | ||
86 | this._mThread.PC += 2; | ||
87 | break; | ||
88 | case "GetRandomAvatarID": | ||
89 | entityID = new Int(); | ||
90 | entityID.mValue = (int)Thread.OpenSimScriptAPI.GetRandomAvatarID(); | ||
91 | this._mThread.currentFrame.OpStack.Push(entityID); | ||
92 | this._mThread.PC += 2; | ||
93 | break; | ||
94 | case "GetEntityPositionX": | ||
95 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
96 | if (bs1 is Int) | ||
97 | { | ||
98 | //should get the position of the entity from the IScriptAPI | ||
99 | OSVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue); | ||
100 | Float pos = new Float(); | ||
101 | pos.mValue = vec3.X; | ||
102 | this._mThread.currentFrame.OpStack.Push(pos); | ||
103 | } | ||
104 | this._mThread.PC += 2; | ||
105 | break; | ||
106 | case "GetEntityPositionY": | ||
107 | bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
108 | if (bs1 is Int) | ||
109 | { | ||
110 | //should get the position of the entity from the IScriptAPI | ||
111 | OSVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue); | ||
112 | Float pos = new Float(); | ||
113 | pos.mValue = vec3.Y; | ||
114 | this._mThread.currentFrame.OpStack.Push(pos); | ||
115 | } | ||
116 | this._mThread.PC += 2; | ||
117 | break; | ||
118 | case "GetEntityPositionZ": | ||
119 | bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
120 | if (bs1 is Int) | ||
121 | { | ||
122 | //should get the position of the entity from the IScriptAPI | ||
123 | OSVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue); | ||
124 | Float pos = new Float(); | ||
125 | pos.mValue = vec3.Z; | ||
126 | this._mThread.currentFrame.OpStack.Push(pos); | ||
127 | } | ||
128 | this._mThread.PC += 2; | ||
129 | break; | ||
130 | case "SetEntityPosition": | ||
131 | //pop the three float values and the entity id | ||
132 | BaseType ft3 = this._mThread.currentFrame.OpStack.Pop(); | ||
133 | BaseType ft2 = this._mThread.currentFrame.OpStack.Pop(); | ||
134 | BaseType ft1 = this._mThread.currentFrame.OpStack.Pop(); | ||
135 | BaseType in1 = this._mThread.currentFrame.OpStack.Pop(); | ||
136 | if (ft1 is Float && ft2 is Float && ft3 is Float) | ||
137 | { | ||
138 | if(in1 is Int) | ||
139 | { | ||
140 | Thread.OpenSimScriptAPI.SetEntityPosition((uint)((Int) in1).mValue, ((Float)ft1).mValue, ((Float)ft2).mValue, ((Float)ft3).mValue); | ||
141 | } | ||
142 | } | ||
143 | this._mThread.PC += 2; | ||
144 | break; | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | this._mThread.PC += 2; | ||
152 | } | ||
153 | result = true; | ||
154 | break; | ||
155 | } | ||
156 | |||
157 | return result; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | } | ||