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

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

デプロイ時にcore.lib/cored.libのビルドもできるようにした。

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 {
60 }
61 ~Compiler()
62 {
63 delete pObjectModule;
[270]64 Clear();
[265]65 }
[270]66 void Clear()
67 {
68 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries )
69 {
70 delete pStaticLibrary;
71 }
72 staticLibraries.clear();
73 }
[265]74
[270]75 void StaticLink( ObjectModules &staticLibraries );
76
[472]77 // ビルド成功のフラグ
78 bool IsBuildSuccessful() const
79 {
80 return isBuildSuccessful;
81 }
82 void BuildSuccessful()
83 {
84 isBuildSuccessful = true;
85 }
86
[308]87 // モジュール名
88 void SetModuleName( const std::string &moduleName )
89 {
90 this->moduleName = moduleName;
91 }
92 const std::string &GetModuleName() const
93 {
94 return moduleName;
95 }
96
97 // 名前空間サポート
[199]98 NamespaceSupporter &GetNamespaceSupporter()
99 {
100 return namespaceSupporter;
101 }
102
[465]103 // メッセンジャー
104 Messenger messenger;
105 ErrorMessenger errorMessenger;
106
[225]107 // コード生成機構
108 CodeGenerator codeGenerator;
109
[256]110 // リンカ
111 Linker linker;
112
[269]113 // 静的リンクするオブジェクトファイル
114 std::vector<std::string> staticLibraryFilePaths;
115
[270]116 // 静的リンクするオブジェクトモジュール
117 ObjectModules staticLibraries;
118
[266]119 // オブジェクトモジュール
[265]120 ObjectModule &GetObjectModule()
121 {
122 return *pNowObjectModule;
123 }
124 void SelectObjectModule( ObjectModule &objectModule )
125 {
126 pNowObjectModule = &objectModule;
127 }
128
[266]129 bool IsExe() const
130 {
131 if( targetModuleType == Exe )
132 {
133 return true;
134 }
135 return false;
136 }
137 bool IsDll() const
138 {
139 if( targetModuleType == Dll )
140 {
141 return true;
142 }
143 return false;
144 }
145 bool IsStaticLibrary() const
146 {
147 if( targetModuleType == StaticLibrary )
148 {
149 return true;
150 }
151 return false;
152 }
153 void SetTargetModuleType( TargetModuleType targetModuleType )
154 {
155 this->targetModuleType = targetModuleType;
156 }
157
[459]158 void SetDebugMark( bool isDebug )
159 {
160 this->isDebug = isDebug;
161 }
162 bool IsDebug() const
163 {
164 return isDebug;
165 }
[266]166
[461]167 void SetUnicodeMark( bool isUnicode )
168 {
169 this->isUnicode = isUnicode;
170 }
171 bool IsUnicode()
172 {
173 return isUnicode;
174 }
[459]175
[461]176
[294]177 // コアモジュールかどうか
178 bool isCore;
179 void SetCoreMark( bool isCore )
180 {
181 this->isCore = isCore;
182 }
183 bool IsCore() const
184 {
185 return isCore;
186 }
187
[308]188 // グローバルエリアが置かれる関数名
189 std::string globalAreaProcName;
[294]190
[406]191 // 列挙型
192 EnumInfoCollection enumInfoCollection;
[308]193
[406]194
[299]195 bool StringToType( const std::string &typeName, Type &type );
196 const std::string TypeToString( const Type &type );
[206]197
198 // コンパイル中のクラス
199 const CClass *pCompilingClass;
[184]200};
[193]201
[195]202extern Compiler compiler;
Note: See TracBrowser for help on using the repository browser.