diff options
Diffstat (limited to 'src/kernel/ui/vt.h')
-rw-r--r-- | src/kernel/ui/vt.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/kernel/ui/vt.h b/src/kernel/ui/vt.h new file mode 100644 index 0000000..b4f3672 --- /dev/null +++ b/src/kernel/ui/vt.h @@ -0,0 +1,49 @@ +#ifndef DEF_UI_VT_H +#define DEF_UI_VT_H + +#include <vfs/node.h> +#include <dev/display.h> + +struct vt_char { + int ch; + uint8_t fgcolor, bgcolor; +}; + +class vt : public node { + private: + display *output; + int w, h, csr_l, csr_c; + vt_char *text; + + void put_at(int l, int c, int ch); + bool cursor_visible; + + public: + uint8_t fgcolor, bgcolor; + + vt(node* parent, int w, int h); + + // internal use + void put(int c); + void clear(); + void writeStr(char* str); + void writeHex(uint32_t v); + void writeDec(uint32_t v); + + int outputTo(display *display); + + virtual int write(size_t offset, size_t len, char* buffer); + virtual size_t get_size(); +}; + +extern vt *ke_vt; +#define NL ke_vt->writeStr("\n"); +#define TAB ke_vt->writeStr("\t"); +#define WHERE { ke_vt->writeStr("(ke:"); \ + ke_vt->writeStr(__FILE__); \ + ke_vt->writeStr(":"); \ + ke_vt->writeDec(__LINE__); \ + ke_vt->writeStr(") "); } + +#endif + |