diff options
Diffstat (limited to 'src/kernel/ui')
-rw-r--r-- | src/kernel/ui/vt.cpp | 6 | ||||
-rw-r--r-- | src/kernel/ui/vt.h | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/kernel/ui/vt.cpp b/src/kernel/ui/vt.cpp index 4675cdc..683d484 100644 --- a/src/kernel/ui/vt.cpp +++ b/src/kernel/ui/vt.cpp @@ -91,11 +91,15 @@ void vt::writeHex(uint32_t v) { } } -void vt::writeDec(uint32_t v) { +void vt::writeDec(int v) { if (v == 0) { put('0'); return; } + if (v < 0) { + put ('-'); + v = -v; + } char numbers[] = "0123456789"; while (v > 0) { diff --git a/src/kernel/ui/vt.h b/src/kernel/ui/vt.h index b4f3672..ebafe5f 100644 --- a/src/kernel/ui/vt.h +++ b/src/kernel/ui/vt.h @@ -28,7 +28,12 @@ class vt : public node { void clear(); void writeStr(char* str); void writeHex(uint32_t v); - void writeDec(uint32_t v); + void writeDec(int v); + // shortcuts + vt& operator<< (char* str) { writeStr(str); return *this; } + vt& operator<< (uint32_t t) { writeHex(t); return *this; } + vt& operator<< (int i) { writeDec(i); return *this; } + int outputTo(display *display); |