diff --git a/src/base/type_system/base_toString.c b/src/base/type_system/base_toString.c index 9101bec..fc3ccf0 100644 --- a/src/base/type_system/base_toString.c +++ b/src/base/type_system/base_toString.c @@ -19,7 +19,7 @@ char* __toString_char(void* c, uint32 fmt) { char* __toString_bool(void* c, uint32 fmt) { static const char _strbool[4][6]={ "false", "true\0", "False", "True\0" }; - uint8 strind=*(bool*)c==1 + kprint_format_uppercase(fmt)*2; + uint8 strind=*(bool*)c==1 + kprint_format_isUppercase(fmt)*2; char* rez=malloc(6); rez[0]=_strbool[strind][0]; rez[1]=_strbool[strind][1]; @@ -139,9 +139,9 @@ char* toString_hex(void* _bytes, uint32 size, bool withPrefix, bool uppercase){ int##BITS n=*(int##BITS*)_n;\ return toString_int(n);\ case kprint_fmtBin:\ - return toString_bin(_n, BITS/8, kprint_format_withPrefix(f));\ + return toString_bin(_n, BITS/8, kprint_format_isWithPrefix(f));\ case kprint_fmtHex:\ - return toString_hex(_n, BITS/8, kprint_format_withPrefix(f), kprint_format_uppercase(f));\ + return toString_hex(_n, BITS/8, kprint_format_isWithPrefix(f), kprint_format_isUppercase(f));\ default:\ kprintf("\n%u\n", kprint_format_dataFormat(f));\ throw(ERR_FORMAT);\ @@ -157,11 +157,11 @@ __toString_int_def(64) switch(kprint_format_dataFormat(f)){\ case kprint_fmtUInt: ;\ uint##BITS n=*(uint##BITS*)_n;\ - return toString_uint(n, kprint_format_withPostfix(f), kprint_format_uppercase(f));\ + return toString_uint(n, kprint_format_isWithPostfix(f), kprint_format_isUppercase(f));\ case kprint_fmtBin:\ - return toString_bin(_n, BITS/8, kprint_format_withPrefix(f));\ + return toString_bin(_n, BITS/8, kprint_format_isWithPrefix(f));\ case kprint_fmtHex:\ - return toString_hex(_n, BITS/8, kprint_format_withPrefix(f), kprint_format_uppercase(f));\ + return toString_hex(_n, BITS/8, kprint_format_isWithPrefix(f), kprint_format_isUppercase(f));\ default:\ kprintf("\n%u\n", kprint_format_dataFormat(f));\ throw(ERR_FORMAT);\ @@ -177,11 +177,11 @@ __toString_uint_def(64) switch(kprint_format_dataFormat(f)){\ case kprint_fmtFloat: ;\ float##BITS n=*(float##BITS*)_n;\ - return toString_float(n, kprint_format_withPostfix(f), kprint_format_uppercase(f));\ + return toString_float(n, kprint_format_isWithPostfix(f), kprint_format_isUppercase(f));\ case kprint_fmtBin:\ - return toString_bin(_n, BITS/8, kprint_format_withPrefix(f));\ + return toString_bin(_n, BITS/8, kprint_format_isWithPrefix(f));\ case kprint_fmtHex:\ - return toString_hex(_n, BITS/8, kprint_format_withPrefix(f), kprint_format_uppercase(f));\ + return toString_hex(_n, BITS/8, kprint_format_isWithPrefix(f), kprint_format_isUppercase(f));\ default:\ kprintf("\n%u\n", kprint_format_dataFormat(f));\ throw(ERR_FORMAT);\ diff --git a/src/kprint/kprint.c b/src/kprint/kprint.c index bc3421f..16307bb 100644 --- a/src/kprint/kprint.c +++ b/src/kprint/kprint.c @@ -124,24 +124,24 @@ DWORD kprint_bgColor_toWin(kprint_bgColor f){ void kprint_setColor(kprint_format f){ DWORD color=0; - if(!kprint_format_fgColorChanged(f) & !kprint_format_bgColorChanged(f)) + if(!kprint_format_isFgColorChanged(f) & !kprint_format_isBgColorChanged(f)) return; - if(kprint_format_fgColorChanged(f)) + if(kprint_format_isFgColorChanged(f)) color+=kprint_fgColor_toWin(kprint_format_fgColor(f)); - if(kprint_format_bgColorChanged(f)) + if(kprint_format_isBgColorChanged(f)) color+=kprint_bgColor_toWin(kprint_format_bgColor(f)); HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, color); } #else void kprint_setColor(kprint_format f){ - if(kprint_format_fgColorChanged(f)){ + if(kprint_format_isFgColorChanged(f)){ uint8 fg=(f&0x0f000000)>>24; if(fg<8) fg+=30; else fg+=90-8; printf("\e[%um", fg); } - if(kprint_format_bgColorChanged(f)){ + if(kprint_format_isBgColorChanged(f)){ uint8 bg=(f&0x00f00000)>>20; if(bg<8) bg+=40; else bg+=100-8; diff --git a/src/kprint/kprint_format.h b/src/kprint/kprint_format.h index a9c5db8..b925cb3 100644 --- a/src/kprint/kprint_format.h +++ b/src/kprint/kprint_format.h @@ -33,11 +33,11 @@ typedef enum kprint_dataFormat{ typedef uint32 kprint_format; -#define kprint_format_fgColorChanged(FMT) (FMT&0x80000000) -#define kprint_format_bgColorChanged(FMT) (FMT&0x40000000) -#define kprint_format_withPrefix(FMT) (FMT&kprint_fmtWithPrefix) -#define kprint_format_withPostfix(FMT) (FMT&kprint_fmtWithPostfix) -#define kprint_format_uppercase(FMT) (FMT&kprint_fmtUppercase) +#define kprint_format_isFgColorChanged(FMT) (bool)((FMT&0x80000000)!=0) +#define kprint_format_isBgColorChanged(FMT) (bool)((FMT&0x40000000)!=0) +#define kprint_format_isWithPrefix(FMT) (bool)((FMT&kprint_fmtWithPrefix)!=0) +#define kprint_format_isWithPostfix(FMT) (bool)((FMT&kprint_fmtWithPostfix)!=0) +#define kprint_format_isUppercase(FMT) (bool)((FMT&kprint_fmtUppercase)!=0) #define kprint_format_fgColor(FMT) (kprint_fgColor)(FMT&0x8f000000) #define kprint_format_bgColor(FMT) (kprint_bgColor)(FMT&0x40f00000) #define kprint_format_dataFormat(FMT) (kprint_dataFormat)(FMT&0x000f0000)