Changeset 636 in dev for trunk/ab5.0/abdev/ab_common
- Timestamp:
- Jun 10, 2008, 11:40:17 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev/ab_common
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.