kprintf readme
This commit is contained in:
parent
65c2780b94
commit
912bea9397
@ -1,5 +1,19 @@
|
|||||||
# kprintf
|
# kprintf
|
||||||
It is just my variant of printf.
|
It is just my cross-plaform variant of printf.
|
||||||
|
Unlike in standard printf, `%l...` and `%ll...` placeholders dont depend on size of `long int` and `long long int`. And you can change terminal colors by unix codes (`\e[92m`) even on Windows.
|
||||||
|
|
||||||
|
| type | placeholder |
|
||||||
|
|-------------------------|-------------------------|
|
||||||
|
| int8 / int16 / int32 | %i / %d |
|
||||||
|
| int64 | %li / %ld / %lld / %lli |
|
||||||
|
| uint8 / uint16 / uint32 | %u |
|
||||||
|
| uint64 | %lu / %llu |
|
||||||
|
| float32 / float64 | %f |
|
||||||
|
| char | %c |
|
||||||
|
| char[] | %s |
|
||||||
|
| void* | %p / %x |
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
# kprint
|
# kprint
|
||||||
I don't really like printf function (and its variants), so i made safer and more convinient replacement.
|
I don't really like printf function (and its variants), so i made safer and more convinient replacement.
|
||||||
@ -33,4 +47,4 @@ I don't really like printf function (and its variants), so i made safer and more
|
|||||||
Maybe m=MaybeNull;
|
Maybe m=MaybeNull;
|
||||||
kprint(kprint_fgBlue | kprint_fmtString, "Maybe: ", kprint_fgGreen | ktid_MaybePtr, &m);
|
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>
|
output: <span style="color:blue">Maybe:</span> <span style="color:lightgreen">{value={0, ktid_Null}}</span>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// cross-platform kprintf analog
|
// cross-platform printf analog
|
||||||
void kprintf(const char* format, ...);
|
void kprintf(const char* format, ...);
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user