log-e-audioc/daisy/scope/audioc.hpp

41 lines
825 B
C++

#ifndef _AUDIOC_HPP
#define _AUDIOC_HPP
#define AUDIOC_DEBUG
#ifdef AUDIOC_DEBUG
#define AUDIOC_PRECOND(cond) \
do { \
if (! (cond)) { \
AUDIOC_LOG("AC_PRECOND(" #cond ") @ %s: line %u failed\n", \
__FILE__, __LINE__); \
} \
} while (0)
#define AUDIOC_POSTCOND(cond) \
do { \
if (! (cond)) { \
AUDIOC_LOG("AC_POSTCOND(" #cond ") @ %s: line %u failed\n", \
__FILE__, __LINE__); \
} \
} while (0)
#define AUDIOC_ASSERT(cond) \
do { \
if (! (cond)) { \
AUDIOC_LOG("AC_ASSERT(" #cond ") @ %s: line %u failed\n", \
__FILE__, __LINE__); \
} \
} while (0)
#else
#define AUDIOC_ASSERT(cond)
#endif /* ifdef AUDIOC_DEBUG */
#define AC_ASSERT AUDIOC_ASSERT
#define AC_PRECOND AUDIOC_PRECOND
#define AC_POSTCOND AUDIOC_POSTCOND
#define AC_LOG AUDIOC_LOG
#endif /* ifndef _AUDIOC_HPP */