/*
 * @file hv_vos_Printf.h
 * @brief Header file of I2C driver.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use ()
 *
 * @endverbatim
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-03-01
 */


#ifndef _VOS_PRINTF_H
#define _VOS_PRINTF_H

#include "hv_vos_Types.h"

VOS_EXTERN_C_BEGIN

#ifdef __GNUC__
#define _VOS_SPECIFY_PRINTF_FMT(fmt_idx,arg1_idx) __attribute__((format (printf, fmt_idx, arg1_idx)))
#else
#define _VOS_SPECIFY_PRINTF_FMT(fmt_idx,arg1_idx)
#endif

int Hv_Vos_vsnprintf(char *str, size_t size, const char *fmt, va_list ap);

int Hv_Vos_snprintf(char *str, size_t size, const char *fmt, ...) _VOS_SPECIFY_PRINTF_FMT(3, 4);

int Hv_Vos_vsprintf(char *str, const char *fmt, va_list ap);

int Hv_Vos_sprintf(char *str, const char *fmt, ...) _VOS_SPECIFY_PRINTF_FMT(2, 3);

void Hv_Vos_printf(const char *fmt, ...) _VOS_SPECIFY_PRINTF_FMT(1, 2);

#ifdef HV_CONFIG_NO_PRINTF
#define HV_VSNPRINTF(...)
#define HV_SNPRINTF(...)
INLINE int HV_VSPRINTF(char *str, const char *format, va_list ap)
{
    return 0;
}
#define HV_SPRINTF(str, format, ...)  (1)
#define HV_PRINTF(...)
#else
#define HV_VSNPRINTF Hv_Vos_vsnprintf
#define HV_SNPRINTF Hv_Vos_snprintf
#define HV_VSPRINTF Hv_Vos_vsprintf
#define HV_SPRINTF Hv_Vos_sprintf
#define HV_PRINTF Hv_Vos_printf
#define HV_PUTCHAR Hv_Vos_STDIO_PutChar
#define HV_FFLUSH Hv_Vos_STDIO_FFlush
#endif

VOS_EXTERN_C_END

#endif
