Changeset 347 in dev for trunk/abdev/BasicCompiler_Common/src
- Timestamp:
- Oct 11, 2007, 3:23:51 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r346 r347 665 665 } 666 666 667 void CClass::EnumDynamicMethodsOfInterfaceMethods( const char *methodName, std::vector<const UserProc *> &subs ) const 668 { 669 // 動的メソッド 670 GetDynamicMethods().Enum( methodName, subs ); 671 672 // インターフェイス メソッド 673 BOOST_FOREACH( ::Interface *pInterface, GetInterfaces() ) 674 { 675 pInterface->GetDynamicMethods().Enum( methodName, subs ); 676 } 677 } 678 const CMethod *CClass::GetDynamicMethodOfInterfaceMethod( const UserProc *pUserProc ) const 679 { 680 // 動的メソッド 681 const CMethod *result = GetDynamicMethods().GetMethodPtr( pUserProc ); 682 683 if( !result ) 684 { 685 // インターフェイス メソッド 686 BOOST_FOREACH( ::Interface *pInterface, GetInterfaces() ) 687 { 688 result = pInterface->GetDynamicMethods().GetMethodPtr( pUserProc ); 689 } 690 } 691 692 return result; 693 } 694 667 695 const ::Delegate &CClass::GetDelegate() const 668 696 { … … 803 831 index++; 804 832 805 BOOST_FOREACH( const CMethod *pMethod, pInterface->Get Class().GetDynamicMethods() ){833 BOOST_FOREACH( const CMethod *pMethod, pInterface->GetDynamicMethods() ){ 806 834 if( &pMethod->GetUserProc() == pUserProc ) 807 835 { … … 833 861 return vtblMasterListOffset; 834 862 } 835 void CClass::GenerateVTablePart( long &vtableDataTableOffset ) const836 {837 const UserProc **ppsi = (const UserProc **)malloc(GetVtblNum()*sizeof(UserProc *));838 839 //関数テーブルに値をセット840 int i2 = 0;841 BOOST_FOREACH( const CMethod *pMethod, GetDynamicMethods() ){842 if(pMethod->IsVirtual()){843 if( !pMethod->GetUserProc().IsUsing() )844 {845 ts((char *)pMethod->GetUserProc().GetFullName().c_str());846 }847 pMethod->GetUserProc().Using();848 849 if(pMethod->IsAbstract()){850 extern int cp;851 SmoothieException::Throw(300,NULL,cp);852 853 ppsi[i2]=0;854 }855 else{856 ppsi[i2]=&pMethod->GetUserProc();857 }858 i2++;859 }860 }861 862 vtableDataTableOffset = compiler.GetObjectModule().dataTable.AddBinary( (void *)ppsi, GetVtblNum()*sizeof(LONG_PTR) );863 864 for( int i=0; i < GetVtblNum(); i++ ){865 pobj_Reloc->AddSchedule_DataSection(static_cast<DWORD>(vtableDataTableOffset+i*sizeof(LONG_PTR)));866 }867 868 free(ppsi);869 }870 863 void CClass::GenerateVTableMasterList( const std::vector<long> &vtableMasterList, long &offset ) 871 864 { … … 895 888 896 889 // 自身のクラスのvtblを生成 897 Ge nerateVTablePart( this->vtbl_offset );890 GetDynamicMethods().GenerateVTablePart( this->vtbl_offset ); 898 891 vtblMasterList.push_back( this->vtbl_offset ); 899 892 … … 902 895 { 903 896 long tempVtblOffset; 904 pInterface->Get Class().GenerateVTablePart( tempVtblOffset );897 pInterface->GetDynamicMethods().GenerateVTablePart( tempVtblOffset ); 905 898 vtblMasterList.push_back( tempVtblOffset ); 906 899 … … 946 939 BOOST_FOREACH( const ::Interface *pInterface, interfaces ) 947 940 { 948 LONG_PTR *pVtbl = (LONG_PTR *)((char *)compiler.GetObjectModule().dataTable.GetPtr() + pInterface->Get Class().vtbl_offset);941 LONG_PTR *pVtbl = (LONG_PTR *)((char *)compiler.GetObjectModule().dataTable.GetPtr() + pInterface->GetVtblOffset()); 949 942 950 943 for( int i=0; i<pInterface->GetClass().GetVtblNum(); i++ ){ … … 1945 1938 } 1946 1939 1947 pCompilingMethod = pParentClass->GetDynamicMethod s().GetMethodPtr( pUserProc );1940 pCompilingMethod = pParentClass->GetDynamicMethodOfInterfaceMethod( pUserProc ); 1948 1941 if( !pCompilingMethod ){ 1949 1942 pCompilingMethod = pParentClass->GetStaticMethods().GetMethodPtr( pUserProc ); -
trunk/abdev/BasicCompiler_Common/src/Method.cpp
r346 r347 103 103 } 104 104 } 105 106 int Methods::GetVtblNum() const 107 { 108 int count = 0; 109 const Methods &methods = *this; 110 BOOST_FOREACH( const CMethod *pMethod, methods ) 111 { 112 if( pMethod->IsVirtual() ) 113 { 114 count++; 115 } 116 } 117 return count; 118 } 119 120 void Methods::GenerateVTablePart( long &vtableDataTableOffset ) const 121 { 122 const UserProc **ppsi = (const UserProc **)malloc(GetVtblNum()*sizeof(UserProc *)); 123 124 //関数テーブルに値をセット 125 int i2 = 0; 126 const Methods &methods = *this; 127 BOOST_FOREACH( const CMethod *pMethod, methods ){ 128 if(pMethod->IsVirtual()){ 129 if( !pMethod->GetUserProc().IsUsing() ) 130 { 131 ts((char *)pMethod->GetUserProc().GetFullName().c_str()); 132 } 133 pMethod->GetUserProc().Using(); 134 135 if(pMethod->IsAbstract()){ 136 SetError(); 137 138 ppsi[i2]=0; 139 } 140 else{ 141 ppsi[i2]=&pMethod->GetUserProc(); 142 } 143 i2++; 144 } 145 } 146 147 vtableDataTableOffset = compiler.GetObjectModule().dataTable.AddBinary( (void *)ppsi, GetVtblNum()*sizeof(LONG_PTR) ); 148 149 for( int i=0; i < GetVtblNum(); i++ ){ 150 pobj_Reloc->AddSchedule_DataSection(static_cast<DWORD>(vtableDataTableOffset+i*sizeof(LONG_PTR))); 151 } 152 153 free(ppsi); 154 }
Note:
See TracChangeset
for help on using the changeset viewer.