X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdebug.c;h=4b3aeb77518f47700c99c7123ad5e990dbd4eee0;hb=5c9451f7e03edf59a3066853ae544c9d120bf90a;hp=7168b3af99937de44c04eb9d0647480b546e98f3;hpb=bd8dc898108f10c0498f4dc5d0164a50b5ff2e5c;p=tpg%2Facess2.git diff --git a/Kernel/debug.c b/Kernel/debug.c index 7168b3af..4b3aeb77 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -85,11 +85,12 @@ static void Debug_Puts(char *Str) void Debug_Fmt(const char *format, va_list *args) { char c, pad = ' '; - int minSize = 0; + int minSize = 0, len; char tmpBuf[34]; // For Integers char *p = NULL; int isLongLong = 0; Uint64 arg; + int bPadLeft = 0; while((c = *format++) != 0) { @@ -119,6 +120,12 @@ void Debug_Fmt(const char *format, va_list *args) // Get Argument arg = va_arg(*args, Uint); + // - Padding Side Flag + if(c == '+') { + bPadLeft = 1; + c = *format++; + } + // Padding if(c == '0') { pad = '0'; @@ -175,6 +182,11 @@ void Debug_Fmt(const char *format, va_list *args) itoa(p, arg, 2, minSize, pad); goto printString; + printString: + if(!p) p = "(null)"; + while(*p) Debug_Putchar(*p++); + break; + case 'B': //Boolean if(arg) Debug_Puts("True"); else Debug_Puts("False"); @@ -182,9 +194,11 @@ void Debug_Fmt(const char *format, va_list *args) case 's': p = (char*)(Uint)arg; - printString: if(!p) p = "(null)"; + len = strlen(p); + if( !bPadLeft ) while(len++ < minSize) Debug_Putchar(pad); while(*p) Debug_Putchar(*p++); + if( bPadLeft ) while(len++ < minSize) Debug_Putchar(pad); break; // Single Character / Array @@ -261,7 +275,7 @@ void Debug_SetKTerminal(char *File) if(giDebug_KTerm != -1) VFS_Close(giDebug_KTerm); giDebug_KTerm = VFS_Open(File, VFS_OPENFLAG_WRITE); - Log("Opened '%s' as 0x%x", File, giDebug_KTerm); + Log_Log("Debug", "Opened '%s' as 0x%x", File, giDebug_KTerm); } void Debug_Enter(char *FuncName, char *ArgTypes, ...)