Changeset 636 in dev
- Timestamp:
- Jun 10, 2008, 11:40:17 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 25 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 -
trunk/ab5.0/abdev/ab_common/include/Lexical/Interface.h
r603 r636 72 72 } 73 73 74 const CClass &GetClass() const{ 74 const CClass &GetClass() const 75 { 75 76 return *pInterfaceClass; 76 77 } -
trunk/ab5.0/abdev/ab_common/include/Lexical/Meta.h
r603 r636 69 69 70 70 // 静的リンク 71 void StaticLink( Meta &meta, long dataSectionBaseOffset, int sourceIndexBase );71 void StaticLink( Meta &meta, long dataSectionBaseOffset, const std::vector<int> &relationTable ); 72 72 73 73 const NamespaceScopesCollection &GetNamespaces() const -
trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h
r603 r636 125 125 int lineNum; 126 126 long nativeCodePos; 127 int sourceIndex;127 int relationalObjectModuleIndex; 128 128 long sourceCodePos; 129 129 DWORD codeType; … … 138 138 ar & BOOST_SERIALIZATION_NVP( lineNum ); 139 139 ar & BOOST_SERIALIZATION_NVP( nativeCodePos ); 140 ar & BOOST_SERIALIZATION_NVP( sourceIndex );140 ar & BOOST_SERIALIZATION_NVP( relationalObjectModuleIndex ); 141 141 ar & BOOST_SERIALIZATION_NVP( sourceCodePos ); 142 142 ar & BOOST_SERIALIZATION_NVP( codeType ); … … 144 144 145 145 public: 146 SourceLine( int lineNum, int nativeCodePos, int sourceIndex, int sourceCodePos, DWORD codeType )146 SourceLine( int lineNum, int nativeCodePos, int relationalObjectModuleIndex, int sourceCodePos, DWORD codeType ) 147 147 : lineNum( lineNum ) 148 148 , nativeCodePos( nativeCodePos ) 149 , sourceIndex( sourceIndex )149 , relationalObjectModuleIndex( relationalObjectModuleIndex ) 150 150 , sourceCodePos( sourceCodePos ) 151 151 , codeType( codeType ) … … 164 164 return nativeCodePos; 165 165 } 166 int Get SourceIndex() const167 { 168 return sourceIndex;169 } 170 void Set SourceIndex( int sourceIndex )171 { 172 this-> sourceIndex = sourceIndex;166 int GetRelationalObjectModuleIndex() const 167 { 168 return relationalObjectModuleIndex; 169 } 170 void SetRelationalObjectModuleIndex( int relationalObjectModuleIndex ) 171 { 172 this->relationalObjectModuleIndex = relationalObjectModuleIndex; 173 173 } 174 174 long GetSourceCodePos() const … … 259 259 260 260 void ResetDataSectionBaseOffset( long dataSectionBaseOffset ); 261 void ResetSourceIndexes( long sourceIndexBase );261 void ResetSourceIndexes( const std::vector<int> &relationTable ); 262 262 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h
r632 r636 6 6 // オブジェクトモジュール名 7 7 std::string name; 8 9 // 関連オブジェクトモジュールの名前リスト 10 Jenga::Common::Strings relationalObjectModuleNames; 8 11 9 12 // メタ情報 … … 18 21 private: 19 22 // ソースコード 20 int currentSourceIndex; 21 BasicSources sources; 23 BasicSource source; 22 24 23 25 // XMLシリアライズ用 … … 33 35 34 36 ar & BOOST_SERIALIZATION_NVP( name ); 37 ar & BOOST_SERIALIZATION_NVP( relationalObjectModuleNames ); 35 38 ar & BOOST_SERIALIZATION_NVP( meta ); 36 39 ar & BOOST_SERIALIZATION_NVP( globalNativeCode ); 37 40 ar & BOOST_SERIALIZATION_NVP( dataTable ); 38 ar & BOOST_SERIALIZATION_NVP( currentSourceIndex ); 39 ar & BOOST_SERIALIZATION_NVP( sources ); 41 ar & BOOST_SERIALIZATION_NVP( source ); 40 42 } 41 43 … … 51 53 this->name = name; 52 54 } 53 int GetCurrentSourceIndex() const55 const BasicSource &GetSource() const 54 56 { 55 return currentSourceIndex;57 return source; 56 58 } 57 const BasicSource &GetCurrentSource() const59 BasicSource &GetSource() 58 60 { 59 return source s[currentSourceIndex];61 return source; 60 62 } 61 BasicSource &GetCurrentSource() 62 { 63 return sources[currentSourceIndex]; 64 } 65 void SetCurrentSourceIndex( int currentSourceIndex ) 66 { 67 this->currentSourceIndex = currentSourceIndex; 68 } 69 const BasicSource &GetSource( int sourceIndex ) const 70 { 71 return sources[sourceIndex]; 72 } 73 BasicSources &GetSources() 74 { 75 return sources; 76 } 63 64 // 下記の関連になるようなテーブルを取得する 65 // 要素 = 古いインデックス、値 = 新しいインデックス 66 const std::vector<int> GetRelationTable( const Jenga::Common::Strings &oldRelationalObjectModule ); 77 67 78 68 bool Read( const std::string &filePath ); -
trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h
r632 r636 11 11 template<class Archive> void serialize(Archive& ar, const unsigned int version) 12 12 { 13 trace_for_serialize( "serializing - IncludedFilesRelation" );14 15 13 ar & BOOST_SERIALIZATION_NVP( filePaths ); 16 14 ar & BOOST_SERIALIZATION_NVP( lineFileNumbers ); … … 119 117 template<class Archive> void load(Archive& ar, const unsigned int version) 120 118 { 121 trace_for_serialize( "serializing(load) - BasicSource" );122 123 119 std::string _buffer; 124 120 ar & BOOST_SERIALIZATION_NVP( _buffer ); … … 139 135 template<class Archive> void save(Archive& ar, const unsigned int version) const 140 136 { 141 trace_for_serialize( "serializing(save) - BasicSource" );142 143 137 // 保存準備 144 138 char *tempCode = (char *)calloc( (length+1) * 3, 1 ); … … 252 246 int cannotIncludeSourcePos; 253 247 }; 254 typedef std::vector<BasicSource> BasicSources; 248 class BasicSources 249 : public std::vector<BasicSource> 250 , public Jenga::Common::BoostSerializationSupport<BasicSources> 251 { 252 // XMLシリアライズ用 253 private: 254 virtual const char *RootTagName() const 255 { 256 return "basicSources"; 257 } 258 friend class boost::serialization::access; 259 template<class Archive> void serialize(Archive& ar, const unsigned int version) 260 { 261 ar & boost::serialization::make_nvp("vector_BasicSource", boost::serialization::base_object<std::vector<BasicSource>>(*this)); 262 } 263 }; 255 264 256 265 class SourceCodePosition -
trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
r632 r636 677 677 } 678 678 679 _ASSERT( false ); 679 680 throw; 680 681 } … … 693 694 } 694 695 696 _ASSERT( false ); 695 697 throw; 696 698 } … … 699 701 if( vtblMasterListOffset == -1 ) 700 702 { 703 _ASSERT( false ); 701 704 throw; 702 705 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp
r632 r636 34 34 } 35 35 36 void Meta::StaticLink( Meta &meta, long dataSectionBaseOffset, int sourceIndexBase )36 void Meta::StaticLink( Meta &meta, long dataSectionBaseOffset, const std::vector<int> &relationTable ) 37 37 { 38 38 // 名前空間 … … 53 53 54 54 pUserProc->GetNativeCode().ResetDataSectionBaseOffset( dataSectionBaseOffset ); 55 pUserProc->GetNativeCode().ResetSourceIndexes( sourceIndexBase );55 pUserProc->GetNativeCode().ResetSourceIndexes( relationTable ); 56 56 57 57 this->userProcs.Put( pUserProc ); … … 75 75 CClass *pClass = meta.GetClasses().Iterator_GetNext(); 76 76 pClass->isTargetObjectModule = false; 77 pClass->Readed(); 77 78 this->GetClasses().Put( pClass ); 78 79 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp
r603 r636 45 45 sourceLine.GetLineNum(), 46 46 baseOffset + sourceLine.GetNativeCodePos(), 47 sourceLine.Get SourceIndex(),47 sourceLine.GetRelationalObjectModuleIndex(), // TODO: 複数libの取り込みを想定できていない(ソースコード行番号とネイティブコード位置の対応情報の追加は静的リンクが完了した後に行うべき) 48 48 sourceLine.GetSourceCodePos(), 49 49 sourceLine.GetCodeType() … … 152 152 } 153 153 } 154 void NativeCode::ResetSourceIndexes( long sourceIndexBase )154 void NativeCode::ResetSourceIndexes( const std::vector<int> &relationTable ) 155 155 { 156 156 BOOST_FOREACH( SourceLine &sourceLine, sourceLines ) 157 157 { 158 sourceLine.Set SourceIndex( sourceLine.GetSourceIndex() + sourceIndexBase);158 sourceLine.SetRelationalObjectModuleIndex( relationTable[sourceLine.GetRelationalObjectModuleIndex()] ); 159 159 } 160 160 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/ObjectModule.cpp
r603 r636 58 58 void ObjectModule::StaticLink( ObjectModule &objectModule ) 59 59 { 60 const std::vector<int> relationTable = this->GetRelationTable( objectModule.relationalObjectModuleNames ); 61 60 62 long dataSectionBaseOffset = dataTable.GetSize(); 61 int sourceIndexBase = (int)sources.size();62 63 63 64 // メタ情報を結合 64 meta.StaticLink( objectModule.meta, dataSectionBaseOffset, sourceIndexBase );65 meta.StaticLink( objectModule.meta, dataSectionBaseOffset, relationTable ); 65 66 66 67 // グローバル ネイティブコードを結合 67 68 objectModule.globalNativeCode.ResetDataSectionBaseOffset( dataSectionBaseOffset ); 68 objectModule.globalNativeCode.ResetSourceIndexes( sourceIndexBase );69 objectModule.globalNativeCode.ResetSourceIndexes( relationTable ); 69 70 globalNativeCode.PutEx( objectModule.globalNativeCode ); 70 71 … … 73 74 dataTable.Add( objectModule.dataTable ); 74 75 75 // ソースコードを結合76 BOOST_FOREACH( const BasicSource &source, objectModule.sources )77 {78 this->sources.push_back( source );79 }80 81 76 // TODO: basbufがいらなくなったら消す 82 77 extern char *basbuf; 83 basbuf = this->sources[0].GetBuffer(); 78 basbuf = this->source.GetBuffer(); 79 } 80 81 const std::vector<int> ObjectModule::GetRelationTable( const Jenga::Common::Strings &oldRelationalObjectModuleNames ) 82 { 83 // 要素 = 古いインデックス、値 = 新しいインデックス 84 std::vector<int> relationTable; 85 86 // リレーションテーブルを構築 87 BOOST_FOREACH( const std::string &oldRelationalObjectModuleName, oldRelationalObjectModuleNames ) 88 { 89 bool isMatch = false; 90 for( int i=0; i<static_cast<int>(this->relationalObjectModuleNames.size()); i++ ) 91 { 92 if( oldRelationalObjectModuleName == this->relationalObjectModuleNames[i] ) 93 { 94 isMatch = true; 95 relationTable.push_back( i ); 96 break; 97 } 98 } 99 100 if( !isMatch ) 101 { 102 // エラー 103 _ASSERT( false ); 104 } 105 } 106 107 return relationTable; 84 108 } 85 109 -
trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp
r632 r636 328 328 } 329 329 330 char *backupBasbuf = NULL; 331 int backupCurrentRelationalObjectModuleIndexForSource = compiler.GetCurrentRelationalObjectModuleIndexForSource(); 332 330 333 if( !pUserProc->IsAutoGeneration() ) 331 334 { 335 // テンプレート展開がされている場合、対象のソースコードが現在のオブジェクトモジュールではない場合がある 336 if( compiler.staticLibraries[compiler.GetCurrentRelationalObjectModuleIndexForSource()]->GetName() != pUserProc->GetSourceCodePosition().GetObjectModuleName() ) 337 { 338 for( int i=0; i<static_cast<int>(compiler.staticLibraries.size()); i++ ) 339 { 340 const ObjectModule *pObjectModule = compiler.staticLibraries[i]; 341 342 if( pObjectModule->GetName() == pUserProc->GetSourceCodePosition().GetObjectModuleName() ) 343 { 344 compiler.SetCurrentRelationalObjectModuleIndexForSource( i ); 345 basbuf = const_cast<char *>(compiler.GetCurrentSource().GetBuffer()); 346 } 347 } 348 } 349 332 350 cp=pUserProc->GetSourceCodePosition().GetPos(); 333 351 for(;;cp++){ -
trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp
r632 r636 120 120 121 121 // 静的リンク 122 compiler.PreStaticLink( compiler.staticLibraries ); 122 123 compiler.StaticLink( compiler.staticLibraries ); 123 124 … … 144 145 { 145 146 ActiveBasic::Compiler::LexicalAnalyzer::CollectEnums( 146 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),147 compiler.GetCurrentSource().GetBuffer(), 147 148 compiler.enumInfoCollection 148 149 ); … … 157 158 // 名前空間情報を取得 158 159 ActiveBasic::Compiler::LexicalAnalyzer::CollectNamespaces( 159 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),160 compiler.GetCurrentSource().GetBuffer(), 160 161 compiler.GetObjectModule().meta.GetNamespaces() 161 162 ); … … 164 165 { 165 166 ActiveBasic::Compiler::LexicalAnalyzer::CollectDelegates( 166 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),167 compiler.GetCurrentSource().GetBuffer(), 167 168 compiler.GetObjectModule().meta.GetDelegates() 168 169 ); … … 180 181 // ※オブジェクトの内容までは取得しない 181 182 ActiveBasic::Compiler::LexicalAnalyzer::CollectClassesForNameOnly( 182 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),183 compiler.GetCurrentSource().GetBuffer(), 183 184 compiler.GetObjectModule().meta.GetClasses() 184 185 ); … … 186 187 //TypeDef情報を収集 187 188 ActiveBasic::Compiler::LexicalAnalyzer::CollectTypeDefs( 188 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),189 compiler.GetCurrentSource().GetBuffer(), 189 190 compiler.GetObjectModule().meta.GetTypeDefs() 190 191 ); … … 201 202 //定数情報を取得 202 203 ActiveBasic::Compiler::LexicalAnalyzer::CollectConsts( 203 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),204 compiler.GetCurrentSource().GetBuffer(), 204 205 compiler.GetObjectModule().meta.GetGlobalConsts(), 205 206 compiler.GetObjectModule().meta.GetGlobalConstMacros() … … 209 210 compiler.SetCompilingClass( NULL ); 210 211 ActiveBasic::Compiler::LexicalAnalyzer::CollectProcedures( 211 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),212 compiler.GetCurrentSource().GetBuffer(), 212 213 compiler.GetObjectModule().meta.GetUserProcs(), 213 214 compiler.GetObjectModule().meta.GetDllProcs() … … 216 217 // クラス情報を取得(※注 - CollectProceduresの後に呼び出す) 217 218 ActiveBasic::Compiler::LexicalAnalyzer::CollectClasses( 218 compiler.Get ObjectModule().GetCurrentSource().GetBuffer(),219 compiler.GetCurrentSource().GetBuffer(), 219 220 compiler.GetObjectModule().meta.GetClasses() 220 221 );
Note:
See TracChangeset
for help on using the changeset viewer.