Changeset 75 in dev for BasicCompiler32/Compile_Statement.cpp
- Timestamp:
- Mar 20, 2007, 4:36:16 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_Statement.cpp
r73 r75 5 5 int i,i2; 6 6 char buffer[8192]; 7 SubInfo *psi;7 UserProc *pUserProc; 8 8 9 9 for(i=0;;i++){ … … 41 41 ////////////////////////////// 42 42 43 p si=GetSubHash(Command);43 pUserProc=GetSubHash(Command); 44 44 45 45 //GetSubHash内でエラー提示が行われた場合 46 if(p si==(SubInfo*)-1) return;47 48 if(p si==0){46 if(pUserProc==(UserProc *)-1) return; 47 48 if(pUserProc==0){ 49 49 char temporary[VN_SIZE]; 50 50 lstrcpy(temporary,Command); 51 51 52 52 CharUpper(temporary); 53 p si=GetSubHash(temporary);53 pUserProc=GetSubHash(temporary); 54 54 55 55 //GetSubHash内でエラー提示が行われた場合 56 if(p si==(SubInfo*)-1) return;57 } 58 59 if(p si){60 if( psi->dwType!=SUBTYPE_MACRO) SetError(10,Command,cp);61 62 Opcode_CallProc("",p si,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); 63 63 64 64 return; … … 963 963 964 964 int CaseTypeSize; 965 void OpcodeSelect(c har *Parameter){965 void OpcodeSelect(const char *lpszParams){ 966 966 extern DWORD *pCaseSchedule; 967 967 extern int CaseScheduleNum; … … 987 987 988 988 LONG_PTR lpIndex; 989 type1=NumOpe( Parameter,0,0,&lpIndex);989 type1=NumOpe(lpszParams,0,0,&lpIndex); 990 990 if(type1==DEF_INTEGER|| 991 991 type1==DEF_WORD|| … … 1076 1076 pobj_c=(CClass *)lpIndex; 1077 1077 1078 std::vector< SubInfo*> subs;1078 std::vector<UserProc *> subs; 1079 1079 pobj_c->EnumMethod( CALC_EQUAL, subs ); 1080 1080 if( subs.size() == 0 ){ … … 1082 1082 } 1083 1083 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 ) ) ); 1093 1086 1094 1087 //オーバーロードを解決 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){ 1100 1094 //エラー 1101 1095 return; … … 1116 1110 1117 1111 //call operator_proc ※ ==演算子 1118 op_call(p si);1112 op_call(pUserProc); 1119 1113 1120 1114 //test eax,eax … … 1330 1324 //戻り値をセット 1331 1325 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); 1350 1336 } 1351 1337 … … 1460 1446 OpcodeCalc(temp2); 1461 1447 1462 SubInfo *psi;1463 if(bFile) p si=GetSubHash("INPUT_FromFile");1464 else p si=GetSubHash("INPUT_FromPrompt");1465 if(!p si){1448 UserProc *pUserProc; 1449 if(bFile) pUserProc=GetSubHash("INPUT_FromFile"); 1450 else pUserProc=GetSubHash("INPUT_FromPrompt"); 1451 if(!pUserProc){ 1466 1452 SetError(3,"Input",cp); 1467 1453 return; 1468 1454 } 1469 Opcode_CallProc(buffer,p si,0,"",0);1455 Opcode_CallProc(buffer,pUserProc,0,"",0); 1470 1456 } 1471 1457 void Opcode_PrintUsing(const char *Parameter,char *buffer,BOOL bFile){ … … 1562 1548 OpcodeCalc(temp2); 1563 1549 1564 SubInfo *psi;1565 if(bFile) p si=GetSubHash("PRINTUSING_ToFile");1566 else p si=GetSubHash("PRINTUSING_ToPrompt");1567 if(!p si){1550 UserProc *pUserProc; 1551 if(bFile) pUserProc=GetSubHash("PRINTUSING_ToFile"); 1552 else pUserProc=GetSubHash("PRINTUSING_ToPrompt"); 1553 if(!pUserProc){ 1568 1554 SetError(3,"Print",cp); 1569 1555 return; 1570 1556 } 1571 Opcode_CallProc(buffer,p si,0,"",0);1557 Opcode_CallProc(buffer,pUserProc,0,"",0); 1572 1558 } 1573 1559 void Opcode_Print(const char *Parameter,BOOL bWrite){ … … 1666 1652 if(sw) lstrcat(buffer,"+Ex\"\\r\\n\""); 1667 1653 1668 SubInfo *psi;1669 if(bFile) p si=GetSubHash("PRINT_ToFile");1670 else p si=GetSubHash("PRINT_ToPrompt");1671 if(!p si){1654 UserProc *pUserProc; 1655 if(bFile) pUserProc=GetSubHash("PRINT_ToFile"); 1656 else pUserProc=GetSubHash("PRINT_ToPrompt"); 1657 if(!pUserProc){ 1672 1658 SetError(3,"Print",cp); 1673 1659 return; 1674 1660 } 1675 Opcode_CallProc(buffer,p si,0,"",0);1661 Opcode_CallProc(buffer,pUserProc,0,"",0); 1676 1662 } 1677 1663
Note:
See TracChangeset
for help on using the changeset viewer.