root/projects/bberry/coddec.patch
| Revision 13, 58.3 kB (checked in by lawler, 1 year ago) |
|---|
-
src/net/rim/tools/a/coddec.java
old new 18 18 private static Hashtable _codfiles = null; 19 19 private static Hashtable _imports = null; 20 20 private static StringBuffer _output = null; 21 public static String currentFileHackCrap; 21 22 22 23 public coddec () 23 24 { … … 88 89 { 89 90 String s1= ""; 90 91 net.rim.tools.compiler.codfile.Module _module_ = (net.rim.tools.compiler.codfile.Module)_modules.get(__moduleName); 92 System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>"); 93 System.err.println(">>>> Attempting to parse " + __moduleName + ".cod"); 94 System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>"); 91 95 if (_module_ == null) 92 96 { 93 97 … … 129 133 130 134 public static String getTypeName (net.rim.tools.compiler.codfile.TypeItem __typeItem) 131 135 { 132 String _typeName_ =""; 136 String _typeName_ =""; String _origTypeName_=""; 133 137 134 138 if (__typeItem != null) 135 139 { 136 140 _typeName_ = __typeItem.getTypeName(); 141 _origTypeName_ = __typeItem.getTypeName(); 137 142 138 143 if (_typeName_.contains(".")) 139 144 { … … 155 160 } 156 161 else 157 162 _typeName_ = "void"; 158 return _typeName_ ;163 return _typeName_ + " /*"+_origTypeName_+"*/ "; 159 164 } 160 165 161 166 public static String getTypeName (net.rim.tools.compiler.codfile.ClassDef __classDef) … … 480 485 __message.append(getTypeName( _type_) + " "); 481 486 482 487 // Field name 488 // The field.getName.get_Name does not jive with the members in the disassembled code 489 // (are they different objects???.......) so always use the offset (maybe) 483 490 if (!(_field_.getName().get_Name() != null && _field_.getName().get_Name().length() == 0)) 484 491 __message.append (_field_.getName().get_Name() + " "); 485 492 // Changes 486 493 // We leave only defined fields, not fields by offset 487 else 494 else { 488 495 __message.append ("field_" + _field_.getOffset() + " "); 496 } 489 497 490 498 // Field initial value 491 499 if (!_clinit_) … … 495 503 //_code_. 496 504 } 497 505 // End of field section 498 __message.append("; \r\n"); 506 __message.append(";"); 507 __message.append(" // ofs = " + _field_.getOffset() + " addr = " + _field_.getAddress()); 508 __message.append(")\r\n"); 499 509 } 500 510 __message.append("\r\n"); 501 511 } … … 672 682 { 673 683 case 0: 674 684 _routineLocal_ = (net.rim.tools.compiler.codfile.RoutineLocal)_classDefLocal_.getStaticRoutine(i); 685 System.out.println("STAT " + _routineLocal_.get_Name()); 686 System.out.println("STAT OF" + _routineLocal_.getAddress()); 687 System.out.println("STAT OF" + _routineLocal_.getOffset()); 688 System.out.println("STAT OR" + _routineLocal_.getOrdinal()); 689 System.out.println("STAT V1" + _routineLocal_.getVTableOffset(true)); 690 System.out.println("STAT V2" + _routineLocal_.getVTableOffset(false)); 675 691 break; 676 692 case 1: 677 693 _routineLocal_ = (net.rim.tools.compiler.codfile.RoutineLocal)_classDefLocal_.get_nonVirtualRoutine(i); 694 System.out.println("NVRT " + _routineLocal_.get_Name()); 695 System.out.println("NVRT OF" + _routineLocal_.getAddress()); 696 System.out.println("NVRT OF" + _routineLocal_.getOffset()); 697 System.out.println("NVRT OR" + _routineLocal_.getOrdinal()); 698 System.out.println("NVRT V1" + _routineLocal_.getVTableOffset(true)); 699 System.out.println("NVRT V2" + _routineLocal_.getVTableOffset(false)); 678 700 break; 679 701 case 2: 680 702 _routineLocal_ = (net.rim.tools.compiler.codfile.RoutineLocal)_classDefLocal_.getVirtualRoutine(i); 703 System.out.println("VIRT " + _routineLocal_.get_Name()); 704 System.out.println("VIRT OF" + _routineLocal_.getAddress()); 705 System.out.println("VIRT OF" + _routineLocal_.getOffset()); 706 System.out.println("VIRT OR" + _routineLocal_.getOrdinal()); 707 System.out.println("VIRT V1" + _routineLocal_.getVTableOffset(true)); 708 System.out.println("VIRT V2" + _routineLocal_.getVTableOffset(false)); 681 709 break; 682 710 default: 683 711 break; … … 710 738 //if (_routineAttributes.length() != 0) 711 739 //{ 712 740 __message.append(_routineAttributesString_); 741 System.err.println("APPEND AS " + _routineAttributesString_); 713 742 //} 714 743 //else 715 744 // break; 716 745 717 746 __message.append(_routineLocal_.get_Name()); 747 System.err.println("APPEND NM " + _routineLocal_.get_Name()); 718 748 // Return type 719 749 //net.rim.tools.compiler.codfile.TypeItem _returnType_ = _routineLocal_.getTypeList().get_baseType(); 720 750 //__message.append(getTypeName(_returnType_) + " "); … … 733 763 //CHANGES: 734 764 //ADDED semi-colon after function header 735 765 __message.append(";"); 766 767 __message.append(" // address: " + _routineLocal_.getAddress()); 768 736 769 __message.append("\r\n"); 737 770 738 771 // exceptions … … 838 871 { 839 872 if(!_packageFolder_.mkdirs()) 840 873 { 841 System. out.println("Problem creating package " + __packageName + " folders");874 System.err.println("Problem creating package " + __packageName + " folders"); 842 875 _packagePath_ = ""; 843 876 return _packagePath_; 844 877 } … … 856 889 StringBuffer _stringBuf_ = new StringBuffer(); 857 890 StringBuffer _importsBuf_ = new StringBuffer(""); 858 891 859 String _pathString =createPackagePath(__classDef.getPackageNameString()) + "\\"+ __classDef.getClassNameString() + ".java"; 892 String _pathString =createPackagePath(currentFileHackCrap + "\\" + __classDef.getPackageNameString()) + "\\"+ __classDef.getClassNameString() + ".java"; 893 File fofo = new File(_pathString); 894 if (fofo.exists()) { 895 System.err.println("DUP PATH " + _pathString); 896 _pathString = createPackagePath(currentFileHackCrap + "\\" + __classDef.getPackageNameString()) + "\\"+ __classDef.getClassNameString() + "__" + Math.abs(new Random().nextInt()) + "" + Math.abs(new Random().nextInt()) + ".java"; 897 } 860 898 FileOutputStream _javaOutputStream_ = new FileOutputStream(_pathString); 861 899 try 862 900 { … … 931 969 } 932 970 } 933 971 934 p rivatestatic void parseFile (String __fileName)972 public static void parseFile (String __fileName) 935 973 { 936 974 File _file_ = new File(__fileName); 937 975 if (_file_.exists()) … … 979 1017 for (int k = 0; k < i; k++) 980 1018 { 981 1019 String s = args[k]; 1020 _coddec.currentFileHackCrap = s.replaceFirst(".cod", "");; 982 1021 parseFile(s); 983 1022 984 1023 net.rim.tools.compiler.codfile.Module _module_ = null; -
src/net/rim/tools/compiler/codfile/ClassDef.java
old new 181 181 } 182 182 } 183 183 184 public void addFieldDef(net.rim.tools.compiler.codfile.FieldDef w1, boolean flag)184 public void addFieldDef(net.rim.tools.compiler.codfile.FieldDef w1, boolean isStatic) 185 185 { 186 if (!isStatic) { 187 System.out.println("----------------- addFieldDef"); 188 try { 189 throw new Exception("yay"); 190 } catch (Exception e) { 191 e.printStackTrace(); 192 } 193 } 186 194 net.rim.tools.compiler.codfile.CodfileArray o1 = null; 187 if( flag)195 if(isStatic) 188 196 { 189 197 if(_staticFieldDefs == null) 190 allocateFieldDefs(1, flag);198 allocateFieldDefs(1, isStatic); 191 199 o1 = _staticFieldDefs; 192 200 } else 193 201 { 194 202 if(_fieldDefs == null) 195 allocateFieldDefs(1, flag);203 allocateFieldDefs(1, isStatic); 196 204 o1 = _fieldDefs; 197 205 } 198 206 int i = o1.getExtent(); -
src/net/rim/tools/compiler/codfile/ClassRef.java
old new 45 45 int j = a2.readUnsignedShort(); 46 46 _module = k1.getModule(j); 47 47 net.rim.tools.compiler.codfile.DataBytes a1_1 = k1.getDataBytes(); 48 _packageName = a1_1.get_identifier(a2.readUnsignedShort()); 49 _className = a1_1.get_identifier(a2.readUnsignedShort()); 48 int pkgId = a2.readUnsignedShort(); 49 int clsId = a2.readUnsignedShort(); 50 _packageName = a1_1.get_identifier(pkgId); 51 _className = a1_1.get_identifier(clsId); 52 System.out.println("---- ModId 0x" + Integer.toHexString(j) + " PkgId " + Integer.toHexString(pkgId) + " = " + _packageName.getString() + 53 " ClsId " + Integer.toHexString(clsId) + " = " + _className.getString()); 54 System.out.println("----- Mod Ord " + _module.getOrdinal() + " names " + _module.get_Name() + " " + _module.get_name_1() + " " + _module.get_name_2()); 50 55 _bgvV(); 51 56 z_hnI = a2.readUnsignedByte(); 52 57 z_hjI = a2.readUnsignedByte(); 53 58 if(j != 0) 54 59 if(_module instanceof net.rim.tools.compiler.codfile.ModuleDomestic) 55 60 { 61 System.out.println("---- DOMESTIC"); 56 62 _classDef = new net.rim.tools.compiler.codfile.ClassDefForeign(k1, _module, _packageName, _className); 57 63 _module._ifuV(_classDef); 58 64 } else 59 65 if(_module instanceof net.rim.tools.compiler.codfile.ModuleRef) 60 66 { 67 System.out.println("---- REF"); 61 68 net.rim.tools.compiler.codfile.ModuleRef g1 = (net.rim.tools.compiler.codfile.ModuleRef)_module; 62 69 _classDef = new net.rim.tools.compiler.codfile.ClassDefDomestic(k1, _module, _packageName, _className); 63 70 g1._auvV(_classDef, z_hjI); 64 71 } else 65 72 if(_module instanceof net.rim.tools.compiler.codfile.ModuleForeign) 66 73 { 74 System.out.println("---- FOREIGN"); 67 75 net.rim.tools.compiler.codfile.ModuleForeign au1 = (net.rim.tools.compiler.codfile.ModuleForeign)_module; 68 76 _classDef = new net.rim.tools.compiler.codfile.l(k1, _module, _packageName, _className); 69 77 au1._ifuvV(_classDef, z_hjI); 70 78 } else 71 79 if(_module instanceof net.rim.tools.compiler.codfile.ModuleNull) 72 80 { 81 System.out.println("---- NULL"); 73 82 _classDef = new net.rim.tools.compiler.codfile.ClassDefNull(k1, _packageName, _className); 74 83 _classDef.setModule(_module); 75 84 } -
src/net/rim/tools/compiler/codfile/DataSection.java
old new 61 61 private boolean _aliasesFlag; 62 62 private boolean z_eYZ; 63 63 private boolean z_e7Z; 64 private boolean fh; 65 private boolean _isVersion6; 64 66 private net.rim.tools.compiler.codfile.CodfileVector _fixedFields; 65 67 private net.rim.tools.compiler.codfile.CodfileVector _classDataFixups; 66 68 private net.rim.tools.compiler.codfile.CodfileVector _nativeRoutines; … … 94 96 _fieldsFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 95 97 _localFieldsFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 96 98 _staticFieldsFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 99 _isVersion6 = false; 100 fh = true; 97 101 z_eGZ = true; 98 102 z_e4Z = true; 99 103 _moduleCodeFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); … … 127 131 _nativeRoutines = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 128 132 _nativeRoutines.setTableName("native routine table"); 129 133 _moduleCodeFixups.setTableName("module code fixup table"); 130 _Version = 5; 134 _Version = 6; 135 if (_Version >= 6) 136 { 137 _isVersion6 = true; 138 fh = false; 139 z_eGZ = false; 140 z_e4Z = false; 141 z_e7Z = false; 142 } 131 143 } 132 144 133 145 public void read(net.rim.tools.compiler.io.StructuredInputStream __input, boolean flag) … … 137 149 _Flags = __input.readUnsignedByte() & 0x37; 138 150 _Version = __input.readUnsignedByte(); 139 151 z_eYZ = false; 152 fh = false; 140 153 z_eGZ = false; 141 154 z_e4Z = false; 142 155 z_e7Z = false; 143 156 if(_Version >= 4) 144 157 { 145 158 z_eYZ = true; 159 fh = true; 146 160 z_e4Z = true; 147 161 if(_Version >= 5) 148 162 { 149 163 z_e7Z = true; 150 164 z_eGZ = true; 151 165 } 166 if(_Version >= 6) 167 { 168 _isVersion6 = true; 169 z_eYZ = false; 170 fh = false; 171 z_eGZ = false; 172 z_e4Z = false; 173 z_e7Z = false; 174 } 152 175 } 176 System.out.println("!!!! VERSION = " + Integer.toString(_Version)); 153 177 if(!_aliasesFlag); 154 178 _iCallsNumber = __input.readUnsignedShort(); 155 179 int _numModules_ = __input.readUnsignedByte(); … … 271 295 process_intdStaticData(__input, l, flag); 272 296 __input.moveCurrentIdxtoOffset(_offsetClassRefs_); 273 297 addClassRefs(__input, _routineFixups.getOffset()); 298 /* 274 299 if(!z_eYZ) 275 300 _doaZ(__input, _routineFixups, flag); 276 301 else 277 z_eYZ = _ifaZ(__input, _routineFixups, flag); 302 z_eYZ = _ifaZ(__input, _routineFixups, flag); // I think this is wrong... new version assigns retval of this to another flag 278 303 z_e4Z = _doaZ(__input, _staticRoutineFixups, flag); 279 304 _doaZ(__input, _virtualRoutineFixups, flag); 280 305 if(!z_eYZ) //!z_eYZ --- demo files from BB JDE produce error here when !z_eYZ … … 293 318 _aaV(__input, _moduleCodeFixups, false); 294 319 else 295 320 addInterfaceMethodRefs(__input, flag); 321 */ 322 if(!z_eYZ) 323 _doaZ(__input, _routineFixups, true, flag); 324 else 325 fh = _ifaZ(__input, _routineFixups, true, flag); 326 if(!z_eYZ) 327 _doaZ(__input, _staticRoutineFixups, true, flag); 328 else 329 z_e4Z = _ifaZ(__input, _staticRoutineFixups, true, flag); 330 _doaZ(__input, _virtualRoutineFixups, true, flag); 331 if(!z_eYZ) 332 _aaV(__input, _classCodeFixups); 333 else 334 create_classDefFixupTable(__input, _classCodeFixups); 335 if(!_aliasesFlag) 336 _aaV(__input, _classDataFixups); 337 _doaZ(__input, _fieldsFixups, false, flag); 338 _foraV(__input, _localFieldsFixups, flag); 339 if(!z_eGZ) 340 _doaZ(__input, _staticFieldsFixups, false, flag); 341 else 342 z_eGZ = _ifaZ(__input, _staticFieldsFixups, false, flag); 343 if(_aliasesFlag) 344 _aaV(__input, _moduleCodeFixups, false); 345 else 346 addInterfaceMethodRefs(__input, flag); 347 348 296 349 __input.verifySlack(4); 297 350 setExtent(__input.getOffset()); 298 351 byte abyte0[] = _codFile._bKvaB(); … … 339 392 _aagBIV(_moduleCodeFixups, abyte1, i2); 340 393 if(!flag) 341 394 { 342 if(!z_eYZ) 395 /*if(!z_eYZ) 396 _foraBIV(abyte1, i2);*/ 397 if(!z_eYZ || !fh) 343 398 _foraBIV(abyte1, i2); 399 /*update_staticRoutineFixupTable(abyte1, i2);*/ 400 if(!z_e4Z) 344 401 update_staticRoutineFixupTable(abyte1, i2); 345 402 _intaBIV(abyte1, i2); 346 403 update_fieldFixupTable(_fieldsFixups, abyte1, i2); … … 496 553 { 497 554 __input.verifySlack(_classRefs.getAlign()); 498 555 __input.verifyOffset(_classRefs.getOffset(), "class refs"); 499 for(; __input.getOffset() < __offset; _classRefs.addElement(new net.rim.tools.compiler.codfile.ClassRef(__input, this, _classRefs.size()))); 556 System.out.println("-- Adding class refs from 0x" + Integer.toHexString(__input.getOffset()) + " to 0x" + 557 Integer.toHexString(__offset)); 558 for( 559 ;__input.getOffset() < __offset 560 ;) 561 { 562 System.out.println("---- Adding classref Ord " + Integer.toHexString(_classRefs.size()) + " at offset 0x" + Integer.toHexString(__input.getOffset())); 563 net.rim.tools.compiler.codfile.ClassRef classRef = new net.rim.tools.compiler.codfile.ClassRef(__input, this, _classRefs.size()); 564 System.out.println("---- (ref name is ... " + classRef.getClassName().getString() + ")"); 565 _classRefs.addElement(classRef); 566 } 500 567 } 501 568 502 569 public void _amvV() … … 516 583 517 584 } 518 585 519 public boolean _doaZ(net.rim.tools.compiler.io.StructuredInputStream __input, net.rim.tools.compiler.codfile.CodfileVector ag1, boolean flag)586 public boolean _doaZ(net.rim.tools.compiler.io.StructuredInputStream __input, net.rim.tools.compiler.codfile.CodfileVector ag1, boolean mebbeIsRoutineFixups, boolean flag) 520 587 throws IOException 521 588 { 522 589 boolean flag1 = true; 590 boolean needsAdvancedMemberRef = mebbeIsRoutineFixups && _isVersion6; 523 591 __input.verifySlack(ag1.getAlign()); 524 592 __input.verifyOffset(ag1.getOffset(), "member fixup table"); 525 int l =MemberRef._SvI();593 int elementSize = needsAdvancedMemberRef ? net.rim.tools.compiler.codfile.AdvancedMemberRef._SvI() : net.rim.tools.compiler.codfile.MemberRef._SvI(); 526 594 int i1 = __input.readShort(); 595 System.out.println("Read " + Integer.toString(i1) + " members, each " + Integer.toString(elementSize) + "bytes"); 527 596 if(i1 < 0) 528 597 { 529 598 i1 = -i1; … … 535 604 __input.verifySlack(2); 536 605 if(flag) 537 606 { 538 __input.skipBytes( l);607 __input.skipBytes(elementSize); 539 608 if(_aliasesFlag) 540 609 { 541 610 int k1 = __input.readUnsignedShort1(); … … 547 616 } 548 617 } else 549 618 { 550 net.rim.tools.compiler.codfile.MemberRef j2 = new net.rim.tools.compiler.codfile.MemberRef(__input, this); 551 ag1.addElement(new net.rim.tools.compiler.codfile.FixupTableEntry(__input, j2, 2, _aliasesFlag, false)); 619 //net.rim.tools.compiler.codfile.MemberRef j2 = new net.rim.tools.compiler.codfile.MemberRef(__input, this); 620 net.rim.tools.compiler.codfile.MemberRef memberRef = 621 needsAdvancedMemberRef ? 622 new net.rim.tools.compiler.codfile.AdvancedMemberRef(__input, this) : 623 new net.rim.tools.compiler.codfile.MemberRef(__input, this); 624 ag1.addElement(new net.rim.tools.compiler.codfile.FixupTableEntry(__input, memberRef, 2, _aliasesFlag, false)); 552 625 } 553 626 } 554 627 555 628 return flag1; 556 629 } 557 630 558 public boolean _ifaZ(net.rim.tools.compiler.io.StructuredInputStream __input, net.rim.tools.compiler.codfile.CodfileVector __codFileVector, boolean flag)631 public boolean _ifaZ(net.rim.tools.compiler.io.StructuredInputStream __input, net.rim.tools.compiler.codfile.CodfileVector __codFileVector, boolean mebbeIsRoutineFixups, boolean flag) 559 632 throws IOException 560 633 { 561 634 boolean flag1 = true; 635 boolean needsAdvancedMemberRef = mebbeIsRoutineFixups && _isVersion6; 562 636 __input.verifySlack(__codFileVector.getAlign()); 563 637 __input.verifyOffset(__codFileVector.getOffset(), "implied member fixup table"); 564 int l =MemberRef._SvI();638 int elementSize = needsAdvancedMemberRef ? net.rim.tools.compiler.codfile.AdvancedMemberRef._SvI() : net.rim.tools.compiler.codfile.MemberRef._SvI(); 565 639 int i1 = __input.readShort(); 640 System.out.println("Read " + Integer.toString(i1) + " members, each " + Integer.toString(elementSize) + "bytes"); 566 641 if(i1 < 0) 567 642 { 568 643 i1 = -i1; 569 644 flag1 = false; 570 645 __codFileVector.negatePrefix(); 571 646 } 647 if (!flag1) System.out.println(">>>>><<<<<"); 572 648 for(int j1 = 0; j1 < i1; j1++) 573 649 { 574 650 __input.verifySlack(2); 575 651 if(flag) 576 652 { 577 __input.skipBytes( l);653 __input.skipBytes(elementSize); 578 654 if(!flag1) 579 655 if(_aliasesFlag) 580 656 { … … 587 663 } 588 664 } else 589 665 { 590 net.rim.tools.compiler.codfile.MemberRef j2 = new net.rim.tools.compiler.codfile.MemberRef(__input, this); 591 __codFileVector.addElement(new net.rim.tools.compiler.codfile.FixupTableEntry(__input, j2, 2, _aliasesFlag, flag1)); 666 net.rim.tools.compiler.codfile.MemberRef memberRef = 667 needsAdvancedMemberRef ? 668 new net.rim.tools.compiler.codfile.AdvancedMemberRef(__input, this) : 669 new net.rim.tools.compiler.codfile.MemberRef(__input, this); 670 __codFileVector.addElement(new net.rim.tools.compiler.codfile.FixupTableEntry(__input, memberRef, 2, _aliasesFlag, flag1)); 592 671 } 593 672 } 594 673 … … 832 911 } 833 912 } 834 913 835 public net.rim.tools.compiler.codfile.Routine _yIa5(int l)914 public net.rim.tools.compiler.codfile.Routine getVirtualRoutine(int l) 836 915 throws IOException 837 916 { 838 917 Object obj = null; … … 846 925 { 847 926 obj = new net.rim.tools.compiler.codfile.RoutineNull(_ClassDef, this); 848 927 ((net.rim.tools.compiler.codfile.CodfileItem) (obj)).setAddress(l); 928 929 /* equals/toString via observed behavior */ 930 switch (l) { 931 case 1: 932 ((net.rim.tools.compiler.codfile.Member) (obj))._ifStringvV("equals", 0); 933 break; 934 case 2: 935 ((net.rim.tools.compiler.codfile.Member) (obj))._ifStringvV("toString", 0); 936 break; 937 938 default: 849 939 ((net.rim.tools.compiler.codfile.Member) (obj))._ifStringvV("virtual_", l); 940 break; 941 } 850 942 } 851 943 return ((net.rim.tools.compiler.codfile.Routine) (obj)); 852 944 } … … 872 964 } 873 965 } 874 966 875 public net.rim.tools.compiler.codfile.FieldDef _tIw(int l)967 public net.rim.tools.compiler.codfile.FieldDef getField(int l) 876 968 throws IOException 877 969 { 878 970 if(l < -1) … … 886 978 net.rim.tools.compiler.codfile.TypeList p = _TypeLists.getNullTypeList(); 887 979 net.rim.tools.compiler.codfile.FieldDefLocal ab1 = new net.rim.tools.compiler.codfile.FieldDefLocal(_ClassDef, ak1, p, false); 888 980 ab1.setAddress(l); 889 ab1._ifStringvV("field_" , l);981 ab1._ifStringvV("field_"+l+"_", l); 890 982 return ab1; 891 983 } 892 984 … … 1623 1715 } 1624 1716 } 1625 1717 1718 public void cockItUp() 1719 { 1720 for (int i =0; i < _modules.size(); i++) { 1721 net.rim.tools.compiler.codfile.Module m = (net.rim.tools.compiler.codfile.Module)_modules.elementAt(i); 1722 if (m == null) continue; 1723 System.out.println("$$ " + i + " " + m.get_Name() + " " + m.get_name_1() + " " + m.get_name_2() + " "); 1724 m.cockItUp(); 1725 } 1726 } 1727 1626 1728 public net.rim.tools.compiler.codfile.ClassDef findClassDef(int __moduleOrdinal, int __classOrdinal) 1627 1729 throws IOException 1628 1730 { … … 1630 1732 return _ClassDef; 1631 1733 if(__moduleOrdinal == 0) 1632 1734 return getClassDef(__moduleOrdinal, __classOrdinal); 1735 //System.out.println(">> findClassDef(" + __moduleOrdinal + ", " + __classOrdinal + ")"); 1633 1736 net.rim.tools.compiler.codfile.Module af1 = (net.rim.tools.compiler.codfile.Module)_modules.elementAt(__moduleOrdinal); 1634 1737 if((af1 instanceof net.rim.tools.compiler.codfile.ModuleRef) || (af1 instanceof net.rim.tools.compiler.codfile.ModuleForeign)) 1635 1738 return af1.getClassDef(__classOrdinal); 1739 int __origClassOrd = __classOrdinal; 1740 //System.out.println(">>> We have " + _classRefs.size() + " class refs"); 1636 1741 for(int j1 = _classRefs.size(); __classOrdinal < j1; __classOrdinal += 256) 1637 1742 { 1638 1743 net.rim.tools.compiler.codfile.ClassRef at1 = (net.rim.tools.compiler.codfile.ClassRef)_classRefs.elementAt(__classOrdinal); 1744 //System.out.println(">>>> Try classord " + __classOrdinal + " hiz modord is " + at1.getModuleNum()); 1639 1745 if(at1.getModuleNum() == __moduleOrdinal) 1640 1746 return at1.getClassDef(); 1641 1747 } 1642 1748 1643 throw new IOException("no class ref found for module: " + __moduleOrdinal + " class ordinal: " + __classOrdinal); 1749 /* System.out.println(">> findClassDef ModOrd " + __moduleOrdinal + " ClassOrd " + __classOrdinal); 1750 System.out.println("-- We have " + _classRefs.size() + " class refs"); 1751 for (int me = 0; me < _classRefs.size(); me++) { 1752 ClassRef cr = (ClassRef)_classRefs.elementAt(me); 1753 System.out.println("---- ClassOrd " + me + " ModOrd " + cr.getModuleNum() + " ClsName " + cr.getClassName().getString()); 1754 } 1755 System.out.println("-- We have " + _modules.size() + " modules"); 1756 for (int me = 0; me < _modules.size(); me++) { 1757 Module mo = (Module)_modules.elementAt(me); 1758 System.out.println("---- Idx " + me + " ModOrd " + mo.getOrdinal() + " Name? " + mo.getName().getString() + " CDefs " + mo.getNumClassDefs()); 1759 for (int cdi = 0; cdi < mo.getNumClassDefs(); cdi++) { 1760 ClassDef cd = mo.getClassDef(cdi); 1761 System.out.println("------ Idx " + cdi + " Cns " + cd.getClassNameString() + " Ord " + cd.getOrdinal()); 1762 } 1763 }*/ 1764 System.out.println(">>>>>>>>>>>>>>>>>>>>>>"); 1765 System.out.println(" Something's fucked, so let's just return getClassDef(" + __moduleOrdinal + "," + __origClassOrd + ")..."); 1766 System.out.println(">>>>>>>>>>>>>>>>>>>>>>"); 1767 1768 net.rim.tools.compiler.codfile.ClassDef fuckRef = getClassDef(__moduleOrdinal, __origClassOrd); 1769 System.out.println(fuckRef.get_Name() + " " + fuckRef.get_name_1() + " " + fuckRef.get_name_2() + " " + fuckRef.getClassNameString()); 1770 return fuckRef; 1771 //throw new IOException("no class ref found for module: " + __moduleOrdinal + " class ordinal: " + __classOrdinal); 1644 1772 } 1645 1773 1646 1774 public net.rim.tools.compiler.codfile.ClassRef getClassRef(int __offset) … … 1714 1842 return _virtualRoutineFixups; 1715 1843 } 1716 1844 return null; 1845 } 1846 1847 public boolean isVersion6() 1848 { 1849 return _isVersion6; 1717 1850 } 1718 1851 } -
src/net/rim/tools/compiler/codfile/FieldDefLocal.java
old new 24 24 super(u1, ak1, p, flag); 25 25 } 26 26 27 public FieldDefLocal(net.rim.tools.compiler.io.StructuredInputStream a2, net.rim.tools.compiler.codfile.DataSection k1, net.rim.tools.compiler.codfile.ClassDef u1, boolean flag)27 public FieldDefLocal(net.rim.tools.compiler.io.StructuredInputStream a2, net.rim.tools.compiler.codfile.DataSection k1, net.rim.tools.compiler.codfile.ClassDef u1, boolean isStatic) 28 28 throws IOException 29 29 { 30 super(u1, a2.getOffset(), flag);30 super(u1, a2.getOffset(), isStatic); 31 31 read(a2, k1); 32 32 } 33 33 … … 51 51 protected int addFixup(net.rim.tools.compiler.io.StructuredOutputStream c1, net.rim.tools.compiler.codfile.ClassDef u1) 52 52 { 53 53 int i = -1; 54 if(super._isStatic) 54 if(super._isStatic) { 55 System.out.println("LLINGO 1"); 55 56 i = super.addFixup(c1, u1); 56 else57 } else 57 58 if(super._ordinal > 255) 58 59 { 60 System.out.println("LLINGO 2"); 59 61 Object obj = c1.getCookie(); 60 62 if(obj != null) 61 63 { … … 70 72 Object obj1 = c1.getCookie(); 71 73 if(obj1 != null) 72 74 { 75 System.out.println("LLINGO 3"); 73 76 if(super._fixups == null) 74 77 { 75 78 super._fixups = new net.rim.tools.compiler.codfile.FixupTableEntry(1); … … 141 144 k1._foranV(super._fixups); 142 145 } 143 146 144 public static int _ifZI(boolean flag)147 public static int elementSize(boolean flag) 145 148 { 146 149 return flag ? 6 : 4; 147 150 } -
src/net/rim/tools/compiler/codfile/MemberRef.java
old new 46 46 public MemberRef(net.rim.tools.compiler.io.StructuredInputStream __input, net.rim.tools.compiler.codfile.DataSection __dataSection) 47 47 throws IOException 48 48 { 49 _classRef = __dataSection.getClassRef(__input.readUnsignedShort()); 49 int mbrOfs = __input.getOffset(); 50 int crOfs = __input.readUnsignedShort(); 51 System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); 52 System.out.println("> ofs 0x" + Integer.toHexString(mbrOfs) + " -> CR 0x" + Integer.toHexString(crOfs)); 53 54 _classRef = __dataSection.getClassRef(crOfs); 55 //_classRef = __dataSection.getClassRef(__input.readUnsignedShort()); 56 57 System.out.println("In class(?) " + _classRef.getClassName().getString()); 58 50 59 _name = __dataSection.getDataBytes().get_identifier(__input.readUnsignedShort()); 60 System.out.println("member " + _name.getString()); 61 51 62 _typeListOffset = __input.readUnsignedShort(); 52 63 } 53 64 -
src/net/rim/tools/compiler/codfile/Routine.java
old new 225 225 z_fIStringBuffer.append(super._typeList.get_baseType().getTypeName()); 226 226 z_fIStringBuffer.append(" "); 227 227 } 228 if (super._name.getString().length() == 0) { 229 z_fIStringBuffer.append(super.get_Name()); 230 } else { 228 231 z_fIStringBuffer.append(super._name.getString()); 232 } 229 233 z_fIStringBuffer.append("( "); 230 234 int i = _protoTypeList.length(); 231 235 for(int l = 0; l < i; l++) -
src/net/rim/tools/compiler/exec/c.java
old new 15 15 16 16 public class c 17 17 { 18 static class c 18 static class c_static 19 19 { 20 20 21 21 private static final int z_ifI = 4; … … 154 154 z_charDeflater.end(); 155 155 } 156 156 157 public c (int j, int k, int l, DataOutputStream dataoutputstream)157 public c_static(int j, int k, int l, DataOutputStream dataoutputstream) 158 158 { 159 159 z_gotoc$b = new net.rim.tools.compiler.exec.cls_c$b(); 160 160 z_caseI = l; -
src/net/rim/tools/compiler/types/ClassType.java
old new 177 177 178 178 public void set_className(String s) 179 179 { 180 System.out.println("SET CLASS NAME TO " + s); 180 181 f_className_nv = s; 181 182 } 182 183
Note: See TracBrowser for help on using the browser.
