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

Last change on this file since 268 was 268, checked in by dai_9181, 17 years ago
File size: 1.7 KB
Line 
1#pragma once
2
3#include <CodeGenerator.h>
4#include <NamespaceSupporter.h>
5#include <Meta.h>
6#include <DataTable.h>
7#include <CodeGenerator.h>
8#include <Linker.h>
9
10class Compiler
11{
12 // 名前空間サポート
13 NamespaceSupporter namespaceSupporter;
14
15 // オブジェクトモジュール
16 ObjectModule *pObjectModule;
17 ObjectModule *pNowObjectModule;
18
19public:
20
21 Compiler()
22 : pObjectModule( new ObjectModule )
23 , pNowObjectModule( pObjectModule )
24 , targetModuleType( Exe )
25 {
26 }
27 ~Compiler()
28 {
29 delete pObjectModule;
30 }
31
32 NamespaceSupporter &GetNamespaceSupporter()
33 {
34 return namespaceSupporter;
35 }
36
37 // ソースコード
38 BasicSource source;
39
40 // コード生成機構
41 CodeGenerator codeGenerator;
42
43 // リンカ
44 Linker linker;
45
46 // オブジェクトモジュール
47 ObjectModule &GetObjectModule()
48 {
49 return *pNowObjectModule;
50 }
51 void SelectObjectModule( ObjectModule &objectModule )
52 {
53 pNowObjectModule = &objectModule;
54 }
55
56
57 // ターゲット
58 enum TargetModuleType
59 {
60 Exe,
61 Dll,
62 StaticLibrary,
63 };
64
65 TargetModuleType targetModuleType;
66
67 bool IsExe() const
68 {
69 if( targetModuleType == Exe )
70 {
71 return true;
72 }
73 return false;
74 }
75 bool IsDll() const
76 {
77 if( targetModuleType == Dll )
78 {
79 return true;
80 }
81 return false;
82 }
83 bool IsStaticLibrary() const
84 {
85 if( targetModuleType == StaticLibrary )
86 {
87 return true;
88 }
89 return false;
90 }
91 void SetTargetModuleType( TargetModuleType targetModuleType )
92 {
93 this->targetModuleType = targetModuleType;
94 }
95
96
97
98 static bool StringToType( const std::string &typeName, Type &type );
99 static const std::string TypeToString( const Type &type );
100
101 // コンパイル中のクラス
102 const CClass *pCompilingClass;
103};
104
105extern Compiler compiler;
Note: See TracBrowser for help on using the repository browser.