summaryrefslogtreecommitdiff
path: root/Source/Kernel
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-09-13 15:36:39 +0200
committerAlexis211 <alexis211@gmail.com>2009-09-13 15:36:39 +0200
commitace1914398633e05970f634ddec297665dfda7c6 (patch)
treec244c222a7693b5257e1e955b5ed372530035b19 /Source/Kernel
parent0b760a50b5aee05f1f34c1599b547c8b78d1d737 (diff)
downloadMelon-ace1914398633e05970f634ddec297665dfda7c6.tar.gz
Melon-ace1914398633e05970f634ddec297665dfda7c6.zip
RamFS creatable but not loadable yet
Diffstat (limited to 'Source/Kernel')
-rw-r--r--Source/Kernel/FileSystems/RamFS/RamFS.class.h2
-rw-r--r--Source/Kernel/Library/String.class.cpp10
-rw-r--r--Source/Kernel/Library/String.class.h10
-rw-r--r--Source/Kernel/Library/Vector.class.cpp10
-rw-r--r--Source/Kernel/Library/Vector.class.h1
-rwxr-xr-xSource/Kernel/Melon.kebin127379 -> 127392 bytes
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.class.cpp2
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.class.h4
8 files changed, 25 insertions, 14 deletions
diff --git a/Source/Kernel/FileSystems/RamFS/RamFS.class.h b/Source/Kernel/FileSystems/RamFS/RamFS.class.h
index 427019c..822dc39 100644
--- a/Source/Kernel/FileSystems/RamFS/RamFS.class.h
+++ b/Source/Kernel/FileSystems/RamFS/RamFS.class.h
@@ -10,7 +10,7 @@ class RamFS : public FileSystem {
public:
RamFS(u32int maxSize); //Creates an empty RAM file system
- RamFS(u8int* ptr, u32int maxSize); //Creates a RAM file system from data loaded in memory. format to be defined
+ RamFS(u8int* ptr, u32int maxSize, bool writable = true); //Creates a RAM file system from data loaded in memory. format to be defined
bool setName(FSNode* node, String name);
bool setPermissions(FSNode* node, u32int permissions);
diff --git a/Source/Kernel/Library/String.class.cpp b/Source/Kernel/Library/String.class.cpp
index 8df5cbf..b8e01d5 100644
--- a/Source/Kernel/Library/String.class.cpp
+++ b/Source/Kernel/Library/String.class.cpp
@@ -136,7 +136,7 @@ bool String::operator== (const char* string) {
return true;
}
-String& String::operator+= (String &other) {
+String& String::operator+= (const String &other) {
WChar* newdata = new WChar[m_length + other.m_length + 1];
for (u32int i = 0; i < m_length; i++) {
newdata[i] = m_string[i];
@@ -181,7 +181,7 @@ String& String::operator+= (WChar other) {
return *this;
}
-String& String::operator+ (String &other) { //Can be optimized
+String& String::operator+ (const String &other) { //Can be optimized
String ret(*this);
return (ret += other);
}
@@ -236,11 +236,11 @@ u32int String::toInt16() {
return number;
}
-WChar& String::operator[] (int index) {
+WChar& String::operator[] (int index) const {
return m_string[index];
}
-u32int String::size() {
+u32int String::size() const {
return m_length;
}
@@ -250,7 +250,7 @@ void String::clear() {
m_string = 0;
}
-bool String::empty() {
+bool String::empty() const {
return (m_length == 0);
}
diff --git a/Source/Kernel/Library/String.class.h b/Source/Kernel/Library/String.class.h
index 85ec268..6b48a30 100644
--- a/Source/Kernel/Library/String.class.h
+++ b/Source/Kernel/Library/String.class.h
@@ -25,19 +25,19 @@ class String {
bool operator== (const String &other);
bool operator== (const char* string);
- String &operator+= (String &other);
+ String &operator+= (const String &other);
String &operator+= (const char* other);
String &operator+= (WChar other);
- String &operator+ (String &other);
+ String &operator+ (const String &other);
String &operator+ (const char* other);
String &operator+ (WChar other);
s32int toInt();
u32int toInt16(); //From HEX
- WChar& operator[] (int index);
+ WChar& operator[] (int index) const;
- u32int size();
+ u32int size() const;
void clear();
- bool empty();
+ bool empty() const;
Vector<String> split(WChar c);
diff --git a/Source/Kernel/Library/Vector.class.cpp b/Source/Kernel/Library/Vector.class.cpp
index aaa777f..d0c71a4 100644
--- a/Source/Kernel/Library/Vector.class.cpp
+++ b/Source/Kernel/Library/Vector.class.cpp
@@ -32,6 +32,16 @@ Vector<T>::Vector(const Vector<T> &other) {
}
template <typename T>
+Vector<T>& Vector<T>::operator= (const Vector<T> &other) {
+ if (m_data != 0) delete[] m_data;
+ m_size = other.m_size;
+ m_data = (T*)Mem::kalloc(m_size * sizeof(T));
+ for (u32int i = 0; i < m_size; i++) {
+ new(&m_data[i]) T(other.m_data[i]);
+ }
+}
+
+template <typename T>
Vector<T>::~Vector() {
if (m_data != 0) delete[] m_data;
}
diff --git a/Source/Kernel/Library/Vector.class.h b/Source/Kernel/Library/Vector.class.h
index 9763d2c..f16303b 100644
--- a/Source/Kernel/Library/Vector.class.h
+++ b/Source/Kernel/Library/Vector.class.h
@@ -14,6 +14,7 @@ class Vector {
Vector(u32int size);
Vector(u32int size, T value);
Vector(const Vector<T> &other);
+ Vector<T>& operator= (const Vector<T> &other);
~Vector();
T& operator[] (u32int index);
diff --git a/Source/Kernel/Melon.ke b/Source/Kernel/Melon.ke
index 575395c..89d3f81 100755
--- a/Source/Kernel/Melon.ke
+++ b/Source/Kernel/Melon.ke
Binary files differ
diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.cpp b/Source/Kernel/VTManager/VirtualTerminal.class.cpp
index dde487c..be1299c 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.class.cpp
+++ b/Source/Kernel/VTManager/VirtualTerminal.class.cpp
@@ -129,7 +129,7 @@ void VirtualTerminal::put(WChar c, bool updatecsr) {
if (updatecsr) updateCursor();
}
-void VirtualTerminal::write(String s, bool updatecsr) {
+void VirtualTerminal::write(const String& s, bool updatecsr) {
for (u32int i = 0; i < s.size(); i++) {
put(s[i], false);
}
diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.h b/Source/Kernel/VTManager/VirtualTerminal.class.h
index 5739c72..e0cdff2 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.class.h
+++ b/Source/Kernel/VTManager/VirtualTerminal.class.h
@@ -46,13 +46,13 @@ class VirtualTerminal {
//Display functions
void put(WChar c, bool updatecsr = true);
- void write(String s, bool updatecsr = true);
+ void write(const String& s, bool updatecsr = true);
void writeDec(s32int i, bool updatecsr = true);
void writeHex(u32int i, bool updatecsr = true);
void hexDump(u8int* ptr, u32int sz);
- inline VirtualTerminal& operator<<(String s) { write(s); return *this; }
+ inline VirtualTerminal& operator<<(const String& s) { write(s); return *this; }
//inline VirtualTerminal& operator<<(WChar c) { put(c); return *this; }
inline VirtualTerminal& operator<<(s32int i) { writeDec(i); return *this; }
inline VirtualTerminal& operator<<(u32int i) { writeHex(i); return *this; }