Changeset 206 in dev for trunk/abdev/BasicCompiler_Common/include
- Timestamp:
- Jul 12, 2007, 2:58:26 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common/include
- Files:
-
- 7 added
- 1 deleted
- 6 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/include/Class.h
r201 r206 1 1 #pragma once 2 2 3 #include <jenga/include/smoothie/Class.h> 4 5 class ClassImpl: public CClass 3 #include <option.h> 4 #include <Program.h> 5 #include <Prototype.h> 6 #include <Method.h> 7 #include <Member.h> 8 9 class UserProc; 10 11 class InheritedInterface 6 12 { 7 public: 8 ClassImpl( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name ) 9 : CClass( namespaceScopes, importedNamespaces, name ) 10 { 11 } 12 ClassImpl() 13 : CClass() 14 { 15 } 16 17 virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const; 13 CClass *pInterfaceClass; 14 int vtblOffset; 15 public: 16 InheritedInterface( CClass *pInterfaceClass, int vtblOffset ) 17 : pInterfaceClass( pInterfaceClass ) 18 , vtblOffset( vtblOffset ) 19 { 20 } 21 22 CClass &GetInterfaceClass() const{ 23 return *pInterfaceClass; 24 } 25 int GetVtblOffset() const 26 { 27 return vtblOffset; 28 } 29 }; 30 typedef vector<InheritedInterface> Interfaces; 31 32 class CClass: public Prototype 33 { 34 public: 35 // 型の種類 36 enum ClassType{ 37 Class, 38 Interface, 39 Enum, 40 Delegate, 41 Structure, 42 }; 43 44 private: 45 ClassType classType; 46 47 // importされている名前空間 48 NamespaceScopesCollection importedNamespaces; 49 50 // 継承クラス 51 const CClass *pSuperClass; 52 53 // Blittable型情報 54 Type blittableType; 55 56 // 実装するインターフェイス 57 Interfaces interfaces; 58 59 // 動的メンバ 60 Members dynamicMembers; 61 62 // 静的メンバ 63 Members staticMembers; 64 65 // 動的メソッド 66 Methods methods; 67 int ConstructorMemberSubIndex; 68 int DestructorMemberSubIndex; 69 int vtblNum; // 仮想関数の数 70 71 // 静的メソッド 72 Methods staticMethods; 73 74 // XMLシリアライズ用 75 private: 76 friend class boost::serialization::access; 77 template<class Archive> void serialize(Archive& ar, const unsigned int version) 78 { 79 trace_for_serialize( "serializing - CClass" ); 80 81 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Prototype ); 82 ar & BOOST_SERIALIZATION_NVP( classType ); 83 ar & BOOST_SERIALIZATION_NVP( importedNamespaces ); 84 ar & boost::serialization::make_nvp( "pSuperClass", const_cast<CClass *&>(pSuperClass) ); 85 ar & BOOST_SERIALIZATION_NVP( blittableType ); 86 //ar & BOOST_SERIALIZATION_NVP( interfaces ); 87 ar & BOOST_SERIALIZATION_NVP( dynamicMembers ); 88 ar & BOOST_SERIALIZATION_NVP( staticMembers ); 89 ar & BOOST_SERIALIZATION_NVP( methods ); 90 ar & BOOST_SERIALIZATION_NVP( ConstructorMemberSubIndex ); 91 ar & BOOST_SERIALIZATION_NVP( DestructorMemberSubIndex ); 92 ar & BOOST_SERIALIZATION_NVP( vtblNum ); 93 ar & BOOST_SERIALIZATION_NVP( staticMethods ); 94 } 95 96 bool isReady; 97 public: 98 99 //アラインメント値 100 int iAlign; 101 102 CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name ) 103 : Prototype( namespaceScopes, name ) 104 , importedNamespaces( importedNamespaces ) 105 , classType( Class ) 106 , pSuperClass( NULL ) 107 , isReady( false ) 108 , iAlign( 0 ) 109 , ConstructorMemberSubIndex( -1 ) 110 , DestructorMemberSubIndex( -1 ) 111 , vtblNum( 0 ) 112 , vtbl_offset( -1 ) 113 , isCompilingConstructor( false ) 114 , isCompilingDestructor( false ) 115 , pobj_NextClass( NULL ) 116 { 117 } 118 CClass() 119 : Prototype() 120 , importedNamespaces() 121 , classType() 122 , pSuperClass( NULL ) 123 , isReady( false ) 124 , iAlign( 0 ) 125 , ConstructorMemberSubIndex( -1 ) 126 , DestructorMemberSubIndex( -1 ) 127 , vtblNum( 0 ) 128 , vtbl_offset( -1 ) 129 , isCompilingConstructor( false ) 130 , isCompilingDestructor( false ) 131 , pobj_NextClass( NULL ) 132 { 133 } 134 ~CClass() 135 { 136 // 動的メンバ 137 BOOST_FOREACH( CMember *member, dynamicMembers ){ 138 delete member; 139 } 140 141 // 静的メンバ 142 BOOST_FOREACH( CMember *member, staticMembers ){ 143 delete member; 144 } 145 } 146 147 void Readed(){ 148 isReady = true; 149 } 150 bool IsReady() const{ 151 return isReady; 152 } 153 154 const NamespaceScopesCollection &GetImportedNamespaces() const 155 { 156 return importedNamespaces; 157 } 158 159 // 継承元クラス 160 bool HasSuperClass() const 161 { 162 return ( pSuperClass != NULL ); 163 } 164 const CClass &GetSuperClass() const 165 { 166 return *pSuperClass; 167 } 168 void SetSuperClass( const CClass *pSuperClass ) 169 { 170 this->pSuperClass = pSuperClass; 171 } 172 173 // Blittable型 174 bool IsBlittableType() const 175 { 176 return !blittableType.IsNull(); 177 } 178 const Type &GetBlittableType() const 179 { 180 return blittableType; 181 } 182 void SetBlittableType( const Type &type ){ 183 blittableType = type; 184 } 185 186 bool IsClass() const; 187 bool IsInterface() const; 188 bool IsEnum() const; 189 bool IsDelegate() const; 190 bool IsStructure() const; 191 void SetClassType( ClassType classType ) 192 { 193 this->classType = classType; 194 } 195 196 197 //コンストラクタをコンパイルしているかどうかのチェックフラグ 198 private: 199 mutable bool isCompilingConstructor; 200 public: 201 void NotifyStartConstructorCompile() const; 202 void NotifyFinishConstructorCompile() const; 203 bool IsCompilingConstructor() const; 204 205 //デストラクタをコンパイルしているかどうかのチェックフラグ 206 private: 207 mutable bool isCompilingDestructor; 208 public: 209 void NotifyStartDestructorCompile() const; 210 void NotifyFinishDestructorCompile() const; 211 bool IsCompilingDestructor() const; 212 213 214 //自身の派生クラスかどうかを確認 215 bool IsSubClass( const CClass *pClass ) const; 216 217 //自身と等しいまたは派生クラスかどうかを確認 218 bool IsEqualsOrSubClass( const CClass *pClass ) const; 219 220 // 自身と等しいまたは派生クラス、基底クラスかどうかを確認 221 bool IsEqualsOrSubClassOrSuperClass( const CClass &objClass ) const; 222 223 // インターフェイス 224 bool HasInterfaces() const 225 { 226 return ( interfaces.size() != 0 ); 227 } 228 bool IsInheritsInterface( const CClass *pInterfaceClass ) const; 18 229 19 230 //継承させる 20 virtualbool Inherits( const char *inheritNames, int nowLine );21 virtualbool InheritsClass( const CClass &inheritsClass, int nowLine );22 virtualbool InheritsInterface( const CClass &inheritsClass, int nowLine );231 bool Inherits( const char *inheritNames, int nowLine ); 232 bool InheritsClass( const CClass &inheritsClass, int nowLine ); 233 bool InheritsInterface( const CClass &inheritsClass, int nowLine ); 23 234 24 235 //メンバ、メソッドの追加 25 236 CMember *CreateMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ); 26 v irtual void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine );27 v irtual void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );28 29 v irtual void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,237 void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine ); 238 void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ); 239 240 void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract, 30 241 bool isVirtual, bool isOverride, char *buffer, int nowLine); 31 242 32 virtual LONG_PTR GetVtblGlobalOffset(void) const; 33 virtual void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection); 34 35 36 // XMLシリアライズ用 37 private: 38 friend class boost::serialization::access; 39 template<class Archive> void serialize(Archive& ar, const unsigned int version) 40 { 41 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( CClass ); 42 } 243 //重複チェック 244 bool DupliCheckAll(const char *name); 245 bool DupliCheckMember(const char *name); 246 247 const Members &GetDynamicMembers() const 248 { 249 return dynamicMembers; 250 } 251 const Members &GetStaticMembers() const 252 { 253 return staticMembers; 254 } 255 Members &GetDynamicMembers() 256 { 257 return dynamicMembers; 258 } 259 Members &GetStaticMembers() 260 { 261 return staticMembers; 262 } 263 264 const Methods &GetMethods() const 265 { 266 return methods; 267 } 268 const Methods &GetStaticMethods() const 269 { 270 return staticMethods; 271 } 272 Methods &GetMethods() 273 { 274 return methods; 275 } 276 Methods &GetStaticMethods() 277 { 278 return staticMethods; 279 } 280 281 //デフォルト コンストラクタ 282 const CMethod *GetConstructorMethod() const 283 { 284 if( ConstructorMemberSubIndex == -1 ) return NULL; 285 return methods[ConstructorMemberSubIndex]; 286 } 287 void SetConstructorMemberSubIndex( int constructorMemberSubIndex ) 288 { 289 this->ConstructorMemberSubIndex = constructorMemberSubIndex; 290 } 291 292 //デストラクタ メソッドを取得 293 const CMethod *GetDestructorMethod() const 294 { 295 if( DestructorMemberSubIndex == -1 ) return NULL; 296 return methods[DestructorMemberSubIndex]; 297 } 298 void SetDestructorMemberSubIndex( int destructorMemberSubIndex ) 299 { 300 this->DestructorMemberSubIndex = destructorMemberSubIndex; 301 } 302 303 // vtblに存在する仮想関数の数 304 int GetVtblNum() const 305 { 306 return vtblNum; 307 } 308 void SetVtblNum( int vtblNum ) 309 { 310 this->vtblNum = vtblNum; 311 } 312 void AddVtblNum( int vtblNum ) 313 { 314 this->vtblNum += vtblNum; 315 } 316 bool IsExistVirtualFunctions() const 317 { 318 return ( vtblNum > 0 ); 319 } 320 321 // メンバの総合サイズを取得 322 int GetSize() const; 323 324 // メンバのオフセットを取得 325 int GetMemberOffset( const char *memberName, int *pMemberNum = NULL ) const; 326 private: 327 // アラインメント値を取得 328 int GetAlignment() const; 329 330 //vtbl 331 protected: 332 mutable long vtbl_offset; 333 public: 334 int GetFuncNumInVtbl( const UserProc *pUserProc ) const; 335 LONG_PTR GetVtblGlobalOffset(void) const; 336 void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection); 337 bool IsAbstract() const; 338 339 340 //線形リスト用 341 CClass *pobj_NextClass; 43 342 }; 44 BOOST_IS_ABSTRACT( CClass ); 45 46 class Classes Impl : public Classes343 344 #define MAX_CLASS_HASH 65535 345 class Classes 47 346 { 48 public: 49 ClassesImpl() 50 : Classes() 51 { 52 } 53 54 virtual CClass *Create( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name); 55 virtual void CollectClassesForNameOnly( const BasicSource &source ); 56 57 virtual void InitStaticMember(); 58 59 private: 60 bool MemberVar_LoopRefCheck(const CClass &objClass); 61 public: 62 virtual void GetClass_recur(const char *lpszInheritsClass); 63 virtual void GetAllClassInfo(); 64 virtual void Compile_System_InitializeUserTypes(); 65 66 virtual const CClass *Find( const NamespaceScopes &namespaceScopes, const string &name ) const; 67 347 CClass *pobj_ClassHash[MAX_CLASS_HASH]; 348 int GetHashCode(const char *name) const; 68 349 69 350 // XMLシリアライズ用 … … 73 354 template<class Archive> void load(Archive& ar, const unsigned int version) 74 355 { 75 std::vector<ClassImpl *> vectorClasses; 356 trace_for_serialize( "serializing(load) - Classes" ); 357 358 std::vector<CClass *> vectorClasses; 76 359 ar & BOOST_SERIALIZATION_NVP( vectorClasses ); 77 360 … … 82 365 Insert( pClass ); 83 366 } 367 Iterator_Init(); 84 368 } 85 369 template<class Archive> void save(Archive& ar, const unsigned int version) const 86 370 { 371 trace_for_serialize( "serializing(save) - Classes" ); 372 87 373 // 保存準備 88 std::vector<C lassImpl*> vectorClasses;374 std::vector<CClass *> vectorClasses; 89 375 vectorClasses.clear(); 90 376 Iterator_Reset(); 91 377 while( Iterator_HasNext() ) 92 378 { 93 vectorClasses.push_back( dynamic_cast<C lassImpl*>(Iterator_GetNext()) );379 vectorClasses.push_back( dynamic_cast<CClass *>(Iterator_GetNext()) ); 94 380 } 95 381 96 382 ar & BOOST_SERIALIZATION_NVP( vectorClasses ); 97 383 } 384 385 public: 386 Classes() 387 : pCompilingMethod( NULL ) 388 , pStringClass( NULL ) 389 , pObjectClass( NULL ) 390 , ppobj_IteClass( NULL ) 391 , iIteMaxNum( 0 ) 392 , iIteNextNum( 0 ) 393 { 394 memset( pobj_ClassHash, 0, MAX_CLASS_HASH * sizeof(CClass *) ); 395 } 396 ~Classes() 397 { 398 for(int i=0;i<MAX_CLASS_HASH;i++){ 399 if(pobj_ClassHash[i]) DestroyClass(pobj_ClassHash[i]); 400 } 401 } 402 void DestroyClass(CClass *pobj_c) 403 { 404 if(pobj_c->pobj_NextClass){ 405 DestroyClass(pobj_c->pobj_NextClass); 406 } 407 408 delete pobj_c; 409 } 410 void Clear() 411 { 412 if(ppobj_IteClass) 413 { 414 free(ppobj_IteClass); 415 ppobj_IteClass = NULL; 416 } 417 // TODO: ここはこれでいいのか… 418 memset( pobj_ClassHash, 0, MAX_CLASS_HASH * sizeof(CClass *) ); 419 } 420 421 virtual CClass *Create( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name); 422 bool Insert( CClass *pClass ); 423 CClass *Add( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name,int nowLine); 424 virtual void CollectClassesForNameOnly( const BasicSource &source ); 425 426 void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection); 427 428 virtual void InitStaticMember(); 429 430 private: 431 bool MemberVar_LoopRefCheck(const CClass &objClass); 432 public: 433 virtual void GetClass_recur(const char *lpszInheritsClass); 434 virtual void GetAllClassInfo(); 435 virtual void Compile_System_InitializeUserTypes(); 436 437 const CClass *Find( const NamespaceScopes &namespaceScopes, const string &name ) const; 438 const CClass *Find( const string &fullName ) const; 439 440 441 ///////////////////////////// 442 // 現在コンパイル中の情報 443 ///////////////////////////// 444 private: 445 const CMethod *pCompilingMethod; 446 public: 447 void StartCompile( const UserProc *pUserProc ); 448 449 //現在コンパイル中のメソッド情報を取得 450 const CMethod *GetNowCompilingMethodInfo(){ 451 return pCompilingMethod; 452 } 453 454 455 ///////////////////////////// 456 // 特殊クラス 457 ///////////////////////////// 458 CClass *pStringClass; 459 CClass *pObjectClass; 460 CClass *GetStringClassPtr() const; 461 CClass *GetObjectClassPtr() const; 462 463 464 ///////////////////// 465 // イテレータ 466 ///////////////////// 467 private: 468 mutable CClass **ppobj_IteClass; 469 mutable int iIteMaxNum; 470 mutable int iIteNextNum; 471 public: 472 void Iterator_Init() const; 473 void Iterator_Reset() const; 474 BOOL Iterator_HasNext() const; 475 CClass *Iterator_GetNext() const; 476 int Iterator_GetMaxCount() const; 98 477 }; 99 BOOST_IS_ABSTRACT( Classes ); -
trunk/abdev/BasicCompiler_Common/include/Compiler.h
r199 r206 34 34 static bool StringToType( const std::string &typeName, Type &type ); 35 35 static const std::string TypeToString( const Type &type ); 36 37 // コンパイル中のクラス 38 const CClass *pCompilingClass; 36 39 }; 37 40 -
trunk/abdev/BasicCompiler_Common/include/Const.h
r201 r206 1 1 #pragma once 2 2 3 #include <jenga/include/smoothie/Type.h> 3 #include <Type.h> 4 #include <Symbol.h> 4 5 5 //定数の基底クラス 6 class ConstBase{ 7 const string name; 8 const NamespaceScopes namespaceScopes; 6 7 void AddConst( const NamespaceScopes &namespaceScopes, char *buffer ); 8 9 //定数 10 class CConst : public Symbol, public Jenga::Common::ObjectInHashmap<CConst> 11 { 12 Type type; 13 _int64 i64data; 14 15 // XMLシリアライズ用 16 private: 17 friend class boost::serialization::access; 18 template<class Archive> void serialize(Archive& ar, const unsigned int version) 19 { 20 trace_for_serialize( "serializing - CConst" ); 21 22 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 23 ar & BOOST_SERIALIZATION_NVP( type ); 24 ar & BOOST_SERIALIZATION_NVP( i64data ); 25 } 9 26 10 27 public: 11 28 12 ConstBase( const NamespaceScopes &namespaceScopes, const string &name ) 13 : namespaceScopes( namespaceScopes ) 14 , name( name ) 29 CConst( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &newType, _int64 i64data) 30 : Symbol( namespaceScopes, name ) 31 , type( newType ) 32 , i64data( i64data ) 15 33 { 16 34 } 17 ~ConstBase() 35 CConst( const NamespaceScopes &namespaceScopes, const std::string &name, int value) 36 : Symbol( namespaceScopes, name ) 37 , type( Type(DEF_LONG) ) 38 , i64data( value ) 39 { 40 } 41 CConst() 42 { 43 } 44 ~CConst() 18 45 { 19 46 } 20 47 21 const string &GetName() const48 virtual const std::string &GetKeyName() const 22 49 { 23 return name;50 return GetName(); 24 51 } 25 52 26 bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const; 27 bool IsEqualSymbol( const string &name ) const; 28 }; 29 30 //定数 31 class CConst:public ConstBase{ 32 Type type; 33 _int64 i64data; 34 35 public: 36 CConst *pNext; 37 38 CConst( const NamespaceScopes &namespaceScopes, const string &name, const Type &newType, _int64 i64data); 39 CConst( const NamespaceScopes &namespaceScopes, const string &name, int value); 40 ~CConst(); 41 42 Type GetType(); 43 _int64 GetWholeData(); 53 Type GetType() 54 { 55 return type; 56 } 57 _int64 GetWholeData() 58 { 59 return i64data; 60 } 44 61 double GetDoubleData(); 45 62 }; 63 class Consts : public Jenga::Common::Hashmap<CConst> 64 { 65 // XMLシリアライズ用 66 private: 67 friend class boost::serialization::access; 68 template<class Archive> void serialize(Archive& ar, const unsigned int version) 69 { 70 trace_for_serialize( "serializing - Consts" ); 46 71 47 //定数マクロ 48 class CConstMacro:public ConstBase{ 49 int ParmNum; 50 char **ppParm; 51 public: 52 53 CConstMacro( const NamespaceScopes &namespaceScopes, const string &name, char *Expression); 54 ~CConstMacro(); 55 }; 56 57 //定数管理クラス 58 class CDBConst{ 59 CConst **ppHash; 60 61 CConstMacro **ppobj_Macro; 62 int NumOfMacro; 63 64 //シングルトンクラスなので、プライベートに置く 65 CDBConst(); 66 ~CDBConst(); 67 void _free(); 68 void Free(); 72 ar & boost::serialization::make_nvp("Hashmap_CConst", 73 boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this)); 74 } 69 75 70 76 public: 71 77 72 void Init();73 74 78 void Add( const NamespaceScopes &namespaceScopes, char *buffer); 75 private: 76 void AddConst( const string &name, CConst *newconst); 77 public: 78 void AddConst( const NamespaceScopes &namespaceScopes, const string &name, char *Expression); 79 void AddConst( const NamespaceScopes &namespaceScopes, const string &name, int value); 79 void Add( const NamespaceScopes &namespaceScopes, const string &name, char *Expression); 80 void Add( const NamespaceScopes &namespaceScopes, const string &name, int value); 80 81 81 82 private: … … 87 88 double GetDoubleData(char *Name); 88 89 bool IsStringPtr(char *Name); 90 }; 89 91 92 //定数マクロ 93 class ConstMacro : public Symbol, public Jenga::Common::ObjectInHashmap<ConstMacro> 94 { 95 std::vector<std::string> parameters; 96 std::string expression; 90 97 91 //シングルトンオブジェクト 92 static CDBConst obj; 98 // XMLシリアライズ用 99 private: 100 friend class boost::serialization::access; 101 template<class Archive> void serialize(Archive& ar, const unsigned int version) 102 { 103 trace_for_serialize( "serializing - ConstMacro" ); 104 105 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 106 ar & BOOST_SERIALIZATION_NVP( parameters ); 107 ar & BOOST_SERIALIZATION_NVP( expression ); 108 } 109 110 public: 111 ConstMacro( const NamespaceScopes &namespaceScopes, const std::string &name, const std::vector<std::string> ¶meters, const string &expression ) 112 : Symbol( namespaceScopes, name ) 113 , parameters( parameters ) 114 , expression( expression ) 115 { 116 } 117 ConstMacro() 118 { 119 } 120 ~ConstMacro() 121 { 122 } 123 124 virtual const std::string &GetKeyName() const 125 { 126 return GetName(); 127 } 128 129 const std::vector<std::string> &GetParameters() const 130 { 131 return parameters; 132 } 133 const std::string &GetExpression() const 134 { 135 return expression; 136 } 137 138 bool GetCalcBuffer( const char *parameterStr, char *dest ) const; 93 139 }; 140 class ConstMacros : public Jenga::Common::Hashmap<ConstMacro> 141 { 142 // XMLシリアライズ用 143 private: 144 friend class boost::serialization::access; 145 template<class Archive> void serialize(Archive& ar, const unsigned int version) 146 { 147 trace_for_serialize( "serializing - ConstMacros" ); 148 149 ar & boost::serialization::make_nvp("Hashmap_ConstMacro", 150 boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this)); 151 } 152 153 public: 154 void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr ); 155 ConstMacro *Find( const std::string &name ); 156 }; -
trunk/abdev/BasicCompiler_Common/include/LexicalScopingImpl.h
r184 r206 26 26 public: 27 27 28 virtual void End(); 29 28 30 //スコープ終了時のデストラクタ呼び出し 29 31 virtual void CallDestructorsOfScopeEnd(); -
trunk/abdev/BasicCompiler_Common/include/MetaImpl.h
r201 r206 3 3 #include <jenga/include/common/BoostXmlSupport.h> 4 4 5 #include <jenga/include/smoothie/ObjectModule.h> 5 #include <option.h> 6 #include <Program.h> 7 #include <Class.h> 8 #include <Procedure.h> 9 #include <TypeDef.h> 10 #include <Variable.h> 11 #include <Const.h> 6 12 7 #include <ClassImpl.h> 8 #include <ProcedureImpl.h> 9 #include <TypeDef.h> 10 11 class MetaImpl : public Meta, public Jenga::Common::BoostXmlSupport<MetaImpl> 13 class MetaImpl : public Jenga::Common::BoostXmlSupport<MetaImpl> 12 14 { 13 15 // 名前空間 14 16 NamespaceScopesCollection namespaceScopesCollection; 15 17 18 // 関数・メソッド 19 UserProcs userProcs; 20 16 21 // クラス 17 ClassesImpl classesImpl; 18 Classes *pNowClassesForDebugger; 22 Classes classesImpl; 23 24 // グローバル変数 25 Variables globalVars; 26 27 // グローバル定数 28 Consts globalConsts; 29 30 // グローバル定数マクロ 31 ConstMacros globalConstMacros; 19 32 20 33 // blittable型 … … 24 37 TypeDefCollection typeDefs; 25 38 39 // 関数ポインタ 40 ProcPointers procPointers; 41 42 // XMLシリアライズ用 43 private: 44 virtual const char *RootTagName() const 45 { 46 return "metaImpl"; 47 } 48 friend class boost::serialization::access; 49 template<class Archive> void serialize(Archive& ar, const unsigned int version) 50 { 51 trace_for_serialize( "serializing - MetaImpl" ); 52 53 ar & BOOST_SERIALIZATION_NVP( namespaceScopesCollection ); 54 ar & BOOST_SERIALIZATION_NVP( userProcs ); 55 ar & BOOST_SERIALIZATION_NVP( classesImpl ); 56 ar & BOOST_SERIALIZATION_NVP( globalVars ); 57 ar & BOOST_SERIALIZATION_NVP( globalConsts ); 58 ar & BOOST_SERIALIZATION_NVP( globalConstMacros ); 59 ar & BOOST_SERIALIZATION_NVP( blittableTypes ); 60 ar & BOOST_SERIALIZATION_NVP( typeDefs ); 61 ar & BOOST_SERIALIZATION_NVP( procPointers ); 62 } 63 64 Classes *pNowClassesForDebugger; 65 26 66 public: 27 67 MetaImpl() 28 : Meta( new ProcPointersImpl() ) 29 , classesImpl() 68 : classesImpl() 30 69 , pNowClassesForDebugger( &classesImpl ) 31 70 { … … 41 80 } 42 81 43 virtual Classes &GetClasses() 82 const UserProcs &GetUserProcs() const 83 { 84 return userProcs; 85 } 86 UserProcs &GetUserProcs() 87 { 88 return userProcs; 89 } 90 91 Classes &GetClasses() 44 92 { 45 93 return *pNowClassesForDebugger; 46 94 } 47 v irtual void SetClasses( Classes *pClasses )95 void SetClasses( Classes *pClasses ) 48 96 { 49 97 this->pNowClassesForDebugger = pClasses; 98 } 99 100 const Variables &GetGlobalVars() const 101 { 102 return globalVars; 103 } 104 Variables &GetGlobalVars() 105 { 106 return globalVars; 107 } 108 109 const Consts &GetGlobalConsts() const 110 { 111 return globalConsts; 112 } 113 Consts &GetGlobalConsts() 114 { 115 return globalConsts; 116 } 117 118 const ConstMacros &GetGlobalConstMacros() const 119 { 120 return globalConstMacros; 121 } 122 ConstMacros &GetGlobalConstMacros() 123 { 124 return globalConstMacros; 50 125 } 51 126 … … 60 135 } 61 136 62 virtual bool AutoWrite( const std::string &filePath ) 137 // 関数ポインタ 138 ProcPointers &GetProcPointers() 139 { 140 return procPointers; 141 } 142 143 bool AutoWrite( const std::string &filePath ) 63 144 { 64 145 std::ofstream ofs( filePath.c_str() ); … … 82 163 return isSuccessful; 83 164 } 84 85 86 // XMLシリアライズ用87 private:88 virtual const char *RootTagName() const89 {90 return "metaImpl";91 }92 friend class boost::serialization::access;93 template<class Archive> void serialize(Archive& ar, const unsigned int version)94 {95 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Meta );96 ar & BOOST_SERIALIZATION_NVP( classesImpl );97 }98 165 }; 99 BOOST_IS_ABSTRACT( Meta ); -
trunk/abdev/BasicCompiler_Common/include/Procedure.h
r201 r206 1 1 #pragma once 2 2 3 #include <jenga/include/smoothie/Procedure.h> 4 5 6 class UserProcImpl : public UserProc 3 #include <jenga/include/common/Hashmap.h> 4 #include <jenga/include/smoothie/Source.h> 5 #include <jenga/include/smoothie/LexicalAnalysis.h> 6 7 #include <option.h> 8 #include <Program.h> 9 #include <Class.h> 10 #include <Method.h> 11 #include <Procedure.h> 12 #include <Parameter.h> 13 #include <Variable.h> 14 15 class CClass; 16 class CMethod; 17 18 class Procedure 7 19 { 8 20 public: 9 UserProcImpl( const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport ) 10 : UserProc( name, kind, isMacro, isCdecl, isExport ) 11 { 12 } 13 virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine, bool isStatic ); 21 // 種類 22 enum Kind{ 23 Sub, 24 Function, 25 }; 26 27 private: 28 string name; // プロシージャ名 29 30 Kind kind; 31 32 bool isCdecl; 33 mutable bool isUsing; 34 35 protected: 36 37 // パラメータ 38 Parameters params; 39 40 // 戻り値の型 41 Type returnType; 42 43 // ソースコードの位置 44 int codePos; 45 46 // XMLシリアライズ用 47 private: 48 private: 49 friend class boost::serialization::access; 50 BOOST_SERIALIZATION_SPLIT_MEMBER(); 51 template<class Archive> void load(Archive& ar, const unsigned int version) 52 { 53 trace_for_serialize( "serializing - Procedure" ); 54 55 std::string _name; 56 ar & BOOST_SERIALIZATION_NVP( _name ); 57 this->name = Operator_NaturalStringToCalcMarkString( _name ); 58 59 ar & BOOST_SERIALIZATION_NVP( kind ); 60 ar & BOOST_SERIALIZATION_NVP( isCdecl ); 61 ar & BOOST_SERIALIZATION_NVP( isUsing ); 62 ar & BOOST_SERIALIZATION_NVP( params ); 63 ar & BOOST_SERIALIZATION_NVP( returnType ); 64 ar & BOOST_SERIALIZATION_NVP( codePos ); 65 } 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 ) 84 , kind( kind ) 85 , isCdecl( isCdecl ) 86 , isUsing( false ) 87 , codePos( -1 ) 88 { 89 } 90 Procedure() 91 { 92 } 93 ~Procedure(){ 94 BOOST_FOREACH( Parameter *pParam, params ){ 95 delete pParam; 96 } 97 } 98 99 const string &GetName() const 100 { 101 return name; 102 } 103 104 bool IsSub() const 105 { 106 return ( kind == Sub ); 107 } 108 bool IsFunction() const 109 { 110 return ( kind == Function ); 111 } 112 113 bool IsCdecl() const 114 { 115 return isCdecl; 116 } 117 void Using() const 118 { 119 isUsing = true; 120 } 121 bool IsUsing() const 122 { 123 return isUsing; 124 } 125 126 int GetCodePos() const 127 { 128 return codePos; 129 } 130 131 const Parameters &Params() const 132 { 133 return params; 134 } 135 const Type &ReturnType() const 136 { 137 return returnType; 138 } 14 139 }; 15 140 16 class GlobalProc : public UserProcImpl141 class UserProc : public Procedure, public Jenga::Common::ObjectInHashmap<UserProc> 17 142 { 18 const NamespaceScopes namespaceScopes; 19 const NamespaceScopesCollection importedNamespaces; 143 public: 144 string _paramStr; 145 146 private: 147 NamespaceScopes namespaceScopes; 148 NamespaceScopesCollection importedNamespaces; 149 150 // 親クラスと対応するメソッド 151 const CClass *pParentClass; 152 CMethod *pMethod; 153 154 bool isMacro; 155 156 // パラメータの追加情報 157 int secondParmNum; 158 Parameters realParams; 159 int realSecondParmNum; 160 161 // 各種フラグ 162 bool isExport; 163 mutable bool isSystem; 164 mutable bool isAutoGeneration; 165 mutable bool isCompiled; 166 167 mutable DWORD beginOpAddress; 168 mutable DWORD endOpAddress; 169 170 // ローカル変数 171 mutable Variables localVars; 172 173 // 識別ID 174 int id; 175 176 // XMLシリアライズ用 177 private: 178 friend class boost::serialization::access; 179 template<class Archive> void serialize(Archive& ar, const unsigned int version) 180 { 181 trace_for_serialize( "serializing - UserProc" ); 182 183 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 184 ar & BOOST_SERIALIZATION_NVP( _paramStr ); 185 ar & BOOST_SERIALIZATION_NVP( namespaceScopes ); 186 ar & BOOST_SERIALIZATION_NVP( importedNamespaces ); 187 ar & boost::serialization::make_nvp("pParentClass", const_cast<CClass *&>(pParentClass) ); 188 ar & BOOST_SERIALIZATION_NVP( pMethod ); 189 ar & BOOST_SERIALIZATION_NVP( isMacro ); 190 ar & BOOST_SERIALIZATION_NVP( secondParmNum ); 191 ar & BOOST_SERIALIZATION_NVP( realParams ); 192 ar & BOOST_SERIALIZATION_NVP( realSecondParmNum ); 193 ar & BOOST_SERIALIZATION_NVP( isExport ); 194 ar & BOOST_SERIALIZATION_NVP( isSystem ); 195 ar & BOOST_SERIALIZATION_NVP( isAutoGeneration ); 196 ar & BOOST_SERIALIZATION_NVP( isCompiled ); 197 ar & BOOST_SERIALIZATION_NVP( beginOpAddress ); 198 ar & BOOST_SERIALIZATION_NVP( endOpAddress ); 199 ar & BOOST_SERIALIZATION_NVP( localVars ); 200 ar & BOOST_SERIALIZATION_NVP( id ); 201 } 202 203 public: 204 205 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 ) 208 , importedNamespaces( importedNamespaces ) 209 , pParentClass( NULL ) 210 , pMethod( NULL ) 211 , isMacro( isMacro ) 212 , isExport( isExport ) 213 , isSystem( false ) 214 , isAutoGeneration( false ) 215 , isCompiled( false ) 216 , beginOpAddress( 0 ) 217 , endOpAddress( 0 ) 218 , id( id ) 219 { 220 } 221 UserProc() 222 { 223 } 224 ~UserProc() 225 { 226 BOOST_FOREACH( Parameter *pParam, realParams ){ 227 delete pParam; 228 } 229 } 230 231 virtual const std::string &GetKeyName() const 232 { 233 return GetName(); 234 } 235 236 bool IsMacro() const 237 { 238 return isMacro; 239 } 240 241 int GetSecondParmNum() const 242 { 243 return secondParmNum; 244 } 245 const Parameters &RealParams() const 246 { 247 return realParams; 248 } 249 int GetRealSecondParmNum() const 250 { 251 return realSecondParmNum; 252 } 253 254 void ExportOff(){ 255 isExport = false; 256 } 257 bool IsExport() const 258 { 259 return isExport; 260 } 261 void ThisIsSystemProc() const 262 { 263 isSystem = true; 264 } 265 bool IsSystem() const 266 { 267 return isSystem; 268 } 269 void ThisIsAutoGenerationProc() const 270 { 271 isAutoGeneration = true; 272 } 273 bool IsAutoGeneration() const 274 { 275 return isAutoGeneration; 276 } 277 void CompleteCompile() const 278 { 279 isCompiled = true; 280 } 281 void KillCompileStatus() const 282 { 283 isCompiled = false; 284 } 285 bool IsCompiled() const 286 { 287 return isCompiled; 288 } 289 bool IsDestructor() const 290 { 291 return ( GetName()[0] == '~' ); 292 } 293 294 // バイナリコード位置とサイズ 295 DWORD GetBeginOpAddress() const 296 { 297 return beginOpAddress; 298 } 299 void SetBeginOpAddress( DWORD beginOpAddress ) const 300 { 301 this->beginOpAddress = beginOpAddress; 302 } 303 DWORD GetEndOpAddress() const 304 { 305 return endOpAddress; 306 } 307 void SetEndOpAddress( DWORD endOpAddress ) const 308 { 309 this->endOpAddress = endOpAddress; 310 } 311 int GetCodeSize() const 312 { 313 return endOpAddress - beginOpAddress; 314 } 315 316 const NamespaceScopes &GetNamespaceScopes() const; 317 const NamespaceScopesCollection &GetImportedNamespaces() const; 318 319 Variables &GetLocalVars() const 320 { 321 return localVars; 322 } 323 324 int GetId() const 325 { 326 return id; 327 } 328 329 std::string GetFullName() const; 330 331 virtual bool IsDuplication( const UserProc *pUserProc ) const 332 { 333 if( this->GetParentClassPtr() == pUserProc->GetParentClassPtr() 334 && pUserProc->IsEqualSymbol( *this ) 335 && this->Params().Equals( pUserProc->Params() ) ) 336 { 337 return true; 338 } 339 return false; 340 } 341 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 bool IsVirtual() const; 347 348 void SetParentClass( const CClass *pParentClass ){ 349 this->pParentClass = pParentClass; 350 } 351 const CClass *GetParentClassPtr() const 352 { 353 return pParentClass; 354 } 355 const CClass &GetParentClass() const 356 { 357 return *pParentClass; 358 } 359 bool HasParentClass() const 360 { 361 return ( pParentClass != NULL ); 362 } 363 void SetMethod( CMethod *pMethod ){ 364 this->pMethod = pMethod; 365 } 366 367 bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine, bool isStatic ); 368 369 370 371 ///////////////////////////////////////////////////////////////// 372 // コンパイル中の関数を管理 373 ///////////////////////////////////////////////////////////////// 374 private: 375 static const UserProc *pCompilingUserProc; 376 public: 377 static void CompileStartForGlobalArea(){ 378 pCompilingUserProc = NULL; 379 } 380 static void CompileStartForUserProc( const UserProc *pUserProc ){ 381 pCompilingUserProc = pUserProc; 382 } 383 static bool IsGlobalAreaCompiling(){ 384 return ( pCompilingUserProc == NULL ); 385 } 386 static bool IsLocalAreaCompiling(){ 387 return ( pCompilingUserProc != NULL ); 388 } 389 static const UserProc &CompilingUserProc(){ 390 return *pCompilingUserProc; 391 } 392 }; 393 394 class UserProcs : public Jenga::Common::Hashmap<UserProc> 395 { 396 std::vector<std::string> macroNames; 397 398 // XMLシリアライズ用 399 private: 400 friend class boost::serialization::access; 401 template<class Archive> void serialize(Archive& ar, const unsigned int version) 402 { 403 trace_for_serialize( "serializing - UserProcs" ); 404 405 ar & boost::serialization::make_nvp("Hashmap_UserProcImpl", 406 boost::serialization::base_object<Jenga::Common::Hashmap<UserProc>>(*this)); 407 ar & BOOST_SERIALIZATION_NVP( macroNames ); 408 } 409 410 411 public: 412 UserProcs() 413 { 414 } 415 ~UserProcs() 416 { 417 } 418 419 bool Insert( UserProc *pUserProc, int nowLine ); 420 421 UserProc *Add( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, char *buffer,int nowLine,bool isVirtual,CClass *pobj_c, bool isStatic); 422 423 void EnumGlobalProcs( const char *simpleName, const char *localName, std::vector<const UserProc *> &subs ); 424 425 static void CollectUserProcs( const BasicSource &source, UserProcs &userProcs ); 426 }; 427 428 class DllProc : public Procedure 429 { 430 NamespaceScopes namespaceScopes; 431 432 string dllFileName; 433 string alias; 434 int lookupAddress; 435 436 // XMLシリアライズ用 437 private: 438 friend class boost::serialization::access; 439 template<class Archive> void serialize(Archive& ar, const unsigned int version) 440 { 441 trace_for_serialize( "serializing - DllProc" ); 442 443 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 444 ar & BOOST_SERIALIZATION_NVP( namespaceScopes ); 445 ar & BOOST_SERIALIZATION_NVP( dllFileName ); 446 ar & BOOST_SERIALIZATION_NVP( alias ); 447 ar & BOOST_SERIALIZATION_NVP( lookupAddress ); 448 } 449 20 450 public: 21 451 // ハッシュリスト用 22 GlobalProc *pNextData;23 24 GlobalProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport):25 UserProcImpl( name, kind, isMacro, isCdecl, isExport),452 DllProc *pNextData; 453 454 DllProc( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl, const string &dllFileName, const string &alias ): 455 Procedure( name, kind, isCdecl ), 26 456 namespaceScopes( namespaceScopes ), 27 importedNamespaces( importedNamespaces ), 457 dllFileName( dllFileName ), 458 alias( alias ), 459 lookupAddress( 0 ), 28 460 pNextData( NULL ) 29 {} 30 ~GlobalProc(){} 31 32 virtual const NamespaceScopes &GetNamespaceScopes() const; 33 virtual const NamespaceScopesCollection &GetImportedNamespaces() const 34 { 35 return importedNamespaces; 36 } 461 { 462 } 463 ~DllProc(){} 37 464 38 465 virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const; 39 virtual bool IsEqualSymbol( const GlobalProc &globalProc ) const; 40 virtual bool IsEqualSymbol( const string &name ) const; 466 bool IsEqualSymbol( const string &name ) const; 467 468 const NamespaceScopes &GetNamespaceScopes() const 469 { 470 return namespaceScopes; 471 } 472 473 const string &GetDllFileName() const 474 { 475 return dllFileName; 476 } 477 const string &GetAlias() const 478 { 479 return alias; 480 } 481 482 void SetLookupAddress( int lookupAddress ){ 483 this->lookupAddress = lookupAddress; 484 } 485 int GetLookupAddress() const 486 { 487 return lookupAddress; 488 } 489 490 bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine ); 41 491 }; 42 492 43 class DllProcImpl : public DllProc493 class ProcPointer : public Procedure 44 494 { 45 public: 46 DllProcImpl( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl, const string &dllFileName, const string &alias ) 47 : DllProc( namespaceScopes, name, kind, isCdecl, dllFileName, alias ) 48 { 49 } 50 51 virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const; 495 // XMLシリアライズ用 496 private: 497 friend class boost::serialization::access; 498 template<class Archive> void serialize(Archive& ar, const unsigned int version) 499 { 500 trace_for_serialize( "serializing - ProcPointer" ); 501 502 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); 503 } 504 505 public: 506 ProcPointer( Kind kind ) 507 : Procedure( "", kind, false ) 508 { 509 } 510 ProcPointer() 511 { 512 } 513 ~ProcPointer(){} 52 514 53 515 virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine ); 54 516 }; 55 517 56 class ProcPointer Impl : public ProcPointer518 class ProcPointers : public vector<ProcPointer *> 57 519 { 58 public: 59 ProcPointerImpl( Kind kind ):60 ProcPointer( kind )61 {62 }63 64 virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine ); 65 }; 66 67 class ProcPointersImpl : public ProcPointers 68 { 69 public: 70 ProcPointers Impl()71 { 72 } 73 ~ProcPointers Impl()520 // XMLシリアライズ用 521 private: 522 friend class boost::serialization::access; 523 template<class Archive> void serialize(Archive& ar, const unsigned int version) 524 { 525 trace_for_serialize( "serializing - ProcPointers" ); 526 527 ar & boost::serialization::make_nvp("vector_ProcPointer", 528 boost::serialization::base_object<vector<ProcPointer *>>(*this)); 529 } 530 531 public: 532 ProcPointers() 533 { 534 } 535 ~ProcPointers() 74 536 { 75 537 Clear(); -
trunk/abdev/BasicCompiler_Common/include/SmoothieImpl.h
r193 r206 2 2 3 3 #include <jenga/include/smoothie/Smoothie.h> 4 #include <jenga/include/smoothie/ObjectModule.h>5 4 6 5 #include <MetaImpl.h> -
trunk/abdev/BasicCompiler_Common/include/TypeDef.h
r193 r206 4 4 #include <string> 5 5 6 #include <jenga/include/smoothie/Type.h>7 6 #include <jenga/include/smoothie/Namespace.h> 7 8 #include <Type.h> 9 #include <Symbol.h> 8 10 9 11 using namespace std; … … 11 13 class TypeDefCollection; 12 14 13 class TypeDef{ 15 class TypeDef : public Symbol 16 { 14 17 friend TypeDefCollection; 15 18 16 NamespaceScopes namespaceScopes;17 18 string name;19 19 string baseName; 20 20 Type baseType; 21 22 // XMLシリアライズ用 23 private: 24 friend class boost::serialization::access; 25 template<class Archive> void serialize(Archive& ar, const unsigned int version) 26 { 27 trace_for_serialize( "serializing - TypeDef" ); 28 29 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); 30 ar & BOOST_SERIALIZATION_NVP( baseName ); 31 ar & BOOST_SERIALIZATION_NVP( baseType ); 32 } 33 21 34 public: 22 35 TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName, int nowLine ); 23 ~TypeDef(); 36 TypeDef() 37 { 38 } 39 ~TypeDef() 40 { 41 } 24 42 25 const string &GetName() const26 {27 return name;28 }29 43 const string &GetBaseName() const 30 44 { … … 35 49 return baseType; 36 50 } 37 38 bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;39 bool IsEqualSymbol( const string &name ) const;40 51 }; 41 52 42 class TypeDefCollection : public vector<TypeDef>53 class TypeDefCollection : public std::vector<TypeDef> 43 54 { 55 // XMLシリアライズ用 56 private: 57 friend class boost::serialization::access; 58 template<class Archive> void serialize(Archive& ar, const unsigned int version) 59 { 60 trace_for_serialize( "serializing - TypeDefCollection" ); 61 62 ar & boost::serialization::make_nvp("vector_TypeDef", 63 boost::serialization::base_object<std::vector<TypeDef>>(*this)); 64 } 65 44 66 public: 45 67 TypeDefCollection(); -
trunk/abdev/BasicCompiler_Common/include/option.h
r182 r206 23 23 24 24 // ログ生成しない場合はこの下の行をコメントアウトする 25 //#define USE_TRACE25 #define USE_TRACE 26 26 27 27 // オーバーロードに関するログを生成する 28 #define USE_TRACE_FOR_OVERLOAD28 //#define USE_TRACE_FOR_OVERLOAD 29 29 30 30 // モジュールサイズに関するログを生成する 31 #define USE_TRACE_FOR_SIZE 31 //#define USE_TRACE_FOR_SIZE 32 33 // XMLシリアライズに関するログを生成する 34 #define USE_TRACE_FOR_SERIALIZE 35 36 // ソースコードステップに関するログを生成する 37 #define USE_TRACE_FOR_SOURCECODESTEP 32 38 33 39 … … 53 59 #define trace_for_size(s) 54 60 #endif 61 62 #ifdef USE_TRACE_FOR_SERIALIZE 63 #define trace_for_serialize(s) trace(s) 64 #else 65 #define trace_for_serialize(s) 66 #endif 67 68 #ifdef USE_TRACE_FOR_SOURCECODESTEP 69 #define trace_for_sourcecodestep(s) trace( "[source code step] " << s) 70 #else 71 #define trace_for_sourcecodestep(s) 72 #endif
Note:
See TracChangeset
for help on using the changeset viewer.