- Timestamp:
- Oct 11, 2007, 3:23:51 AM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_CallProc.cpp
r342 r347 156 156 ///////////////////////////////// 157 157 pMethod = NULL; 158 if( ! isStatic ) pMethod = pobj_c->GetDynamicMethod s().GetMethodPtr( pUserProc );158 if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodOfInterfaceMethod( pUserProc ); 159 159 if( ! pMethod ){ 160 160 //動的メソッドが取得できなかったときは静的メソッドを当たる -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r342 r347 232 232 GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType); 233 233 234 objClass. GetDynamicMethods().Enum( methodName, userProcs );234 objClass.EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs ); 235 235 if(userProcs.size()){ 236 236 //オーバーロードを解決 -
trunk/abdev/BasicCompiler64/Compile_CallProc.cpp
r345 r347 164 164 ///////////////////////////////// 165 165 pMethod = NULL; 166 if( ! isStatic ) pMethod = pobj_c->GetDynamicMethod s().GetMethodPtr( pUserProc );166 if( ! isStatic ) pMethod = pobj_c->GetDynamicMethodOfInterfaceMethod( pUserProc ); 167 167 if( ! pMethod ){ 168 168 //動的メソッドが取得できなかったときは静的メソッドを当たる -
trunk/abdev/BasicCompiler64/NumOpe.cpp
r345 r347 233 233 GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType); 234 234 235 objClass. GetDynamicMethods().Enum( methodName, userProcs );235 objClass.EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs ); 236 236 if(userProcs.size()){ 237 237 //オーバーロードを解決 -
trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
r342 r347 342 342 343 343 vector<const UserProc *> userProcs; 344 leftType.GetClass(). GetDynamicMethods().Enum( methodName, userProcs );344 leftType.GetClass().EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs ); 345 345 if(userProcs.size()){ 346 346 //オーバーロードを解決 -
trunk/abdev/BasicCompiler_Common/hash.cpp
r342 r347 90 90 else{ 91 91 //動的メソッドから列挙 92 pobj_c-> GetDynamicMethods().Enum( NestMember, subs );92 pobj_c->EnumDynamicMethodsOfInterfaceMethods( NestMember, subs ); 93 93 } 94 94 … … 105 105 106 106 // 動的メソッド 107 compiler.pCompilingClass-> GetDynamicMethods().Enum( name, subs );107 compiler.pCompilingClass->EnumDynamicMethodsOfInterfaceMethods( name, subs ); 108 108 } 109 109 … … 157 157 if( pClass ){ 158 158 vector<const UserProc *> userProcs; 159 pClass-> GetDynamicMethods().Enum( methodName, userProcs );159 pClass->EnumDynamicMethodsOfInterfaceMethods( methodName, userProcs ); 160 160 if( userProcs.size() == 1 ){ 161 161 return userProcs[0]; -
trunk/abdev/BasicCompiler_Common/include/Class.h
r346 r347 409 409 } 410 410 411 void EnumDynamicMethodsOfInterfaceMethods( const char *methodName, std::vector<const UserProc *> &subs ) const; 412 const CMethod *GetDynamicMethodOfInterfaceMethod( const UserProc *pUserProc ) const; 413 411 414 const Methods &GetStaticMethods() const 412 415 { … … 493 496 int GetFuncNumInVtbl( const UserProc *pUserProc ) const; 494 497 long GetVtblMasterListOffset() const; 495 void GenerateVTablePart( long &vtableDataTableOffset ) const;496 498 void GenerateVTableMasterList( const std::vector<long> &vtableMasterList, long &offset ); 497 499 void GenerateFullVTables(); -
trunk/abdev/BasicCompiler_Common/include/Method.h
r346 r347 204 204 virtual void Enum( const char *methodName, vector<const UserProc *> &subs ) const; 205 205 virtual void Enum( BYTE idOperatorCalc, vector<const UserProc *> &subs ) const; 206 }; 206 207 // 仮想メソッドの個数を取得 208 int GetVtblNum() const; 209 210 // vtblを生成 211 void GenerateVTablePart( long &vtableDataTableOffset ) const; 212 }; -
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.