Changeset 79 in dev


Ignore:
Timestamp:
Mar 25, 2007, 5:58:57 AM (17 years ago)
Author:
dai_9181
Message:

バージョンをβ17にした。
#strictをデフォルトの状態で適用するようにした(#90)。
Dimステートメントにおいて、初期値式とAsが同時に指定されていたとき、As以降も初期値式の一部として捉えるよう、変更(#91)。
GetTypeDef関数を完全廃止。

Files:
23 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/BasicCompiler.vcproj

    r78 r79  
    147147                Optimization="2"
    148148                InlineFunctionExpansion="1"
    149                 AdditionalIncludeDirectories="..\cpplibs\boost"
     149                AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include"
    150150                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN"
    151151                StringPooling="true"
     
    245245                Optimization="2"
    246246                InlineFunctionExpansion="1"
    247                 AdditionalIncludeDirectories="..\cpplibs\boost"
     247                AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include"
    248248                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ENG"
    249249                StringPooling="true"
  • BasicCompiler32/Compile_Func.cpp

    r78 r79  
    340340    pUserProc->Using();
    341341}
    342 void Opcode_Func_SizeOf(const char *Parameter){
    343     LONG_PTR lpIndex;
    344     int type = GetTypeFixed(Parameter,&lpIndex);
    345 
    346     int size;
    347     if( type == DEF_OBJECT ){
    348         CClass *pClass = (CClass *)lpIndex;
    349         size = pClass->GetSize();
    350     }
    351     else{
    352         size=GetTypeSize(type,lpIndex);
    353     }
     342void Opcode_Func_SizeOf( const string &typeName ){
     343    Type tempType;
     344    if( !Type::StringToType( typeName, tempType ) ){
     345        SetError(3,typeName,cp);
     346        return;
     347    }
     348
     349    int typeSize = ( tempType.IsObject() ) ?
     350        tempType.GetClass().GetSize() : tempType.GetSize();
    354351
    355352    //mov eax,size
    356     op_mov_RV( REG_EAX, size );
     353    op_mov_RV( REG_EAX, typeSize );
    357354}
    358355void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){
  • BasicCompiler32/Compile_Var.cpp

    r76 r79  
    10791079}
    10801080
    1081 void dim(bool isRef, char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
     1081void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
    10821082    if( UserProc::IsGlobalAreaCompiling() ){
    10831083        /////////////////////////
     
    10851085        /////////////////////////
    10861086
    1087         AddGlobalVariable(isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);
     1087        AddGlobalVariable(VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);
    10881088    }
    10891089    else{
     
    10921092        /////////////////
    10931093
    1094         if( UserProc::CompilingUserProc().localVars.BackSearch( VarName ) ){
     1094        if( UserProc::CompilingUserProc().localVars.DuplicateCheck( VarName ) ){
    10951095            //2重定義のエラー
    10961096            SetError(15,VarName,cp);
     
    11001100        bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false;
    11011101
    1102         Variable *pVar = new Variable( VarName, type, isConst, isRef );
     1102        Variable *pVar = new Variable( VarName, type, isConst );
    11031103
    11041104        if( SubScripts[0] != -1 ){
  • BasicCompiler32/NumOpe.cpp

    r76 r79  
    151151    int sp;
    152152    int type_stack[255];
     153    bool isNothing_stack[255];
    153154    LONG_PTR index_stack[255];
    154155    BOOL bUseHeap[255];
     
    160161        if(idCalc){
    161162            if(type_stack[sp-2]==DEF_OBJECT){
    162                 //オーバーロードされたオペレータを呼び出す
    163                 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
    164                 if(i2==0){
    165                     if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
    166                     else GetCalcName(idCalc,temp2);
    167                     sprintf(temporary,"Operator %s",temp2);
    168                     SetError(27,temporary,cp);
    169                     goto error;
     163                if( idCalc == CALC_AS
     164                    && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST )
     165                    && index_stack[sp-1] == index_stack[sp-2]
     166                    || isNothing_stack[sp-2] ){
     167                        // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない
    170168                }
    171                 else if(i2==-1) goto error;
    172 
    173                 continue;
     169                else{
     170                    //オーバーロードされたオペレータを呼び出す
     171                    i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
     172                    if(i2==0){
     173                        if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
     174                        else GetCalcName(idCalc,temp2);
     175                        sprintf(temporary,"Operator %s",temp2);
     176                        SetError(27,temporary,cp);
     177                        goto error;
     178                    }
     179                    else if(i2==-1) goto error;
     180
     181                    continue;
     182                }
    174183            }
    175184
     
    181190            case 0:
    182191                index_stack[sp]=-1;
     192                isNothing_stack[sp] = false;
    183193                bUseHeap[sp]=0;
    184194
     
    363373                    // Nothing
    364374                    if( lstrcmp( term, "Nothing" ) == 0 ){
     375                        isNothing_stack[sp] = true;
     376
    365377                        type_stack[sp] = DEF_OBJECT;
    366378                        if( baseType.IsObject() ){
     
    489501                    // 型名の場合
    490502                    //////////////
    491 
    492                     LONG_PTR lp;
    493                     i3=GetTypeFixed(term,&lp);
    494                     if(i3!=-1){
    495                         type_stack[sp]=i3|FLAG_CAST;
    496                         index_stack[sp]=lp;
     503                    Type tempType;
     504                    if( Type::StringToType( term, tempType ) ){
     505                        type_stack[sp] = tempType.GetBasicType() | FLAG_CAST;
     506                        index_stack[sp] = tempType.GetIndex();
    497507                        sp++;
    498508                        break;
    499509                    }
    500 
    501510
    502511
  • BasicCompiler32/Opcode.h

    r78 r79  
    190190#define DIMFLAG_STATIC                  4
    191191#define DIMFLAG_CONST                   8
    192 void dim(bool isRef, char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
     192void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
    193193void SetVarPtrToEax(RELATIVE_VAR *pRelativeVar);
    194194
  • BasicCompiler64/BasicCompiler.vcproj

    r78 r79  
    152152                Optimization="2"
    153153                InlineFunctionExpansion="1"
    154                 AdditionalIncludeDirectories="..\cpplibs\boost;..\cpplibs\Base"
     154                AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include"
    155155                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN;_AMD64_;_WIN64"
    156156                StringPooling="true"
     
    253253                Optimization="2"
    254254                InlineFunctionExpansion="1"
    255                 AdditionalIncludeDirectories="..\cpplibs\boost;..\cpplibs\Base"
     255                AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include"
    256256                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ENG"
    257257                StringPooling="true"
     
    348348                Name="VCCLCompilerTool"
    349349                Optimization="2"
    350                 AdditionalIncludeDirectories="..\cpplibs\boost;..\cpplibs\Base"
     350                AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include"
    351351                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN;_AMD64_;_WIN64"
    352352                MinimalRebuild="false"
  • BasicCompiler64/Compile_Func.cpp

    r78 r79  
    185185    pUserProc->Using();
    186186}
    187 void Opcode_Func_SizeOf( const char *Parameter ){
    188     LONG_PTR lpIndex;
    189     int type = GetTypeFixed(Parameter,&lpIndex);
    190 
    191     int size;
    192     if( type == DEF_OBJECT ){
    193         CClass *pClass = (CClass *)lpIndex;
    194         size = pClass->GetSize();
    195     }
    196     else{
    197         size=GetTypeSize(type,lpIndex);
    198     }
     187void Opcode_Func_SizeOf( const string &typeName ){
     188    Type tempType;
     189    if( !Type::StringToType( typeName, tempType ) ){
     190        SetError(3,typeName,cp);
     191        return;
     192    }
     193
     194    int typeSize = ( tempType.IsObject() ) ?
     195        tempType.GetClass().GetSize() : tempType.GetSize();
    199196
    200197    //mov rax,size
    201     op_mov_RV(sizeof(_int64),REG_RAX,size);
     198    op_mov_RV(sizeof(_int64),REG_RAX,typeSize);
    202199}
    203200void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){
  • BasicCompiler64/Compile_Var.cpp

    r76 r79  
    10741074}
    10751075
    1076 void dim(bool isRef, char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
     1076void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
    10771077    if( UserProc::IsGlobalAreaCompiling() ){
    10781078        /////////////////////////
     
    10801080        /////////////////////////
    10811081
    1082         AddGlobalVariable(isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);
     1082        AddGlobalVariable(VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);
    10831083    }
    10841084    else{
     
    10951095        bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false;
    10961096
    1097         Variable *pVar = new Variable( VarName, type, isConst, isRef );
     1097        Variable *pVar = new Variable( VarName, type, isConst );
    10981098
    10991099        if( SubScripts[0] != -1 ){
  • BasicCompiler64/NumOpe.cpp

    r76 r79  
    177177    int type_stack[255];
    178178    LONG_PTR index_stack[255];
     179    bool isNothing_stack[255];
    179180    BOOL bUseHeap[255];
    180181    _int64 i64data;
     
    187188        if(idCalc){
    188189            if(type_stack[sp-2]==DEF_OBJECT){
    189                 //オーバーロードされたオペレータを呼び出す
    190                 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
    191                 if(i2==0){
    192                     if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
    193                     else GetCalcName(idCalc,temp2);
    194                     sprintf(temporary,"Operator %s",temp2);
    195                     SetError(27,temporary,cp);
    196                     goto error;
     190                if( idCalc == CALC_AS
     191                    && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST )
     192                    && index_stack[sp-1] == index_stack[sp-2]
     193                    || isNothing_stack[sp-2] ){
     194                        // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない
    197195                }
    198                 else if(i2==-1) goto error;
    199 
    200                 continue;
     196                else{
     197                    //オーバーロードされたオペレータを呼び出す
     198                    i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
     199                    if(i2==0){
     200                        if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
     201                        else GetCalcName(idCalc,temp2);
     202                        sprintf(temporary,"Operator %s",temp2);
     203                        SetError(27,temporary,cp);
     204                        goto error;
     205                    }
     206                    else if(i2==-1) goto error;
     207
     208                    continue;
     209                }
    201210            }
    202211
     
    208217            case 0:
    209218                index_stack[sp]=-1;
     219                isNothing_stack[sp] = false;
    210220                bUseHeap[sp]=0;
    211221
     
    424434                    // Nothing
    425435                    if( lstrcmp( term, "Nothing" ) == 0 ){
     436                        isNothing_stack[sp] = true;
     437
    426438                        type_stack[sp] = DEF_OBJECT;
    427439                        if( baseType.IsObject() ){
     
    554566                    // 型名の場合
    555567                    //////////////
    556 
    557                     LONG_PTR lp;
    558                     i3=GetTypeFixed(term,&lp);
    559                     if(i3!=-1){
    560                         type_stack[sp]=i3|FLAG_CAST;
    561                         index_stack[sp]=lp;
     568                    Type tempType;
     569                    if( Type::StringToType( term, tempType ) ){
     570                        type_stack[sp] = tempType.GetBasicType() | FLAG_CAST;
     571                        index_stack[sp] = tempType.GetIndex();
    562572                        sp++;
    563573                        break;
    564574                    }
    565 
    566575
    567576
  • BasicCompiler64/Opcode.h

    r78 r79  
    323323#define DIMFLAG_STATIC                  0x04
    324324#define DIMFLAG_CONST                   0x08
    325 void dim(bool isRef, char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
     325void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
    326326void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar);
    327327
  • BasicCompiler_Common/Class.cpp

    r76 r79  
    106106            sprintf(temporary,"%s.%s",pobj_c->name,member->name);
    107107            dim(
    108                 false,
    109108                temporary,
    110109                member->SubScripts,
  • BasicCompiler_Common/DebugMiddleFile.cpp

    r78 r79  
    138138    // TypeDef情報
    139139    //////////////////
    140     *(long *)(buffer+i2)=House::typeDefs.size();
     140    *(long *)(buffer+i2)=(int)House::typeDefs.size();
    141141    i2+=sizeof(long);
    142142    for(i3=0;i3<(int)House::typeDefs.size();i3++){
  • BasicCompiler_Common/Intermediate_Step1.cpp

    r67 r79  
    328328
    329329    extern BOOL bStrict;
    330     bStrict=0;
     330    bStrict=1;
    331331
    332332    for(i=0;;i++){
     
    351351            else if(lstrcmpi(temporary,"strict")==0){
    352352                //#strict
     353                //旧機能なので、無視
    353354                for(;;i2++){
    354355                    if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break;
    355356                }
    356357                SlideString(basbuf+i2,i-i2);
    357 
    358                 //型チェックを厳密に行う
    359                 bStrict=1;
    360358            }
    361359            else if(lstrcmpi(temporary,"struct")==0){
  • BasicCompiler_Common/NumOpe_GetType.cpp

    r75 r79  
    340340    int type_stack[255];
    341341    LONG_PTR index_stack[255];
     342    bool isNothing_stack[255];
    342343    _int64 i64data;
    343344    int idCalc;
     
    347348        if(idCalc){
    348349            if(type_stack[sp-2]==DEF_OBJECT){
    349                 //オーバーロードされたオペレータを呼び出す
    350                 if(!GetReturnType_OperatorProc(idCalc,baseType,type_stack,index_stack,sp)){
    351                     goto error;
     350                if( idCalc == CALC_AS
     351                    && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST )
     352                    && index_stack[sp-1] == index_stack[sp-2]
     353                    || isNothing_stack[sp-2] ){
     354                        // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない
    352355                }
    353 
    354                 continue;
     356                else{
     357                    //オーバーロードされたオペレータを呼び出す
     358                    if(!GetReturnType_OperatorProc(idCalc,baseType,type_stack,index_stack,sp)){
     359                        goto error;
     360                    }
     361
     362                    continue;
     363                }
    355364            }
    356365
     
    362371            case 0:
    363372                index_stack[sp]=-1;
     373                isNothing_stack[sp] = false;
    364374
    365375                char *term;
     
    490500                    // Nothing
    491501                    if( lstrcmp( term, "Nothing" ) == 0 ){
     502                        isNothing_stack[sp] = true;
     503
    492504                        type_stack[sp] = DEF_OBJECT;
    493505                        if( baseType.IsObject() ){
     
    558570                    //////////////
    559571
    560                     LONG_PTR lp;
    561                     i3=GetTypeFixed(term,&lp);
    562                     if(i3!=-1){
    563                         type_stack[sp]=i3|FLAG_CAST;
    564                         index_stack[sp]=lp;
     572                    Type tempType;
     573                    if( Type::StringToType( term, tempType ) ){
     574                        type_stack[sp] = tempType.GetBasicType() | FLAG_CAST;
     575                        index_stack[sp] = tempType.GetIndex();
    565576                        sp++;
    566577                        break;
    567578                    }
    568 
    569579
    570580
  • BasicCompiler_Common/Procedure.cpp

    r78 r79  
    120120            Type::StringToType( temporary, type );
    121121
    122             /*
    123             TODO: 消す(TypeDef関連の変更)
    124             if(temporary[0]=='*'&&
    125                 temporary[1]==1&&
    126                 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
    127                 if(sourceOfParams[i]!='('){
    128                     SetError(10,temporary,nowLine);
    129                     break;
    130                 }
    131                 i3=GetStringInPare(temporary+i2,sourceOfParams+i);
    132                 i+=i3;
    133                 i2+=i3;
    134 
    135                 if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
    136                     temporary[i2++]=sourceOfParams[i++];
    137                     temporary[i2++]=sourceOfParams[i++];
    138                     for(;;i++,i2++){
    139                         if(!IsVariableChar(sourceOfParams[i])){
    140                             temporary[i2]=0;
    141                             break;
    142                         }
    143                         temporary[i2]=sourceOfParams[i];
    144                     }
    145                 }
    146             }
    147             else{
    148                 //TypeDefをする前のベース型を取得
    149                 GetOriginalTypeName_Old(temporary);
    150             }*/
    151 
    152122            if( type.IsNull() ){
    153123                SetError(3,temporary,nowLine);
     
    159129            SetError(-103,temporary,nowLine);
    160130        }
    161 
    162         /*
    163         TODO: 消す(TypeDef関連の変更)
    164         if( type.IsProcPtr() ){
    165             //関数ポインタの場合
    166             type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine) );
    167         }*/
    168131
    169132        Parameter *pParam = new Parameter( name, type, isRef, initValue );
     
    278241                Type::StringToType( temporary, type );
    279242
    280                 /*
    281                 TODO: 消す(TypeDef関連の変更)
    282                 if(temporary[0]=='*'&&
    283                     temporary[1]==1&&
    284                     (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
    285                     if(sourceOfParams[i]!='('){
    286                         SetError(10,temporary,nowLine);
    287                         break;
    288                     }
    289                     i3=GetStringInPare(temporary+i2,sourceOfParams+i);
    290                     i+=i3;
    291                     i2+=i3;
    292 
    293                     if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
    294                         temporary[i2++]=sourceOfParams[i++];
    295                         temporary[i2++]=sourceOfParams[i++];
    296                         for(;;i++,i2++){
    297                             if(!IsVariableChar(sourceOfParams[i])){
    298                                 temporary[i2]=0;
    299                                 break;
    300                             }
    301                             temporary[i2]=sourceOfParams[i];
    302                         }
    303                     }
    304                 }
    305                 else{
    306                     //TypeDefをする前のベース型を取得
    307                     GetOriginalTypeName_Old(temporary);
    308                 }*/
    309 
    310243                if( type.IsNull() ){
    311244                    SetError(3,temporary,nowLine);
     
    317250                SetError(-103,temporary,nowLine);
    318251            }
    319 
    320             /*
    321             TODO: 消す(TypeDef関連の変更)
    322             if( type.IsProcPtr() ){
    323                 //関数ポインタの場合
    324                 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine) );
    325             }*/
    326252
    327253            Parameter *pParam = new Parameter( name, type, isRef );
     
    535461            Type::StringToType( temporary, type );
    536462
    537             /*
    538             TODO: 消す(TypeDef関連の変更)
    539             if(temporary[0]=='*'&&
    540                 temporary[1]==1&&
    541                 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
    542                 if(sourceOfParams[i]!='('){
    543                     SetError(10,temporary,nowLine);
    544                     break;
    545                 }
    546                 i3=GetStringInPare(temporary+i2,sourceOfParams+i);
    547                 i+=i3;
    548                 i2+=i3;
    549 
    550                 if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
    551                     temporary[i2++]=sourceOfParams[i++];
    552                     temporary[i2++]=sourceOfParams[i++];
    553                     for(;;i++,i2++){
    554                         if(!IsVariableChar(sourceOfParams[i])){
    555                             temporary[i2]=0;
    556                             break;
    557                         }
    558                         temporary[i2]=sourceOfParams[i];
    559                     }
    560                 }
    561             }
    562             else{
    563                 //TypeDefをする前のベース型を取得
    564                 GetOriginalTypeName_Old(temporary);
    565             }*/
    566 
    567463            if( type.IsNull() ){
    568464                SetError(3,temporary,nowLine);
     
    574470            SetError(-103,temporary,nowLine);
    575471        }
    576 
    577         /*
    578         TODO: 消す(TypeDef関連の変更)
    579         if( type.IsProcPtr() ){
    580             //関数ポインタの場合
    581             type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine ) );
    582         }*/
    583472
    584473        Parameter *pParam = new Parameter( name, type, isRef );
     
    743632            Type::StringToType( temporary, type );
    744633
    745             /*
    746             TODO: 消す(TypeDef関連の変更)
    747             if(temporary[0]=='*'&&
    748                 temporary[1]==1&&
    749                 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
    750                 if(sourceOfParams[i]!='('){
    751                     SetError(10,temporary,nowLine);
    752                     break;
    753                 }
    754                 i3=GetStringInPare(temporary+i2,sourceOfParams+i);
    755                 i+=i3;
    756                 i2+=i3;
    757 
    758                 if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
    759                     temporary[i2++]=sourceOfParams[i++];
    760                     temporary[i2++]=sourceOfParams[i++];
    761                     for(;;i++,i2++){
    762                         if(!IsVariableChar(sourceOfParams[i])){
    763                             temporary[i2]=0;
    764                             break;
    765                         }
    766                         temporary[i2]=sourceOfParams[i];
    767                     }
    768                 }
    769             }
    770             else{
    771                 //TypeDefをする前のベース型を取得
    772                 GetOriginalTypeName_Old(temporary);
    773             }*/
    774 
    775634            if( type.IsNull() ){
    776635                SetError(3,temporary,nowLine);
     
    782641            SetError(-103,temporary,nowLine);
    783642        }
    784 
    785         /*
    786         TODO: 消す(TypeDef関連の変更)
    787         if( type.IsProcPtr() ){
    788             //関数ポインタの場合
    789             type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine ) );
    790         }*/
    791643
    792644        Parameter *pParam = new Parameter( name, type, isRef );
  • BasicCompiler_Common/Subroutine.cpp

    r78 r79  
    783783    House::procPointers.push_back( pProcPointer );
    784784
    785     return House::procPointers.size()-1;
     785    return (int)House::procPointers.size()-1;
    786786}
    787787void DeleteProcPtrInfo(void){
  • BasicCompiler_Common/Type.h

    r77 r79  
    44
    55class Type{
    6     static const int basicTypeList[];
    7     static const string basicTypeNameList[];
    8 
    9 
    106    int basicType;
    117    union{
     
    1511
    1612public:
    17 
    18     static bool StringToBasicType( const string &typeName, int &basicType );
    19     static bool StringToType( const string &typeName, Type &type );
    2013    static int GetBasicSize( int basicType );
    2114
     
    124117
    125118    static Type String();
     119
     120
     121private:
     122    static const int basicTypeList[];
     123    static const string basicTypeNameList[];
     124public:
     125    static bool StringToBasicType( const string &typeName, int &basicType );
     126    static bool StringToType( const string &typeName, Type &type );
    126127};
  • BasicCompiler_Common/TypeDef.cpp

    r78 r79  
    5252}
    5353int TypeDefCollection::GetIndex( const string &typeName ) const{
    54     int max = (*this).size();
     54    int max = (int)(*this).size();
    5555    for( int i=0; i<max; i++ ){
    5656        if( (*this)[i].newName == typeName ){
  • BasicCompiler_Common/VariableOpe.cpp

    r78 r79  
    179179    return MAKE_PTR_TYPE(NATURAL_TYPE(type),PTR_LEVEL(type)+1);
    180180}
    181 int GetTypeFixed(const char *TypeName,LONG_PTR *lpNum){
    182     int type;
    183 
    184     if(lpNum) *lpNum=-1;
    185 
    186     if(TypeName[0]=='*'){
    187         if(TypeName[1]==1&&(TypeName[2]==ESC_FUNCTION||TypeName[2]==ESC_SUB)){
    188             //関数ポインタ(*Function)
    189             return DEF_PTR_PROC;
    190         }
    191 
    192         type=GetTypeFixed(TypeName+1,lpNum);
    193         if(type==-1) return -1;
    194 
    195         return GetPtrType(type);
    196     }
    197 
    198     //整数型
    199     if(lstrcmpi(TypeName,"SByte")==0)           return DEF_SBYTE;
    200     else if(lstrcmpi(TypeName,"Byte")==0)       return DEF_BYTE;
    201     else if(lstrcmpi(TypeName,"Integer")==0)    return DEF_INTEGER;
    202     else if(lstrcmpi(TypeName,"WORD")==0)       return DEF_WORD;
    203     else if(lstrcmpi(TypeName,"Long")==0)       return DEF_LONG;
    204     else if(lstrcmpi(TypeName,"DWORD")==0)      return DEF_DWORD;
    205     else if(lstrcmpi(TypeName,"Int64")==0)      return DEF_INT64;
    206     else if(lstrcmpi(TypeName,"QWORD")==0)      return DEF_QWORD;
    207 
    208     //実数型
    209     else if(lstrcmpi(TypeName,"Single")==0)     return DEF_SINGLE;
    210     else if(lstrcmpi(TypeName,"Double")==0)     return DEF_DOUBLE;
    211 
    212     //文字型
    213     //else if( lstrcmpi( TypeName, "Char" ) == 0 ) return DEF_CHAR;
    214 
    215     //bool型
    216     else if( lstrcmpi( TypeName, "Boolean" ) == 0 ) return DEF_BOOLEAN;
    217 
    218     //ポインタ型
    219     //※VoidPtr型以外のポインタ型はTypeDef宣言により定義される
    220     else if(lstrcmpi(TypeName,"VoidPtr")==0)    return DEF_PTR_VOID;
    221 
    222     //その他
    223     else if(lstrcmpi(TypeName,"Any")==0)        return DEF_ANY;
    224 
    225 
    226     ////////////////////
    227     // TypeDefされた型
    228     ////////////////////
    229     int i;
    230     i=House::typeDefs.GetIndex(TypeName);
    231     if(i!=-1){
    232         *lpNum = House::typeDefs[i].GetBaseType().GetIndex();
    233         return House::typeDefs[i].GetBaseType().GetBasicType();
    234     }
    235 
    236     if(!lpNum) return -1;
    237 
    238     //クラス
    239     CClass *pobj_c;
    240     pobj_c=pobj_DBClass->check(TypeName);
    241     if(pobj_c){
    242         *lpNum=(LONG_PTR)pobj_c;
    243 
    244         if( pobj_c->IsStructure() ){
    245             return DEF_STRUCT;
    246         }
    247         else{
    248             return DEF_OBJECT;
    249         }
    250     }
    251 
    252     return -1;
    253 }
    254 /*
    255 TODO: 消す(TypeDef関連の変更)
    256 void GetOriginalTypeName_Old(char *buffer){
    257     // TypeDefされた型に対して、オリジナルの型の名前に変更する
    258 
    259     if(buffer[0]=='*'){
    260         if(buffer[1]==1&&(buffer[2]==ESC_FUNCTION||buffer[2]==ESC_SUB)) return;
    261 
    262         GetOriginalTypeName_Old(buffer+1);
    263         return;
    264     }
    265 
    266     int i;
    267     i=House::typeDefs.GetIndex(buffer);
    268     if(i!=-1){
    269         lstrcpy(buffer,House::typeDefs[i].GetBaseName().c_str());
    270         GetOriginalTypeName_Old(buffer);
    271     }
    272 }*/
    273181BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name){
    274182    if(PTR_LEVEL(type)){
     
    948856        // 初期化データが指定されいるとき
    949857        ////////////////////////////////////
    950 
    951         for(i++,i2=0,IsStr=0;;i++,i2++){
    952             if(buffer[i]=='\"') IsStr^=1;
    953             if(buffer[i]=='('&&IsStr==0){
    954                 i3=GetStringInPare(InitBuf+i2,buffer+i);
    955                 i+=i3-1;
    956                 i2+=i3-1;
    957                 continue;
    958             }
    959             if(buffer[i]=='['&&IsStr==0){
    960                 i3=GetStringInBracket(InitBuf+i2,buffer+i);
    961                 i+=i3-1;
    962                 i2+=i3-1;
    963                 continue;
    964             }
    965             if((buffer[i]==1&&buffer[i+1]==ESC_AS)||
    966                 (buffer[i]==','&&IsStr==0)||
    967                 buffer[i]=='\0'){
    968                 InitBuf[i2]=0;
    969                 break;
    970             }
    971             InitBuf[i2]=buffer[i];
     858        i++;
     859
     860        if( buffer[i]=='[' ){
     861            // 構造初期データの場合
     862
     863            i3=GetStringInBracket(InitBuf,buffer+i);
     864            i+=i3;
     865        }
     866        else{
     867            // 代入初期データの場合
     868
     869            for(i2=0,IsStr=0;;i++,i2++){
     870                if(buffer[i]=='\"') IsStr^=1;
     871                if(buffer[i]=='('&&IsStr==0){
     872                    i3=GetStringInPare(InitBuf+i2,buffer+i);
     873                    i+=i3-1;
     874                    i2+=i3-1;
     875                    continue;
     876                }
     877                if(buffer[i]=='['&&IsStr==0){
     878                    i3=GetStringInBracket(InitBuf+i2,buffer+i);
     879                    i+=i3-1;
     880                    i2+=i3-1;
     881                    continue;
     882                }
     883                if((buffer[i]==','&&IsStr==0)||
     884                    buffer[i]=='\0'){
     885                    InitBuf[i2]=0;
     886                    break;
     887                }
     888                InitBuf[i2]=buffer[i];
     889            }
    972890        }
    973891    }
     
    1052970                return false;
    1053971            }
     972
     973            if( IS_LITERAL( type.GetIndex() ) ){
     974                type.SetIndex( -1 );
     975            }
    1054976        }
    1055977
     
    10991021
    11001022
    1101 void AddGlobalVariable(bool isRef, const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag){
     1023void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag){
    11021024    /////////////////////////
    11031025    // グローバル変数を追加
     
    11141036    bool isConst = ( dwFlag & DIMFLAG_CONST ) ? true:false;
    11151037
    1116     Variable *pVar = new Variable( name, type, isConst, isRef );
     1038    Variable *pVar = new Variable( name, type, isConst );
    11171039
    11181040    if( SubScripts[0] != -1 ){
     
    12171139    char VarName[VN_SIZE];
    12181140
    1219     //参照型かどうか
    1220     bool isRef = false;
    1221 
    12221141    i2 = 0;
    12231142
    12241143    if( Parameter[i2] == 1 && Parameter[i2+1] == ESC_BYREF ){
    12251144        //参照型
    1226         isRef = true;
     1145        SetError();
    12271146        Parameter += 2;
    12281147    }
     
    12901209        GetNowStaticVarFullName(VarName,temporary);
    12911210
    1292         dim( isRef,temporary,SubScripts,type,InitBuf,ConstractParameter,dwFlags );
     1211        dim( temporary,SubScripts,type,InitBuf,ConstractParameter,dwFlags );
    12931212
    12941213        /*
     
    12981217    }
    12991218    else{
    1300         dim( isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags );
     1219        dim( VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags );
    13011220    }
    13021221}
  • BasicCompiler_Common/VariableOpe.h

    r78 r79  
    1313int GetTypeSize(int type,LONG_PTR lpIndex);
    1414int GetPtrType(int type);
    15 int GetTypeFixed(const char *TypeName,LONG_PTR *lpNum);
    16 /*
    17 TODO: 消す(TypeDef関連の変更)
    18 void GetOriginalTypeName_Old(char *buffer);
    19 void GetOriginalTypeName(char *buffer);
    20 */
    2115BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name);
    2216bool FormatUseProcReturnObject( const char *term, char *procName, char *parameter, CClass::RefType &refType, char *member );
     
    3731                        char *ConstractParameter );
    3832BOOL GetNowStaticVarFullName(char *VarName,char *FullName);
    39 void AddGlobalVariable(bool isRef, const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag);
     33void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag);
    4034void dim(char *Parameter,DWORD dwFlags);
    4135void OpcodeDim(char *Parameter,DWORD dwFlags);
  • BasicCompiler_Common/calculation.cpp

    r78 r79  
    483483                        type[pnum]=DEF_LONG;
    484484
    485                         LONG_PTR lpIndex;
    486                         i3=GetTypeFixed(temp2,&lpIndex);
    487                         if(i3==-1){
    488                             extern int cp;
     485                        Type tempType;
     486                        if( !Type::StringToType( temp2, tempType ) ){
    489487                            if(enableerror) SetError(3,temp2,cp);
    490488                            return false;
    491489                        }
    492                         i64nums[pnum]=GetTypeSize(i3,lpIndex);
     490                        i64nums[pnum] = tempType.GetSize();
    493491                        StrPtr[pnum]=0;
    494492                    }
     
    688686                        //////////////
    689687
    690                         type[pnum]=GetTypeFixed(Parms,&before_index[pnum]);
    691 
    692                         if(type[pnum]==-1){
    693                             if(bDebuggingWatchList){
    694                                 if( pIsMemoryAccessError ) *pIsMemoryAccessError = true;
     688                        {
     689                            Type tempType;
     690                            if( !Type::StringToType( Parms, tempType ) ){
     691                                if(bDebuggingWatchList){
     692                                    if( pIsMemoryAccessError ) *pIsMemoryAccessError = true;
     693                                    return false;
     694                                }
     695                                //エラー
     696                                if(enableerror) SetError(3,Parms,cp);
    695697                                return false;
    696698                            }
    697                             //エラー
    698                             if(enableerror) SetError(3,Parms,cp);
    699                             return false;
     699
     700                            type[pnum] = tempType.GetBasicType();
     701                            before_index[pnum] = tempType.GetIndex();
    700702                        }
     703
    701704JumpConst:;
    702705                    }
  • BasicCompiler_Common/common.h

    r78 r79  
    4747
    4848#ifdef _AMD64_
    49 #define VER_INFO        "β16 (x64)"
     49#define VER_INFO        "β17 (x64)"
    5050#else
    51 #define VER_INFO        "β16"
     51#define VER_INFO        "β17"
    5252#endif
    5353
  • ProjectEditor/Common.h

    r70 r79  
    5959#define APPLICATION_NAME "ActiveBasic 5.0"
    6060#define VERSION_APPLI_NAME APPLICATION_NAME
    61 #define VERSION_STRING "5.00.00 β16"
     61#define VERSION_STRING "5.00.00 β17"
    6262
    6363#endif
Note: See TracChangeset for help on using the changeset viewer.