Changeset 140 in dev for BasicCompiler32
- Timestamp:
- Jun 15, 2007, 4:00:25 AM (17 years ago)
- Location:
- BasicCompiler32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/BasicCompiler.vcproj
r135 r140 146 146 Name="VCCLCompilerTool" 147 147 Optimization="2" 148 InlineFunctionExpansion="1" 148 InlineFunctionExpansion="2" 149 FavorSizeOrSpeed="1" 149 150 AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include" 150 151 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN" … … 1840 1841 <File 1841 1842 RelativePath="..\BasicCompiler_Common\src\Prototype.cpp" 1843 > 1844 </File> 1845 <File 1846 RelativePath="..\BasicCompiler_Common\src\Symbol.cpp" 1842 1847 > 1843 1848 </File> … … 1952 1957 > 1953 1958 <File 1959 RelativePath="..\BasicCompiler_Common\include\logger.h" 1960 > 1961 </File> 1962 <File 1954 1963 RelativePath="..\BasicCompiler_Common\include\Namespace.h" 1955 1964 > … … 1961 1970 <File 1962 1971 RelativePath="..\BasicCompiler_Common\Procedure.h" 1972 > 1973 </File> 1974 <File 1975 RelativePath="..\BasicCompiler_Common\include\Symbol.h" 1963 1976 > 1964 1977 </File> -
BasicCompiler32/Compile_Object.cpp
r135 r140 59 59 if( subs.size() == 1 ){ 60 60 char temporary[VN_SIZE]; 61 sprintf( temporary, " _System_TypeBase.Search(\"\",\"%s\"))", pobj_c->GetName().c_str() );61 sprintf( temporary, "ActiveBasic.Core._System_TypeBase.Search(\"\",\"%s\"))", pobj_c->GetName().c_str() ); 62 62 63 63 Opcode_CallProc(temporary, -
BasicCompiler32/Compile_ProcOp.cpp
r135 r140 514 514 } 515 515 516 //新しいオブジェクト領域は0で初期化されているため、Nothingを明示的に代入する必要はない517 /*518 //実体クラスを持つメンバのコンストラクタ(引数有りを除く)を呼び出す519 for(i3=0;i3<pobj_CompilingClass->iMemberNum;i3++){520 CMember *pMember = pobj_CompilingClass->ppobj_Member[i3];521 if(pMember->IsObject()){522 // オブジェクトメンバを発見したとき523 524 sprintf(temporary, "This.%s=Nothing",525 pMember->name );526 OpcodeCalc( temporary );527 }528 }529 */530 531 516 //仮想関数テーブルを初期化 532 517 if(pobj_CompilingClass->vtbl_num&& … … 608 593 } 609 594 } 610 611 //実体クラスを持つメンバのデストラクタ呼び出しはGCに任せる612 /*613 //※コンストラクタと逆順序で呼び出す614 int offset;615 int MemberTypeSize;616 int MemberObjectNum;617 offset=GetTypeSize(DEF_OBJECT,(LONG_PTR)pobj_CompilingClass);618 for(i3=pobj_CompilingClass->iMemberNum-1;i3>=0;i3--){619 CMember *pMember = pobj_CompilingClass->ppobj_Member[i3];620 621 MemberTypeSize=622 GetTypeSize(pMember->TypeInfo.type,623 pMember->TypeInfo.u.lpIndex);624 625 MemberObjectNum=626 JumpSubScripts(pMember->SubScripts);627 628 offset-=MemberTypeSize*MemberObjectNum;629 630 if(pMember->TypeInfo.type==DEF_OBJECT){631 CMethod *method = pMember->TypeInfo.u.pobj_Class->GetDestructorMethod();632 if( method ){633 for(i4=MemberObjectNum-1;i4>=0;i4--){634 //Thisポインタをecxにコピー635 SetThisPtrToReg(REG_ECX);636 637 //add ecx,offset638 OpBuffer[obp++]=(char)0x81;639 OpBuffer[obp++]=(char)0xC1;640 *((long *)(OpBuffer+obp))=offset+i4*MemberTypeSize;641 obp+=sizeof(long);642 643 //push ecx644 op_push(REG_ECX);645 646 //call destructor647 op_call( method->pUserProc );648 }649 }650 }651 }*/652 595 } 653 596 } -
BasicCompiler32/Compile_Var.cpp
r138 r140 158 158 } 159 159 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const CClass &objClass, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess){ 160 int i;161 162 160 163 161 ////////////////////////////////////// … … 178 176 //////////////////////////// 179 177 180 int offset = objClass.GetMemberOffset( VarName, &i ); 181 if(i==objClass.iMemberNum){ 178 int memberIndex; 179 int offset = objClass.GetMemberOffset( VarName, &memberIndex ); 180 if(memberIndex==objClass.GetDynamicMembers().size()){ 182 181 if(isErrorEnabled) SetError(103,VarName,cp); 183 182 return false; 184 183 } 185 184 186 CMember *pMember=objClass. ppobj_Member[i];185 CMember *pMember=objClass.GetDynamicMembers()[memberIndex]; 187 186 188 187 … … 351 350 352 351 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType,int *pss){ 353 int i;354 352 char variable[VN_SIZE]; 355 353 … … 387 385 ////////////////// 388 386 389 const Variable *pVar = UserProc::CompilingUserProc().localVars.BackSearch( VarName);387 const Variable *pVar = UserProc::CompilingUserProc().localVars.BackSearch( Symbol( VarName ) ); 390 388 if( pVar ){ 391 389 //ポインタ変数の場合 … … 444 442 //クラス内メンバを参照するとき(通常) 445 443 446 for(i=0;i<pobj_CompilingClass->iMemberNum;i++){ 447 if( pobj_CompilingClass->ppobj_Member[i]->GetName() == VarName ){ 444 bool isFound = false; 445 BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){ 446 if( pMember->GetName() == VarName ){ 447 isFound = true; 448 448 break; 449 449 } 450 450 } 451 if( i==pobj_CompilingClass->iMemberNum) goto NonClassMember;451 if( !isFound ) goto NonClassMember; 452 452 } 453 453 … … 494 494 GetNowStaticVarFullName(VarName,temporary); 495 495 496 pVar = globalVars.Find( temporary);496 pVar = globalVars.Find( Symbol( temporary ) ); 497 497 if( pVar ){ 498 498 goto GlobalOk; … … 525 525 char temp2[VN_SIZE]; 526 526 sprintf(temp2,"%s.%s",VarName,temporary); 527 pVar = globalVars.Find( temp2);527 pVar = globalVars.Find( Symbol( temp2 ) ); 528 528 if( pVar ){ 529 529 lstrcpy(member,tempMember); … … 537 537 char temp2[VN_SIZE]; 538 538 sprintf(temp2,"%s.%s",pobj_CompilingClass->GetName().c_str(),VarName); 539 pVar = globalVars.Find( temp2);539 pVar = globalVars.Find( Symbol( temp2 ) ); 540 540 if( pVar ){ 541 541 goto GlobalOk; … … 547 547 ///////////////////// 548 548 549 pVar = globalVars.BackSearch( VarName);549 pVar = globalVars.BackSearch( Symbol( VarName ) ); 550 550 if( pVar ){ 551 551 goto GlobalOk; … … 716 716 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){ 717 717 extern BYTE *initGlobalBuf; 718 int i ,i2,i3;718 int i2,i3; 719 719 char temporary[VN_SIZE]; 720 720 char InitBuf[VN_SIZE]; … … 729 729 if(SubScripts[0]!=-1){ 730 730 typeSize*=JumpSubScripts(SubScripts+1); 731 i =0;731 int i=0; 732 732 i2=0; 733 733 while(1){ … … 751 751 const CClass &objClass = type.GetClass(); 752 752 753 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 753 int i = 0; 754 BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){ 755 if(InitBuf[i]=='\0'){ 756 SetError(41,0,cp); 757 return false; 758 } 759 754 760 i=GetOneParameter(InitBuf,i,temporary); 755 761 756 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->GetName().c_str(), NULL );762 i3=objClass.GetMemberOffset( pMember->GetName().c_str(), NULL ); 757 763 758 764 if(!SetInitGlobalData(offset+i3, 759 objClass.ppobj_Member[i2]->GetType(),760 objClass.ppobj_Member[i2]->SubScripts,765 pMember->GetType(), 766 pMember->SubScripts, 761 767 temporary)) return false; 762 763 if(InitBuf[i]=='\0') break;764 }765 if(i2+1!=objClass.iMemberNum){766 SetError(41,0,cp);767 return false;768 768 } 769 769 return true; … … 889 889 const CClass &objClass = type.GetClass(); 890 890 891 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 891 int i = 0; 892 BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){ 893 if(InitBuf[i]=='\0'){ 894 SetError(41,0,cp); 895 return false; 896 } 897 892 898 i=GetOneParameter(InitBuf,i,temporary); 893 899 894 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->GetName().c_str(), NULL );900 i3=objClass.GetMemberOffset( pMember->GetName().c_str(), NULL ); 895 901 896 902 if(!InitLocalVar(offset+i3, 897 objClass.ppobj_Member[i2]->GetType(),898 objClass.ppobj_Member[i2]->SubScripts,903 pMember->GetType(), 904 pMember->SubScripts, 899 905 temporary)) return false; 900 906 901 907 if(InitBuf[i]=='\0') break; 902 }903 if(i2+1!=objClass.iMemberNum){904 SetError(41,0,cp);905 return 0;906 908 } 907 909 return true; … … 1078 1080 ///////////////// 1079 1081 1080 if( UserProc::CompilingUserProc().localVars.DuplicateCheck( VarName) ){1082 if( UserProc::CompilingUserProc().localVars.DuplicateCheck( Symbol( VarName ) ) ){ 1081 1083 //2重定義のエラー 1082 1084 SetError(15,VarName,cp); -
BasicCompiler32/MakePeHdr.cpp
r105 r140 259 259 pSub_System_GC_free_for_SweepingDelete->Using(); 260 260 261 if( pSubStaticMethod_System_TypeBase_InitializeUserTypes = GetSubHash( " _System_TypeBase.InitializeUserTypes",1 ) ){261 if( pSubStaticMethod_System_TypeBase_InitializeUserTypes = GetSubHash( "ActiveBasic.Core._System_TypeBase.InitializeUserTypes",1 ) ){ 262 262 pSubStaticMethod_System_TypeBase_InitializeUserTypes->Using(); 263 263 pSubStaticMethod_System_TypeBase_InitializeUserTypes->ThisIsAutoGenerationProc(); -
BasicCompiler32/Opcode.h
r138 r140 232 232 233 233 private: 234 bool _overload_check( int level, const Parameters &targetParms, const Type &targetResultType ); 235 UserProc *OverloadSolutionWithReturnType( const char *name, std::vector<UserProc *> &subs ); 234 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType ); 236 235 public: 237 UserProc *OverloadSolution( const char *name, std::vector<UserProc *> &subs ); 236 UserProc *_OverloadSolution( const char *name, std::vector<UserProc *> &subs, bool isEnabledReturnType = false ); 237 UserProc *OverloadSolution( const char *name, std::vector<UserProc *> &subs, bool isEnabledReturnType = false ); 238 238 239 239 void ApplyDefaultParameters( const Parameters ¶ms );
Note:
See TracChangeset
for help on using the changeset viewer.