- Timestamp:
- Mar 11, 2008, 4:02:38 PM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Func.cpp
r426 r431 7 7 #include "../BasicCompiler_Common/common.h" 8 8 #include "Opcode.h" 9 10 #ifdef _AMD64_ 11 #include "../BasicCompiler64/FunctionValue.h" 12 #else 13 #include "../BasicCompiler32/FunctionValue.h" 14 #endif 9 15 10 16 int GetFunctionFromName(char *FuncName){ … … 22 28 if( lstrcmpi( FuncName, "_System_GetBp" ) == 0 ) return FUNC_SYSTEM_GET_BP; 23 29 if( lstrcmpi( FuncName, "_System_GetSp" ) == 0 ) return FUNC_SYSTEM_GET_SP; 24 if( lstrcmp( FuncName, "_System_New" ) == 0 ) return FUNC_SYSTEM_NEW; 30 if( lstrcmp( FuncName, "_System_GetComVtbl" ) == 0 ) return FUNC_SYSTEM_GET_COM_VTBL; 31 if( lstrcmp( FuncName, "_System_GetVtblList" ) == 0 ) return FUNC_SYSTEM_GET_VTBL_LIST; 32 if( lstrcmp( FuncName, "_System_GetDefaultConstructor" ) == 0 ) return FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR; 33 if( lstrcmp( FuncName, "_System_GetDestructor" ) == 0 ) return FUNC_SYSTEM_GET_DESTRUCTOR; 25 34 if( lstrcmpi( FuncName, "GetDouble" ) == 0 ) return FUNC_GETDOUBLE; 26 35 if( lstrcmpi( FuncName, "GetSingle" ) == 0 ) return FUNC_GETSINGLE; … … 607 616 } 608 617 609 void Opcode_Func_System_New( const char *parameter, Type &resultType, bool isCallOn ) 610 { 611 if( !compiler.StringToType( parameter, resultType ) ) 612 { 613 SetError(); 614 return; 615 } 616 if( !resultType.IsObject() ) 617 { 618 SetError(); 619 return; 620 } 621 622 if( isCallOn ) 623 { 624 Type tempResultType; 625 if( !Operator_New( parameter, resultType, tempResultType ) ) 626 { 627 return; 628 } 629 630 if( !resultType.Equals( tempResultType ) ) 631 { 632 SetError(); 633 } 634 635 //pop eax 636 compiler.codeGenerator.op_pop( REG_EAX ); 637 } 618 void Opcode_Func_System_GetComVtbl( const char *parameter ) 619 { 620 Type classType; 621 compiler.StringToType( parameter, classType ); 622 623 // mov eax,com_vtbl 624 compiler.codeGenerator.op_mov_RV_com_vtbl( REG_EAX, &classType.GetClass() ); 625 } 626 void Opcode_Func_System_GetVtblList( const char *parameter ) 627 { 628 Type classType; 629 compiler.StringToType( parameter, classType ); 630 631 // mov eax,com_vtbl 632 compiler.codeGenerator.op_mov_RV_vtbl( REG_EAX, &classType.GetClass() ); 633 } 634 void Opcode_Func_System_GetDefaultConstructor( const char *parameter ) 635 { 636 Type classType; 637 compiler.StringToType( parameter, classType ); 638 639 if( classType.GetClass().GetConstructorMethod() ) 640 { 641 //mov eax,ProcAddr 642 compiler.codeGenerator.op_addressof( REG_EAX, &classType.GetClass().GetConstructorMethod()->GetUserProc() ); 643 } 644 else 645 { 646 // デフォルトコンストラクタを持たない 647 648 //xor eax,eax 649 compiler.codeGenerator.op_zero_reg( REG_EAX ); 650 } 651 } 652 void Opcode_Func_System_GetDestructor( const char *parameter ) 653 { 654 Type classType; 655 compiler.StringToType( parameter, classType ); 656 657 //mov eax,ProcAddr 658 compiler.codeGenerator.op_addressof( REG_EAX, &classType.GetClass().GetDestructorMethod()->GetUserProc() ); 638 659 } 639 660 … … 748 769 resultType.SetBasicType( DEF_LONG ); 749 770 break; 750 case FUNC_SYSTEM_NEW: 751 Opcode_Func_System_New( Parameter, resultType, isCallOn ); 771 case FUNC_SYSTEM_GET_COM_VTBL: 772 if( isCallOn ) Opcode_Func_System_GetComVtbl( Parameter ); 773 resultType.SetBasicType( DEF_PTR_VOID ); 774 break; 775 case FUNC_SYSTEM_GET_VTBL_LIST: 776 if( isCallOn ) Opcode_Func_System_GetVtblList( Parameter ); 777 resultType.SetBasicType( DEF_PTR_VOID ); 778 break; 779 case FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR: 780 if( isCallOn ) Opcode_Func_System_GetDefaultConstructor( Parameter ); 781 resultType.SetBasicType( DEF_PTR_VOID ); 782 break; 783 case FUNC_SYSTEM_GET_DESTRUCTOR: 784 if( isCallOn ) Opcode_Func_System_GetDestructor( Parameter ); 785 resultType.SetBasicType( DEF_PTR_VOID ); 752 786 break; 753 787 -
trunk/abdev/BasicCompiler32/FunctionValue.h
r426 r431 21 21 #define FUNC_SYSTEM_GET_BP 0x0625 22 22 #define FUNC_SYSTEM_GET_SP 0x0626 23 #define FUNC_SYSTEM_NEW 0x0627 23 #define FUNC_SYSTEM_GET_COM_VTBL 0x0627 24 #define FUNC_SYSTEM_GET_VTBL_LIST 0x0628 25 #define FUNC_SYSTEM_GET_DEFAULT_CONSTRUCTOR 0x0629 26 #define FUNC_SYSTEM_GET_DESTRUCTOR 0x062A 24 27 25 28 //ポインタ -
trunk/abdev/BasicCompiler_Common/common.h
r424 r431 11 11 #include "../BasicCompiler64/resource.h" 12 12 #include "../BasicCompiler64/CommandValue.h" 13 #include "../BasicCompiler64/FunctionValue.h"14 13 #define OPCODE_H_PATH "../BasicCompiler64/opcode.h" 15 14 #else 16 15 #include "../BasicCompiler32/resource.h" 17 16 #include "../BasicCompiler32/CommandValue.h" 18 #include "../BasicCompiler32/FunctionValue.h"19 17 #define OPCODE_H_PATH "../BasicCompiler32/opcode.h" 20 18 #endif -
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r417 r431 1326 1326 1327 1327 char temporary[8192]; 1328 sprintf(temporary, "%c%ctempType=Nothing%c%c TypeBaseImpl"1328 sprintf(temporary, "%c%ctempType=Nothing%c%c_System_TypeForClass" 1329 1329 , HIBYTE( COM_DIM ) 1330 1330 , LOBYTE( COM_DIM ) … … 1347 1347 if( objClass.HasSuperClass() || objClass.GetDynamicMembers().size() ){ 1348 1348 sprintf( temporary 1349 , "tempType=Search(\"%s\") "1349 , "tempType=Search(\"%s\") As ActiveBasic.Core._System_TypeForClass" 1350 1350 , objClass.GetFullName().c_str() 1351 ); 1352 1353 // コンパイル 1354 MakeMiddleCode( temporary ); 1355 ChangeOpcode( temporary ); 1356 1357 sprintf( temporary 1358 , "tempType.SetClassInfo(%d,_System_GetComVtbl(%s),_System_GetVtblList(%s),_System_GetDefaultConstructor(%s),_System_GetDestructor(%s))" 1359 , objClass.GetSize() 1360 , objClass.GetFullName().c_str() 1361 , objClass.GetFullName().c_str() 1362 , objClass.GetFullName().c_str() 1363 , objClass.GetFullName().c_str() 1364 , objClass.GetName().c_str() 1351 1365 ); 1352 1366
Note:
See TracChangeset
for help on using the changeset viewer.