Changeset 632 in dev for trunk/ab5.0/abdev/ab_common
- Timestamp:
- Jun 5, 2008, 10:04:39 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev/ab_common
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/ab_common/ab_common.vcproj
r622 r632 340 340 <File 341 341 RelativePath=".\src\Lexical\Interface.cpp" 342 > 343 </File> 344 <File 345 RelativePath=".\src\Lexical\Member.cpp" 342 346 > 343 347 </File> … … 416 420 </File> 417 421 <File 422 RelativePath=".\src\Lexical\Template.cpp" 423 > 424 </File> 425 <File 418 426 RelativePath=".\src\Lexical\Type.cpp" 419 427 > … … 530 538 </File> 531 539 <File 540 RelativePath=".\include\Lexical\Template.h" 541 > 542 </File> 543 <File 532 544 RelativePath=".\include\Lexical\Type.h" 533 545 > -
trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h
r603 r632 2 2 3 3 class UserProc; 4 class UserProcs; 4 5 class Delegate; 6 class Classes; 5 7 6 8 class ClassPrototype : public Prototype, public DynamicMethodsPrototype … … 78 80 //アラインメント値 79 81 int fixedAlignment; 82 83 public: 84 ActiveBasic::Common::Lexical::ExpandedTemplateClasses expandedTemplateClasses; 80 85 81 86 // XMLシリアライズ用 … … 101 106 ar & BOOST_SERIALIZATION_NVP( staticMethods ); 102 107 ar & BOOST_SERIALIZATION_NVP( fixedAlignment ); 108 ar & BOOST_SERIALIZATION_NVP( expandedTemplateClasses ); 103 109 } 104 110 … … 106 112 public: 107 113 108 CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name ) 109 : ClassPrototype( namespaceScopes, name ) 110 , importedNamespaces( importedNamespaces ) 111 , classType( Class ) 112 , pSuperClass( NULL ) 113 , blittableType( Type() ) 114 , isReady( false ) 115 , fixedAlignment( 0 ) 116 , ConstructorMemberSubIndex( -1 ) 117 , DestructorMemberSubIndex( -1 ) 118 , vtblNum( 0 ) 119 , vtbl_offset( -1 ) 120 , comVtblOffset( 0 ) 121 , isCompilingConstructor( false ) 122 , isCompilingDestructor( false ) 123 , cacheSize( 0 ) 124 { 125 } 126 CClass() 127 : ClassPrototype() 128 , importedNamespaces() 129 , classType() 130 , pSuperClass( NULL ) 131 , blittableType( Type() ) 132 , isReady( false ) 133 , fixedAlignment( 0 ) 134 , ConstructorMemberSubIndex( -1 ) 135 , DestructorMemberSubIndex( -1 ) 136 , vtblNum( 0 ) 137 , vtbl_offset( -1 ) 138 , comVtblOffset( 0 ) 139 , isCompilingConstructor( false ) 140 , isCompilingDestructor( false ) 141 , cacheSize( 0 ) 142 { 143 } 144 ~CClass() 145 { 146 // 動的メンバ 147 BOOST_FOREACH( Member *member, dynamicMembers ) 148 { 149 delete member; 150 } 151 152 // 静的メンバ 153 BOOST_FOREACH( Member *member, staticMembers ) 154 { 155 delete member; 156 } 157 158 // インターフェイス 159 BOOST_FOREACH( ::Interface *pInterface, interfaces ) 160 { 161 delete pInterface; 162 } 163 } 114 CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name ); 115 CClass( const NamespaceScopes &namespaceScopes, 116 const NamespaceScopesCollection &importedNamespaces, 117 const std::string &name, ClassType classType, 118 const GenericTypes &formalGenericTypes, 119 const Types &superClassActualTypeParameters, 120 int ConstructorMemberSubIndex, 121 int DestructorMemberSubIndex, 122 int vtblNum, 123 int fixedAlignment ); 124 CClass(); 125 ~CClass(); 164 126 165 127 virtual const std::string &GetKeyName() const … … 273 235 this->classType = classType; 274 236 } 237 ClassType GetClassType() const 238 { 239 return classType; 240 } 275 241 276 242 … … 314 280 return interfaces; 315 281 } 282 Interfaces &GetInterfaces() 283 { 284 return interfaces; 285 } 316 286 bool IsInheritsInterface( const CClass *pInterfaceClass ) const; 317 287 … … 372 342 this->ConstructorMemberSubIndex = constructorMemberSubIndex; 373 343 } 344 int GetConstructorMemberSubIndex() const 345 { 346 return ConstructorMemberSubIndex; 347 } 374 348 375 349 //デストラクタ メソッドを取得 … … 382 356 { 383 357 this->DestructorMemberSubIndex = destructorMemberSubIndex; 358 } 359 int GetDestructorMemberSubIndex() const 360 { 361 return DestructorMemberSubIndex; 384 362 } 385 363 -
trunk/ab5.0/abdev/ab_common/include/Lexical/Member.h
r603 r632 33 33 34 34 int source_code_address; 35 36 Member( Prototype::Accessibility accessibility, const std::string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const std::string &initializeExpression, const std::string &constructParameter ); 37 Member( const Member &member, const Type &actualType ); 38 Member( const Member &member ); 39 Member(); 40 ~Member(); 35 41 36 42 const std::string &GetName() const … … 70 76 return constructParameter; 71 77 } 72 73 Member( Prototype::Accessibility accessibility, const std::string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const std::string &initializeExpression, const std::string &constructParameter )74 : MemberPrototype( accessibility )75 , name( name )76 , type( newType )77 , isConst( isConst )78 , subscripts( subscripts )79 , initializeExpression( initializeExpression )80 , constructParameter( constructParameter )81 {82 }83 Member::Member(Member &member)84 : MemberPrototype( member.GetAccessibility() )85 , name( member.GetName() )86 , type( member.GetType() )87 , isConst( member.IsConst() )88 , subscripts( member.GetSubscripts() )89 {90 //ソースコードの位置91 source_code_address=member.source_code_address;92 }93 Member()94 {95 }96 ~Member()97 {98 }99 78 }; 100 79 typedef std::vector<Member *> Members; -
trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h
r603 r632 4 4 { 5 5 public: 6 // オブジェクトモジュール名 7 std::string name; 8 6 9 // メタ情報 7 10 Meta meta; … … 29 32 trace_for_serialize( "serializing - objectModule" ); 30 33 34 ar & BOOST_SERIALIZATION_NVP( name ); 31 35 ar & BOOST_SERIALIZATION_NVP( meta ); 32 36 ar & BOOST_SERIALIZATION_NVP( globalNativeCode ); … … 39 43 void StaticLink( ObjectModule &objectModule ); 40 44 45 const std::string &GetName() const 46 { 47 return name; 48 } 49 void SetName( const std::string &name ) 50 { 51 this->name = name; 52 } 41 53 int GetCurrentSourceIndex() const 42 54 { -
trunk/ab5.0/abdev/ab_common/include/Lexical/Parameter.h
r603 r632 26 26 27 27 public: 28 Parameter( const std::string &varName, const Type &type, bool isRef = false, const std::string initValue = "" ): 29 Type( type ), 30 varName( varName ), 31 isRef( isRef ), 32 isArray( false ), 33 initValue( initValue ) 34 { 35 } 36 Parameter( const Parameter ¶m ): 37 Type( param ), 38 varName( param.varName ), 39 isRef( param.isRef ), 40 isArray( param.isArray ), 41 subscripts( param.subscripts ), 42 initValue( param.initValue ) 43 { 44 } 45 Parameter() 46 { 47 } 48 ~Parameter(){} 28 Parameter( const std::string &varName, const Type &type, bool isRef = false, const std::string initValue = "" ); 29 Parameter( const Parameter ¶m, const Type &type ); 30 Parameter( const Parameter ¶m ); 31 Parameter(); 32 ~Parameter(); 49 33 50 34 void SetArray( const Subscripts &subscripts ){ -
trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h
r604 r632 24 24 Type returnType; 25 25 26 private: 26 27 // ソースコードの位置 27 int codePos;28 SourceCodePosition sourceCodePosition; 28 29 29 30 // XMLシリアライズ用 … … 40 41 ar & BOOST_SERIALIZATION_NVP( params ); 41 42 ar & BOOST_SERIALIZATION_NVP( returnType ); 42 ar & BOOST_SERIALIZATION_NVP( codePos);43 ar & BOOST_SERIALIZATION_NVP( sourceCodePosition ); 43 44 } 44 45 … … 49 50 , isCdecl( isCdecl ) 50 51 , isUsing( false ) 51 , codePos( -1 )52 52 { 53 53 } … … 83 83 } 84 84 85 int GetCodePos() const86 { 87 return codePos;88 } 89 void Set CodePos( int codePos)90 { 91 this-> codePos = codePos;85 const SourceCodePosition &GetSourceCodePosition() const 86 { 87 return sourceCodePosition; 88 } 89 void SetSourceCodePosition( const SourceCodePosition &sourceCodePosition ) 90 { 91 this->sourceCodePosition = sourceCodePosition; 92 92 } 93 93 … … 178 178 public: 179 179 180 UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport ) 181 : Procedure( namespaceScopes, name, kind, isCdecl ) 182 , importedNamespaces( importedNamespaces ) 183 , pParentClass( NULL ) 184 , pInterface( NULL ) 185 , pMethod( NULL ) 186 , isMacro( isMacro ) 187 , secondParmNum( 0 ) 188 , realSecondParmNum( 1 ) 189 , isExport( isExport ) 190 , isSystem( false ) 191 , isAutoGeneration( false ) 192 , isCompiled( false ) 193 , beginOpAddress( 0 ) 194 , endOpAddress( 0 ) 195 { 196 static int id_base=0; 197 id = ( id_base ++ ); 198 } 199 UserProc() 200 { 201 } 202 ~UserProc() 203 { 204 BOOST_FOREACH( Parameter *pParam, realParams ){ 205 delete pParam; 206 } 207 } 180 UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport ); 181 UserProc( const UserProc &userProc, const CClass *pParentClass ); 182 UserProc(); 183 ~UserProc(); 208 184 209 185 void SetReturnType( const Type &newReturnType ) -
trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h
r603 r632 253 253 }; 254 254 typedef std::vector<BasicSource> BasicSources; 255 256 class SourceCodePosition 257 { 258 std::string objectModuleName; 259 int pos; 260 261 // XMLシリアライズ用 262 private: 263 friend class boost::serialization::access; 264 template<class Archive> void serialize(Archive& ar, const unsigned int version) 265 { 266 trace_for_serialize( "serializing - IncludedFilesRelation" ); 267 268 ar & BOOST_SERIALIZATION_NVP( objectModuleName ); 269 ar & BOOST_SERIALIZATION_NVP( pos ); 270 } 271 272 public: 273 SourceCodePosition( const std::string &objectModuleName, int pos ) 274 : objectModuleName( objectModuleName ) 275 , pos( pos ) 276 { 277 } 278 SourceCodePosition() 279 : pos( -1 ) 280 { 281 } 282 283 const std::string &GetObjectModuleName() const 284 { 285 return objectModuleName; 286 } 287 int GetPos() const 288 { 289 return pos; 290 } 291 }; -
trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h
r603 r632 136 136 void PtrLevelDown(){ 137 137 PTR_LEVEL_DOWN( basicType ); 138 } 139 void SetPtrLevel( int level ) 140 { 141 basicType = MAKE_PTR_TYPE( NATURAL_TYPE( basicType ), level ); 138 142 } 139 143 … … 166 170 bool IsReal() const; 167 171 bool Is64() const; 172 bool IsValueType() const; 168 173 bool IsProcPtr() const; 169 174 bool IsStruct() const; … … 233 238 static int GetBasicTypeFromSimpleName( const char *variable ); 234 239 }; 235 typedef std::vector<Type> Types; 240 241 class Types 242 : public std::vector<Type> 243 { 244 // XMLシリアライズ用 245 private: 246 friend class boost::serialization::access; 247 template<class Archive> void serialize(Archive& ar, const unsigned int version) 248 { 249 ar & boost::serialization::make_nvp("vector_Type", boost::serialization::base_object<vector<Type>>(*this)); 250 } 251 252 public: 253 bool IsEquals( const Types &Types ) const; 254 }; 236 255 237 256 /*! -
trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h
r603 r632 59 59 60 60 void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine ); 61 int GetIndex( const Symbol &symbol ) const;61 const TypeDef *Find( const Symbol &symbol ) const; 62 62 }; -
trunk/ab5.0/abdev/ab_common/include/ab_common.h
r622 r632 19 19 #include "Lexical/Interface.h" 20 20 #include "Lexical/Member.h" 21 #include "Lexical/Template.h" 21 22 #include "Lexical/Class.h" 22 23 #include "Lexical/Parameter.h" -
trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
r603 r632 1 1 #include "stdafx.h" 2 3 4 CClass::CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name ) 5 : ClassPrototype( namespaceScopes, name ) 6 , importedNamespaces( importedNamespaces ) 7 , classType( Class ) 8 , pSuperClass( NULL ) 9 , blittableType( Type() ) 10 , isReady( false ) 11 , fixedAlignment( 0 ) 12 , ConstructorMemberSubIndex( -1 ) 13 , DestructorMemberSubIndex( -1 ) 14 , vtblNum( 0 ) 15 , vtbl_offset( -1 ) 16 , comVtblOffset( 0 ) 17 , isCompilingConstructor( false ) 18 , isCompilingDestructor( false ) 19 , cacheSize( 0 ) 20 { 21 } 22 23 CClass::CClass( const NamespaceScopes &namespaceScopes, 24 const NamespaceScopesCollection &importedNamespaces, 25 const std::string &name, 26 ClassType classType, 27 const GenericTypes &formalGenericTypes, 28 const Types &superClassActualTypeParameters, 29 int ConstructorMemberSubIndex, 30 int DestructorMemberSubIndex, 31 int vtblNum, 32 int fixedAlignment ) 33 : ClassPrototype( namespaceScopes, name ) 34 , importedNamespaces( importedNamespaces ) 35 , classType( classType ) 36 , formalGenericTypes( formalGenericTypes ) 37 , pSuperClass( NULL ) 38 , superClassActualTypeParameters( superClassActualTypeParameters ) 39 , blittableType( Type() ) 40 , isReady( false ) 41 , ConstructorMemberSubIndex( ConstructorMemberSubIndex ) 42 , DestructorMemberSubIndex( DestructorMemberSubIndex ) 43 , vtblNum( vtblNum ) 44 , fixedAlignment( fixedAlignment ) 45 , vtbl_offset( -1 ) 46 , comVtblOffset( 0 ) 47 , isCompilingConstructor( false ) 48 , isCompilingDestructor( false ) 49 , cacheSize( 0 ) 50 { 51 } 52 53 CClass::CClass() 54 : ClassPrototype() 55 , importedNamespaces() 56 , classType() 57 , pSuperClass( NULL ) 58 , blittableType( Type() ) 59 , isReady( false ) 60 , fixedAlignment( 0 ) 61 , ConstructorMemberSubIndex( -1 ) 62 , DestructorMemberSubIndex( -1 ) 63 , vtblNum( 0 ) 64 , vtbl_offset( -1 ) 65 , comVtblOffset( 0 ) 66 , isCompilingConstructor( false ) 67 , isCompilingDestructor( false ) 68 , cacheSize( 0 ) 69 { 70 } 71 72 CClass::~CClass() 73 { 74 // 動的メンバ 75 BOOST_FOREACH( Member *member, dynamicMembers ) 76 { 77 delete member; 78 } 79 80 // 静的メンバ 81 BOOST_FOREACH( Member *member, staticMembers ) 82 { 83 delete member; 84 } 85 86 // インターフェイス 87 BOOST_FOREACH( ::Interface *pInterface, interfaces ) 88 { 89 delete pInterface; 90 } 91 92 // テンプレート展開済みのクラス 93 BOOST_FOREACH( ExpandedTemplateClass *pExpandedTemplateClass, expandedTemplateClasses ) 94 { 95 delete pExpandedTemplateClass; 96 } 97 } 2 98 3 99 void CClass::Using() const -
trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp
r603 r632 186 186 187 187 // TypeDefも見る 188 int index = this->GetTypeDefs().GetIndex( symbol ); 189 if( index != -1 ){ 190 Type type = this->GetTypeDefs()[index].GetBaseType(); 191 if( type.IsObject() ){ 188 const TypeDef *pTypeDef = this->GetTypeDefs().Find( symbol ); 189 if( pTypeDef ) 190 { 191 Type type = pTypeDef->GetBaseType(); 192 if( type.IsObject() ) 193 { 192 194 return &type.GetClass(); 193 195 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp
r603 r632 1 1 #include "stdafx.h" 2 3 Parameter::Parameter( const std::string &varName, const Type &type, bool isRef, const std::string initValue ) 4 : Type( type ) 5 , varName( varName ) 6 , isRef( isRef ) 7 , isArray( false ) 8 , initValue( initValue ) 9 { 10 } 11 12 Parameter::Parameter( const Parameter ¶m, const Type &type ) 13 : Type( type ) 14 , varName( param.varName ) 15 , isRef( param.isRef ) 16 , isArray( param.isArray ) 17 , subscripts( param.subscripts ) 18 , initValue( param.initValue ) 19 { 20 } 21 22 Parameter::Parameter( const Parameter ¶m ) 23 : Type( param ) 24 , varName( param.varName ) 25 , isRef( param.isRef ) 26 , isArray( param.isArray ) 27 , subscripts( param.subscripts ) 28 , initValue( param.initValue ) 29 { 30 } 31 32 Parameter::Parameter() 33 { 34 } 35 36 Parameter::~Parameter() 37 { 38 } 2 39 3 40 bool Parameter::Equals( const Parameter ¶m, bool isContravariant ) const -
trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp
r603 r632 1 1 #include "stdafx.h" 2 3 int id_base = 0; 4 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 ) 7 , importedNamespaces( importedNamespaces ) 8 , pParentClass( NULL ) 9 , pInterface( NULL ) 10 , pMethod( NULL ) 11 , isMacro( isMacro ) 12 , secondParmNum( 0 ) 13 , realSecondParmNum( 1 ) 14 , isExport( isExport ) 15 , isSystem( false ) 16 , isAutoGeneration( false ) 17 , isCompiled( false ) 18 , beginOpAddress( 0 ) 19 , endOpAddress( 0 ) 20 , id( id_base ++ ) 21 { 22 } 23 24 UserProc::UserProc( const UserProc &userProc, const CClass *pParentClass ) 25 : Procedure( userProc ) 26 , _paramStr( userProc._paramStr ) 27 , importedNamespaces( userProc.importedNamespaces ) 28 , pParentClass( pParentClass ) 29 , pInterface( NULL ) 30 , pMethod( NULL ) 31 , isMacro( userProc.isMacro ) 32 , secondParmNum( userProc.secondParmNum ) 33 , realParams( userProc.realParams ) 34 , realSecondParmNum( userProc.realSecondParmNum ) 35 , isExport( userProc.isExport ) 36 , isSystem( userProc.isSystem ) 37 , isAutoGeneration( userProc.isAutoGeneration ) 38 , isCompiled( false ) 39 , beginOpAddress( 0 ) 40 , endOpAddress( 0 ) 41 , localVars( Variables() ) 42 , id( id_base ++ ) 43 , nativeCode( NativeCode() ) 44 { 45 } 46 47 UserProc::UserProc() 48 { 49 } 50 51 UserProc::~UserProc() 52 { 53 BOOST_FOREACH( Parameter *pParam, realParams ){ 54 delete pParam; 55 } 56 } 2 57 3 58 bool UserProc::IsEqualForOverride( const Types &actualTypeParametersForThisProc, const UserProc *pUserProc ) const … … 54 109 const NamespaceScopes &UserProc::GetNamespaceScopes() const 55 110 { 56 if( HasParentClass() ){ 111 if( HasParentClass() ) 112 { 57 113 return GetParentClassPtr()->GetNamespaceScopes(); 58 114 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp
r603 r632 5 5 const NamespaceSupporter *Symbol::namespaceSupporter = NULL; 6 6 7 char *calcNames[25 5] = {7 char *calcNames[256] = { 8 8 "xor", 9 9 }; -
trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp
r603 r632 384 384 return false; 385 385 } 386 387 bool Type::IsValueType() const 388 { 389 return ( IsWhole() || IsReal() ); 390 } 391 386 392 bool Type::IsProcPtr() const 387 393 { … … 550 556 } 551 557 558 bool Types::IsEquals( const Types &types ) const 559 { 560 if( this->size() != types.size() ) 561 { 562 // アイテム数が違う 563 return false; 564 } 565 566 const Types &thisTypes = *this; 567 for( int i=0; i<static_cast<int>(this->size()); i++ ) 568 { 569 if( !thisTypes[i].Equals( types[i] ) ) 570 { 571 return false; 572 } 573 } 574 575 return true; 576 } 552 577 553 578 void ResolveFormalGenericTypeParameter( Type &typeParameter, const Type &classType, const UserProc *pUserProc ) -
trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp
r603 r632 17 17 } 18 18 19 int TypeDefCollection::GetIndex( const Symbol &symbol ) const{ 20 int max = (int)(*this).size(); 21 for( int i=0; i<max; i++ ){ 22 if( (*this)[i].IsEqualSymbol( symbol ) ){ 23 return i; 19 const TypeDef *TypeDefCollection::Find( const Symbol &symbol ) const 20 { 21 const TypeDefCollection &typeDefs = *this; 22 BOOST_FOREACH( const TypeDef &typeDef, typeDefs ) 23 { 24 if( typeDef.IsEqualSymbol( symbol ) ) 25 { 26 return &typeDef; 24 27 } 25 28 } 26 return -1;29 return NULL; 27 30 }
Note:
See TracChangeset
for help on using the changeset viewer.