Changeset 69 in dev for BasicCompiler_Common


Ignore:
Timestamp:
Mar 13, 2007, 4:52:59 AM (17 years ago)
Author:
dai_9181
Message:

一時文字列をNewしたときに、bUseHeapフラグを立たせないようにした(bUseHeapが立つのは一時構造体のときのみ)。
DEF_PTR_CHARを廃止し、typeOfPtrCharを導入。

Location:
BasicCompiler_Common
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/BasicCompiler.cpp

    r55 r69  
    692692
    693693        //Unicode
    694         else if( lstrcmp( temp2, "unicode" ) ==0 ) isUnicode = true;
     694        else if( lstrcmp( temp2, "unicode" ) ==0 ){
     695            isUnicode = true;
     696            typeOfPtrChar = MAKE_PTR_TYPE(DEF_WORD,1);
     697        }
    695698
    696699        //埋め込み型コンパイラビュー
  • BasicCompiler_Common/BasicCompiler.h

    r55 r69  
    8383BOOL bDll;
    8484bool isUnicode = false;
     85int typeOfPtrChar = MAKE_PTR_TYPE(DEF_SBYTE,1);
    8586
    8687char *basbuf;
  • BasicCompiler_Common/BasicFixed.h

    r64 r69  
    6363#define PTR_LEVEL_DOWN(t)   t = MAKE_PTR_TYPE(NATURAL_TYPE(t),PTR_LEVEL(t)-1)
    6464
    65 #define DEF_PTR_CHAR    MAKE_PTR_TYPE(DEF_CHAR,1)
    6665#define DEF_PTR_OBJECT  MAKE_PTR_TYPE(DEF_OBJECT,1)
    6766#define DEF_PTR_STRUCT  MAKE_PTR_TYPE(DEF_STRUCT,1)
  • BasicCompiler_Common/NumOpe_GetType.cpp

    r68 r69  
    389389                    }
    390390
    391                     type[sp]=DEF_PTR_CHAR;
     391                    type[sp]=typeOfPtrChar;
    392392                    bLiteralCalculation=0;
    393393                }
  • BasicCompiler_Common/Subroutine.cpp

    r64 r69  
    460460    _int64 i64data;
    461461    type = StaticCalculation( true, temporary, 0, &i64data, &lpIndex );
    462     if( type != DEF_PTR_CHAR ){
     462    if( type != typeOfPtrChar ){
    463463        SetError(1,NULL,NowLine);
    464464        return;
     
    483483    if( temporary[0] ){
    484484        type = StaticCalculation( true, temporary, 0, &i64data, &lpIndex );
    485         if( type != DEF_PTR_CHAR ){
     485        if( type != typeOfPtrChar ){
    486486            SetError(1,NULL,NowLine);
    487487            return;
  • BasicCompiler_Common/calculation.cpp

    r64 r69  
    524524                        StrPtr[pnum][i2]=0;
    525525
    526                         type[pnum]=DEF_PTR_CHAR;
     526                        type[pnum]=typeOfPtrChar;
    527527                        before_index[pnum]=LITERAL_STRING;
    528528                    }
     
    538538                        StrPtr[pnum][i2]=0;
    539539
    540                         type[pnum]=DEF_PTR_CHAR;
     540                        type[pnum]=typeOfPtrChar;
    541541                        before_index[pnum]=LITERAL_STRING;
    542542                    }
  • BasicCompiler_Common/common.h

    r66 r69  
    8989extern int cp;
    9090extern bool isUnicode;
     91extern int typeOfPtrChar;
    9192
    9293
  • BasicCompiler_Common/preprocessor.cpp

    r68 r69  
    2626        free( ppFilePath );
    2727    }
    28     bool IsIncluded( const char *FilePath ){
    29         for( int i = 0; i < count; i++ ){
    30             if( lstrcmpi( ppFilePath[i], FilePath ) == 0 ){
     28    bool IsIncluded( const char *includeFilePath ){
     29        // '/' → '\\'
     30        char tempPath[MAX_PATH];
     31        lstrcpy( tempPath, includeFilePath );
     32        for( int i=0; tempPath[i]; i++ ){
     33            if( tempPath[i] == '/' ){
     34                tempPath[i] = '\\';
     35            }
     36        }
     37
     38        for( int i=0; i<count; i++ ){
     39            if( lstrcmpi( ppFilePath[i], tempPath ) == 0 ){
    3140                return true;
    3241            }
     
    3443        return false;
    3544    }
    36     void Add( const char *FilePath ){
     45    void Add( const char *includeFilePath ){
     46        // '/' → '\\'
     47        char tempPath[MAX_PATH];
     48        lstrcpy( tempPath, includeFilePath );
     49        for( int i=0; tempPath[i]; i++ ){
     50            if( tempPath[i] == '/' ){
     51                tempPath[i] = '\\';
     52            }
     53        }
     54
    3755        //既に読み込まれているとき
    38         if( IsIncluded( FilePath ) ) return;
     56        if( IsIncluded( tempPath ) ) return;
    3957
    4058        //追加
    4159        ppFilePath = (char **)realloc(ppFilePath, ( count + 1 ) * sizeof(char *) );
    42         ppFilePath[count] = (char *)malloc( lstrlen(FilePath) + 1 );
    43         lstrcpy( ppFilePath[count], FilePath );
     60        ppFilePath[count] = (char *)malloc( lstrlen(tempPath) + 1 );
     61        lstrcpy( ppFilePath[count], tempPath );
    4462        count++;
    4563    }
     
    84102    }
    85103
    86     // TODO: 削除
    87     add( "__STRING_IS_NOT_ALWAYS_UNICODE" );
    88 
    89104    char temporary[255];
    90105    sprintf(temporary,"_AB_VER%d",MAJOR_VER);
Note: See TracChangeset for help on using the changeset viewer.