blob: 9d438c6c1f1ad961742756483b71cc93b6404cb7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <Syscall/RessourceCaller.class.h>
#include <VirtualTerminal.iface.h>
#include <String.class.h>
#include <WChar.class.h>
class VirtualTerminal : public RessourceCaller {
public:
static VirtualTerminal get() {
u32int id = RessourceCaller::sCall(VTIF_OBJTYPE, VTIF_SGETPRVT);
return VirtualTerminal(id);
}
VirtualTerminal(u32int id) : RessourceCaller(id, VTIF_OBJTYPE) {}
void writeHex(u32int number) {
doCall(VTIF_WRITEHEX, number);
}
void writeDec(s64int number) {
doCall(VTIF_WRITEDEC, (number >> 32), number);
}
void write(String s) {
doCall(VTIF_WRITE, (u32int)&s);
}
String readLine() {
return String::unserialize(doCall(VTIF_READLINE));
}
void setColor(u8int fg, u8int bg = 0xFF) {
doCall(VTIF_SETCOLOR, (fg << 8) | bg);
}
void setCsrLine(u32int line) {
doCall(VTIF_SETCSRLINE, line);
}
void setCsrCol(u32int col) {
doCall(VTIF_SETCSRCOL, col);
}
bool isBoxed() {
return doCall(VTIF_ISBOXED) != 0;
}
void put(WChar c) {
doCall(VTIF_PUT, c);
}
inline VirtualTerminal& operator<<(const String& s) { write(s); return *this; }
inline VirtualTerminal& operator<<(s32int i) { writeDec(i); return *this; }
inline VirtualTerminal& operator<<(s64int i) { writeDec(i); return *this; }
inline VirtualTerminal& operator<<(u32int i) { writeHex(i); return *this; }
};
|