Annotation of nono/lib/object.cpp, revision 1.1.1.3

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 "object.h"
                      8: #include "logger.h"
                      9: #include "mpu.h"
                     10: #include "scheduler.h"
                     11: #include "textscreen.h"
                     12: 
                     13: // 全オブジェクトのリスト
                     14: std::vector<Object*> gObjects;
                     15: 
                     16: // コンストラクタ
                     17: Object::Object()
                     18: {
                     19:        logname = "?";
                     20:        devname = "?";
                     21: 
                     22:        // 自分自身をリストに繋ぐ
                     23:        gObjects.push_back(this);
                     24: }
                     25: 
                     26: // デストラクタ
                     27: Object::~Object()
                     28: {
                     29: }
                     30: 
                     31: // メッセージ表示
                     32: // 常に表示 (あらかじめ loglevel の評価をした後で呼び出す用)
                     33: void
1.1.1.2   root       34: Object::putmsg(const char *fmt, ...) const
1.1       root       35: {
                     36:        va_list ap;
                     37: 
                     38:        va_start(ap, fmt);
                     39:        vputmsg(fmt, ap);
                     40:        va_end(ap);
                     41: }
                     42: 
                     43: // メッセージ出力 (va_list)
                     44: // 常に表示 (あらかじめ loglevel の評価をした後で呼び出す用)
                     45: void
1.1.1.2   root       46: Object::vputmsg(const char *fmt, va_list ap) const
1.1       root       47: {
1.1.1.2   root       48:        char buf[1024];
1.1       root       49:        int len;
                     50: 
                     51:        // デバイス名だけ生表示されても分かりづらいので括弧でもつけておく
1.1.1.3 ! root       52:        len = snprintf(buf, sizeof(buf), "(%s) ", devname.c_str());
1.1.1.2   root       53:        vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
1.1.1.3 ! root       54:        gLogger.Write(buf);
1.1       root       55: }
                     56: 
                     57: // ログ出力 (可変引数)
                     58: // 常に表示 (あらかじめ loglevel の評価をした後で呼び出す用)
                     59: void
1.1.1.2   root       60: Object::putlog(const char *fmt, ...) const
1.1       root       61: {
                     62:        va_list ap;
                     63: 
                     64:        va_start(ap, fmt);
                     65:        vputlog(fmt, ap);
                     66:        va_end(ap);
                     67: }
                     68: 
                     69: // ログ出力 (va_list)
                     70: // 常に表示 (あらかじめ loglevel の評価をした後で呼び出す用)
                     71: void
1.1.1.2   root       72: Object::vputlog(const char *fmt, va_list ap) const
1.1       root       73: {
1.1.1.2   root       74:        char buf[1024];
1.1       root       75:        uint64 vt;
                     76:        int len = 0;
                     77: 
                     78:        vt = gScheduler->GetVirtTime();
1.1.1.2   root       79:        len += snprintf(buf + len, sizeof(buf) - len, "%4d.%03d'%03d'%03d ",
1.1       root       80:                (int)(vt / 1000 / 1000 / 1000),
                     81:                (int)((vt / 1000 / 1000) % 1000),
                     82:                (int)((vt / 1000) % 1000),
                     83:                (int)(vt % 1000));
                     84: 
1.1.1.2   root       85:        len += snprintf(buf + len, sizeof(buf) - len, "%08x %s ",
1.1.1.3 ! root       86:                gMPU->GetPPC(), devname.c_str());
1.1.1.2   root       87:        vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
1.1       root       88: 
1.1.1.3 ! root       89:        gLogger.Write(buf);
1.1       root       90: }
                     91: 
                     92: // モニタースクリーンを更新する。
                     93: bool
                     94: Object::MonitorUpdate()
                     95: {
                     96:        // モニタースクリーンなし
                     97:        return false;
                     98: }

unix.superglobalmegacorp.com

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