1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef _API_RT_DBG_H_
- #define _API_RT_DBG_H_
- #ifdef __cplusplus
- extern "C" {
- #endif // __cplusplus
- #define API_RT_ASSERT_NONE 0
- #define API_RT_ASSERT_MIN 1
- #define API_RT_ASSERT_FULL 2
- #define API_RT_USE_ASSERT API_RT_ASSERT_MIN
- #if API_RT_USE_ASSERT == API_RT_ASSERT_FULL
- #define ASSERT_EQ(X, Y) \
- do \
- { \
- if (((X) != (Y))) \
- { \
- assert_fail(__FILE__, __LINE__); \
- while (1) \
- ; \
- } \
- } while (0)
- #define ASSERT_LESS(X, Y) \
- do \
- { \
- if (((X) >= (Y))) \
- { \
- assert_fail(__FILE__, __LINE__); \
- while (1) \
- ; \
- } \
- } while (0)
- #elif API_RT_USE_ASSERT == API_RT_ASSERT_MIN
- #define ASSERT_EQ(X, Y) \
- do \
- { \
- if (((X) != (Y))) \
- { \
- while (1) \
- ; \
- } \
- } while (0)
- #define ASSERT_LESS(X, Y) \
- do \
- { \
- if (((X) >= (Y))) \
- { \
- while (1) \
- ; \
- } \
- } while (0)
- #elif API_RT_USE_ASSERT == API_RT_ASSERT_NONE
- #define ASSERT_EQ(X, Y)
- #define ASSERT_LESS(X, Y)
- #endif
- typedef struct
- {
- int FailCount;
- char *LastFileName;
- int LastLineNo;
- } AssertFailRecord;
- extern AssertFailRecord AssertRecord;
- void assert_fail(char *fileName, int lineNo);
- #ifdef __cplusplus
- }
- #endif // __cplusplus
- #endif
|