#pragma once class Compiler { // ビルド成功のフラグ bool isBuildSuccessful; // モジュール名 std::string moduleName; // モジュール タイプ ActiveBasic::Common::TargetModuleType::EnumType targetModuleType; // デバッグ ビルドかどうか bool isDebug; // Unicode対応モジュールかどうか bool isUnicode; // 名前空間サポート NamespaceSupporter namespaceSupporter; // コンパイル中のUserProc/CClass const UserProc *pCompilingUserProc; const CClass *pCompilingClass; // 現在参照したいソースコードのオブジェクト モジュール インデックス int currentRelationalObjectModuleIndexForSource; public: Compiler(); ~Compiler(); // 静的リンクの準備を行う(オブジェクトモジュール同士の名前リストの結合など、前処理を行う) void PreStaticLink( const ObjectModules &staticLibraries ); // 静的リンクを行う void StaticLink( ObjectModules &staticLibraries ); // ビルド成功のフラグ bool IsBuildSuccessful() const { return isBuildSuccessful; } void BuildSuccessful() { isBuildSuccessful = true; } // モジュール名 void SetModuleName( const std::string &moduleName ) { this->moduleName = moduleName; } const std::string &GetModuleName() const { return moduleName; } // 名前空間サポート NamespaceSupporter &GetNamespaceSupporter() { return namespaceSupporter; } // メッセンジャー Messenger messenger; ErrorMessenger errorMessenger; // コード生成機構 CodeGenerator codeGenerator; // リンカ Linker linker; // リソースマネージャ ActiveBasic::Common::ResourceManager resourceManager; // 静的リンクするオブジェクトファイル std::vector staticLibraryFilePaths; // 静的リンクするオブジェクトモジュール ObjectModules staticLibraries; ObjectModule *pSelectedObjectModule; // オブジェクトモジュール ObjectModule &GetObjectModule() { return *pSelectedObjectModule; } void SelectObjectModule( ObjectModule *pObjectModule ) { this->pSelectedObjectModule = pObjectModule; } // 現在参照すべきソースコード const BasicSource &GetCurrentSource() { return staticLibraries[currentRelationalObjectModuleIndexForSource]->GetSource(); } // 現在参照すべきソースコードを格納するオブジェクトモジュールのインデックス int GetCurrentRelationalObjectModuleIndexForSource() const { return currentRelationalObjectModuleIndexForSource; } void SetCurrentRelationalObjectModuleIndexForSource( int currentRelationalObjectModuleIndexForSource ) { this->currentRelationalObjectModuleIndexForSource = currentRelationalObjectModuleIndexForSource; } bool IsExe() const { if( targetModuleType == ActiveBasic::Common::TargetModuleType::Exe ) { return true; } return false; } bool IsDll() const { if( targetModuleType == ActiveBasic::Common::TargetModuleType::Dll ) { return true; } return false; } // スタティック リンク ライブラリをビルドする? bool IsSll() const { if( targetModuleType == ActiveBasic::Common::TargetModuleType::Sll ) { return true; } return false; } void SetTargetModuleType( ActiveBasic::Common::TargetModuleType::EnumType targetModuleType ) { this->targetModuleType = targetModuleType; } void SetDebugMark( bool isDebug ) { this->isDebug = isDebug; } bool IsDebug() const { return isDebug; } void SetUnicodeMark( bool isUnicode ) { this->isUnicode = isUnicode; } bool IsUnicode() { return isUnicode; } // コアモジュールかどうか bool isCore; void SetCoreMark( bool isCore ) { this->isCore = isCore; } bool IsCore() const { return isCore; } // グローバルエリアが置かれる関数名 std::string globalAreaProcName; // 列挙型 EnumInfoCollection enumInfoCollection; private: ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType StringToGenericTypeEx( const std::string &typeName, Type &type ); public: ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType StringToTypeEx( const std::string &typeName, Type &type, bool isResolveGenerics = false ); bool StringToType( const std::string &typeName, Type &type ); const std::string TypeToString( const Type &type ); void ClearCompilingUserProcAndClass(); void StartGlobalAreaCompile(); void FinishGlobalAreaCompile(); void SetCompilingClass( const CClass *pClass ); void SetCompilingUserProc( const UserProc *pUserProc ); void StartProcedureCompile( const UserProc *pUserProc ); void FinishProcedureCompile(); bool IsGlobalAreaCompiling(); bool IsLocalAreaCompiling(); const UserProc &GetCompilingUserProc(); bool IsCompilingClass(); const CClass &GetCompilingClass(); }; extern Compiler compiler;