kprint moved out from base
This commit is contained in:
@@ -9,7 +9,6 @@ extern "C" {
|
||||
#include "cptr.h"
|
||||
#include "optime.h"
|
||||
#include "type_system/type_system.h"
|
||||
#include "kprint/kprint.h"
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# kprint
|
||||
I don't really like printf function (and its variants), so i made safer and more convinient replacement.
|
||||
|
||||
| function | returns | arguments |
|
||||
|----------|---------|-----------|
|
||||
| kprint | void/throw | kprint_format, void*, kprint_format, void*... |
|
||||
| ksprint | Maybe<char*> | kprint_format, void*, kprint_format, void*... |
|
||||
| kfprint | Maybe<void> | FILE*, kprint_format, void*, kprint_format, void*... |
|
||||
|
||||
## how to use it:
|
||||
+ **format construction:**
|
||||
```
|
||||
kprint_format fmt= kprint_fgColor | kprint_bgColor | kprint_fdataFmt | flags | ktId;
|
||||
```
|
||||
[more about `kprint_format`](kprint_format.md)
|
||||
+ fgColor and bgColor can be set to change console output color
|
||||
+ you should set dataFormat for `int`/`uint`/`float`/`char*` arguments and ktId for other types
|
||||
+ flags can be set to modify TypeDescriptor.toString() behavior
|
||||
+ don't forget to set TypeDescriptor.toString when registering type, or kprint will crash
|
||||
|
||||
+ **using base type arguments:**
|
||||
you can just put them into a function
|
||||
```
|
||||
kprint(kprint_fmtHex | kprint_fmtUppercase | kprint_fmtWithPrefix, 255);
|
||||
```
|
||||
output: 0xFF
|
||||
+ **using other registered types:**
|
||||
should be sent as pointers
|
||||
```
|
||||
Maybe m=MaybeNull;
|
||||
kprint(kprint_fgBlue | kprint_fmtString, "Maybe: ", kprint_fgGreen | ktId_MaybePtr, &m);
|
||||
```
|
||||
output: <span style="color:blue">Maybe:</span> <span style="color:lightgreen">{value={0, ktId_Null}}</span>
|
||||
@@ -1,164 +0,0 @@
|
||||
#include "../base.h"
|
||||
#include "../../String/StringBuilder.h"
|
||||
|
||||
ktId __typeFromFormat(kprint_format f){
|
||||
ktId typeId=kprint_format_ktId(f);
|
||||
if(typeId)
|
||||
return typeId;
|
||||
switch(kprint_format_dataFormat(f)){
|
||||
case kprint_fmtInt:
|
||||
case kprint_fmtHex:
|
||||
case kprint_fmtBin:
|
||||
return ktId_Int64;
|
||||
case kprint_fmtUInt:
|
||||
return ktId_UInt64;
|
||||
case kprint_fmtFloat:
|
||||
return ktId_Float64;
|
||||
case kprint_fmtChar:
|
||||
return ktId_Char;
|
||||
case kprint_fmtString:
|
||||
return ktId_CharPtr;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Maybe __next_toString(kprint_format f, void* object){
|
||||
// detecting type
|
||||
ktId typeId=__typeFromFormat(f);
|
||||
if(typeId==-1)
|
||||
safethrow("typeId is not set, can't autodetect type",;);
|
||||
ktDescriptor typeDesc=ktDescriptor_get(typeId);
|
||||
if(!typeDesc.toString)
|
||||
safethrow("type descriptor doesnt have toString() func",;);
|
||||
return SUCCESS(UniHeap(ktId_CharPtr, typeDesc.toString(object, f)));
|
||||
}
|
||||
|
||||
Maybe __ksprint(uint8 n, kprint_format* formats, void** objects){
|
||||
StringBuilder* strb=StringBuilder_create();
|
||||
for(uint8 i=0; i<n; i++){
|
||||
try(__next_toString(formats[i], objects[i]),mStr,;);
|
||||
StringBuilder_append_cptr(strb, mStr.value.VoidPtr);
|
||||
}
|
||||
char* rezult=StringBuilder_build(strb).ptr;
|
||||
return SUCCESS(UniHeap(ktId_CharPtr, rezult));
|
||||
}
|
||||
|
||||
Maybe __kfprint(FILE* file, uint8 n, kprint_format* formats, void** objects){
|
||||
for(uint8 i=0; i<n; i++){
|
||||
try(__next_toString(formats[i], objects[i]),maybeStr,;);
|
||||
if(fputs(maybeStr.value.VoidPtr, file)==EOF)
|
||||
safethrow("can't write string to file", Unitype_free(maybeStr.value));
|
||||
Unitype_free(maybeStr.value);
|
||||
}
|
||||
fflush(file);
|
||||
return MaybeNull;
|
||||
}
|
||||
|
||||
void __kprint(uint8 n, kprint_format* formats, void** objects){
|
||||
for(uint8 i=0; i<n; i++){
|
||||
kprint_format fmt=formats[i];
|
||||
kprint_setColor(fmt);
|
||||
tryLast(__next_toString(fmt, objects[i]),maybeStr);
|
||||
if(fputs(maybeStr.value.VoidPtr, stdout)==EOF)\
|
||||
throw("can't write string to stdout");
|
||||
//, Unitype_free(maybeStr.value)
|
||||
Unitype_free(maybeStr.value);
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
#if defined(_WIN32)|| defined(_WIN64)
|
||||
#include <windows.h>
|
||||
#define FOREGROUND_YELLOW FOREGROUND_GREEN | FOREGROUND_RED
|
||||
|
||||
DWORD kprint_fgColor_toWin(kprint_fgColor f){
|
||||
//printf("fg: %x\n", f);
|
||||
switch(f){
|
||||
case kprint_fgBlack: return 0;
|
||||
case kprint_fgDarkRed: return FOREGROUND_RED;
|
||||
case kprint_fgDarkGreen: return FOREGROUND_GREEN;
|
||||
case kprint_fgDarkYellow: return FOREGROUND_GREEN | FOREGROUND_RED;
|
||||
case kprint_fgDarkBlue: return FOREGROUND_BLUE;
|
||||
case kprint_fgDarkMagneta: return FOREGROUND_RED | FOREGROUND_BLUE;
|
||||
case kprint_fgDarkCyan: return FOREGROUND_BLUE | FOREGROUND_GREEN;
|
||||
case kprint_fgGray: return FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
|
||||
case kprint_fgDarkGray: return FOREGROUND_INTENSITY;
|
||||
case kprint_fgRed: return FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||
case kprint_fgGreen: return FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||
case kprint_fgYellow: return FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||
case kprint_fgBlue: return FOREGROUND_BLUE | FOREGROUND_INTENSITY;
|
||||
case kprint_fgMagneta: return FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||
case kprint_fgCyan: return FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||
case kprint_fgWhite: return FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||
default: throw(ERR_FORMAT);
|
||||
}
|
||||
}
|
||||
|
||||
DWORD kprint_bgColor_toWin(kprint_bgColor f){
|
||||
//printf("bg: %x\n", f);
|
||||
switch(f){
|
||||
case kprint_bgBlack: return 0;
|
||||
case kprint_bgDarkRed: return BACKGROUND_RED;
|
||||
case kprint_bgDarkGreen: return BACKGROUND_GREEN;
|
||||
case kprint_bgDarkYellow: return BACKGROUND_GREEN | BACKGROUND_RED;
|
||||
case kprint_bgDarkBlue: return BACKGROUND_BLUE;
|
||||
case kprint_bgDarkMagneta: return BACKGROUND_RED | BACKGROUND_BLUE;
|
||||
case kprint_bgDarkCyan: return BACKGROUND_BLUE | BACKGROUND_GREEN;
|
||||
case kprint_bgGray: return BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED;
|
||||
case kprint_bgDarkGray: return BACKGROUND_INTENSITY;
|
||||
case kprint_bgRed: return BACKGROUND_RED | BACKGROUND_INTENSITY;
|
||||
case kprint_bgGreen: return BACKGROUND_GREEN | BACKGROUND_INTENSITY;
|
||||
case kprint_bgYellow: return BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY;
|
||||
case kprint_bgBlue: return BACKGROUND_BLUE | BACKGROUND_INTENSITY;
|
||||
case kprint_bgMagneta: return BACKGROUND_BLUE | BACKGROUND_RED | BACKGROUND_INTENSITY;
|
||||
case kprint_bgCyan: return BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY;
|
||||
case kprint_bgWhite: return BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY;
|
||||
default: throw(ERR_FORMAT);
|
||||
}
|
||||
}
|
||||
|
||||
void kprint_setColor(kprint_format f){
|
||||
DWORD color=0;
|
||||
if(!kprint_format_fgColorChanged(f) & !kprint_format_bgColorChanged(f))
|
||||
return;
|
||||
if(kprint_format_fgColorChanged(f))
|
||||
color+=kprint_fgColor_toWin(kprint_format_fgColor(f));
|
||||
if(kprint_format_bgColorChanged(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)){
|
||||
uint8 fg=(f&0x0f000000)>>24;
|
||||
if(fg<8) fg+=30;
|
||||
else fg+=90-8;
|
||||
printf("\e[%um", fg);
|
||||
}
|
||||
if(kprint_format_bgColorChanged(f)){
|
||||
uint8 bg=(f&0x00f00000)>>20;
|
||||
if(bg<8) bg+=40;
|
||||
else bg+=100-8;
|
||||
printf("\e[%um", bg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Maybe ksprint_ar(uint32 count, kprint_format format, ktId typeId, void* array){
|
||||
ktDescriptor typeDesc=ktDescriptor_get(format.typeId);
|
||||
if(!typeDesc.toString)
|
||||
safethrow("type descriptor doesnt have toString() func",;);
|
||||
StringBuilder* strb=StringBuilder_create();
|
||||
StringBuilder_append_char(strb, '[');
|
||||
for (uint16 e=1; e<count; e++){
|
||||
StringBuilder_append_char(strb, ' ');
|
||||
char* elStr=typeDesc.toString(array+typeDesc.size*e, &format);
|
||||
StringBuilder_append_cptr(strb, elStr);
|
||||
StringBuilder_append_char(strb, ',');
|
||||
}
|
||||
StringBuilder_rmchar(strb);
|
||||
StringBuilder_append_char(strb, ' ');
|
||||
StringBuilder_append_char(strb, ']');
|
||||
} */
|
||||
@@ -1,65 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../errors.h"
|
||||
#include "kprint_colors.h"
|
||||
#include "kprint_format.h"
|
||||
|
||||
#define __kprint_argsToFormats8(\
|
||||
a0, a1, a2, a3, a4, a5, a6, a7,...)\
|
||||
((int32[]){ a0,a2,a4,a6 })
|
||||
#define __kprint_argsToObjects8(\
|
||||
a0, a1, a2, a3, a4, a5, a6, a7,...)\
|
||||
((void*[]){ &a1,&a3,&a5,&a7 })
|
||||
|
||||
#define __kprint_argsToFormats16(\
|
||||
a0, a1, a2, a3, a4, a5, a6, a7,\
|
||||
a8, a9, a10,a11,a12,a13,a14,a15,...)\
|
||||
((int32[]){ a0,a2,a4,a6,a8,a10,a12,a14 })
|
||||
#define __kprint_argsToObjects16(\
|
||||
a0, a1, a2, a3, a4, a5, a6, a7,\
|
||||
a8, a9, a10,a11,a12,a13,a14,a15,...)\
|
||||
((void*[]){ &a1,&a3,&a5,&a7,&a9,&a11,&a13,&a15 })
|
||||
|
||||
#define __kprint_argsToFormats32(\
|
||||
a0, a1, a2, a3, a4, a5, a6, a7,\
|
||||
a8, a9, a10,a11,a12,a13,a14,a15,\
|
||||
a16,a17,a18,a19,a20,a21,a22,a23,\
|
||||
a24,a25,a26,a27,a28,a29,a30,a31,...)\
|
||||
((int32[]){ a0,a2,a4,a6,a8,a10,a12,a14,a16,a18,a20,a22,a24,a26,a28,a30 })
|
||||
#define __kprint_argsToObjects32(\
|
||||
a0, a1, a2, a3, a4, a5, a6, a7,\
|
||||
a8, a9, a10,a11,a12,a13,a14,a15,\
|
||||
a16,a17,a18,a19,a20,a21,a22,a23,\
|
||||
a24,a25,a26,a27,a28,a29,a30,a31,...)\
|
||||
((void*[]){ &a1,&a3,&a5,&a7,&a9,&a11,&a13,&a15,&a17,&a19,&a21,&a23,&a25,&a27,&a29,&a31 })
|
||||
|
||||
#define __32zeroes 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
#define __kprint_argsToArrs(COUNT,ARGS...)\
|
||||
(COUNT<=8 ? __kprint_argsToFormats8(ARGS) :\
|
||||
COUNT<=16 ? __kprint_argsToFormats16(ARGS) :\
|
||||
__kprint_argsToFormats32(ARGS)),\
|
||||
(COUNT<=8 ? __kprint_argsToObjects8(ARGS) :\
|
||||
COUNT<=16 ? __kprint_argsToObjects16(ARGS) :\
|
||||
__kprint_argsToObjects32(ARGS))
|
||||
|
||||
|
||||
Maybe __ksprint(uint8 n, kprint_format* formats, void** objects);
|
||||
#define ksprint(ARGS...) __ksprint(count_args(ARGS), __kprint_argsToArrs(count_args(ARGS),ARGS, __32zeroes))
|
||||
|
||||
Maybe __kfprint(FILE* fd, uint8 n, kprint_format* formats, void** objects);
|
||||
#define kfprint(FD, ARGS...) __kfprint(FD, count_args(ARGS), __kprint_argsToArrs(count_args(ARGS),ARGS, __32zeroes))
|
||||
|
||||
void __kprint(uint8 n, kprint_format* formats, void** objects);
|
||||
#define kprint(ARGS...) __kprint(count_args(ARGS), __kprint_argsToArrs(count_args(ARGS),ARGS, __32zeroes))
|
||||
|
||||
// can take (bgColor | fgColor)
|
||||
void kprint_setColor(kprint_format f);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum kprint_fgColor{
|
||||
// 10000000 00000000 00000000 00000000
|
||||
// ^ ^^^^
|
||||
// | color num
|
||||
// fgColorChanged flag
|
||||
|
||||
kprint_fgBlack = 0x80000000,
|
||||
kprint_fgDarkRed = 0x81000000,
|
||||
kprint_fgDarkGreen = 0x82000000,
|
||||
kprint_fgDarkYellow = 0x83000000,
|
||||
kprint_fgDarkBlue = 0x84000000,
|
||||
kprint_fgDarkMagneta= 0x85000000,
|
||||
kprint_fgDarkCyan = 0x86000000,
|
||||
kprint_fgGray = 0x87000000,
|
||||
kprint_fgDarkGray = 0x88000000,
|
||||
kprint_fgRed = 0x89000000,
|
||||
kprint_fgGreen = 0x8a000000,
|
||||
kprint_fgYellow = 0x8b000000,
|
||||
kprint_fgBlue = 0x8c000000,
|
||||
kprint_fgMagneta = 0x8d000000,
|
||||
kprint_fgCyan = 0x8e000000,
|
||||
kprint_fgWhite = 0x8f000000
|
||||
} kprint_fgColor;
|
||||
|
||||
typedef enum kprint_bgColor{
|
||||
// 01000000 00000000 00000000 00000000
|
||||
// ^ ^^^^
|
||||
// bgColorChanged flag color num
|
||||
kprint_bgBlack = 0x40000000,
|
||||
kprint_bgDarkRed = 0x40100000,
|
||||
kprint_bgDarkGreen = 0x40200000,
|
||||
kprint_bgDarkYellow = 0x40300000,
|
||||
kprint_bgDarkBlue = 0x40400000,
|
||||
kprint_bgDarkMagneta= 0x40500000,
|
||||
kprint_bgDarkCyan = 0x40600000,
|
||||
kprint_bgGray = 0x40700000,
|
||||
kprint_bgDarkGray = 0x40800000,
|
||||
kprint_bgRed = 0x40900000,
|
||||
kprint_bgGreen = 0x40a00000,
|
||||
kprint_bgYellow = 0x40b00000,
|
||||
kprint_bgBlue = 0x40c00000,
|
||||
kprint_bgMagneta = 0x40d00000,
|
||||
kprint_bgCyan = 0x40e00000,
|
||||
kprint_bgWhite = 0x40f00000
|
||||
} kprint_bgColor;
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,48 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../std.h"
|
||||
#include "../type_system/ktId.h"
|
||||
|
||||
typedef enum kprint_dataFormat{
|
||||
// 00000000 00000000 00000000 00000000
|
||||
// ^^^^
|
||||
// type
|
||||
kprint_fmtInt = 0x00000000,
|
||||
kprint_fmtUInt = 0x00010000,
|
||||
kprint_fmtHex = 0x00020000,
|
||||
kprint_fmtBin = 0x00030000,
|
||||
kprint_fmtFloat = 0x00040000,
|
||||
kprint_fmtChar = 0x00050000,
|
||||
kprint_fmtString = 0x00060000,
|
||||
|
||||
// 00100000 00000000 00000000 00000000
|
||||
// ^
|
||||
// prefix/postfix flag
|
||||
kprint_fmtWithPrefix=0x20000000,
|
||||
kprint_fmtWithPostfix=kprint_fmtWithPrefix,
|
||||
|
||||
// 00010000 00000000 00000000 00000000
|
||||
// ^
|
||||
// uppercase flag
|
||||
kprint_fmtUppercase=0x10000000
|
||||
} 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_fgColor(FMT) (kprint_fgColor)(FMT&0x8f000000)
|
||||
#define kprint_format_bgColor(FMT) (kprint_bgColor)(FMT&0x40f00000)
|
||||
#define kprint_format_dataFormat(FMT) (kprint_dataFormat)(FMT&0x000f0000)
|
||||
#define kprint_format_ktId(FMT) (kprint_dataFormat)(FMT&0x0000ffff)
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,72 +0,0 @@
|
||||
# kerep_format
|
||||
|
||||
```
|
||||
00000000 00000000 00000000 00000000
|
||||
fgColorSet┘│││└┼┴┘ └┼┴┘└┴┴┤ ktId
|
||||
bgColorSet─┘││ │ bgColor └data format
|
||||
prefix┬────┘│ └fgColor
|
||||
postfix └uppercase
|
||||
|
||||
```
|
||||
|
||||
## Console colors
|
||||
### *Foreground*
|
||||
|
||||
| kprint_fg | hex | bin |
|
||||
|-----------|-----|-----|
|
||||
| Black | 0x80000000 | 10000000 00000000... |
|
||||
| DarkRed | 0x81000000 | 10000001 00000000... |
|
||||
| DarkGreen | 0x82000000 | 10000010 00000000... |
|
||||
| DarkYellow | 0x83000000 | 10000011 00000000... |
|
||||
| DarkBlue | 0x84000000 | 10000100 00000000... |
|
||||
| DarkMagneta | 0x85000000 | 10000101 00000000... |
|
||||
| DarkCyan | 0x86000000 | 10000110 00000000... |
|
||||
| Gray | 0x87000000 | 10000111 00000000... |
|
||||
| DarkGray | 0x88000000 | 10001000 00000000... |
|
||||
| Red | 0x89000000 | 10001001 00000000... |
|
||||
| Green | 0x8a000000 | 10001010 00000000... |
|
||||
| Yellow | 0x8b000000 | 10001011 00000000... |
|
||||
| Blue | 0x8c000000 | 10001100 00000000... |
|
||||
| Magneta | 0x8d000000 | 10001101 00000000... |
|
||||
| Cyan | 0x8e000000 | 10001110 00000000... |
|
||||
| White | 0x8f000000 | 10001111 00000000... |
|
||||
|
||||
### *Background*
|
||||
| kprint_bg | hex | bin |
|
||||
|-----------|-----|-----|
|
||||
| Black | 0x40000000 | 01000000 00000000... |
|
||||
| DarkRed | 0x40100000 | 01000000 00010000... |
|
||||
| DarkGreen | 0x40200000 | 01000000 00100000... |
|
||||
| DarkYellow | 0x40300000 | 01000000 00110000... |
|
||||
| DarkBlue | 0x40400000 | 01000000 01000000... |
|
||||
| DarkMagneta | 0x40500000 | 01000000 01010000... |
|
||||
| DarkCyan | 0x40600000 | 01000000 01100000... |
|
||||
| Gray | 0x40700000 | 01000000 01110000... |
|
||||
| DarkGray | 0x40800000 | 01000000 10000000... |
|
||||
| Red | 0x40900000 | 01000000 10010000... |
|
||||
| Green | 0x40a00000 | 01000000 10100000... |
|
||||
| Yellow | 0x40b00000 | 01000000 10110000... |
|
||||
| Blue | 0x40c00000 | 01000000 11000000... |
|
||||
| Magneta | 0x40d00000 | 01000000 11010000... |
|
||||
| Cyan | 0x40e00000 | 01000000 11100000... |
|
||||
| White | 0x40f00000 | 01000000 11110000... |
|
||||
|
||||
|
||||
## Data format
|
||||
|
||||
| kprint_fmt | possible flags | data types | hex value | bin value |
|
||||
|------------|----------------|------------|-----------|-----------|
|
||||
| Int | | int8... int64 | 0x00000000 | 00000000 00000000... |
|
||||
| UInt | WithPostfix, Uppercase | uint8... uint64 | 0x00010000 | 00000000 00000001... |
|
||||
| Hex | WithPrefix, Uppercase | any | 0x00020000 | 00000000 00000010... |
|
||||
| Bin | WithPrefix, | any | 0x00030000 | 00000000 00000011... |
|
||||
| Float | WithPostfix, Uppercase | float32, float64 | 0x00040000 | 00000000 00000100... |
|
||||
| Char | | char | 0x00050000 | 00000000 00000101... |
|
||||
| String | | char* | 0x00060000 | 00000000 00000110... |
|
||||
|
||||
### *Flags*
|
||||
| kprint_fmt | hex value | bin value |
|
||||
|-------------|------------|-----------|
|
||||
| withPrefix | 0x20000000 | 00100000 00000000... |
|
||||
| withPostfix | 0x20000000 | 00100000 00000000... |
|
||||
| upperase | 0x10000000 | 00010000 00000000... |
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "base_toString.h"
|
||||
#include "../cptr.h"
|
||||
#include "../kprint/kprint_format.h"
|
||||
#include "../../kprint/kprint_format.h"
|
||||
|
||||
char* toString_int(int64 n){
|
||||
int64 d=n;
|
||||
|
||||
Reference in New Issue
Block a user