Changeset 265 in dev for trunk/abdev/BasicCompiler_Common
- Timestamp:
- Aug 6, 2007, 11:44:42 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/Debug.cpp
r263 r265 229 229 } 230 230 UserProc *GetSubFromObp(ULONG_PTR pos){ 231 compiler. objectModule.meta.GetUserProcs().Iterator_Reset();232 while( compiler. objectModule.meta.GetUserProcs().Iterator_HasNext() )231 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset(); 232 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() ) 233 233 { 234 UserProc *pUserProc = compiler. objectModule.meta.GetUserProcs().Iterator_GetNext();235 236 if(rva_to_real(pUserProc-> _beginOpAddressOld) <= pos &&237 pos < rva_to_real(pUserProc-> _endOpAddressOld))234 UserProc *pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Iterator_GetNext(); 235 236 if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pos && 237 pos < rva_to_real(pUserProc->GetEndOpAddress())) 238 238 { 239 239 return pUserProc; … … 693 693 extern const UserProc *pSub_DebugSys_EndProc; 694 694 if((BYTE)temporary[0]==0xE8&& 695 *((long *)(temporary+1))+5==(long)rva_to_real(pSub_DebugSys_EndProc-> _beginOpAddressOld)-(long)EIP_RIP(Context)){695 *((long *)(temporary+1))+5==(long)rva_to_real(pSub_DebugSys_EndProc->GetBeginOpAddress())-(long)EIP_RIP(Context)){ 696 696 //プロシージャの終端位置の場合はステップインを行う 697 697 goto StepIn; … … 714 714 //シングルステップON 715 715 WriteProcessMemory(hDebugProcess, 716 (void *)rva_to_real(pUserProc-> _beginOpAddressOld),717 pobj_DBDebugSection->pobj_now->SingleStepCodeBuffer+pUserProc-> _beginOpAddressOld,718 pUserProc-> _endOpAddressOld-pUserProc->_beginOpAddressOld,716 (void *)rva_to_real(pUserProc->GetBeginOpAddress()), 717 pobj_DBDebugSection->pobj_now->SingleStepCodeBuffer+pUserProc->GetBeginOpAddress(), 718 pUserProc->GetEndOpAddress()-pUserProc->GetBeginOpAddress(), 719 719 &lpAccBytes); 720 720 } -
trunk/abdev/BasicCompiler_Common/DebugMiddleFile.cpp
r264 r265 37 37 (*p)+=lstrlen(buffer+(*p))+1; 38 38 39 type.SetClassPtr( compiler. objectModule.meta.GetClasses().Find(szClassName) );39 type.SetClassPtr( compiler.GetObjectModule().meta.GetClasses().Find(szClassName) ); 40 40 } 41 41 else{ … … 48 48 49 49 CDebugSection::~CDebugSection(){ 50 if( pobj_DBClass) DeleteDebugInfo();50 if(dwImageBase) DeleteDebugInfo(); 51 51 if(buffer){ 52 52 HeapDefaultFree(buffer); … … 55 55 } 56 56 void CDebugSection::make(void){ 57 extern INCLUDEFILEINFO IncludeFileInfo;58 57 int i2,i3,BufferSize; 59 58 … … 82 81 // テキストデータにシリアライズ 83 82 std::string textString; 84 compiler. objectModule.WriteTextString( textString );83 compiler.GetObjectModule().WriteTextString( textString ); 85 84 86 85 // サイズ … … 105 104 106 105 //インクルード情報 106 extern INCLUDEFILEINFO IncludeFileInfo; 107 107 *(long *)(buffer+i2)=IncludeFileInfo.FilesNum; 108 108 i2+=sizeof(long); … … 115 115 buffer[i2++]=(char)IncludeFileInfo.LineOfFile[i3]; 116 116 if(IncludeFileInfo.LineOfFile[i3]==-1) break; 117 118 //バッファが足りない場合は再確保 119 if(BufferSize<i2+32768){ 120 BufferSize+=32768; 121 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize); 122 } 117 123 } 118 124 119 125 //ソースコード 126 { 127 //バッファが足りない場合は再確保 128 int bufferLen = lstrlen( basbuf ); 129 if(BufferSize<i2+(int)bufferLen+32768){ 130 while( BufferSize<i2+(int)bufferLen+32768 ) 131 { 132 BufferSize+=32768; 133 } 134 135 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize); 136 } 137 } 120 138 lstrcpy(buffer+i2,basbuf); 121 i2+=lstrlen( buffer+i2)+1;139 i2+=lstrlen( buffer + i2 )+1; 122 140 123 141 … … 150 168 } 151 169 152 153 154 ////////////////////////////////////////////155 // クラス情報(名前のみ。詳細は後で保存)156 ////////////////////////////////////////////157 158 //イテレータをリセット159 compiler.objectModule.meta.GetClasses().Iterator_Reset();160 161 //個数162 *(long *)(buffer+i2)=compiler.objectModule.meta.GetClasses().Iterator_GetMaxCount();163 i2+=sizeof(long);164 165 while(compiler.objectModule.meta.GetClasses().Iterator_HasNext()){166 CClass *pobj_c;167 pobj_c=compiler.objectModule.meta.GetClasses().Iterator_GetNext();168 169 //クラス名170 lstrcpy(buffer+i2,pobj_c->GetName().c_str());171 i2+=lstrlen(buffer+i2)+1;172 }173 174 175 176 //////////////////177 // TypeDef情報178 //////////////////179 *(long *)(buffer+i2)=(int)compiler.objectModule.meta.GetTypeDefs().size();180 i2+=sizeof(long);181 for(i3=0;i3<(int)compiler.objectModule.meta.GetTypeDefs().size();i3++){182 lstrcpy(buffer+i2,compiler.objectModule.meta.GetTypeDefs()[i3].GetName().c_str() );183 i2+=lstrlen(buffer+i2)+1;184 185 lstrcpy(buffer+i2,compiler.objectModule.meta.GetTypeDefs()[i3].GetBaseName().c_str() );186 i2+=lstrlen(buffer+i2)+1;187 188 //バッファが足りない場合は再確保189 if(BufferSize<i2+32768){190 BufferSize+=32768;191 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize);192 }193 }194 195 196 //グローバル変数情報197 *(long *)(buffer+i2)=(int)compiler.objectModule.meta.GetGlobalVars().size();198 i2+=sizeof(long);199 BOOST_FOREACH( Variable *pVar, compiler.objectModule.meta.GetGlobalVars() ){200 //変数名201 lstrcpy(buffer+i2,pVar->GetName().c_str());202 i2+=lstrlen(buffer+i2)+1;203 204 //型205 *(long *)(buffer+i2)=pVar->GetType().GetBasicType();206 i2+=sizeof(long);207 208 //型の拡張情報209 SetLpIndex_DebugFile(buffer,&i2,pVar->GetType());210 211 buffer[i2++] = pVar->IsRef() ? 1 : 0;212 213 buffer[i2++] = pVar->IsArray() ? 1 : 0;214 215 if(pVar->IsArray()){216 *(long *)(buffer+i2)=(int)pVar->GetSubscripts().size();217 i2+=sizeof(long);218 BOOST_FOREACH( int indexMax, pVar->GetSubscripts() )219 {220 *(long *)(buffer+i2)=indexMax;221 i2+=sizeof(long);222 }223 }224 225 //レキシカルスコープ情報226 *(long *)(buffer+i2)=pVar->GetScopeStartAddress();227 i2+=sizeof(long);228 *(long *)(buffer+i2)=pVar->GetScopeEndAddress();229 i2+=sizeof(long);230 *(long *)(buffer+i2)=pVar->GetScopeLevel();231 i2+=sizeof(long);232 233 //メモリ位置234 *(long *)(buffer+i2)=pVar->GetOffsetAddress();235 i2+=sizeof(long);236 237 //バッファが足りない場合は再確保238 if(BufferSize<i2+32768){239 BufferSize+=32768;240 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize);241 }242 }243 244 170 //グローバル実行領域のサイズ 245 171 extern int GlobalOpBufferSize; … … 247 173 i2+=sizeof(long); 248 174 249 //プロシージャ情報250 *(long *)(buffer+i2) = compiler.objectModule.meta.GetUserProcs().Iterator_GetMaxCount();251 i2+=sizeof(long);252 compiler.objectModule.meta.GetUserProcs().Iterator_Reset();253 while( compiler.objectModule.meta.GetUserProcs().Iterator_HasNext() )254 {255 UserProc *pUserProc = compiler.objectModule.meta.GetUserProcs().Iterator_GetNext();256 257 if(pUserProc->GetParentClassPtr()){258 lstrcpy(buffer+i2,pUserProc->GetParentClassPtr()->GetName().c_str());259 i2+=lstrlen(buffer+i2)+1;260 }261 else{262 lstrcpy(buffer+i2,"");263 i2+=lstrlen(buffer+i2)+1;264 }265 266 //ID267 *(long *)(buffer+i2)=pUserProc->GetId();268 i2+=sizeof(long);269 270 //関数名271 lstrcpy(buffer+i2,pUserProc->GetName().c_str());272 i2+=lstrlen(buffer+i2)+1;273 274 *(long *)(buffer+i2)=pUserProc->_beginOpAddressOld;275 i2+=sizeof(long);276 *(long *)(buffer+i2)=pUserProc->_endOpAddressOld;277 i2+=sizeof(long);278 279 //ローカル変数情報280 *(long *)(buffer+i2)=(int)pUserProc->GetLocalVars().size();281 i2+=sizeof(long);282 283 //バッファが足りない場合は再確保284 if(BufferSize<i2+32768){285 BufferSize+=32768;286 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize);287 }288 289 BOOST_FOREACH( Variable *pVar, pUserProc->GetLocalVars() ){290 lstrcpy(buffer+i2,pVar->GetName().c_str());291 i2+=lstrlen(buffer+i2)+1;292 293 //型294 *(long *)(buffer+i2)=pVar->GetType().GetBasicType();295 i2+=sizeof(long);296 297 //型の拡張情報298 SetLpIndex_DebugFile(buffer,&i2,pVar->GetType());299 300 //参照型パラメータかどうか301 buffer[i2++] = pVar->IsRef() ? 1 : 0;302 303 //配列かどうか304 buffer[i2++] = pVar->IsArray() ? 1 : 0;305 306 //配列要素307 if(pVar->IsArray()){308 *(long *)(buffer+i2)=(int)pVar->GetSubscripts().size();309 i2+=sizeof(long);310 BOOST_FOREACH( int indexMax, pVar->GetSubscripts() )311 {312 *(long *)(buffer+i2)=indexMax;313 i2+=sizeof(long);314 }315 }316 317 //レキシカルスコープ情報318 *(long *)(buffer+i2)=pVar->GetScopeStartAddress();319 i2+=sizeof(long);320 *(long *)(buffer+i2)=pVar->GetScopeEndAddress();321 i2+=sizeof(long);322 *(long *)(buffer+i2)=pVar->GetScopeLevel();323 i2+=sizeof(long);324 325 //メモリ位置326 *(long *)(buffer+i2)=pVar->GetOffsetAddress();327 i2+=sizeof(long);328 329 330 331 332 //バッファが足りない場合は再確保333 if(BufferSize<i2+32768){334 BufferSize+=32768;335 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize);336 }337 }338 }339 340 341 342 ///////////////////343 // クラス情報344 ///////////////////345 346 //イテレータをリセット347 compiler.objectModule.meta.GetClasses().Iterator_Reset();348 349 while(compiler.objectModule.meta.GetClasses().Iterator_HasNext()){350 CClass *pobj_c;351 pobj_c=compiler.objectModule.meta.GetClasses().Iterator_GetNext();352 353 354 //クラス名355 lstrcpy(buffer+i2,pobj_c->GetName().c_str());356 i2+=lstrlen(buffer+i2)+1;357 358 //仮想関数の数359 *(long *)(buffer+i2)=pobj_c->GetVtblNum();360 i2+=sizeof(long);361 362 //アラインメント363 *(long *)(buffer+i2)=pobj_c->GetFixedAlignment();364 i2+=sizeof(long);365 366 // 動的メンバ367 *(long *)(buffer+i2)=(int)pobj_c->GetDynamicMembers().size();368 i2+=sizeof(long);369 BOOST_FOREACH( CMember *member, pobj_c->GetDynamicMembers() ){370 // 名前371 lstrcpy(buffer+i2,member->GetName().c_str());372 i2+=lstrlen(buffer+i2)+1;373 374 // 型375 *(long *)(buffer+i2)=member->GetType().GetBasicType();376 i2+=sizeof(long);377 378 // 型の拡張情報379 SetLpIndex_DebugFile(buffer,&i2,member->GetType());380 381 // アクセシビリティ382 *(Prototype::Accessibility *)(buffer+i2)=member->GetAccessibility();383 i2+=sizeof(Prototype::Accessibility);384 385 *(long *)(buffer+i2)=(int)member->GetSubscripts().size();386 i2+=sizeof(long);387 BOOST_FOREACH( int indexMax, member->GetSubscripts() )388 {389 *(long *)(buffer+i2)=indexMax;390 i2+=sizeof(long);391 }392 393 //バッファが足りない場合は再確保394 if(BufferSize<i2+32768){395 BufferSize+=32768;396 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize);397 }398 }399 400 // 動的メソッド401 *(long *)(buffer+i2)=(long)pobj_c->GetMethods().size();402 i2+=sizeof(long);403 BOOST_FOREACH( const CMethod *pMethod, pobj_c->GetMethods() ){404 *(Prototype::Accessibility *)(buffer+i2)=pMethod->GetAccessibility();405 i2+=sizeof(Prototype::Accessibility);406 if( pMethod->GetInheritsClassPtr() ){407 lstrcpy(buffer+i2,pMethod->GetInheritsClassPtr()->GetName().c_str());408 i2+=lstrlen(buffer+i2)+1;409 }410 else{411 lstrcpy(buffer+i2,"");412 i2+=lstrlen(buffer+i2)+1;413 }414 lstrcpy(buffer+i2,pMethod->GetUserProc().GetName().c_str());415 i2+=lstrlen(buffer+i2)+1;416 }417 418 //静的メンバ419 *(long *)(buffer+i2)=(long)pobj_c->GetStaticMembers().size();420 i2+=sizeof(long);421 BOOST_FOREACH( CMember *member, pobj_c->GetStaticMembers() ){422 // 名前423 lstrcpy(buffer+i2,member->GetName().c_str());424 i2+=lstrlen(buffer+i2)+1;425 426 // 型427 *(long *)(buffer+i2)=member->GetType().GetBasicType();428 i2+=sizeof(long);429 430 // 型の拡張情報431 SetLpIndex_DebugFile(buffer,&i2,member->GetType());432 433 // アクセシビリティ434 *(Prototype::Accessibility *)(buffer+i2)=member->GetAccessibility();435 i2+=sizeof(Prototype::Accessibility);436 437 // 配列438 *(long *)(buffer+i2)=(int)member->GetSubscripts().size();439 i2+=sizeof(long);440 BOOST_FOREACH( int indexMax, member->GetSubscripts() )441 {442 *(long *)(buffer+i2)=indexMax;443 i2+=sizeof(long);444 }445 446 //バッファが足りない場合は再確保447 if(BufferSize<i2+32768){448 BufferSize+=32768;449 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize);450 }451 }452 453 //バッファが足りない場合は再確保454 if(BufferSize<i2+32768){455 BufferSize+=32768;456 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize);457 }458 }459 460 175 length=i2; 461 176 } … … 467 182 memcpy(buffer,OpBuffer,SizeOf_CodeSection); 468 183 469 BOOST_FOREACH( const SourceLine &sourceLine, oldSourceLines )184 BOOST_FOREACH( const SourceLine &sourceLine, _oldSourceLines ) 470 185 { 471 186 if(!( … … 481 196 } 482 197 BOOL CDebugSection::__load(void){ 483 int i2,i3,i4,num; 484 char temp2[MAX_PATH],*temp5; 198 int i2,i3; 485 199 486 200 compiler.pCompilingClass = NULL; … … 502 216 i2+=sizeof(long); 503 217 504 MessageBox(0,"test","test",0);505 506 218 // オブジェクトモジュール 507 219 { … … 512 224 // バッファ 513 225 const std::string textString( (const char *)(buffer + i2), size ); 514 i2 += textString.size();226 i2 += size; 515 227 516 228 // テキストデータからシリアライズ 517 229 this->objectModule.ReadTextString( textString ); 230 231 compiler.SelectObjectModule( this->objectModule ); 518 232 } 519 233 520 234 //インクルード情報 521 IncludeFileInfo.FilesNum=*(long *)(buffer+i2);522 i2+=sizeof(long); 523 IncludeFileInfo.ppFileNames=(char **)malloc(IncludeFileInfo.FilesNum*sizeof(char *));524 for(i3=0;i3< IncludeFileInfo.FilesNum;i3++){235 _IncludeFileInfo.FilesNum=*(long *)(buffer+i2); 236 i2+=sizeof(long); 237 _IncludeFileInfo.ppFileNames=(char **)malloc(_IncludeFileInfo.FilesNum*sizeof(char *)); 238 for(i3=0;i3<_IncludeFileInfo.FilesNum;i3++){ 525 239 if(buffer[i2]=='\0') break; 526 IncludeFileInfo.ppFileNames[i3]=(char *)malloc(lstrlen(buffer+i2)+1);527 lstrcpy( IncludeFileInfo.ppFileNames[i3],buffer+i2);240 _IncludeFileInfo.ppFileNames[i3]=(char *)malloc(lstrlen(buffer+i2)+1); 241 lstrcpy(_IncludeFileInfo.ppFileNames[i3],buffer+i2); 528 242 i2+=lstrlen(buffer+i2)+1; 529 243 } 530 244 for(i2++,i3=0;;i2++,i3++){ 531 IncludeFileInfo.LineOfFile[i3]=(long)buffer[i2];532 if( IncludeFileInfo.LineOfFile[i3]==-1) break;245 _IncludeFileInfo.LineOfFile[i3]=(long)buffer[i2]; 246 if(_IncludeFileInfo.LineOfFile[i3]==-1) break; 533 247 } 534 248 … … 555 269 i2+=sizeof(long); 556 270 557 oldSourceLines.push_back( SourceLine( lineNum, nativeCodePos, sourceCodePos, sourceLineType ) ); 558 } 559 560 561 /////////////////////////////////////////// 562 // クラス情報(名前のみ。詳細は後で取得) 563 /////////////////////////////////////////// 564 565 this->pobj_DBClass=new Classes(); 566 567 int iMaxClassCount; 568 iMaxClassCount=*(long *)(buffer+i2); 569 i2+=sizeof(long); 570 for(i3=0;i3<iMaxClassCount;i3++){ 571 //クラス名 572 // TODO: 名前空間が未完成 573 this->pobj_DBClass->Add(NamespaceScopes(),NamespaceScopesCollection(),buffer+i2,0); 574 i2+=lstrlen(buffer+i2)+1; 575 } 576 577 compiler.objectModule.meta.SetClasses( this->pobj_DBClass ); 578 579 580 ////////////////// 581 // TypeDef情報 582 ////////////////// 583 584 //初期化 585 compiler.objectModule.meta.GetTypeDefs().clear(); 586 587 //個数を取得 588 num=*(long *)(buffer+i2); 589 i2+=sizeof(long); 590 for(i3=0;i3<num;i3++){ 591 temp5=buffer+i2; 592 i2+=lstrlen(buffer+i2)+1; 593 594 // 名前空間に未対応 595 compiler.objectModule.meta.GetTypeDefs().push_back( TypeDef( NamespaceScopes(), temp5, buffer+i2, -1 ) ); 596 597 i2+=lstrlen(buffer+i2)+1; 598 } 599 600 //定数を取得 601 GetConstInfo(); 602 this->globalConsts = compiler.objectModule.meta.GetGlobalConsts(); 603 this->globalConstMacros = compiler.objectModule.meta.GetGlobalConstMacros(); 604 605 //グローバル変数情報 606 compiler.objectModule.meta.GetGlobalVars().clear(); 607 int maxGlobalVars=*(long *)(buffer+i2); 608 i2+=sizeof(long); 609 for(i3=0;i3<maxGlobalVars;i3++){ 610 611 //変数名 612 char *name = buffer+i2; 613 i2+=lstrlen(buffer+i2)+1; 614 615 int basicType = *(long *)(buffer+i2); 616 i2+=sizeof(long); 617 618 Type type( basicType ); 619 GetLpIndex_DebugFile(buffer,&i2,type); 620 621 bool isRef = (buffer[i2++]) ? true:false; 622 623 bool isArray = (buffer[i2++]) ? true:false; 624 625 Variable *pVar = new Variable( name, type, false, isRef, "" ); 626 627 if(isArray){ 628 Subscripts subscripts; 629 int nSubScriptsNum = *(long *)(buffer+i2); 630 i2+=sizeof(long); 631 for( int i=0; i<nSubScriptsNum; i++ ) 632 { 633 subscripts.push_back( *(long *)(buffer+i2) ); 634 i2+=sizeof(long); 635 } 636 637 pVar->SetArray( subscripts ); 638 } 639 640 //レキシカルスコープ情報 641 pVar->SetScopeStartAddress( *(long *)(buffer+i2) ); 642 i2+=sizeof(long); 643 pVar->SetScopeEndAddress( *(long *)(buffer+i2) ); 644 i2+=sizeof(long); 645 pVar->SetScopeLevel( *(long *)(buffer+i2) ); 646 i2+=sizeof(long); 647 648 //メモリ位置 649 pVar->SetOffsetAddress( *(long *)(buffer+i2) ); 650 i2+=sizeof(long); 651 652 //変数を追加 653 compiler.objectModule.meta.GetGlobalVars().push_back( pVar ); 271 _oldSourceLines.push_back( SourceLine( lineNum, nativeCodePos, sourceCodePos, sourceLineType ) ); 654 272 } 655 273 … … 658 276 i2+=sizeof(long); 659 277 660 //プロシージャ情報661 userProcs.Clear();662 int subNum = *(long *)(buffer+i2);663 i2+=sizeof(long);664 for(int i6=0;i6<subNum;i6++){665 char szParentClassName[VN_SIZE];666 lstrcpy(szParentClassName,buffer+i2);667 i2+=lstrlen(buffer+i2)+1;668 669 const CClass *pClass = NULL;670 if(szParentClassName[0]){671 pClass=compiler.objectModule.meta.GetClasses().Find(szParentClassName);672 }673 674 //ID675 int id=*(long *)(buffer+i2);676 i2+=sizeof(long);677 678 //名前679 char *name = buffer+i2;680 i2+=lstrlen(buffer+i2)+1;681 682 // オブジェクトを生成683 // TODO: 名前空間が未完成684 UserProc *pUserProc = new UserProc( NamespaceScopes(), NamespaceScopesCollection(), name, Procedure::Function, false, false, false, id );685 pUserProc->SetParentClass( pClass );686 687 pUserProc->_beginOpAddressOld = *(long *)(buffer+i2);688 i2+=sizeof(long);689 pUserProc->_endOpAddressOld = *(long *)(buffer+i2);690 i2+=sizeof(long);691 692 pUserProc->CompleteCompile();693 694 //ローカル変数情報695 pUserProc->GetLocalVars().clear();696 int maxLocalVar=*(long *)(buffer+i2);697 i2+=sizeof(long);698 for(i3=0;i3<maxLocalVar;i3++){699 //変数名700 char *name = buffer+i2;701 i2+=lstrlen(buffer+i2)+1;702 703 int basicType = *(long *)(buffer+i2);704 i2+=sizeof(long);705 706 Type type( basicType );707 GetLpIndex_DebugFile(buffer,&i2,type);708 709 bool isRef = (buffer[i2++]) ? true:false;710 711 bool isArray = (buffer[i2++]) ? true:false;712 713 Variable *pVar = new Variable( name, type, false, isRef, "" );714 715 if(isArray){716 Subscripts subscripts;717 int nSubScriptsNum = *(long *)(buffer+i2);718 i2+=sizeof(long);719 for( int i=0; i<nSubScriptsNum; i++ )720 {721 subscripts.push_back( *(long *)(buffer+i2) );722 i2+=sizeof(long);723 }724 725 pVar->SetArray( subscripts );726 }727 728 //レキシカルスコープ情報729 pVar->SetScopeStartAddress( *(long *)(buffer+i2) );730 i2+=sizeof(long);731 pVar->SetScopeEndAddress( *(long *)(buffer+i2) );732 i2+=sizeof(long);733 pVar->SetScopeLevel( *(long *)(buffer+i2) );734 i2+=sizeof(long);735 736 //メモリ位置737 pVar->SetOffsetAddress( *(long *)(buffer+i2) );738 i2+=sizeof(long);739 740 //変数を追加741 pUserProc->GetLocalVars().push_back( pVar );742 }743 744 745 /////////////////////////////////746 // 格納位置を計算してpUserProcをセット747 /////////////////////////////////748 749 // ハッシュに追加750 if( !userProcs.Insert( pUserProc, -1 ) )751 {752 //return NULL;753 }754 }755 userProcs.Iterator_Init();756 757 //クラス情報758 CClass *pobj_c;759 for(i3=0;i3<iMaxClassCount;i3++){760 //クラス名761 char szClassName[VN_SIZE];762 lstrcpy(szClassName,buffer+i2);763 i2+=lstrlen(buffer+i2)+1;764 765 pobj_c = const_cast<CClass *>( compiler.objectModule.meta.GetClasses().Find(szClassName) );766 767 //仮想関数の数768 pobj_c->SetVtblNum( *(long *)(buffer+i2) );769 i2+=sizeof(long);770 771 //アラインメント772 pobj_c->SetFixedAlignment( *(long *)(buffer+i2) );773 i2+=sizeof(long);774 775 // 動的メンバ776 int nDynamicMember = *(long *)(buffer+i2);777 i2+=sizeof(long);778 for( i4=0; i4<nDynamicMember; i4++ ){779 // 名前780 string name = (char *)(buffer+i2);781 i2+=lstrlen(buffer+i2)+1;782 783 // 型784 Type type( *(long *)(buffer+i2) );785 i2+=sizeof(long);786 787 // 型の拡張情報788 GetLpIndex_DebugFile(buffer,&i2,type);789 790 // アクセシビリティ791 Prototype::Accessibility accessibility = *(Prototype::Accessibility *)(buffer+i2);792 i2+=sizeof(Prototype::Accessibility);793 794 Subscripts subscripts;795 int nSubScriptsNum = *(long *)(buffer+i2);796 i2+=sizeof(long);797 for( int i=0; i<nSubScriptsNum; i++ )798 {799 subscripts.push_back( *(long *)(buffer+i2) );800 i2+=sizeof(long);801 }802 803 CMember *member=new CMember( accessibility, name, type, false, subscripts, "", "" );804 805 pobj_c->GetDynamicMembers().push_back( member );806 }807 808 // 動的メソッド809 int nMethod = *(long *)(buffer+i2);810 i2+=sizeof(long);811 for( i4=0; i4<nMethod; i4++ ){812 813 Prototype::Accessibility accessibility=*(Prototype::Accessibility *)(buffer+i2);814 i2+=sizeof(Prototype::Accessibility);815 816 char szInherits[VN_SIZE];817 lstrcpy(szInherits,buffer+i2);818 i2+=lstrlen(buffer+i2)+1;819 820 const CClass *pobj_InheritsClass = NULL;821 if(szInherits[0]){822 pobj_InheritsClass=compiler.objectModule.meta.GetClasses().Find(szInherits);823 }824 825 lstrcpy(temp2,buffer+i2);826 i2+=lstrlen(buffer+i2)+1;827 828 const CClass *pobj_temp_c;829 pobj_temp_c=pobj_InheritsClass;830 if(pobj_temp_c==0) pobj_temp_c=pobj_c;831 832 UserProc *pUserProc = compiler.objectModule.meta.GetUserProcs().GetHashArrayElement( temp2 );833 while(pUserProc){834 if( pUserProc->GetName() == temp2 &&pUserProc->GetParentClassPtr()==pobj_temp_c)835 {836 break;837 }838 839 pUserProc=pUserProc->GetChainNext();840 }841 842 CMethod *pMethod = new DynamicMethod( pUserProc, accessibility, 0,0,false, pobj_InheritsClass);843 844 pobj_c->GetMethods().push_back( pMethod );845 }846 847 //静的メンバ848 int nStaticMember = *(long *)(buffer+i2);849 i2+=sizeof(long);850 for( i4=0; i4<nStaticMember; i4++ ){851 // 名前852 string name = (char *)(buffer+i2);853 i2+=lstrlen(buffer+i2)+1;854 855 // 型856 Type type( *(long *)(buffer+i2) );857 i2+=sizeof(long);858 859 // 型の拡張情報860 GetLpIndex_DebugFile(buffer,&i2,type);861 862 // アクセシビリティ863 Prototype::Accessibility accessibility = *(Prototype::Accessibility *)(buffer+i2);864 i2+=sizeof(Prototype::Accessibility);865 866 // 配列867 Subscripts subscripts;868 int nSubScriptsNum = *(long *)(buffer+i2);869 i2+=sizeof(long);870 for( int i=0; i<nSubScriptsNum; i++ )871 {872 subscripts.push_back( *(long *)(buffer+i2) );873 i2+=sizeof(long);874 }875 876 CMember *member=new CMember( accessibility, name, type, false, subscripts, "", "" );877 878 pobj_c->GetStaticMembers().push_back( member );879 }880 }881 278 882 279 HeapDefaultFree(buffer); … … 884 281 885 282 886 887 888 compiler.objectModule.meta.GetUserProcs() = userProcs; 889 pSub_DebugSys_EndProc=GetSubHash("_DebugSys_EndProc"); 283 this->pSub_DebugSys_EndProc=GetSubHash("_DebugSys_EndProc"); 284 if( this->pSub_DebugSys_EndProc == NULL ) 285 { 286 MessageBox( 0, "_DebugSys_EndProcが見つからない", "ActiveBasic", MB_OK ); 287 } 890 288 891 289 … … 899 297 //インクルード情報 900 298 extern INCLUDEFILEINFO IncludeFileInfo; 901 IncludeFileInfo=this-> IncludeFileInfo;299 IncludeFileInfo=this->_IncludeFileInfo; 902 300 903 301 //コードと行番号の関係 904 302 extern SourceLines oldSourceLines; 905 oldSourceLines = this-> oldSourceLines;303 oldSourceLines = this->_oldSourceLines; 906 304 907 305 BreakStepCodeBuffer=pobj_DBBreakPoint->update(OpBuffer,SizeOf_CodeSection); … … 1011 409 FileSize_CodeSection=this->SizeOf_CodeSection; 1012 410 411 // オブジェクトモジュール 412 compiler.SelectObjectModule( this->objectModule ); 413 1013 414 //インクルード情報 1014 415 extern INCLUDEFILEINFO IncludeFileInfo; 1015 IncludeFileInfo=this-> IncludeFileInfo;416 IncludeFileInfo=this->_IncludeFileInfo; 1016 417 1017 418 //ソースコード … … 1020 421 //コードと行番号の関係 1021 422 extern SourceLines oldSourceLines; 1022 oldSourceLines = this->oldSourceLines; 1023 1024 // クラス情報 1025 compiler.objectModule.meta.SetClasses( this->pobj_DBClass ); 1026 1027 //定数を取得 1028 compiler.objectModule.meta.GetGlobalConsts() = this->globalConsts; 1029 compiler.objectModule.meta.GetGlobalConstMacros() = this->globalConstMacros; 423 oldSourceLines = this->_oldSourceLines; 1030 424 1031 425 //グローバル実行領域のサイズ … … 1033 427 GlobalOpBufferSize=this->GlobalOpBufferSize; 1034 428 1035 //プロシージャ1036 compiler.objectModule.meta.GetUserProcs() = userProcs;1037 1038 429 extern const UserProc *pSub_DebugSys_EndProc; 1039 430 pSub_DebugSys_EndProc=this->pSub_DebugSys_EndProc; … … 1048 439 1049 440 //インクルード情報を解放 1050 for(i2=0;i2<IncludeFileInfo.FilesNum;i2++) 1051 { 1052 free(IncludeFileInfo.ppFileNames[i2]); 1053 } 1054 free(IncludeFileInfo.ppFileNames); 1055 1056 //クラスに関するメモリを解放 1057 delete this->pobj_DBClass; 1058 this->pobj_DBClass=0; 441 for(i2=0;i2<_IncludeFileInfo.FilesNum;i2++) 442 { 443 free(_IncludeFileInfo.ppFileNames[i2]); 444 } 445 free(_IncludeFileInfo.ppFileNames); 1059 446 1060 447 //コードバッファを解放 -
trunk/abdev/BasicCompiler_Common/DebugSection.h
r263 r265 30 30 31 31 //インクルード情報 32 INCLUDEFILEINFO IncludeFileInfo;32 INCLUDEFILEINFO _IncludeFileInfo; 33 33 34 34 //ソースコード … … 36 36 37 37 //コードと行番号の関係 38 SourceLines oldSourceLines; 39 40 // クラス情報 41 Classes *pobj_DBClass; 42 43 //定数を取得 44 Consts globalConsts; 45 ConstMacros globalConstMacros; 38 SourceLines _oldSourceLines; 46 39 47 40 //グローバル実行領域のサイズ 48 41 int GlobalOpBufferSize; 49 50 //プロシージャ51 UserProcs userProcs;52 42 53 43 const UserProc *pSub_DebugSys_EndProc; … … 73 63 , dwRVA_CodeSection( 0 ) 74 64 , SizeOf_CodeSection( 0 ) 75 , pobj_DBClass( NULL )76 65 , GlobalOpBufferSize( 0 ) 77 66 , pSub_DebugSys_EndProc( NULL ) -
trunk/abdev/BasicCompiler_Common/Diagnose.cpp
r256 r265 40 40 int codeSizeOfGlobalProc = 0; 41 41 int codeSizeOfClassMethod = 0; 42 compiler. objectModule.meta.GetUserProcs().Iterator_Reset();43 while( compiler. objectModule.meta.GetUserProcs().Iterator_HasNext() )42 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset(); 43 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() ) 44 44 { 45 UserProc *pUserProc = compiler. objectModule.meta.GetUserProcs().Iterator_GetNext();45 UserProc *pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Iterator_GetNext(); 46 46 if( pUserProc->IsCompiled() ){ 47 47 if( pUserProc->HasParentClass() ){ … … 67 67 68 68 // イテレータをリセット 69 extern Classes *pobj_DBClass; 70 compiler.objectModule.meta.GetClasses().Iterator_Reset(); 69 compiler.GetObjectModule().meta.GetClasses().Iterator_Reset(); 71 70 72 while( compiler. objectModule.meta.GetClasses().Iterator_HasNext() ){71 while( compiler.GetObjectModule().meta.GetClasses().Iterator_HasNext() ){ 73 72 int codeSizeOfClass = 0; 74 73 75 CClass &objClass = *compiler. objectModule.meta.GetClasses().Iterator_GetNext();74 CClass &objClass = *compiler.GetObjectModule().meta.GetClasses().Iterator_GetNext(); 76 75 77 76 if( !objClass.IsEnum() ){ … … 107 106 108 107 // イテレータをリセット 109 extern Classes *pobj_DBClass; 110 compiler.objectModule.meta.GetClasses().Iterator_Reset(); 108 compiler.GetObjectModule().meta.GetClasses().Iterator_Reset(); 111 109 112 while( compiler. objectModule.meta.GetClasses().Iterator_HasNext() ){110 while( compiler.GetObjectModule().meta.GetClasses().Iterator_HasNext() ){ 113 111 int codeSizeOfClass = 0; 114 112 115 CClass &objClass = *compiler. objectModule.meta.GetClasses().Iterator_GetNext();113 CClass &objClass = *compiler.GetObjectModule().meta.GetClasses().Iterator_GetNext(); 116 114 117 115 // 動的メソッド -
trunk/abdev/BasicCompiler_Common/Intermediate_Step2.cpp
r256 r265 79 79 80 80 //定数を追加 81 compiler. objectModule.meta.GetGlobalConsts().Add( namespaceScopes, temporary, NextValue);81 compiler.GetObjectModule().meta.GetGlobalConsts().Add( namespaceScopes, temporary, NextValue); 82 82 } 83 83 } … … 95 95 96 96 //定数に関する情報を初期化 97 compiler. objectModule.meta.GetGlobalConsts().Clear();98 compiler. objectModule.meta.GetGlobalConstMacros().Clear();97 compiler.GetObjectModule().meta.GetGlobalConsts().Clear(); 98 compiler.GetObjectModule().meta.GetGlobalConstMacros().Clear(); 99 99 100 100 extern char *basbuf; … … 172 172 173 173 // イテレータを初期化 174 compiler. objectModule.meta.GetGlobalConsts().Iterator_Init();175 compiler. objectModule.meta.GetGlobalConstMacros().Iterator_Init();174 compiler.GetObjectModule().meta.GetGlobalConsts().Iterator_Init(); 175 compiler.GetObjectModule().meta.GetGlobalConstMacros().Iterator_Init(); 176 176 177 177 return true; -
trunk/abdev/BasicCompiler_Common/MakeExe.cpp
r263 r265 137 137 extern int AllGlobalVarSize; 138 138 extern int AllInitGlobalVarSize; 139 compiler. objectModule.meta.GetGlobalVars().clear();139 compiler.GetObjectModule().meta.GetGlobalVars().clear(); 140 140 AllGlobalVarSize=0; 141 141 AllInitGlobalVarSize=0; -
trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
r256 r265 330 330 Type leftType; 331 331 if( GetTermType( termLeft, leftType, isLiteral, &isClassName ) ){ 332 if( isClassName == false && compiler. objectModule.meta.GetBlittableTypes().IsExist( leftType ) ){332 if( isClassName == false && compiler.GetObjectModule().meta.GetBlittableTypes().IsExist( leftType ) ){ 333 333 // 左側のオブジェクト部分がBlittable型のとき 334 334 … … 336 336 lstrcpy( temporary, termLeft ); 337 337 sprintf( termLeft, "%s(%s)", 338 compiler. objectModule.meta.GetBlittableTypes().Find( leftType ).GetCreateStaticMethodFullName().c_str(),338 compiler.GetObjectModule().meta.GetBlittableTypes().Find( leftType ).GetCreateStaticMethodFullName().c_str(), 339 339 temporary ); 340 340 … … 398 398 399 399 if( pIsClassName ){ 400 if( compiler. objectModule.meta.GetClasses().Find( termFull ) ){400 if( compiler.GetObjectModule().meta.GetClasses().Find( termFull ) ){ 401 401 *pIsClassName = true; 402 402 return true; … … 457 457 else 458 458 { 459 ConstMacro *pConstMacro = compiler. objectModule.meta.GetGlobalConstMacros().Find( procName );459 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( procName ); 460 460 if( pConstMacro ) 461 461 { … … 689 689 //要求タイプがオブジェクト、または未定のとき 690 690 type_stack[sp]=DEF_OBJECT; 691 index_stack[sp]=(LONG_PTR)compiler. objectModule.meta.GetClasses().GetStringClassPtr();691 index_stack[sp]=(LONG_PTR)compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr(); 692 692 *pIsLiteralCalculation = false; 693 693 … … 734 734 } 735 735 else{ 736 index_stack[sp] = (LONG_PTR)compiler. objectModule.meta.GetClasses().GetObjectClassPtr();736 index_stack[sp] = (LONG_PTR)compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr(); 737 737 } 738 738 *pIsLiteralCalculation = false; … … 746 746 ////////////// 747 747 748 i3 = compiler. objectModule.meta.GetGlobalConsts().GetBasicType(term);748 i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(term); 749 749 if(i3){ 750 if( compiler. objectModule.meta.GetGlobalConsts().IsStringPtr( term ) ){750 if( compiler.GetObjectModule().meta.GetGlobalConsts().IsStringPtr( term ) ){ 751 751 //リテラル文字列 752 752 goto StrLiteral; -
trunk/abdev/BasicCompiler_Common/Subroutine.cpp
r256 r265 168 168 GetVarType(fullCallName,type,false); 169 169 170 ProcPointer *pProcPtr = compiler. objectModule.meta.GetProcPointers()[type.GetIndex()];170 ProcPointer *pProcPtr = compiler.GetObjectModule().meta.GetProcPointers()[type.GetIndex()]; 171 171 resultType = pProcPtr->ReturnType(); 172 172 … … 451 451 452 452 bool IsNeedProcCompile(){ 453 compiler. objectModule.meta.GetUserProcs().Iterator_Reset();454 while( compiler. objectModule.meta.GetUserProcs().Iterator_HasNext() )453 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset(); 454 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() ) 455 455 { 456 UserProc *pUserProc = compiler. objectModule.meta.GetUserProcs().Iterator_GetNext();456 UserProc *pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Iterator_GetNext(); 457 457 if( pUserProc->IsUsing() && pUserProc->IsCompiled() == false ){ 458 458 return true; -
trunk/abdev/BasicCompiler_Common/VarList.cpp
r263 r265 275 275 extern int MemPos_RWSection; 276 276 277 BOOST_FOREACH( Variable *pVar, compiler. objectModule.meta.GetGlobalVars() ){277 BOOST_FOREACH( Variable *pVar, compiler.GetObjectModule().meta.GetGlobalVars() ){ 278 278 279 279 //スコープ外の場合は無視 … … 358 358 359 359 UserProc *pUserProc = NULL; 360 compiler. objectModule.meta.GetUserProcs().Iterator_Reset();361 while( compiler. objectModule.meta.GetUserProcs().Iterator_HasNext() )360 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset(); 361 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() ) 362 362 { 363 pUserProc = compiler. objectModule.meta.GetUserProcs().Iterator_GetNext();364 if(rva_to_real(pUserProc-> _beginOpAddressOld) <= pobj_dti->lplpObp[i2] &&365 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc-> _endOpAddressOld)){363 pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Iterator_GetNext(); 364 if(rva_to_real(pUserProc->GetBeginOpAddress()) <= pobj_dti->lplpObp[i2] && 365 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc->GetEndOpAddress())){ 366 366 break; 367 367 } … … 604 604 605 605 UserProc *pUserProc = NULL; 606 compiler. objectModule.meta.GetUserProcs().Iterator_Reset();607 while( compiler. objectModule.meta.GetUserProcs().Iterator_HasNext() )606 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset(); 607 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() ) 608 608 { 609 pUserProc = compiler. objectModule.meta.GetUserProcs().Iterator_GetNext();610 611 if(rva_to_real(pUserProc-> _beginOpAddressOld) <= pobj_dti->lplpObp[i2] &&612 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc-> _endOpAddressOld))609 pUserProc = compiler.GetObjectModule().meta.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 613 { 614 614 lstrcpy(temporary,pUserProc->GetName().c_str()); … … 717 717 718 718 UserProc *pUserProc = NULL; 719 compiler. objectModule.meta.GetUserProcs().Iterator_Reset();720 while( compiler. objectModule.meta.GetUserProcs().Iterator_HasNext() )719 compiler.GetObjectModule().meta.GetUserProcs().Iterator_Reset(); 720 while( compiler.GetObjectModule().meta.GetUserProcs().Iterator_HasNext() ) 721 721 { 722 pUserProc = compiler. objectModule.meta.GetUserProcs().Iterator_GetNext();723 724 if(rva_to_real(pUserProc-> _beginOpAddressOld) <= pobj_dti->lplpObp[i2] &&725 pobj_dti->lplpObp[i2] < rva_to_real(pUserProc-> _endOpAddressOld)){722 pUserProc = compiler.GetObjectModule().meta.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 726 break; 727 727 } -
trunk/abdev/BasicCompiler_Common/VariableOpe.cpp
r256 r265 220 220 if(lpIndex==-1) lstrcpy(name,"VoidPtr"); 221 221 else{ 222 if( compiler. objectModule.meta.GetProcPointers()[lpIndex]->ReturnType().IsNull() )222 if( compiler.GetObjectModule().meta.GetProcPointers()[lpIndex]->ReturnType().IsNull() ) 223 223 lstrcpy(name,"*Sub"); 224 224 else lstrcpy(name,"*Function"); … … 235 235 236 236 Type GetStringTypeInfo(){ 237 Type type( DEF_OBJECT, *compiler. objectModule.meta.GetClasses().GetStringClassPtr() );237 Type type( DEF_OBJECT, *compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr() ); 238 238 return type; 239 239 } … … 575 575 // 名前空間を分離 576 576 char namespaceStr[VN_SIZE]="", simpleName[VN_SIZE]; 577 compiler. objectModule.meta.GetNamespaces().SplitNamespace( variable, namespaceStr, simpleName );577 compiler.GetObjectModule().meta.GetNamespaces().SplitNamespace( variable, namespaceStr, simpleName ); 578 578 579 579 // 先頭オブジェクトまたはクラス名と入れ子メンバに分割 … … 647 647 GetNowStaticVarFullName(VarName,temporary); 648 648 649 pVar = compiler. objectModule.meta.GetGlobalVars().Find( Symbol( temporary ) );649 pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temporary ) ); 650 650 if( pVar ){ 651 651 goto ok; … … 667 667 } 668 668 669 int typeDefIndex = compiler. objectModule.meta.GetTypeDefs().GetIndex( VarName );669 int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( VarName ); 670 670 if( typeDefIndex != -1 ){ 671 671 // TypeDef後の型名だったとき 672 lstrcpy( VarName, compiler. objectModule.meta.GetTypeDefs()[typeDefIndex].GetBaseName().c_str() );672 lstrcpy( VarName, compiler.GetObjectModule().meta.GetTypeDefs()[typeDefIndex].GetBaseName().c_str() ); 673 673 } 674 674 … … 676 676 sprintf(temp2,"%s.%s",VarName,temporary); 677 677 678 pVar = compiler. objectModule.meta.GetGlobalVars().Find( Symbol( temp2 ) );678 pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temp2 ) ); 679 679 if( pVar ){ 680 680 lstrcpy(member,tempMember); … … 689 689 sprintf(temp2,"%s.%s",compiler.pCompilingClass->GetName().c_str(),VarName); 690 690 691 pVar = compiler. objectModule.meta.GetGlobalVars().Find( Symbol( temp2 ) );691 pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temp2 ) ); 692 692 if( pVar ){ 693 693 goto ok; … … 700 700 //////////////////// 701 701 702 pVar = compiler. objectModule.meta.GetGlobalVars().BackSearch( Symbol( VarName ) );702 pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch( Symbol( VarName ) ); 703 703 if( pVar ){ 704 704 goto ok; … … 973 973 extern int AllGlobalVarSize; 974 974 975 if( compiler. objectModule.meta.GetGlobalVars().DuplicateCheck( Symbol( name ) ) ){975 if( compiler.GetObjectModule().meta.GetGlobalVars().DuplicateCheck( Symbol( name ) ) ){ 976 976 //2重定義のエラー 977 977 SetError(15,name,cp); … … 997 997 998 998 // 変数を追加 999 compiler. objectModule.meta.GetGlobalVars().push_back( pVar );999 compiler.GetObjectModule().meta.GetGlobalVars().push_back( pVar ); 1000 1000 1001 1001 //アラインメントを考慮 … … 1105 1105 1106 1106 //定数と2重定義されていないる場合は抜け出す 1107 if(compiler. objectModule.meta.GetGlobalConsts().GetBasicType(VarName)){1107 if(compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(VarName)){ 1108 1108 return; 1109 1109 } 1110 1110 1111 1111 //定数マクロとして定義されている場合は抜け出す 1112 if( compiler. objectModule.meta.GetGlobalConstMacros().IsExist( VarName ) )1112 if( compiler.GetObjectModule().meta.GetGlobalConstMacros().IsExist( VarName ) ) 1113 1113 { 1114 1114 return; … … 1126 1126 1127 1127 //定数と2重定義されていないかを調べる 1128 if(compiler. objectModule.meta.GetGlobalConsts().GetBasicType(VarName)){1128 if(compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(VarName)){ 1129 1129 SetError(15,VarName,cp); 1130 1130 return; … … 1132 1132 1133 1133 //定数マクロとして定義されている場合 1134 if( compiler. objectModule.meta.GetGlobalConstMacros().IsExist( VarName ) ){1134 if( compiler.GetObjectModule().meta.GetGlobalConstMacros().IsExist( VarName ) ){ 1135 1135 SetError(15,VarName,cp); 1136 1136 return; -
trunk/abdev/BasicCompiler_Common/WatchList.cpp
r256 r265 440 440 /////////////////// 441 441 442 const Variable *pVar = compiler. objectModule.meta.GetGlobalVars().Find( VarName );442 const Variable *pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( VarName ); 443 443 if( !pVar ){ 444 444 //一致しないとき -
trunk/abdev/BasicCompiler_Common/calculation.cpp
r256 r265 500 500 //定数関数 501 501 502 ConstMacro *pConstMacro = compiler. objectModule.meta.GetGlobalConstMacros().Find( temporary );502 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( temporary ); 503 503 if( !pConstMacro ) 504 504 { … … 665 665 ///////// 666 666 StrPtr[pnum]=0; 667 type[pnum] = compiler. objectModule.meta.GetGlobalConsts().GetBasicType(Parms);667 type[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(Parms); 668 668 if(type[pnum]){ 669 669 if(IsRealNumberType(type[pnum])){ 670 670 //実数型 671 nums[pnum] = compiler. objectModule.meta.GetGlobalConsts().GetDoubleData(Parms);671 nums[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(Parms); 672 672 } 673 673 else if(IsWholeNumberType(type[pnum])){ 674 674 //整数 675 i64nums[pnum] = compiler. objectModule.meta.GetGlobalConsts().GetWholeData(Parms);675 i64nums[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(Parms); 676 676 } 677 677 /* else if(type[pnum]==DEF_STRING){ … … 1221 1221 1222 1222 //定数 1223 ConstMacro *pConstMacro = compiler. objectModule.meta.GetGlobalConstMacros().Find( temporary );1223 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( temporary ); 1224 1224 if(pConstMacro){ 1225 1225 //マクロ関数の場合 … … 1231 1231 1232 1232 //定数 1233 i3 = compiler. objectModule.meta.GetGlobalConsts().GetBasicType(Command+i2);1233 i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(Command+i2); 1234 1234 if(i3==DEF_STRING) return 1; //文字列 1235 1235 if(i3) return 0; //数値 -
trunk/abdev/BasicCompiler_Common/hash.cpp
r256 r265 33 33 34 34 // ハッシュ値を取得 35 DllProc *pDllProc = compiler. objectModule.meta.GetDllProcs().GetHashArrayElement( simpleName );35 DllProc *pDllProc = compiler.GetObjectModule().meta.GetDllProcs().GetHashArrayElement( simpleName ); 36 36 while(pDllProc){ 37 37 if( pDllProc->IsEqualSymbol( fullName ) ){ … … 74 74 } 75 75 else{ 76 pobj_c=compiler. objectModule.meta.GetClasses().Find(ObjName);76 pobj_c=compiler.GetObjectModule().meta.GetClasses().Find(ObjName); 77 77 if( pobj_c ){ 78 78 isStatic = true; … … 107 107 108 108 // グローバル関数を検索 109 compiler. objectModule.meta.GetUserProcs().EnumGlobalProcs( NestMember, name, subs );109 compiler.GetObjectModule().meta.GetUserProcs().EnumGlobalProcs( NestMember, name, subs ); 110 110 } 111 111 … … 151 151 152 152 const UserProc *GetClassMethod( const char *className, const char *methodName ){ 153 const CClass *pClass = compiler. objectModule.meta.GetClasses().Find( className );153 const CClass *pClass = compiler.GetObjectModule().meta.GetClasses().Find( className ); 154 154 if( pClass ){ 155 155 vector<const UserProc *> userProcs; -
trunk/abdev/BasicCompiler_Common/include/Compiler.h
r256 r265 13 13 NamespaceSupporter namespaceSupporter; 14 14 15 // オブジェクトモジュール 16 ObjectModule *pObjectModule; 17 ObjectModule *pNowObjectModule; 18 15 19 public: 20 21 Compiler() 22 : pObjectModule( new ObjectModule ) 23 , pNowObjectModule( pObjectModule ) 24 { 25 } 26 ~Compiler() 27 { 28 delete pObjectModule; 29 } 16 30 17 31 NamespaceSupporter &GetNamespaceSupporter() … … 20 34 } 21 35 22 // オブジェクトモジュール23 ObjectModule objectModule;24 25 36 // コード生成機構 26 37 CodeGenerator codeGenerator; … … 28 39 // リンカ 29 40 Linker linker; 41 42 ObjectModule &GetObjectModule() 43 { 44 return *pNowObjectModule; 45 } 46 void SelectObjectModule( ObjectModule &objectModule ) 47 { 48 pNowObjectModule = &objectModule; 49 } 30 50 31 51 static bool StringToType( const std::string &typeName, Type &type ); -
trunk/abdev/BasicCompiler_Common/include/NativeCode.h
r263 r265 408 408 } 409 409 410 const SourceLines &GetSourceLines() const 411 { 412 return sourceLines; 413 } 410 414 void NextSourceLine(); 411 415 }; -
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r263 r265 189 189 190 190 //継承元クラスを取得 191 const CClass *pInheritsClass = compiler. objectModule.meta.GetClasses().Find(temporary);191 const CClass *pInheritsClass = compiler.GetObjectModule().meta.GetClasses().Find(temporary); 192 192 if( !pInheritsClass ){ 193 193 SmoothieException::Throw(106,temporary,nowLine); … … 219 219 if( !isInheritsClass ){ 220 220 // クラスを一つも継承していないとき 221 const CClass *pObjectClass = compiler. objectModule.meta.GetClasses().Find("Object");221 const CClass *pObjectClass = compiler.GetObjectModule().meta.GetClasses().Find("Object"); 222 222 if( !pObjectClass ){ 223 223 SmoothieException::Throw(106,"Object",i); … … 243 243 244 244 //継承元クラスを取得 245 const CClass *pInheritsClass = compiler. objectModule.meta.GetClasses().Find(temporary);245 const CClass *pInheritsClass = compiler.GetObjectModule().meta.GetClasses().Find(temporary); 246 246 if( !pInheritsClass ){ 247 247 SmoothieException::Throw(106,temporary,nowLine); … … 282 282 //継承先が読み取られていないとき 283 283 pobj_LoopRefCheck->add(this->GetName().c_str()); 284 compiler. objectModule.meta.GetClasses().GetClass_recur(inheritsClass.GetName().c_str());284 compiler.GetObjectModule().meta.GetClasses().GetClass_recur(inheritsClass.GetName().c_str()); 285 285 pobj_LoopRefCheck->del(this->GetName().c_str()); 286 286 } … … 344 344 //継承先が読み取られていないとき 345 345 pobj_LoopRefCheck->add(this->GetName().c_str()); 346 compiler. objectModule.meta.GetClasses().GetClass_recur(inheritsInterface.GetName().c_str());346 compiler.GetObjectModule().meta.GetClasses().GetClass_recur(inheritsInterface.GetName().c_str()); 347 347 pobj_LoopRefCheck->del(this->GetName().c_str()); 348 348 } … … 427 427 428 428 //関数ハッシュへ登録 429 UserProc *pUserProc = compiler. objectModule.meta.GetUserProcs().Add( NamespaceScopes(), NamespaceScopesCollection(), buffer,nowLine,isVirtual,pobj_c, (bStatic!=0) );429 UserProc *pUserProc = compiler.GetObjectModule().meta.GetUserProcs().Add( NamespaceScopes(), NamespaceScopesCollection(), buffer,nowLine,isVirtual,pobj_c, (bStatic!=0) ); 430 430 if(!pUserProc) return; 431 431 … … 716 716 } 717 717 718 vtbl_offset=compiler. objectModule.dataTable.AddBinary((void *)ppsi,GetVtblNum()*sizeof(LONG_PTR));718 vtbl_offset=compiler.GetObjectModule().dataTable.AddBinary((void *)ppsi,GetVtblNum()*sizeof(LONG_PTR)); 719 719 720 720 for( int i=0; i < GetVtblNum(); i++ ){ … … 730 730 731 731 LONG_PTR *pVtbl; 732 pVtbl=(LONG_PTR *)((char *)compiler. objectModule.dataTable.GetPtr()+vtbl_offset);732 pVtbl=(LONG_PTR *)((char *)compiler.GetObjectModule().dataTable.GetPtr()+vtbl_offset); 733 733 734 734 int i; … … 834 834 835 835 // Blittable型管理オブジェクトを初期化 836 compiler. objectModule.meta.GetBlittableTypes().clear();836 compiler.GetObjectModule().meta.GetBlittableTypes().clear(); 837 837 838 838 // 名前空間管理 … … 954 954 955 955 // Blittable型として登録 956 compiler. objectModule.meta.GetBlittableTypes().push_back( BlittableType( blittableType, pClass ) );956 compiler.GetObjectModule().meta.GetBlittableTypes().push_back( BlittableType( blittableType, pClass ) ); 957 957 } 958 958 } … … 1659 1659 1660 1660 // TypeDefも見る 1661 int index = compiler. objectModule.meta.GetTypeDefs().GetIndex( namespaceScopes, name );1661 int index = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( namespaceScopes, name ); 1662 1662 if( index != -1 ){ 1663 Type type = compiler. objectModule.meta.GetTypeDefs()[index].GetBaseType();1663 Type type = compiler.GetObjectModule().meta.GetTypeDefs()[index].GetBaseType(); 1664 1664 if( type.IsObject() ){ 1665 1665 return &type.GetClass(); -
trunk/abdev/BasicCompiler_Common/src/Compiler.cpp
r256 r265 16 16 //関数ポインタ(*Function) 17 17 type.SetBasicType( DEF_PTR_PROC ); 18 type.SetIndex( compiler. objectModule.meta.GetProcPointers().Add( typeName ) );18 type.SetIndex( compiler.GetObjectModule().meta.GetProcPointers().Add( typeName ) ); 19 19 return true; 20 20 } … … 42 42 // Object型だったとき 43 43 if( typeName == "Object" ){ 44 type.SetType( DEF_OBJECT, compiler. objectModule.meta.GetClasses().GetObjectClassPtr() );44 type.SetType( DEF_OBJECT, compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr() ); 45 45 return true; 46 46 } … … 48 48 // String型だったとき 49 49 if( typeName == "String" ){ 50 type.SetType( DEF_OBJECT, compiler. objectModule.meta.GetClasses().GetStringClassPtr() );50 type.SetType( DEF_OBJECT, compiler.GetObjectModule().meta.GetClasses().GetStringClassPtr() ); 51 51 return true; 52 52 } … … 56 56 // TypeDefされた型 57 57 //////////////////// 58 int i=compiler. objectModule.meta.GetTypeDefs().GetIndex( typeName );58 int i=compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( typeName ); 59 59 if(i!=-1){ 60 type = compiler. objectModule.meta.GetTypeDefs()[i].GetBaseType();60 type = compiler.GetObjectModule().meta.GetTypeDefs()[i].GetBaseType(); 61 61 return true; 62 62 } 63 63 64 64 //クラス 65 const CClass *pobj_c = compiler. objectModule.meta.GetClasses().Find( typeName );65 const CClass *pobj_c = compiler.GetObjectModule().meta.GetClasses().Find( typeName ); 66 66 if(pobj_c){ 67 67 type.SetClassPtr( pobj_c ); … … 104 104 } 105 105 else{ 106 if( compiler. objectModule.meta.GetProcPointers()[type.GetIndex()]->ReturnType().IsNull() ){106 if( compiler.GetObjectModule().meta.GetProcPointers()[type.GetIndex()]->ReturnType().IsNull() ){ 107 107 return "*Sub"; 108 108 } -
trunk/abdev/BasicCompiler_Common/src/Const.cpp
r256 r265 28 28 29 29 //重複チェック 30 if( compiler. objectModule.meta.GetGlobalConstMacros().IsExist( name )31 || compiler. objectModule.meta.GetGlobalConsts().IsExist( name ) )30 if( compiler.GetObjectModule().meta.GetGlobalConstMacros().IsExist( name ) 31 || compiler.GetObjectModule().meta.GetGlobalConsts().IsExist( name ) ) 32 32 { 33 33 SetError(15,name,cp); … … 38 38 //定数マクロ 39 39 40 compiler. objectModule.meta.GetGlobalConstMacros().Add( namespaceScopes, name, buffer + i );40 compiler.GetObjectModule().meta.GetGlobalConstMacros().Add( namespaceScopes, name, buffer + i ); 41 41 } 42 42 else{ … … 44 44 char *expression = buffer + i + 1; 45 45 46 compiler. objectModule.meta.GetGlobalConsts().Add( namespaceScopes, name, expression );46 compiler.GetObjectModule().meta.GetGlobalConsts().Add( namespaceScopes, name, expression ); 47 47 } 48 48 } -
trunk/abdev/BasicCompiler_Common/src/LexicalScope.cpp
r256 r265 72 72 73 73 Variables &vars = UserProc::IsGlobalAreaCompiling() ? 74 compiler. objectModule.meta.GetGlobalVars() :74 compiler.GetObjectModule().meta.GetGlobalVars() : 75 75 UserProc::CompilingUserProc().GetLocalVars(); 76 76 … … 98 98 99 99 Variables &vars = UserProc::IsGlobalAreaCompiling() ? 100 compiler. objectModule.meta.GetGlobalVars() :100 compiler.GetObjectModule().meta.GetGlobalVars() : 101 101 UserProc::CompilingUserProc().GetLocalVars(); 102 102 -
trunk/abdev/BasicCompiler_Common/src/NamespaceSupporter.cpp
r256 r265 9 9 { 10 10 NamespaceScopes namespaceScopes( namespaceStr ); 11 if( !compiler. objectModule.meta.GetNamespaces().IsExist( namespaceScopes ) ){11 if( !compiler.GetObjectModule().meta.GetNamespaces().IsExist( namespaceScopes ) ){ 12 12 return false; 13 13 }
Note:
See TracChangeset
for help on using the changeset viewer.