src/bft/bft_printf.h File Reference

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Functions
bft_printf.h File Reference
`#include "cs_defs.h"`
`#include <stdarg.h>`
Include dependency graph for bft_printf.h:

Go to the source code of this file.

## Typedefs
typedef int( | bft_printf_proxy_t )(const char *const format, va_list arg_ptr)
| Function pointer for printf() type functions. More...
typedef int( | bft_printf_flush_proxy_t )(void)
| Function pointer for fflush(stdout) type functions. More...

## Functions
int | bft_printf (const char *const format,...)
| Replacement for printf() with modifiable behavior. More...
int | bft_printf_flush (void)
| Flush for output of bft_printf() with modifiable behavior. More...
bft_printf_proxy_t * | bft_printf_proxy_get (void)
| Returns function associated with the bft_printf() function. More...
void | bft_printf_proxy_set (bft_printf_proxy_t *const fct)
| Associates a vprintf() type function with the bft_printf() function. More...
bft_printf_flush_proxy_t * | bft_printf_flush_proxy_get (void)
| Returns function associated with bft_printf_flush(). More...
void | bft_printf_flush_proxy_set (bft_printf_flush_proxy_t *const fct)
| Associates a proxy function with bft_printf_flush(). More...

## Typedef Documentation

bft_printf_flush_proxy_t

Function pointer for fflush(stdout) type functions.

bft_printf_proxy_t

Function pointer for printf() type functions.

Parameters

  [in] | format | format string, as printf() and family.
  [in,out] | arg_ptr | pointer to variable argument list based on format string.

## Function Documentation

int bft_printf | ( | const char *const | format,
|  |  | ...
| ) |  |

Replacement for printf() with modifiable behavior.

This function calls vprintf() by default, or a function with similar arguments indicated by bft_printf_proxy_set().

Parameters

  [in] | format | format string, as printf() and family.
  [in] | ... | variable arguments based on format string.

Returns
  number of characters printed, not counting the trailing '\0' used to end output strings

int bft_printf_flush | ( | void |  | ) |

Flush for output of bft_printf() with modifiable behavior.

This function calls fflush(stdout) if bft_printf()'s default behavior is used. If bft_printf's behavior is modified with bft_printf_proxy_set(), bft_printf_flush()'s behavior may have to be also adjusted with bft_printf_flush_proxy_set().

Returns
  using the default behavior, the return value is that of fflush(stdout): O upon successful completion, EOF otherwise (with errno set to indicate the error).

bft_printf_flush_proxy_t* bft_printf_flush_proxy_get | ( | void |  | ) |

Returns function associated with bft_printf_flush().

Returns
  pointer to the bft_printf_flush() proxy.

void bft_printf_flush_proxy_set | ( | bft_printf_flush_proxy_t *const | fct | ) |

Associates a proxy function with bft_printf_flush().

Warning
  bft_printf() is called by the default bft_error() error handler (so as to ensure that the error text appears at the end of the program output), so a bft_print_flush replacement must not itself call (directly or indirectly) bft_error() if the default error handler is used.

Parameters

  [in] | fct | pointer to a function similar to {return fflush(stdout)}.

bft_printf_proxy_t* bft_printf_proxy_get | ( | void |  | ) |

Returns function associated with the bft_printf() function.

Returns
  pointer to the vprintf() or replacement function.

void bft_printf_proxy_set | ( | bft_printf_proxy_t *const | fct | ) |

Associates a vprintf() type function with the bft_printf() function.

Parameters

  [in] | fct | pointer to a vprintf() type function.