source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h@ 504

Last change on this file since 504 was 504, checked in by dai_9181, 16 years ago

Symbol::RegistNamespaceSupporterメソッドを追加。

File size: 3.5 KB
RevLine 
[184]1#pragma once
2
[465]3#include <Messenger.h>
[184]4#include <CodeGenerator.h>
[199]5#include <NamespaceSupporter.h>
[256]6#include <Meta.h>
[224]7#include <DataTable.h>
[225]8#include <CodeGenerator.h>
[270]9#include <ObjectModule.h>
[256]10#include <Linker.h>
[322]11#include <Delegate.h>
[357]12#include <Exception.h>
[407]13#include <Enum.h>
[193]14
[184]15class Compiler
16{
[459]17public:
18 // ターゲット
19 enum TargetModuleType
20 {
21 Exe,
22 Dll,
23 StaticLibrary,
24 };
25
26private:
[472]27 // ビルド成功のフラグ
28 bool isBuildSuccessful;
29
[308]30 // モジュール名
31 std::string moduleName;
32
[459]33 // モジュール タイプ
34 TargetModuleType targetModuleType;
35
36 // デバッグ ビルドかどうか
37 bool isDebug;
38
[461]39 // Unicode対応モジュールかどうか
40 bool isUnicode;
41
[199]42 // 名前空間サポート
43 NamespaceSupporter namespaceSupporter;
44
[265]45 // オブジェクトモジュール
46 ObjectModule *pObjectModule;
47 ObjectModule *pNowObjectModule;
48
[184]49public:
[193]50
[265]51 Compiler()
[472]52 : isBuildSuccessful( false )
53 , pObjectModule( new ObjectModule )
[265]54 , pNowObjectModule( pObjectModule )
[266]55 , targetModuleType( Exe )
[459]56 , isDebug( false )
[461]57 , isUnicode( false )
[294]58 , isCore( false )
[265]59 {
[504]60 Symbol::RegistNamespaceSupporter( &namespaceSupporter );
[265]61 }
62 ~Compiler()
63 {
64 delete pObjectModule;
[270]65 Clear();
[265]66 }
[270]67 void Clear()
68 {
69 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries )
70 {
71 delete pStaticLibrary;
72 }
73 staticLibraries.clear();
74 }
[265]75
[270]76 void StaticLink( ObjectModules &staticLibraries );
77
[472]78 // ビルド成功のフラグ
79 bool IsBuildSuccessful() const
80 {
81 return isBuildSuccessful;
82 }
83 void BuildSuccessful()
84 {
85 isBuildSuccessful = true;
86 }
87
[308]88 // モジュール名
89 void SetModuleName( const std::string &moduleName )
90 {
91 this->moduleName = moduleName;
92 }
93 const std::string &GetModuleName() const
94 {
95 return moduleName;
96 }
97
98 // 名前空間サポート
[199]99 NamespaceSupporter &GetNamespaceSupporter()
100 {
101 return namespaceSupporter;
102 }
103
[465]104 // メッセンジャー
105 Messenger messenger;
106 ErrorMessenger errorMessenger;
107
[225]108 // コード生成機構
109 CodeGenerator codeGenerator;
110
[256]111 // リンカ
112 Linker linker;
113
[269]114 // 静的リンクするオブジェクトファイル
115 std::vector<std::string> staticLibraryFilePaths;
116
[270]117 // 静的リンクするオブジェクトモジュール
118 ObjectModules staticLibraries;
119
[266]120 // オブジェクトモジュール
[265]121 ObjectModule &GetObjectModule()
122 {
123 return *pNowObjectModule;
124 }
125 void SelectObjectModule( ObjectModule &objectModule )
126 {
127 pNowObjectModule = &objectModule;
128 }
129
[266]130 bool IsExe() const
131 {
132 if( targetModuleType == Exe )
133 {
134 return true;
135 }
136 return false;
137 }
138 bool IsDll() const
139 {
140 if( targetModuleType == Dll )
141 {
142 return true;
143 }
144 return false;
145 }
146 bool IsStaticLibrary() const
147 {
148 if( targetModuleType == StaticLibrary )
149 {
150 return true;
151 }
152 return false;
153 }
154 void SetTargetModuleType( TargetModuleType targetModuleType )
155 {
156 this->targetModuleType = targetModuleType;
157 }
158
[459]159 void SetDebugMark( bool isDebug )
160 {
161 this->isDebug = isDebug;
162 }
163 bool IsDebug() const
164 {
165 return isDebug;
166 }
[266]167
[461]168 void SetUnicodeMark( bool isUnicode )
169 {
170 this->isUnicode = isUnicode;
171 }
172 bool IsUnicode()
173 {
174 return isUnicode;
175 }
[459]176
[461]177
[294]178 // コアモジュールかどうか
179 bool isCore;
180 void SetCoreMark( bool isCore )
181 {
182 this->isCore = isCore;
183 }
184 bool IsCore() const
185 {
186 return isCore;
187 }
188
[308]189 // グローバルエリアが置かれる関数名
190 std::string globalAreaProcName;
[294]191
[406]192 // 列挙型
193 EnumInfoCollection enumInfoCollection;
[308]194
[406]195
[299]196 bool StringToType( const std::string &typeName, Type &type );
197 const std::string TypeToString( const Type &type );
[206]198
199 // コンパイル中のクラス
200 const CClass *pCompilingClass;
[184]201};
[193]202
[195]203extern Compiler compiler;
Note: See TracBrowser for help on using the repository browser.