From bcb8807209f4aa7da4d7fec54857599b60c87947 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Fri, 27 Nov 2009 22:17:21 +0100 Subject: Some bugfixes --- Source/Applications/Demos/GOL.cpp | 6 +++++- Source/Kernel/Core/kmain.wtf.cpp | 6 +++--- Source/Library/Common/BasicString.class.cpp | 5 +++-- Source/Library/Common/BasicString.class.h | 2 +- Source/Library/Common/String.class.cpp | 5 +++-- Source/Library/Common/String.class.h | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) (limited to 'Source') diff --git a/Source/Applications/Demos/GOL.cpp b/Source/Applications/Demos/GOL.cpp index 298c73a..e6da3a6 100644 --- a/Source/Applications/Demos/GOL.cpp +++ b/Source/Applications/Demos/GOL.cpp @@ -83,12 +83,16 @@ int main(Vector args) { u64int y = Rand::rand() * h / Rand::max(); cells[x * h + y] = true; } + } else if (kp.character == WChar("p")) { + outvt << " [PAUSED] press a key to resume"; + invt.getKeypress(); } else if (kp.character == WChar("h")) { outvt << "\n\n** Melon's demo Game Of Life Simulator help :\n"; outvt << " - ctrl+c : quit\n"; outvt << " - ctrl+h : show this\n"; + outvt << " - ctrl+p : pause\n"; outvt << " - ctrl+r : add some random cells\n"; - outvt << " - ctrl+R : add more cells, but not random\n\n"; + outvt << " - ctrl+R : add more cells, still random\n\n"; outvt << "Press any key to return to simultaor..."; invt.getKeypress(); } diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 827a834..a028457 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -86,7 +86,7 @@ u32int logoAnimation(void* p) { void selectVideoMode(SimpleVT& v) { Disp::getModes(); - v << "\n\nPlease select a graphic mode in the list below:\n"; + v << "\nPlease select a graphic mode in the list below:\n"; for (u32int i = 0; i < Disp::modes.size(); i++) { Disp::mode_t& m = Disp::modes[i]; @@ -206,7 +206,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //*************************************** LOAD SYSTEM STUFF if (keymap != "builtin") { - if (!Kbd::loadKeymap(keymap)) *kvt << "\nWARNING : Could not load keymap " << keymap << ", using built-in keymap instead."; + if (!Kbd::loadKeymap(keymap)) *kvt << "WARNING : Could not load keymap " << keymap << ", using built-in keymap instead."; } Log::init(KL_STATUS); //Setup logging @@ -216,7 +216,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) { Log::log(KL_STATUS, "kmain : User list loaded"); if (init.empty()) { - *kvt << "\n\n"; + *kvt << "\n"; new KernelShell(cwd, kvt); while (KernelShell::getInstances() > 0) { Task::currThread()->sleep(100); diff --git a/Source/Library/Common/BasicString.class.cpp b/Source/Library/Common/BasicString.class.cpp index 58fa926..ddb4e2c 100644 --- a/Source/Library/Common/BasicString.class.cpp +++ b/Source/Library/Common/BasicString.class.cpp @@ -173,9 +173,10 @@ Vector< BasicString > BasicString::split(T sep) const { } template -BasicString BasicString::substr(s32int start, u32int size) { +BasicString BasicString::substr(s32int start, s32int size) { + if (size == 0) return BasicString(); if (start < 0) start = m_length - start; - if (size == 0) size = m_length - start; + if (size == -1) size = m_length - start; BasicString ret; ret.m_string = new T[size + 1]; ret.m_length = size; diff --git a/Source/Library/Common/BasicString.class.h b/Source/Library/Common/BasicString.class.h index be74cf3..03d82c1 100644 --- a/Source/Library/Common/BasicString.class.h +++ b/Source/Library/Common/BasicString.class.h @@ -46,7 +46,7 @@ class BasicString { bool contains(const T& chr) const; Vector< BasicString > split(T sep) const; - BasicString substr(s32int start, u32int size = 0); + BasicString substr(s32int start, s32int size = -1); }; #include "BasicString.class.cpp" diff --git a/Source/Library/Common/String.class.cpp b/Source/Library/Common/String.class.cpp index da2b93e..fe851bd 100644 --- a/Source/Library/Common/String.class.cpp +++ b/Source/Library/Common/String.class.cpp @@ -191,9 +191,10 @@ Vector String::split(WChar c) const { return ret; } -String String::substr(s32int start, u32int size) { +String String::substr(s32int start, s32int size) { + if (size == 0) return String(); if (start < 0) start = m_length - start; - if (size == 0) size = m_length - start; + if (size == -1) size = m_length - start; String ret; ret.m_string = new WChar[size + 1]; ret.m_length = size; diff --git a/Source/Library/Common/String.class.h b/Source/Library/Common/String.class.h index 473624b..b623fb2 100644 --- a/Source/Library/Common/String.class.h +++ b/Source/Library/Common/String.class.h @@ -43,7 +43,7 @@ class String : public BasicString { Vector split(WChar c) const; - String substr(s32int start, u32int size = 0); + String substr(s32int start, s32int size = -1); }; #endif -- cgit v1.2.3