ocarina/include/core/print.h

46 lines
859 B
C
Raw Normal View History

/**
* @file
* Copyright (c) 2013 Anna Schumaker.
*/
#ifndef OCARINA_CORE_PRINT_H
#define OCARINA_CORE_PRINT_H
#include <cstdio>
#include <cstdarg>
/**
* Print a message to the console
*
* @param fmt Printf-style text format.
* @param ... Var-args to be printed.
*/
inline void print(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}
#if defined(CONFIG_DEBUG) || defined(CONFIG_TEST)
inline void dprint(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}
#else /* ! (CONFIG_DEBUG || CONFIG_TEST) */
/**
* Print a message to the console (only if debugging is enabled).
*
* @param fmt Printf-style text format.
* @param ... Var-args to be printed.
*/
inline void dprint(const char *fmt, ...) {}
#endif /* CONFIG_DEBUG */
#endif /* OCARINA_CORE_PRINT_H */