diff options
Little bit more work on AllNewSceneObjectPart2
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs index a609a40..4b2aec3 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/ClassRecord.cs | |||
@@ -36,23 +36,23 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
36 | { | 36 | { |
37 | public class ClassRecord | 37 | public class ClassRecord |
38 | { | 38 | { |
39 | private ushort _majorVersion; | 39 | private ushort m_majorVersion; |
40 | private ushort _minorVersion; | 40 | private ushort m_minorVersion; |
41 | private ushort _constantPoolCount; | 41 | private ushort m_constantPoolCount; |
42 | private ushort _accessFlags; | 42 | private ushort m_accessFlags; |
43 | private ushort _thisClass; | 43 | private ushort m_thisClass; |
44 | private ushort _supperClass; | 44 | private ushort m_supperClass; |
45 | private ushort _interfaceCount; | 45 | private ushort m_interfaceCount; |
46 | private ushort _fieldCount; | 46 | private ushort m_fieldCount; |
47 | private ushort _methodCount; | 47 | private ushort m_methodCount; |
48 | //private ushort _attributeCount; | 48 | //private ushort _attributeCount; |
49 | //private string _name; | 49 | //private string _name; |
50 | public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); | 50 | public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>(); |
51 | public PoolClass mClass; | 51 | public PoolClass MClass; |
52 | 52 | ||
53 | public List<PoolItem> _constantsPool = new List<PoolItem>(); | 53 | public List<PoolItem> m_constantsPool = new List<PoolItem>(); |
54 | private List<MethodInfo> _methodsList = new List<MethodInfo>(); | 54 | private List<MethodInfo> m_methodsList = new List<MethodInfo>(); |
55 | private List<FieldInfo> _fieldList = new List<FieldInfo>(); | 55 | private List<FieldInfo> m_fieldList = new List<FieldInfo>(); |
56 | 56 | ||
57 | public ClassRecord() | 57 | public ClassRecord() |
58 | { | 58 | { |
@@ -80,11 +80,11 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
80 | { | 80 | { |
81 | int i = 0; | 81 | int i = 0; |
82 | i += 4; | 82 | i += 4; |
83 | _minorVersion = (ushort)((data[i++] << 8) + data[i++]); | 83 | m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); |
84 | _majorVersion = (ushort)((data[i++] << 8) + data[i++]); | 84 | m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); |
85 | _constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); | 85 | m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); |
86 | Console.WriteLine("there should be " + _constantPoolCount + " items in the pool"); | 86 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); |
87 | for (int count = 0; count < (_constantPoolCount - 1); count++) | 87 | for (int count = 0; count < (m_constantPoolCount - 1); count++) |
88 | { | 88 | { |
89 | //read in the constant pool | 89 | //read in the constant pool |
90 | byte pooltype = data[i++]; | 90 | byte pooltype = data[i++]; |
@@ -98,7 +98,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
98 | // Console.WriteLine("new utf8 type, length is " + uLength); | 98 | // Console.WriteLine("new utf8 type, length is " + uLength); |
99 | PoolUtf8 utf8 = new PoolUtf8(); | 99 | PoolUtf8 utf8 = new PoolUtf8(); |
100 | utf8.readValue(data, ref i, uLength); | 100 | utf8.readValue(data, ref i, uLength); |
101 | this._constantsPool.Add(utf8); | 101 | this.m_constantsPool.Add(utf8); |
102 | break; | 102 | break; |
103 | case 3: //Int | 103 | case 3: //Int |
104 | break; | 104 | break; |
@@ -107,74 +107,74 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
107 | case 7: //Class | 107 | case 7: //Class |
108 | PoolClass pClass = new PoolClass(this); | 108 | PoolClass pClass = new PoolClass(this); |
109 | pClass.readValue(data, ref i); | 109 | pClass.readValue(data, ref i); |
110 | this._constantsPool.Add(pClass); | 110 | this.m_constantsPool.Add(pClass); |
111 | break; | 111 | break; |
112 | case 9: //FieldRef | 112 | case 9: //FieldRef |
113 | PoolFieldRef pField = new PoolFieldRef(this); | 113 | PoolFieldRef pField = new PoolFieldRef(this); |
114 | pField.readValue(data, ref i); | 114 | pField.readValue(data, ref i); |
115 | this._constantsPool.Add(pField); | 115 | this.m_constantsPool.Add(pField); |
116 | break; | 116 | break; |
117 | case 10: //Method | 117 | case 10: //Method |
118 | PoolMethodRef pMeth = new PoolMethodRef(this); | 118 | PoolMethodRef pMeth = new PoolMethodRef(this); |
119 | pMeth.readValue(data, ref i); | 119 | pMeth.readValue(data, ref i); |
120 | this._constantsPool.Add(pMeth); | 120 | this.m_constantsPool.Add(pMeth); |
121 | break; | 121 | break; |
122 | case 12: //NamedType | 122 | case 12: //NamedType |
123 | PoolNamedType pNamed = new PoolNamedType(this); | 123 | PoolNamedType pNamed = new PoolNamedType(this); |
124 | pNamed.readValue(data, ref i); | 124 | pNamed.readValue(data, ref i); |
125 | this._constantsPool.Add(pNamed); | 125 | this.m_constantsPool.Add(pNamed); |
126 | break; | 126 | break; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | _accessFlags = (ushort)((data[i++] << 8) + data[i++]); | 130 | m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); |
131 | _thisClass = (ushort)((data[i++] << 8) + data[i++]); | 131 | m_thisClass = (ushort)((data[i++] << 8) + data[i++]); |
132 | _supperClass = (ushort)((data[i++] << 8) + data[i++]); | 132 | m_supperClass = (ushort)((data[i++] << 8) + data[i++]); |
133 | 133 | ||
134 | if (this._constantsPool[this._thisClass - 1] is PoolClass) | 134 | if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) |
135 | { | 135 | { |
136 | this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]); | 136 | this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); |
137 | } | 137 | } |
138 | 138 | ||
139 | _interfaceCount = (ushort)((data[i++] << 8) + data[i++]); | 139 | m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); |
140 | //should now read in the info for each interface | 140 | //should now read in the info for each interface |
141 | 141 | ||
142 | _fieldCount = (ushort)((data[i++] << 8) + data[i++]); | 142 | m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); |
143 | //should now read in the info for each field | 143 | //should now read in the info for each field |
144 | for (int count = 0; count < _fieldCount; count++) | 144 | for (int count = 0; count < m_fieldCount; count++) |
145 | { | 145 | { |
146 | FieldInfo fieldInf = new FieldInfo(this); | 146 | FieldInfo fieldInf = new FieldInfo(this); |
147 | fieldInf.ReadData(data, ref i); | 147 | fieldInf.ReadData(data, ref i); |
148 | this._fieldList.Add(fieldInf); | 148 | this.m_fieldList.Add(fieldInf); |
149 | } | 149 | } |
150 | 150 | ||
151 | _methodCount = (ushort)((data[i++] << 8) + data[i++]); | 151 | m_methodCount = (ushort)((data[i++] << 8) + data[i++]); |
152 | for (int count = 0; count < _methodCount; count++) | 152 | for (int count = 0; count < m_methodCount; count++) |
153 | { | 153 | { |
154 | MethodInfo methInf = new MethodInfo(this); | 154 | MethodInfo methInf = new MethodInfo(this); |
155 | methInf.ReadData(data, ref i); | 155 | methInf.ReadData(data, ref i); |
156 | this._methodsList.Add(methInf); | 156 | this.m_methodsList.Add(methInf); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | public void AddMethodsToMemory(MethodMemory memory) | 160 | public void AddMethodsToMemory(MethodMemory memory) |
161 | { | 161 | { |
162 | for (int count = 0; count < _methodCount; count++) | 162 | for (int count = 0; count < m_methodCount; count++) |
163 | { | 163 | { |
164 | this._methodsList[count].AddMethodCode(memory); | 164 | this.m_methodsList[count].AddMethodCode(memory); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | public bool StartMethod(Thread thread, string methodName) | 168 | public bool StartMethod(Thread thread, string methodName) |
169 | { | 169 | { |
170 | for (int count = 0; count < _methodCount; count++) | 170 | for (int count = 0; count < m_methodCount; count++) |
171 | { | 171 | { |
172 | if (this._constantsPool[this._methodsList[count].NameIndex - 1] is PoolUtf8) | 172 | if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) |
173 | { | 173 | { |
174 | if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value == methodName) | 174 | if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) |
175 | { | 175 | { |
176 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); | 176 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); |
177 | thread.SetPC(this._methodsList[count].CodePointer); | 177 | thread.SetPC(this.m_methodsList[count].CodePointer); |
178 | return true; | 178 | return true; |
179 | } | 179 | } |
180 | } | 180 | } |
@@ -185,32 +185,32 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
185 | public void PrintToConsole() | 185 | public void PrintToConsole() |
186 | { | 186 | { |
187 | Console.WriteLine("Class File:"); | 187 | Console.WriteLine("Class File:"); |
188 | Console.WriteLine("Major version: " + _majorVersion); | 188 | Console.WriteLine("Major version: " + m_majorVersion); |
189 | Console.WriteLine("Minor version: " + _minorVersion); | 189 | Console.WriteLine("Minor version: " + m_minorVersion); |
190 | Console.WriteLine("Pool size: " + _constantPoolCount); | 190 | Console.WriteLine("Pool size: " + m_constantPoolCount); |
191 | 191 | ||
192 | for (int i = 0; i < _constantsPool.Count; i++) | 192 | for (int i = 0; i < m_constantsPool.Count; i++) |
193 | { | 193 | { |
194 | this._constantsPool[i].Print(); | 194 | this.m_constantsPool[i].Print(); |
195 | } | 195 | } |
196 | 196 | ||
197 | Console.WriteLine("Access flags: " + _accessFlags); | 197 | Console.WriteLine("Access flags: " + m_accessFlags); |
198 | Console.WriteLine("This class: " + _thisClass); | 198 | Console.WriteLine("This class: " + m_thisClass); |
199 | Console.WriteLine("Super class: " + _supperClass); | 199 | Console.WriteLine("Super class: " + m_supperClass); |
200 | 200 | ||
201 | for (int count = 0; count < _fieldCount; count++) | 201 | for (int count = 0; count < m_fieldCount; count++) |
202 | { | 202 | { |
203 | Console.WriteLine(); | 203 | Console.WriteLine(); |
204 | this._fieldList[count].Print(); | 204 | this.m_fieldList[count].Print(); |
205 | } | 205 | } |
206 | 206 | ||
207 | for (int count = 0; count < _methodCount; count++) | 207 | for (int count = 0; count < m_methodCount; count++) |
208 | { | 208 | { |
209 | Console.WriteLine(); | 209 | Console.WriteLine(); |
210 | this._methodsList[count].Print(); | 210 | this.m_methodsList[count].Print(); |
211 | } | 211 | } |
212 | 212 | ||
213 | Console.WriteLine("class name is " + this.mClass.Name.Value); | 213 | Console.WriteLine("class name is " + this.MClass.Name.Value); |
214 | } | 214 | } |
215 | 215 | ||
216 | public static byte[] ReadFully(Stream stream) | 216 | public static byte[] ReadFully(Stream stream) |
@@ -294,9 +294,9 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
294 | 294 | ||
295 | public override void Print() | 295 | public override void Print() |
296 | { | 296 | { |
297 | this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); | 297 | this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); |
298 | Console.Write("Class type: " + namePointer); | 298 | Console.Write("Class type: " + namePointer); |
299 | Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); | 299 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); |
300 | 300 | ||
301 | } | 301 | } |
302 | } | 302 | } |
@@ -322,8 +322,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
322 | 322 | ||
323 | public override void Print() | 323 | public override void Print() |
324 | { | 324 | { |
325 | this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); | 325 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); |
326 | this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); | 326 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); |
327 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); | 327 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); |
328 | } | 328 | } |
329 | } | 329 | } |
@@ -349,8 +349,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
349 | 349 | ||
350 | public override void Print() | 350 | public override void Print() |
351 | { | 351 | { |
352 | this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]); | 352 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); |
353 | this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]); | 353 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); |
354 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); | 354 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); |
355 | } | 355 | } |
356 | } | 356 | } |
@@ -376,10 +376,10 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
376 | 376 | ||
377 | public override void Print() | 377 | public override void Print() |
378 | { | 378 | { |
379 | Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]); | 379 | Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); |
380 | Type = ((PoolUtf8)this.parent._constantsPool[typePointer - 1]); | 380 | Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); |
381 | Console.Write("Named type: " + namePointer + " , " + typePointer); | 381 | Console.Write("Named type: " + namePointer + " , " + typePointer); |
382 | Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value); | 382 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
@@ -426,8 +426,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
426 | { | 426 | { |
427 | Console.WriteLine("Method Info Struct: "); | 427 | Console.WriteLine("Method Info Struct: "); |
428 | Console.WriteLine("AccessFlags: " + AccessFlags); | 428 | Console.WriteLine("AccessFlags: " + AccessFlags); |
429 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); | 429 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
430 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value); | 430 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); |
431 | Console.WriteLine("Attribute Count:" + AttributeCount); | 431 | Console.WriteLine("Attribute Count:" + AttributeCount); |
432 | for (int i = 0; i < AttributeCount; i++) | 432 | for (int i = 0; i < AttributeCount; i++) |
433 | { | 433 | { |
@@ -480,7 +480,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
480 | public void Print() | 480 | public void Print() |
481 | { | 481 | { |
482 | Console.WriteLine("Method Attribute: "); | 482 | Console.WriteLine("Method Attribute: "); |
483 | Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); | 483 | Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
484 | Console.WriteLine("Length: " + Length); | 484 | Console.WriteLine("Length: " + Length); |
485 | Console.WriteLine("MaxStack: " + MaxStack); | 485 | Console.WriteLine("MaxStack: " + MaxStack); |
486 | Console.WriteLine("MaxLocals: " + MaxLocals); | 486 | Console.WriteLine("MaxLocals: " + MaxLocals); |
@@ -522,7 +522,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
522 | 522 | ||
523 | public void Print() | 523 | public void Print() |
524 | { | 524 | { |
525 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); | 525 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
526 | } | 526 | } |
527 | 527 | ||
528 | } | 528 | } |
@@ -570,22 +570,22 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
570 | { | 570 | { |
571 | Console.WriteLine("Field Info Struct: "); | 571 | Console.WriteLine("Field Info Struct: "); |
572 | Console.WriteLine("AccessFlags: " + AccessFlags); | 572 | Console.WriteLine("AccessFlags: " + AccessFlags); |
573 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); | 573 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
574 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value); | 574 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); |
575 | Console.WriteLine("Attribute Count:" + AttributeCount); | 575 | Console.WriteLine("Attribute Count:" + AttributeCount); |
576 | //if static, add to static field list | 576 | //if static, add to static field list |
577 | // if (this.AccessFlags == 9) //public and static | 577 | // if (this.AccessFlags == 9) //public and static |
578 | if ((this.AccessFlags & 0x08) != 0) | 578 | if ((this.AccessFlags & 0x08) != 0) |
579 | { | 579 | { |
580 | switch (((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value) | 580 | switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) |
581 | { | 581 | { |
582 | case "I": | 582 | case "I": |
583 | Int newin = new Int(); | 583 | Int newin = new Int(); |
584 | this.parent.StaticFields.Add(((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value, newin); | 584 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); |
585 | break; | 585 | break; |
586 | case "F": | 586 | case "F": |
587 | Float newfl = new Float(); | 587 | Float newfl = new Float(); |
588 | this.parent.StaticFields.Add(((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value, newfl); | 588 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); |
589 | break; | 589 | break; |
590 | } | 590 | } |
591 | 591 | ||
@@ -622,7 +622,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
622 | 622 | ||
623 | public void Print() | 623 | public void Print() |
624 | { | 624 | { |
625 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value); | 625 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | } | 628 | } |