source: dev/trunk/abdev/BasicCompiler_Common/include/Compiler.h@ 308

Last change on this file since 308 was 308, checked in by dai_9181, 17 years ago

静的リンクライブラリにより、複数のグローバル領域が存在することになったのでそれぞれを関数ベースに分けた

File size: 2.6 KB
RevLine 
[184]1#pragma once
2
3#include <CodeGenerator.h>
[199]4#include <NamespaceSupporter.h>
[256]5#include <Meta.h>
[224]6#include <DataTable.h>
[225]7#include <CodeGenerator.h>
[270]8#include <ObjectModule.h>
[256]9#include <Linker.h>
[193]10
[184]11class Compiler
12{
[308]13 // モジュール名
14 std::string moduleName;
15
[199]16 // 名前空間サポート
17 NamespaceSupporter namespaceSupporter;
18
[265]19 // オブジェクトモジュール
20 ObjectModule *pObjectModule;
21 ObjectModule *pNowObjectModule;
22
[184]23public:
[193]24
[265]25 Compiler()
26 : pObjectModule( new ObjectModule )
27 , pNowObjectModule( pObjectModule )
[266]28 , targetModuleType( Exe )
[294]29 , isCore( false )
[265]30 {
31 }
32 ~Compiler()
33 {
34 delete pObjectModule;
[270]35 Clear();
[265]36 }
[270]37 void Clear()
38 {
39 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries )
40 {
41 delete pStaticLibrary;
42 }
43 staticLibraries.clear();
44 }
[265]45
[270]46 void StaticLink( ObjectModules &staticLibraries );
47
[308]48 // モジュール名
49 void SetModuleName( const std::string &moduleName )
50 {
51 this->moduleName = moduleName;
52 }
53 const std::string &GetModuleName() const
54 {
55 return moduleName;
56 }
57
58 // 名前空間サポート
[199]59 NamespaceSupporter &GetNamespaceSupporter()
60 {
61 return namespaceSupporter;
62 }
63
[225]64 // コード生成機構
65 CodeGenerator codeGenerator;
66
[256]67 // リンカ
68 Linker linker;
69
[269]70 // 静的リンクするオブジェクトファイル
71 std::vector<std::string> staticLibraryFilePaths;
72
[270]73 // 静的リンクするオブジェクトモジュール
74 ObjectModules staticLibraries;
75
[266]76 // オブジェクトモジュール
[265]77 ObjectModule &GetObjectModule()
78 {
79 return *pNowObjectModule;
80 }
81 void SelectObjectModule( ObjectModule &objectModule )
82 {
83 pNowObjectModule = &objectModule;
84 }
85
[266]86
87 // ターゲット
88 enum TargetModuleType
89 {
90 Exe,
91 Dll,
92 StaticLibrary,
93 };
94
95 TargetModuleType targetModuleType;
96
97 bool IsExe() const
98 {
99 if( targetModuleType == Exe )
100 {
101 return true;
102 }
103 return false;
104 }
105 bool IsDll() const
106 {
107 if( targetModuleType == Dll )
108 {
109 return true;
110 }
111 return false;
112 }
113 bool IsStaticLibrary() const
114 {
115 if( targetModuleType == StaticLibrary )
116 {
117 return true;
118 }
119 return false;
120 }
121 void SetTargetModuleType( TargetModuleType targetModuleType )
122 {
123 this->targetModuleType = targetModuleType;
124 }
125
126
[294]127 // コアモジュールかどうか
128 bool isCore;
129 void SetCoreMark( bool isCore )
130 {
131 this->isCore = isCore;
132 }
133 bool IsCore() const
134 {
135 return isCore;
136 }
137
[308]138 // グローバルエリアが置かれる関数名
139 std::string globalAreaProcName;
[294]140
[308]141
[299]142 bool StringToType( const std::string &typeName, Type &type );
143 const std::string TypeToString( const Type &type );
[206]144
145 // コンパイル中のクラス
146 const CClass *pCompilingClass;
[184]147};
[193]148
[195]149extern Compiler compiler;
Note: See TracBrowser for help on using the repository browser.