- Timestamp:
- Aug 14, 2007, 8:37:08 AM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r279 r280 174 174 // 名前空間情報を取得 175 175 NamespaceSupporter::CollectNamespaces( 176 compiler.GetObjectModule(). source.GetBuffer(),176 compiler.GetObjectModule().GetCurrentSource().GetBuffer(), 177 177 compiler.GetObjectModule().meta.GetNamespaces() 178 178 ); … … 181 181 // CollectProcedures関数の中で参照されるオブジェクト名を事前に取得する。 182 182 // ※オブジェクトの内容までは取得しない 183 compiler.GetObjectModule().meta.GetClasses().CollectClassesForNameOnly( compiler.GetObjectModule(). source);183 compiler.GetObjectModule().meta.GetClasses().CollectClassesForNameOnly( compiler.GetObjectModule().GetCurrentSource() ); 184 184 185 185 //TypeDef情報を初期化 … … 192 192 compiler.pCompilingClass = NULL; 193 193 CollectProcedures( 194 compiler.GetObjectModule(). source,194 compiler.GetObjectModule().GetCurrentSource(), 195 195 compiler.GetObjectModule().meta.GetUserProcs(), 196 196 compiler.GetObjectModule().meta.GetDllProcs() … … 204 204 compiler.GetObjectModule().meta.GetDllProcs().Iterator_Init(); 205 205 206 207 //コードと行番号の関係208 extern SourceLines oldSourceLines;209 oldSourceLines.clear();210 206 211 207 … … 505 501 compiler.linker.Link( compiler.GetObjectModule() ); 506 502 503 extern SourceLines oldSourceLines; 507 504 oldSourceLines = compiler.linker.GetNativeCode().GetSourceLines(); 508 505 -
trunk/abdev/BasicCompiler_Common/BreakPoint.cpp
r279 r280 44 44 } 45 45 46 void CFileBreakPoint::update(char *nativeCodeBuffer){ 46 void CFileBreakPoint::update(char *nativeCodeBuffer) 47 { 47 48 int FileNum; 48 for(FileNum=0;FileNum<compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileCounts();FileNum++){ 49 if(lstrcmpi(compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFilePathFromFileNumber(FileNum).c_str(),lpszFileName)==0) break; 50 } 51 if( FileNum == compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileCounts() ) 49 const IncludedFilesRelation *pIncludedFilesRelation = NULL; 50 BOOST_FOREACH( const BasicSource &source, compiler.GetObjectModule().GetSources() ) 51 { 52 pIncludedFilesRelation = &source.GetIncludedFilesRelation(); 53 54 for(FileNum=0;FileNum<pIncludedFilesRelation->GetFileCounts();FileNum++) 55 { 56 if(lstrcmpi(pIncludedFilesRelation->GetFilePathFromFileNumber(FileNum).c_str(),lpszFileName)==0) break; 57 } 58 if( FileNum == pIncludedFilesRelation->GetFileCounts() ) 59 { 60 pIncludedFilesRelation = NULL; 61 } 62 else 63 { 64 break; 65 } 66 } 67 68 if( !pIncludedFilesRelation ) 69 { 70 Jenga::Throw( "CFileBreakPoint::update内で不正な処理" ); 71 return; 72 } 73 74 int i; 75 for(i=0;;i++){ 76 if( pIncludedFilesRelation->GetFileNumber( i ) == FileNum 77 || pIncludedFilesRelation->GetFileNumber( i ) == -1 ) 78 { 79 break; 80 } 81 } 82 if( pIncludedFilesRelation->GetFileNumber( i ) == -1 ) 52 83 { 53 84 return; 54 85 } 55 86 56 int i;57 for(i=0;;i++){58 if( compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) == FileNum59 || compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) == -1 )60 {61 break;62 }63 }64 if( compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) == -1 )65 {66 return;67 }68 69 87 int FileBaseLine; 70 88 FileBaseLine=i; … … 72 90 int i2,nCount=0; 73 91 for(i2=0;;i2++){ 74 if( compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( FileBaseLine+i2 ) == -1 )92 if( pIncludedFilesRelation->GetFileNumber( FileBaseLine+i2 ) == -1 ) 75 93 { 76 94 //ソースコードの終端行 -
trunk/abdev/BasicCompiler_Common/CDebugThreadInfo.cpp
r206 r280 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 40 40 41 //lplpObp … … 107 108 HeapDefaultFree(lplpSpBase); 108 109 HeapDefaultFree(lpdwCp); 110 HeapDefaultFree(lpdwSourceIndex); 109 111 } 110 112 -
trunk/abdev/BasicCompiler_Common/Debug.cpp
r279 r280 56 56 57 57 int FileNum; 58 for(FileNum=0;FileNum<compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileCounts();FileNum++){ 59 if(lstrcmpi(compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFilePathFromFileNumber(FileNum).c_str(),szFilePath)==0) break; 60 } 61 if( FileNum == compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileCounts() ) 58 const IncludedFilesRelation *pIncludedFilesRelation = NULL; 59 BOOST_FOREACH( const BasicSource &source, compiler.GetObjectModule().GetSources() ) 60 { 61 pIncludedFilesRelation = &source.GetIncludedFilesRelation(); 62 63 for(FileNum=0;FileNum<pIncludedFilesRelation->GetFileCounts();FileNum++) 64 { 65 if(lstrcmpi(pIncludedFilesRelation->GetFilePathFromFileNumber(FileNum).c_str(),szFilePath)==0) break; 66 } 67 if( FileNum == pIncludedFilesRelation->GetFileCounts() ) 68 { 69 pIncludedFilesRelation = NULL; 70 } 71 else 72 { 73 break; 74 } 75 } 76 77 if( !pIncludedFilesRelation ) 62 78 { 63 79 return; … … 65 81 66 82 for(i=0;;i++){ 67 if( compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) == FileNum68 || compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) == -1 )83 if( pIncludedFilesRelation->GetFileNumber( i ) == FileNum 84 || pIncludedFilesRelation->GetFileNumber( i ) == -1 ) 69 85 { 70 86 break; 71 87 } 72 88 } 73 if( compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) == -1 )89 if( pIncludedFilesRelation->GetFileNumber( i ) == -1 ) 74 90 { 75 91 return; … … 82 98 for(i2=0;;i++,i2++) 83 99 { 84 if( FileNum < compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) )100 if( FileNum < pIncludedFilesRelation->GetFileNumber( i ) ) 85 101 { 86 while( FileNum != compiler.GetObjectModule().source.GetIncludedFilesRelation().GetFileNumber( i ) )102 while( FileNum != pIncludedFilesRelation->GetFileNumber( i ) ) 87 103 { 88 104 i++; -
trunk/abdev/BasicCompiler_Common/DebugMiddleFile.cpp
r279 r280 116 116 117 117 *(long *)(buffer+i2) = sourceLine.GetNativeCodePos(); 118 i2+=sizeof(long); 119 120 *(long *)(buffer+i2) = sourceLine.GetSourceIndex(); 118 121 i2+=sizeof(long); 119 122 … … 206 209 i2+=sizeof(long); 207 210 211 int sourceIndex = *(long *)(buffer+i2); 212 i2+=sizeof(long); 213 208 214 int sourceCodePos = *(long *)(buffer+i2); 209 215 i2+=sizeof(long); … … 212 218 i2+=sizeof(long); 213 219 214 _oldSourceLines.push_back( SourceLine( lineNum, nativeCodePos, sourceCodePos, sourceLineType ) ); 220 _oldSourceLines.push_back( 221 SourceLine( 222 lineNum, 223 nativeCodePos, 224 sourceIndex, 225 sourceCodePos, 226 sourceLineType 227 ) 228 ); 215 229 } 216 230 -
trunk/abdev/BasicCompiler_Common/Enum.cpp
r279 r280 115 115 iEnumParentNum=0; 116 116 117 const char *source = compiler.GetObjectModule(). source.GetBuffer();117 const char *source = compiler.GetObjectModule().GetCurrentSource().GetBuffer(); 118 118 119 119 // 名前空間管理 -
trunk/abdev/BasicCompiler_Common/MakeExe.cpp
r279 r280 24 24 25 25 //最後尾に貼り付け 26 compiler.GetObjectModule(). source.Addition( temp );26 compiler.GetObjectModule().GetCurrentSource().Addition( temp ); 27 27 28 28 HeapDefaultFree(temp); … … 57 57 //プログラムをファイルから読み込む 58 58 extern char SourceFileName[MAX_PATH]; 59 if( !compiler.GetObjectModule().source.ReadFile( SourceFileName ) ){ 59 compiler.GetObjectModule().SetCurrentSourceIndex( compiler.GetObjectModule().GetSources().size() ); 60 compiler.GetObjectModule().GetSources().push_back( BasicSource() ); 61 if( !compiler.GetObjectModule().GetCurrentSource().ReadFile( SourceFileName ) ){ 60 62 SetError(201,SourceFileName,-1); 61 63 goto EndCompile; -
trunk/abdev/BasicCompiler_Common/VarList.cpp
r279 r280 576 576 } 577 577 if(i2==oldSourceLines.size()-1) pobj_dti->lpdwCp[i3]=-1; 578 else pobj_dti->lpdwCp[i3]=oldSourceLines[i2].GetSourceCodePos(); 578 else 579 { 580 pobj_dti->lpdwCp[i3]=oldSourceLines[i2].GetSourceCodePos(); 581 pobj_dti->lpdwSourceIndex[i3]=oldSourceLines[i2].GetSourceIndex(); 582 } 579 583 } 580 584 for(i3=0;i3<(int)pobj_dti->iProcLevel+1;i3++){ … … 585 589 pobj_dti->lplpSpBase[i2]=pobj_dti->lplpSpBase[i2+1]; 586 590 pobj_dti->lpdwCp[i2]=pobj_dti->lpdwCp[i2+1]; 591 pobj_dti->lpdwSourceIndex[i2]=pobj_dti->lpdwSourceIndex[i2+1]; 587 592 } 588 593 i3--; … … 592 597 593 598 std::string dummyStr; 594 if(!compiler.GetObjectModule(). source.GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel], i2, dummyStr )){599 if(!compiler.GetObjectModule().GetSource( pobj_dti->lpdwSourceIndex[pobj_dti->iProcLevel] ).GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel], i2, dummyStr )){ 595 600 extern HWND hMainDlg; 596 601 //"デバッグ情報の取得に失敗" … … 674 679 675 680 std::string dummyStr; 676 compiler.GetObjectModule(). source.GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel-i2], i3, dummyStr );681 compiler.GetObjectModule().GetSource( pobj_dti->lpdwSourceIndex[pobj_dti->iProcLevel] ).GetLineInfo( pobj_dti->lpdwCp[pobj_dti->iProcLevel-i2], i3, dummyStr ); 677 682 ShowErrorLine(i3,dummyStr.c_str()); 678 683 -
trunk/abdev/BasicCompiler_Common/debug.h
r4 r280 4 4 //ソースコードポインタ 5 5 DWORD *lpdwCp; 6 DWORD *lpdwSourceIndex; 6 7 7 8 //ネイティブコードポインタ -
trunk/abdev/BasicCompiler_Common/error.cpp
r279 r280 330 330 else{ 331 331 std::string dummyStr; 332 compiler.GetObjectModule(). source.GetLineInfo( pos, pErrorInfo[ErrorNum].line, dummyStr );332 compiler.GetObjectModule().GetCurrentSource().GetLineInfo( pos, pErrorInfo[ErrorNum].line, dummyStr ); 333 333 334 334 pErrorInfo[ErrorNum].FileName=(char *)HeapAlloc(hHeap,0,lstrlen(dummyStr.c_str())+1); -
trunk/abdev/BasicCompiler_Common/include/Meta.h
r273 r280 75 75 76 76 // 静的リンク 77 void StaticLink( Meta &meta, long dataSectionBaseOffset );77 void StaticLink( Meta &meta, long dataSectionBaseOffset, int sourceIndexBase ); 78 78 79 79 const NamespaceScopesCollection &GetNamespaces() const -
trunk/abdev/BasicCompiler_Common/include/NativeCode.h
r279 r280 130 130 int lineNum; 131 131 long nativeCodePos; 132 int sourceIndex; 132 133 long sourceCodePos; 133 134 DWORD codeType; … … 142 143 ar & BOOST_SERIALIZATION_NVP( lineNum ); 143 144 ar & BOOST_SERIALIZATION_NVP( nativeCodePos ); 145 ar & BOOST_SERIALIZATION_NVP( sourceIndex ); 144 146 ar & BOOST_SERIALIZATION_NVP( sourceCodePos ); 145 147 ar & BOOST_SERIALIZATION_NVP( codeType ); … … 147 149 148 150 public: 149 SourceLine( int lineNum, int nativeCodePos, int source CodePos, DWORD codeType )151 SourceLine( int lineNum, int nativeCodePos, int sourceIndex, int sourceCodePos, DWORD codeType ) 150 152 : lineNum( lineNum ) 151 153 , nativeCodePos( nativeCodePos ) 154 , sourceIndex( sourceIndex ) 152 155 , sourceCodePos( sourceCodePos ) 153 156 , codeType( codeType ) … … 165 168 { 166 169 return nativeCodePos; 170 } 171 int GetSourceIndex() const 172 { 173 return sourceIndex; 174 } 175 void SetSourceIndex( int sourceIndex ) 176 { 177 this->sourceIndex = sourceIndex; 167 178 } 168 179 long GetSourceCodePos() const … … 366 377 367 378 void ResetDataSectionBaseOffset( long dataSectionBaseOffset ); 379 void ResetSourceIndexes( long sourceIndexBase ); 368 380 }; -
trunk/abdev/BasicCompiler_Common/include/ObjectModule.h
r279 r280 13 13 DataTable dataTable; 14 14 15 private: 15 16 // ソースコード 16 BasicSource source; 17 int currentSourceIndex; 18 BasicSources sources; 17 19 18 20 // XMLシリアライズ用 … … 30 32 ar & BOOST_SERIALIZATION_NVP( globalNativeCode ); 31 33 ar & BOOST_SERIALIZATION_NVP( dataTable ); 32 ar & BOOST_SERIALIZATION_NVP( source ); 34 ar & BOOST_SERIALIZATION_NVP( currentSourceIndex ); 35 ar & BOOST_SERIALIZATION_NVP( sources ); 33 36 } 34 37 35 38 public: 36 39 void StaticLink( ObjectModule &objectModule ); 40 41 int GetCurrentSourceIndex() const 42 { 43 return currentSourceIndex; 44 } 45 const BasicSource &GetCurrentSource() const 46 { 47 return sources[currentSourceIndex]; 48 } 49 BasicSource &GetCurrentSource() 50 { 51 return sources[currentSourceIndex]; 52 } 53 void SetCurrentSourceIndex( int currentSourceIndex ) 54 { 55 this->currentSourceIndex = currentSourceIndex; 56 } 57 const BasicSource &GetSource( int sourceIndex ) const 58 { 59 return sources[sourceIndex]; 60 } 61 BasicSources &GetSources() 62 { 63 return sources; 64 } 37 65 38 66 bool Read( const std::string &filePath ); -
trunk/abdev/BasicCompiler_Common/include/Source.h
r279 r280 11 11 12 12 #include <BoostSerializationSupport.h> 13 14 using namespace std;15 16 struct INCLUDEFILEINFO{17 char **ppFileNames;18 int FilesNum;19 int LineOfFile[MAX_LEN];20 };21 13 22 14 class IncludedFilesRelation … … 87 79 buffer = (char *)calloc( 1, 1 ); 88 80 length = 0; 81 } 82 Text( const Text &text ) 83 : length( text.length ) 84 { 85 buffer = (char *)malloc( length + 1 ); 86 memcpy( buffer, text.buffer, length ); 87 buffer[length] = 0; 89 88 } 90 89 ~Text(){ … … 195 194 public: 196 195 BasicSource(){} 196 BasicSource( const BasicSource &basicSource ) 197 : Text( basicSource ) 198 , includedFilesRelation( basicSource.includedFilesRelation ) 199 { 200 } 197 201 ~BasicSource(){} 198 202 … … 222 226 void Addition( const char *buffer ); 223 227 224 bool GetLineInfo( int sourceCodePos, int &line, std::string &fileName ) ;228 bool GetLineInfo( int sourceCodePos, int &line, std::string &fileName ) const; 225 229 226 230 void operator = ( const BasicSource &source ){ … … 238 242 } 239 243 }; 244 typedef std::vector<BasicSource> BasicSources; -
trunk/abdev/BasicCompiler_Common/src/Meta.cpp
r275 r280 36 36 } 37 37 38 void Meta::StaticLink( Meta &meta, long dataSectionBaseOffset )38 void Meta::StaticLink( Meta &meta, long dataSectionBaseOffset, int sourceIndexBase ) 39 39 { 40 40 // 名前空間 … … 55 55 56 56 pUserProc->GetNativeCode().ResetDataSectionBaseOffset( dataSectionBaseOffset ); 57 pUserProc->GetNativeCode().ResetSourceIndexes( sourceIndexBase ); 57 58 58 59 this->userProcs.Put( pUserProc ); -
trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp
r276 r280 1 1 #include "stdafx.h" 2 2 3 #include <NativeCode.h> 4 #include <Procedure.h> 3 #include <Compiler.h> 5 4 6 5 #define BREAK_EIP(checkEip) (obp+0x00401000>=checkEip) … … 32 31 sourceLine.GetLineNum(), 33 32 baseOffset + sourceLine.GetNativeCodePos(), 33 sourceLine.GetSourceIndex(), 34 34 sourceLine.GetSourceCodePos(), 35 35 sourceLine.GetCodeType() … … 86 86 sourceLineType |= CODETYPE_SYSTEMPROC; 87 87 } 88 sourceLines.push_back( SourceLine( (long)sourceLines.size(), size, cp, sourceLineType ) ); 88 sourceLines.push_back( 89 SourceLine( 90 (long)sourceLines.size(), 91 size, 92 compiler.GetObjectModule().GetCurrentSourceIndex(), 93 cp, 94 sourceLineType 95 ) 96 ); 89 97 } 90 98 … … 102 110 } 103 111 } 112 void NativeCode::ResetSourceIndexes( long sourceIndexBase ) 113 { 114 BOOST_FOREACH( SourceLine &sourceLine, sourceLines ) 115 { 116 sourceLine.SetSourceIndex( sourceLine.GetSourceIndex() + sourceIndexBase ); 117 } 118 } -
trunk/abdev/BasicCompiler_Common/src/ObjectModule.cpp
r279 r280 14 14 void ObjectModule::StaticLink( ObjectModule &objectModule ) 15 15 { 16 long dataSectionBaseOffset = dataTable.GetSize(); 17 int sourceIndexBase = sources.size(); 18 16 19 // メタ情報を結合 17 meta.StaticLink( objectModule.meta, data Table.GetSize());20 meta.StaticLink( objectModule.meta, dataSectionBaseOffset, sourceIndexBase ); 18 21 19 22 // ネイティブコードを結合 23 objectModule.globalNativeCode.ResetDataSectionBaseOffset( dataSectionBaseOffset ); 24 objectModule.globalNativeCode.ResetSourceIndexes( sourceIndexBase ); 20 25 globalNativeCode.Put( objectModule.globalNativeCode ); 21 globalNativeCode.ResetDataSectionBaseOffset( dataTable.GetSize() );22 26 23 27 // データテーブルを結合 24 28 dataTable.Add( objectModule.dataTable ); 29 30 // ソースコードを結合 31 BOOST_FOREACH( const BasicSource &source, objectModule.sources ) 32 { 33 this->sources.push_back( source ); 34 } 25 35 } 26 36 -
trunk/abdev/BasicCompiler_Common/src/Source.cpp
r279 r280 921 921 } 922 922 923 bool BasicSource::GetLineInfo( int sourceCodePos, int &line, std::string &filePath ) 923 bool BasicSource::GetLineInfo( int sourceCodePos, int &line, std::string &filePath ) const 924 924 { 925 925 int i2,i3,i4,i5; 926 926 927 c har *buffer = GetBuffer();927 const char *buffer = GetBuffer(); 928 928 int i = sourceCodePos; 929 929
Note:
See TracChangeset
for help on using the changeset viewer.