Ignore:
Timestamp:
Mar 24, 2008, 8:05:20 PM (16 years ago)
Author:
dai_9181
Message:

Messenger/ErrorMessengerクラスを導入。SetError関数によるエラー生成を廃止した。

File:
1 edited

Legend:

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

    r461 r465  
    4343    extern HANDLE hHeap;
    4444    extern char *basbuf;
    45     extern int ErrorNum;
    4645    extern BOOL bStopCompile;
    4746    extern HWND hMainDlg;
     
    7170    compiler.GetObjectModule().GetSources().push_back( BasicSource() );
    7271    if( !compiler.GetObjectModule().GetCurrentSource().ReadFile( SourceFileName ) ){
    73         SetError(201,SourceFileName,-1);
     72        compiler.errorMessenger.Output(201,SourceFileName,-1);
    7473        goto EndCompile;
    7574    }
     
    8079    else ImageBase=0x00400000;
    8180
    82     extern BOOL bError;
    83     if(bError||bStopCompile) goto EndCompile;
     81    if( compiler.errorMessenger.HasError() || bStopCompile ) goto EndCompile;
    8482
    8583
     
    8987
    9088    //"最適化中..."
    91     CompileMessage(STRING_COMPILE_OPTIMIZING);
     89    compiler.messenger.Output( STRING_COMPILE_OPTIMIZING );
    9290
    9391    //カッコを相互チェック(ダブルクォートチェックチェックを含む)
    9492    CheckParenthesis(basbuf);
    9593
    96     if(bError||bStopCompile) goto EndCompile;
     94    if( compiler.errorMessenger.HasError() || bStopCompile )
     95    {
     96        goto EndCompile;
     97    }
    9798
    9899    //コンパイルダイアログのプログレスバーを上げる
     
    117118    //CheckPareCommand();
    118119
    119     if(bError||bStopCompile) goto EndCompile;
     120    if( compiler.errorMessenger.HasError() || bStopCompile )
     121    {
     122        goto EndCompile;
     123    }
    120124
    121125    //コンパイルダイアログのプログレスバーを上げる
     
    136140    SynonymErrorWords=0;
    137141
    138     if(bError||bStopCompile){
     142    if( compiler.errorMessenger.HasError() || bStopCompile )
     143    {
    139144        //定数に関する情報を解放
    140145        goto EndCompile;
     
    175180                if( compiler.staticLibraries.back()->Read( coreFilePath ) )
    176181                {
    177                     CompileMessage( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" を読み込みました。").c_str() );
     182                    compiler.messenger.Output( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" を読み込みました。").c_str() );
    178183                }
    179184                else
    180185                {
    181                     CompileMessage( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが壊れています。").c_str() );
     186                    compiler.messenger.Output( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが壊れています。").c_str() );
    182187                    isSuccessfulLoadStaticLinkLibrary = false;
    183188                }
     
    185190            else
    186191            {
    187                 CompileMessage( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが存在しません。").c_str() );
     192                compiler.messenger.Output( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが存在しません。").c_str() );
    188193                isSuccessfulLoadStaticLinkLibrary = false;
    189194            }
     
    198203                if( compiler.staticLibraries.back()->Read( filePath ) )
    199204                {
    200                     CompileMessage( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" を読み込みました。").c_str() );
     205                    compiler.messenger.Output( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" を読み込みました。").c_str() );
    201206                }
    202207                else
    203208                {
    204                     CompileMessage( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが壊れています。").c_str() );
     209                    compiler.messenger.Output( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが壊れています。").c_str() );
    205210                    isSuccessfulLoadStaticLinkLibrary = false;
    206211                }
     
    208213            else
    209214            {
    210                 CompileMessage( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが存在しません。").c_str() );
     215                compiler.messenger.Output( ((string)"\"" + path.GetFileName() + path.GetExt() + "\" ファイルが存在しません。").c_str() );
    211216                isSuccessfulLoadStaticLinkLibrary = false;
    212217            }
     
    225230
    226231    //"コンパイル中..."
    227     CompileMessage(STRING_COMPILE_COMPILING);
     232    compiler.messenger.Output(STRING_COMPILE_COMPILING);
    228233
    229234    Compile();
     
    248253
    249254        //"コンパイルはユーザーにより中断されました。"
    250         CompileMessage(STRING_COMPILE_STOP);
     255        compiler.messenger.Output(STRING_COMPILE_STOP);
    251256    }
    252257    else{
    253         extern int CompileMsgNum;
    254258        extern int WarningNum;
    255         if(bError==0){
     259        if( !compiler.errorMessenger.HasError() )
     260        {
    256261            //"コンパイルは正常に完了しました(エラー:%d、警告:%d)"
    257262            sprintf(temp2,
    258263                STRING_COMPILE_SUCCESS,
    259                 ErrorNum-CompileMsgNum-WarningNum,
    260                 WarningNum,
     264                compiler.errorMessenger.GetErrorCount(),
     265                compiler.errorMessenger.GetWarningCount(),
    261266                ((double)(GetTickCount() - beforeTickCount))/1000
    262267            );
    263268        }
    264         else{
     269        else
     270        {
    265271            //"コンパイルは中断されました(エラー:%d、警告:%d)"
    266             sprintf(temp2,STRING_COMPILE_ERROR,ErrorNum-CompileMsgNum-WarningNum,WarningNum);
    267         }
    268 
    269         CompileMessage("");
    270         CompileMessage("-----------------------------------------------------");
    271         CompileMessage(temp2);
     272            sprintf(temp2,STRING_COMPILE_ERROR,
     273                compiler.errorMessenger.GetErrorCount(),
     274                compiler.errorMessenger.GetWarningCount() );
     275        }
     276
     277        compiler.messenger.Output( "" );
     278        compiler.messenger.Output( "-----------------------------------------------------" );
     279        compiler.messenger.Output( temp2 );
    272280    }
    273281
     
    282290int MainThread(DWORD dummy){
    283291    extern BOOL bDebugRun;
    284     extern int bError;
    285292
    286293    if(bDebugRun){
     
    296303
    297304        //デバッグ実行
    298         if(bError==0) DebugProgram();
     305        if( !compiler.errorMessenger.HasError() )
     306        {
     307            DebugProgram();
     308        }
    299309    }
    300310    else{
Note: See TracChangeset for help on using the changeset viewer.