diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-20 19:21:34 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-20 19:21:34 +0200 |
commit | 9836acd720988af30250c2c1ec18d618664dea4e (patch) | |
tree | 9e26d7d65e1693d1a7f9fd93c9fd33b41d175464 /Source/Library | |
parent | 90b49b6f171108f272ff529f7546bd9625ca7d17 (diff) | |
download | Melon-9836acd720988af30250c2c1ec18d618664dea4e.tar.gz Melon-9836acd720988af30250c2c1ec18d618664dea4e.zip |
Started working on a userland shell
This means I'll have to do syscalls for everything I need.
Diffstat (limited to 'Source/Library')
-rw-r--r-- | Source/Library/Common/String.class.cpp | 2 | ||||
-rw-r--r-- | Source/Library/Common/String.class.h | 2 | ||||
-rw-r--r-- | Source/Library/Interface/FSNode.iface.h | 14 | ||||
-rw-r--r-- | Source/Library/Userland/Binding/FSNode.class.h | 23 | ||||
-rw-r--r-- | Source/Library/Userland/Binding/VirtualTerminal.class.h | 6 |
5 files changed, 44 insertions, 3 deletions
diff --git a/Source/Library/Common/String.class.cpp b/Source/Library/Common/String.class.cpp index c217807..ac0eba0 100644 --- a/Source/Library/Common/String.class.cpp +++ b/Source/Library/Common/String.class.cpp @@ -60,7 +60,7 @@ String String::unserialize(u32int w) { return ret; } -u32int String::serialize() { +u32int String::serialize() const { u32int* x = (u32int*)Mem::mkXchgSpace((m_length + 1) * sizeof(u32int)); x[0] = m_length; for (u32int i = 0; i < m_length; i++) { diff --git a/Source/Library/Common/String.class.h b/Source/Library/Common/String.class.h index 5db9858..0d48ce6 100644 --- a/Source/Library/Common/String.class.h +++ b/Source/Library/Common/String.class.h @@ -10,7 +10,7 @@ class String : public BasicString<WChar> { static String number(s32int number); static String unserialize(u32int w); - u32int serialize(); + u32int serialize() const; String(const char* string, u8int encoding = UE_UTF8); String() : BasicString<WChar>() {} diff --git a/Source/Library/Interface/FSNode.iface.h b/Source/Library/Interface/FSNode.iface.h new file mode 100644 index 0000000..482ebd2 --- /dev/null +++ b/Source/Library/Interface/FSNode.iface.h @@ -0,0 +1,14 @@ +#ifndef DEF_FSNODE_IFACE_H +#define DEF_FSNODE_IFACE_H + +#define FNIF_OBJTYPE 0x14 + +//S : static, GET : get, R : root, FN : fsnode +#define FNIF_SGETRFN 0 + +#define FNIF_GETNAME 0x10 +#define FNIF_TYPE 0x11 +#define FNIF_GETPARENT 0x12 +#define FNIF_GETLENGTH 0x13 + +#endif diff --git a/Source/Library/Userland/Binding/FSNode.class.h b/Source/Library/Userland/Binding/FSNode.class.h new file mode 100644 index 0000000..eb25782 --- /dev/null +++ b/Source/Library/Userland/Binding/FSNode.class.h @@ -0,0 +1,23 @@ +#include <Syscall/RessourceCaller.class.h> +#include <FSNode.iface.h> + +class FSNode : public RessourceCaller { + public: + static FSNode getRoot() { + return FSNode(RessourceCaller::sCall(FNIF_OBJTYPE, FNIF_SGETRFN)); + } + FSNode(u32int id) : RessourceCaller(id, FNIF_OBJTYPE) {} + + String getName() { + return String::unserialize(doCall(FNIF_GETNAME)); + } + u8int type() { + return doCall(FNIF_TYPE); + } + FSNode getParent() { + return FSNode(doCall(FNIF_GETPARENT)); + } + u64int getLength() { + return *((u64int*)doCall(FNIF_GETLENGTH)); + } +}; diff --git a/Source/Library/Userland/Binding/VirtualTerminal.class.h b/Source/Library/Userland/Binding/VirtualTerminal.class.h index 0da1be4..9d438c6 100644 --- a/Source/Library/Userland/Binding/VirtualTerminal.class.h +++ b/Source/Library/Userland/Binding/VirtualTerminal.class.h @@ -37,8 +37,12 @@ class VirtualTerminal : public RessourceCaller { 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; } }; |