Ignore:
Timestamp:
Apr 24, 2007, 3:17:29 AM (17 years ago)
Author:
dai_9181
Message:

名前空間機能をグローバル関数に適用。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Subroutine.cpp

    r99 r100  
    9999    }
    100100    if( lastIndex == -1 ){
     101        lstrcpy( member, desc );
    101102        return false;
    102103    }
     
    298299//インデクサ(getter)の戻り値を取得
    299300bool GetReturnTypeOfIndexerGetterProc( const CClass &objClass, Type &resultType ){
    300     std::vector<UserProc *> subs;
     301    vector<UserProc *> subs;
    301302    objClass.EnumMethod( CALC_ARRAY_GET, subs );
    302303    if( subs.size() == 0 ){
     
    310311
    311312
    312 void AddDeclareData(char *buffer,int nowLine){
     313void AddDeclareData(const NamespaceScopes &namespaceScopes, char *buffer,int nowLine){
    313314    extern HANDLE hHeap;
    314315    int i2;
     
    401402
    402403    // オブジェクトを生成
    403     DllProc *pDllProc = new DllProc( procName, kind, isCdecl, dllFileName, alias );
     404    DllProc *pDllProc = new DllProc( namespaceScopes, procName, kind, isCdecl, dllFileName, alias );
    404405
    405406    // パラメータを解析
     
    462463}
    463464
    464 UserProc *AddSubData(char *buffer,int nowLine,BOOL bVirtual,CClass *pobj_c, bool isStatic){
     465GlobalProc *AddSubData( const NamespaceScopes &namespaceScopes, char *buffer,int nowLine,BOOL bVirtual,CClass *pobj_c, bool isStatic){
    465466    int i2,i3;
    466467    char temporary[8192];
     
    468469    int i=1;
    469470
    470     UserProc::Kind kind = Procedure::Sub;
     471    Procedure::Kind kind = Procedure::Sub;
    471472    bool isMacro = false;
    472473    if(buffer[i]==ESC_FUNCTION) kind = Procedure::Function;
     
    583584    SubNum++;
    584585
    585     UserProc *pUserProc = new UserProc( temporary, kind, isMacro, isCdecl, isExport );
     586    GlobalProc *pUserProc = new GlobalProc( namespaceScopes, temporary, kind, isMacro, isCdecl, isExport );
    586587    pUserProc->SetParentClass( pobj_c );
    587588
     
    610611    key=hash_default(pUserProc->GetName().c_str());
    611612
    612     extern UserProc **ppSubHash;
     613    extern GlobalProc **ppSubHash;
    613614    if(ppSubHash[key]){
    614         UserProc *psi2;
     615        GlobalProc *psi2;
    615616        psi2=ppSubHash[key];
    616617        while(1){
     
    648649
    649650    //サブルーチン(ユーザー定義)情報を初期化
    650     extern UserProc **ppSubHash;
     651    extern GlobalProc **ppSubHash;
    651652    extern int SubNum;
    652     ppSubHash=(UserProc **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(UserProc *));
     653    ppSubHash=(GlobalProc **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(GlobalProc *));
    653654    SubNum=0;
    654655
     
    660661
    661662    // 名前空間管理
    662     vector<string> namespaceScopes;
     663    NamespaceScopes namespaceScopes;
    663664
    664665    i=-1;
     
    715716                if(basbuf[i]=='\0') break;
    716717            }
    717             AddDeclareData(temporary,i);
     718            AddDeclareData(namespaceScopes,temporary,i);
    718719
    719720            continue;
     
    728729                if(basbuf[i]=='\0') break;
    729730            }
    730             AddSubData(temporary,i,0,0);
     731            AddSubData(namespaceScopes,temporary,i,0,0);
    731732
    732733            continue;
     
    743744    // 特殊関数
    744745    ////////////
     746    namespaceScopes.clear();
    745747
    746748    sprintf(temporary,"%c%c_allrem()",1,ESC_SUB);
    747     AddSubData(temporary,0,0,0);
     749    AddSubData( namespaceScopes, temporary,0,0,0);
    748750
    749751    sprintf(temporary,"%c%c_aullrem()",1,ESC_SUB);
    750     AddSubData(temporary,0,0,0);
     752    AddSubData( namespaceScopes, temporary,0,0,0);
    751753
    752754    sprintf(temporary,"%c%c_allmul()",1,ESC_SUB);
    753     AddSubData(temporary,0,0,0);
     755    AddSubData( namespaceScopes, temporary,0,0,0);
    754756
    755757    sprintf(temporary,"%c%c_alldiv()",1,ESC_SUB);
    756     AddSubData(temporary,0,0,0);
     758    AddSubData( namespaceScopes, temporary,0,0,0);
    757759
    758760    sprintf(temporary,"%c%c_aulldiv()",1,ESC_SUB);
    759     AddSubData(temporary,0,0,0);
     761    AddSubData( namespaceScopes, temporary,0,0,0);
    760762
    761763    sprintf(temporary,"%c%c_allshl()",1,ESC_SUB);
    762     AddSubData(temporary,0,0,0);
     764    AddSubData( namespaceScopes, temporary,0,0,0);
    763765
    764766    sprintf(temporary,"%c%c_allshr()",1,ESC_SUB);
    765     AddSubData(temporary,0,0,0);
     767    AddSubData( namespaceScopes, temporary,0,0,0);
    766768
    767769    sprintf(temporary,"%c%c_aullshr()",1,ESC_SUB);
    768     AddSubData(temporary,0,0,0);
     770    AddSubData( namespaceScopes, temporary,0,0,0);
    769771
    770772    sprintf(temporary,"%c%c_System_InitStaticLocalVariables()",1,ESC_SUB);
    771     AddSubData(temporary,0,0,0);
    772 }
    773 void Delete_si(UserProc *pUserProc){
     773    AddSubData( namespaceScopes, temporary,0,0,0);
     774}
     775void Delete_si(GlobalProc *pUserProc){
    774776    if(pUserProc->pNextData) Delete_si(pUserProc->pNextData);
    775777    delete pUserProc;
    776778}
    777 void DeleteSubInfo(UserProc **ppSubHash,char **ppMacroNames,int MacroNum){  //サブルーチン情報のメモリ解放
     779void DeleteSubInfo(GlobalProc **ppSubHash,char **ppMacroNames,int MacroNum){    //サブルーチン情報のメモリ解放
    778780    int i;
    779781    for(i=0;i<MAX_HASH;i++){
     
    845847bool IsNeedProcCompile(){
    846848    for(int i2=0;i2<MAX_HASH;i2++){
    847         extern UserProc **ppSubHash;
    848         UserProc *pUserProc=ppSubHash[i2];
     849        extern GlobalProc **ppSubHash;
     850        GlobalProc *pUserProc=ppSubHash[i2];
    849851        while(pUserProc){
    850852            if( pUserProc->IsUsing() && pUserProc->IsCompiled() == false ){
Note: See TracChangeset for help on using the changeset viewer.