X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fdebug.c;h=4b3aeb77518f47700c99c7123ad5e990dbd4eee0;hb=0e9730abc6c9ba710a3f71356720a70d79e407ab;hp=f71e889ea9ef668a75afca67be8166ff455ffa63;hpb=4ab9a574c9301d9590c91209f62c348e1d8c8883;p=tpg%2Facess2.git diff --git a/Kernel/debug.c b/Kernel/debug.c index f71e889e..4b3aeb77 100644 --- a/Kernel/debug.c +++ b/Kernel/debug.c @@ -90,6 +90,7 @@ void Debug_Fmt(const char *format, va_list *args) 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"); @@ -184,10 +196,9 @@ void Debug_Fmt(const char *format, va_list *args) p = (char*)(Uint)arg; if(!p) p = "(null)"; len = strlen(p); - while(len++ < minSize) Debug_Putchar(pad); - printString: - if(!p) p = "(null)"; + 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 @@ -264,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, ...)