Changeset 537 in dev for trunk/ab5.0


Ignore:
Timestamp:
May 3, 2008, 6:58:38 PM (16 years ago)
Author:
dai_9181
Message:

UserProcクラスによるコンパイル中関数管理用メソッドを除去(すべてCompilerクラス内で処理するようにした)。

Location:
trunk/ab5.0/abdev
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp

    r524 r537  
    242242
    243243            case ESC_TYPEDEF:
    244                 if( UserProc::IsLocalAreaCompiling() ){
     244                if( compiler.IsLocalAreaCompiling() ){
    245245                    // ローカル領域をコンパイルしているとき
    246246                    compiler.errorMessenger.Output(65,"TypeDef",cp );
     
    251251
    252252            case ESC_DELEGATE:
    253                 if( UserProc::IsLocalAreaCompiling() ){
     253                if( compiler.IsLocalAreaCompiling() ){
    254254                    // ローカル領域をコンパイルしているとき
    255255                    compiler.errorMessenger.Output(65,"Delegate",cp );
     
    335335                break;
    336336            case ESC_DECLARE:
    337                 if( UserProc::IsLocalAreaCompiling() ){
     337                if( compiler.IsLocalAreaCompiling() ){
    338338                    // ローカル領域をコンパイルしているとき
    339339                    compiler.errorMessenger.Output(65,"Declare",cp );
  • trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp

    r536 r537  
    751751                                // Blittable型のときは基本型として扱う
    752752                                // ※ただし、コンパイル中のメソッドがBlittable型クラスに属していないこと
    753                                 if( UserProc::IsLocalAreaCompiling()
    754                                     && UserProc::CompilingUserProc().HasParentClass()
    755                                     && UserProc::CompilingUserProc().GetParentClass().IsBlittableType() )
     753                                if( compiler.IsLocalAreaCompiling()
     754                                    && compiler.GetCompilingUserProc().HasParentClass()
     755                                    && compiler.GetCompilingUserProc().GetParentClass().IsBlittableType() )
    756756                                {
    757757                                    // コンパイル中のメソッドがBlittable型クラスに属している
  • trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp

    r536 r537  
    779779        if(pUserProc){
    780780            compiler.StartProcedureCompile( pUserProc );
    781             UserProc::CompileStartForUserProc( pUserProc );
    782781        }
    783782    }
  • trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp

    r536 r537  
    560560    const Variable *pVar = NULL;
    561561
    562     if( UserProc::IsLocalAreaCompiling() ){
     562    if( compiler.IsLocalAreaCompiling() ){
    563563        /////////////////
    564564        // ローカル変数
    565565        /////////////////
    566566
    567         pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
     567        pVar = compiler.GetCompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    568568        if( pVar ){
    569569            goto ok;
     
    613613
    614614    char temporary[VN_SIZE];
    615     if( UserProc::IsLocalAreaCompiling() ){
     615    if( compiler.IsLocalAreaCompiling() ){
    616616        GetNowStaticVarFullName(VarName,temporary);
    617617
     
    905905
    906906BOOL GetNowStaticVarFullName(char *VarName,char *FullName){
    907     if( UserProc::IsGlobalAreaCompiling() ){
     907    if( compiler.IsGlobalAreaCompiling() ){
    908908        // グローバル領域をコンパイル中のとき
    909909        return 0;
    910910    }
    911911
    912     const UserProc &proc = UserProc::CompilingUserProc();
     912    const UserProc &proc = compiler.GetCompilingUserProc();
    913913
    914914    //Static識別
     
    10821082            // Blittable型のときは基本型として扱う
    10831083            // ※ただし、コンパイル中のメソッドがBlittable型クラスに属していないこと
    1084             if( UserProc::IsLocalAreaCompiling()
    1085                 && UserProc::CompilingUserProc().HasParentClass()
    1086                 && UserProc::CompilingUserProc().GetParentClass().IsBlittableType() )
     1084            if( compiler.IsLocalAreaCompiling()
     1085                && compiler.GetCompilingUserProc().HasParentClass()
     1086                && compiler.GetCompilingUserProc().GetParentClass().IsBlittableType() )
    10871087            {
    10881088                // コンパイル中のメソッドがBlittable型クラスに属している
     
    10941094    }
    10951095
    1096     if(dwFlags&DIMFLAG_STATIC){
    1097         if( UserProc::IsGlobalAreaCompiling() ){
     1096    if(dwFlags&DIMFLAG_STATIC)
     1097    {
     1098        if( compiler.IsGlobalAreaCompiling() )
     1099        {
    10981100            compiler.errorMessenger.Output(60,NULL,cp);
    10991101            return;
  • trunk/ab5.0/abdev/BasicCompiler_Common/WatchList.cpp

    r536 r537  
    351351    // ローカル変数
    352352    /////////////////
    353     if( UserProc::IsLocalAreaCompiling() ){
    354         const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().Find( LexicalAnalyzer::FullNameToSymbol( VarName ) );
     353    if( compiler.IsLocalAreaCompiling() ){
     354        const Variable *pVar = compiler.GetCompilingUserProc().GetLocalVars().Find( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    355355
    356356        if( pVar ){
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h

    r536 r537  
    192192
    193193    void ClearCompilingUserProcAndClass();
     194    void StartGlobalAreaCompile();
     195    void FinishGlobalAreaCompile();
    194196    void SetCompilingClass( const CClass *pClass );
     197    void SetCompilingUserProc( const UserProc *pUserProc );
    195198    void StartProcedureCompile( const UserProc *pUserProc );
    196199    void FinishProcedureCompile();
    197200
    198201    bool IsGlobalAreaCompiling();
     202    bool IsLocalAreaCompiling();
    199203    const UserProc &GetCompilingUserProc();
    200204    bool IsCompilingClass();
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Procedure.h

    r524 r537  
    371371
    372372
    373 
    374     /////////////////////////////////////////////////////////////////
    375     // コンパイル中の関数を管理
    376     /////////////////////////////////////////////////////////////////
    377 private:
    378     static const UserProc *pCompilingUserProc;
    379 public:
    380373    static const UserProc *pGlobalProc;
    381     static void CompileStartForGlobalArea(){
    382         pCompilingUserProc = NULL;
    383     }
    384     static void CompileStartForUserProc( const UserProc *pUserProc ){
    385         pCompilingUserProc = pUserProc;
    386     }
    387     static bool IsGlobalAreaCompiling(){
    388         return ( pCompilingUserProc == NULL );
    389     }
    390     static bool IsLocalAreaCompiling(){
    391         return ( pCompilingUserProc != NULL );
    392     }
    393     static const UserProc &CompilingUserProc(){
    394         return *pCompilingUserProc;
    395     }
    396374};
    397375
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp

    r536 r537  
    222222}
    223223
     224void Compiler::SetCompilingUserProc( const UserProc *pUserProc )
     225{
     226    this->pCompilingUserProc = pUserProc;
     227
     228    this->SetCompilingClass( pUserProc->GetParentClassPtr() );
     229}
     230
     231void Compiler::StartGlobalAreaCompile()
     232{
     233    ClearCompilingUserProcAndClass();
     234}
     235
    224236void Compiler::StartProcedureCompile( const UserProc *pUserProc )
    225237{
    226238    //コンパイル中の関数
    227     this->pCompilingUserProc = pUserProc;
    228 
    229     //コンパイル中の関数が属するクラス
    230     this->SetCompilingClass( pUserProc->GetParentClassPtr() );
     239    this->SetCompilingUserProc( pUserProc );
    231240
    232241    //コンパイルスタートをクラス管理クラスに追加
    233242    this->GetObjectModule().meta.GetClasses().StartCompile( pUserProc );
    234243
    235     //コンパイル中の関数
    236     UserProc::CompileStartForUserProc( pUserProc );
    237 
    238244    // コンパイル中の関数が属する名前空間
    239245    this->GetNamespaceSupporter().SetLivingNamespaceScopes( pUserProc->GetNamespaceScopes() );
     
    255261    return ( pCompilingUserProc == NULL );
    256262}
     263bool Compiler::IsLocalAreaCompiling()
     264{
     265    return ( pCompilingUserProc != NULL );
     266}
    257267const UserProc &Compiler::GetCompilingUserProc()
    258268{
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp

    r524 r537  
    222222
    223223            // Catchアドレス
    224             const UserProc *pUserProc = &UserProc::CompilingUserProc();
    225             if( UserProc::IsGlobalAreaCompiling() )
     224            const UserProc *pUserProc = &compiler.GetCompilingUserProc();
     225            if( compiler.IsGlobalAreaCompiling() )
    226226            {
    227227                pUserProc = UserProc::pGlobalProc;
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalScope.cpp

    r485 r537  
    7171    CallDestructorsOfScopeEnd();
    7272
    73     Variables *pVars = UserProc::IsGlobalAreaCompiling() ?
     73    Variables *pVars = compiler.IsGlobalAreaCompiling() ?
    7474        &compiler.GetObjectModule().meta.GetGlobalVars() :
    75         &UserProc::CompilingUserProc().GetLocalVars();
     75        &compiler.GetCompilingUserProc().GetLocalVars();
    7676
    7777    //使用済みローカル変数の生存チェックを外す
     
    9898void LexicalScopes::CallDestructorsOfScopeEnd(){
    9999
    100     Variables *pVariabls = UserProc::IsGlobalAreaCompiling() ?
     100    Variables *pVariabls = compiler.IsGlobalAreaCompiling() ?
    101101        &compiler.GetObjectModule().meta.GetGlobalVars() :
    102         &UserProc::CompilingUserProc().GetLocalVars();
     102        &compiler.GetCompilingUserProc().GetLocalVars();
    103103
    104104
     
    109109        Variable *pVar = (*pVariabls)[i3];
    110110
    111         if( UserProc::IsGlobalAreaCompiling() && GetNowLevel() == 0 ){
     111        if( compiler.IsGlobalAreaCompiling() && GetNowLevel() == 0 ){
    112112            if( pVar->GetName() == "_System_GC" ){
    113113                indexSystemGC=i3;
     
    152152
    153153
    154             if( UserProc::IsGlobalAreaCompiling() ){
     154            if( compiler.IsGlobalAreaCompiling() ){
    155155                //ここには来ないハズ
    156156                compiler.errorMessenger.Output(300,NULL,cp);
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/NativeCode.cpp

    r465 r537  
    8585    if( scheduleType == Schedule::CatchAddress )
    8686    {
    87         const UserProc *pUserProc = &UserProc::CompilingUserProc();
    88         if( UserProc::IsGlobalAreaCompiling() )
     87        const UserProc *pUserProc = &compiler.GetCompilingUserProc();
     88        if( compiler.IsGlobalAreaCompiling() )
    8989        {
    9090            pUserProc = UserProc::pGlobalProc;
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Procedure.cpp

    r523 r537  
    483483}
    484484
    485 const UserProc *UserProc::pCompilingUserProc = NULL;
    486485const UserProc *UserProc::pGlobalProc = NULL;
    487486
  • trunk/ab5.0/abdev/compiler_x86/Compile_Func.cpp

    r536 r537  
    614614    }
    615615
    616     resultType = UserProc::CompilingUserProc().ReturnType();
     616    resultType = compiler.GetCompilingUserProc().ReturnType();
    617617}
    618618void Opcode_Func_System_Get_Bp()
  • trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp

    r536 r537  
    3232
    3333        const UserProc *pBackUserProc;
    34         pBackUserProc = &UserProc::CompilingUserProc();
    35         UserProc::CompileStartForGlobalArea();
     34        pBackUserProc = &compiler.GetCompilingUserProc();
     35        compiler.StartGlobalAreaCompile();
    3636
    3737        int BackCp;
     
    5757        GetGlobalDataForDll();
    5858
    59         UserProc::CompileStartForUserProc( pBackUserProc );
     59        compiler.SetCompilingUserProc( pBackUserProc );
    6060        cp=BackCp;
    6161
     
    8989
    9090        const UserProc *pBackUserProc;
    91         pBackUserProc = &UserProc::CompilingUserProc();
    92         UserProc::CompileStartForGlobalArea();
     91        pBackUserProc = &compiler.GetCompilingUserProc();
     92        compiler.StartGlobalAreaCompile();
    9393
    9494        compiler.codeGenerator.lexicalScopes.CallDestructorsOfScopeEnd();
    9595
    96         UserProc::CompileStartForUserProc( pBackUserProc );
     96        compiler.SetCompilingUserProc( pBackUserProc );
    9797
    9898
     
    225225        UserProc::pGlobalProc = &userProc;
    226226
    227         const UserProc *pBackUserProc = &UserProc::CompilingUserProc();
    228         UserProc::CompileStartForGlobalArea();
     227        const UserProc *pBackUserProc = &compiler.GetCompilingUserProc();
     228        compiler.StartGlobalAreaCompile();
    229229
    230230        int BackCp = cp;
     
    250250        }
    251251
    252         UserProc::CompileStartForUserProc( pBackUserProc );
     252        compiler.SetCompilingUserProc( pBackUserProc );
    253253        cp=BackCp;
    254254    }
  • trunk/ab5.0/abdev/compiler_x86/Compile_Statement.cpp

    r465 r537  
    893893
    894894void OpcodeExitSub(void){
    895     if( UserProc::IsGlobalAreaCompiling() ){
     895    if( compiler.IsGlobalAreaCompiling() ){
    896896        compiler.errorMessenger.Output(12,"Exit Sub/Function",cp);
    897897        return;
     
    12311231}
    12321232void OpcodeReturn(char *Parameter){
    1233     if( UserProc::IsGlobalAreaCompiling() ){
     1233    if( compiler.IsGlobalAreaCompiling() ){
    12341234        //Gosub~Returnとして扱う
    12351235
     
    12401240        //戻り値をセット
    12411241        if(Parameter[0]){
    1242             const UserProc &proc = UserProc::CompilingUserProc();
     1242            const UserProc &proc = compiler.GetCompilingUserProc();
    12431243
    12441244            const char *temp = "_System_ReturnValue";
  • trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp

    r536 r537  
    388388
    389389
    390     if( UserProc::IsLocalAreaCompiling() ){
     390    if( compiler.IsLocalAreaCompiling() ){
    391391        //////////////////
    392392        // ローカル変数
    393393        //////////////////
    394394
    395         const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
     395        const Variable *pVar = compiler.GetCompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    396396        if( pVar ){
    397397            //ポインタ変数の場合
     
    517517
    518518        char temporary[VN_SIZE];
    519         if( UserProc::IsLocalAreaCompiling() ){
     519        if( compiler.IsLocalAreaCompiling() ){
    520520            GetNowStaticVarFullName(VarName,temporary);
    521521
     
    10921092
    10931093void dim( char *VarName, const Subscripts &subscripts, const Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags){
    1094     if( UserProc::IsGlobalAreaCompiling() ){
     1094    if( compiler.IsGlobalAreaCompiling() ){
    10951095        /////////////////////////
    10961096        // グローバル変数
     
    11041104        /////////////////
    11051105
    1106         if( UserProc::CompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ) ) ){
     1106        if( compiler.GetCompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ) ) ){
    11071107            //2重定義のエラー
    11081108            compiler.errorMessenger.Output(15,VarName,cp);
     
    11281128
    11291129        // 変数を追加
    1130         UserProc::CompilingUserProc().GetLocalVars().push_back( pVar );
     1130        compiler.GetCompilingUserProc().GetLocalVars().push_back( pVar );
    11311131
    11321132        //アラインメントを考慮
     
    11451145                // 呼び出し側のオフセットズレを考慮する
    11461146
    1147                 if( 0 == ( UserProc::CompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE /* ret分 */ ) % alignment ){
     1147                if( 0 == ( compiler.GetCompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE /* ret分 */ ) % alignment ){
    11481148                    AllLocalVarSize += PTR_SIZE;
    11491149                }
  • trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp

    r536 r537  
    365365
    366366    cp=-1;
    367     UserProc::CompileStartForGlobalArea();
     367    compiler.StartGlobalAreaCompile();
    368368
    369369    if( !compiler.IsDll() ){
Note: See TracChangeset for help on using the changeset viewer.