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

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2018 [email protected]
                      4: //
                      5: 
                      6: #include "header.h"
                      7: #include "mainapp.h"
                      8: #include "mpu.h"
                      9: #include "pluto.h"
                     10: #include "rtc.h"
                     11: #include "vm.h"
                     12: 
                     13: // wxApp と相似にするためのクラス
                     14: class CLIApp
                     15: {
                     16:  public:
                     17:        bool OnInit();
                     18:        bool Parse();
                     19:        void OnCreate();
                     20: 
                     21:        int ac;
                     22:        char **av;
                     23: };
                     24: 
                     25: int
                     26: main(int ac, char *av[])
                     27: {
1.1.1.2 ! root       28:        std::unique_ptr<CLIApp> app(new CLIApp());
1.1       root       29: 
                     30:        // wxApp とよく似せるため
                     31:        app->ac = ac;
                     32:        app->av = av;
1.1.1.2 ! root       33:        if (!app->OnInit()) {
1.1       root       34:                return 1;
                     35:        }
                     36:        return 0;
                     37: }
                     38: 
                     39: // ここがエントリポイント(のつもり)
                     40: bool
                     41: CLIApp::OnInit()
                     42: {
1.1.1.2 ! root       43:        if (!gMainApp.Init(true, ac, av)) {
1.1       root       44:                return false;
                     45:        }
1.1.1.2 ! root       46:        if (!gMainApp.Start()) {
1.1       root       47:                return false;
                     48:        }
                     49: 
                     50:        // メインウィンドウに相当するところ
                     51:        OnCreate();
                     52: 
                     53:        return true;
                     54: }
                     55: 
                     56: // メインウィンドウ作成後のイベントに相当するところ
                     57: void
                     58: CLIApp::OnCreate()
                     59: {
                     60:        // 時刻開始?
                     61:        // なるべく VM が開始する直前にしたい。
                     62:        gRTC->InitRTC();
                     63: 
                     64:        // VM 実行開始
                     65:        gVM->PowerButton();
                     66: 
                     67:        // ?
                     68:        for (;;) {
                     69:                sleep(1);
                     70:        }
                     71: }

unix.superglobalmegacorp.com

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