Changeset 206 in dev for trunk/abdev/BasicCompiler_Common/VarList.cpp
- Timestamp:
- Jul 12, 2007, 2:58:26 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/VarList.cpp
r182 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/Smoothie.h> 4 5 #include <Compiler.h> 2 6 3 7 #include "../BasicCompiler_Common/common.h" … … 9 13 HWND hVarTree_Global,hVarTree_Local,hVarTree_This; 10 14 11 int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type,const int *SubScripts);15 int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type,const Subscripts &subscripts); 12 16 void VarList_Member(HWND hVarTree,HTREEITEM hParent,LONG_PTR pTopOffset,const CClass &objClass,BOOL bPtr); 13 17 void VarList_Insert(HWND hVarTree,TV_INSERTSTRUCT *lptv,const char *VarName,const Type &type,LONG_PTR offset){ … … 180 184 offset=objClass.GetMemberOffset( pMember->GetName().c_str(), &i2 ); 181 185 182 if( pMember->SubScripts[0]!=-1){186 if( pMember->GetSubscripts().size() > 0 ){ 183 187 //構造体内の配列 184 188 sprintf(VarData,"%s %s(&H%X)",VarName,STRING_ARRAY,pTopOffset+offset); … … 187 191 hParent=TreeView_InsertItem(hVarTree,&tv); 188 192 189 VarList_Array(hVarTree,hParent, 190 pTopOffset+offset, 193 VarList_Array( 194 hVarTree, 195 hParent, 196 pTopOffset + offset, 191 197 pMember->GetType(), 192 pMember->SubScripts); 198 pMember->GetSubscripts() 199 ); 193 200 } 194 201 else{ … … 202 209 } 203 210 } 204 int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type, const int *SubScripts ){211 int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,const Type &type, const Subscripts &subscripts ){ 205 212 int i,i2,i3,ElementNum,MemCounter,UseCount[255]; 206 213 char temporary[VN_SIZE],temp2[DIGIT_SIZE]; … … 213 220 tv.item.pszText=temporary; 214 221 215 for(i=0;i<255;i++){ 216 if(SubScripts[i]==-1) break; 222 for(i=0;i<(int)subscripts.size();i++){ 217 223 UseCount[i]=0; 218 224 } … … 221 227 while(1){ 222 228 UseCount[i]++; 223 for(ElementNum=0; SubScripts[i-ElementNum]<UseCount[i-ElementNum];ElementNum++){229 for(ElementNum=0;subscripts[i-ElementNum]<UseCount[i-ElementNum];ElementNum++){ 224 230 UseCount[i-ElementNum]=0; 225 231 if(i-ElementNum-1<0) return MemCounter; … … 268 274 extern int MemPos_RWSection; 269 275 270 BOOST_FOREACH( Variable *pVar, globalVars){276 BOOST_FOREACH( Variable *pVar, compiler.GetMeta().GetGlobalVars() ){ 271 277 272 278 //スコープ外の場合は無視 273 if(pVar-> ScopeLevel!=0){274 if(rva_to_real(pVar-> ScopeStartAddress) <= pobj_dti->lplpObp[0] &&275 pobj_dti->lplpObp[0] < rva_to_real(pVar-> ScopeEndAddress)){279 if(pVar->GetScopeLevel()!=0){ 280 if(rva_to_real(pVar->GetScopeStartAddress()) <= pobj_dti->lplpObp[0] && 281 pobj_dti->lplpObp[0] < rva_to_real(pVar->GetScopeEndAddress())){ 276 282 //範囲内 277 283 } … … 304 310 pVar->GetName().c_str(), 305 311 STRING_ARRAY, 306 ImageBase+MemPos_RWSection+pVar-> offset);312 ImageBase+MemPos_RWSection+pVar->GetOffsetAddress()); 307 313 tv.item.iImage=0; 308 314 tv.item.iSelectedImage=0; 309 315 hParent=TreeView_InsertItem(hVarTree_Global,&tv); 310 316 311 VarList_Array(hVarTree_Global,hParent, 312 (LONG_PTR)(ImageBase+MemPos_RWSection+pVar->offset), 313 *pVar, 314 pVar->GetSubScriptsPtr()); 317 VarList_Array( 318 hVarTree_Global, 319 hParent, 320 (LONG_PTR)(ImageBase+MemPos_RWSection + pVar->GetOffsetAddress()), 321 pVar->GetType(), 322 pVar->GetSubscripts() 323 ); 315 324 } 316 325 else{ … … 318 327 &tv, 319 328 pVar->GetName().c_str(), 320 *pVar,321 (LONG_PTR)(ImageBase+MemPos_RWSection+pVar-> offset));329 pVar->GetType(), 330 (LONG_PTR)(ImageBase+MemPos_RWSection+pVar->GetOffsetAddress())); 322 331 } 323 332 } 324 333 } 325 334 void RefreshLocalVar(void){ 326 int i2 ,i3,sw;335 int i2; 327 336 char temporary[VN_SIZE]; 328 337 TV_INSERTSTRUCT tv; … … 347 356 if(pobj_dti->lplpSpBase[i2]==0) return; 348 357 349 extern GlobalProc **ppSubHash; 350 GlobalProc *pUserProc; 351 for(i3=0,sw=0;i3<MAX_HASH;i3++){ 352 pUserProc=ppSubHash[i3]; 353 while(pUserProc){ 354 if(rva_to_real(pUserProc->beginOpAddress) <= pobj_dti->lplpObp[i2] && 355 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->endOpAddress)){ 356 sw=1; 357 break; 358 } 359 360 pUserProc=pUserProc->pNextData; 361 } 362 if(sw) break; 358 UserProc *pUserProc = NULL; 359 compiler.GetMeta().GetUserProcs().Iterator_Reset(); 360 while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() ) 361 { 362 pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext(); 363 if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pobj_dti->lplpObp[i2] && 364 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->GetEndOpAddress())){ 365 break; 366 } 363 367 } 364 368 if(!pUserProc) return; 365 369 366 BOOST_FOREACH( Variable *pVar, pUserProc-> localVars){370 BOOST_FOREACH( Variable *pVar, pUserProc->GetLocalVars() ){ 367 371 368 372 //スコープ外の場合は無視 369 if(pVar-> ScopeLevel!=0){370 if(rva_to_real(pVar-> ScopeStartAddress) <= pobj_dti->lplpObp[i2] &&371 pobj_dti->lplpObp[i2] < rva_to_real(pVar-> ScopeEndAddress)){373 if(pVar->GetScopeLevel()!=0){ 374 if(rva_to_real(pVar->GetScopeStartAddress()) <= pobj_dti->lplpObp[i2] && 375 pobj_dti->lplpObp[i2] < rva_to_real(pVar->GetScopeEndAddress())){ 372 376 //範囲内 373 377 } … … 382 386 pVar->GetName().c_str(), 383 387 STRING_ARRAY, 384 pobj_dti->lplpSpBase[i2]+pVar-> offset);388 pobj_dti->lplpSpBase[i2]+pVar->GetOffsetAddress()); 385 389 tv.item.iImage=0; 386 390 tv.item.iSelectedImage=0; 387 391 hParent=TreeView_InsertItem(hVarTree_Local,&tv); 388 392 389 VarList_Array(hVarTree_Local,hParent, 390 pobj_dti->lplpSpBase[i2]+pVar->offset, 391 *pVar, 392 pVar->GetSubScriptsPtr()); 393 VarList_Array( 394 hVarTree_Local, 395 hParent, 396 pobj_dti->lplpSpBase[i2] + pVar->GetOffsetAddress(), 397 pVar->GetType(), 398 pVar->GetSubscripts() 399 ); 393 400 } 394 401 else{ 395 offset=pobj_dti->lplpSpBase[i2]+pVar-> offset;402 offset=pobj_dti->lplpSpBase[i2]+pVar->GetOffsetAddress(); 396 403 if(pVar->IsRef()){ 397 404 ReadProcessMemory(hDebugProcess,(void *)offset,&lpData,sizeof(LONG_PTR),&accessBytes); … … 400 407 VarList_Insert(hVarTree_Local,&tv, 401 408 pVar->GetName().c_str(), 402 *pVar,409 pVar->GetType(), 403 410 offset); 404 411 } … … 416 423 //Thisポインタを取得 417 424 LONG_PTR pThis; 418 const Variable *pVar = pUserProc-> localVars.Find( Symbol( "_System_LocalThis" ) );425 const Variable *pVar = pUserProc->GetLocalVars().Find( Symbol( "_System_LocalThis" ) ); 419 426 if( !pVar ){ 420 427 return; 421 428 } 422 lpData=pobj_dti->lplpSpBase[i2]+pVar-> offset;429 lpData=pobj_dti->lplpSpBase[i2]+pVar->GetOffsetAddress(); 423 430 ReadProcessMemory(hDebugProcess,(void *)lpData,&pThis,sizeof(LONG_PTR),&accessBytes); 424 431 … … 426 433 offset=pUserProc->GetParentClassPtr()->GetMemberOffset( pMember->GetName().c_str(),&i2); 427 434 428 if( pMember->SubScripts[0]!=-1){435 if( pMember->GetSubscripts().size() > 0 ){ 429 436 //配列 430 437 sprintf(temporary,"%s %s(&H%X)", … … 436 443 hParent=TreeView_InsertItem(hVarTree_This,&tv); 437 444 438 VarList_Array(hVarTree_This,hParent, 439 pThis+offset, 445 VarList_Array( 446 hVarTree_This, 447 hParent, 448 pThis + offset, 440 449 pMember->GetType(), 441 pMember->SubScripts); 450 pMember->GetSubscripts() 451 ); 442 452 } 443 453 else{ … … 590 600 591 601 //プロシージャ コンボボックス 592 extern GlobalProc **ppSubHash;593 GlobalProc *pUserProc;594 int sw;595 602 SendMessage(hProcCombo,CB_RESETCONTENT,0,0); 596 603 for(i2=pobj_dti->iProcLevel;i2>=0;i2--){ 597 for(i3=0,sw=0;i3<MAX_HASH;i3++){ 598 pUserProc=ppSubHash[i3]; 599 while(pUserProc){ 600 if(rva_to_real(pUserProc->beginOpAddress) <= pobj_dti->lplpObp[i2] && 601 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->endOpAddress)){ 602 lstrcpy(temporary,pUserProc->GetName().c_str()); 603 sw=1; 604 break; 605 } 606 pUserProc=pUserProc->pNextData; 607 } 608 if(sw) break; 604 605 UserProc *pUserProc = NULL; 606 compiler.GetMeta().GetUserProcs().Iterator_Reset(); 607 while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() ) 608 { 609 pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext(); 610 611 if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pobj_dti->lplpObp[i2] && 612 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->GetEndOpAddress())) 613 { 614 lstrcpy(temporary,pUserProc->GetName().c_str()); 615 break; 616 } 609 617 } 610 618 if(!pUserProc){ … … 675 683 void InitVarList(DWORD dwThreadId){ 676 684 extern HWND hDebugWnd; 677 int i2,i 3,i5;685 int i2,i5; 678 686 char temporary[255]; 679 687 … … 703 711 /////////////////////////////////////////////// 704 712 705 int sw;706 707 713 i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0); 708 714 i2=pobj_dti->iProcLevel-i2; 709 715 710 716 if(pobj_dti->lplpSpBase[i2]){ 711 extern GlobalProc **ppSubHash; 712 GlobalProc *pUserProc; 713 for(i3=0,sw=0;i3<MAX_HASH;i3++){ 714 pUserProc=ppSubHash[i3]; 715 while(pUserProc){ 716 if(rva_to_real(pUserProc->beginOpAddress) <= pobj_dti->lplpObp[i2] && 717 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->endOpAddress)){ 718 sw=1; 719 break; 720 } 721 722 pUserProc=pUserProc->pNextData; 723 } 724 if(sw) break; 725 } 726 717 718 UserProc *pUserProc = NULL; 719 compiler.GetMeta().GetUserProcs().Iterator_Reset(); 720 while( compiler.GetMeta().GetUserProcs().Iterator_HasNext() ) 721 { 722 pUserProc = compiler.GetMeta().GetUserProcs().Iterator_GetNext(); 723 724 if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pobj_dti->lplpObp[i2] && 725 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->GetEndOpAddress())){ 726 break; 727 } 728 } 727 729 728 730 if(pUserProc){ 729 Smoothie::Temp::pCompilingClass = pUserProc->GetParentClassPtr();731 compiler.pCompilingClass = pUserProc->GetParentClassPtr(); 730 732 UserProc::CompileStartForUserProc( pUserProc ); 731 733 }
Note:
See TracChangeset
for help on using the changeset viewer.