diff options
author | Alexis211 <alexis211@gmail.com> | 2009-08-29 19:03:00 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-08-29 19:03:00 +0200 |
commit | 9ad8e2fe0242da26dae7fca2b180640637c8c062 (patch) | |
tree | 92fdd3f2195221a110d2c4f1f2e98bd6505578ed /Source/Kernel/VTManager | |
parent | 0139012d683036fb661fed62babb71f59ec9ab45 (diff) | |
download | Melon-9ad8e2fe0242da26dae7fca2b180640637c8c062.tar.gz Melon-9ad8e2fe0242da26dae7fca2b180640637c8c062.zip |
We now have (partial) support for UTF-8.
Diffstat (limited to 'Source/Kernel/VTManager')
-rw-r--r-- | Source/Kernel/VTManager/VirtualTerminal.class.cpp | 20 | ||||
-rw-r--r-- | Source/Kernel/VTManager/VirtualTerminal.class.h | 13 |
2 files changed, 17 insertions, 16 deletions
diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.cpp b/Source/Kernel/VTManager/VirtualTerminal.class.cpp index a0c920b..41c3e8d 100644 --- a/Source/Kernel/VTManager/VirtualTerminal.class.cpp +++ b/Source/Kernel/VTManager/VirtualTerminal.class.cpp @@ -29,7 +29,7 @@ void VirtualTerminal::setColor(u8int fgcolor, u8int bgcolor) { } } -void VirtualTerminal::putChar(u32int row, u32int col, char c) { +void VirtualTerminal::putChar(u32int row, u32int col, wchar c) { if (row >= m_rows or col >= m_cols) return; chr* ch = &BUFCHR(row, col); ch->c = c; @@ -103,18 +103,18 @@ void VirtualTerminal::setCursorCol(u32int col) { // Display functionn -void VirtualTerminal::put(char c, bool updatecsr) { - if (c == 0x08) { //Ascii backspace +void VirtualTerminal::put(wchar c, bool updatecsr) { + if (c.value == 0x08) { //Ascii backspace if (m_csrcol > 0) m_csrcol--; putChar(m_csrlin, m_csrcol, ' '); - } else if (c == 0x09) { //Ascii tab + } else if (c.value == 0x09) { //Ascii tab m_csrcol = (m_csrcol + 8) &~(8 - 1); - } else if (c == '\r') { + } else if (c.value == '\r') { m_csrcol = 0; - } else if (c == '\n') { + } else if (c.value == '\n') { m_csrcol = 0; m_csrlin++; - } else if (c >= ' ') { //Printable character + } else if (c.value >= ' ') { //Printable character putChar(m_csrlin, m_csrcol, c); m_csrcol++; } @@ -129,9 +129,9 @@ void VirtualTerminal::put(char c, bool updatecsr) { if (updatecsr) updateCursor(); } -void VirtualTerminal::write(char* c, bool updatecsr) { - while (*c) { - put(*(c++), false); +void VirtualTerminal::write(String s, bool updatecsr) { + for (u32int i = 0; i < s.size(); i++) { + put(s[i], false); } if (updatecsr) updateCursor(); } diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.h b/Source/Kernel/VTManager/VirtualTerminal.class.h index 61e78a7..6d081ee 100644 --- a/Source/Kernel/VTManager/VirtualTerminal.class.h +++ b/Source/Kernel/VTManager/VirtualTerminal.class.h @@ -2,10 +2,11 @@ #define DEF_VIRTUALTERMINAL_CLASS_H #include <Core/common.wtf.h> +#include <Library/String.class.h> struct chr { u8int color; - char c; + wchar c; }; class VirtualTerminal { @@ -24,7 +25,7 @@ class VirtualTerminal { ~VirtualTerminal(); void setColor(u8int fgcolor, u8int bgcolor = 0xFF); - void putChar(u32int row, u32int col, char c); + void putChar(u32int row, u32int col, wchar c); void clear(); void map(s32int row = -1, s32int col = -1); @@ -38,13 +39,13 @@ class VirtualTerminal { void setCursorCol(u32int col); //Display functions - void put(char c, bool updatecsr = true); - void write(char *c, bool updatecsr = true); + void put(wchar c, bool updatecsr = true); + void write(String s, bool updatecsr = true); void writeDec(s32int i, bool updatecsr = true); void writeHex(u32int i, bool updatecsr = true); - inline VirtualTerminal& operator<<(char *c) { write(c); return *this; } - inline VirtualTerminal& operator<<(char c) { put(c); return *this; } + inline VirtualTerminal& operator<<(String s) { write(s); return *this; } + //inline VirtualTerminal& operator<<(wchar c) { put(c); return *this; } inline VirtualTerminal& operator<<(s32int i) { writeDec(i); return *this; } inline VirtualTerminal& operator<<(u32int i) { writeHex(i); return *this; } }; |