Changeset 636 in dev for trunk/ab5.0/abdev/BasicCompiler_Common
- Timestamp:
- Jun 10, 2008, 11:40:17 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev/BasicCompiler_Common
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/BreakPoint.cpp
r603 r636 42 42 const IncludedFilesRelation *pIncludedFilesRelation = NULL; 43 43 const BasicSource *pNowSource = NULL; 44 BOOST_FOREACH( const BasicSource &source, compiler.GetObjectModule().GetSources())44 BOOST_FOREACH( const ObjectModule *pObjectModule, compiler.staticLibraries ) 45 45 { 46 pIncludedFilesRelation = &source.GetIncludedFilesRelation(); 46 const BasicSource *pSource = &pObjectModule->GetSource(); 47 48 pIncludedFilesRelation = &pSource->GetIncludedFilesRelation(); 47 49 48 50 for(FileNum=0;FileNum<pIncludedFilesRelation->GetFileCounts();FileNum++) … … 50 52 if(lstrcmpi(pIncludedFilesRelation->GetFilePathFromFileNumber(FileNum).c_str(),lpszFileName)==0) 51 53 { 52 pNowSource = &source;54 pNowSource = pSource; 53 55 break; 54 56 } -
trunk/ab5.0/abdev/BasicCompiler_Common/CDebugThreadInfo.cpp
r280 r636 37 37 lplpSpBase=(ULONG_PTR *)HeapAlloc(hHeap,0,(iProcLevel+1)*sizeof(ULONG_PTR)); 38 38 lpdwCp=(DWORD *)HeapAlloc(hHeap,0,(iProcLevel+1)*sizeof(DWORD)); 39 lpdwSourceIndex=(DWORD *)HeapAlloc(hHeap,0,(iProcLevel+1)*sizeof(DWORD));39 this->relationalObjectModuleIndexes.resize( iProcLevel + 1 ); 40 40 41 41 //lplpObp … … 108 108 HeapDefaultFree(lplpSpBase); 109 109 HeapDefaultFree(lpdwCp); 110 HeapDefaultFree(lpdwSourceIndex);110 relationalObjectModuleIndexes.clear(); 111 111 } 112 112 -
trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp
r632 r636 18 18 //デバッグ用行番号情報 19 19 SourceLines oldSourceLines; 20 21 // オブジェクトモジュールリストに類似したソースコードリスト 22 BasicSources sourcesLinkRelationalObjectModule; 20 23 21 24 … … 744 747 } 745 748 746 compiler.codeGenerator.NextSourceLine( compiler.Get ObjectModule().GetCurrentSourceIndex() );749 compiler.codeGenerator.NextSourceLine( compiler.GetCurrentRelationalObjectModuleIndexForSource() ); 747 750 748 751 if(Command[0]==1){ -
trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp
r605 r636 58 58 const IncludedFilesRelation *pIncludedFilesRelation = NULL; 59 59 const BasicSource *pNowSource = NULL; 60 BOOST_FOREACH( const BasicSource &source, compiler.GetObjectModule().GetSources())60 BOOST_FOREACH( const ObjectModule *pObjectModule, compiler.staticLibraries ) 61 61 { 62 pIncludedFilesRelation = &source.GetIncludedFilesRelation(); 62 const BasicSource *pSource = &pObjectModule->GetSource(); 63 64 pIncludedFilesRelation = &pSource->GetIncludedFilesRelation(); 63 65 64 66 for(FileNum=0;FileNum<pIncludedFilesRelation->GetFileCounts();FileNum++) … … 66 68 if(lstrcmpi(pIncludedFilesRelation->GetFilePathFromFileNumber(FileNum).c_str(),szFilePath)==0) 67 69 { 68 pNowSource = &source;70 pNowSource = pSource; 69 71 break; 70 72 } -
trunk/ab5.0/abdev/BasicCompiler_Common/DebugMiddleFile.cpp
r603 r636 99 99 } 100 100 101 // オブジェクトモジュールリストに類似したソースコードリスト 102 { 103 // オブジェクトモジュールリストに類似したソースコードリストを作成 104 BasicSources sources; 105 BOOST_FOREACH( const ObjectModule *pObjectModule, compiler.staticLibraries ) 106 { 107 sources.push_back( pObjectModule->GetSource() ); 108 } 109 110 // テキストデータにシリアライズ 111 std::string textString; 112 sources.WriteBinaryString( textString ); 113 114 // サイズ 115 *(long *)(buffer+i2) = (long)textString.size(); 116 i2+=sizeof(long); 117 118 //バッファが足りない場合は再確保 119 if(BufferSize<i2+(int)textString.size()+32768){ 120 while( BufferSize<i2+(int)textString.size()+32768 ) 121 { 122 BufferSize+=32768; 123 } 124 125 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize); 126 } 127 128 // バッファ 129 memcpy( buffer+i2, textString.c_str(), textString.size() ); 130 i2 += (int)textString.size(); 131 } 132 101 133 102 134 //////////////////////// … … 115 147 i2+=sizeof(long); 116 148 117 *(long *)(buffer+i2) = sourceLine.Get SourceIndex();149 *(long *)(buffer+i2) = sourceLine.GetRelationalObjectModuleIndex(); 118 150 i2+=sizeof(long); 119 151 … … 192 224 this->objectModule.ReadString( textString ); 193 225 194 compiler.SelectObjectModule( this->objectModule ); 195 } 196 226 compiler.SelectObjectModule( &this->objectModule ); 227 } 228 229 // オブジェクトモジュールリストに類似したソースコードリスト 230 { 231 // サイズ 232 int size = *(long *)(buffer+i2); 233 i2 += sizeof(long); 234 235 // バッファ 236 const std::string textString( (const char *)(buffer + i2), size ); 237 i2 += size; 238 239 // テキストデータからシリアライズ 240 this->_sourcesLinkRelationalObjectModule.ReadBinaryString( textString ); 241 } 197 242 198 243 //コードと行番号の関係 … … 246 291 //ソースコード 247 292 extern char *basbuf; 248 basbuf = const_cast<char *>(compiler.GetObjectModule().GetSource( 0).GetBuffer());293 basbuf = const_cast<char *>(compiler.GetObjectModule().GetSource().GetBuffer()); 249 294 250 295 … … 252 297 // ブレークポイントを適用 253 298 ///////////////////////////// 299 300 // オブジェクトモジュールリストに類似したソースコードリスト 301 extern BasicSources sourcesLinkRelationalObjectModule; 302 sourcesLinkRelationalObjectModule = this->_sourcesLinkRelationalObjectModule; 254 303 255 304 //コードと行番号の関係 … … 364 413 365 414 // オブジェクトモジュール 366 compiler.SelectObjectModule( this->objectModule );415 compiler.SelectObjectModule( &this->objectModule ); 367 416 368 417 //コードと行番号の関係 -
trunk/ab5.0/abdev/BasicCompiler_Common/DebugSection.h
r603 r636 24 24 // オブジェクトモジュール 25 25 ObjectModule objectModule; 26 27 // オブジェクトモジュールリストに類似したソースコードリスト 28 BasicSources _sourcesLinkRelationalObjectModule; 26 29 27 30 //コードと行番号の関係 -
trunk/ab5.0/abdev/BasicCompiler_Common/MakeExe.cpp
r622 r636 34 34 35 35 //最後尾に貼り付け 36 compiler.GetObjectModule().Get CurrentSource().Addition( temp );36 compiler.GetObjectModule().GetSource().Addition( temp ); 37 37 38 38 HeapDefaultFree(temp); … … 64 64 TypeOfSubSystem=IMAGE_SUBSYSTEM_WINDOWS_GUI; 65 65 66 // オブジェクトモジュール名をセットする 67 compiler.GetObjectModule().SetName( program.GetOutputFileName() ); 68 66 69 //プログラムをファイルから読み込む 67 compiler.GetObjectModule().SetCurrentSourceIndex( (int)compiler.GetObjectModule().GetSources().size() ); 68 compiler.GetObjectModule().GetSources().push_back( BasicSource() ); 69 bool result = compiler.GetObjectModule().GetCurrentSource().ReadFile( 70 bool result = compiler.GetObjectModule().GetSource().ReadFile( 70 71 program.GetSourceFilePath(), 71 72 compiler.IsDebug(), … … 80 81 goto EndCompile; 81 82 } 82 if( !compiler.Get ObjectModule().GetCurrentSource().cannotIncludePath.empty() )83 if( !compiler.GetCurrentSource().cannotIncludePath.empty() ) 83 84 { 84 85 compiler.errorMessenger.Output( 85 86 35, 86 compiler.Get ObjectModule().GetCurrentSource().cannotIncludePath,87 compiler.Get ObjectModule().GetCurrentSource().cannotIncludeSourcePos87 compiler.GetCurrentSource().cannotIncludePath, 88 compiler.GetCurrentSource().cannotIncludeSourcePos 88 89 ); 89 90 goto EndCompile; … … 145 146 146 147 ChangeCommandToCode(basbuf); 147 compiler.GetObjectModule().GetSource s()[0]._ResetLength();148 compiler.GetObjectModule().GetSource()._ResetLength(); 148 149 149 150 if( compiler.errorMessenger.HasError() || bStopCompile ) -
trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp
r587 r636 621 621 { 622 622 pobj_dti->lpdwCp[i3]=oldSourceLines[i2].GetSourceCodePos(); 623 pobj_dti-> lpdwSourceIndex[i3]=oldSourceLines[i2].GetSourceIndex();623 pobj_dti->relationalObjectModuleIndexes[i3]=oldSourceLines[i2].GetRelationalObjectModuleIndex(); 624 624 } 625 625 } … … 631 631 pobj_dti->lplpSpBase[i2]=pobj_dti->lplpSpBase[i2+1]; 632 632 pobj_dti->lpdwCp[i2]=pobj_dti->lpdwCp[i2+1]; 633 pobj_dti-> lpdwSourceIndex[i2]=pobj_dti->lpdwSourceIndex[i2+1];633 pobj_dti->relationalObjectModuleIndexes[i2]=pobj_dti->relationalObjectModuleIndexes[i2+1]; 634 634 } 635 635 i3--; … … 639 639 640 640 std::string dummyStr; 641 if(!compiler.GetObjectModule().GetSource( pobj_dti->lpdwSourceIndex[pobj_dti->iProcLevel] ).GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel], i2, dummyStr )){ 641 extern BasicSources sourcesLinkRelationalObjectModule; 642 if(!sourcesLinkRelationalObjectModule[pobj_dti->relationalObjectModuleIndexes[pobj_dti->iProcLevel]].GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel], i2, dummyStr )){ 642 643 extern HWND hMainDlg; 643 644 //"デバッグ情報の取得に失敗" … … 721 722 722 723 std::string dummyStr; 723 compiler.GetObjectModule().GetSource( pobj_dti->lpdwSourceIndex[pobj_dti->iProcLevel] ).GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel-i2], i3, dummyStr ); 724 extern BasicSources sourcesLinkRelationalObjectModule; 725 sourcesLinkRelationalObjectModule[pobj_dti->relationalObjectModuleIndexes[pobj_dti->iProcLevel]].GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel-i2], i3, dummyStr ); 724 726 ShowErrorLine(i3,dummyStr.c_str()); 725 727 -
trunk/ab5.0/abdev/BasicCompiler_Common/debug.h
r280 r636 4 4 //ソースコードポインタ 5 5 DWORD *lpdwCp; 6 DWORD *lpdwSourceIndex;6 std::vector<int> relationalObjectModuleIndexes; 7 7 8 8 //ネイティブコードポインタ -
trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h
r632 r636 25 25 const CClass *pCompilingClass; 26 26 27 // オブジェクトモジュール 28 ObjectModule *pObjectModule; 29 ObjectModule *pNowObjectModule; 27 // 現在参照したいソースコードのオブジェクト モジュール インデックス 28 int currentRelationalObjectModuleIndexForSource; 29 30 30 31 31 32 public: 32 33 33 Compiler() 34 : isBuildSuccessful( false ) 35 , pObjectModule( new ObjectModule ) 36 , targetModuleType( ActiveBasic::Common::TargetModuleType::Exe ) 37 , isDebug( false ) 38 , isUnicode( false ) 39 , isCore( false ) 40 { 41 SelectObjectModule( *pObjectModule ); 42 Symbol::RegistNamespaceSupporter( &namespaceSupporter ); 43 } 44 ~Compiler() 45 { 46 delete pObjectModule; 47 Clear(); 48 } 49 void Clear() 50 { 51 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries ) 52 { 53 delete pStaticLibrary; 54 } 55 staticLibraries.clear(); 56 } 57 34 Compiler(); 35 ~Compiler(); 36 37 // 静的リンクの準備を行う(オブジェクトモジュール同士の名前リストの結合など、前処理を行う) 38 void PreStaticLink( const ObjectModules &staticLibraries ); 39 40 // 静的リンクを行う 58 41 void StaticLink( ObjectModules &staticLibraries ); 59 42 … … 103 86 ObjectModules staticLibraries; 104 87 88 ObjectModule *pSelectedObjectModule; 89 105 90 // オブジェクトモジュール 106 91 ObjectModule &GetObjectModule() 107 92 { 108 return *pNowObjectModule; 109 } 110 void SelectObjectModule( ObjectModule &objectModule ) 111 { 112 pNowObjectModule = &objectModule; 113 114 namespaceSupporter.RegistAllNamespaceScopesCollection( &GetObjectModule().meta.GetNamespaces() ); 93 return *pSelectedObjectModule; 94 } 95 96 void SelectObjectModule( ObjectModule *pObjectModule ) 97 { 98 this->pSelectedObjectModule = pObjectModule; 99 } 100 101 // 現在参照すべきソースコード 102 const BasicSource &GetCurrentSource() 103 { 104 return staticLibraries[currentRelationalObjectModuleIndexForSource]->GetSource(); 105 } 106 107 // 現在参照すべきソースコードを格納するオブジェクトモジュールのインデックス 108 int GetCurrentRelationalObjectModuleIndexForSource() const 109 { 110 return currentRelationalObjectModuleIndexForSource; 111 } 112 void SetCurrentRelationalObjectModuleIndexForSource( int currentRelationalObjectModuleIndexForSource ) 113 { 114 this->currentRelationalObjectModuleIndexForSource = currentRelationalObjectModuleIndexForSource; 115 115 } 116 116 -
trunk/ab5.0/abdev/BasicCompiler_Common/include/Program.h
r522 r636 42 42 { 43 43 return outputFilePath; 44 } 45 const std::string GetOutputFileName() const 46 { 47 Jenga::Common::Path path( outputFilePath ); 48 return path.GetFileName() + path.GetExt(); 44 49 } 45 50 void SetOutputFilePath( const std::string &outputFilePath ) -
trunk/ab5.0/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
r603 r636 496 496 #include <logger.h> 497 497 #include <Configuration.h> 498 #include <abdev/ab_common/include/Lexical/Source.h> 498 499 499 500 template class Jenga::Common::BoostSerializationSupport<LoggerSetting>; 500 501 template class Jenga::Common::BoostSerializationSupport<Configuration>; 502 template class Jenga::Common::BoostSerializationSupport<BasicSources>; -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp
r632 r636 5 5 Compiler compiler; 6 6 7 Compiler::Compiler() 8 : isBuildSuccessful( false ) 9 , targetModuleType( ActiveBasic::Common::TargetModuleType::Exe ) 10 , isDebug( false ) 11 , isUnicode( false ) 12 , isCore( false ) 13 , currentRelationalObjectModuleIndexForSource( 0 ) 14 { 15 // 生成先のオブジェクトモジュールを登録 16 ObjectModule *pObjectModule = new ObjectModule(); 17 staticLibraries.push_back( pObjectModule ); 18 SelectObjectModule( pObjectModule ); 19 20 namespaceSupporter.RegistAllNamespaceScopesCollection( &GetObjectModule().meta.GetNamespaces() ); 21 22 Symbol::RegistNamespaceSupporter( &namespaceSupporter ); 23 } 24 Compiler::~Compiler() 25 { 26 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries ) 27 { 28 delete pStaticLibrary; 29 } 30 staticLibraries.clear(); 31 } 32 33 void Compiler::PreStaticLink( const ObjectModules &staticLibraries ) 34 { 35 BOOST_FOREACH( const ObjectModule *pStaticLibrary, staticLibraries ) 36 { 37 // 関連オブジェクトモジュールの名前リスト 38 this->GetObjectModule().relationalObjectModuleNames.push_back( pStaticLibrary->GetName() ); 39 } 40 } 7 41 void Compiler::StaticLink( ObjectModules &staticLibraries ) 8 42 { 9 43 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries ) 10 44 { 45 if( &this->GetObjectModule() == pStaticLibrary ) 46 { 47 // 自分自身の場合はリンクしない 48 continue; 49 } 50 11 51 // メタ情報 12 pNowObjectModule->StaticLink( *pStaticLibrary );52 this->GetObjectModule().StaticLink( *pStaticLibrary ); 13 53 } 14 54 } -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Messenger.cpp
r628 r636 42 42 if( sourceIndex != -1 ) 43 43 { 44 compiler.Get ObjectModule().GetCurrentSource().GetLineInfo( sourceIndex, sourceLineNum, sourceFilePath );44 compiler.GetCurrentSource().GetLineInfo( sourceIndex, sourceLineNum, sourceFilePath ); 45 45 } 46 46
Note:
See TracChangeset
for help on using the changeset viewer.