Changeset 54 in dev


Ignore:
Timestamp:
Feb 12, 2007, 2:09:55 PM (17 years ago)
Author:
dai_9181
Message:

DeclareのLib、AliasにConst定義された文字列定数を指定できるようにした。

Location:
BasicCompiler_Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Intermediate_Step1.cpp

    r4 r54  
    414414    char *temporary,temp2[VN_SIZE];
    415415
    416     temporary=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(buffer)*2);
     416    temporary=(char *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,lstrlen(buffer)*2);
    417417    for(i=0,i2=0,IsStr=0;;i++,i2++){
    418418        if(buffer[i]=='\"') IsStr^=1;
     
    594594                    if(lstrcmpi(temporary+i3,"Declare")==0){
    595595                        i2=i3;
     596                        int i9=i2;
    596597                        temporary[i2]=1;
    597598                        temporary[++i2]=ESC_DECLARE;
    598599                        i++;
    599600                        while(buffer[i]==' '||buffer[i]=='\t') i++;
     601
     602                        // Sub/Function
    600603                        for(i4=0;;i++,i4++){
    601604                            if(!IsVariableChar(buffer[i])){
     
    608611                        else if(lstrcmpi(temp2,"Function")==0) temporary[++i2]=ESC_FUNCTION;
    609612                        while(buffer[i]==' '||buffer[i]=='\t') i++;
     613
     614                        // 関数名
    610615                        for(i2++;;i++,i2++){
    611616                            if(!IsVariableChar(buffer[i])){
     
    616621                        }
    617622                        while(buffer[i]==' '||buffer[i]=='\t') i++;
     623
    618624                        for(i4=0;;i++,i4++){
    619625                            if(!IsVariableChar(buffer[i])){
     
    638644                        if(lstrcmpi(temp2,"Lib")==0) temporary[++i2]=',';
    639645                        while(buffer[i]==' '||buffer[i]=='\t') i++;
     646
    640647                        if(buffer[i]=='\"'){
    641648                            temporary[++i2]=buffer[i];
     
    649656                            }
    650657                        }
     658                        else{
     659                            for(i2++;;i++,i2++){
     660                                if(!IsVariableChar(buffer[i])){
     661                                    i2--;
     662                                    break;
     663                                }
     664                                temporary[i2]=buffer[i];
     665                            }
     666                        }
    651667                        while(buffer[i]==' '||buffer[i]=='\t') i++;
    652                         for(i4=0;;i++,i4++){
    653                             if(!IsVariableChar(buffer[i])){
    654                                 temp2[i4]=0;
    655                                 break;
     668
     669                        temporary[++i2]=',';
     670
     671                        if( memicmp( buffer + i, "Alias", 5 ) ==0 ){
     672                            i+=5;
     673                            for(i++,i2++;;i++,i2++){
     674                                temporary[i2]=buffer[i];
     675                                if(buffer[i]=='('){
     676                                    i2--;
     677                                    break;
     678                                }
     679                                if(buffer[i]=='\0') break;
    656680                            }
    657                             temp2[i4]=buffer[i];
    658                         }
    659                         if(lstrcmpi(temp2,"Alias")==0)
    660                             temporary[++i2]=',';
     681                        }
     682
     683                        temporary[++i2]=',';
     684
    661685                        i--;
    662686                    }
     
    942966    }
    943967    lstrcpy(buffer,temporary);
    944     GlobalFree(temporary);
     968    HeapDefaultFree(temporary);
    945969}
    946970void DefCommandFormat(char *buffer){
  • BasicCompiler_Common/Subroutine.cpp

    r50 r54  
    455455
    456456    //ライブラリ
    457     if(buffer[i]!='\"'){
     457    i = GetOneParameter( buffer, i, temporary );
     458    int type;
     459    LONG_PTR lpIndex;
     460    _int64 i64data;
     461    type = StaticCalculation( true, temporary, 0, &i64data, &lpIndex );
     462    if( type != DEF_PTR_BYTE ){
    458463        SetError(1,NULL,NowLine);
    459464        return;
    460465    }
    461     for(i++,i2=0;;i++,i2++){
    462         if(buffer[i]=='\"'){
    463             temporary[i2]=0;
    464             break;
    465         }
    466         if(buffer[i]=='\0'){
    467             SetError(1,NULL,NowLine);
    468             return;
    469         }
    470         temporary[i2]=buffer[i];
    471     }
     466    lstrcpy( temporary, (char *)i64data );
    472467    CharUpper(temporary);
    473468    if(!strstr(temporary,".")){
     
    483478    pdi->file=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
    484479    lstrcpy(pdi->file,temporary);
    485     i++;
    486 
    487     if(buffer[i]==','){
    488         i++;
    489         if(buffer[i]!='\"'){
     480
     481    //エイリアス
     482    i = GetOneParameter( buffer, i, temporary );
     483    if( temporary[0] ){
     484        type = StaticCalculation( true, temporary, 0, &i64data, &lpIndex );
     485        if( type != DEF_PTR_BYTE ){
    490486            SetError(1,NULL,NowLine);
    491487            return;
    492488        }
    493         for(i++,i2=0;;i++,i2++){
    494             if(buffer[i]=='\"'){
    495                 temporary[i2]=0;
    496                 break;
    497             }
    498             if(buffer[i]=='\0'){
    499                 SetError(1,NULL,NowLine);
    500                 return;
    501             }
    502             temporary[i2]=buffer[i];
    503         }
     489        lstrcpy( temporary, (char *)i64data );
     490
    504491        pdi->alias=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
    505492        lstrcpy(pdi->alias,temporary);
    506         i++;
    507493    }
    508494    else{
     495        //省略されたときは関数名
    509496        pdi->alias=(char *)HeapAlloc(hHeap,0,lstrlen(pdi->name)+1);
    510497        lstrcpy(pdi->alias,pdi->name);
Note: See TracChangeset for help on using the changeset viewer.