summaryrefslogtreecommitdiff
path: root/Source/Library/Userland/Binding
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-12-20 16:13:44 +0100
committerAlexis211 <alexis211@gmail.com>2009-12-20 16:13:44 +0100
commit2d3c5a9c47d99c8f4f5561f9eae16497c1cde63a (patch)
treea3f800e17a34a16a00b6dc0b980e2f6cfed22dd5 /Source/Library/Userland/Binding
parentcab353cbb21c142ac1e227d42338fa587e1a7f24 (diff)
downloadMelon-2d3c5a9c47d99c8f4f5561f9eae16497c1cde63a.tar.gz
Melon-2d3c5a9c47d99c8f4f5561f9eae16497c1cde63a.zip
Added file streams and string streams
Diffstat (limited to 'Source/Library/Userland/Binding')
-rw-r--r--Source/Library/Userland/Binding/VirtualTerminal.class.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/Library/Userland/Binding/VirtualTerminal.class.h b/Source/Library/Userland/Binding/VirtualTerminal.class.h
index 6576c1c..54bdc53 100644
--- a/Source/Library/Userland/Binding/VirtualTerminal.class.h
+++ b/Source/Library/Userland/Binding/VirtualTerminal.class.h
@@ -11,6 +11,9 @@
#include <WChar.class.h>
class VirtualTerminal : public RessourceCaller, public OStream, public IStream {
+ private:
+ bool m_eof;
+
public:
static VirtualTerminal getIn() {
u32int id = RessourceCaller::sCall(VTIF_OBJTYPE, VTIF_SGETPRINVT);
@@ -20,7 +23,7 @@ class VirtualTerminal : public RessourceCaller, public OStream, public IStream {
u32int id = RessourceCaller::sCall(VTIF_OBJTYPE, VTIF_SGETPROUTVT);
return VirtualTerminal(id);
}
- VirtualTerminal(u32int id) : RessourceCaller(id, VTIF_OBJTYPE) {}
+ VirtualTerminal(u32int id) : RessourceCaller(id, VTIF_OBJTYPE) { m_eof = false; }
/*void writeHex(u32int number) {
doCall(VTIF_WRITEHEX, number);
@@ -32,7 +35,13 @@ class VirtualTerminal : public RessourceCaller, public OStream, public IStream {
doCall(VTIF_WRITE, (u32int)&s);
}
String read() {
- return String::unserialize(doCall(VTIF_READLINE, 1)) += "\n";
+ if (m_eof) return "";
+ String ret = String::unserialize(doCall(VTIF_READLINE, 1));
+ if (ret[ret.size() - 1] == WChar(EOF)) {
+ ret = ret.substr(0, ret.size() - 1);
+ m_eof = true;
+ }
+ return ret += "\n";
}
keypress_t getKeypress(bool show = true, bool block = true) {
keypress_t* ptr = (keypress_t*)doCall(VTIF_GETKEYPRESS, (show ? 1 : 0) | (block ? 2 : 0));