Annotation of nono/cli/cli_app.cpp, revision 1.1.1.5

1.1       root        1: //
                      2: // nono
1.1.1.3   root        3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
                      7: #include "header.h"
                      8: #include "mainapp.h"
1.1.1.3   root        9: #include "mpu680x0.h"
1.1       root       10: #include "pluto.h"
                     11: #include "vm.h"
                     12: 
1.1.1.3   root       13: void cli_halt_callback(void *);
                     14: 
1.1       root       15: // wxApp と相似にするためのクラス
                     16: class CLIApp
                     17: {
                     18:  public:
1.1.1.4   root       19:        int OnInit();
1.1       root       20:        bool Parse();
1.1.1.3   root       21:        [[noreturn]] void OnCreate();
1.1       root       22: 
                     23:        int ac;
                     24:        char **av;
                     25: };
                     26: 
                     27: int
                     28: main(int ac, char *av[])
                     29: {
1.1.1.2   root       30:        std::unique_ptr<CLIApp> app(new CLIApp());
1.1       root       31: 
                     32:        // wxApp とよく似せるため
                     33:        app->ac = ac;
                     34:        app->av = av;
1.1.1.4   root       35:        return app->OnInit();
1.1       root       36: }
                     37: 
                     38: // ここがエントリポイント(のつもり)
1.1.1.4   root       39: int
1.1       root       40: CLIApp::OnInit()
                     41: {
1.1.1.4   root       42:        int rv;
                     43: 
                     44:        rv = gMainApp.Init(true, ac, av);
                     45:        if (rv != MainApp::PASS) {
                     46:                return rv;
1.1       root       47:        }
1.1.1.2   root       48:        if (!gMainApp.Start()) {
1.1.1.4   root       49:                return EXIT_FAILURE;
1.1       root       50:        }
                     51: 
                     52:        // メインウィンドウに相当するところ
                     53:        OnCreate();
                     54: 
1.1.1.4   root       55:        return EXIT_SUCCESS;
1.1       root       56: }
                     57: 
                     58: // メインウィンドウ作成後のイベントに相当するところ
                     59: void
                     60: CLIApp::OnCreate()
                     61: {
1.1.1.3   root       62:        // VM にコールバックを登録
                     63:        if (gMPU680x0) {
                     64:                gMPU680x0->SetHaltCallback(cli_halt_callback, NULL);
                     65:        }
                     66: 
1.1       root       67:        // VM 実行開始
                     68:        gVM->PowerButton();
                     69: 
                     70:        // ?
                     71:        for (;;) {
                     72:                sleep(1);
                     73:        }
                     74: }
1.1.1.3   root       75: 
                     76: // m680x0 ダブルバスフォールト時に呼ばれるコールバック。
                     77: void
                     78: cli_halt_callback(void *dummy)
                     79: {
                     80:        // どうする?
                     81:        warnx("Double bus fault has occurred in VM");
                     82: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.