Program Listing for File printf_internal.h

Return to documentation for file (rcsw/stdio/printf_internal.h)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "rcsw/common/common.h"

#include "rcsw/stdio/printf_config.h"
#include "rcsw/stdio/printf_gadget.h"
#if (RCSW_CONFIG_STDIO_PRINTF_WITH_DEC || RCSW_CONFIG_STDIO_PRINTF_WITH_EXP)
#include "rcsw/stdio/printf_float.h"
#endif

/*******************************************************************************
 * Macros
 ******************************************************************************/
/* \cond INTERNAL */
/*
 * Note in particular the behavior here on LONG_MIN or LLONG_MIN; it is valid
 * and well-defined, but if you're not careful you can easily trigger undefined
 * behavior with -LONG_MIN or -LLONG_MIN/
 */
#define ABS_FOR_PRINTING(_x) \
  ((printf_unsigned_value_t) ( (_x) > 0 ? (_x) : -((printf_signed_value_t)_x) ))


/*******************************************************************************
 * RCSW Private Functions
 ******************************************************************************/
BEGIN_C_DECLS

RCSW_LOCAL void out_reversed(struct printf_output_gadget* output,
                  const char* buf, printf_size_t len,
                  printf_size_t width,
                  printf_flags_t flags);

RCSW_LOCAL void print_integer(struct printf_output_gadget* output,
                   printf_unsigned_value_t value,
                   bool_t negative,
                   numeric_base_t base,
                   printf_size_t precision,
                   printf_size_t width,
                   printf_flags_t flags);

RCSW_LOCAL void print_integer_finalization(struct printf_output_gadget* output,
                                char* buf,
                                printf_size_t len,
                                bool_t negative,
                                numeric_base_t base,
                                printf_size_t precision,
                                printf_size_t width,
                                printf_flags_t flags);

/* \endcond */

END_C_DECLS