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
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>
[256]8#include <Linker.h>
[193]9
[184]10class Compiler
11{
[199]12 // 名前空間サポート
13 NamespaceSupporter namespaceSupporter;
14
[265]15 // オブジェクトモジュール
16 ObjectModule *pObjectModule;
17 ObjectModule *pNowObjectModule;
18
[184]19public:
[193]20
[265]21 Compiler()
22 : pObjectModule( new ObjectModule )
23 , pNowObjectModule( pObjectModule )
[266]24 , targetModuleType( Exe )
[265]25 {
26 }
27 ~Compiler()
28 {
29 delete pObjectModule;
30 }
31
[199]32 NamespaceSupporter &GetNamespaceSupporter()
33 {
34 return namespaceSupporter;
35 }
36
[268]37 // ソースコード
38 BasicSource source;
39
[225]40 // コード生成機構
41 CodeGenerator codeGenerator;
42
[256]43 // リンカ
44 Linker linker;
45
[266]46 // オブジェクトモジュール
[265]47 ObjectModule &GetObjectModule()
48 {
49 return *pNowObjectModule;
50 }
51 void SelectObjectModule( ObjectModule &objectModule )
52 {
53 pNowObjectModule = &objectModule;
54 }
55
[266]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
[193]98 static bool StringToType( const std::string &typeName, Type &type );
99 static const std::string TypeToString( const Type &type );
[206]100
101 // コンパイル中のクラス
102 const CClass *pCompilingClass;
[184]103};
[193]104
[195]105extern Compiler compiler;
Note: See TracBrowser for help on using the repository browser.