Changeset 260 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Aug 3, 2007, 11:28:19 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/BasicCompiler.vcproj
r257 r260 1253 1253 > 1254 1254 </File> 1255 <Filter1256 Name="CoreClasses"1257 >1258 <File1259 RelativePath="..\BasicCompiler_Common\src\CommonCodeGenerator.cpp"1260 >1261 </File>1262 </Filter>1263 1255 </Filter> 1264 1256 <Filter … … 1267 1259 <File 1268 1260 RelativePath="..\BasicCompiler_Common\src\CodeGenerator.cpp" 1261 > 1262 </File> 1263 <File 1264 RelativePath="..\BasicCompiler_Common\src\CommonCodeGenerator.cpp" 1269 1265 > 1270 1266 </File> -
trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
r259 r260 402 402 compiler.codeGenerator._exitSubCodePositions_ObpOld.clear(); 403 403 404 //ラベル用のメモリを確保 405 extern LABEL *pLabelNames; 406 extern int MaxLabelNum; 407 pLabelNames=(LABEL *)HeapAlloc(hHeap,0,1); 408 MaxLabelNum=0; 404 //ラベル管理オブジェクトを初期化 405 extern Labels labels; 406 labels.clear(); 409 407 410 408 //Gotoラベルスケジュール … … 581 579 } 582 580 583 //ラベル用のメモリを解放584 for(i3=0;i3<MaxLabelNum;i3++){585 if(pLabelNames[i3].pName) HeapDefaultFree(pLabelNames[i3].pName);586 }587 HeapDefaultFree(pLabelNames);588 589 581 //With情報のメモリを解放 590 582 for(i3=0;i3<WithInfo.num;i3++){ -
trunk/abdev/BasicCompiler32/Compile_Statement.cpp
r254 r260 279 279 280 280 int GetLabelAddress(char *LabelName,int LineNum){ 281 extern int MaxLabelNum; 282 extern LABEL *pLabelNames; 283 int i; 281 extern Labels labels; 284 282 285 283 if(LabelName){ 286 for(i=0;i<MaxLabelNum;i++){ 287 if(pLabelNames[i].pName){ 288 if(lstrcmp(LabelName,pLabelNames[i].pName)==0) return pLabelNames[i].address; 284 BOOST_FOREACH( const Label &label, labels ) 285 { 286 if( label.name.size() > 0 ) 287 { 288 if( label.name == LabelName ) 289 { 290 return label.address; 291 } 289 292 } 290 293 } 291 294 } 292 295 else{ 293 for(i=0;i<MaxLabelNum;i++){ 294 if(pLabelNames[i].pName==0){ 295 if(LineNum==pLabelNames[i].line) return pLabelNames[i].address; 296 BOOST_FOREACH( const Label &label, labels ) 297 { 298 if( label.name.size() == 0 ) 299 { 300 if( label.line == LineNum ) 301 { 302 return label.address; 303 } 296 304 } 297 305 } … … 309 317 { 310 318 //jmp ...(schedule) 311 extern int obp;312 319 compiler.codeGenerator.op_jmp_goto_schedule( (const std::string)(Parameter + 1), 0, cp ); 313 320 } … … 326 333 { 327 334 //jmp ...(schedule) 328 extern int obp;329 335 compiler.codeGenerator.op_jmp_goto_schedule( "", LineNum, cp ); 330 336 } -
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r259 r260 417 417 } 418 418 419 //ラベル用のメモリを確保 420 extern LABEL *pLabelNames; 421 extern int MaxLabelNum; 422 pLabelNames=(LABEL *)HeapAlloc(hHeap,0,1); 423 MaxLabelNum=0; 419 //ラベル管理オブジェクトを初期化 420 extern Labels labels; 421 labels.clear(); 424 422 425 423 //Gotoラベルスケジュール … … 465 463 //グローバル実行領域をコンパイル開始 466 464 CompileBuffer(0,0); 467 468 //ラベル用のメモリを解放469 for(i=0;i<MaxLabelNum;i++){470 if(pLabelNames[i].pName) HeapDefaultFree(pLabelNames[i].pName);471 }472 HeapDefaultFree(pLabelNames);473 465 474 466 //Goto未知ラベルスケジュールが存在したらエラーにする -
trunk/abdev/BasicCompiler32/Opcode.h
r253 r260 21 21 22 22 //ラベルアドレス 23 struct LABEL{ 24 char *pName; 23 class Label 24 { 25 public: 26 std::string name; 25 27 int line; 26 28 DWORD address; 27 }; 29 30 Label( const std::string &name, long nativeCodePos ) 31 : name( name ) 32 , line( -1 ) 33 , address( nativeCodePos ) 34 { 35 } 36 Label( int line, long nativeCodePos ) 37 : name( "" ) 38 , line( line ) 39 , address( nativeCodePos ) 40 { 41 } 42 }; 43 typedef std::vector<Label> Labels; 28 44 29 45 //プロシージャの種類
Note:
See TracChangeset
for help on using the changeset viewer.