1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#ifndef __sq_debug_h
#define __sq_debug_h
#ifndef DEBUG
# define DEBUG 0
#endif
#if (DEBUG)
/* the thing to use here is a variadic macro, but Apple's gcc barfs on
** them when running in precomp mode. did they _really_ have to break
** the preprocessor just to implement precomp? good _grief_.
*/
extern void __sq_debugf(const char *fmt, ...);
# define debugf(ARGS) __sq_debugf ARGS
#else
# define debugf(ARGS) ((void)0)
#endif
#undef assert
#if (DEBUG)
extern void __sq_assert(char *file, int line, char *func, char *expr);
# define assert(E) \
((void)((E) ? 0 : __sq_assert(__FILE__, __LINE__, __FUNCTION__, #E)))
#else
# define assert(E) ((void)0)
#endif
extern char *__sq_errfile;
extern int __sq_errline;
extern char *__sq_errfunc;
extern void __sq_eprintf(const char *fmt, ...);
# define eprintf \
( __sq_errfile= __FILE__, \
__sq_errline= __LINE__, \
__sq_errfunc= __FUNCTION__, \
__sq_eprintf )
extern void sqDebugAnchor(void);
#endif /* __sq_debug_h */
|