Changeset 67 in dev


Ignore:
Timestamp:
Mar 11, 2007, 3:25:42 AM (17 years ago)
Author:
dai_9181
Message:

[32bit Compiler]op_push_value → op_push_V
Nothingに対応。

Files:
22 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/BasicCompiler.vcproj

    r56 r67  
    19271927            <File
    19281928                RelativePath="..\BasicCompiler_Common\BasicCompiler.h"
     1929                >
     1930            </File>
     1931            <File
     1932                RelativePath="..\BasicCompiler_Common\BasicFixed.h"
    19291933                >
    19301934            </File>
  • BasicCompiler32/CParameter.cpp

    r66 r67  
    135135
    136136    //push object_size
    137     op_push_value(object_size);
     137    op_push_V(object_size);
    138138
    139139    //call calloc
  • BasicCompiler32/Compile_Calc.cpp

    r66 r67  
    3131
    3232        //push 0
    33         op_push_value(0);
     33        op_push_V(0);
    3434
    3535        //push eax
     
    116116
    117117            //push 0
    118             op_push_value(0);
     118            op_push_V(0);
    119119
    120120            //push eax
     
    260260
    261261            //push 0
    262             op_push_value(0);
     262            op_push_V(0);
    263263
    264264            //push eax
  • BasicCompiler32/Compile_CallProc.cpp

    r64 r67  
    256256
    257257        //push object_size
    258         op_push_value(object_size);
     258        op_push_V(object_size);
    259259
    260260        //call calloc
  • BasicCompiler32/Compile_Set_Var.cpp

    r66 r67  
    610610
    611611        //push 0
    612         op_push_value(0);
     612        op_push_V(0);
    613613
    614614        //push eax
  • BasicCompiler32/Compile_Statement.cpp

    r64 r67  
    146146
    147147        //push 0
    148         op_push_value(0);
     148        op_push_V(0);
    149149
    150150        //fild dword ptr[esp]
     
    180180
    181181        //push 0
    182         op_push_value(0);
     182        op_push_V(0);
    183183
    184184        //fild dword ptr[esp]
     
    400400
    401401        //push 0
    402         op_push_value(0);
     402        op_push_V(0);
    403403
    404404        //fild dword ptr[esp]
     
    434434
    435435        //push 0
    436         op_push_value(0);
     436        op_push_V(0);
    437437
    438438        //fild dword ptr[esp]
     
    731731
    732732                //push 0
    733                 op_push_value(0);
     733                op_push_V(0);
    734734
    735735                //fild dword ptr[esp]
     
    772772
    773773                //push 0
    774                 op_push_value(0);
     774                op_push_V(0);
    775775
    776776                //fild dword ptr[esp]
  • BasicCompiler32/Compile_Var.cpp

    r65 r67  
    107107
    108108    //push 0
    109     op_push_value(0);
     109    op_push_V(0);
    110110
    111111    for(i=i3-1;i>=0;i--){
     
    11921192        else{
    11931193            //push 0
    1194             op_push_value(0);
     1194            op_push_V(0);
    11951195
    11961196            //push VarSize
    1197             op_push_value(VarSize);
     1197            op_push_V(VarSize);
    11981198
    11991199            //mov eax,ebp
  • BasicCompiler32/MakePeHdr.cpp

    r64 r67  
    155155    ProcPtrInfoNum=0;
    156156
    157     //クラス名を取得(詳細情報はGetObjectClassInfoで取得)
     157    //クラス名を取得(詳細情報はGetAllClassInfoで取得)
    158158    //   GetSubInfo関数の中で参照されるオブジェクト名を事前に取得する。
    159159    //     ※オブジェクトの内容までは取得しない
     
    169169
    170170    //クラス情報を取得(※注 - GetSubInfoの後に呼び出す)
    171     pobj_DBClass->GetObjectClassInfo();
     171    pobj_DBClass->GetAllClassInfo();
    172172
    173173    //コードと行番号の関係
  • BasicCompiler32/NumOpe.cpp

    r64 r67  
    359359
    360360
     361                    // Nothing
     362                    if( lstrcmp( term, "Nothing" ) == 0 ){
     363                        type[sp] = DEF_OBJECT;
     364                        if( BaseType == DEF_OBJECT ){
     365                            index_stack[sp] = lpBaseIndex;
     366                        }
     367                        else{
     368                            index_stack[sp] = (LONG_PTR)pobj_DBClass->GetObjectClass();
     369                        }
     370
     371                        bLiteralCalculation = 0;
     372
     373                        //push 0
     374                        op_push_V( 0 );
     375
     376                        sp++;
     377                        break;
     378                    }
     379
     380
    361381
    362382                    RELATIVE_VAR RelativeVar;
     
    521541
    522542                        //push HILONG(dbl)
    523                         op_push_value((long)*(long *)(((char *)(&i64data))+4));
     543                        op_push_V((long)*(long *)(((char *)(&i64data))+4));
    524544
    525545                        //push LOLONG(dbl)
    526                         op_push_value(*(long *)(&i64data));
     546                        op_push_V(*(long *)(&i64data));
    527547                    }
    528548                    else if(type[sp]==DEF_SINGLE){
     
    535555
    536556                        //push term
    537                         op_push_value(i3);
     557                        op_push_V(i3);
    538558                    }
    539559                    else{
     
    541561
    542562                        //push term
    543                         op_push_value((long)i64data);
     563                        op_push_V((long)i64data);
    544564
    545565                        if((long)i64data==0) index_stack[sp]=LITERAL_NULL;
     
    693713
    694714            //push HILONG(i64data)
    695             op_push_value((long)*(long *)(((char *)(&i64data))+4));
     715            op_push_V((long)*(long *)(((char *)(&i64data))+4));
    696716
    697717            //push LOLONG(i64data)
    698             op_push_value(*(long *)(&i64data));
     718            op_push_V(*(long *)(&i64data));
    699719        }
    700720        else if(i2==DEF_SINGLE){
     
    708728
    709729            //push flt
    710             op_push_value(i3);
     730            op_push_V(i3);
    711731        }
    712732        else{
     
    719739
    720740            //push term
    721             op_push_value(i3);
     741            op_push_V(i3);
    722742        }
    723743
  • BasicCompiler32/NumOpe_Arithmetic.cpp

    r66 r67  
    605605
    606606        //push 0
    607         op_push_value(0);
     607        op_push_V(0);
    608608
    609609        //push eax
     
    645645
    646646        //push 0
    647         op_push_value(0);
     647        op_push_V(0);
    648648
    649649        //push eax
     
    834834
    835835        //push -1
    836         op_push_value(-1);
     836        op_push_V(-1);
    837837
    838838        //fild dword ptr[esp]
     
    856856
    857857        //push -1
    858         op_push_value(-1);
     858        op_push_V(-1);
    859859
    860860        //fild dword ptr[esp]
  • BasicCompiler32/NumOpe_TypeOperation.cpp

    r66 r67  
    3232
    3333        //push 0
    34         op_push_value(0);
     34        op_push_V(0);
    3535
    3636        //push eax
  • BasicCompiler32/Opcode.h

    r66 r67  
    319319
    320320void op_push(int reg);
    321 void op_push_value(long data);
     321void op_push_V(long data);
    322322void op_pop(int reg);
    323323void op_add_esp(int num);
  • BasicCompiler32/OperatorProc.cpp

    r64 r67  
    125125
    126126        //push object_size
    127         op_push_value(object_size);
     127        op_push_V(object_size);
    128128
    129129        //call calloc
  • BasicCompiler32/op32_main.cpp

    r66 r67  
    519519    __op_format(0,(char)0x50,reg);
    520520}
    521 void op_push_value(long data){
     521void op_push_V(long data){
    522522    //スタックにリテラル値をプッシュ
    523523    if(-128<=data&&data<=127){
  • BasicCompiler64/MakePeHdr.cpp

    r64 r67  
    141141    ProcPtrInfoNum=0;
    142142
    143     //クラス名を取得(詳細情報はGetObjectClassInfoで取得)
     143    //クラス名を取得(詳細情報はGetAllClassInfoで取得)
    144144    //   GetSubInfo関数の中で参照されるオブジェクト名を事前に取得する。
    145145    //     ※オブジェクトの内容までは取得しない
     
    155155
    156156    //クラス情報を取得(※注 - GetSubInfoの後に呼び出す)
    157     pobj_DBClass->GetObjectClassInfo();
     157    pobj_DBClass->GetAllClassInfo();
    158158
    159159    //コードと行番号の関係
  • BasicCompiler64/NumOpe.cpp

    r64 r67  
    402402
    403403
     404                    // Nothing
     405                    if( lstrcmp( term, "Nothing" ) == 0 ){
     406                        type[sp] = DEF_OBJECT;
     407                        if( BaseType == DEF_OBJECT ){
     408                            index_stack[sp] = lpBaseIndex;
     409                        }
     410                        else{
     411                            index_stack[sp] = (LONG_PTR)pobj_DBClass->GetObjectClass();
     412                        }
     413
     414                        bLiteralCalculation = 0;
     415
     416                        //xor reg,reg
     417                        op_zero_reg( UseReg );
     418
     419                        if(UseReg==REG_R14){
     420                            //mov qword ptr[rsp+offset],r14     ※スタックフレームを利用
     421                            pobj_sf->push(REG_R14);
     422                        }
     423
     424                        pobj_reg->LockReg();
     425                        sp++;
     426                        break;
     427                    }
     428
     429
    404430                    RELATIVE_VAR RelativeVar;
    405431                    if(GetVarOffset(
  • BasicCompiler_Common/Class.cpp

    r64 r67  
    118118        pobj_c=pobj_DBClass->Iterator_GetNext();
    119119
     120        int i=0;
    120121        foreach( CMember *member, pobj_c->staticMembers ){
    121122            char temporary[VN_SIZE];
     
    137138                OpBuffer=(char *)HeapReAlloc(hHeap,0,OpBuffer,obp_AllocSize); //matea
    138139            }
     140            i++;
    139141        }
    140142    }
     
    671673}
    672674
    673 CDBClass::CDBClass(){
    674     memset(this,0,sizeof(CDBClass));
     675CDBClass::CDBClass():
     676    pStringClass( NULL ),
     677    pObjectClass( NULL ),
     678    pCompilingClass( NULL ),
     679    pCompilingMethod( NULL ),
     680    ppobj_IteClass( NULL ),
     681    iIteMaxNum( 0 ),
     682    iIteNextNum( 0 )
     683{
     684    memset( pobj_ClassHash, 0, MAX_CLASS_HASH * sizeof(CClass *) );
    675685}
    676686CDBClass::~CDBClass(){
     
    731741        //Stringクラス
    732742        pobj_StringClass=pobj_c;
     743    }
     744    if( lstrcmp( name, "Object" ) == 0 ){
     745        pObjectClass = pobj_c;
    733746    }
    734747
     
    14211434}
    14221435
    1423 void CDBClass::GetObjectClassInfo(void){
     1436void CDBClass::GetAllClassInfo(void){
    14241437    //ループ継承チェック用のクラス
    14251438    pobj_LoopRefCheck=new CLoopRefCheck();
     
    14301443    delete pobj_LoopRefCheck;
    14311444    pobj_LoopRefCheck=0;
     1445}
     1446
     1447CClass *CDBClass::GetStringClass() const
     1448{
     1449    if( !pStringClass ){
     1450        SetError();
     1451        return NULL;
     1452    }
     1453    return pStringClass;
     1454}
     1455CClass *CDBClass::GetObjectClass() const
     1456{
     1457    if( !pObjectClass ){
     1458        SetError();
     1459        return NULL;
     1460    }
     1461    return pObjectClass;
    14321462}
    14331463
  • BasicCompiler_Common/Class.h

    r64 r67  
    229229    void InitNames(void);
    230230    void GetClass_recur(const char *lpszInheritsClass);
    231     void GetObjectClassInfo(void);
     231    void GetAllClassInfo(void);
     232
     233
     234    /////////////////////////////
     235    // 特殊クラス
     236    /////////////////////////////
     237    CClass *pStringClass;
     238    CClass *pObjectClass;
     239    CClass *GetStringClass() const;
     240    CClass *GetObjectClass() const;
    232241
    233242
  • BasicCompiler_Common/Intermediate_Step1.cpp

    r64 r67  
    872872                case 'n':
    873873                case 'N':
    874                     if(lstrcmpi(temporary+i3,"Not")==0){
     874                    if(lstrcmpi(temporary+i3,"New")==0){
     875                        i2=i3;
     876                        temporary[i2++]=1;
     877                        temporary[i2]=ESC_NEW;
     878                    }
     879                    else if(lstrcmpi(temporary+i3,"Not")==0){
    875880                        i2=i3;
    876881                        temporary[i2++]=1;
    877882                        temporary[i2]=ESC_NOT;
    878                     }
    879                     else if(lstrcmpi(temporary+i3,"New")==0){
    880                         i2=i3;
    881                         temporary[i2++]=1;
    882                         temporary[i2]=ESC_NEW;
    883883                    }
    884884                    break;
  • BasicCompiler_Common/NumOpe_GetType.cpp

    r64 r67  
    492492
    493493
     494                    // Nothing
     495                    if( lstrcmp( term, "Nothing" ) == 0 ){
     496                        type[sp] = DEF_OBJECT;
     497                        if( pBaseType && pBaseType->type == DEF_OBJECT ){
     498                            index_stack[sp] = pBaseType->u.lpIndex;
     499                        }
     500                        else{
     501                            index_stack[sp] = (LONG_PTR)pobj_DBClass->GetObjectClass();
     502                        }
     503                        bLiteralCalculation = 0;
     504                        sp++;
     505                        break;
     506                    }
     507
     508
    494509                    i2=GetVarType(term,&index_stack[sp],0);
    495510                    if(i2!=-1){
  • BasicCompiler_Common/Variable.cpp

    r64 r67  
    10291029        if(pTypeInfo->type==-1){
    10301030            SetError(3,temporary,cp);
    1031             return 0;
     1031            pTypeInfo->type=DEF_LONG;
    10321032        }
    10331033
  • BasicCompiler_Common/preprocessor.cpp

    r55 r67  
    142142CDefine *pobj_define;
    143143
    144 int Search_endif(char *buffer,int i){
     144int Search_endif(char *buffer,int i, int *pLine = 0){
    145145    for(;;i++){
    146146        if(buffer[i]=='\0') break;
    147147
     148        if( buffer[i] == '\n' ){
     149            if( pLine ){
     150                (*pLine)++;
     151            }
     152        }
     153
    148154        if(buffer[i-1]=='\n'){
    149155            if(_memicmp(buffer+i,"#ifdef",6)==0||_memicmp(buffer+i,"#ifndef",7)==0){
    150                 i=Search_endif(buffer,i+6);
     156                i=Search_endif(buffer,i+6, pLine);
    151157                if(buffer[i]=='\0') break;
    152158                continue;
     
    229235                if(i2==0||buffer[i2-1]=='\n'){
    230236                    if(_memicmp(buffer+i2,"#ifdef",6)==0||_memicmp(buffer+i2,"#ifndef",7)==0){
    231                         i2=Search_endif(buffer,i2+6);
     237                        i2=Search_endif(buffer,i2+6, &i3 );
    232238                        if(buffer[i2]=='\0') break;
    233239                        continue;
     
    256262            if(i2==0||buffer[i2-1]=='\n'){
    257263                if(_memicmp(buffer+i2,"#ifdef",6)==0||_memicmp(buffer+i2,"#ifndef",7)==0){
    258                     i2=Search_endif(buffer,i2+6);
     264                    i2=Search_endif(buffer,i2+6, &i3 );
    259265                    if(buffer[i2]=='\0') break;
    260266                    continue;
Note: See TracChangeset for help on using the changeset viewer.