Changeset 465 in dev for trunk/ab5.0/abdev/BasicCompiler32


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

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

Location:
trunk/ab5.0/abdev/BasicCompiler32
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler32/BasicCompiler.vcproj

    r461 r465  
    12661266                    >
    12671267                </File>
     1268                <File
     1269                    RelativePath="..\BasicCompiler_Common\src\Messenger.cpp"
     1270                    >
     1271                </File>
    12681272                <Filter
    12691273                    Name="Langauge Classes"
     
    14711475                    >
    14721476                </File>
     1477                <File
     1478                    RelativePath="..\BasicCompiler_Common\include\Messenger.h"
     1479                    >
     1480                </File>
    14731481                <Filter
    14741482                    Name="Language Classes"
  • trunk/ab5.0/abdev/BasicCompiler32/CParameter.cpp

    r437 r465  
    239239                char temp2[255];
    240240                sprintf(temp2,"%s関数の第%dパラメータ",procName.c_str(),i2+1);
    241                 SetError(19,temp2,cp);
     241                compiler.errorMessenger.Output(19,temp2,cp);
    242242                continue;
    243243            }
     
    306306            }
    307307            else{
    308                 SetError(300,NULL,cp);
     308                compiler.errorMessenger.Output(300,NULL,cp);
    309309            }
    310310        }
     
    368368                                    if( dummyType.IsObject() ){
    369369                                        if( !dummyType.GetClass().IsEqualsOrSubClass( &varType.GetClass() ) ){
    370                                             SetError(11,Parms[i2],cp);
     370                                            compiler.errorMessenger.Output(11,Parms[i2],cp);
    371371                                        }
    372372                                    }
    373373                                    else if( dummyType.IsStruct() ){
    374374                                        if( !dummyType.GetClass().IsEquals( &varType.GetClass() ) ){
    375                                             SetError(11,Parms[i2],cp);
     375                                            compiler.errorMessenger.Output(11,Parms[i2],cp);
    376376                                        }
    377377                                    }
     
    382382                                }
    383383                                else{
    384                                     SetError(11,Parms[i2],cp);
     384                                    compiler.errorMessenger.Output(11,Parms[i2],cp);
    385385                                }
    386386                            }
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_Calc.cpp

    r461 r465  
    130130        compiler.codeGenerator.op_fstp_basereg( DEF_DOUBLE, REG_ESP );
    131131    }
    132     else SetError(9,NULL,cp);
     132    else compiler.errorMessenger.Output(9,NULL,cp);
    133133}
    134134void ChangeTypeToSingle(int OldType){
     
    198198        compiler.codeGenerator.op_fstp_basereg( DEF_SINGLE, REG_ESP );
    199199    }
    200     else SetError(9,NULL,cp);
     200    else compiler.errorMessenger.Output(9,NULL,cp);
    201201}
    202202
     
    254254        }
    255255    }
    256     else SetError(9,NULL,cp);
     256    else compiler.errorMessenger.Output(9,NULL,cp);
    257257}
    258258void ChangeTypeToLong(int OldType){
     
    393393    }
    394394    else{
    395         SetError(300,NULL,cp);
     395        compiler.errorMessenger.Output(300,NULL,cp);
    396396    }
    397397}
     
    411411            //ダブルクォートは不正なのでエラー扱い
    412412            variable[i]=0;
    413             SetError(3,variable,cp);
     413            compiler.errorMessenger.Output(3,variable,cp);
    414414            return;
    415415        }
     
    458458            if(GetVarType(variable,Type(),0)){
    459459                //変数リストに該当したとき
    460                 SetError(1,NULL,cp);
     460                compiler.errorMessenger.Output(1,NULL,cp);
    461461            }
    462462            else{
     
    465465                {
    466466                    //定数リストに該当したとき
    467                     SetError(1,NULL,cp);
     467                    compiler.errorMessenger.Output(1,NULL,cp);
    468468                }
    469469                else{
    470470                    //変数リスト、定数リストに該当しないとき
    471                     SetError(3,variable,cp);
     471                    compiler.errorMessenger.Output(3,variable,cp);
    472472                }
    473473            }
     
    491491
    492492    if(Command[i+1]=='\0'){
    493         SetError(1,NULL,cp);
     493        compiler.errorMessenger.Output(1,NULL,cp);
    494494        return;
    495495    }
     
    531531
    532532    if( lstrcmpi( variable, "This" ) == 0 ){
    533         SetError(133,NULL,cp);
     533        compiler.errorMessenger.Output(133,NULL,cp);
    534534        return;
    535535    }
     
    593593    if( !TermOpeOnlyVariable( variable, varType, VarRelativeVar, true ) )
    594594    {
    595         SetError();
     595        compiler.errorMessenger.OutputFatalError();
    596596        return;
    597597    }
    598598
    599599    if(varType.GetBasicType()&FLAG_PTR){
    600         SetError(14,variable,cp);
     600        compiler.errorMessenger.Output(14,variable,cp);
    601601        return;
    602602    }
     
    614614        compiler.GetObjectModule().meta.GetBlittableTypes().GetClass( calcType ).GetStaticMethods().Enum( "_Create", userProcs );
    615615        if( userProcs.size() != 1 ){
    616             SetError();
     616            compiler.errorMessenger.OutputFatalError();
    617617            return;
    618618        }
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_Calc_PushVar.cpp

    r308 r465  
    2121    }
    2222    else if(pRelativeVar->dwKind==VAR_REFGLOBAL){
    23         SetError(300,NULL,cp);
     23        compiler.errorMessenger.Output(300,NULL,cp);
    2424    }
    2525    else if(pRelativeVar->dwKind==VAR_LOCAL){
     
    6868        //64ビットの場合はedx:eaxにロード
    6969        if(reg!=REG_EAX){
    70             SetError(300,NULL,cp);
     70            compiler.errorMessenger.Output(300,NULL,cp);
    7171            return;
    7272        }
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_CallProc.cpp

    r461 r465  
    135135                    }
    136136                    else{
    137                         SetError(300,NULL,cp);
     137                        compiler.errorMessenger.Output(300,NULL,cp);
    138138                    }
    139139                }
     
    163163            pMethod = pobj_c->GetStaticMethods().GetMethodPtr( pUserProc );
    164164            if( !pMethod ){
    165                 SetError(300,NULL,cp);
     165                compiler.errorMessenger.Output(300,NULL,cp);
    166166                return false;
    167167            }
     
    181181                //同一クラスオブジェクトの場合はプライベートアクセスを容認する
    182182                if( pMethod->IsNoneAccess() ){
    183                     SetError(109,pUserProc->GetName(),cp);
     183                    compiler.errorMessenger.Output(109,pUserProc->GetName(),cp);
    184184                    return false;
    185185                }
     
    188188                if( pMethod->IsPrivate()
    189189                    || pMethod->IsNoneAccess() ){
    190                     SetError(109,pUserProc->GetName(),cp);
     190                    compiler.errorMessenger.Output(109,pUserProc->GetName(),cp);
    191191                    return false;
    192192                }
    193193                if( !pMethod->GetUserProc().GetParentClass().IsEqualsOrSubClass( pobj_c ) && pMethod->IsProtected() ){
    194                     SetError(110,pUserProc->GetName(),cp);
     194                    compiler.errorMessenger.Output(110,pUserProc->GetName(),cp);
    195195                    return false;
    196196                }
     
    200200            //クラス内部からの呼び出し(継承によるACCESS_NONのみをエラーとする)
    201201            if( pMethod->IsNoneAccess() ){
    202                 SetError(109,pUserProc->GetName(),cp);
     202                compiler.errorMessenger.Output(109,pUserProc->GetName(),cp);
    203203                return false;
    204204            }
     
    296296                if( !resultType.IsObject() )
    297297                {
    298                     SetError();
     298                    compiler.errorMessenger.OutputFatalError();
    299299                }
    300300
     
    344344            if( vtblMasterListIndex != 0 )
    345345            {
    346                 SetError();
     346                compiler.errorMessenger.OutputFatalError();
    347347            }
    348348        }
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_Func.cpp

    r461 r465  
    263263                    || type.IsObjectPtr() && referenceKind == RefPointer ) )
    264264                {
    265                     SetError(104,ObjectName,cp);
     265                    compiler.errorMessenger.Output(104,ObjectName,cp);
    266266                }
    267267
     
    305305            if( vtblMasterListIndex != 0 )
    306306            {
    307                 SetError();
     307                compiler.errorMessenger.OutputFatalError();
    308308            }
    309309        }
     
    400400        {
    401401            extern int cp;
    402             SetError(1,NULL,cp);
     402            compiler.errorMessenger.Output(1,NULL,cp);
    403403            return;
    404404        }
     
    460460        GetOverloadSubHash( name, subs );
    461461        if( subs.size() == 0 ){
    462             SetError(27,name,cp);
     462            compiler.errorMessenger.Output(27,name,cp);
    463463            return;
    464464        }
     
    480480                    ) )
    481481                {
    482                     SetError(67, name, cp );
     482                    compiler.errorMessenger.Output(67, name, cp );
    483483                }
    484484            }
     
    491491                    ) )
    492492                {
    493                     SetError(66, name, cp );
     493                    compiler.errorMessenger.Output(66, name, cp );
    494494                }
    495495            }
     
    497497
    498498        if(!pUserProc){
    499             SetError(27,name,cp);
     499            compiler.errorMessenger.Output(27,name,cp);
    500500            return;
    501501        }
     
    504504        pUserProc=GetSubHash(name);
    505505        if(!pUserProc){
    506             SetError(27,name,cp);
     506            compiler.errorMessenger.Output(27,name,cp);
    507507            return;
    508508        }
     
    531531    Type tempType;
    532532    if( !compiler.StringToType( typeName, tempType ) ){
    533         SetError(3,typeName,cp);
     533        compiler.errorMessenger.Output(3,typeName,cp);
    534534        return;
    535535    }
     
    597597    }
    598598    else{
    599         SetError(134,NULL,cp );
     599        compiler.errorMessenger.Output(134,NULL,cp );
    600600    }
    601601}
     
    680680    }
    681681    if(!tempType.IsWhole()){
    682         SetError(11,Parameter,cp);
     682        compiler.errorMessenger.Output(11,Parameter,cp);
    683683        return;
    684684    }
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_Object.cpp

    r391 r465  
    2222
    2323    if(bSomeObjects){
    24         SetError();
     24        compiler.errorMessenger.OutputFatalError();
    2525
    2626        //push ebx
     
    6464        }
    6565        else{
    66             SetError();
     66            compiler.errorMessenger.OutputFatalError();
    6767        }
    6868
     
    110110    if(pClass->IsAbstract()){
    111111        //抽象クラスだったとき
    112         SetError(125,pClass->GetName(),cp);
     112        compiler.errorMessenger.Output(125,pClass->GetName(),cp);
    113113    }
    114114
     
    119119        Type tempType;
    120120        NumOpe(objectSizeStr,Type(),tempType);
    121         if( !tempType.IsWhole() ) SetError(49,NULL,cp);
     121        if( !tempType.IsWhole() ) compiler.errorMessenger.Output(49,NULL,cp);
    122122        ChangeTypeToLong(tempType.GetBasicType());
    123123
     
    269269        return;
    270270    }
    271     if(!( tempType.IsObjectPtr() || tempType.IsVoidPtr() )) SetError(122,NULL,cp);
     271    if(!( tempType.IsObjectPtr() || tempType.IsVoidPtr() )) compiler.errorMessenger.Output(122,NULL,cp);
    272272
    273273    //pop eax
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_ProcOp.cpp

    r461 r465  
    197197    }
    198198    else{
    199         SetError();
     199        compiler.errorMessenger.OutputFatalError();
    200200    }
    201201}
     
    242242        {
    243243            if(pGotoLabelSchedule->GetName().size()>0){
    244                 SetError(6,pGotoLabelSchedule->GetName(),pGotoLabelSchedule->GetSourceCodePos());
     244                compiler.errorMessenger.Output(6,pGotoLabelSchedule->GetName(),pGotoLabelSchedule->GetSourceCodePos());
    245245            }
    246246            else{
    247247                char temporary[255];
    248248                sprintf(temporary,"%d",pGotoLabelSchedule->GetLineNum());
    249                 SetError(6,temporary,pGotoLabelSchedule->GetSourceCodePos());
     249                compiler.errorMessenger.Output(6,temporary,pGotoLabelSchedule->GetSourceCodePos());
    250250            }
    251251        }
     
    273273    }
    274274    else{
    275         SetError();
     275        compiler.errorMessenger.OutputFatalError();
    276276    }
    277277}
     
    285285
    286286    if( pUserProc->GetLocalVars().size() ){
    287         SetError();
     287        compiler.errorMessenger.OutputFatalError();
    288288        return;
    289289    }
     
    311311    {
    312312        // 既にコード生成が行われている場合はエラー
    313         SetError();
     313        compiler.errorMessenger.OutputFatalError();
    314314    }
    315315
     
    531531                    }
    532532                    if(!(temporary[0]=='('&&temporary[lstrlen(temporary)-1]==')')){
    533                         SetError(1,NULL,cp);
     533                        compiler.errorMessenger.Output(1,NULL,cp);
    534534                    }
    535535                    RemoveStringPare(temporary);
     
    618618    //With情報のメモリを解放
    619619    for(i3=0;i3<WithInfo.num;i3++){
    620         SetError(22,"With",WithInfo.pWithCp[i3]);
     620        compiler.errorMessenger.Output(22,"With",WithInfo.pWithCp[i3]);
    621621        HeapDefaultFree(WithInfo.ppName[i3]);
    622622    }
     
    710710        else
    711711        {
    712             SetError();
     712            compiler.errorMessenger.OutputFatalError();
    713713        }
    714714    }
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_Set_Var.cpp

    r461 r465  
    5050    }
    5151
    52     SetError(1,NULL,cp);
     52    compiler.errorMessenger.Output(1,NULL,cp);
    5353}
    5454
     
    155155    if(type==DEF_DOUBLE){
    156156        // TODO: 実装
    157         SetError();
     157        compiler.errorMessenger.OutputFatalError();
    158158    }
    159159    else if(type==DEF_SINGLE){
    160160        // TODO: 実装
    161         SetError();
     161        compiler.errorMessenger.OutputFatalError();
    162162    }
    163163    else if(type==DEF_INT64||type==DEF_QWORD){
     
    180180        if(!IsWholeNumberType(type)){
    181181            //不正な型の場合
    182             SetError(9,NULL,cp);
     182            compiler.errorMessenger.Output(9,NULL,cp);
    183183            return;
    184184        }
     
    327327    else if(pRelative->dwKind==VAR_REFGLOBAL){
    328328        // 今は使われていない
    329         SetError();
     329        compiler.errorMessenger.OutputFatalError();
    330330
    331331        if(pRelative->bOffsetOffset){
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_Statement.cpp

    r435 r465  
    1616            //ダブルクォートは不正なのでエラー扱い
    1717            leftTerm[i]=0;
    18             SetError(3,leftTerm,cp);
     18            compiler.errorMessenger.Output(3,leftTerm,cp);
    1919            return;
    2020        }
     
    4848        (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM)
    4949        )){
    50         SetError(1,NULL,cp);
     50        compiler.errorMessenger.Output(1,NULL,cp);
    5151        return;
    5252    }
     
    7676        if(pUserProc){
    7777            if( !pUserProc->IsMacro() ){
    78                 SetError(10,Command,cp);
     78                compiler.errorMessenger.Output(10,Command,cp);
    7979            }
    8080
     
    117117
    118118    // どこにも当てはまらなかったため、失敗
    119     SetError(1,NULL,cp);
     119    compiler.errorMessenger.Output(1,NULL,cp);
    120120}
    121121
     
    126126    for(i=0;;i++){
    127127        if(Parameter[i]=='\0'){
    128             SetError(21,NULL,cp);
     128            compiler.errorMessenger.Output(21,NULL,cp);
    129129            return;
    130130        }
     
    355355    compiler.codeGenerator.ContinueAreaBegin();
    356356
    357     if(!Parameter[0]) SetError(10,"While",cp);
     357    if(!Parameter[0]) compiler.errorMessenger.Output(10,"While",cp);
    358358
    359359    const PertialSchedule *pWhilePertialSchedule = NULL;
     
    483483    i=GetOneParameter(Parameter,0,temporary);
    484484    if(!Parameter[i]){
    485         SetError(12,"For",cp);
     485        compiler.errorMessenger.Output(12,"For",cp);
    486486        goto ErrorStep;
    487487    }
     
    496496        }
    497497        if(temporary[i2]=='\0'){
    498             SetError(12,"For",cp);
     498            compiler.errorMessenger.Output(12,"For",cp);
    499499            goto ErrorStep;
    500500        }
     
    514514    if(Parameter[i]){
    515515        i=GetOneParameter(Parameter,i,StepNum);
    516         if(Parameter[i]) SetError(12,"For",cp);
     516        if(Parameter[i]) compiler.errorMessenger.Output(12,"For",cp);
    517517    }
    518518    else lstrcpy(StepNum,"1");
     
    578578    if(szNextVariable[0]){
    579579        if(lstrcmp(szNextVariable,variable)!=0){
    580             SetError(55,szNextVariable,cp);
     580            compiler.errorMessenger.Output(55,szNextVariable,cp);
    581581        }
    582582    }
     
    608608    GetCustomToken( variable, Parameter, i, ESC_IN, true );
    609609    if(!Parameter[i]){
    610         SetError(12,"Foreach",cp);
     610        compiler.errorMessenger.Output(12,"Foreach",cp);
    611611        isError = true;
    612612        goto ErrorStep;
     
    667667    if(szNextVariable[0]){
    668668        if(lstrcmp(szNextVariable,variable)!=0){
    669             SetError(55,szNextVariable,cp);
     669            compiler.errorMessenger.Output(55,szNextVariable,cp);
    670670        }
    671671    }
     
    691691    int i,i2,i3;
    692692
    693     if(Parameter[0]) SetError(10,"Do",cp);
     693    if(Parameter[0]) compiler.errorMessenger.Output(10,"Do",cp);
    694694
    695695    //Continueアドレスのバックアップとセット
     
    894894void OpcodeExitSub(void){
    895895    if( UserProc::IsGlobalAreaCompiling() ){
    896         SetError(12,"Exit Sub/Function",cp);
     896        compiler.errorMessenger.Output(12,"Exit Sub/Function",cp);
    897897        return;
    898898    }
     
    942942            if(basbuf[i]=='\0'){
    943943                selectSchedules.pop_back();
    944                 SetError(22,"Select",cp);
     944                compiler.errorMessenger.Output(22,"Select",cp);
    945945                return;
    946946            }
     
    11631163
    11641164    if(selectSchedules.back().typeSize==-1){
    1165         SetError(30,"Case",cp);
     1165        compiler.errorMessenger.Output(30,"Case",cp);
    11661166        return;
    11671167    }
     
    12821282    i=GetOneParameter(Parameter,0,temporary);
    12831283    if(!Parameter[i]){
    1284         SetError(1,NULL,cp);
     1284        compiler.errorMessenger.Output(1,NULL,cp);
    12851285        return;
    12861286    }
     
    12911291    }
    12921292    if(!resultType.IsWhole()){
    1293         SetError(11,Parameter,cp);
     1293        compiler.errorMessenger.Output(11,Parameter,cp);
    12941294        return;
    12951295    }
     
    13001300    i=GetOneParameter(Parameter,i,temporary);
    13011301    if(Parameter[i]){
    1302         SetError(1,NULL,cp);
     1302        compiler.errorMessenger.Output(1,NULL,cp);
    13031303        return;
    13041304    }
  • trunk/ab5.0/abdev/BasicCompiler32/Compile_Var.cpp

    r461 r465  
    3535    else{
    3636        //エラー
    37         SetError(1,NULL,cp);
     37        compiler.errorMessenger.Output(1,NULL,cp);
    3838        return;
    3939    }
     
    185185    if( !pMember )
    186186    {
    187         if(isErrorEnabled) SetError(103,VarName,cp);
     187        if(isErrorEnabled) compiler.errorMessenger.Output(103,VarName,cp);
    188188        return false;
    189189    }
     
    196196        //同一クラスオブジェクトの場合はプライベートアクセスを容認する
    197197        if(pMember->IsNoneAccess()){
    198             if(isErrorEnabled) SetError(107,VarName,cp);
     198            if(isErrorEnabled) compiler.errorMessenger.Output(107,VarName,cp);
    199199            return false;
    200200        }
     
    203203        if((bPrivateAccess==0&&pMember->IsPrivate())||
    204204            pMember->IsNoneAccess()){
    205             if(isErrorEnabled) SetError(107,VarName,cp);
     205            if(isErrorEnabled) compiler.errorMessenger.Output(107,VarName,cp);
    206206            return false;
    207207        }
    208208        else if(bPrivateAccess==0&&pMember->IsProtected()){
    209             if(isErrorEnabled) SetError(108,VarName,cp);
     209            if(isErrorEnabled) compiler.errorMessenger.Output(108,VarName,cp);
    210210            return false;
    211211        }
     
    219219        ){
    220220            //Const定義の変数に書き込みアクセスをしようとした場合
    221             SetError(61,VarName,cp);
     221            compiler.errorMessenger.Output(61,VarName,cp);
    222222    }
    223223
     
    237237    else{
    238238        if(lpPtrOffset[0]){
    239             if(isErrorEnabled) SetError(16,member,cp);
     239            if(isErrorEnabled) compiler.errorMessenger.Output(16,member,cp);
    240240            return false;
    241241        }
     
    250250        //配列オフセット
    251251        if(!GetArrayOffset(pMember->GetSubscripts(),array,pMember->GetType())){
    252             if(isErrorEnabled) SetError(14,member,cp);
     252            if(isErrorEnabled) compiler.errorMessenger.Output(14,member,cp);
    253253            return false;
    254254        }
     
    263263        if( resultType.IsObject() || resultType.IsStruct() ){
    264264            if( refType != RefDot ){
    265                 if(isErrorEnabled) SetError(104,member,cp);
     265                if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
    266266                return false;
    267267            }
     
    279279                if( ( resultType.IsObjectPtr() || resultType.IsStructPtr() )
    280280                    && refType != RefDot ){
    281                         if(isErrorEnabled) SetError(104,member,cp);
     281                        if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
    282282                        return false;
    283283                }
     
    293293                if( ( resultType.IsObjectPtr() || resultType.IsStructPtr() )
    294294                    && refType != RefPointer ){
    295                         if(isErrorEnabled) SetError(104,member,cp);
     295                        if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
    296296                        return false;
    297297                }
     
    307307                //ppObj[n]->member
    308308                if( refType != RefPointer ){
    309                     if(isErrorEnabled) SetError(104,member,cp);
     309                    if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
    310310                    return false;
    311311                }
     
    321321            }
    322322            else{
    323                 if(isErrorEnabled) SetError(104,member,cp);
     323                if(isErrorEnabled) compiler.errorMessenger.Output(104,member,cp);
    324324                return false;
    325325            }
     
    403403            else{
    404404                if(lpPtrOffset[0]){
    405                     SetError(16,variable,cp);
     405                    compiler.errorMessenger.Output(16,variable,cp);
    406406                    pRelativeVar->dwKind=NON_VAR;
    407407                    return false;
     
    485485            compiler.pCompilingClass->IsCompilingDestructor() == false
    486486            ){
    487                 SetError(131, NULL, cp );
     487                compiler.errorMessenger.Output(131, NULL, cp );
    488488        }
    489489
     
    577577        }
    578578
    579         if(isErrorEnabled) SetError(3,variable,cp);
     579        if(isErrorEnabled) compiler.errorMessenger.Output(3,variable,cp);
    580580        pRelativeVar->dwKind=NON_VAR;
    581581        return false;
     
    593593        else{
    594594            if(lpPtrOffset[0]){
    595                 SetError(16,variable,cp);
     595                compiler.errorMessenger.Output(16,variable,cp);
    596596                pRelativeVar->dwKind=NON_VAR;
    597597                return false;
     
    619619        if( resultType.IsObject() ){
    620620            //オブジェクト定数
    621             SetError(130, VarName, cp );
     621            compiler.errorMessenger.Output(130, VarName, cp );
    622622        }
    623623        else{
    624624            //一般のConst変数
    625             SetError(61,VarName,cp);
     625            compiler.errorMessenger.Output(61,VarName,cp);
    626626        }
    627627    }
     
    647647    if(array[0]){
    648648        if(!GetArrayOffset(*pSubscripts,array,resultType)){
    649             SetError(14,variable,cp);
     649            compiler.errorMessenger.Output(14,variable,cp);
    650650            pRelativeVar->dwKind=NON_VAR;
    651651            return false;
     
    656656            //実態オブジェクトのメンバを参照(obj.member)
    657657            if( refType != RefDot ){
    658                 SetError(104,VarName,cp);
     658                compiler.errorMessenger.Output(104,VarName,cp);
    659659                pRelativeVar->dwKind=NON_VAR;
    660660                return false;
     
    671671                //pObj[n].member
    672672                if( refType != RefDot ){
    673                     SetError(104,VarName,cp);
     673                    compiler.errorMessenger.Output(104,VarName,cp);
    674674                    pRelativeVar->dwKind=NON_VAR;
    675675                    return false;
     
    681681                //pObj->member
    682682                if( refType != RefPointer ){
    683                     SetError(104,VarName,cp);
     683                    compiler.errorMessenger.Output(104,VarName,cp);
    684684                    pRelativeVar->dwKind=NON_VAR;
    685685                    return false;
     
    698698                //ppObj[n]->member
    699699                if( refType != RefPointer ){
    700                     SetError(104,VarName,cp);
     700                    compiler.errorMessenger.Output(104,VarName,cp);
    701701                    pRelativeVar->dwKind=NON_VAR;
    702702                    return false;
     
    713713            }
    714714            else{
    715                 SetError(104,VarName,cp);
     715                compiler.errorMessenger.Output(104,VarName,cp);
    716716                pRelativeVar->dwKind=NON_VAR;
    717717                return false;
     
    719719        }
    720720        else{
    721             SetError(102,VarName,cp);
     721            compiler.errorMessenger.Output(102,VarName,cp);
    722722            pRelativeVar->dwKind=NON_VAR;
    723723            return false;
     
    768768                while(1){
    769769                    if( subscripts[0] < i2 ){
    770                         SetError(41,0,cp);
     770                        compiler.errorMessenger.Output(41,0,cp);
    771771                        return 0;
    772772                    }
     
    790790            BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
    791791                if(InitBuf[i]=='\0'){
    792                     SetError(41,0,cp);
     792                    compiler.errorMessenger.Output(41,0,cp);
    793793                    return false;
    794794                }
     
    806806        }
    807807
    808         SetError(41,0,cp);
     808        compiler.errorMessenger.Output(41,0,cp);
    809809        return false;
    810810    }
     
    816816
    817817    if( subscripts.size() > 0 ){
    818         SetError(41,0,cp);
     818        compiler.errorMessenger.Output(41,0,cp);
    819819        return false;
    820820    }
     
    931931                while(1){
    932932                    if( subscripts[0] < i2 ){
    933                         SetError(41,0,cp);
     933                        compiler.errorMessenger.Output(41,0,cp);
    934934                        return 0;
    935935                    }
     
    953953            BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
    954954                if(InitBuf[i]=='\0'){
    955                     SetError(41,0,cp);
     955                    compiler.errorMessenger.Output(41,0,cp);
    956956                    return false;
    957957                }
     
    971971        }
    972972
    973         SetError(41,0,cp);
     973        compiler.errorMessenger.Output(41,0,cp);
    974974        return false;
    975975    }
     
    981981
    982982    if( subscripts.size() > 0 ){
    983         SetError(41,0,cp);
     983        compiler.errorMessenger.Output(41,0,cp);
    984984        return false;
    985985    }
     
    11051105        if( UserProc::CompilingUserProc().GetLocalVars().DuplicateCheck( Symbol( VarName ) ) ){
    11061106            //2重定義のエラー
    1107             SetError(15,VarName,cp);
     1107            compiler.errorMessenger.Output(15,VarName,cp);
    11081108            return;
    11091109        }
     
    12181218        else{
    12191219            if( subscripts.size() > 1 ){
    1220                 SetError(300,NULL,cp);
     1220                compiler.errorMessenger.Output(300,NULL,cp);
    12211221            }
    12221222            sprintf( objectSize, "%d", subscripts[0] );
     
    12301230        GetVarOffset( true, false, VarName, &RelativeVar, Type() );
    12311231        if( RelativeVar.dwKind == VAR_DIRECTMEM ){
    1232             SetError();
     1232            compiler.errorMessenger.OutputFatalError();
    12331233        }
    12341234        SetVariableFromEax( Type( DEF_OBJECT, *compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr() ), DEF_OBJECT, &RelativeVar );
     
    13061306void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar){
    13071307    if( reg != REG_EAX ){
    1308         SetError();
     1308        compiler.errorMessenger.OutputFatalError();
    13091309        //TODO: 未完成
    13101310    }
     
    13151315    const UserProc *pUserProc_AddGlobalRootPtr = GetClassMethod( "_System_CGarbageCollection", "AddGlobalRootPtr" );
    13161316    if( !pUserProc_AddGlobalRootPtr ){
    1317         SetError(3, "_System_CGarbageCollection.AddGlobalRootPtr", -1 );
     1317        compiler.errorMessenger.Output(3, "_System_CGarbageCollection.AddGlobalRootPtr", -1 );
    13181318        return false;
    13191319    }
  • trunk/ab5.0/abdev/BasicCompiler32/MakePeHdr.cpp

    r459 r465  
    365365        // 名前空間が初期化されているかをチェック
    366366        if( compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().size() ){
    367             SetError();
     367            compiler.errorMessenger.OutputFatalError();
    368368        }
    369369
     
    443443        //With情報のメモリを解放
    444444        for(i=0;i<WithInfo.num;i++){
    445             SetError(22,"With",WithInfo.pWithCp[i]);
     445            compiler.errorMessenger.Output(22,"With",WithInfo.pWithCp[i]);
    446446            HeapDefaultFree(WithInfo.ppName[i]);
    447447        }
     
    451451        // 名前空間が正しく閉じられているかをチェック
    452452        if( compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().size() ){
    453             SetError(63,NULL,-1);
     453            compiler.errorMessenger.Output(63,NULL,-1);
    454454        }
    455455
     
    504504    }
    505505
    506     extern BOOL bError;
    507     if( !bError )
     506    if( !compiler.errorMessenger.HasError() )
    508507    {
    509         CompileMessage( "リンク中..." );
     508        compiler.messenger.Output( "リンク中..." );
    510509    }
    511510
     
    558557
    559558            if(!hLib){
    560                 SetError(-106,pDllProc->GetDllFileName().c_str(),pDllProc->GetCodePos());
     559                compiler.errorMessenger.Output(-106,pDllProc->GetDllFileName().c_str(),pDllProc->GetCodePos());
    561560            }
    562561        }
     
    565564            if(!GetProcAddress(hLib,pDllProc->GetAlias().c_str())){
    566565                FreeLibrary(hLib);
    567                 SetError(-107,pDllProc->GetAlias(),pDllProc->GetCodePos());
     566                compiler.errorMessenger.Output(-107,pDllProc->GetAlias(),pDllProc->GetCodePos());
    568567            }
    569568            FreeLibrary(hLib);
     
    712711
    713712        if( pDllProc->GetDllFileName().size() > 16 ){
    714             SetError(7,NULL,cp);
     713            compiler.errorMessenger.Output(7,NULL,cp);
    715714            break;
    716715        }
     
    831830    CDebugSection *pobj_DebugSection;
    832831    pobj_DebugSection=new CDebugSection();
    833     extern BOOL bError;
    834     if( compiler.IsDebug() && bError == 0 )
     832    if( compiler.IsDebug() && !compiler.errorMessenger.HasError() )
    835833    {
    836         CompileMessage( "デバッグ情報を生成しています。" );
     834        compiler.messenger.Output( "デバッグ情報を生成しています。" );
    837835
    838836        pobj_DebugSection->make();
    839837
    840         CompileMessage( "デバッグ情報の生成が完了しました。" );
     838        compiler.messenger.Output( "デバッグ情報の生成が完了しました。" );
    841839    }
    842840
     
    11221120
    11231121
    1124     extern BOOL bError;
    1125     if(bError) goto EndWriteOpcode;
     1122    if( compiler.errorMessenger.HasError() )
     1123    {
     1124        goto EndWriteOpcode;
     1125    }
    11261126
    11271127
     
    14141414    hFile=CreateFile(OutputFileName,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
    14151415    if(hFile==INVALID_HANDLE_VALUE){
    1416         SetError(53,OutputFileName,-1);
     1416        compiler.errorMessenger.Output(53,OutputFileName,-1);
    14171417        goto EndWriteOpcode;
    14181418    }
  • trunk/ab5.0/abdev/BasicCompiler32/NumOpe.cpp

    r461 r465  
    5959    }
    6060    else{
    61         SetError();
     61        compiler.errorMessenger.OutputFatalError();
    6262    }
    6363}
     
    7979void ExtendRegToBigType( int reg, int bigBasicType, int baseBasicType ){
    8080    if( reg != REG_EAX ){
    81         SetError();
     81        compiler.errorMessenger.OutputFatalError();
    8282    }
    8383    switch( Type::GetBasicSize( bigBasicType ) ){
     
    190190                // オブジェクトメンバのポインタをeaxにコピー
    191191                if( !VarToReg( tempRelativeVar, baseType, resultType ) ){
    192                     SetError(11,termFull,cp);
     192                    compiler.errorMessenger.Output(11,termFull,cp);
    193193                }
    194194
     
    224224            if( !leftType.IsStruct() )
    225225            {
    226                 SetError();
     226                compiler.errorMessenger.OutputFatalError();
    227227            }
    228228
     
    332332    {
    333333        // 関数ポインタ
    334         SetError();
     334        compiler.errorMessenger.OutputFatalError();
    335335
    336336        ///////////////////////////////////////////////////////////////////
     
    342342    }
    343343
    344     SetError();
     344    compiler.errorMessenger.OutputFatalError();
    345345
    346346    return false;
     
    400400            if( isProcedureCallOnly )
    401401            {
    402                 SetError(1,NULL,cp);
     402                compiler.errorMessenger.Output(1,NULL,cp);
    403403            }
    404404            return false;
     
    432432        if( compiler.pCompilingClass == NULL )
    433433        {
    434             SetError(142,NULL,cp);
     434            compiler.errorMessenger.Output(142,NULL,cp);
    435435            return false;
    436436        }
     
    465465            {
    466466                //閉じカッコ")"に続く文字がNULLでないとき
    467                 SetError(42,NULL,cp);
     467                compiler.errorMessenger.Output(42,NULL,cp);
    468468            }
    469469
     
    525525
    526526                //閉じカッコ")"に続く文字がNULLでないときはエラーにする
    527                 if(termFull[i2+1+i4+1]!='\0') SetError(42,NULL,cp);
     527                if(termFull[i2+1+i4+1]!='\0') compiler.errorMessenger.Output(42,NULL,cp);
    528528
    529529                //マクロ関数の場合
     
    629629    if( isProcedureCallOnly )
    630630    {
    631         SetError(3, termLeft, cp );
     631        compiler.errorMessenger.Output(3, termLeft, cp );
    632632    }
    633633
     
    645645        // 変数の場合はeaxに変数ポインタを格納する
    646646        if( !VarToReg( relativeVar, baseType, resultType ) ){
    647             SetError(11,term,cp);
     647            compiler.errorMessenger.Output(11,term,cp);
    648648        }
    649649    }
     
    658658    if( !isVariable )
    659659    {
    660         SetError();
     660        compiler.errorMessenger.OutputFatalError();
    661661    }
    662662
     
    678678    if( reg != REG_EAX ){
    679679        // TODO: 未実装
    680         SetError();
     680        compiler.errorMessenger.OutputFatalError();
    681681    }
    682682
     
    708708
    709709    if(expression[0]=='\0'){
    710         SetError(1,NULL,cp);
     710        compiler.errorMessenger.Output(1,NULL,cp);
    711711        return false;
    712712    }
     
    863863                        else GetCalcName(idCalc,temp2);
    864864                        sprintf(temporary,"Operator %s",temp2);
    865                         SetError(27,temporary,cp);
     865                        compiler.errorMessenger.Output(27,temporary,cp);
    866866                        goto error;
    867867                    }
     
    892892                    }
    893893                    else{
    894                         SetError(3, term, cp );
     894                        compiler.errorMessenger.Output(3, term, cp );
    895895                        goto error;
    896896                    }
     
    918918                        // 拡張版リテラル文字列(エスケープシーケンス可能)
    919919                        if(!RemoveStringQuotes(term+2)){
    920                             SetError(43,NULL,cp);
     920                            compiler.errorMessenger.Output(43,NULL,cp);
    921921                            goto error;
    922922                        }
     
    928928                        // 通常文字列
    929929                        if(!RemoveStringQuotes(term)){
    930                             SetError(43,NULL,cp);
     930                            compiler.errorMessenger.Output(43,NULL,cp);
    931931                            goto error;
    932932                        }
     
    976976                                }
    977977                            }
    978                             SetError(38,term,cp);
     978                            compiler.errorMessenger.Output(38,term,cp);
    979979
    980980                            goto error;
     
    990990                        if( resultType.GetBasicType() & FLAG_CAST ){
    991991                            // 型名のみ
    992                             SetError();
     992                            compiler.errorMessenger.OutputFatalError();
    993993                        }
    994994                        else{
     
    10871087                        }
    10881088                        else{
    1089                             SetError(300,NULL,cp);
     1089                            compiler.errorMessenger.Output(300,NULL,cp);
    10901090                            goto error;
    10911091                        }
     
    10951095                    //該当する識別子が見当たらないときはエラー扱いにする
    10961096                    bError=1;
    1097                     SetError(3,term,cp);
     1097                    compiler.errorMessenger.Output(3,term,cp);
    10981098                    type_stack[sp]=DEF_DOUBLE;
    10991099                }
     
    12431243                if( PTR_LEVEL( type_stack[sp-1] ) <= 0 ){
    12441244                    //ポインタ型ではないとき
    1245                     SetError( 3, NULL, cp );
     1245                    compiler.errorMessenger.Output( 3, NULL, cp );
    12461246                    goto error;
    12471247                }
     
    12521252
    12531253            default:
    1254                 SetError(300,NULL,cp);
     1254                compiler.errorMessenger.Output(300,NULL,cp);
    12551255                goto error;
    12561256        }
     
    12601260
    12611261    if(sp!=1){
    1262         SetError(1,NULL,cp);
     1262        compiler.errorMessenger.Output(1,NULL,cp);
    12631263        goto error;
    12641264    }
     
    12661266    if(bLiteralCalculation){
    12671267        //右辺値が数値の定数式の場合
    1268         SetError();
     1268        compiler.errorMessenger.OutputFatalError();
    12691269    }
    12701270    else{
  • trunk/ab5.0/abdev/BasicCompiler32/NumOpe_Arithmetic.cpp

    r290 r465  
    999999    int castBasicType = type[sp-1];
    10001000    if((castBasicType&FLAG_CAST)==0){
    1001         SetError(47,NULL,cp);
     1001        compiler.errorMessenger.Output(47,NULL,cp);
    10021002        return 0;
    10031003    }
  • trunk/ab5.0/abdev/BasicCompiler32/NumOpe_Logical.cpp

    r308 r465  
    1515    if(IsRealNumberType(type[sp-2])||IsRealNumberType(type[sp-1])){
    1616        //いずれかの項が実数のとき
    17         SetError(45,"xor",cp);
     17        compiler.errorMessenger.Output(45,"xor",cp);
    1818        return 0;
    1919    }
     
    158158    if(IsRealNumberType(type[sp-2])||IsRealNumberType(type[sp-1])){
    159159        //いずれかの項が実数のとき
    160         SetError(45,"or",cp);
     160        compiler.errorMessenger.Output(45,"or",cp);
    161161        return 0;
    162162    }
     
    301301    if(IsRealNumberType(type[sp-2])||IsRealNumberType(type[sp-1])){
    302302        //いずれかの項が実数のとき
    303         SetError(45,"and",cp);
     303        compiler.errorMessenger.Output(45,"and",cp);
    304304        return 0;
    305305    }
     
    441441    if(IsRealNumberType(type[sp-1])){
    442442        //実数のとき
    443         SetError(45,"Not",cp);
     443        compiler.errorMessenger.Output(45,"Not",cp);
    444444        return 0;
    445445    }
  • trunk/ab5.0/abdev/BasicCompiler32/NumOpe_Relation.cpp

    r248 r465  
    2424        }
    2525        else{
    26             SetError();
     26            compiler.errorMessenger.OutputFatalError();
    2727        }
    2828    }*/
  • trunk/ab5.0/abdev/BasicCompiler32/OperatorProc.cpp

    r448 r465  
    77
    88void FreeTempObject(int reg,const CClass *pobj_c){
    9     if(!IsSafeReg(reg)) SetError(300,NULL,cp);
     9    if(!IsSafeReg(reg)) compiler.errorMessenger.Output(300,NULL,cp);
    1010
    1111    const CMethod *method = pobj_c->GetDestructorMethod();
     
    231231    if(bCalcUseHeap){
    232232        //未解放のインスタンスが存在する旨を示す警告
    233         SetError(-105,NULL,cp);
     233        compiler.errorMessenger.Output(-105,NULL,cp);
    234234    }
    235235
     
    255255
    256256    //エラーを発行
    257     SetError(-1,"キャスト演算子がオーバーロードされていません。",cp);
     257    compiler.errorMessenger.Output(-1,"キャスト演算子がオーバーロードされていません。",cp);
    258258}
    259259void CallIndexerGetterProc( const Type &classType, const char *ObjectName, char *Parameter,Type &resultType, DWORD dwProcFlags ){
  • trunk/ab5.0/abdev/BasicCompiler32/stdafx.h

    r461 r465  
    2222#include <jenga/include/common/File.h>
    2323#include <jenga/include/common/CmdLine.h>
     24#include <jenga/include/common/Path.h>
    2425
    2526#include "../BasicCompiler_Common/common.h"
  • trunk/ab5.0/abdev/BasicCompiler32/x86CodeGenerator.cpp

    r370 r465  
    3030        || mod == MOD_REG ) )
    3131    {
    32         SetError();
     32        compiler.errorMessenger.OutputFatalError();
    3333    }
    3434    if( isPertialSchedule && !( mod == MOD_DISP32 || mod == MOD_BASE_DISP32 ) )
    3535    {
    36         SetError();
     36        compiler.errorMessenger.OutputFatalError();
    3737    }
    3838
     
    972972    if(type==DEF_DOUBLE)        pNativeCode->Put( (char)0xDD );
    973973    else if(type==DEF_SINGLE)   pNativeCode->Put( (char)0xD9 );
    974     else SetError(300,NULL,cp);
     974    else compiler.errorMessenger.Output(300,NULL,cp);
    975975
    976976    if(base_reg==REG_ESP){
     
    993993    if(type==DEF_DOUBLE)        pNativeCode->Put( (char)0xDD );
    994994    else if(type==DEF_SINGLE)   pNativeCode->Put( (char)0xD9 );
    995     else SetError(300,NULL,cp);
     995    else compiler.errorMessenger.Output(300,NULL,cp);
    996996
    997997    //オペコード、レジスタ
     
    10271027    if(type==DEF_DOUBLE)        pNativeCode->Put( (char)0xDD );
    10281028    else if(type==DEF_SINGLE)   pNativeCode->Put( (char)0xD9 );
    1029     else SetError(300,NULL,cp);
     1029    else compiler.errorMessenger.Output(300,NULL,cp);
    10301030
    10311031    int reg=0;
     
    10691069    if(type==DEF_DOUBLE)        pNativeCode->Put( (char)0xDD );
    10701070    else if(type==DEF_SINGLE)   pNativeCode->Put( (char)0xD9 );
    1071     else SetError(300,NULL,cp);
     1071    else compiler.errorMessenger.Output(300,NULL,cp);
    10721072
    10731073    if(base_reg==REG_ESP){
     
    10901090    if(type==DEF_DOUBLE)        pNativeCode->Put( (char)0xDD );
    10911091    else if(type==DEF_SINGLE)   pNativeCode->Put( (char)0xD9 );
    1092     else SetError(300,NULL,cp);
     1092    else compiler.errorMessenger.Output(300,NULL,cp);
    10931093
    10941094    //オペコード、レジスタ
     
    11241124    if(type==DEF_DOUBLE)        pNativeCode->Put( (char)0xDD );
    11251125    else if(type==DEF_SINGLE)   pNativeCode->Put( (char)0xD9 );
    1126     else SetError(300,NULL,cp);
     1126    else compiler.errorMessenger.Output(300,NULL,cp);
    11271127
    11281128    int reg=0;
     
    11821182    }
    11831183    else{
    1184         SetError();
     1184        compiler.errorMessenger.OutputFatalError();
    11851185    }
    11861186}
Note: See TracChangeset for help on using the changeset viewer.