printing utilities to replace the large printf from the standard library (code)
More...
Go to the source code of this file.
|
#define | CRLF true |
| if CR+LN new line should be enforced
|
|
|
static size_t | print_char (char **str, size_t *size, char c) |
| print character More...
|
|
static size_t | print_string (char **str, size_t *size, const char *s) |
| print string More...
|
|
static size_t | print_unsigned (char **str, size_t *size, uint64_t u, uint8_t padding, bool sign) |
| print unsigned number More...
|
|
static size_t | print_signed (char **str, size_t *size, int64_t d, uint8_t padding, bool sign) |
| print signed number More...
|
|
static size_t | print_nibble (char **str, size_t *size, uint8_t nibble, bool upcase) |
| print nibble (half-byte) More...
|
|
static size_t | print_hex (char **str, size_t *size, uint32_t hex, uint8_t padding, bool prefix, bool upcase) |
| print hex value More...
|
|
static size_t | print_bits (char **str, size_t *size, uint32_t u, uint8_t padding, bool prefix) |
| print bits More...
|
|
static size_t | vsnprintf (char **str, size_t *size, const char *format, va_list va) |
| print format string on string or user output More...
|
|
size_t | printf (const char *format,...) |
| print format string on user output More...
|
|
size_t | snprintf (char *str, size_t size, const char *format,...) |
| print format string on string or user output More...
|
|
printing utilities to replace the large printf from the standard library (code)
- Author
- King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
- Date
- 2017
Definition in file print.c.
◆ print_bits()
static size_t print_bits |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
uint32_t |
u, |
|
|
uint8_t |
padding, |
|
|
bool |
prefix |
|
) |
| |
|
static |
print bits
- Parameters
-
[out] | str | string to print bits on (use NULL to print on user output) |
[in,out] | size | size of string |
[in] | u | bits to be printed |
[in] | padding | number of 0's to pad |
[in] | prefix | if 0b prefix should be printed |
- Returns
- number of characters printed
Definition at line 187 of file print.c.
◆ print_char()
static size_t print_char |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
char |
c |
|
) |
| |
|
static |
print character
- Parameters
-
[out] | str | string to print character on (use NULL to print on user output) |
[in,out] | size | size of string |
[in] | c | character to be printed |
- Returns
- number of characters printed
Definition at line 41 of file print.c.
◆ print_hex()
static size_t print_hex |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
uint32_t |
hex, |
|
|
uint8_t |
padding, |
|
|
bool |
prefix, |
|
|
bool |
upcase |
|
) |
| |
|
static |
print hex value
- Parameters
-
[out] | str | string to print hex on (use NULL to print on user output) |
[in,out] | size | size of string |
[in] | hex | hex value to be printed |
[in] | padding | number of 0's to pad |
[in] | prefix | if 0x prefix should be printed |
[in] | upcase | use upcase digits (A-F) |
- Returns
- number of characters printed
Definition at line 153 of file print.c.
◆ print_nibble()
static size_t print_nibble |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
uint8_t |
nibble, |
|
|
bool |
upcase |
|
) |
| |
|
static |
print nibble (half-byte)
- Parameters
-
[out] | str | string to print nibble on (use NULL to print on user output) |
[in,out] | size | size of string |
[in] | nibble | nibble to be printed |
[in] | upcase | use upcase digits (A-F) |
- Returns
- number of characters printed
Definition at line 131 of file print.c.
◆ print_signed()
static size_t print_signed |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
int64_t |
d, |
|
|
uint8_t |
padding, |
|
|
bool |
sign |
|
) |
| |
|
static |
print signed number
- Parameters
-
[out] | str | string to print signed number on (use NULL to print on user output) |
[in,out] | size | size of string |
[in] | d | signed number to be printed |
[in] | padding | number of 0's to pad |
[in] | sign | if sign should be printed |
- Returns
- number of characters printed
Definition at line 113 of file print.c.
◆ print_string()
static size_t print_string |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
const char * |
s |
|
) |
| |
|
static |
print string
- Parameters
-
[out] | str | string to print string on (use NULL to print on user output) |
[in,out] | size | size of string |
[in] | s | string to be printed |
- Returns
- number of characters printed
Definition at line 65 of file print.c.
◆ print_unsigned()
static size_t print_unsigned |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
uint64_t |
u, |
|
|
uint8_t |
padding, |
|
|
bool |
sign |
|
) |
| |
|
static |
print unsigned number
- Parameters
-
[out] | str | string to print unsigned number on (use NULL to print on user output) |
[in,out] | size | size of string |
[in] | u | unsigned number to be printed |
[in] | padding | number of 0's to pad |
[in] | sign | if sign should be printed |
- Returns
- number of characters printed
Definition at line 82 of file print.c.
◆ printf()
size_t printf |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
print format string on user output
- Parameters
-
[in] | format | format string to be printed |
[in] | ... | arguments referenced by format string to be printed |
- Returns
- number of characters printed
Definition at line 296 of file print.c.
◆ snprintf()
size_t snprintf |
( |
char * |
str, |
|
|
size_t |
size, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
print format string on string or user output
- Parameters
-
[out] | str | string to print format string on, or user output if str is set to NULL (str will always be terminated with a null character '\0') |
[in,out] | size | size of string (writes at most size characters on str, including the termination null character '\0') |
[in] | format | format string to be printed |
[in] | ... | arguments referenced by format string to be printed |
- Returns
- number of characters printed (a return value of size or more means that the output was truncated)
Definition at line 306 of file print.c.
◆ vsnprintf()
static size_t vsnprintf |
( |
char ** |
str, |
|
|
size_t * |
size, |
|
|
const char * |
format, |
|
|
va_list |
va |
|
) |
| |
|
static |
print format string on string or user output
- Parameters
-
[out] | str | string to print format string on, or user output if str is set to NULL (str will always be terminated with a null character '\0') |
[in,out] | size | size of string (writes at most size characters on str, including the termination null character '\0') |
[in] | format | format string to be printed |
[in] | va | arguments referenced by format string to be printed |
- Returns
- number of characters printed (a return value of size or more means that the output was truncated)
Definition at line 218 of file print.c.