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

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

静的リンクライブラリプロジェクトの作成(IDE側)に対応。

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