--- nono/lib/mainapp.h 2026/04/29 17:04:30 1.1.1.2 +++ nono/lib/mainapp.h 2026/04/29 17:05:05 1.1.1.10 @@ -1,6 +1,7 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once @@ -15,11 +16,15 @@ class MainApp { public: - // 初期化 - bool Init(bool is_cli_, int ac, char *av[]); + // Init() の戻り値 + static const int PASS = -1; // 実行を継続 - // VM 実行開始 - bool Start(); + public: + // 初期化 (ステージ1) + int Init1(bool is_cli_, int ac, char *av[]); + + // 初期化 (ステージ2) + bool Init2(); std::string SearchFile(const std::string& name) const; @@ -27,34 +32,44 @@ class MainApp // (Config が持っているのは文字列) vmtype_t GetVMType() const { return vmtype; } - public: - // -A: ホストファイル名 (とりあえず) - const char *host_file = NULL; + // 現在の VM が指定の feature を持っているか? + bool HasVMFeature(vmf_t flag) const; - // -b: ブレークポイント - uint32 debug_breakaddr = 0; + // ログレベルを設定する。 + static bool SetLogopt(const std::vector&, std::string *errmsg); + + // ログ名の一覧を表示する + static std::vector GetLogNames(); + + public: + // -b: ブレークポイント "[,]" + std::vector debug_breakaddr {}; // -B: ベンチマークモード - int benchmark_mode = 0; + int benchmark_mode {}; - // -c: VM ディレクトリ + // -c: VM ディレクトリ or 設定ファイル std::string vmdir {}; + std::string vmfile {}; const std::string& GetVMDir() const { return vmdir; } // -C: ログをコンソールに出力 - bool log_to_console = false; + bool log_to_console {}; // -d: 起動時にデバッガで停止 - bool debug_on_start = false; + bool debug_on_start {}; // -D: コンソールをデバッガで使う - bool debug_on_console = false; + bool debug_on_console {}; // -f: 高速モード (XXX 設定ファイルと含めて見直すこと) - bool fast_mode = false; + bool fast_mode {}; // --fontsize: フォントサイズ指定値 (値は fontsize_t ではない) - int fontsize = 0; + int fontsize {}; + + // -H: 内蔵 Human68k 風を組み込む。-X による実行ファイル名が必要。 + bool human_mode {}; // -L: ログ指定文字列 char logopt[256] {}; @@ -63,17 +78,18 @@ class MainApp std::string monitor_opt {}; // -s,--scale: 画面スケール - double screen_scale = 0.0; + double screen_scale {}; - // --show-config: 設定内容を表示 - bool show_config {}; + // --show-config: 設定内容を表示 (1なら通常、2ならall) + int show_config {}; // -V: パラメータ指定 - std::vector config_options; + std::vector config_options {}; - // -X: Human68k 実行ファイル名と引数 - const char *human68k_file = NULL; - char human68k_arg[256] {}; + // -X: ホスト実行ファイル名とその引数 + const char *exec_file {}; + std::string exec_arg {}; + bool load_and_exec {}; private: // ヘルプメッセージを表示する @@ -88,10 +104,16 @@ class MainApp // -L オプションを処理する bool ParseLogopt(); + // ログレベル1つを設定する。 + static bool SetLogopt1(const std::string&, std::string *errmsg); + + // コンパイルされている host netdriver の一覧を表示 + void ShowHostnet() const; + // CLI/GUI 区別 bool IsCLI() const { return is_cli; } bool IsGUI() const { return !is_cli; } - bool is_cli; + bool is_cli {}; // VM 種別 vmtype_t vmtype {};