diff options
Diffstat (limited to 'OpenSim/OpenSim.Scripting/EmbeddedJVM')
24 files changed, 0 insertions, 2185 deletions
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassInstance.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassInstance.cs deleted file mode 100644 index 1d93197..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassInstance.cs +++ /dev/null | |||
@@ -1,45 +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 | |||
33 | namespace OpenSim.Scripting.EmbeddedJVM | ||
34 | { | ||
35 | public class ClassInstance : Object | ||
36 | { | ||
37 | public int size; | ||
38 | public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); | ||
39 | |||
40 | public ClassInstance() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassRecord.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassRecord.cs deleted file mode 100644 index f4ab1a2..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/ClassRecord.cs +++ /dev/null | |||
@@ -1,503 +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.IO; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Scripting.EmbeddedJVM.Types; | ||
33 | |||
34 | namespace OpenSim.Scripting.EmbeddedJVM | ||
35 | { | ||
36 | public class ClassRecord | ||
37 | { | ||
38 | private ushort _majorVersion; | ||
39 | private ushort _minorVersion; | ||
40 | private ushort _constantPoolCount; | ||
41 | private ushort _accessFlags; | ||
42 | private ushort _thisClass; | ||
43 | private ushort _supperClass; | ||
44 | private ushort _interfaceCount; | ||
45 | private ushort _fieldCount; | ||
46 | private ushort _methodCount; | ||
47 | //private ushort _attributeCount; | ||
48 | //private string _name; | ||
49 | public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); | ||
50 | public PoolClass mClass; | ||
51 | |||
52 | public List<PoolItem> _constantsPool = new List<PoolItem>(); | ||
53 | private List<MethodInfo> _methodsList = new List<MethodInfo>(); | ||
54 | private List<FieldInfo> _fieldList = new List<FieldInfo>(); | ||
55 | |||
56 | public ClassRecord() | ||
57 | { | ||
58 | |||
59 | } | ||
60 | |||
61 | public ClassInstance CreateNewInstance() | ||
62 | { | ||
63 | return new ClassInstance(); | ||
64 | } | ||
65 | |||
66 | public void LoadClassFromFile(string fileName) | ||
67 | { | ||
68 | Console.WriteLine("loading script " + fileName); | ||
69 | FileStream fs = File.OpenRead(fileName); | ||
70 | this.LoadClassFromBytes(ReadFully(fs)); | ||
71 | fs.Close(); | ||
72 | } | ||
73 | |||
74 | public void LoadClassFromBytes(byte[] data) | ||
75 | { | ||
76 | int i = 0; | ||
77 | i += 4; | ||
78 | _minorVersion = (ushort)((data[i++] << 8) + data[i++] ); | ||
79 | _majorVersion = (ushort)((data[i++] << 8) + data[i++] ); | ||
80 | _constantPoolCount = (ushort)((data[i++] << 8) + data[i++] ); | ||
81 | // Console.WriteLine("there should be " + _constantPoolCount + " items in the pool"); | ||
82 | for (int count = 0; count < _constantPoolCount -1 ; count++) | ||
83 | { | ||
84 | //read in the constant pool | ||
85 | byte pooltype = data[i++]; | ||
86 | //Console.WriteLine("#" +count +": new constant type = " +pooltype); | ||
87 | //Console.WriteLine("start position is: " + i); | ||
88 | switch (pooltype) | ||
89 | { | ||
90 | case 1: //Utf8 | ||
91 | ushort uLength = (ushort)((data[i++] << 8) + data[i++] ); | ||
92 | |||
93 | // Console.WriteLine("new utf8 type, length is " + uLength); | ||
94 | PoolUtf8 utf8 = new PoolUtf8(); | ||
95 | utf8.readValue(data, ref i, uLength); | ||
96 | this._constantsPool.Add(utf8); | ||
97 | break; | ||
98 | case 3: //Int | ||
99 | break; | ||
100 | case 7: //Class | ||
101 | PoolClass pClass = new PoolClass(this); | ||
102 | pClass.readValue(data, ref i); | ||
103 | this._constantsPool.Add(pClass); | ||
104 | break; | ||
105 | case 10: //Method | ||
106 | PoolMethodRef pMeth = new PoolMethodRef(this); | ||
107 | pMeth.readValue(data, ref i); | ||
108 | this._constantsPool.Add(pMeth); | ||
109 | break; | ||
110 | case 12: //NamedType | ||
111 | PoolNamedType pNamed = new PoolNamedType(this); | ||
112 | pNamed.readValue(data, ref i); | ||
113 | this._constantsPool.Add(pNamed); | ||
114 | break; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | _accessFlags = (ushort)((data[i++] << 8) + data[i++] ); | ||
119 | _thisClass = (ushort)((data[i++] << 8) + data[i++] ); | ||
120 | _supperClass = (ushort)((data[i++] << 8) + data[i++] ); | ||
121 | |||
122 | if (this._constantsPool[this._thisClass - 1] is PoolClass) | ||
123 | { | ||
124 | this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]); | ||
125 | } | ||
126 | |||
127 | _interfaceCount = (ushort)((data[i++] << 8) + data[i++]); | ||
128 | //should now read in the info for each interface | ||
129 | _fieldCount = (ushort)((data[i++] << 8) + data[i++]); | ||
130 | //should now read in the info for each field | ||
131 | _methodCount = (ushort)((data[i++] << 8) + data[i++]); | ||
132 | for (int count = 0; count < _methodCount; count++) | ||
133 | { | ||
134 | MethodInfo methInf = new MethodInfo(this); | ||
135 | methInf.ReadData(data, ref i); | ||
136 | this._methodsList.Add(methInf); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | public void AddMethodsToMemory(MethodMemory memory) | ||
141 | { | ||
142 | for (int count = 0; count < _methodCount; count++) | ||
143 | { | ||
144 | this._methodsList[count].AddMethodCode(memory); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | public bool StartMethod(Thread thread, string methodName) | ||
149 | { | ||
150 | for (int count = 0; count < _methodCount; count++) | ||
151 | { | ||
152 | if (this._constantsPool[this._methodsList[count].NameIndex-1] is PoolUtf8) | ||
153 | { | ||
154 | if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex-1]).Value == methodName) | ||
155 | { | ||
156 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); | ||
157 | thread.SetPC(this._methodsList[count].CodePointer); | ||
158 | return true; | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | return false; | ||
163 | } | ||
164 | |||
165 | public void PrintToConsole() | ||
166 | { | ||
167 | Console.WriteLine("Class File:"); | ||
168 | Console.WriteLine("Major version: " + _majorVersion); | ||
169 | Console.WriteLine("Minor version: " + _minorVersion); | ||
170 | Console.WriteLine("Pool size: " + _constantPoolCount); | ||
171 | |||
172 | for (int i = 0; i < _constantsPool.Count; i++) | ||
173 | { | ||
174 | this._constantsPool[i].Print(); | ||
175 | } | ||
176 | |||
177 | Console.WriteLine("Access flags: " + _accessFlags); | ||
178 | Console.WriteLine("This class: " + _thisClass ); | ||
179 | Console.WriteLine("Super class: " + _supperClass); | ||
180 | |||
181 | for (int count = 0; count < _methodCount; count++) | ||
182 | { | ||
183 | Console.WriteLine(); | ||
184 | this._methodsList[count].Print(); | ||
185 | } | ||
186 | |||
187 | Console.WriteLine("class name is " + this.mClass.Name.Value); | ||
188 | } | ||
189 | |||
190 | public static byte[] ReadFully(Stream stream) | ||
191 | { | ||
192 | byte[] buffer = new byte[1024]; | ||
193 | using (MemoryStream ms = new MemoryStream()) | ||
194 | { | ||
195 | while (true) | ||
196 | { | ||
197 | int read = stream.Read(buffer, 0, buffer.Length); | ||
198 | if (read <= 0) | ||
199 | return ms.ToArray(); | ||
200 | ms.Write(buffer, 0, read); | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | #region nested classes | ||
206 | public class PoolItem | ||
207 | { | ||
208 | public virtual void Print() | ||
209 | { | ||
210 | |||
211 | } | ||
212 | } | ||
213 | |||
214 | public class PoolUtf8 : PoolItem | ||
215 | { | ||
216 | public string Value = ""; | ||
217 | |||
218 | public void readValue(byte[] data,ref int pointer , int length) | ||
219 | { | ||
220 | for (int i = 0; i < length; i++) | ||
221 | { | ||
222 | int a =(int) data[pointer++]; | ||
223 | if ((a & 0x80) == 0) | ||
224 | { | ||
225 | Value = Value + (char)a; | ||
226 | } | ||
227 | else if ((a & 0x20) == 0) | ||
228 | { | ||
229 | int b = (int) data[pointer++]; | ||
230 | Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | int b = (int)data[pointer++]; | ||
235 | int c = (int)data[pointer++]; | ||
236 | Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | |||
241 | public override void Print() | ||
242 | { | ||
243 | Console.WriteLine("Utf8 type: " + Value); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | private class PoolInt : PoolItem | ||
248 | { | ||
249 | |||
250 | } | ||
251 | |||
252 | public class PoolClass : PoolItem | ||
253 | { | ||
254 | //public string name = ""; | ||
255 | public ushort namePointer = 0; | ||
256 | private ClassRecord parent; | ||
257 | public PoolUtf8 Name; | ||
258 | |||
259 | public PoolClass(ClassRecord paren) | ||
260 | { | ||
261 | parent = paren; | ||
262 | } | ||
263 | |||
264 | public void readValue(byte[] data, ref int pointer) | ||
265 | { | ||
266 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); | ||
267 | } | ||
268 | |||
269 | public override void Print() | ||
270 | { | ||
271 | this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); | ||
272 | Console.Write("Class type: " + namePointer); | ||
273 | Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); | ||
274 | |||
275 | } | ||
276 | } | ||
277 | |||
278 | public class PoolMethodRef : PoolItem | ||
279 | { | ||
280 | public ushort classPointer = 0; | ||
281 | public ushort nameTypePointer = 0; | ||
282 | public PoolNamedType mNameType; | ||
283 | public PoolClass mClass; | ||
284 | private ClassRecord parent; | ||
285 | |||
286 | public PoolMethodRef(ClassRecord paren) | ||
287 | { | ||
288 | parent = paren; | ||
289 | } | ||
290 | |||
291 | public void readValue(byte[] data, ref int pointer) | ||
292 | { | ||
293 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
294 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
295 | } | ||
296 | |||
297 | public override void Print() | ||
298 | { | ||
299 | this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); | ||
300 | this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); | ||
301 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); | ||
302 | } | ||
303 | } | ||
304 | |||
305 | public class PoolNamedType : PoolItem | ||
306 | { | ||
307 | public ushort namePointer = 0; | ||
308 | public ushort typePointer = 0; | ||
309 | private ClassRecord parent; | ||
310 | public PoolUtf8 Name; | ||
311 | public PoolUtf8 Type; | ||
312 | |||
313 | public PoolNamedType(ClassRecord paren) | ||
314 | { | ||
315 | parent = paren; | ||
316 | } | ||
317 | |||
318 | public void readValue(byte[] data, ref int pointer) | ||
319 | { | ||
320 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); | ||
321 | typePointer = (ushort)((data[pointer++] << 8) + data[pointer++] ); | ||
322 | } | ||
323 | |||
324 | public override void Print() | ||
325 | { | ||
326 | Name = ((PoolUtf8)this.parent._constantsPool[namePointer-1]); | ||
327 | Type = ((PoolUtf8)this.parent._constantsPool[typePointer-1]); | ||
328 | Console.Write("Named type: " + namePointer + " , " + typePointer ); | ||
329 | Console.WriteLine(" // "+ ((PoolUtf8)this.parent._constantsPool[namePointer-1]).Value); | ||
330 | } | ||
331 | } | ||
332 | |||
333 | //*********************** | ||
334 | public class MethodInfo | ||
335 | { | ||
336 | public ushort AccessFlags = 0; | ||
337 | public ushort NameIndex = 0; | ||
338 | public string Name = ""; | ||
339 | public ushort DescriptorIndex = 0; | ||
340 | public ushort AttributeCount = 0; | ||
341 | public List<MethodAttribute> Attributes = new List<MethodAttribute>(); | ||
342 | private ClassRecord parent; | ||
343 | public int CodePointer = 0; | ||
344 | |||
345 | public MethodInfo(ClassRecord paren) | ||
346 | { | ||
347 | parent = paren; | ||
348 | } | ||
349 | |||
350 | public void AddMethodCode(MethodMemory memory) | ||
351 | { | ||
352 | Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); | ||
353 | memory.Methodcount++; | ||
354 | this.CodePointer = memory.NextMethodPC; | ||
355 | memory.NextMethodPC += this.Attributes[0].Code.Length; | ||
356 | } | ||
357 | |||
358 | public void ReadData(byte[] data, ref int pointer) | ||
359 | { | ||
360 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
361 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
362 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
363 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
364 | for(int i =0; i< AttributeCount; i++) | ||
365 | { | ||
366 | MethodAttribute attri = new MethodAttribute(this.parent); | ||
367 | attri.ReadData(data, ref pointer); | ||
368 | this.Attributes.Add(attri); | ||
369 | } | ||
370 | } | ||
371 | |||
372 | public void Print() | ||
373 | { | ||
374 | Console.WriteLine("Method Info Struct: "); | ||
375 | Console.WriteLine("AccessFlags: " + AccessFlags); | ||
376 | Console.WriteLine("NameIndex: " + NameIndex +" // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); | ||
377 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[DescriptorIndex-1]).Value); | ||
378 | Console.WriteLine("Attribute Count:" + AttributeCount); | ||
379 | for (int i = 0; i < AttributeCount; i++) | ||
380 | { | ||
381 | this.Attributes[i].Print(); | ||
382 | } | ||
383 | } | ||
384 | |||
385 | public class MethodAttribute | ||
386 | { | ||
387 | public ushort NameIndex = 0; | ||
388 | public string Name = ""; | ||
389 | public Int32 Length = 0; | ||
390 | //for now only support code attribute | ||
391 | public ushort MaxStack = 0; | ||
392 | public ushort MaxLocals = 0; | ||
393 | public Int32 CodeLength = 0; | ||
394 | public byte[] Code; | ||
395 | public ushort ExceptionTableLength = 0; | ||
396 | public ushort SubAttributeCount = 0; | ||
397 | public List<SubAttribute> SubAttributes = new List<SubAttribute>(); | ||
398 | private ClassRecord parent; | ||
399 | |||
400 | public MethodAttribute(ClassRecord paren) | ||
401 | { | ||
402 | parent = paren; | ||
403 | } | ||
404 | |||
405 | public void ReadData(byte[] data, ref int pointer) | ||
406 | { | ||
407 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
408 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
409 | MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
410 | MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
411 | CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
412 | Code = new byte[CodeLength]; | ||
413 | for (int i = 0; i < CodeLength; i++) | ||
414 | { | ||
415 | Code[i] = data[pointer++]; | ||
416 | } | ||
417 | ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
418 | SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
419 | for (int i = 0; i < SubAttributeCount; i++) | ||
420 | { | ||
421 | SubAttribute subAttri = new SubAttribute(this.parent); | ||
422 | subAttri.ReadData(data, ref pointer); | ||
423 | this.SubAttributes.Add(subAttri); | ||
424 | } | ||
425 | } | ||
426 | |||
427 | public void Print() | ||
428 | { | ||
429 | Console.WriteLine("Method Attribute: "); | ||
430 | Console.WriteLine("Name Index: " + NameIndex + " // "+ ((PoolUtf8)this.parent._constantsPool[NameIndex-1]).Value); | ||
431 | Console.WriteLine("Length: " + Length); | ||
432 | Console.WriteLine("MaxStack: " + MaxStack); | ||
433 | Console.WriteLine("MaxLocals: " + MaxLocals); | ||
434 | Console.WriteLine("CodeLength: " + CodeLength); | ||
435 | for (int i = 0; i < Code.Length; i++) | ||
436 | { | ||
437 | Console.WriteLine("OpCode #" + i + " is: " + Code[i]); | ||
438 | } | ||
439 | Console.WriteLine("SubAttributes: " + SubAttributeCount); | ||
440 | for (int i = 0; i < SubAttributeCount; i++) | ||
441 | { | ||
442 | this.SubAttributes[i].Print(); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | public class SubAttribute | ||
447 | { | ||
448 | public ushort NameIndex = 0; | ||
449 | public string Name = ""; | ||
450 | public Int32 Length = 0; | ||
451 | public byte[] Data; | ||
452 | private ClassRecord parent; | ||
453 | |||
454 | public SubAttribute(ClassRecord paren) | ||
455 | { | ||
456 | parent = paren; | ||
457 | } | ||
458 | |||
459 | public void ReadData(byte[] data, ref int pointer) | ||
460 | { | ||
461 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | ||
462 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
463 | Data = new byte[Length]; | ||
464 | for (int i = 0; i < Length; i++) | ||
465 | { | ||
466 | Data[i] = data[pointer++]; | ||
467 | } | ||
468 | } | ||
469 | |||
470 | public void Print() | ||
471 | { | ||
472 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); | ||
473 | } | ||
474 | |||
475 | } | ||
476 | } | ||
477 | |||
478 | } | ||
479 | private class InterfaceInfo | ||
480 | { | ||
481 | public void ReadData(byte[] data, ref int i) | ||
482 | { | ||
483 | |||
484 | } | ||
485 | } | ||
486 | private class FieldInfo | ||
487 | { | ||
488 | public void ReadData(byte[] data, ref int i) | ||
489 | { | ||
490 | |||
491 | } | ||
492 | } | ||
493 | private class AttributeInfo | ||
494 | { | ||
495 | public void ReadData(byte[] data, ref int i) | ||
496 | { | ||
497 | |||
498 | } | ||
499 | } | ||
500 | #endregion | ||
501 | |||
502 | } | ||
503 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Heap.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Heap.cs deleted file mode 100644 index f213c36..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Heap.cs +++ /dev/null | |||
@@ -1,43 +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 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class Heap | ||
35 | { | ||
36 | public List<ClassInstance> ClassObjects = new List<ClassInstance>(); | ||
37 | |||
38 | public Heap() | ||
39 | { | ||
40 | |||
41 | } | ||
42 | } | ||
43 | } | ||
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 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterLogic.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterLogic.cs deleted file mode 100644 index 2a11afd..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterLogic.cs +++ /dev/null | |||
@@ -1,427 +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 bool IsLogicOpCode(byte opcode) | ||
41 | { | ||
42 | bool result = false; | ||
43 | switch (opcode) | ||
44 | { | ||
45 | case 2: | ||
46 | Int m_int= new Int(); | ||
47 | m_int.mValue = -1; | ||
48 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
49 | result = true; | ||
50 | break; | ||
51 | case 3: | ||
52 | m_int= new Int(); | ||
53 | m_int.mValue = 0; | ||
54 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
55 | result = true; | ||
56 | break; | ||
57 | case 4: | ||
58 | m_int = new Int(); | ||
59 | m_int.mValue = 1; | ||
60 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
61 | result = true; | ||
62 | break; | ||
63 | case 5: | ||
64 | m_int = new Int(); | ||
65 | m_int.mValue = 2; | ||
66 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
67 | result = true; | ||
68 | break; | ||
69 | case 6: | ||
70 | m_int = new Int(); | ||
71 | m_int.mValue = 3; | ||
72 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
73 | break; | ||
74 | case 7: | ||
75 | m_int = new Int(); | ||
76 | m_int.mValue = 4; | ||
77 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
78 | result = true; | ||
79 | break; | ||
80 | case 8: | ||
81 | m_int = new Int(); | ||
82 | m_int.mValue = 5; | ||
83 | this._mThread.currentFrame.OpStack.Push(m_int); | ||
84 | result = true; | ||
85 | break; | ||
86 | case 11: | ||
87 | Float m_float = new Float(); | ||
88 | m_float.mValue = 0.0f; | ||
89 | this._mThread.currentFrame.OpStack.Push(m_float); | ||
90 | result = true; | ||
91 | break; | ||
92 | case 12: | ||
93 | m_float = new Float(); | ||
94 | m_float.mValue = 1.0f; | ||
95 | this._mThread.currentFrame.OpStack.Push(m_float); | ||
96 | result = true; | ||
97 | break; | ||
98 | case 13: | ||
99 | m_float = new Float(); | ||
100 | m_float.mValue = 2.0f; | ||
101 | this._mThread.currentFrame.OpStack.Push(m_float); | ||
102 | result = true; | ||
103 | break; | ||
104 | case 16: | ||
105 | int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; | ||
106 | Int pushInt = new Int(); | ||
107 | pushInt.mValue = pushvalue; | ||
108 | this._mThread.currentFrame.OpStack.Push(pushInt); | ||
109 | this._mThread.PC++; | ||
110 | result = true; | ||
111 | break; | ||
112 | case 17: | ||
113 | short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
114 | Int pushInt2 = new Int(); | ||
115 | pushInt2.mValue = pushvalue2; | ||
116 | this._mThread.currentFrame.OpStack.Push(pushInt2); | ||
117 | this._mThread.PC += 2; | ||
118 | result = true; | ||
119 | break; | ||
120 | case 23: | ||
121 | short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); | ||
122 | Float fload = new Float(); | ||
123 | if (this._mThread.currentFrame.LocalVariables[findex1] != null) | ||
124 | { | ||
125 | if (this._mThread.currentFrame.LocalVariables[findex1] is Float) | ||
126 | { | ||
127 | fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue; | ||
128 | this._mThread.currentFrame.OpStack.Push(fload); | ||
129 | } | ||
130 | } | ||
131 | this._mThread.PC++; | ||
132 | result = true; | ||
133 | break; | ||
134 | case 26: | ||
135 | if (this._mThread.currentFrame.LocalVariables[0] != null) | ||
136 | { | ||
137 | if (this._mThread.currentFrame.LocalVariables[0] is Int) | ||
138 | { | ||
139 | Int newInt = new Int(); | ||
140 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue; | ||
141 | this._mThread.currentFrame.OpStack.Push(newInt); | ||
142 | } | ||
143 | } | ||
144 | result = true; | ||
145 | break; | ||
146 | case 27: | ||
147 | if (this._mThread.currentFrame.LocalVariables[1] != null) | ||
148 | { | ||
149 | if (this._mThread.currentFrame.LocalVariables[1] is Int) | ||
150 | { | ||
151 | Int newInt = new Int(); | ||
152 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue; | ||
153 | this._mThread.currentFrame.OpStack.Push(newInt); | ||
154 | } | ||
155 | } | ||
156 | result = true; | ||
157 | break; | ||
158 | case 34: | ||
159 | if (this._mThread.currentFrame.LocalVariables[0] != null) | ||
160 | { | ||
161 | if (this._mThread.currentFrame.LocalVariables[0] is Float) | ||
162 | { | ||
163 | Float newfloat = new Float(); | ||
164 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue; | ||
165 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
166 | } | ||
167 | } | ||
168 | result = true; | ||
169 | break; | ||
170 | case 35: | ||
171 | if (this._mThread.currentFrame.LocalVariables[1] != null) | ||
172 | { | ||
173 | if (this._mThread.currentFrame.LocalVariables[1] is Float) | ||
174 | { | ||
175 | Float newfloat = new Float(); | ||
176 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue; | ||
177 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
178 | } | ||
179 | } | ||
180 | result = true; | ||
181 | break; | ||
182 | case 36: | ||
183 | if (this._mThread.currentFrame.LocalVariables[2] != null) | ||
184 | { | ||
185 | if (this._mThread.currentFrame.LocalVariables[2] is Float) | ||
186 | { | ||
187 | Float newfloat = new Float(); | ||
188 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue; | ||
189 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
190 | } | ||
191 | } | ||
192 | result = true; | ||
193 | break; | ||
194 | case 37: | ||
195 | if (this._mThread.currentFrame.LocalVariables[3] != null) | ||
196 | { | ||
197 | if (this._mThread.currentFrame.LocalVariables[3] is Float) | ||
198 | { | ||
199 | Float newfloat = new Float(); | ||
200 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue; | ||
201 | this._mThread.currentFrame.OpStack.Push(newfloat); | ||
202 | } | ||
203 | } | ||
204 | result = true; | ||
205 | break; | ||
206 | case 56: | ||
207 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); | ||
208 | BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); | ||
209 | if (fstor is Float) | ||
210 | { | ||
211 | this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor; | ||
212 | } | ||
213 | this._mThread.PC++; | ||
214 | result = true; | ||
215 | break; | ||
216 | case 59: | ||
217 | BaseType baset = this._mThread.currentFrame.OpStack.Pop(); | ||
218 | if (baset is Int) | ||
219 | { | ||
220 | this._mThread.currentFrame.LocalVariables[0] = (Int)baset; | ||
221 | } | ||
222 | result = true; | ||
223 | break; | ||
224 | case 60: | ||
225 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
226 | if (baset is Int) | ||
227 | { | ||
228 | this._mThread.currentFrame.LocalVariables[1] = (Int)baset; | ||
229 | } | ||
230 | result = true; | ||
231 | break; | ||
232 | case 67: | ||
233 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
234 | if (baset is Float) | ||
235 | { | ||
236 | this._mThread.currentFrame.LocalVariables[0] = (Float)baset; | ||
237 | } | ||
238 | result = true; | ||
239 | break; | ||
240 | case 68: | ||
241 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
242 | if (baset is Float) | ||
243 | { | ||
244 | this._mThread.currentFrame.LocalVariables[1] = (Float)baset; | ||
245 | } | ||
246 | result = true; | ||
247 | break; | ||
248 | case 69: | ||
249 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
250 | if (baset is Float) | ||
251 | { | ||
252 | this._mThread.currentFrame.LocalVariables[2] = (Float)baset; | ||
253 | } | ||
254 | result = true; | ||
255 | break; | ||
256 | case 70: | ||
257 | baset = this._mThread.currentFrame.OpStack.Pop(); | ||
258 | if (baset is Float) | ||
259 | { | ||
260 | this._mThread.currentFrame.LocalVariables[3] = (Float)baset; | ||
261 | } | ||
262 | result = true; | ||
263 | break; | ||
264 | case 87: | ||
265 | this._mThread.currentFrame.OpStack.Pop(); | ||
266 | result = true; | ||
267 | break; | ||
268 | case 98: | ||
269 | BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); | ||
270 | BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); | ||
271 | if (bf1 is Float && bf2 is Float) | ||
272 | { | ||
273 | Float nflt = new Float(); | ||
274 | nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; | ||
275 | this._mThread.currentFrame.OpStack.Push(nflt); | ||
276 | } | ||
277 | result = true; | ||
278 | break; | ||
279 | case 102: | ||
280 | BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); | ||
281 | BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); | ||
282 | if (bsf1 is Float && bsf2 is Float) | ||
283 | { | ||
284 | Float resf = new Float(); | ||
285 | resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; | ||
286 | this._mThread.currentFrame.OpStack.Push(resf); | ||
287 | } | ||
288 | result = true; | ||
289 | break; | ||
290 | case 104: //check the order of the two values off the stack is correct | ||
291 | BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); | ||
292 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); | ||
293 | if (bs1 is Int && bs2 is Int) | ||
294 | { | ||
295 | Int nInt = new Int(); | ||
296 | nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; | ||
297 | this._mThread.currentFrame.OpStack.Push(nInt); | ||
298 | } | ||
299 | result = true; | ||
300 | break; | ||
301 | case 132: | ||
302 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) | ||
303 | { | ||
304 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) | ||
305 | { | ||
306 | ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; | ||
307 | } | ||
308 | } | ||
309 | this._mThread.PC += 2; | ||
310 | result = true; | ||
311 | break; | ||
312 | case 139: | ||
313 | BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); | ||
314 | if (conv1 is Float) | ||
315 | { | ||
316 | Int newconv = new Int(); | ||
317 | newconv.mValue = (int)((Float)conv1).mValue; | ||
318 | this._mThread.currentFrame.OpStack.Push(newconv); | ||
319 | } | ||
320 | result = true; | ||
321 | break; | ||
322 | case 149: | ||
323 | BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); | ||
324 | BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); | ||
325 | if (flcom1 is Float && flcom2 is Float) | ||
326 | { | ||
327 | Int compres = new Int(); | ||
328 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | ||
329 | { | ||
330 | compres.mValue = -1; | ||
331 | } | ||
332 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | ||
333 | { | ||
334 | compres.mValue = 1; | ||
335 | } | ||
336 | else | ||
337 | { | ||
338 | compres.mValue = 0; | ||
339 | } | ||
340 | this._mThread.currentFrame.OpStack.Push(compres); | ||
341 | } | ||
342 | result = true; | ||
343 | break; | ||
344 | case 158: | ||
345 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
346 | BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); | ||
347 | if (comp1 is Int) | ||
348 | { | ||
349 | if (((Int)comp1).mValue <= 0) | ||
350 | { | ||
351 | this._mThread.PC += -1 + compareoffset1; | ||
352 | } | ||
353 | else | ||
354 | { | ||
355 | this._mThread.PC += 2; | ||
356 | } | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | this._mThread.PC += 2; | ||
361 | } | ||
362 | result = true; | ||
363 | break; | ||
364 | case 162: | ||
365 | short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
366 | BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); | ||
367 | BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); | ||
368 | if (bc1 is Int && bc2 is Int) | ||
369 | { | ||
370 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); | ||
371 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) | ||
372 | { | ||
373 | // Console.WriteLine("branch compare true , offset is " +compareoffset); | ||
374 | // Console.WriteLine("current PC is " + this._mThread.PC); | ||
375 | this._mThread.PC += -1 + compareoffset; | ||
376 | //Console.WriteLine("new PC is " + this._mThread.PC); | ||
377 | } | ||
378 | else | ||
379 | { | ||
380 | //Console.WriteLine("branch compare false"); | ||
381 | this._mThread.PC += 2; | ||
382 | } | ||
383 | } | ||
384 | else | ||
385 | { | ||
386 | this._mThread.PC += 2; | ||
387 | } | ||
388 | result = true; | ||
389 | break; | ||
390 | case 164: | ||
391 | short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
392 | BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); | ||
393 | BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); | ||
394 | if (bcl1 is Int && bcl2 is Int) | ||
395 | { | ||
396 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); | ||
397 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) | ||
398 | { | ||
399 | // Console.WriteLine("branch compare true , offset is " + compareloffset); | ||
400 | // Console.WriteLine("current PC is " + this._mThread.PC); | ||
401 | this._mThread.PC += -1 + compareloffset; | ||
402 | // Console.WriteLine("new PC is " + this._mThread.PC); | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | //Console.WriteLine("branch compare false"); | ||
407 | this._mThread.PC += 2; | ||
408 | } | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | this._mThread.PC += 2; | ||
413 | } | ||
414 | result = true; | ||
415 | break; | ||
416 | case 167: | ||
417 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); | ||
418 | this._mThread.PC += -1 + offset; | ||
419 | result = true; | ||
420 | break; | ||
421 | } | ||
422 | |||
423 | return result; | ||
424 | } | ||
425 | } | ||
426 | } | ||
427 | } | ||
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 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterReturn.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterReturn.cs deleted file mode 100644 index cbedb71..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/InterpreterReturn.cs +++ /dev/null | |||
@@ -1,40 +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 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | partial class Thread | ||
35 | { | ||
36 | private partial class Interpreter | ||
37 | { | ||
38 | } | ||
39 | } | ||
40 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MainMemory.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/MainMemory.cs deleted file mode 100644 index 97d9fb6..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MainMemory.cs +++ /dev/null | |||
@@ -1,45 +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 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class MainMemory | ||
35 | { | ||
36 | public Heap HeapArea; | ||
37 | public MethodMemory MethodArea; | ||
38 | |||
39 | public MainMemory() | ||
40 | { | ||
41 | MethodArea = new MethodMemory(); | ||
42 | HeapArea = new Heap(); | ||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MethodMemory.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/MethodMemory.cs deleted file mode 100644 index 7e938b4..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/MethodMemory.cs +++ /dev/null | |||
@@ -1,46 +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 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class MethodMemory | ||
35 | { | ||
36 | public byte[] MethodBuffer; | ||
37 | public List<ClassRecord> Classes = new List<ClassRecord>(); | ||
38 | public int NextMethodPC = 0; | ||
39 | public int Methodcount = 0; | ||
40 | |||
41 | public MethodMemory() | ||
42 | { | ||
43 | MethodBuffer = new byte[20000]; | ||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Object.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Object.cs deleted file mode 100644 index 2c3bedd..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Object.cs +++ /dev/null | |||
@@ -1,37 +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 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class Object | ||
35 | { | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.csproj b/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.csproj deleted file mode 100644 index bd1a332..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.csproj +++ /dev/null | |||
@@ -1,153 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{97A82740-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Scripting.EmbeddedJVM</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Scripting.EmbeddedJVM</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\ScriptEngines\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\ScriptEngines\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="System" > | ||
62 | <HintPath>System.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System.Xml" > | ||
66 | <HintPath>System.Xml.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | </ItemGroup> | ||
70 | <ItemGroup> | ||
71 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
72 | <Name>OpenSim.Framework</Name> | ||
73 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
74 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
75 | <Private>False</Private> | ||
76 | </ProjectReference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <Compile Include="ClassInstance.cs"> | ||
80 | <SubType>Code</SubType> | ||
81 | </Compile> | ||
82 | <Compile Include="ClassRecord.cs"> | ||
83 | <SubType>Code</SubType> | ||
84 | </Compile> | ||
85 | <Compile Include="Heap.cs"> | ||
86 | <SubType>Code</SubType> | ||
87 | </Compile> | ||
88 | <Compile Include="Interpreter.cs"> | ||
89 | <SubType>Code</SubType> | ||
90 | </Compile> | ||
91 | <Compile Include="InterpreterLogic.cs"> | ||
92 | <SubType>Code</SubType> | ||
93 | </Compile> | ||
94 | <Compile Include="InterpreterMethods.cs"> | ||
95 | <SubType>Code</SubType> | ||
96 | </Compile> | ||
97 | <Compile Include="InterpreterReturn.cs"> | ||
98 | <SubType>Code</SubType> | ||
99 | </Compile> | ||
100 | <Compile Include="MainMemory.cs"> | ||
101 | <SubType>Code</SubType> | ||
102 | </Compile> | ||
103 | <Compile Include="MethodMemory.cs"> | ||
104 | <SubType>Code</SubType> | ||
105 | </Compile> | ||
106 | <Compile Include="Object.cs"> | ||
107 | <SubType>Code</SubType> | ||
108 | </Compile> | ||
109 | <Compile Include="OpenSimJVM.cs"> | ||
110 | <SubType>Code</SubType> | ||
111 | </Compile> | ||
112 | <Compile Include="Stack.cs"> | ||
113 | <SubType>Code</SubType> | ||
114 | </Compile> | ||
115 | <Compile Include="StackFrame.cs"> | ||
116 | <SubType>Code</SubType> | ||
117 | </Compile> | ||
118 | <Compile Include="Thread.cs"> | ||
119 | <SubType>Code</SubType> | ||
120 | </Compile> | ||
121 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
122 | <SubType>Code</SubType> | ||
123 | </Compile> | ||
124 | <Compile Include="Types\ArrayReference.cs"> | ||
125 | <SubType>Code</SubType> | ||
126 | </Compile> | ||
127 | <Compile Include="Types\BaseType.cs"> | ||
128 | <SubType>Code</SubType> | ||
129 | </Compile> | ||
130 | <Compile Include="Types\ObjectReference.cs"> | ||
131 | <SubType>Code</SubType> | ||
132 | </Compile> | ||
133 | <Compile Include="Types\PrimitiveTypes\Byte.cs"> | ||
134 | <SubType>Code</SubType> | ||
135 | </Compile> | ||
136 | <Compile Include="Types\PrimitiveTypes\Char.cs"> | ||
137 | <SubType>Code</SubType> | ||
138 | </Compile> | ||
139 | <Compile Include="Types\PrimitiveTypes\Float.cs"> | ||
140 | <SubType>Code</SubType> | ||
141 | </Compile> | ||
142 | <Compile Include="Types\PrimitiveTypes\Int.cs"> | ||
143 | <SubType>Code</SubType> | ||
144 | </Compile> | ||
145 | </ItemGroup> | ||
146 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
147 | <PropertyGroup> | ||
148 | <PreBuildEvent> | ||
149 | </PreBuildEvent> | ||
150 | <PostBuildEvent> | ||
151 | </PostBuildEvent> | ||
152 | </PropertyGroup> | ||
153 | </Project> | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build b/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build deleted file mode 100644 index cce2fef..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSim.Scripting.EmbeddedJVM.dll.build +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Scripting.EmbeddedJVM" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Scripting.EmbeddedJVM" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="ClassInstance.cs" /> | ||
15 | <include name="ClassRecord.cs" /> | ||
16 | <include name="Heap.cs" /> | ||
17 | <include name="Interpreter.cs" /> | ||
18 | <include name="InterpreterLogic.cs" /> | ||
19 | <include name="InterpreterMethods.cs" /> | ||
20 | <include name="InterpreterReturn.cs" /> | ||
21 | <include name="MainMemory.cs" /> | ||
22 | <include name="MethodMemory.cs" /> | ||
23 | <include name="Object.cs" /> | ||
24 | <include name="OpenSimJVM.cs" /> | ||
25 | <include name="Stack.cs" /> | ||
26 | <include name="StackFrame.cs" /> | ||
27 | <include name="Thread.cs" /> | ||
28 | <include name="Properties/AssemblyInfo.cs" /> | ||
29 | <include name="Types/ArrayReference.cs" /> | ||
30 | <include name="Types/BaseType.cs" /> | ||
31 | <include name="Types/ObjectReference.cs" /> | ||
32 | <include name="Types/PrimitiveTypes/Byte.cs" /> | ||
33 | <include name="Types/PrimitiveTypes/Char.cs" /> | ||
34 | <include name="Types/PrimitiveTypes/Float.cs" /> | ||
35 | <include name="Types/PrimitiveTypes/Int.cs" /> | ||
36 | </sources> | ||
37 | <references basedir="${project::get-base-directory()}"> | ||
38 | <lib> | ||
39 | <include name="${project::get-base-directory()}" /> | ||
40 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
41 | </lib> | ||
42 | <include name="../../../bin/OpenSim.Framework.dll" /> | ||
43 | <include name="System.dll" /> | ||
44 | <include name="System.Xml.dll" /> | ||
45 | </references> | ||
46 | </csc> | ||
47 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/ScriptEngines/" /> | ||
48 | <mkdir dir="${project::get-base-directory()}/../../../bin/ScriptEngines/"/> | ||
49 | <copy todir="${project::get-base-directory()}/../../../bin/ScriptEngines/"> | ||
50 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
51 | <include name="*.dll"/> | ||
52 | <include name="*.exe"/> | ||
53 | </fileset> | ||
54 | </copy> | ||
55 | </target> | ||
56 | <target name="clean"> | ||
57 | <delete dir="${bin.dir}" failonerror="false" /> | ||
58 | <delete dir="${obj.dir}" failonerror="false" /> | ||
59 | </target> | ||
60 | <target name="doc" description="Creates documentation."> | ||
61 | </target> | ||
62 | </project> | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.cs deleted file mode 100644 index 2de8152..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/OpenSimJVM.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 System.IO; | ||
32 | using System.Threading; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Utilities; | ||
36 | |||
37 | namespace OpenSim.Scripting.EmbeddedJVM | ||
38 | { | ||
39 | public class OpenSimJVM : IScriptEngine | ||
40 | { | ||
41 | private List<Thread> _threads = new List<Thread>(); | ||
42 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); | ||
43 | private MainMemory _mainMemory; | ||
44 | private System.Threading.Thread compileThread; | ||
45 | |||
46 | public OpenSimJVM() | ||
47 | { | ||
48 | |||
49 | } | ||
50 | |||
51 | public bool Init(IScriptAPI api) | ||
52 | { | ||
53 | Console.WriteLine("Creating OpenSim JVM scripting engine"); | ||
54 | _mainMemory = new MainMemory(); | ||
55 | Thread.GlobalMemory = this._mainMemory; | ||
56 | Thread.OpenSimScriptAPI = api; | ||
57 | compileThread = new System.Threading.Thread(new ThreadStart(CompileScript)); | ||
58 | compileThread.IsBackground = true; | ||
59 | compileThread.Start(); | ||
60 | return true; | ||
61 | } | ||
62 | |||
63 | public string GetName() | ||
64 | { | ||
65 | return "OpenSimJVM"; | ||
66 | } | ||
67 | |||
68 | public void LoadScript(string script, string scriptName, uint entityID) | ||
69 | { | ||
70 | Console.WriteLine("OpenSimJVM - loading new script: " + scriptName); | ||
71 | CompileInfo comp = new CompileInfo(); | ||
72 | comp.entityId = entityID; | ||
73 | comp.script = script; | ||
74 | comp.scriptName = scriptName; | ||
75 | this.CompileScripts.Enqueue(comp); | ||
76 | } | ||
77 | |||
78 | public void CompileScript() | ||
79 | { | ||
80 | while (true) | ||
81 | { | ||
82 | CompileInfo comp = this.CompileScripts.Dequeue(); | ||
83 | string script = comp.script; | ||
84 | string scriptName = comp.scriptName; | ||
85 | uint entityID = comp.entityId; | ||
86 | try | ||
87 | { | ||
88 | //need to compile the script into a java class file | ||
89 | |||
90 | //first save it to a java source file | ||
91 | TextWriter tw = new StreamWriter(scriptName + ".java"); | ||
92 | tw.WriteLine(script); | ||
93 | tw.Close(); | ||
94 | |||
95 | //now compile | ||
96 | System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); | ||
97 | // psi.RedirectStandardOutput = true; | ||
98 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | ||
99 | psi.UseShellExecute = false; | ||
100 | |||
101 | System.Diagnostics.Process javacomp; | ||
102 | javacomp = System.Diagnostics.Process.Start(psi); | ||
103 | javacomp.WaitForExit(); | ||
104 | |||
105 | |||
106 | //now load in class file | ||
107 | ClassRecord class1 = new ClassRecord(); | ||
108 | class1.LoadClassFromFile(scriptName + ".class"); | ||
109 | class1.PrintToConsole(); | ||
110 | //Console.WriteLine(); | ||
111 | this._mainMemory.MethodArea.Classes.Add(class1); | ||
112 | class1.AddMethodsToMemory(this._mainMemory.MethodArea); | ||
113 | |||
114 | Thread newThread = new Thread(); | ||
115 | this._threads.Add(newThread); | ||
116 | newThread.EntityId = entityID; | ||
117 | newThread.currentClass = class1; | ||
118 | |||
119 | //now delete the created files | ||
120 | System.IO.File.Delete(scriptName + ".java"); | ||
121 | System.IO.File.Delete(scriptName + ".class"); | ||
122 | //this.OnFrame(); | ||
123 | } | ||
124 | catch (Exception e) | ||
125 | { | ||
126 | Console.WriteLine("exception"); | ||
127 | Console.WriteLine(e.StackTrace); | ||
128 | Console.WriteLine(e.Message); | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | public void OnFrame() | ||
134 | { | ||
135 | for (int i = 0; i < this._threads.Count; i++) | ||
136 | { | ||
137 | if (!this._threads[i].running) | ||
138 | { | ||
139 | this._threads[i].StartMethod("OnFrame"); | ||
140 | bool run = true; | ||
141 | while (run) | ||
142 | { | ||
143 | run = this._threads[i].Excute(); | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | |||
149 | private class CompileInfo | ||
150 | { | ||
151 | public string script; | ||
152 | public string scriptName; | ||
153 | public uint entityId; | ||
154 | |||
155 | public CompileInfo() | ||
156 | { | ||
157 | |||
158 | } | ||
159 | } | ||
160 | } | ||
161 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Properties/AssemblyInfo.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Properties/AssemblyInfo.cs deleted file mode 100644 index 53a0f08..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Scripting.EmbeddedJVM")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenSim.Scripting.EmbeddedJVM")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("087c0917-5a6a-4b47-a4dd-0928dd85bd4b")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Stack.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Stack.cs deleted file mode 100644 index 69a274c..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Stack.cs +++ /dev/null | |||
@@ -1,42 +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 | |||
32 | namespace OpenSim.Scripting.EmbeddedJVM | ||
33 | { | ||
34 | public class Stack | ||
35 | { | ||
36 | public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); | ||
37 | |||
38 | public Stack() | ||
39 | { | ||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/StackFrame.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/StackFrame.cs deleted file mode 100644 index 3a2b58a..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/StackFrame.cs +++ /dev/null | |||
@@ -1,49 +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 | |||
33 | namespace OpenSim.Scripting.EmbeddedJVM | ||
34 | { | ||
35 | public class StackFrame | ||
36 | { | ||
37 | public BaseType[] LocalVariables; | ||
38 | public Stack<BaseType> OpStack = new Stack<BaseType>(); | ||
39 | |||
40 | public int ReturnPC = 0; | ||
41 | public ClassRecord CallingClass = null; | ||
42 | |||
43 | public StackFrame() | ||
44 | { | ||
45 | LocalVariables = new BaseType[20]; | ||
46 | } | ||
47 | |||
48 | } | ||
49 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs deleted file mode 100644 index 6813a20..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs +++ /dev/null | |||
@@ -1,115 +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; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Scripting.EmbeddedJVM | ||
37 | { | ||
38 | public partial class Thread | ||
39 | { | ||
40 | public static MainMemory GlobalMemory; | ||
41 | public static IScriptAPI OpenSimScriptAPI; | ||
42 | private int PC = 0; | ||
43 | private Stack stack; | ||
44 | private Interpreter mInterpreter; | ||
45 | public ClassRecord currentClass; | ||
46 | public ClassInstance currentInstance; | ||
47 | private StackFrame currentFrame; | ||
48 | public int excutionCounter = 0; | ||
49 | public bool running = false; | ||
50 | public uint EntityId = 0; | ||
51 | |||
52 | public Thread() | ||
53 | { | ||
54 | this.mInterpreter = new Interpreter(this); | ||
55 | this.stack = new Stack(); | ||
56 | } | ||
57 | |||
58 | public void SetPC(int methodpointer) | ||
59 | { | ||
60 | //Console.WriteLine("Thread PC has been set to " + methodpointer); | ||
61 | PC = methodpointer; | ||
62 | } | ||
63 | |||
64 | public void StartMethod(ClassRecord rec, string methName) | ||
65 | { | ||
66 | currentFrame = new StackFrame(); | ||
67 | this.stack.StackFrames.Push(currentFrame); | ||
68 | this.currentClass = rec; | ||
69 | currentClass.StartMethod(this, methName); | ||
70 | } | ||
71 | |||
72 | public void StartMethod( string methName) | ||
73 | { | ||
74 | currentFrame = new StackFrame(); | ||
75 | this.stack.StackFrames.Push(currentFrame); | ||
76 | currentClass.StartMethod(this, methName); | ||
77 | } | ||
78 | |||
79 | public void JumpToStaticVoidMethod(string methName, int returnPC) | ||
80 | { | ||
81 | currentFrame = new StackFrame(); | ||
82 | currentFrame.ReturnPC = returnPC; | ||
83 | this.stack.StackFrames.Push(currentFrame); | ||
84 | currentClass.StartMethod(this, methName); | ||
85 | } | ||
86 | |||
87 | public void JumpToStaticParamMethod(string methName, string param, int returnPC) | ||
88 | { | ||
89 | if (param == "I") | ||
90 | { | ||
91 | BaseType bs1 = currentFrame.OpStack.Pop(); | ||
92 | currentFrame = new StackFrame(); | ||
93 | currentFrame.ReturnPC = returnPC; | ||
94 | this.stack.StackFrames.Push(currentFrame); | ||
95 | currentFrame.LocalVariables[0] = ((Int)bs1); | ||
96 | currentClass.StartMethod(this, methName); | ||
97 | } | ||
98 | if (param == "F") | ||
99 | { | ||
100 | |||
101 | } | ||
102 | } | ||
103 | |||
104 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) | ||
105 | { | ||
106 | |||
107 | } | ||
108 | |||
109 | public bool Excute() | ||
110 | { | ||
111 | excutionCounter++; | ||
112 | return this.mInterpreter.Excute(); | ||
113 | } | ||
114 | } | ||
115 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ArrayReference.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ArrayReference.cs deleted file mode 100644 index 2854eab..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ArrayReference.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types | ||
6 | { | ||
7 | public class ArrayReference :BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/BaseType.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/BaseType.cs deleted file mode 100644 index 270aa7b..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/BaseType.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types | ||
6 | { | ||
7 | public class BaseType : Object | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ObjectReference.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ObjectReference.cs deleted file mode 100644 index da28eaa..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/ObjectReference.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types | ||
6 | { | ||
7 | public class ObjectReference : BaseType | ||
8 | { | ||
9 | public ushort Reference; | ||
10 | |||
11 | public ObjectReference() | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
16 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Byte.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Byte.cs deleted file mode 100644 index 1a3ecff..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Byte.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Byte : BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Char.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Char.cs deleted file mode 100644 index 19002d4..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Char.cs +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Char : BaseType | ||
8 | { | ||
9 | } | ||
10 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Float.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Float.cs deleted file mode 100644 index 91f1679..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Float.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Float : BaseType | ||
8 | { | ||
9 | public float mValue = 0; | ||
10 | |||
11 | public Float() | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
16 | } | ||
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Int.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Int.cs deleted file mode 100644 index 4ecd325..0000000 --- a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Types/PrimitiveTypes/Int.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes | ||
6 | { | ||
7 | public class Int : BaseType | ||
8 | { | ||
9 | public int mValue = 0; | ||
10 | |||
11 | public Int() | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
16 | } | ||