Ignore:
Timestamp:
May 6, 2007, 6:52:10 PM (17 years ago)
Author:
dai_9181
Message:

関数、クラスメソッドにImports機構を適用。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Subroutine.cpp

    r101 r108  
    463463}
    464464
    465 GlobalProc *AddSubData( const NamespaceScopes &namespaceScopes, char *buffer,int nowLine,BOOL bVirtual,CClass *pobj_c, bool isStatic){
     465GlobalProc *AddSubData( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, char *buffer,int nowLine,BOOL bVirtual,CClass *pobj_c, bool isStatic){
    466466    int i2,i3;
    467467    char temporary[8192];
     
    584584    SubNum++;
    585585
    586     GlobalProc *pUserProc = new GlobalProc( namespaceScopes, temporary, kind, isMacro, isCdecl, isExport );
     586    GlobalProc *pUserProc = new GlobalProc( namespaceScopes, importedNamespaces, temporary, kind, isMacro, isCdecl, isExport );
    587587    pUserProc->SetParentClass( pobj_c );
    588588
     
    664664    namespaceScopes.clear();
    665665
     666    // Importsされた名前空間の管理
     667    NamespaceScopesCollection &importedNamespaces = Smoothie::Meta::importedNamespaces;
     668    importedNamespaces.clear();
     669
    666670    i=-1;
    667671    while(1){
     
    707711            continue;
    708712        }
     713        else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPORTS ){
     714            for(i+=2,i2=0;;i2++,i++){
     715                if( IsCommandDelimitation( basbuf[i] ) ){
     716                    temporary[i2]=0;
     717                    break;
     718                }
     719                temporary[i2]=basbuf[i];
     720            }
     721            importedNamespaces.Imports( temporary );
     722
     723            continue;
     724        }
     725        else if( basbuf[i] == 1 && basbuf[i+1] == ESC_CLEARNAMESPACEIMPORTED ){
     726            importedNamespaces.clear();
     727            continue;
     728        }
    709729
    710730        if(basbuf[i]==1&&basbuf[i+1]==ESC_DECLARE){
     
    722742        }
    723743        if(basbuf[i]==1&&(basbuf[i+1]==ESC_SUB||basbuf[i+1]==ESC_FUNCTION||basbuf[i+1]==ESC_MACRO)){
     744            char statementChar = basbuf[i+1];
     745
    724746            for(i2=0;;i2++,i++){
    725747                if(IsCommandDelimitation(basbuf[i])){
     
    730752                if(basbuf[i]=='\0') break;
    731753            }
    732             AddSubData(namespaceScopes,temporary,i,0,0);
    733 
     754            AddSubData(namespaceScopes, importedNamespaces, temporary,i,0,0);
     755
     756            /*  Sub ~ End Sub
     757                Function ~ End Function
     758                Macro ~ End Macro
     759                を飛び越す           */
     760            char endStatementChar = GetEndXXXCommand( statementChar );
     761            for(i2=0;;i++,i2++){
     762                if( basbuf[i] == '\0' ) break;
     763                if( basbuf[i] == 1 && basbuf[i+1] == endStatementChar ){
     764                    i++;
     765                    break;
     766                }
     767            }
     768            if(basbuf[i]=='\0') break;
    734769            continue;
    735770        }
     
    746781    ////////////
    747782    namespaceScopes.clear();
     783    importedNamespaces.clear();
    748784
    749785    sprintf(temporary,"%c%c_allrem()",1,ESC_SUB);
    750     AddSubData( namespaceScopes, temporary,0,0,0);
     786    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    751787
    752788    sprintf(temporary,"%c%c_aullrem()",1,ESC_SUB);
    753     AddSubData( namespaceScopes, temporary,0,0,0);
     789    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    754790
    755791    sprintf(temporary,"%c%c_allmul()",1,ESC_SUB);
    756     AddSubData( namespaceScopes, temporary,0,0,0);
     792    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    757793
    758794    sprintf(temporary,"%c%c_alldiv()",1,ESC_SUB);
    759     AddSubData( namespaceScopes, temporary,0,0,0);
     795    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    760796
    761797    sprintf(temporary,"%c%c_aulldiv()",1,ESC_SUB);
    762     AddSubData( namespaceScopes, temporary,0,0,0);
     798    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    763799
    764800    sprintf(temporary,"%c%c_allshl()",1,ESC_SUB);
    765     AddSubData( namespaceScopes, temporary,0,0,0);
     801    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    766802
    767803    sprintf(temporary,"%c%c_allshr()",1,ESC_SUB);
    768     AddSubData( namespaceScopes, temporary,0,0,0);
     804    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    769805
    770806    sprintf(temporary,"%c%c_aullshr()",1,ESC_SUB);
    771     AddSubData( namespaceScopes, temporary,0,0,0);
     807    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    772808
    773809    sprintf(temporary,"%c%c_System_InitStaticLocalVariables()",1,ESC_SUB);
    774     AddSubData( namespaceScopes, temporary,0,0,0);
     810    AddSubData( namespaceScopes, importedNamespaces, temporary,0,0,0);
    775811}
    776812void Delete_si(GlobalProc *pUserProc){
Note: See TracChangeset for help on using the changeset viewer.