Changeset 69 in dev


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

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

Files:
15 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_Var.cpp

    r67 r69  
    857857        *(_int64 *)(initGlobalBuf+offset)=i64data;
    858858    else if(type==DEF_LONG||type==DEF_DWORD||IsPtrType(type)){
    859         if(type==DEF_PTR_CHAR&&lpCalcIndex==LITERAL_STRING){
     859        if(type==typeOfPtrChar&&lpCalcIndex==LITERAL_STRING){
    860860            //文字列定数のとき
    861861
     
    10471047    }
    10481048    else if(type==DEF_LONG||type==DEF_DWORD||IsPtrType(type)){
    1049         if(type==DEF_PTR_CHAR&&lpCalcIndex==LITERAL_STRING){
     1049        if(type==typeOfPtrChar&&lpCalcIndex==LITERAL_STRING){
    10501050            //文字列定数のとき
    10511051
  • BasicCompiler32/NumOpe.cpp

    r68 r69  
    205205                            type[sp]=DEF_OBJECT;
    206206                            index_stack[sp]=(LONG_PTR)pobj_StringClass;
    207                             bUseHeap[sp]=1;
    208207                            bLiteralCalculation=0;
    209208
     
    214213
    215214
    216                     type[sp]=DEF_PTR_CHAR;
     215                    type[sp]=typeOfPtrChar;
    217216                    index_stack[sp]=LITERAL_STRING;
    218217                    bLiteralCalculation=0;
  • BasicCompiler32/VarList.cpp

    r64 r69  
    4747    }
    4848    else{
    49         if(type==DEF_PTR_CHAR||type==MAKE_PTR_TYPE(DEF_BYTE,1)){
     49        if(type==MAKE_PTR_TYPE(DEF_SBYTE,1)||type==MAKE_PTR_TYPE(DEF_BYTE,1)){
    5050            if(ReadProcessMemory(hDebugProcess,(void *)offset,&dwData,sizeof(DWORD),&dwAccessByte)){
    5151                for(i2=0;;i2++){
  • BasicCompiler64/Compile_Var.cpp

    r65 r69  
    899899            *(float *)(initGlobalBuf+offset)=(float)dbl;
    900900    else if(type==DEF_INT64||type==DEF_QWORD||IsPtrType(type)){
    901         if(type==DEF_PTR_CHAR&&lpCalcIndex==LITERAL_STRING){
     901        if(type==typeOfPtrChar&&lpCalcIndex==LITERAL_STRING){
    902902            //文字列定数のとき
    903903
     
    10481048    }
    10491049    else if(type==DEF_INT64||type==DEF_QWORD||IsPtrType(type)){
    1050         if(type==DEF_PTR_CHAR&&lpCalcIndex==LITERAL_STRING){
     1050        if(type==typeOfPtrChar&&lpCalcIndex==LITERAL_STRING){
    10511051            //文字列定数のとき
    10521052
  • BasicCompiler64/NumOpe.cpp

    r68 r69  
    1414    //////////////////////////////////////////////////////
    1515
    16         char *parameter = (char *)malloc( lstrlen( lpszText ) + 3 );
    17         lstrcpy( parameter, lpszText );
     16        char *parameter = (char *)malloc( lstrlen( lpszText ) + 32 );
     17        sprintf( parameter, "\"%s\"%c%c*Char", lpszText, 1, ESC_AS );
    1818        SetStringQuotes( parameter );
    1919
     
    222222                            type[sp]=DEF_OBJECT;
    223223                            index_stack[sp]=(LONG_PTR)pobj_StringClass;
    224                             bUseHeap[sp]=1;
    225224                            bLiteralCalculation=0;
    226225
     
    233232                    }
    234233
    235                     type[sp]=DEF_PTR_CHAR;
     234                    type[sp]=typeOfPtrChar;
    236235                    bLiteralCalculation=0;
    237236
  • BasicCompiler64/varlist.cpp

    r64 r69  
    4949    }
    5050    else{
    51         if(type==DEF_PTR_CHAR||type==MAKE_PTR_TYPE(DEF_BYTE,1)){
     51        if(type==MAKE_PTR_TYPE(DEF_SBYTE,1)||type==MAKE_PTR_TYPE(DEF_BYTE,1)){
    5252            if(ReadProcessMemory(hDebugProcess,(void *)offset,&pData,sizeof(void *),&stAccBytes)){
    5353                for(i2=0;;i2++){
  • 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);
  • ProjectEditor/SubOperation.cpp

    r58 r69  
    419419    else if(str[0]=='b'||str[0]=='B'){
    420420        if(lstrcmpi(str,"Beep")==0) return COM_BEEP;
    421         if(lstrcmpi(str,"Boolean")==0) return -1;
     421        if(lstrcmp(str,"Boolean")==0) return -1;
    422422        if(lstrcmpi(str,"ByRef")==0) return -1;
    423423        if(lstrcmpi(str,"ByVal")==0) return -1;
    424         if(lstrcmpi(str,"Byte")==0) return -1;
     424        if(lstrcmp(str,"Byte")==0) return -1;
    425425    }
    426426    else if(str[0]=='c'||str[0]=='C'){
    427427        if(lstrcmpi(str,"Case")==0) return -1;
    428         if(lstrcmpi(str,"Char")==0) return -1;
     428        if(lstrcmp(str,"Char")==0) return -1;
    429429        if(lstrcmpi(str,"ChDir")==0) return COM_CHDIR;
    430430        if(lstrcmpi(str,"Circle")==0) return COM_CIRCLE;
     
    444444        if(lstrcmpi(str,"Dim")==0) return COM_DIM;
    445445        if(lstrcmpi(str,"Do")==0) return COM_DO;
    446         if(lstrcmpi(str,"Double")==0) return -1;
    447         if(lstrcmpi(str,"DWord")==0) return -1;
     446        if(lstrcmp(str,"Double")==0) return -1;
     447        if(lstrcmp(str,"DWord")==0) return -1;
    448448    }
    449449    else if(str[0]=='e'||str[0]=='E'){
     
    480480        if(lstrcmpi(str,"Inherits")==0) return COM_INHERITS;
    481481        if(lstrcmpi(str,"Input")==0) return COM_INPUT;
    482         if(lstrcmpi(str,"Int64")==0) return -1;
    483         if(lstrcmpi(str,"Integer")==0) return -1;
     482        if(lstrcmp(str,"Int64")==0) return -1;
     483        if(lstrcmp(str,"Integer")==0) return -1;
    484484        if(lstrcmpi(str,"Interface")==0) return COM_INTERFACE;
    485485    }
     
    491491        if(lstrcmpi(str,"Line")==0) return COM_LINE;
    492492        if(lstrcmpi(str,"Locate")==0) return COM_LOCATE;
    493         if(lstrcmpi(str,"Long")==0) return -1;
     493        if(lstrcmp(str,"Long")==0) return -1;
    494494        if(lstrcmpi(str,"Loop")==0) return COM_LOOP;
    495495    }
     
    501501        if(lstrcmpi(str,"Next")==0) return COM_NEXT;
    502502        if(lstrcmpi(str,"New")==0) return -1;
     503        if(lstrcmpi(str,"Nothing")==0) return -1;
    503504    }
    504505    else if(str[0]=='o'||str[0]=='O'){
     
    517518    }
    518519    else if(str[0]=='q'||str[0]=='Q'){
    519         if(lstrcmpi(str,"QWord")==0) return -1;
     520        if(lstrcmp(str,"QWord")==0) return -1;
    520521    }
    521522    else if(str[0]=='r'||str[0]=='R'){
     
    525526    }
    526527    else if(str[0]=='s'||str[0]=='S'){
    527         if(lstrcmpi(str,"SByte")==0) return -1;
     528        if(lstrcmp(str,"SByte")==0) return -1;
    528529        if(lstrcmpi(str,"Select")==0) return COM_SELECT;
    529530        if(lstrcmpi(str,"SelectCase")==0) return COM_SELECT;
    530         if(lstrcmpi(str,"Single")==0) return -1;
     531        if(lstrcmp(str,"Single")==0) return -1;
    531532        if(lstrcmpi(str,"Sleep")==0) return COM_SLEEP;
    532533        if(lstrcmpi(str,"Static")==0) return -1;
     
    551552        if(lstrcmpi(str,"Window")==0) return COM_WINDOW;
    552553        if(lstrcmpi(str,"With")==0) return COM_WITH;
    553         if(lstrcmpi(str,"Word")==0) return -1;
     554        if(lstrcmp(str,"Word")==0) return -1;
    554555        if(lstrcmpi(str,"Write")==0) return COM_WRITE;
    555556    }
Note: See TracChangeset for help on using the changeset viewer.