root/projects/bberry/coddec.patch

Revision 13, 58.3 kB (checked in by lawler, 1 year ago)

i swear i am losing my mind, i gen the patch, upload it, download it, and it dont work...

  • src/net/rim/tools/a/coddec.java

    old new  
    1818        private static Hashtable _codfiles = null; 
    1919        private static Hashtable _imports = null; 
    2020        private static StringBuffer _output = null; 
     21        public static String currentFileHackCrap; 
    2122         
    2223        public coddec () 
    2324        { 
     
    8889        { 
    8990                String s1= ""; 
    9091                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(">>>>>>>>>>>>>>>>>>>>>>>>>>"); 
    9195                if (_module_ == null) 
    9296                { 
    9397                         
     
    129133         
    130134        public static String getTypeName (net.rim.tools.compiler.codfile.TypeItem __typeItem) 
    131135        { 
    132                 String _typeName_ =""; 
     136                String _typeName_ =""; String _origTypeName_=""; 
    133137                 
    134138                if (__typeItem != null) 
    135139                { 
    136140                        _typeName_ = __typeItem.getTypeName(); 
     141                        _origTypeName_ = __typeItem.getTypeName(); 
    137142                         
    138143                        if (_typeName_.contains(".")) 
    139144                        { 
     
    155160                } 
    156161                else 
    157162                        _typeName_ = "void"; 
    158                 return _typeName_
     163                return _typeName_ + " /*"+_origTypeName_+"*/ "
    159164        } 
    160165         
    161166        public static String getTypeName (net.rim.tools.compiler.codfile.ClassDef __classDef) 
     
    480485                                        __message.append(getTypeName( _type_) + " "); 
    481486                                         
    482487                                        // 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) 
    483490                                        if (!(_field_.getName().get_Name() != null && _field_.getName().get_Name().length() == 0)) 
    484491                                                __message.append (_field_.getName().get_Name() + " "); 
    485492                                        // Changes 
    486493                                        // We leave only defined fields, not fields by offset 
    487                                         else 
     494                                        else { 
    488495                                                __message.append ("field_" + _field_.getOffset() + " "); 
     496                                        } 
    489497                                         
    490498                                        // Field initial value 
    491499                                        if (!_clinit_) 
     
    495503                                                //_code_. 
    496504                                        } 
    497505                                        // 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"); 
    499509                                } 
    500510                                __message.append("\r\n"); 
    501511                        } 
     
    672682                                        { 
    673683                                                case 0: 
    674684                                                        _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)); 
    675691                                                        break; 
    676692                                                case 1: 
    677693                                                        _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)); 
    678700                                                        break; 
    679701                                                case 2: 
    680702                                                        _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)); 
    681709                                                        break; 
    682710                                                default: 
    683711                                                        break; 
     
    710738                                        //if (_routineAttributes.length() != 0) 
    711739                                        //{ 
    712740                                        __message.append(_routineAttributesString_); 
     741                                        System.err.println("APPEND AS " + _routineAttributesString_); 
    713742                                        //} 
    714743                                        //else 
    715744                                        //      break; 
    716745                                         
    717746                                        __message.append(_routineLocal_.get_Name()); 
     747                                        System.err.println("APPEND NM " + _routineLocal_.get_Name()); 
    718748                                        // Return type 
    719749                                        //net.rim.tools.compiler.codfile.TypeItem _returnType_ = _routineLocal_.getTypeList().get_baseType(); 
    720750                                        //__message.append(getTypeName(_returnType_) + " "); 
     
    733763                                        //CHANGES: 
    734764                                        //ADDED semi-colon after function header 
    735765                                        __message.append(";"); 
     766                                         
     767                                        __message.append(" // address: " + _routineLocal_.getAddress()); 
     768                                         
    736769                                        __message.append("\r\n"); 
    737770                                         
    738771                                        // exceptions 
     
    838871                { 
    839872                        if(!_packageFolder_.mkdirs()) 
    840873                        { 
    841                                 System.out.println("Problem creating package " + __packageName + " folders"); 
     874                                System.err.println("Problem creating package " + __packageName + " folders"); 
    842875                                _packagePath_ = ""; 
    843876                                return _packagePath_; 
    844877                        } 
     
    856889                        StringBuffer _stringBuf_ = new StringBuffer(); 
    857890                        StringBuffer _importsBuf_ = new StringBuffer(""); 
    858891                         
    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                        } 
    860898                        FileOutputStream _javaOutputStream_ = new FileOutputStream(_pathString); 
    861899                        try 
    862900                        { 
     
    931969                } 
    932970        } 
    933971         
    934         private static void parseFile (String __fileName) 
     972        public static void parseFile (String __fileName) 
    935973        { 
    936974                File _file_ = new File(__fileName); 
    937975                if (_file_.exists()) 
     
    9791017                        for (int k = 0; k < i; k++) 
    9801018                        { 
    9811019                                String s = args[k]; 
     1020                                _coddec.currentFileHackCrap = s.replaceFirst(".cod", "");; 
    9821021                                parseFile(s); 
    9831022                                 
    9841023                                net.rim.tools.compiler.codfile.Module _module_ = null; 
  • src/net/rim/tools/compiler/codfile/ClassDef.java

    old new  
    181181        } 
    182182    } 
    183183 
    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
    185185    { 
     186        if (!isStatic) { 
     187                System.out.println("----------------- addFieldDef"); 
     188                try { 
     189                        throw new Exception("yay"); 
     190                } catch (Exception e) { 
     191                        e.printStackTrace(); 
     192                } 
     193        } 
    186194        net.rim.tools.compiler.codfile.CodfileArray o1 = null; 
    187         if(flag
     195        if(isStatic
    188196        { 
    189197            if(_staticFieldDefs == null) 
    190                 allocateFieldDefs(1, flag); 
     198                allocateFieldDefs(1, isStatic); 
    191199            o1 = _staticFieldDefs; 
    192200        } else 
    193201        { 
    194202            if(_fieldDefs == null) 
    195                 allocateFieldDefs(1, flag); 
     203                allocateFieldDefs(1, isStatic); 
    196204            o1 = _fieldDefs; 
    197205        } 
    198206        int i = o1.getExtent(); 
  • src/net/rim/tools/compiler/codfile/ClassRef.java

    old new  
    4545        int j = a2.readUnsignedShort(); 
    4646        _module = k1.getModule(j); 
    4747        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()); 
    5055        _bgvV(); 
    5156        z_hnI = a2.readUnsignedByte(); 
    5257        z_hjI = a2.readUnsignedByte(); 
    5358        if(j != 0) 
    5459            if(_module instanceof net.rim.tools.compiler.codfile.ModuleDomestic) 
    5560            { 
     61                System.out.println("---- DOMESTIC"); 
    5662                _classDef = new net.rim.tools.compiler.codfile.ClassDefForeign(k1, _module, _packageName, _className); 
    5763                _module._ifuV(_classDef); 
    5864            } else 
    5965            if(_module instanceof net.rim.tools.compiler.codfile.ModuleRef) 
    6066            { 
     67                System.out.println("---- REF"); 
    6168                net.rim.tools.compiler.codfile.ModuleRef g1 = (net.rim.tools.compiler.codfile.ModuleRef)_module; 
    6269                _classDef = new net.rim.tools.compiler.codfile.ClassDefDomestic(k1, _module, _packageName, _className); 
    6370                g1._auvV(_classDef, z_hjI); 
    6471            } else 
    6572            if(_module instanceof net.rim.tools.compiler.codfile.ModuleForeign) 
    6673            { 
     74                System.out.println("---- FOREIGN"); 
    6775                net.rim.tools.compiler.codfile.ModuleForeign au1 = (net.rim.tools.compiler.codfile.ModuleForeign)_module; 
    6876                _classDef = new net.rim.tools.compiler.codfile.l(k1, _module, _packageName, _className); 
    6977                au1._ifuvV(_classDef, z_hjI); 
    7078            } else 
    7179            if(_module instanceof net.rim.tools.compiler.codfile.ModuleNull) 
    7280            { 
     81                System.out.println("---- NULL"); 
    7382                _classDef = new net.rim.tools.compiler.codfile.ClassDefNull(k1, _packageName, _className); 
    7483                _classDef.setModule(_module); 
    7584            } 
  • src/net/rim/tools/compiler/codfile/DataSection.java

    old new  
    6161    private boolean _aliasesFlag; 
    6262    private boolean z_eYZ; 
    6363    private boolean z_e7Z; 
     64    private boolean fh; 
     65    private boolean _isVersion6; 
    6466    private net.rim.tools.compiler.codfile.CodfileVector _fixedFields; 
    6567    private net.rim.tools.compiler.codfile.CodfileVector _classDataFixups; 
    6668    private net.rim.tools.compiler.codfile.CodfileVector _nativeRoutines; 
     
    9496        _fieldsFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 
    9597        _localFieldsFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 
    9698        _staticFieldsFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 
     99        _isVersion6 = false; 
     100        fh = true; 
    97101        z_eGZ = true; 
    98102        z_e4Z = true; 
    99103        _moduleCodeFixups = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 
     
    127131        _nativeRoutines = new net.rim.tools.compiler.codfile.CodfileVector(2, true); 
    128132        _nativeRoutines.setTableName("native routine table"); 
    129133        _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        } 
    131143    } 
    132144 
    133145    public void read(net.rim.tools.compiler.io.StructuredInputStream __input, boolean flag) 
     
    137149        _Flags = __input.readUnsignedByte() & 0x37; 
    138150        _Version = __input.readUnsignedByte(); 
    139151        z_eYZ = false; 
     152        fh = false; 
    140153        z_eGZ = false; 
    141154        z_e4Z = false; 
    142155        z_e7Z = false; 
    143156        if(_Version >= 4) 
    144157        { 
    145158            z_eYZ = true; 
     159            fh = true; 
    146160            z_e4Z = true; 
    147161            if(_Version >= 5) 
    148162            { 
    149163                z_e7Z = true; 
    150164                z_eGZ = true; 
    151165            } 
     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            } 
    152175        } 
     176        System.out.println("!!!! VERSION = " + Integer.toString(_Version)); 
    153177        if(!_aliasesFlag); 
    154178        _iCallsNumber = __input.readUnsignedShort(); 
    155179        int _numModules_ = __input.readUnsignedByte(); 
     
    271295        process_intdStaticData(__input, l, flag); 
    272296        __input.moveCurrentIdxtoOffset(_offsetClassRefs_); 
    273297        addClassRefs(__input, _routineFixups.getOffset()); 
     298/*         
    274299        if(!z_eYZ) 
    275300            _doaZ(__input, _routineFixups, flag); 
    276301        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 
    278303        z_e4Z = _doaZ(__input, _staticRoutineFixups, flag); 
    279304        _doaZ(__input, _virtualRoutineFixups, flag); 
    280305        if(!z_eYZ) //!z_eYZ --- demo files from BB JDE produce error here when !z_eYZ 
     
    293318            _aaV(__input, _moduleCodeFixups, false); 
    294319        else 
    295320            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         
    296349        __input.verifySlack(4); 
    297350        setExtent(__input.getOffset()); 
    298351        byte abyte0[] = _codFile._bKvaB(); 
     
    339392            _aagBIV(_moduleCodeFixups, abyte1, i2); 
    340393        if(!flag) 
    341394        { 
    342             if(!z_eYZ) 
     395            /*if(!z_eYZ) 
     396                _foraBIV(abyte1, i2);*/ 
     397                if(!z_eYZ || !fh) 
    343398                _foraBIV(abyte1, i2); 
     399            /*update_staticRoutineFixupTable(abyte1, i2);*/ 
     400                if(!z_e4Z) 
    344401            update_staticRoutineFixupTable(abyte1, i2); 
    345402            _intaBIV(abyte1, i2); 
    346403            update_fieldFixupTable(_fieldsFixups, abyte1, i2); 
     
    496553    { 
    497554        __input.verifySlack(_classRefs.getAlign()); 
    498555        __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        } 
    500567    } 
    501568 
    502569    public void _amvV() 
     
    516583 
    517584    } 
    518585 
    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) 
    520587        throws IOException 
    521588    { 
    522589        boolean flag1 = true; 
     590        boolean needsAdvancedMemberRef = mebbeIsRoutineFixups && _isVersion6; 
    523591        __input.verifySlack(ag1.getAlign()); 
    524592        __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(); 
    526594        int i1 = __input.readShort(); 
     595        System.out.println("Read " + Integer.toString(i1) + " members, each " + Integer.toString(elementSize) + "bytes"); 
    527596        if(i1 < 0) 
    528597        { 
    529598            i1 = -i1; 
     
    535604            __input.verifySlack(2); 
    536605            if(flag) 
    537606            { 
    538                 __input.skipBytes(l); 
     607                __input.skipBytes(elementSize); 
    539608                if(_aliasesFlag) 
    540609                { 
    541610                                        int k1 = __input.readUnsignedShort1(); 
     
    547616                } 
    548617            } else 
    549618            { 
    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)); 
    552625            } 
    553626        } 
    554627 
    555628        return flag1; 
    556629    } 
    557630 
    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) 
    559632        throws IOException 
    560633    { 
    561634        boolean flag1 = true; 
     635        boolean needsAdvancedMemberRef = mebbeIsRoutineFixups && _isVersion6; 
    562636        __input.verifySlack(__codFileVector.getAlign()); 
    563637        __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(); 
    565639        int i1 = __input.readShort(); 
     640        System.out.println("Read " + Integer.toString(i1) + " members, each " + Integer.toString(elementSize) + "bytes"); 
    566641        if(i1 < 0) 
    567642        { 
    568643            i1 = -i1; 
    569644            flag1 = false; 
    570645            __codFileVector.negatePrefix(); 
    571646        } 
     647        if (!flag1) System.out.println(">>>>><<<<<"); 
    572648        for(int j1 = 0; j1 < i1; j1++) 
    573649        { 
    574650            __input.verifySlack(2); 
    575651            if(flag) 
    576652            { 
    577                 __input.skipBytes(l); 
     653                __input.skipBytes(elementSize); 
    578654                if(!flag1) 
    579655                    if(_aliasesFlag) 
    580656                    { 
     
    587663                    } 
    588664            } else 
    589665            { 
    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)); 
    592671            } 
    593672        } 
    594673 
     
    832911        } 
    833912    } 
    834913 
    835     public net.rim.tools.compiler.codfile.Routine _yIa5(int l) 
     914    public net.rim.tools.compiler.codfile.Routine getVirtualRoutine(int l) 
    836915        throws IOException 
    837916    { 
    838917        Object obj = null; 
     
    846925        { 
    847926            obj = new net.rim.tools.compiler.codfile.RoutineNull(_ClassDef, this); 
    848927            ((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: 
    849939            ((net.rim.tools.compiler.codfile.Member) (obj))._ifStringvV("virtual_", l); 
     940                        break; 
     941            } 
    850942        } 
    851943        return ((net.rim.tools.compiler.codfile.Routine) (obj)); 
    852944    } 
     
    872964        } 
    873965    } 
    874966 
    875     public net.rim.tools.compiler.codfile.FieldDef _tIw(int l) 
     967    public net.rim.tools.compiler.codfile.FieldDef getField(int l) 
    876968        throws IOException 
    877969    { 
    878970        if(l < -1) 
     
    886978        net.rim.tools.compiler.codfile.TypeList p = _TypeLists.getNullTypeList(); 
    887979        net.rim.tools.compiler.codfile.FieldDefLocal ab1 = new net.rim.tools.compiler.codfile.FieldDefLocal(_ClassDef, ak1, p, false); 
    888980        ab1.setAddress(l); 
    889         ab1._ifStringvV("field_", l); 
     981        ab1._ifStringvV("field_"+l+"_", l); 
    890982        return ab1; 
    891983    } 
    892984 
     
    16231715        } 
    16241716    } 
    16251717 
     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 
    16261728    public net.rim.tools.compiler.codfile.ClassDef findClassDef(int __moduleOrdinal, int __classOrdinal) 
    16271729        throws IOException 
    16281730    { 
     
    16301732            return _ClassDef; 
    16311733        if(__moduleOrdinal == 0) 
    16321734            return getClassDef(__moduleOrdinal, __classOrdinal); 
     1735        //System.out.println(">> findClassDef(" + __moduleOrdinal + ", " + __classOrdinal + ")"); 
    16331736        net.rim.tools.compiler.codfile.Module af1 = (net.rim.tools.compiler.codfile.Module)_modules.elementAt(__moduleOrdinal); 
    16341737        if((af1 instanceof net.rim.tools.compiler.codfile.ModuleRef) || (af1 instanceof net.rim.tools.compiler.codfile.ModuleForeign)) 
    16351738            return af1.getClassDef(__classOrdinal); 
     1739        int __origClassOrd = __classOrdinal; 
     1740        //System.out.println(">>> We have " + _classRefs.size() + " class refs"); 
    16361741        for(int j1 = _classRefs.size(); __classOrdinal < j1; __classOrdinal += 256) 
    16371742        { 
    16381743            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()); 
    16391745            if(at1.getModuleNum() == __moduleOrdinal) 
    16401746                return at1.getClassDef(); 
    16411747        } 
    16421748 
    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); 
    16441772    } 
    16451773 
    16461774    public net.rim.tools.compiler.codfile.ClassRef getClassRef(int __offset) 
     
    17141842            return _virtualRoutineFixups; 
    17151843        } 
    17161844        return null; 
     1845    } 
     1846     
     1847    public boolean isVersion6() 
     1848    { 
     1849        return _isVersion6; 
    17171850    } 
    17181851} 
  • src/net/rim/tools/compiler/codfile/FieldDefLocal.java

    old new  
    2424        super(u1, ak1, p, flag); 
    2525    } 
    2626 
    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
    2828        throws IOException 
    2929    { 
    30         super(u1, a2.getOffset(), flag); 
     30        super(u1, a2.getOffset(), isStatic); 
    3131        read(a2, k1); 
    3232    } 
    3333 
     
    5151    protected int addFixup(net.rim.tools.compiler.io.StructuredOutputStream c1, net.rim.tools.compiler.codfile.ClassDef u1) 
    5252    { 
    5353        int i = -1; 
    54         if(super._isStatic) 
     54        if(super._isStatic) { 
     55                System.out.println("LLINGO 1"); 
    5556            i = super.addFixup(c1, u1); 
    56         else 
     57        } else 
    5758        if(super._ordinal > 255) 
    5859        { 
     60                System.out.println("LLINGO 2"); 
    5961            Object obj = c1.getCookie(); 
    6062            if(obj != null) 
    6163            { 
     
    7072            Object obj1 = c1.getCookie(); 
    7173            if(obj1 != null) 
    7274            { 
     75                System.out.println("LLINGO 3"); 
    7376                if(super._fixups == null) 
    7477                { 
    7578                    super._fixups = new net.rim.tools.compiler.codfile.FixupTableEntry(1); 
     
    141144                k1._foranV(super._fixups); 
    142145    } 
    143146 
    144     public static int _ifZI(boolean flag) 
     147    public static int elementSize(boolean flag) 
    145148    { 
    146149        return flag ? 6 : 4; 
    147150    } 
  • src/net/rim/tools/compiler/codfile/MemberRef.java

    old new  
    4646    public MemberRef(net.rim.tools.compiler.io.StructuredInputStream __input, net.rim.tools.compiler.codfile.DataSection __dataSection) 
    4747        throws IOException 
    4848    { 
    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 
    5059        _name = __dataSection.getDataBytes().get_identifier(__input.readUnsignedShort()); 
     60        System.out.println("member " + _name.getString()); 
     61 
    5162        _typeListOffset = __input.readUnsignedShort(); 
    5263    } 
    5364 
  • src/net/rim/tools/compiler/codfile/Routine.java

    old new  
    225225                    z_fIStringBuffer.append(super._typeList.get_baseType().getTypeName()); 
    226226                    z_fIStringBuffer.append(" "); 
    227227                } 
     228                if (super._name.getString().length() == 0) { 
     229                    z_fIStringBuffer.append(super.get_Name()); 
     230                } else { 
    228231                z_fIStringBuffer.append(super._name.getString()); 
     232                } 
    229233                z_fIStringBuffer.append("( "); 
    230234                int i = _protoTypeList.length(); 
    231235                for(int l = 0; l < i; l++) 
  • src/net/rim/tools/compiler/exec/c.java

    old new  
    1515 
    1616public class c 
    1717{ 
    18     static class c 
     18    static class c_static 
    1919    { 
    2020 
    2121        private static final int z_ifI = 4; 
     
    154154            z_charDeflater.end(); 
    155155        } 
    156156 
    157         public c(int j, int k, int l, DataOutputStream dataoutputstream) 
     157        public c_static(int j, int k, int l, DataOutputStream dataoutputstream) 
    158158        { 
    159159            z_gotoc$b = new net.rim.tools.compiler.exec.cls_c$b(); 
    160160            z_caseI = l; 
  • src/net/rim/tools/compiler/types/ClassType.java

    old new  
    177177 
    178178    public void set_className(String s) 
    179179    { 
     180        System.out.println("SET CLASS NAME TO " + s); 
    180181        f_className_nv = s; 
    181182    } 
    182183 
Note: See TracBrowser for help on using the browser.