Changeset 270 in dev for trunk/abdev/BasicCompiler_Common/include
- Timestamp:
- Aug 9, 2007, 3:18:40 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common/include
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/include/Class.h
r266 r270 31 31 typedef vector<InheritedInterface> Interfaces; 32 32 33 class CClass: public Prototype 33 class CClass: public Prototype, public Jenga::Common::ObjectInHashmap<CClass> 34 34 { 35 35 public: … … 148 148 } 149 149 150 virtual const std::string &GetKeyName() const 151 { 152 return GetName(); 153 } 154 virtual bool IsDuplication( const CClass *pClass ) const 155 { 156 if( pClass->IsEqualSymbol( *this ) ) 157 { 158 return true; 159 } 160 return false; 161 } 162 150 163 void Readed(){ 151 164 isReady = true; … … 355 368 }; 356 369 357 #define MAX_CLASS_HASH 65535 358 class Classes 370 class Classes : public Jenga::Common::Hashmap<CClass> 359 371 { 360 CClass *pobj_ClassHash[MAX_CLASS_HASH];361 int GetHashCode(const char *name) const;362 363 372 // XMLシリアライズ用 364 private:365 friend class boost::serialization::access;366 BOOST_SERIALIZATION_SPLIT_MEMBER();367 template<class Archive> void load(Archive& ar, const unsigned int version)368 {369 trace_for_serialize( "serializing(load) - Classes" );370 371 std::vector<CClass *> vectorClasses;372 ar & BOOST_SERIALIZATION_NVP( vectorClasses );373 374 // 読み込み後の処理375 Clear();376 BOOST_FOREACH( CClass *pClass, vectorClasses )377 {378 Insert( pClass );379 }380 Iterator_Init();381 }382 template<class Archive> void save(Archive& ar, const unsigned int version) const383 {384 trace_for_serialize( "serializing(save) - Classes" );385 386 // 保存準備387 std::vector<CClass *> vectorClasses;388 vectorClasses.clear();389 Iterator_Reset();390 while( Iterator_HasNext() )391 {392 vectorClasses.push_back( dynamic_cast<CClass *>(Iterator_GetNext()) );393 }394 395 ar & BOOST_SERIALIZATION_NVP( vectorClasses );396 }397 398 373 public: 399 374 Classes() … … 401 376 , pStringClass( NULL ) 402 377 , pObjectClass( NULL ) 403 , ppobj_IteClass( NULL ) 404 , iIteMaxNum( 0 ) 405 , iIteNextNum( 0 ) 406 { 407 memset( pobj_ClassHash, 0, MAX_CLASS_HASH * sizeof(CClass *) ); 378 { 408 379 } 409 380 ~Classes() 410 381 { 411 for(int i=0;i<MAX_CLASS_HASH;i++){412 if(pobj_ClassHash[i]) DestroyClass(pobj_ClassHash[i]);413 }414 }415 void DestroyClass(CClass *pobj_c)416 {417 if(pobj_c->pobj_NextClass){418 DestroyClass(pobj_c->pobj_NextClass);419 }420 421 delete pobj_c;422 }423 void Clear()424 {425 if(ppobj_IteClass)426 {427 free(ppobj_IteClass);428 ppobj_IteClass = NULL;429 }430 // TODO: ここはこれでいいのか…431 memset( pobj_ClassHash, 0, MAX_CLASS_HASH * sizeof(CClass *) );432 382 } 433 383 … … 473 423 CClass *GetStringClassPtr() const; 474 424 CClass *GetObjectClassPtr() const; 475 476 477 /////////////////////478 // イテレータ479 /////////////////////480 private:481 mutable CClass **ppobj_IteClass;482 mutable int iIteMaxNum;483 mutable int iIteNextNum;484 public:485 void Iterator_Init() const;486 void Iterator_Reset() const;487 BOOL Iterator_HasNext() const;488 CClass *Iterator_GetNext() const;489 int Iterator_GetMaxCount() const;490 425 }; -
trunk/abdev/BasicCompiler_Common/include/Compiler.h
r269 r270 6 6 #include <DataTable.h> 7 7 #include <CodeGenerator.h> 8 #include <ObjectModule.h> 8 9 #include <Linker.h> 9 10 … … 28 29 { 29 30 delete pObjectModule; 31 Clear(); 30 32 } 33 void Clear() 34 { 35 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries ) 36 { 37 delete pStaticLibrary; 38 } 39 staticLibraries.clear(); 40 } 41 42 void StaticLink( ObjectModules &staticLibraries ); 31 43 32 44 NamespaceSupporter &GetNamespaceSupporter() … … 46 58 // 静的リンクするオブジェクトファイル 47 59 std::vector<std::string> staticLibraryFilePaths; 60 61 // 静的リンクするオブジェクトモジュール 62 ObjectModules staticLibraries; 48 63 49 64 // オブジェクトモジュール … … 98 113 99 114 100 101 115 static bool StringToType( const std::string &typeName, Type &type ); 102 116 static const std::string TypeToString( const Type &type ); -
trunk/abdev/BasicCompiler_Common/include/Hashmap.h
r215 r270 52 52 } 53 53 54 // 内容を破棄せずにすべて抜き取る 55 void PullOutAll() 56 { 57 memset( hashArray, 0, MAX_HASHMAP*sizeof(T*) ); 58 } 59 54 60 bool Put( T* value ) 55 61 { … … 81 87 82 88 T* GetHashArrayElement( const char *keyName ) 89 { 90 return hashArray[GetHash(keyName)]; 91 } 92 const T* GetHashArrayElement( const char *keyName ) const 83 93 { 84 94 return hashArray[GetHash(keyName)]; … … 222 232 return pNextObject; 223 233 } 234 const T *GetChainNext() const 235 { 236 return pNextObject; 237 } 224 238 void SetChainNext( T *pNextObject ) 225 239 { -
trunk/abdev/BasicCompiler_Common/include/Linker.h
r268 r270 1 1 #pragma once 2 3 class ObjectModule : public Jenga::Common::BoostSerializationSupport<ObjectModule>4 {5 public:6 // メタ情報7 Meta meta;8 9 // グローバル領域のネイティブコード10 NativeCode globalNativeCode;11 12 // データテーブル13 DataTable dataTable;14 15 // XMLシリアライズ用16 private:17 virtual const char *RootTagName() const18 {19 return "objectModule";20 }21 friend class boost::serialization::access;22 template<class Archive> void serialize(Archive& ar, const unsigned int version)23 {24 trace_for_serialize( "serializing - objectModule" );25 26 ar & BOOST_SERIALIZATION_NVP( meta );27 ar & BOOST_SERIALIZATION_NVP( globalNativeCode );28 ar & BOOST_SERIALIZATION_NVP( dataTable );29 }30 };31 2 32 3 class Linker -
trunk/abdev/BasicCompiler_Common/include/Meta.h
r256 r270 70 70 { 71 71 } 72 73 // 静的リンク 74 void StaticLink( Meta &meta ); 72 75 73 76 const NamespaceScopesCollection &GetNamespaces() const -
trunk/abdev/BasicCompiler_Common/include/Procedure.h
r266 r270 58 58 59 59 public: 60 bool isTargetObjectModule; 60 61 Procedure( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl ) 61 62 : Symbol( namespaceScopes, name ) … … 64 65 , isUsing( false ) 65 66 , codePos( -1 ) 67 , isTargetObjectModule( true ) 66 68 { 67 69 } 68 70 Procedure() 71 : isTargetObjectModule( true ) 69 72 { 70 73 } -
trunk/abdev/BasicCompiler_Common/include/option.h
r215 r270 37 37 38 38 // XMLシリアライズに関するログを生成する 39 #define USE_TRACE_FOR_SERIALIZE39 //#define USE_TRACE_FOR_SERIALIZE 40 40 41 41 // ソースコードステップに関するログを生成する
Note:
See TracChangeset
for help on using the changeset viewer.