Changeset 246 in dev for trunk/abdev/BasicCompiler_Common/Compile.cpp
- Timestamp:
- Jul 28, 2007, 1:30:22 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/Compile.cpp
r241 r246 32 32 DWORD *pExitSubSchedule; 33 33 int ExitSubScheduleNum; 34 35 //Goto未知ラベル スケジュール36 GOTOLABELSCHEDULE *pGotoLabelSchedule;37 int GotoLabelScheduleNum;38 34 39 35 //グローバル変数初期バッファ … … 123 119 void ChangeOpcode(char *Command){ 124 120 extern HANDLE hHeap; 125 int i,i2;126 121 127 122 if(Command[0]=='\0') … … 141 136 142 137 //書き込みスケジュール 143 for(i=0;i<GotoLabelScheduleNum;i++){ 144 if(lstrcmp(pGotoLabelSchedule[i].pName,Command+1)==0){ 145 *((long *)(OpBuffer+pGotoLabelSchedule[i].pos))=obp-(pGotoLabelSchedule[i].pos+sizeof(long)); 146 147 HeapDefaultFree(pGotoLabelSchedule[i].pName); 148 138 std::vector<GotoLabelSchedule>::iterator it = compiler.codeGenerator.gotoLabelSchedules.begin(); 139 while( it != compiler.codeGenerator.gotoLabelSchedules.end() ) 140 { 141 if( it->GetName() == Command+1 ) 142 { 143 *((long *)( OpBuffer + it->GetNativeCodePos() ))=obp-(it->GetNativeCodePos()+sizeof(long)); 144 149 145 //詰める 150 GotoLabelScheduleNum--; 151 for(i2=i;i2<GotoLabelScheduleNum;i2++){ 152 pGotoLabelSchedule[i2].pName=pGotoLabelSchedule[i2+1].pName; 153 pGotoLabelSchedule[i2].line=pGotoLabelSchedule[i2+1].line; 154 pGotoLabelSchedule[i2].pos=pGotoLabelSchedule[i2+1].pos; 155 } 156 i--; 157 continue; 146 it = compiler.codeGenerator.gotoLabelSchedules.erase( it ); 147 } 148 else 149 { 150 it++; 158 151 } 159 152 } … … 552 545 553 546 //書き込みスケジュール 554 for(i=0;i<GotoLabelScheduleNum;i++){ 555 if(pGotoLabelSchedule[i].pName==0&& 556 pGotoLabelSchedule[i].line==i3){ 557 *((long *)(OpBuffer+pGotoLabelSchedule[i].pos))=obp-(pGotoLabelSchedule[i].pos+sizeof(long)); 558 547 std::vector<GotoLabelSchedule>::iterator it = compiler.codeGenerator.gotoLabelSchedules.begin(); 548 while( it != compiler.codeGenerator.gotoLabelSchedules.end() ) 549 { 550 if( it->GetName().size() == 0 && it->GetLineNum() == i3 ) 551 { 552 *((long *)( OpBuffer + it->GetNativeCodePos() ))=obp-(it->GetNativeCodePos()+sizeof(long)); 553 559 554 //詰める 560 GotoLabelScheduleNum--; 561 for(i2=i;i2<GotoLabelScheduleNum;i2++){ 562 pGotoLabelSchedule[i2].pName=pGotoLabelSchedule[i2+1].pName; 563 pGotoLabelSchedule[i2].line=pGotoLabelSchedule[i2+1].line; 564 pGotoLabelSchedule[i2].pos=pGotoLabelSchedule[i2+1].pos; 565 } 566 i--; 555 it = compiler.codeGenerator.gotoLabelSchedules.erase( it ); 556 } 557 else 558 { 559 it++; 567 560 } 568 561 }
Note:
See TracChangeset
for help on using the changeset viewer.