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

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

unix.superglobalmegacorp.com

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