Changeset 208 in dev for trunk/abdev/BasicCompiler_Common
- Timestamp:
- Jul 13, 2007, 2:49:56 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/VarList.cpp
r206 r208 419 419 420 420 TreeView_DeleteAllItems(hVarTree_This); 421 if( !pUserProc->GetParentClassPtr()) return;421 if( pUserProc->IsGlobalProcedure() ) return; 422 422 423 423 //Thisポインタを取得 -
trunk/abdev/BasicCompiler_Common/include/Class.h
r206 r208 73 73 74 74 // XMLシリアライズ用 75 // TODO: xml未完成 75 76 private: 76 77 friend class boost::serialization::access; -
trunk/abdev/BasicCompiler_Common/include/Procedure.h
r206 r208 3 3 #include <jenga/include/common/Hashmap.h> 4 4 #include <jenga/include/smoothie/Source.h> 5 #include <jenga/include/smoothie/LexicalAnalysis.h>6 5 7 6 #include <option.h> … … 16 15 class CMethod; 17 16 18 class Procedure 17 class Procedure : public Symbol 19 18 { 20 19 public: … … 26 25 27 26 private: 28 string name; // プロシージャ名29 30 27 Kind kind; 31 28 … … 48 45 private: 49 46 friend class boost::serialization::access; 50 BOOST_SERIALIZATION_SPLIT_MEMBER(); 51 template<class Archive> void load(Archive& ar, const unsigned int version) 47 template<class Archive> void serialize(Archive& ar, const unsigned int version) 52 48 { 53 49 trace_for_serialize( "serializing - Procedure" ); 54 50 55 std::string _name; 56 ar & BOOST_SERIALIZATION_NVP( _name ); 57 this->name = Operator_NaturalStringToCalcMarkString( _name ); 58 51 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 59 52 ar & BOOST_SERIALIZATION_NVP( kind ); 60 53 ar & BOOST_SERIALIZATION_NVP( isCdecl ); … … 64 57 ar & BOOST_SERIALIZATION_NVP( codePos ); 65 58 } 66 template<class Archive> void save(Archive& ar, const unsigned int version) const 67 { 68 trace_for_serialize( "serializing - Procedure" ); 69 70 std::string _name = Operator_CalcMarkStringToNaturalString( name ); 71 ar & BOOST_SERIALIZATION_NVP( _name ); 72 73 ar & BOOST_SERIALIZATION_NVP( kind ); 74 ar & BOOST_SERIALIZATION_NVP( isCdecl ); 75 ar & BOOST_SERIALIZATION_NVP( isUsing ); 76 ar & BOOST_SERIALIZATION_NVP( params ); 77 ar & BOOST_SERIALIZATION_NVP( returnType ); 78 ar & BOOST_SERIALIZATION_NVP( codePos ); 79 } 80 81 public: 82 Procedure( const string &name, Kind kind, bool isCdecl ) 83 : name( name ) 59 60 public: 61 Procedure( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl ) 62 : Symbol( namespaceScopes, name ) 84 63 , kind( kind ) 85 64 , isCdecl( isCdecl ) … … 97 76 } 98 77 99 const string &GetName() const100 {101 return name;102 }103 104 78 bool IsSub() const 105 79 { … … 145 119 146 120 private: 147 NamespaceScopes namespaceScopes;148 121 NamespaceScopesCollection importedNamespaces; 149 122 … … 183 156 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 184 157 ar & BOOST_SERIALIZATION_NVP( _paramStr ); 185 ar & BOOST_SERIALIZATION_NVP( namespaceScopes );186 158 ar & BOOST_SERIALIZATION_NVP( importedNamespaces ); 187 159 ar & boost::serialization::make_nvp("pParentClass", const_cast<CClass *&>(pParentClass) ); … … 204 176 205 177 UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport, int id ) 206 : Procedure( name, kind, isCdecl ) 207 , namespaceScopes( namespaceScopes ) 178 : Procedure( namespaceScopes, name, kind, isCdecl ) 208 179 , importedNamespaces( importedNamespaces ) 209 180 , pParentClass( NULL ) … … 314 285 } 315 286 316 const NamespaceScopes &GetNamespaceScopes() const;287 virtual const NamespaceScopes &GetNamespaceScopes() const; 317 288 const NamespaceScopesCollection &GetImportedNamespaces() const; 318 289 … … 340 311 } 341 312 342 bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;343 bool IsEqualSymbol( const UserProc &globalProc ) const;344 bool IsEqualSymbol( const string &name ) const;345 346 313 bool IsVirtual() const; 347 314 … … 360 327 { 361 328 return ( pParentClass != NULL ); 329 } 330 bool IsGlobalProcedure() const 331 { 332 return ( pParentClass == NULL ); 362 333 } 363 334 void SetMethod( CMethod *pMethod ){ … … 428 399 class DllProc : public Procedure 429 400 { 430 NamespaceScopes namespaceScopes;431 432 401 string dllFileName; 433 402 string alias; … … 442 411 443 412 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 444 ar & BOOST_SERIALIZATION_NVP( namespaceScopes );445 413 ar & BOOST_SERIALIZATION_NVP( dllFileName ); 446 414 ar & BOOST_SERIALIZATION_NVP( alias ); … … 453 421 454 422 DllProc( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl, const string &dllFileName, const string &alias ): 455 Procedure( name, kind, isCdecl ), 456 namespaceScopes( namespaceScopes ), 423 Procedure( namespaceScopes, name, kind, isCdecl ), 457 424 dllFileName( dllFileName ), 458 425 alias( alias ), … … 463 430 ~DllProc(){} 464 431 465 virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;466 bool IsEqualSymbol( const string &name ) const;467 468 const NamespaceScopes &GetNamespaceScopes() const469 {470 return namespaceScopes;471 }472 473 432 const string &GetDllFileName() const 474 433 { … … 505 464 public: 506 465 ProcPointer( Kind kind ) 507 : Procedure( "", kind, false )466 : Procedure( NamespaceScopes(), std::string(), kind, false ) 508 467 { 509 468 } -
trunk/abdev/BasicCompiler_Common/include/Symbol.h
r206 r208 7 7 8 8 #include <jenga/include/smoothie/Namespace.h> 9 #include <jenga/include/smoothie/LexicalAnalysis.h> 9 10 10 11 using namespace std; … … 18 19 private: 19 20 friend class boost::serialization::access; 20 template<class Archive> void serialize(Archive& ar, const unsigned int version) 21 BOOST_SERIALIZATION_SPLIT_MEMBER(); 22 template<class Archive> void load(Archive& ar, const unsigned int version) 21 23 { 24 trace_for_serialize( "serializing(load) - Symbol" ); 25 22 26 ar & BOOST_SERIALIZATION_NVP( namespaceScopes ); 23 ar & BOOST_SERIALIZATION_NVP( name ); 27 28 std::string _name; 29 ar & BOOST_SERIALIZATION_NVP( _name ); 30 this->name = Operator_NaturalStringToCalcMarkString( _name ); 31 } 32 template<class Archive> void save(Archive& ar, const unsigned int version) const 33 { 34 trace_for_serialize( "serializing(save) - Symbol" ); 35 36 ar & BOOST_SERIALIZATION_NVP( namespaceScopes ); 37 38 std::string _name = Operator_CalcMarkStringToNaturalString( name ); 39 ar & BOOST_SERIALIZATION_NVP( _name ); 24 40 } 25 41 … … 41 57 } 42 58 43 const NamespaceScopes &GetNamespaceScopes() const59 virtual const NamespaceScopes &GetNamespaceScopes() const 44 60 { 45 61 return namespaceScopes; … … 53 69 bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const; 54 70 bool IsEqualSymbol( const Symbol &symbol ) const; 55 bool IsEqualSymbol( const string &name ) const; 71 bool IsEqualSymbol( const char *fullName ) const; 72 bool IsEqualSymbol( const string &fullName ) const 73 { 74 return IsEqualSymbol( fullName.c_str() ); 75 } 56 76 }; -
trunk/abdev/BasicCompiler_Common/src/Procedure.cpp
r206 r208 30 30 return GetParentClassPtr()->GetNamespaceScopes(); 31 31 } 32 return namespaceScopes;32 return Symbol::GetNamespaceScopes(); 33 33 } 34 34 const NamespaceScopesCollection &UserProc::GetImportedNamespaces() const 35 35 { 36 36 return importedNamespaces; 37 }38 bool UserProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const39 {40 if( GetName() != name ){41 return false;42 }43 44 return compiler.GetNamespaceSupporter().IsSameAreaNamespace( GetNamespaceScopes(), namespaceScopes );45 }46 bool UserProc::IsEqualSymbol( const UserProc &globalProc ) const47 {48 return IsEqualSymbol( globalProc.GetNamespaceScopes(), globalProc.GetName() );49 }50 bool UserProc::IsEqualSymbol( const string &fullName ) const51 {52 char AreaName[VN_SIZE] = ""; //オブジェクト変数53 char NestName[VN_SIZE] = ""; //入れ子メンバ54 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );55 56 return IsEqualSymbol( NamespaceScopes( AreaName ), NestName );57 37 } 58 38 bool UserProc::IsVirtual() const … … 596 576 UserProc *pUserProc = GetHashArrayElement( simpleName ); 597 577 while(pUserProc){ 598 if( !pUserProc->GetParentClassPtr()){578 if( pUserProc->IsGlobalProcedure() ){ 599 579 if( pUserProc->IsEqualSymbol( localName ) ){ 600 580 subs.push_back( pUserProc ); … … 606 586 } 607 587 608 609 bool DllProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const610 {611 if( GetName() != name ){612 return false;613 }614 return compiler.GetNamespaceSupporter().IsSameAreaNamespace( this->GetNamespaceScopes(), namespaceScopes );615 }616 bool DllProc::IsEqualSymbol( const string &fullName ) const617 {618 char AreaName[VN_SIZE] = ""; //オブジェクト変数619 char NestName[VN_SIZE] = ""; //入れ子メンバ620 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );621 622 if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){623 return true;624 }625 626 if( isNest ){627 // 静的メンバを考慮628 629 char AreaName2[VN_SIZE] = ""; //オブジェクト変数630 char NestName2[VN_SIZE] = ""; //入れ子メンバ631 bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 );632 lstrcat( NestName2, "." );633 lstrcat( NestName2, NestName );634 635 return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 );636 }637 638 return false;639 }640 588 bool DllProc::SetParamsAndReturnType( const char *sourceOfParams, int nowLine ){ 641 589 int i = 0; -
trunk/abdev/BasicCompiler_Common/src/Symbol.cpp
r206 r208 52 52 return false; 53 53 } 54 bool Symbol::IsEqualSymbol( const string &fullName ) const54 bool Symbol::IsEqualSymbol( const char *fullName ) const 55 55 { 56 56 char AreaName[VN_SIZE] = ""; //オブジェクト変数 57 57 char NestName[VN_SIZE] = ""; //入れ子メンバ 58 bool isNest = SplitMemberName( fullName .c_str(), AreaName, NestName );58 bool isNest = SplitMemberName( fullName, AreaName, NestName ); 59 59 60 60 if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
Note:
See TracChangeset
for help on using the changeset viewer.