/* * assert.h * sec 4.2 ansi draft */ /* Allow this file to be included multiple times with different settings of NDEBUG. */ #undef assert #undef assertval #ifndef _COMPILER_H #include #endif #ifdef __cplusplus extern "C" { #endif __EXTERN void __eprintf __PROTO((const char *expression, const long line, const char *filename)); __EXTERN __EXITING abort __PROTO((void)); #ifdef __cplusplus } #endif #ifdef NDEBUG #define assert(cond) #define assertval(cond) #else #if __STDC__ #define assert(cond) \ if(!(cond)) \ { __eprintf(#cond,(long)(__LINE__), __FILE__); abort(); } #define assertval(cond) \ ((cond) ? 1 : \ ( __eprintf(#cond,(long)(__LINE__), __FILE__), abort(), 0 )) #else #ifndef __SOZOBON__ /* There's a bug in Sozobon 2.0 whereby __LINE__ & __FILE__ are defined but * testing #ifndef __?I?E__ comes out as if they aren't. */ #ifndef __LINE__ #define __LINE__ 0 #endif #ifndef __FILE__ #define __FILE__ "unknown" #endif #endif /* __SOZOBON__ */ #define assert(cond) \ if(!(cond)) \ { __eprintf("cond", (long)(__LINE__), __FILE__); abort(); } #define assertval(cond) \ ((cond) ? 1: \ ( __eprintf("cond", (long)(__LINE__), __FILE__), abort(), 0)) #endif /* __STDC__ */ #endif /* NDEBUG */