[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] | 10 | class Compiler
|
---|
| 11 | {
|
---|
[199] | 12 | // 名前空間サポート
|
---|
| 13 | NamespaceSupporter namespaceSupporter;
|
---|
| 14 |
|
---|
[265] | 15 | // オブジェクトモジュール
|
---|
| 16 | ObjectModule *pObjectModule;
|
---|
| 17 | ObjectModule *pNowObjectModule;
|
---|
| 18 |
|
---|
[184] | 19 | public:
|
---|
[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 |
|
---|
[225] | 37 | // コード生成機構
|
---|
| 38 | CodeGenerator codeGenerator;
|
---|
| 39 |
|
---|
[256] | 40 | // リンカ
|
---|
| 41 | Linker linker;
|
---|
| 42 |
|
---|
[266] | 43 | // オブジェクトモジュール
|
---|
[265] | 44 | ObjectModule &GetObjectModule()
|
---|
| 45 | {
|
---|
| 46 | return *pNowObjectModule;
|
---|
| 47 | }
|
---|
| 48 | void SelectObjectModule( ObjectModule &objectModule )
|
---|
| 49 | {
|
---|
| 50 | pNowObjectModule = &objectModule;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
[266] | 53 |
|
---|
| 54 | // ターゲット
|
---|
| 55 | enum TargetModuleType
|
---|
| 56 | {
|
---|
| 57 | Exe,
|
---|
| 58 | Dll,
|
---|
| 59 | StaticLibrary,
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 | TargetModuleType targetModuleType;
|
---|
| 63 |
|
---|
| 64 | bool IsExe() const
|
---|
| 65 | {
|
---|
| 66 | if( targetModuleType == Exe )
|
---|
| 67 | {
|
---|
| 68 | return true;
|
---|
| 69 | }
|
---|
| 70 | return false;
|
---|
| 71 | }
|
---|
| 72 | bool IsDll() const
|
---|
| 73 | {
|
---|
| 74 | if( targetModuleType == Dll )
|
---|
| 75 | {
|
---|
| 76 | return true;
|
---|
| 77 | }
|
---|
| 78 | return false;
|
---|
| 79 | }
|
---|
| 80 | bool IsStaticLibrary() const
|
---|
| 81 | {
|
---|
| 82 | if( targetModuleType == StaticLibrary )
|
---|
| 83 | {
|
---|
| 84 | return true;
|
---|
| 85 | }
|
---|
| 86 | return false;
|
---|
| 87 | }
|
---|
| 88 | void SetTargetModuleType( TargetModuleType targetModuleType )
|
---|
| 89 | {
|
---|
| 90 | this->targetModuleType = targetModuleType;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 |
|
---|
[193] | 95 | static bool StringToType( const std::string &typeName, Type &type );
|
---|
| 96 | static const std::string TypeToString( const Type &type );
|
---|
[206] | 97 |
|
---|
| 98 | // コンパイル中のクラス
|
---|
| 99 | const CClass *pCompilingClass;
|
---|
[184] | 100 | };
|
---|
[193] | 101 |
|
---|
[195] | 102 | extern Compiler compiler;
|
---|