Ignore:
Timestamp:
Mar 20, 2007, 4:36:16 AM (17 years ago)
Author:
dai_9181
Message:

TYPEINFO→Typeへのリファクタリングを実施。64bitはほぼ完了。32bitが全般的に未完成。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_Statement.cpp

    r73 r75  
    55    int i,i2;
    66    char buffer[8192];
    7     SubInfo *psi;
     7    UserProc *pUserProc;
    88
    99    for(i=0;;i++){
     
    4141        //////////////////////////////
    4242
    43         psi=GetSubHash(Command);
     43        pUserProc=GetSubHash(Command);
    4444
    4545        //GetSubHash内でエラー提示が行われた場合
    46         if(psi==(SubInfo *)-1) return;
    47 
    48         if(psi==0){
     46        if(pUserProc==(UserProc *)-1) return;
     47
     48        if(pUserProc==0){
    4949            char temporary[VN_SIZE];
    5050            lstrcpy(temporary,Command);
    5151
    5252            CharUpper(temporary);
    53             psi=GetSubHash(temporary);
     53            pUserProc=GetSubHash(temporary);
    5454
    5555            //GetSubHash内でエラー提示が行われた場合
    56             if(psi==(SubInfo *)-1) return;
    57         }
    58 
    59         if(psi){
    60             if(psi->dwType!=SUBTYPE_MACRO) SetError(10,Command,cp);
    61 
    62             Opcode_CallProc("",psi,0,"",0);
     56            if(pUserProc==(UserProc *)-1) return;
     57        }
     58
     59        if(pUserProc){
     60            if( !pUserProc->IsMacro() ) SetError(10,Command,cp);
     61
     62            Opcode_CallProc("",pUserProc,0,"",0);
    6363
    6464            return;
     
    963963
    964964int CaseTypeSize;
    965 void OpcodeSelect(char *Parameter){
     965void OpcodeSelect(const char *lpszParams){
    966966    extern DWORD *pCaseSchedule;
    967967    extern int CaseScheduleNum;
     
    987987
    988988    LONG_PTR lpIndex;
    989     type1=NumOpe(Parameter,0,0,&lpIndex);
     989    type1=NumOpe(lpszParams,0,0,&lpIndex);
    990990    if(type1==DEF_INTEGER||
    991991        type1==DEF_WORD||
     
    10761076                    pobj_c=(CClass *)lpIndex;
    10771077
    1078                     std::vector<SubInfo *> subs;
     1078                    std::vector<UserProc *> subs;
    10791079                    pobj_c->EnumMethod( CALC_EQUAL, subs );
    10801080                    if( subs.size() == 0 ){
     
    10821082                    }
    10831083
    1084                     PARAMETER_INFO *ppi = (PARAMETER_INFO *)HeapAlloc(hHeap,0,sizeof(PARAMETER_INFO)*3);
    1085                     int iParmNum=0;
    1086                     ppi[iParmNum].bArray=0;
    1087                     ppi[iParmNum].bByVal=0;
    1088                     ppi[iParmNum].name=0;
    1089                     ppi[iParmNum].type=type2;
    1090                     ppi[iParmNum].u.index=lpIndex2;
    1091                     ppi[iParmNum].SubScripts[0]=-1;
    1092                     iParmNum++;
     1084                    Parameters params;
     1085                    params.push_back( new Parameter( "", Type( type2, lpIndex2 ) ) );
    10931086
    10941087                    //オーバーロードを解決
    1095                     SubInfo *psi;
    1096                     psi=OverloadSolution("==",subs,ppi,iParmNum,NULL);
    1097                     HeapDefaultFree(ppi);
    1098 
    1099                     if(!psi){
     1088                    UserProc *pUserProc;
     1089                    pUserProc=OverloadSolution("==",subs, params, NULL);
     1090
     1091                    delete params[0];
     1092
     1093                    if(!pUserProc){
    11001094                        //エラー
    11011095                        return;
     
    11161110
    11171111                    //call operator_proc    ※ ==演算子
    1118                     op_call(psi);
     1112                    op_call(pUserProc);
    11191113
    11201114                    //test eax,eax
     
    13301324        //戻り値をセット
    13311325        if(Parameter[0]){
    1332             extern SubInfo *pCompilingSubInfo;
    1333             char *temp;
    1334             if(pCompilingSubInfo->name[0]==1&&pCompilingSubInfo->name[1]==ESC_OPERATOR)
    1335                 temp="_System_ReturnValue";
    1336             else temp=pCompilingSubInfo->name;
    1337 
    1338             /*
    1339             TODO: 消す
    1340             if( pCompilingSubInfo->isReturnRef ){
    1341                 //参照型
    1342                 SetRefVariable( temp, Parameter );
    1343             }
    1344             else{
    1345                 //値型*/
    1346                 char temporary[VN_SIZE];
    1347                 sprintf(temporary,"%s=%s",temp,Parameter);
    1348                 OpcodeCalc(temporary);
    1349             //}
     1326            extern UserProc *pCompilingUserProc;
     1327            const char *temp = "_System_ReturnValue";
     1328            if(pCompilingUserProc->GetName()[0]==1&&pCompilingUserProc->GetName()[1]==ESC_OPERATOR)
     1329            {
     1330            }
     1331            else temp=pCompilingUserProc->GetName().c_str();
     1332
     1333            char temporary[VN_SIZE];
     1334            sprintf(temporary,"%s=%s",temp,Parameter);
     1335            OpcodeCalc(temporary);
    13501336        }
    13511337
     
    14601446    OpcodeCalc(temp2);
    14611447
    1462     SubInfo *psi;
    1463     if(bFile) psi=GetSubHash("INPUT_FromFile");
    1464     else psi=GetSubHash("INPUT_FromPrompt");
    1465     if(!psi){
     1448    UserProc *pUserProc;
     1449    if(bFile) pUserProc=GetSubHash("INPUT_FromFile");
     1450    else pUserProc=GetSubHash("INPUT_FromPrompt");
     1451    if(!pUserProc){
    14661452        SetError(3,"Input",cp);
    14671453        return;
    14681454    }
    1469     Opcode_CallProc(buffer,psi,0,"",0);
     1455    Opcode_CallProc(buffer,pUserProc,0,"",0);
    14701456}
    14711457void Opcode_PrintUsing(const char *Parameter,char *buffer,BOOL bFile){
     
    15621548    OpcodeCalc(temp2);
    15631549
    1564     SubInfo *psi;
    1565     if(bFile) psi=GetSubHash("PRINTUSING_ToFile");
    1566     else psi=GetSubHash("PRINTUSING_ToPrompt");
    1567     if(!psi){
     1550    UserProc *pUserProc;
     1551    if(bFile) pUserProc=GetSubHash("PRINTUSING_ToFile");
     1552    else pUserProc=GetSubHash("PRINTUSING_ToPrompt");
     1553    if(!pUserProc){
    15681554        SetError(3,"Print",cp);
    15691555        return;
    15701556    }
    1571     Opcode_CallProc(buffer,psi,0,"",0);
     1557    Opcode_CallProc(buffer,pUserProc,0,"",0);
    15721558}
    15731559void Opcode_Print(const char *Parameter,BOOL bWrite){
     
    16661652    if(sw) lstrcat(buffer,"+Ex\"\\r\\n\"");
    16671653
    1668     SubInfo *psi;
    1669     if(bFile) psi=GetSubHash("PRINT_ToFile");
    1670     else psi=GetSubHash("PRINT_ToPrompt");
    1671     if(!psi){
     1654    UserProc *pUserProc;
     1655    if(bFile) pUserProc=GetSubHash("PRINT_ToFile");
     1656    else pUserProc=GetSubHash("PRINT_ToPrompt");
     1657    if(!pUserProc){
    16721658        SetError(3,"Print",cp);
    16731659        return;
    16741660    }
    1675     Opcode_CallProc(buffer,psi,0,"",0);
     1661    Opcode_CallProc(buffer,pUserProc,0,"",0);
    16761662}
    16771663
Note: See TracChangeset for help on using the changeset viewer.