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

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