Changeset 637 in dev for trunk/ab5.0/abdev/ab_common
- Timestamp:
- Jun 11, 2008, 10:10:26 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev/ab_common
- Files:
-
- 1 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/ab_common/ab_common.vcproj
r632 r637 530 530 </File> 531 531 <File 532 RelativePath=".\include\Lexical\RelationalObjectModuleItem.h" 533 > 534 </File> 535 <File 532 536 RelativePath=".\include\Lexical\Source.h" 533 537 > -
trunk/ab5.0/abdev/ab_common/include/Environment.h
r608 r637 27 27 { 28 28 static std::string rootPath; 29 static bool isRemoveExternal; 29 30 public: 30 31 static void SetAbdevRootPath( const std::string &rootPath ); … … 38 39 39 40 static const std::string GetCompilerExePath( Platform::EnumType platform ); 41 42 static bool IsRemoveExternal() 43 { 44 return isRemoveExternal; 45 } 46 static void SetRemoveExternalMark( bool isRemoveExternalMark ) 47 { 48 Environment::isRemoveExternal = isRemoveExternalMark; 49 } 40 50 }; 41 51 -
trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h
r632 r637 18 18 19 19 public: 20 ClassPrototype( const NamespaceScopes &namespaceScopes, const std::string &name)21 : Prototype( namespaceScopes, name)20 ClassPrototype( const Symbol &symbol ) 21 : Prototype( symbol ) 22 22 , DynamicMethodsPrototype() 23 23 { … … 92 92 93 93 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( ClassPrototype ); 94 95 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 96 { 97 if( this->IsExternal() ) 98 { 99 this->NeedResolve(); 100 return; 101 } 102 } 103 94 104 ar & BOOST_SERIALIZATION_NVP( classType ); 95 105 ar & BOOST_SERIALIZATION_NVP( importedNamespaces ); … … 112 122 public: 113 123 114 CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name);115 CClass( const NamespaceScopes &namespaceScopes,124 CClass( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces ); 125 CClass( const Symbol &symbol, 116 126 const NamespaceScopesCollection &importedNamespaces, 117 const std::string &name,ClassType classType,127 ClassType classType, 118 128 const GenericTypes &formalGenericTypes, 119 129 const Types &superClassActualTypeParameters, … … 455 465 std::string GetStaticDefiningStringAsMemberOffsets() const; 456 466 void GetReferenceOffsetsInitializeBuffer( std::string &referenceOffsetsBuffer, int &numOfReference, int baseOffset = 0 ) const; 467 468 virtual bool Resolve(); 457 469 }; 458 470 -
trunk/ab5.0/abdev/ab_common/include/Lexical/Const.h
r603 r637 2 2 3 3 //定数 4 class CConst : public Symbol, public Jenga::Common::ObjectInHashmap<CConst> 4 class CConst 5 : public RelationalObjectModuleItem 6 , public Jenga::Common::ObjectInHashmap<CConst> 5 7 { 6 8 Type type; … … 14 16 trace_for_serialize( "serializing - CConst" ); 15 17 16 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 18 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem ); 19 20 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 21 { 22 if( this->IsExternal() ) 23 { 24 this->NeedResolve(); 25 return; 26 } 27 } 28 17 29 ar & BOOST_SERIALIZATION_NVP( type ); 18 30 ar & BOOST_SERIALIZATION_NVP( i64data ); … … 20 32 21 33 public: 22 CConst( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &newType, _int64 i64data)23 : Symbol( namespaceScopes, name)34 CConst( const Symbol &symbol, const Type &newType, _int64 i64data) 35 : RelationalObjectModuleItem( symbol ) 24 36 , type( newType ) 25 37 , i64data( i64data ) 26 38 { 27 39 } 28 CConst( const NamespaceScopes &namespaceScopes, const std::string &name, int value)29 : Symbol( namespaceScopes, name)40 CConst( const Symbol &symbol, int value) 41 : RelationalObjectModuleItem( symbol ) 30 42 , type( Type(DEF_LONG) ) 31 43 , i64data( value ) … … 53 65 } 54 66 double GetDoubleData(); 67 68 virtual bool Resolve(); 55 69 }; 56 70 class Consts : public Jenga::Common::Hashmap<CConst> … … 69 83 public: 70 84 71 void Add( const NamespaceScopes &namespaceScopes, const std::string &name, _int64 i64data, const Type &type );72 void Add( const NamespaceScopes &namespaceScopes, const std::string &name, int value);85 void Add( const Symbol &symbol, _int64 i64data, const Type &type ); 86 void Add( const Symbol &symbol, int value); 73 87 74 88 private: … … 83 97 84 98 //定数マクロ 85 class ConstMacro : public Symbol, public Jenga::Common::ObjectInHashmap<ConstMacro> 99 class ConstMacro 100 : public RelationalObjectModuleItem 101 , public Jenga::Common::ObjectInHashmap<ConstMacro> 86 102 { 87 103 std::vector<std::string> parameters; … … 95 111 trace_for_serialize( "serializing - ConstMacro" ); 96 112 97 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 113 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem ); 114 115 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 116 { 117 if( this->IsExternal() ) 118 { 119 this->NeedResolve(); 120 return; 121 } 122 } 123 98 124 ar & BOOST_SERIALIZATION_NVP( parameters ); 99 125 ar & BOOST_SERIALIZATION_NVP( expression ); … … 101 127 102 128 public: 103 ConstMacro( const NamespaceScopes &namespaceScopes, const std::string &name, const std::vector<std::string> ¶meters, const std::string &expression )104 : Symbol( namespaceScopes, name)129 ConstMacro( const Symbol &symbol, const std::vector<std::string> ¶meters, const std::string &expression ) 130 : RelationalObjectModuleItem( symbol ) 105 131 , parameters( parameters ) 106 132 , expression( expression ) … … 127 153 return expression; 128 154 } 155 156 virtual bool Resolve(); 129 157 }; 130 class ConstMacros : public Jenga::Common::Hashmap<ConstMacro> 158 class ConstMacros 159 : public Jenga::Common::Hashmap<ConstMacro> 131 160 { 132 161 // XMLシリアライズ用 … … 142 171 143 172 public: 144 bool Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr );173 bool Add( const Symbol &symbol, const char *parameterStr ); 145 174 ConstMacro *Find( const Symbol &name ); 146 175 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/DataTable.h
r603 r637 149 149 150 150 void ResetDataSectionBaseOffset( long dataSectionBaseOffset ); 151 152 void Resolve(); 151 153 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/Delegate.h
r603 r637 22 22 23 23 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 24 25 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 26 { 27 if( this->IsExternal() ) 28 { 29 this->NeedResolve(); 30 return; 31 } 32 } 33 24 34 ar & BOOST_SERIALIZATION_NVP( importedNamespaces ); 25 35 ar & BOOST_SERIALIZATION_NVP( dynamicParams ); … … 27 37 28 38 public: 29 Delegate( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Procedure::Kind procKind, const char *paramStr, const std::string &returnTypeName, int sourceIndex )30 : Procedure( namespaceScopes, name, procKind, false )39 Delegate( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces, Procedure::Kind procKind, const char *paramStr, const std::string &returnTypeName, int sourceIndex ) 40 : Procedure( symbol, procKind, false ) 31 41 , importedNamespaces( importedNamespaces ) 32 42 , paramStr( paramStr ) … … 81 91 */ 82 92 bool IsSimilar( const Delegate &dgt ) const; 93 94 virtual bool Resolve(); 83 95 }; 84 96 typedef Jenga::Common::Hashmap<Delegate> Delegates; -
trunk/ab5.0/abdev/ab_common/include/Lexical/Meta.h
r636 r637 157 157 158 158 const CClass *FindClassSupportedTypeDef( const Symbol &symbol ); 159 160 void Resolve(); 159 161 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h
r636 r637 123 123 class SourceLine 124 124 { 125 int lineNum;126 125 long nativeCodePos; 127 int relationalObjectModuleIndex;128 long sourceCodePos;129 126 DWORD codeType; 127 SourceCodePosition sourceCodePosition; 130 128 131 129 // XMLシリアライズ用 … … 136 134 trace_for_serialize( "serializing - SourceLine" ); 137 135 138 ar & BOOST_SERIALIZATION_NVP( lineNum );139 136 ar & BOOST_SERIALIZATION_NVP( nativeCodePos ); 140 ar & BOOST_SERIALIZATION_NVP( relationalObjectModuleIndex );141 ar & BOOST_SERIALIZATION_NVP( sourceCodePos );142 137 ar & BOOST_SERIALIZATION_NVP( codeType ); 143 } 144 145 public: 146 SourceLine( int lineNum, int nativeCodePos, int relationalObjectModuleIndex, int sourceCodePos, DWORD codeType ) 147 : lineNum( lineNum ) 148 , nativeCodePos( nativeCodePos ) 149 , relationalObjectModuleIndex( relationalObjectModuleIndex ) 150 , sourceCodePos( sourceCodePos ) 138 ar & BOOST_SERIALIZATION_NVP( sourceCodePosition ); 139 } 140 141 public: 142 SourceLine( int nativeCodePos, DWORD codeType, const SourceCodePosition &sourceCodePosition ) 143 : nativeCodePos( nativeCodePos ) 151 144 , codeType( codeType ) 145 , sourceCodePosition( sourceCodePosition ) 152 146 { 153 147 } … … 156 150 } 157 151 158 int GetLineNum() const159 {160 return lineNum;161 }162 152 long GetNativeCodePos() const 163 153 { 164 154 return nativeCodePos; 165 155 } 166 int GetRelationalObjectModuleIndex() const167 {168 return relationalObjectModuleIndex;169 }170 void SetRelationalObjectModuleIndex( int relationalObjectModuleIndex )171 {172 this->relationalObjectModuleIndex = relationalObjectModuleIndex;173 }174 long GetSourceCodePos() const175 {176 return sourceCodePos;177 }178 void SetSourceCodePos( int sourceCodePos )179 {180 this->sourceCodePos = sourceCodePos;181 }182 156 DWORD GetCodeType() const 183 157 { 184 158 return codeType; 159 } 160 const SourceCodePosition &GetSourceCodePosition() const 161 { 162 return sourceCodePosition; 163 } 164 SourceCodePosition &GetSourceCodePosition() 165 { 166 return sourceCodePosition; 167 } 168 void SetSourceCodePosition( const SourceCodePosition &sourceCodePosition ) 169 { 170 this->sourceCodePosition = sourceCodePosition; 185 171 } 186 172 bool IsInSystemProc() const … … 256 242 return sourceLines; 257 243 } 258 void NextSourceLine( int currentSourceIndex, int nowLine);244 void NextSourceLine( const SourceCodePosition &sourceCodePosition ); 259 245 260 246 void ResetDataSectionBaseOffset( long dataSectionBaseOffset ); 261 void ResetSourceIndexes( const std::vector<int> &relationTable ); 247 void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable ); 248 249 void Resolve(); 262 250 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h
r636 r637 43 43 44 44 public: 45 void StaticLink( ObjectModule &objectModule );46 45 47 46 const std::string &GetName() const … … 62 61 } 63 62 63 // 静的リンクを行う 64 void StaticLink( ObjectModule &objectModule, bool isSll ); 65 66 // 依存関係の解決を行う 67 void Resolve(); 68 64 69 // 下記の関連になるようなテーブルを取得する 65 70 // 要素 = 古いインデックス、値 = 新しいインデックス -
trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h
r632 r637 1 1 #pragma once 2 2 3 class Procedure : public Symbol 3 class Procedure 4 : public RelationalObjectModuleItem 4 5 { 5 6 public: … … 35 36 trace_for_serialize( "serializing - Procedure" ); 36 37 37 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol);38 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem ); 38 39 ar & BOOST_SERIALIZATION_NVP( kind ); 39 40 ar & BOOST_SERIALIZATION_NVP( isCdecl ); … … 45 46 46 47 public: 47 Procedure( const NamespaceScopes &namespaceScopes, const std::string &name, Kind kind, bool isCdecl )48 : Symbol( namespaceScopes, name)48 Procedure( const Symbol &symbol, Kind kind, bool isCdecl ) 49 : RelationalObjectModuleItem( symbol ) 49 50 , kind( kind ) 50 51 , isCdecl( isCdecl ) … … 91 92 this->sourceCodePosition = sourceCodePosition; 92 93 } 94 virtual void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable ); 93 95 94 96 const Parameters &Params() const … … 156 158 157 159 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 160 161 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 162 { 163 if( this->IsExternal() ) 164 { 165 this->NeedResolve(); 166 return; 167 } 168 } 169 158 170 ar & BOOST_SERIALIZATION_NVP( _paramStr ); 159 171 ar & BOOST_SERIALIZATION_NVP( importedNamespaces ); … … 178 190 public: 179 191 180 UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport );192 UserProc( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces, Kind kind, bool isMacro, bool isCdecl, bool isExport ); 181 193 UserProc( const UserProc &userProc, const CClass *pParentClass ); 182 194 UserProc(); … … 206 218 } 207 219 220 virtual void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable ); 221 208 222 /*! 209 223 @brief オーバーライド用に関数同士が等しいかどうかをチェックする … … 360 374 const CMethod &GetMethod() const; 361 375 376 virtual bool Resolve(); 362 377 363 378 static const UserProc *pGlobalProc; … … 389 404 }; 390 405 391 class DllProc : public Procedure, public Jenga::Common::ObjectInHashmap<DllProc> 406 class DllProc 407 : public Procedure 408 , public Jenga::Common::ObjectInHashmap<DllProc> 392 409 { 393 410 std::string dllFileName; … … 403 420 404 421 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 422 423 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 424 { 425 if( this->IsExternal() ) 426 { 427 this->NeedResolve(); 428 return; 429 } 430 } 431 405 432 ar & BOOST_SERIALIZATION_NVP( dllFileName ); 406 433 ar & BOOST_SERIALIZATION_NVP( alias ); … … 409 436 410 437 public: 411 DllProc( const NamespaceScopes &namespaceScopes, const std::string &name, Kind kind, bool isCdecl, const std::string &dllFileName, const std::string &alias )412 : Procedure( namespaceScopes, name, kind, isCdecl )438 DllProc( const Symbol &symbol, Kind kind, bool isCdecl, const std::string &dllFileName, const std::string &alias ) 439 : Procedure( symbol, kind, isCdecl ) 413 440 , dllFileName( dllFileName ) 414 441 , alias( alias ) … … 454 481 return lookupAddress; 455 482 } 483 484 virtual bool Resolve(); 456 485 }; 457 486 class DllProcs : public Jenga::Common::Hashmap<DllProc> … … 469 498 }; 470 499 471 class ProcPointer : public Procedure 500 class ProcPointer 501 : public Procedure 472 502 { 473 503 // XMLシリアライズ用 … … 483 513 public: 484 514 ProcPointer( Kind kind ) 485 : Procedure( NamespaceScopes(), std::string(), kind, false )515 : Procedure( Symbol( NamespaceScopes(), std::string() ), kind, false ) 486 516 { 487 517 } … … 489 519 { 490 520 } 491 ~ProcPointer(){} 521 ~ProcPointer() 522 { 523 } 524 525 virtual bool Resolve(); 492 526 }; 493 527 -
trunk/ab5.0/abdev/ab_common/include/Lexical/Prototype.h
r540 r637 4 4 5 5 6 class Prototype : public Symbol 6 class Prototype 7 : public RelationalObjectModuleItem 7 8 { 8 9 public: … … 23 24 template<class Archive> void serialize(Archive& ar, const unsigned int version) 24 25 { 25 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol);26 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem ); 26 27 ar & BOOST_SERIALIZATION_NVP( isUsing ); 27 28 } … … 30 31 public: 31 32 32 Prototype( const NamespaceScopes &namespaceScopes, const std::string &name)33 : Symbol( namespaceScopes, name)33 Prototype( const Symbol &symbol ) 34 : RelationalObjectModuleItem( symbol ) 34 35 , isUsing( false ) 35 36 { 36 37 } 37 38 Prototype() 38 : Symbol()39 39 { 40 40 } -
trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h
r636 r637 265 265 class SourceCodePosition 266 266 { 267 std::string objectModuleName;267 int relationalObjectModuleIndex; 268 268 int pos; 269 269 … … 273 273 template<class Archive> void serialize(Archive& ar, const unsigned int version) 274 274 { 275 trace_for_serialize( "serializing - IncludedFilesRelation" ); 276 277 ar & BOOST_SERIALIZATION_NVP( objectModuleName ); 275 ar & BOOST_SERIALIZATION_NVP( relationalObjectModuleIndex ); 278 276 ar & BOOST_SERIALIZATION_NVP( pos ); 279 277 } 280 278 281 279 public: 282 SourceCodePosition( const std::string &objectModuleName, int pos )283 : objectModuleName( objectModuleName)280 SourceCodePosition( int relationalObjectModuleIndex, int pos ) 281 : relationalObjectModuleIndex( relationalObjectModuleIndex ) 284 282 , pos( pos ) 285 283 { 286 284 } 287 285 SourceCodePosition() 288 : pos( -1 ) 289 { 290 } 291 292 const std::string &GetObjectModuleName() const 293 { 294 return objectModuleName; 286 : relationalObjectModuleIndex( -1 ) 287 , pos( -1 ) 288 { 289 } 290 291 int GetRelationalObjectModuleIndex() const; 292 void SetRelationalObjectModuleIndex( int relationalObjectModuleIndex ) 293 { 294 this->relationalObjectModuleIndex = relationalObjectModuleIndex; 295 295 } 296 296 int GetPos() const … … 298 298 return pos; 299 299 } 300 }; 300 void SetPos( int pos ) 301 { 302 this->pos = pos; 303 } 304 305 bool IsNothing() const; 306 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/Symbol.h
r603 r637 38 38 39 39 public: 40 bool isTargetObjectModule;41 40 Symbol( const NamespaceScopes &namespaceScopes, const std::string &name ) 42 41 : namespaceScopes( namespaceScopes ) 43 42 , name( name ) 44 , isTargetObjectModule( true )45 43 { 46 44 } … … 48 46 : namespaceScopes( symbol.namespaceScopes ) 49 47 , name( symbol.name ) 50 , isTargetObjectModule( true )51 48 { 52 49 } 53 50 Symbol() 54 : isTargetObjectModule( true )55 51 { 56 52 } -
trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h
r632 r637 318 318 319 319 public: 320 bool isTargetObjectModule;321 320 BlittableType( const Type &basicType, CClass *pClass ) 322 321 : basicType( basicType ) 323 322 , pClass( pClass ) 324 , isTargetObjectModule( true )325 323 { 326 324 } 327 325 BlittableType() 328 : isTargetObjectModule( true )329 326 { 330 327 } -
trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h
r632 r637 3 3 class TypeDefCollection; 4 4 5 class TypeDef : public Symbol 5 class TypeDef 6 : public RelationalObjectModuleItem 6 7 { 7 8 friend TypeDefCollection; … … 17 18 trace_for_serialize( "serializing - TypeDef" ); 18 19 19 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 20 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem ); 21 22 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 23 { 24 if( this->IsExternal() ) 25 { 26 this->NeedResolve(); 27 return; 28 } 29 } 30 20 31 ar & BOOST_SERIALIZATION_NVP( baseName ); 21 32 ar & BOOST_SERIALIZATION_NVP( baseType ); … … 23 34 24 35 public: 25 TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, const Type &baseType );36 TypeDef( const Symbol &symbol, const std::string &baseName, const Type &baseType ); 26 37 TypeDef() 27 38 { … … 39 50 return baseType; 40 51 } 52 53 virtual bool Resolve(); 41 54 }; 42 55 … … 58 71 ~TypeDefCollection(); 59 72 60 void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine );73 void Add( const Symbol &symbol, const std::string &baseName, int nowLine ); 61 74 const TypeDef *Find( const Symbol &symbol ) const; 62 75 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/Variable.h
r603 r637 1 1 #pragma once 2 2 3 class Variable : public Symbol 3 class Variable 4 : public RelationalObjectModuleItem 4 5 { 5 6 Type type; … … 36 37 trace_for_serialize( "serializing - Variable" ); 37 38 38 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 39 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem ); 40 41 if( ActiveBasic::Common::Environment::IsRemoveExternal() ) 42 { 43 if( this->IsExternal() ) 44 { 45 this->NeedResolve(); 46 return; 47 } 48 } 49 39 50 ar & BOOST_SERIALIZATION_NVP( type ); 40 51 ar & BOOST_SERIALIZATION_NVP( isConst ); … … 53 64 public: 54 65 Variable( const Symbol &symbol, const Type &type, bool isConst, bool isRef, const std::string ¶mStrForConstructor, bool hasInitData ); 55 Variable( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &type, bool isConst, bool isRef, const std::string ¶mStrForConstructor, bool hasInitData );56 66 Variable( const Variable &var ); 57 67 Variable(); … … 165 175 } 166 176 177 virtual bool Resolve(); 178 167 179 168 180 bool isLiving; -
trunk/ab5.0/abdev/ab_common/include/ab_common.h
r632 r637 8 8 #include "Lexical/NamespaceSupporter.h" 9 9 #include "Lexical/Symbol.h" 10 #include "Lexical/RelationalObjectModuleItem.h" 10 11 #include "Lexical/Prototype.h" 11 12 #include "Lexical/TypeMisc.h" … … 13 14 using namespace ActiveBasic::Common::Lexical; 14 15 16 #include "Lexical/Source.h" 15 17 #include "Lexical/NativeCode.h" 16 #include "Lexical/Source.h"17 18 #include "Lexical/Type.h" 18 19 #include "Lexical/Method.h" -
trunk/ab5.0/abdev/ab_common/src/Environment.cpp
r517 r637 2 2 3 3 std::string ActiveBasic::Common::Environment::rootPath; 4 bool ActiveBasic::Common::Environment::isRemoveExternal = false; 4 5 5 6 using namespace ActiveBasic::Common; -
trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
r636 r637 2 2 3 3 4 CClass::CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name)5 : ClassPrototype( namespaceScopes, name)4 CClass::CClass( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces ) 5 : ClassPrototype( symbol ) 6 6 , importedNamespaces( importedNamespaces ) 7 7 , classType( Class ) … … 21 21 } 22 22 23 CClass::CClass( const NamespaceScopes &namespaceScopes, 23 CClass::CClass( 24 const Symbol &symbol, 24 25 const NamespaceScopesCollection &importedNamespaces, 25 const std::string &name,26 26 ClassType classType, 27 27 const GenericTypes &formalGenericTypes, … … 31 31 int vtblNum, 32 32 int fixedAlignment ) 33 : ClassPrototype( namespaceScopes, name)33 : ClassPrototype( symbol ) 34 34 , importedNamespaces( importedNamespaces ) 35 35 , classType( classType ) … … 868 868 } 869 869 } 870 871 bool CClass::Resolve() 872 { 873 // TODO: Resolve 874 return true; 875 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Const.cpp
r603 r637 7 7 } 8 8 9 void Consts::Add( const NamespaceScopes &namespaceScopes, const std::string &name, _int64 i64data, const Type &type)9 bool CConst::Resolve() 10 10 { 11 CConst *newconst = new CConst(namespaceScopes, name, type, i64data); 11 // TODO: Resolve 12 return true; 13 } 14 15 void Consts::Add( const Symbol &symbol, _int64 i64data, const Type &type ) 16 { 17 CConst *newconst = new CConst( symbol, type, i64data ); 12 18 13 19 //ハッシュリストに追加 14 20 Put( newconst ); 15 21 } 16 void Consts::Add(const NamespaceScopes &namespaceScopes, const std::string &name, int value){17 CConst *newconst = new CConst( namespaceScopes, name, value);22 void Consts::Add(const Symbol &symbol, int value){ 23 CConst *newconst = new CConst( symbol, value); 18 24 19 25 //ハッシュリストに追加 … … 72 78 } 73 79 80 bool ConstMacro::Resolve() 81 { 82 // TODO: Resolve 83 return true; 84 } 85 74 86 // マクロ定数を追加するための関数 75 bool ConstMacros::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr )87 bool ConstMacros::Add( const Symbol &symbol, const char *parameterStr ) 76 88 { 77 89 std::vector<std::string> parameters; … … 113 125 lstrcpy(temporary,parameterStr+i+1); 114 126 115 this->Put( new ConstMacro( namespaceScopes, name, parameters, temporary ) );127 this->Put( new ConstMacro( symbol, parameters, temporary ) ); 116 128 117 129 return true; -
trunk/ab5.0/abdev/ab_common/src/Lexical/DataTable.cpp
r603 r637 77 77 } 78 78 } 79 80 void DataTable::Resolve() 81 { 82 // TODO: Resolve 83 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Delegate.cpp
r603 r637 18 18 return false; 19 19 } 20 21 bool Delegate::Resolve() 22 { 23 // TODO: Resolve 24 return true; 25 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp
r636 r637 50 50 { 51 51 UserProc *pUserProc = meta.GetUserProcs().Iterator_GetNext(); 52 pUserProc->isTargetObjectModule = false; 52 if( pUserProc->IsExternal() ) 53 { 54 // 外部参照の場合は取り込まない 55 continue; 56 } 57 58 pUserProc->ResetRelationalObjectModuleIndex( relationTable ); 53 59 54 60 pUserProc->GetNativeCode().ResetDataSectionBaseOffset( dataSectionBaseOffset ); 55 pUserProc->GetNativeCode().ResetSourceIndexes( relationTable );56 61 57 62 this->userProcs.Put( pUserProc ); … … 64 69 { 65 70 DllProc *pDllProc = meta.GetDllProcs().Iterator_GetNext(); 66 pDllProc->isTargetObjectModule = false; 71 if( pDllProc->IsExternal() ) 72 { 73 // 外部参照の場合は取り込まない 74 continue; 75 } 76 77 pDllProc->ResetRelationalObjectModuleIndex( relationTable ); 67 78 this->dllProcs.Put( pDllProc ); 68 79 } … … 74 85 { 75 86 CClass *pClass = meta.GetClasses().Iterator_GetNext(); 76 pClass->isTargetObjectModule = false; 87 if( pClass->IsExternal() ) 88 { 89 // 外部参照の場合は取り込まない 90 continue; 91 } 92 93 pClass->ResetRelationalObjectModuleIndex( relationTable ); 77 94 pClass->Readed(); 78 95 this->GetClasses().Put( pClass ); … … 84 101 BOOST_FOREACH( Variable *pVar, meta.globalVars ) 85 102 { 103 if( pVar->IsExternal() ) 104 { 105 // 外部参照の場合は取り込まない 106 continue; 107 } 108 86 109 // 基底スコープレベルのグローバル変数の生存値をオンにする 87 110 if( pVar->GetScopeLevel() == 0 ) … … 99 122 } 100 123 101 pVar-> isTargetObjectModule = false;124 pVar->ResetRelationalObjectModuleIndex( relationTable ); 102 125 this->globalVars.Add( pVar, isResetOffsetAddress ); 103 126 } … … 113 136 { 114 137 CConst *pConst = meta.GetGlobalConsts().Iterator_GetNext(); 115 pConst->isTargetObjectModule = false; 138 if( pConst->IsExternal() ) 139 { 140 // 外部参照の場合は取り込まない 141 continue; 142 } 143 144 pConst->ResetRelationalObjectModuleIndex( relationTable ); 116 145 this->GetGlobalConsts().Put( pConst ); 117 146 } … … 123 152 { 124 153 ConstMacro *pConstMacro = meta.GetGlobalConstMacros().Iterator_GetNext(); 125 pConstMacro->isTargetObjectModule = false; 154 if( pConstMacro->IsExternal() ) 155 { 156 // 外部参照の場合は取り込まない 157 continue; 158 } 159 160 pConstMacro->ResetRelationalObjectModuleIndex( relationTable ); 126 161 this->GetGlobalConstMacros().Put( pConstMacro ); 127 162 } … … 131 166 BOOST_FOREACH( BlittableType &blittableType, meta.blittableTypes ) 132 167 { 133 blittableType.isTargetObjectModule = false;168 // TODO: coreモジュール以外でもBlittable型用のクラスモジュールを定義できるようにすべき 134 169 this->blittableTypes.push_back( blittableType ); 135 170 } … … 139 174 BOOST_FOREACH( TypeDef &typeDef, meta.typeDefs ) 140 175 { 141 typeDef.isTargetObjectModule = false; 176 if( typeDef.IsExternal() ) 177 { 178 // 外部参照の場合は取り込まない 179 continue; 180 } 181 182 typeDef.ResetRelationalObjectModuleIndex( relationTable ); 142 183 this->typeDefs.push_back( typeDef ); 143 184 } … … 147 188 BOOST_FOREACH( ProcPointer *pProcPointer, meta.procPointers ) 148 189 { 149 pProcPointer->isTargetObjectModule = false; 190 if( pProcPointer->IsExternal() ) 191 { 192 // 外部参照の場合は取り込まない 193 continue; 194 } 195 196 pProcPointer->ResetRelationalObjectModuleIndex( relationTable ); 150 197 this->procPointers.push_back( pProcPointer ); 151 198 } … … 157 204 { 158 205 Delegate *pDelegate = meta.GetDelegates().Iterator_GetNext(); 159 pDelegate->isTargetObjectModule = false; 206 if( pDelegate->IsExternal() ) 207 { 208 // 外部参照の場合は取り込まない 209 continue; 210 } 211 212 pDelegate->ResetRelationalObjectModuleIndex( relationTable ); 160 213 this->GetDelegates().Put( pDelegate ); 161 214 } … … 199 252 return NULL; 200 253 } 254 255 void Meta::Resolve() 256 { 257 // 関数・メソッド 258 this->GetUserProcs().Iterator_Init(); 259 this->GetUserProcs().Iterator_Reset(); 260 while( this->GetUserProcs().Iterator_HasNext() ) 261 { 262 UserProc *pUserProc = this->GetUserProcs().Iterator_GetNext(); 263 pUserProc->Resolve(); 264 } 265 266 // DLL関数 267 this->GetDllProcs().Iterator_Init(); 268 this->GetDllProcs().Iterator_Reset(); 269 while( this->GetDllProcs().Iterator_HasNext() ) 270 { 271 DllProc *pDllProc = this->GetDllProcs().Iterator_GetNext(); 272 pDllProc->Resolve(); 273 } 274 275 // クラス 276 this->GetClasses().Iterator_Init(); 277 this->GetClasses().Iterator_Reset(); 278 while( this->GetClasses().Iterator_HasNext() ) 279 { 280 CClass *pClass = this->GetClasses().Iterator_GetNext(); 281 pClass->Resolve(); 282 } 283 284 // グローバル変数 285 BOOST_FOREACH( Variable *pVar, globalVars ) 286 { 287 pVar->Resolve(); 288 } 289 290 // グローバル定数 291 this->GetGlobalConsts().Iterator_Init(); 292 this->GetGlobalConsts().Iterator_Reset(); 293 while( this->GetGlobalConsts().Iterator_HasNext() ) 294 { 295 CConst *pConst = this->GetGlobalConsts().Iterator_GetNext(); 296 pConst->Resolve(); 297 } 298 299 // グローバル定数マクロ 300 this->GetGlobalConstMacros().Iterator_Init(); 301 this->GetGlobalConstMacros().Iterator_Reset(); 302 while( this->GetGlobalConstMacros().Iterator_HasNext() ) 303 { 304 ConstMacro *pConstMacro = this->GetGlobalConstMacros().Iterator_GetNext(); 305 pConstMacro->Resolve(); 306 } 307 308 // TypeDef 309 BOOST_FOREACH( TypeDef &typeDef, typeDefs ) 310 { 311 typeDef.Resolve(); 312 } 313 314 // 関数ポインタ 315 BOOST_FOREACH( ProcPointer *pProcPointer, procPointers ) 316 { 317 pProcPointer->Resolve(); 318 } 319 320 // デリゲート 321 this->GetDelegates().Iterator_Init(); 322 this->GetDelegates().Iterator_Reset(); 323 while( this->GetDelegates().Iterator_HasNext() ) 324 { 325 Delegate *pDelegate = this->GetDelegates().Iterator_GetNext(); 326 pDelegate->Resolve(); 327 } 328 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp
r636 r637 43 43 this->sourceLines.push_back( 44 44 SourceLine( 45 sourceLine.GetLineNum(),46 45 baseOffset + sourceLine.GetNativeCodePos(), 47 sourceLine.GetRelationalObjectModuleIndex(), // TODO: 複数libの取り込みを想定できていない(ソースコード行番号とネイティブコード位置の対応情報の追加は静的リンクが完了した後に行うべき) 48 sourceLine.GetSourceCodePos(), 49 sourceLine.GetCodeType() 46 sourceLine.GetCodeType(), 47 sourceLine.GetSourceCodePosition() 50 48 ) 51 49 ); … … 106 104 } 107 105 108 void NativeCode::NextSourceLine( int currentSourceIndex, int nowLine)106 void NativeCode::NextSourceLine( const SourceCodePosition &sourceCodePosition ) 109 107 { 110 108 if( sourceLines.size() ) … … 112 110 if( sourceLines.back().GetNativeCodePos() == GetSize() ) 113 111 { 114 sourceLines.back().SetSourceCodePos ( nowLine);112 sourceLines.back().SetSourceCodePosition( sourceCodePosition ); 115 113 return; 116 114 } … … 130 128 sourceLines.push_back( 131 129 SourceLine( 132 (long)sourceLines.size(),133 130 GetSize(), 134 currentSourceIndex, 135 nowLine, 136 sourceLineType 131 sourceLineType, 132 sourceCodePosition 137 133 ) 138 134 ); … … 152 148 } 153 149 } 154 void NativeCode::Reset SourceIndexes( const std::vector<int> &relationTable )150 void NativeCode::ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable ) 155 151 { 156 152 BOOST_FOREACH( SourceLine &sourceLine, sourceLines ) 157 153 { 158 sourceLine.SetRelationalObjectModuleIndex( relationTable[sourceLine.GetRelationalObjectModuleIndex()] ); 154 sourceLine.GetSourceCodePosition().SetRelationalObjectModuleIndex( 155 relationTable[sourceLine.GetSourceCodePosition().GetRelationalObjectModuleIndex()] 156 ); 159 157 } 160 158 } 159 160 void NativeCode::Resolve() 161 { 162 // TODO: Resolve 163 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/ObjectModule.cpp
r636 r637 56 56 57 57 58 void ObjectModule::StaticLink( ObjectModule &objectModule )58 void ObjectModule::StaticLink( ObjectModule &objectModule, bool isSll ) 59 59 { 60 60 const std::vector<int> relationTable = this->GetRelationTable( objectModule.relationalObjectModuleNames ); … … 65 65 meta.StaticLink( objectModule.meta, dataSectionBaseOffset, relationTable ); 66 66 67 // グローバル ネイティブコードを結合 68 objectModule.globalNativeCode.ResetDataSectionBaseOffset( dataSectionBaseOffset ); 69 objectModule.globalNativeCode.ResetSourceIndexes( relationTable ); 70 globalNativeCode.PutEx( objectModule.globalNativeCode ); 71 72 // データテーブルを結合 73 objectModule.dataTable.ResetDataSectionBaseOffset( dataSectionBaseOffset ); 74 dataTable.Add( objectModule.dataTable ); 67 if( !isSll ) 68 { 69 // グローバル ネイティブコードを結合 70 objectModule.globalNativeCode.ResetDataSectionBaseOffset( dataSectionBaseOffset ); 71 objectModule.globalNativeCode.ResetRelationalObjectModuleIndex( relationTable ); 72 globalNativeCode.PutEx( objectModule.globalNativeCode ); 73 74 // データテーブルを結合 75 objectModule.dataTable.ResetDataSectionBaseOffset( dataSectionBaseOffset ); 76 dataTable.Add( objectModule.dataTable ); 77 } 78 79 // 依存関係を解決 80 this->Resolve(); 75 81 76 82 // TODO: basbufがいらなくなったら消す 77 83 extern char *basbuf; 78 84 basbuf = this->source.GetBuffer(); 85 } 86 87 void ObjectModule::Resolve() 88 { 89 this->meta.Resolve(); 90 91 // グローバルネイティブコードを解決(スケジュールを解決する) 92 this->globalNativeCode.Resolve(); 93 94 // データテーブルを解決(スケジュールを解決する) 95 this->dataTable.Resolve(); 79 96 } 80 97 -
trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp
r632 r637 1 1 #include "stdafx.h" 2 2 3 4 void Procedure::ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable ) 5 { 6 RelationalObjectModuleItem::ResetRelationalObjectModuleIndex( relationTable ); 7 8 if( !this->sourceCodePosition.IsNothing() ) 9 { 10 this->sourceCodePosition.SetRelationalObjectModuleIndex( relationTable[this->sourceCodePosition.GetRelationalObjectModuleIndex()] ); 11 } 12 } 13 14 void UserProc::ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable ) 15 { 16 Procedure::ResetRelationalObjectModuleIndex( relationTable ); 17 18 this->GetNativeCode().ResetRelationalObjectModuleIndex( relationTable ); 19 } 20 3 21 int id_base = 0; 4 22 5 UserProc::UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport )6 : Procedure( namespaceScopes, name, kind, isCdecl )23 UserProc::UserProc( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces, Kind kind, bool isMacro, bool isCdecl, bool isExport ) 24 : Procedure( symbol, kind, isCdecl ) 7 25 , importedNamespaces( importedNamespaces ) 8 26 , pParentClass( NULL ) … … 139 157 } 140 158 159 bool UserProc::Resolve() 160 { 161 // TODO: Resolve 162 return true; 163 } 164 141 165 const UserProc *UserProc::pGlobalProc = NULL; 142 166 … … 161 185 } 162 186 187 bool DllProc::Resolve() 188 { 189 // TODO: Resolve 190 return true; 191 } 192 193 bool ProcPointer::Resolve() 194 { 195 // TODO: Resolve 196 return true; 197 } 198 163 199 void ProcPointers::Clear() 164 200 { -
trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp
r635 r637 941 941 return 1; 942 942 } 943 944 int SourceCodePosition::GetRelationalObjectModuleIndex() const 945 { 946 if( this->IsNothing() ) 947 { 948 _ASSERTE( false ); 949 throw; 950 } 951 952 return relationalObjectModuleIndex; 953 } 954 bool SourceCodePosition::IsNothing() const 955 { 956 if( this->relationalObjectModuleIndex == -1 && this->pos == -1 ) 957 { 958 return true; 959 } 960 961 if( this->relationalObjectModuleIndex == -1 || this->pos == -1 ) 962 { 963 _ASSERTE( false ); 964 throw; 965 } 966 967 return false; 968 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp
r632 r637 1 1 #include "stdafx.h" 2 2 3 TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, const Type &baseType )4 : Symbol( namespaceScopes, name)3 TypeDef::TypeDef( const Symbol &symbol, const std::string &baseName, const Type &baseType ) 4 : RelationalObjectModuleItem( symbol ) 5 5 , baseName( baseName ) 6 6 , baseType( baseType ) 7 7 { 8 } 9 10 bool TypeDef::Resolve() 11 { 12 // TODO: Resolve 13 return true; 8 14 } 9 15 … … 12 18 TypeDefCollection::~TypeDefCollection(){ 13 19 } 14 void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine ){15 TypeDef typeDef( namespaceScopes, name, baseName, nowLine );20 void TypeDefCollection::Add( const Symbol &symbol, const std::string &baseName, int nowLine ){ 21 TypeDef typeDef( symbol, baseName, nowLine ); 16 22 this->push_back( typeDef ); 17 23 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Variable.cpp
r603 r637 2 2 3 3 Variable::Variable( const Symbol &symbol, const Type &type, bool isConst, bool isRef, const std::string ¶mStrForConstructor, bool hasInitData ) 4 : Symbol( symbol ) 5 , type( type ) 6 , isConst( isConst ) 7 , isRef( isRef ) 8 , isArray( false ) 9 , isParameter( false) 10 , paramStrForConstructor( paramStrForConstructor ) 11 , hasInitData( hasInitData ) 12 { 13 } 14 Variable::Variable( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &type, bool isConst, bool isRef, const std::string ¶mStrForConstructor, bool hasInitData ) 15 : Symbol( namespaceScopes, name ) 4 : RelationalObjectModuleItem( symbol ) 16 5 , type( type ) 17 6 , isConst( isConst ) … … 24 13 } 25 14 Variable::Variable( const Variable &var ) 26 : Symbol( var )15 : RelationalObjectModuleItem( var ) 27 16 , type( var.type ) 28 17 , isConst( var.isConst ) … … 37 26 Variable::Variable() 38 27 { 28 } 29 30 bool Variable::Resolve() 31 { 32 // TODO: Resolve 33 return true; 39 34 } 40 35
Note:
See TracChangeset
for help on using the changeset viewer.