aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs
diff options
context:
space:
mode:
authorMW2007-06-14 10:36:19 +0000
committerMW2007-06-14 10:36:19 +0000
commit1fef45bc2ba7111f9fd8b89d71334b741940580a (patch)
tree70744347f1c9b558fe39078bec6bd40cb65dc0b6 /OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs
parentFixed the bug that makes a region use its water height as its name (in region... (diff)
downloadopensim-SC_OLD-1fef45bc2ba7111f9fd8b89d71334b741940580a.zip
opensim-SC_OLD-1fef45bc2ba7111f9fd8b89d71334b741940580a.tar.gz
opensim-SC_OLD-1fef45bc2ba7111f9fd8b89d71334b741940580a.tar.bz2
opensim-SC_OLD-1fef45bc2ba7111f9fd8b89d71334b741940580a.tar.xz
Commented out the Scene.Backup method for now as there isn't really anything to Backup yet and it might be the cause of a memory leak.
Deleted EmbeddedJVM scripting engine, not being used. "If" we ever decide to use it then it can be re-added.
Diffstat (limited to 'OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs')
-rw-r--r--OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs170
1 files changed, 0 insertions, 170 deletions
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs
deleted file mode 100644
index 4760e59..0000000
--- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterMethods.cs
+++ /dev/null
@@ -1,170 +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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Scripting.EmbeddedJVM.Types;
32using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework;
35using OpenSim.Framework.Types;
36
37using libsecondlife;
38
39namespace OpenSim.Scripting.EmbeddedJVM
40{
41 partial class Thread
42 {
43 private partial class Interpreter
44 {
45 private bool IsMethodOpCode(byte opcode)
46 {
47 bool result = false;
48 switch (opcode)
49 {
50 case 184:
51 short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
52 //Console.WriteLine("call to method : "+refIndex);
53 if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
54 {
55 // Console.WriteLine("which is " + ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value + "." + ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value);
56 // Console.WriteLine("of type " + ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value);
57 string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value;
58 string typeparam = "";
59 string typereturn = "";
60 int firstbrak = 0;
61 int secondbrak = 0;
62 firstbrak = typ.LastIndexOf('(');
63 secondbrak = typ.LastIndexOf(')');
64 typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
65 typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
66 //Console.WriteLine("split is " + typeparam + " which is length " + typeparam.Length + " , " + typereturn);
67 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
68 {
69 //calling a method in this class
70 if (typeparam.Length == 0)
71 {
72 this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2));
73 }
74 else
75 {
76 this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2));
77 }
78 }
79 else
80 {
81 //calling a method of a different class
82
83 //for now we will have a built in OpenSimAPI class, but this should be a java class that then calls native methods
84 if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
85 {
86 switch (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value)
87 {
88 case "GetEntityID":
89 Int entityID = new Int();
90 entityID.mValue =(int) this._mThread.EntityId;
91 this._mThread.currentFrame.OpStack.Push(entityID);
92 this._mThread.PC += 2;
93 break;
94 case "GetRandomAvatarID":
95 entityID = new Int();
96 entityID.mValue = (int)Thread.OpenSimScriptAPI.GetRandomAvatarID();
97 this._mThread.currentFrame.OpStack.Push(entityID);
98 this._mThread.PC += 2;
99 break;
100 case "GetEntityPositionX":
101 BaseType bs1 = this._mThread.currentFrame.OpStack.Pop();
102 if (bs1 is Int)
103 {
104 //Console.WriteLine("get entity pos for " + ((Int)bs1).mValue);
105 //should get the position of the entity from the IScriptAPI
106 LLVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue);
107 Float pos = new Float();
108 pos.mValue = vec3.X;
109 // Console.WriteLine("returned x value " + vec3.X.ToString());
110 this._mThread.currentFrame.OpStack.Push(pos);
111 }
112 this._mThread.PC += 2;
113 break;
114 case "GetEntityPositionY":
115 bs1 = this._mThread.currentFrame.OpStack.Pop();
116 if (bs1 is Int)
117 {
118 //should get the position of the entity from the IScriptAPI
119 LLVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue);
120 Float pos = new Float();
121 pos.mValue = vec3.Y;
122 this._mThread.currentFrame.OpStack.Push(pos);
123 }
124 this._mThread.PC += 2;
125 break;
126 case "GetEntityPositionZ":
127 bs1 = this._mThread.currentFrame.OpStack.Pop();
128 if (bs1 is Int)
129 {
130 //should get the position of the entity from the IScriptAPI
131 LLVector3 vec3 = Thread.OpenSimScriptAPI.GetEntityPosition((uint)((Int)bs1).mValue);
132 Float pos = new Float();
133 pos.mValue = vec3.Z;
134 this._mThread.currentFrame.OpStack.Push(pos);
135 }
136 this._mThread.PC += 2;
137 break;
138 case "SetEntityPosition":
139 //pop the three float values and the entity id
140 BaseType ft3 = this._mThread.currentFrame.OpStack.Pop();
141 BaseType ft2 = this._mThread.currentFrame.OpStack.Pop();
142 BaseType ft1 = this._mThread.currentFrame.OpStack.Pop();
143 BaseType in1 = this._mThread.currentFrame.OpStack.Pop();
144 if (ft1 is Float && ft2 is Float && ft3 is Float)
145 {
146 if(in1 is Int)
147 {
148 //Console.WriteLine("set: " + ((Int)in1).mValue + " , " + ((Float)ft1).mValue + " , " + ((Float)ft2).mValue + " , " + ((Float)ft3).mValue);
149 Thread.OpenSimScriptAPI.SetEntityPosition((uint)((Int) in1).mValue, ((Float)ft1).mValue, ((Float)ft2).mValue, ((Float)ft3).mValue);
150 }
151 }
152 this._mThread.PC += 2;
153 break;
154 }
155 }
156 }
157 }
158 else
159 {
160 this._mThread.PC += 2;
161 }
162 result = true;
163 break;
164 }
165
166 return result;
167 }
168 }
169 }
170}