Rename writeChar, writeString -> printChar, printString

This commit is contained in:
Eryn Wells 2016-03-13 13:32:52 -04:00
parent 46d18b97d5
commit 1bbd99aeee
5 changed files with 23 additions and 23 deletions

View file

@ -72,7 +72,7 @@ Console::clear(Console::Color color)
void void
Console::writeChar(char c) Console::printChar(char c)
{ {
switch (c) { switch (c) {
case '\n': case '\n':
@ -106,12 +106,12 @@ Console::writeChar(char c)
} }
void void
Console::writeString(const char *str) Console::printString(const char *str)
{ {
// XXX: THIS IS VERY UNSAFE. PUT DOWN THE POINTER ERYN. NO BAD ERYN DONT YOU DARE. // XXX: THIS IS VERY UNSAFE. PUT DOWN THE POINTER ERYN. NO BAD ERYN DONT YOU DARE.
const char *cur = str; const char *cur = str;
while (*cur != '\0') { while (*cur != '\0') {
writeChar(*cur++); printChar(*cur++);
} }
} }

View file

@ -53,10 +53,10 @@ struct Console
void clear(Color color); void clear(Color color);
/** Write a character to the terminal at the current cursor position. */ /** Write a character to the terminal at the current cursor position. */
void writeChar(char c); void printChar(char c);
/** Write a string to the terminal at the current cursor position. */ /** Write a string to the terminal at the current cursor position. */
void writeString(const char *str); void printString(const char *str);
void setColor(Color fg, Color bg); void setColor(Color fg, Color bg);

View file

@ -53,14 +53,14 @@ InterruptHandler::initialize()
mIDT.setDescriptor(i, IDT::DescriptorSpec::exceptionHandler(1, &unhandledInterrupt)); mIDT.setDescriptor(i, IDT::DescriptorSpec::exceptionHandler(1, &unhandledInterrupt));
} }
mIDT.load(); mIDT.load();
console.writeString("Interrupt table loaded\n"); console.printString("Interrupt table loaded\n");
mPIC.initialize(0x20, 0x28); // Map hardware IRQs to interrupt vectors 32 through 48. mPIC.initialize(0x20, 0x28); // Map hardware IRQs to interrupt vectors 32 through 48.
console.writeString("Hardware interrupts initialized\n"); console.printString("Hardware interrupts initialized\n");
// Enable the keyboard interrupt. // Enable the keyboard interrupt.
mPIC.enableInterrupt(1, true); mPIC.enableInterrupt(1, true);
console.writeString("Enabling keyboard interrupt\n"); console.printString("Enabling keyboard interrupt\n");
} }
@ -87,7 +87,7 @@ void
doUnhandledInterrupt() doUnhandledInterrupt()
{ {
auto& console = kernel::Console::systemConsole(); auto& console = kernel::Console::systemConsole();
console.writeString("Received unhandled interrupt.\nAbort. :("); console.printString("Received unhandled interrupt.\nAbort. :(");
} }
@ -98,25 +98,25 @@ dispatchExceptionHandler(size_t vector)
using x86::Interrupt; using x86::Interrupt;
auto& console = kernel::Console::systemConsole(); auto& console = kernel::Console::systemConsole();
console.writeString("Received exception "); console.printString("Received exception ");
switch (Interrupt(vector)) { switch (Interrupt(vector)) {
case Interrupt::DE: case Interrupt::DE:
console.writeString("#DE"); console.printString("#DE");
break; break;
case Interrupt::NMI: case Interrupt::NMI:
console.writeString("NMI"); console.printString("NMI");
break; break;
case Interrupt::DF: case Interrupt::DF:
console.writeString("#DF"); console.printString("#DF");
break; break;
case Interrupt::GP: case Interrupt::GP:
console.writeString("#GP"); console.printString("#GP");
break; break;
default: default:
console.writeString("SOME OTHER THING"); console.printString("SOME OTHER THING");
break; break;
} }
console.writeString("\nAbort. :("); console.printString("\nAbort. :(");
} }
extern "C" extern "C"
@ -124,7 +124,7 @@ void
handleTimerInterrupt() handleTimerInterrupt()
{ {
auto& console = kernel::Console::systemConsole(); auto& console = kernel::Console::systemConsole();
console.writeString("Thyme!\n"); console.printString("Thyme!\n");
} }
extern "C" extern "C"
@ -132,5 +132,5 @@ void
handleKeyboardInterrupt() handleKeyboardInterrupt()
{ {
auto& console = kernel::Console::systemConsole(); auto& console = kernel::Console::systemConsole();
console.writeString("Key!\n"); console.printString("Key!\n");
} }

View file

@ -25,7 +25,7 @@ kearly()
*/ */
Console console; Console console;
console.clear(kernel::Console::Color::Blue); console.clear(kernel::Console::Color::Blue);
console.writeString("Loading system ...\n"); console.printString("Loading system ...\n");
} }
@ -44,12 +44,12 @@ kmain()
gdt.setDescriptor(2, x86::GDT::DescriptorSpec::kernelSegment(0, 0xFFFFFFFF, x86::GDT::Type::DataRW)); gdt.setDescriptor(2, x86::GDT::DescriptorSpec::kernelSegment(0, 0xFFFFFFFF, x86::GDT::Type::DataRW));
gdt.load(); gdt.load();
console.writeString("GDT loaded\n"); console.printString("GDT loaded\n");
auto& interruptHandler = x86::InterruptHandler::systemInterruptHandler(); auto& interruptHandler = x86::InterruptHandler::systemInterruptHandler();
interruptHandler.initialize(); interruptHandler.initialize();
interruptHandler.enableInterrupts(); interruptHandler.enableInterrupts();
console.writeString("Interrupts enabled\n"); console.printString("Interrupts enabled\n");
for (;;) { } for (;;) { }
} }

View file

@ -45,8 +45,8 @@ __cxa_guard_abort(__guard *)
{ {
kernel::Console console; kernel::Console console;
console.clear(kernel::Console::Color::Red); console.clear(kernel::Console::Color::Red);
console.writeString("OOPS!\n"); console.printString("OOPS!\n");
console.writeString("Unhandled exception initializing static variable.\n"); console.printString("Unhandled exception initializing static variable.\n");
} }
} }