Rename writeChar, writeString -> printChar, printString
This commit is contained in:
		
							parent
							
								
									46d18b97d5
								
							
						
					
					
						commit
						1bbd99aeee
					
				
					 5 changed files with 23 additions and 23 deletions
				
			
		| 
						 | 
				
			
			@ -72,7 +72,7 @@ Console::clear(Console::Color color)
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Console::writeChar(char c)
 | 
			
		||||
Console::printChar(char c)
 | 
			
		||||
{
 | 
			
		||||
    switch (c) {
 | 
			
		||||
        case '\n':
 | 
			
		||||
| 
						 | 
				
			
			@ -106,12 +106,12 @@ Console::writeChar(char c)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
    const char *cur = str;
 | 
			
		||||
    while (*cur != '\0') {
 | 
			
		||||
        writeChar(*cur++);
 | 
			
		||||
        printChar(*cur++);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,10 +53,10 @@ struct Console
 | 
			
		|||
    void clear(Color color);
 | 
			
		||||
 | 
			
		||||
    /** 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. */
 | 
			
		||||
    void writeString(const char *str);
 | 
			
		||||
    void printString(const char *str);
 | 
			
		||||
 | 
			
		||||
    void setColor(Color fg, Color bg);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,14 +53,14 @@ InterruptHandler::initialize()
 | 
			
		|||
        mIDT.setDescriptor(i, IDT::DescriptorSpec::exceptionHandler(1, &unhandledInterrupt));
 | 
			
		||||
    }
 | 
			
		||||
    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.
 | 
			
		||||
    console.writeString("Hardware interrupts initialized\n");
 | 
			
		||||
    console.printString("Hardware interrupts initialized\n");
 | 
			
		||||
 | 
			
		||||
    // Enable the keyboard interrupt.
 | 
			
		||||
    mPIC.enableInterrupt(1, true);
 | 
			
		||||
    console.writeString("Enabling keyboard interrupt\n");
 | 
			
		||||
    console.printString("Enabling keyboard interrupt\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +87,7 @@ void
 | 
			
		|||
doUnhandledInterrupt()
 | 
			
		||||
{
 | 
			
		||||
    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;
 | 
			
		||||
 | 
			
		||||
    auto& console = kernel::Console::systemConsole();
 | 
			
		||||
    console.writeString("Received exception ");
 | 
			
		||||
    console.printString("Received exception ");
 | 
			
		||||
    switch (Interrupt(vector)) {
 | 
			
		||||
        case Interrupt::DE:
 | 
			
		||||
            console.writeString("#DE");
 | 
			
		||||
            console.printString("#DE");
 | 
			
		||||
            break;
 | 
			
		||||
        case Interrupt::NMI:
 | 
			
		||||
            console.writeString("NMI");
 | 
			
		||||
            console.printString("NMI");
 | 
			
		||||
            break;
 | 
			
		||||
        case Interrupt::DF:
 | 
			
		||||
            console.writeString("#DF");
 | 
			
		||||
            console.printString("#DF");
 | 
			
		||||
            break;
 | 
			
		||||
        case Interrupt::GP:
 | 
			
		||||
            console.writeString("#GP");
 | 
			
		||||
            console.printString("#GP");
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            console.writeString("SOME OTHER THING");
 | 
			
		||||
            console.printString("SOME OTHER THING");
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
    console.writeString("\nAbort. :(");
 | 
			
		||||
    console.printString("\nAbort. :(");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern "C"
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ void
 | 
			
		|||
handleTimerInterrupt()
 | 
			
		||||
{
 | 
			
		||||
    auto& console = kernel::Console::systemConsole();
 | 
			
		||||
    console.writeString("Thyme!\n");
 | 
			
		||||
    console.printString("Thyme!\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern "C"
 | 
			
		||||
| 
						 | 
				
			
			@ -132,5 +132,5 @@ void
 | 
			
		|||
handleKeyboardInterrupt()
 | 
			
		||||
{
 | 
			
		||||
    auto& console = kernel::Console::systemConsole();
 | 
			
		||||
    console.writeString("Key!\n");
 | 
			
		||||
    console.printString("Key!\n");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ kearly()
 | 
			
		|||
     */
 | 
			
		||||
    Console console;
 | 
			
		||||
    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.load();
 | 
			
		||||
 | 
			
		||||
    console.writeString("GDT loaded\n");
 | 
			
		||||
    console.printString("GDT loaded\n");
 | 
			
		||||
 | 
			
		||||
    auto& interruptHandler = x86::InterruptHandler::systemInterruptHandler();
 | 
			
		||||
    interruptHandler.initialize();
 | 
			
		||||
    interruptHandler.enableInterrupts();
 | 
			
		||||
    console.writeString("Interrupts enabled\n");
 | 
			
		||||
    console.printString("Interrupts enabled\n");
 | 
			
		||||
 | 
			
		||||
    for (;;) { }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,8 +45,8 @@ __cxa_guard_abort(__guard *)
 | 
			
		|||
{
 | 
			
		||||
    kernel::Console console;
 | 
			
		||||
    console.clear(kernel::Console::Color::Red);
 | 
			
		||||
    console.writeString("OOPS!\n");
 | 
			
		||||
    console.writeString("Unhandled exception initializing static variable.\n");
 | 
			
		||||
    console.printString("OOPS!\n");
 | 
			
		||||
    console.printString("Unhandled exception initializing static variable.\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue