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/Interpreter.cs | |
parent | Who would have known that the only way of specifying utf-8 without preamble, ... (diff) | |
download | opensim-SC_OLD-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.zip opensim-SC_OLD-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.gz opensim-SC_OLD-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.bz2 opensim-SC_OLD-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.xz |
* Wiping trunk in prep for Sugilite
Diffstat (limited to 'OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs')
-rw-r--r-- | OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs deleted file mode 100644 index c5995b2..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs +++ /dev/null | |||
@@ -1,135 +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 | |||
34 | namespace OpenSim.Scripting.EmbeddedJVM | ||
35 | { | ||
36 | partial class Thread | ||
37 | { | ||
38 | private partial class Interpreter | ||
39 | { | ||
40 | private Thread _mThread; | ||
41 | |||
42 | public Interpreter(Thread parentThread) | ||
43 | { | ||
44 | _mThread = parentThread; | ||
45 | } | ||
46 | |||
47 | public bool Excute() | ||
48 | { | ||
49 | bool run = true; | ||
50 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++]; | ||
51 | // Console.WriteLine("opCode is: " + currentOpCode); | ||
52 | bool handled = false; | ||
53 | |||
54 | handled = this.IsLogicOpCode(currentOpCode); | ||
55 | if (!handled) | ||
56 | { | ||
57 | handled = this.IsMethodOpCode(currentOpCode); | ||
58 | } | ||
59 | if (!handled) | ||
60 | { | ||
61 | if (currentOpCode == 172) | ||
62 | { | ||
63 | if (this._mThread.stack.StackFrames.Count > 1) | ||
64 | { | ||
65 | Console.WriteLine("returning int from function"); | ||
66 | int retPC1 = this._mThread.currentFrame.ReturnPC; | ||
67 | BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); | ||
68 | this._mThread.stack.StackFrames.Pop(); | ||
69 | this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); | ||
70 | this._mThread.PC = retPC1; | ||
71 | if (bas1 is Int) | ||
72 | { | ||
73 | this._mThread.currentFrame.OpStack.Push((Int)bas1); | ||
74 | } | ||
75 | } | ||
76 | else | ||
77 | { | ||
78 | // Console.WriteLine("No parent function so ending program"); | ||
79 | this._mThread.stack.StackFrames.Pop(); | ||
80 | run = false; | ||
81 | } | ||
82 | handled = true; | ||
83 | } | ||
84 | if (currentOpCode == 174) | ||
85 | { | ||
86 | if (this._mThread.stack.StackFrames.Count > 1) | ||
87 | { | ||
88 | Console.WriteLine("returning float from function"); | ||
89 | int retPC1 = this._mThread.currentFrame.ReturnPC; | ||
90 | BaseType bas1 = this._mThread.currentFrame.OpStack.Pop(); | ||
91 | this._mThread.stack.StackFrames.Pop(); | ||
92 | this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); | ||
93 | this._mThread.PC = retPC1; | ||
94 | if (bas1 is Float) | ||
95 | { | ||
96 | this._mThread.currentFrame.OpStack.Push((Float)bas1); | ||
97 | } | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | // Console.WriteLine("No parent function so ending program"); | ||
102 | this._mThread.stack.StackFrames.Pop(); | ||
103 | run = false; | ||
104 | } | ||
105 | handled = true; | ||
106 | } | ||
107 | if (currentOpCode == 177) | ||
108 | { | ||
109 | if (this._mThread.stack.StackFrames.Count > 1) | ||
110 | { | ||
111 | Console.WriteLine("returning from function"); | ||
112 | int retPC = this._mThread.currentFrame.ReturnPC; | ||
113 | this._mThread.stack.StackFrames.Pop(); | ||
114 | this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek(); | ||
115 | this._mThread.PC = retPC; | ||
116 | } | ||
117 | else | ||
118 | { | ||
119 | // Console.WriteLine("No parent function so ending program"); | ||
120 | this._mThread.stack.StackFrames.Pop(); | ||
121 | run = false; | ||
122 | } | ||
123 | handled = true; | ||
124 | } | ||
125 | } | ||
126 | if (!handled) | ||
127 | { | ||
128 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); | ||
129 | } | ||
130 | return run; | ||
131 | |||
132 | } | ||
133 | } | ||
134 | } | ||
135 | } | ||