Embedded Artistry Framework
Embedded Systems C++ Framework
Macros | Functions
printf.h File Reference
#include <stdarg.h>
#include <stddef.h>
Include dependency graph for printf.h:
This graph shows which files directly or indirectly include this file:

Macros

#define printf   printf_
 Tiny printf implementation You have to implement putchar if you use printf() To avoid conflicts with the regular printf() API it is overridden by macro defines and internal underscore-appended functions like printf() are used. More...
 
#define sprintf   sprintf_
 Tiny sprintf implementation Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD! More...
 
#define snprintf   snprintf_
 Tiny snprintf/vsnprintf implementation. More...
 
#define vsnprintf   vsnprintf_
 
#define vprintf   vprintf_
 Tiny vprintf implementation. More...
 
#define _PRINTF_H_
 
#define printf   printf_
 
#define sprintf   sprintf_
 
#define snprintf   snprintf_
 
#define vsnprintf   vsnprintf_
 
#define vprintf   vprintf_
 

Functions

void _putchar (char character)
 Output a character to a custom device like UART, used by the printf() function This function is declared here only. More...
 
int printf_ (const char *format,...)
 
int sprintf_ (char *buffer, const char *format,...)
 
int snprintf_ (char *buffer, size_t count, const char *format,...)
 
int vsnprintf_ (char *buffer, size_t count, const char *format, va_list va)
 
int vprintf_ (const char *format, va_list va)
 
int fctprintf (void(*out)(char character, void *arg), void *arg, const char *format,...)
 printf with output function You may use this as dynamic alternative to printf() with its fixed _putchar() output More...
 

Macro Definition Documentation

◆ _PRINTF_H_

#define _PRINTF_H_

◆ printf [1/2]

#define printf   printf_

Tiny printf implementation You have to implement putchar if you use printf() To avoid conflicts with the regular printf() API it is overridden by macro defines and internal underscore-appended functions like printf() are used.

Parameters
formatA string that specifies the format of the output
Returns
The number of characters that are written into the array, not counting the terminating null character

◆ printf [2/2]

#define printf   printf_

◆ snprintf [1/2]

#define snprintf   snprintf_

◆ snprintf [2/2]

#define snprintf   snprintf_

Tiny snprintf/vsnprintf implementation.

Parameters
bufferA pointer to the buffer where to store the formatted string
countThe maximum number of characters to store in the buffer, including a terminating null character
formatA string that specifies the format of the output
vaA value identifying a variable arguments list
Returns
The number of characters that COULD have been written into the buffer, not counting the terminating null character. A value equal or larger than count indicates truncation. Only when the returned value is non-negative and less than count, the string has been completely written.

◆ sprintf [1/2]

#define sprintf   sprintf_

◆ sprintf [2/2]

#define sprintf   sprintf_

Tiny sprintf implementation Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD!

Parameters
bufferA pointer to the buffer where to store the formatted string. MUST be big enough to store the output!
formatA string that specifies the format of the output
Returns
The number of characters that are WRITTEN into the buffer, not counting the terminating null character

◆ vprintf [1/2]

#define vprintf   vprintf_

Tiny vprintf implementation.

Parameters
formatA string that specifies the format of the output
vaA value identifying a variable arguments list
Returns
The number of characters that are WRITTEN into the buffer, not counting the terminating null character

◆ vprintf [2/2]

#define vprintf   vprintf_

◆ vsnprintf [1/2]

#define vsnprintf   vsnprintf_

◆ vsnprintf [2/2]

#define vsnprintf   vsnprintf_

Function Documentation

◆ _putchar()

void _putchar ( char  character)

Output a character to a custom device like UART, used by the printf() function This function is declared here only.

You have to write your custom implementation somewhere

Parameters
characterCharacter to output

◆ fctprintf()

int fctprintf ( void(*)(char character, void *arg)  out,
void *  arg,
const char *  format,
  ... 
)

printf with output function You may use this as dynamic alternative to printf() with its fixed _putchar() output

Parameters
outAn output function which takes one character and an argument pointer
argAn argument pointer for user data passed to output function
formatA string that specifies the format of the output
Returns
The number of characters that are sent to the output function, not counting the terminating null character

References _out_fct(), _vsnprintf(), va_end, and va_start.

Referenced by embvm::LoggerBase< TLock >::log().

Here is the caller graph for this function:

◆ printf_()

int printf_ ( const char *  format,
  ... 
)

◆ snprintf_()

int snprintf_ ( char *  buffer,
size_t  count,
const char *  format,
  ... 
)

◆ sprintf_()

int sprintf_ ( char *  buffer,
const char *  format,
  ... 
)

◆ vprintf_()

int vprintf_ ( const char *  format,
va_list  va 
)

References _out_char(), and _vsnprintf().

◆ vsnprintf_()

int vsnprintf_ ( char *  buffer,
size_t  count,
const char *  format,
va_list  va 
)

References _out_buffer(), and _vsnprintf().