diff options
author | Alexis211 <alexis211@gmail.com> | 2009-09-20 15:39:34 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-09-20 15:39:34 +0200 |
commit | a1ffeb45b310b2e0dd9ae6a40b13ccc447eb0ef6 (patch) | |
tree | c3bab20d08df521f2ffac84fdda628ee315e5b09 | |
parent | e7fad609d7d7694ebd19212623a0334bd949c741 (diff) | |
download | Melon-a1ffeb45b310b2e0dd9ae6a40b13ccc447eb0ef6.tar.gz Melon-a1ffeb45b310b2e0dd9ae6a40b13ccc447eb0ef6.zip |
Implemented PipeVT.
-rw-r--r-- | Source/Kernel/Core/kmain.wtf.cpp | 1 | ||||
-rw-r--r-- | Source/Kernel/Makefile | 1 | ||||
-rwxr-xr-x | Source/Kernel/Melon.ke | bin | 157958 -> 158594 bytes | |||
-rw-r--r-- | Source/Kernel/VTManager/PipeVT.class.cpp | 35 | ||||
-rw-r--r-- | Source/Kernel/VTManager/PipeVT.class.h | 18 | ||||
-rw-r--r-- | Source/Kernel/VTManager/VirtualTerminal-kbd.proto.cpp | 2 | ||||
-rw-r--r-- | Source/Kernel/VTManager/VirtualTerminal.proto.h | 2 |
7 files changed, 58 insertions, 1 deletions
diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 366b6b9..465b2f1 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -12,6 +12,7 @@ #include <DeviceManager/Kbd.ns.h> #include <DeviceManager/Time.ns.h> #include <VTManager/ScrollableVT.class.h> +#include <VTManager/PipeVT.class.h> #include <MemoryManager/PhysMem.ns.h> #include <MemoryManager/PageAlloc.ns.h> #include <MemoryManager/GDT.ns.h> diff --git a/Source/Kernel/Makefile b/Source/Kernel/Makefile index 7f6fa56..e8e308d 100644 --- a/Source/Kernel/Makefile +++ b/Source/Kernel/Makefile @@ -34,6 +34,7 @@ Objects = Core/loader.wtf.o \ VTManager/VirtualTerminal.proto.o \ VTManager/SimpleVT.class.o \ VTManager/ScrollableVT.class.o \ + VTManager/PipeVT.class.o \ VTManager/VirtualTerminal-kbd.proto.o \ VTManager/VT.ns.o \ Library/Bitset.class.o \ diff --git a/Source/Kernel/Melon.ke b/Source/Kernel/Melon.ke Binary files differindex 801794b..1c7b040 100755 --- a/Source/Kernel/Melon.ke +++ b/Source/Kernel/Melon.ke diff --git a/Source/Kernel/VTManager/PipeVT.class.cpp b/Source/Kernel/VTManager/PipeVT.class.cpp new file mode 100644 index 0000000..bcaa531 --- /dev/null +++ b/Source/Kernel/VTManager/PipeVT.class.cpp @@ -0,0 +1,35 @@ +#include "PipeVT.class.h" + +PipeVT::PipeVT() { + m_col = 0; +} + +void PipeVT::setCursorCol(u32int col) { + while (col > m_col) { + put(' '); + } +} + +void PipeVT::put(WChar c, bool updatecsr) { + Kbd::keypress_t kp; + if (c.value == '\t') { + m_col = (m_col + 8) &~(8 - 1); + kp.hascmd = true; + kp.command = KBDC_TAB; + } else if (c.value == '\n' or c.value == '\r') { + m_col = 0; + kp.hascmd = true; + kp.command = KBDC_ENTER; + } else if (c.value == '\b') { + kp.hascmd = true; + kp.command = KBDC_BACKSPACE; + } else { + kp.hascmd = false; + kp.haschar = true; + kp.character = c; + m_col++; + } + m_kbdbuffMutex.waitLock(); + m_kbdbuff.push(kp); + m_kbdbuffMutex.unlock(); +} diff --git a/Source/Kernel/VTManager/PipeVT.class.h b/Source/Kernel/VTManager/PipeVT.class.h new file mode 100644 index 0000000..3c9521d --- /dev/null +++ b/Source/Kernel/VTManager/PipeVT.class.h @@ -0,0 +1,18 @@ +#ifndef DEF_PIPEVT_CLASS_H +#define DEF_PIPEVT_CLASS_H + +#include <VTManager/VirtualTerminal.proto.h> + +class PipeVT : public VirtualTerminal { + protected: + u32int m_col; + + public: + PipeVT(); + + bool isBoxed() { return false; } + void setCursorCol(u32int col); + void put(WChar c, bool updatecsr = true); +}; + +#endif diff --git a/Source/Kernel/VTManager/VirtualTerminal-kbd.proto.cpp b/Source/Kernel/VTManager/VirtualTerminal-kbd.proto.cpp index 1797554..ef95615 100644 --- a/Source/Kernel/VTManager/VirtualTerminal-kbd.proto.cpp +++ b/Source/Kernel/VTManager/VirtualTerminal-kbd.proto.cpp @@ -63,6 +63,8 @@ String VirtualTerminal::readLine(bool show) { if (tmp.hascmd && !tmp.haschar && tmp.command == KBDC_BACKSPACE) { if (!ret.empty()) ret = ret.substr(0, ret.size() - 1); else put(" "); //Put a space so that cursor stays at same place + } else if (tmp.hascmd && !tmp.haschar && tmp.command == KBDC_TAB) { + ret += "\t"; } else if (tmp.haschar && !tmp.hascmd) { ret += tmp.character; } diff --git a/Source/Kernel/VTManager/VirtualTerminal.proto.h b/Source/Kernel/VTManager/VirtualTerminal.proto.h index bd38d89..ea6284f 100644 --- a/Source/Kernel/VTManager/VirtualTerminal.proto.h +++ b/Source/Kernel/VTManager/VirtualTerminal.proto.h @@ -44,7 +44,7 @@ class VirtualTerminal { //Keyboard functions virtual void keyPress(Kbd::keypress_t kp); //Called by Kbd:: when a key is pressed, overloaded by ScrollableVT - Kbd::keypress_t getKeypress(bool show = true, bool block = true); //Block : must we wait for a key to be pressed ? + virtual Kbd::keypress_t getKeypress(bool show = true, bool block = true); //Block : must we wait for a key to be pressed ? String readLine(bool show = true); }; |