1999-08-09 18:05:43 +00:00
|
|
|
#include <sane/sanei.h>
|
|
|
|
|
1999-08-09 18:06:01 +00:00
|
|
|
#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
|
1994-02-15 21:37:33 +00:00
|
|
|
|
1999-08-09 18:06:01 +00:00
|
|
|
/* The cpp that comes with GNU C 2.5 seems to have troubles understanding
|
|
|
|
vararg macros. */
|
|
|
|
#if __GNUC__ - 0 > 2 || (__GNUC__ - 0 == 2 && __GNUC_MINOR__ > 5)
|
|
|
|
# define HAVE_VARARG_MACROS
|
|
|
|
#endif
|
1999-08-09 18:05:43 +00:00
|
|
|
|
1999-08-09 18:06:01 +00:00
|
|
|
#ifndef HAVE_VARARG_MACROS
|
|
|
|
extern void sanei_debug (int level, const char *msg, ...);
|
|
|
|
#endif
|
1999-08-09 18:05:43 +00:00
|
|
|
|
|
|
|
#ifdef NDEBUG
|
1999-08-09 18:06:01 +00:00
|
|
|
# define DBG_INIT(backend, var)
|
|
|
|
# ifdef HAVE_VARARG_MACROS
|
|
|
|
# define DBG(level, msg, args...)
|
|
|
|
# else
|
|
|
|
# define DBG if (0) sanei_debug
|
|
|
|
# endif
|
|
|
|
# define IF_DBG(x)
|
|
|
|
#else
|
|
|
|
# include <stdio.h>
|
|
|
|
|
|
|
|
#define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME)
|
|
|
|
|
|
|
|
#if defined(BACKEND_NAME) && !defined(STUBS)
|
|
|
|
int PASTE(sanei_debug_,BACKEND_NAME);
|
2002-02-14 19:39:56 +00:00
|
|
|
#endif
|
2000-10-23 14:59:58 +00:00
|
|
|
|
1999-08-09 18:06:01 +00:00
|
|
|
# define DBG_INIT() \
|
|
|
|
sanei_init_debug (STRINGIFY(BACKEND_NAME), \
|
|
|
|
&PASTE(sanei_debug_,BACKEND_NAME))
|
|
|
|
|
|
|
|
/* The cpp that comes with GNU C 2.5 seems to have troubles understanding
|
|
|
|
vararg macros. */
|
|
|
|
#ifdef HAVE_VARARG_MACROS
|
|
|
|
# define DBG(level, msg, args...) \
|
|
|
|
do { \
|
|
|
|
if (DBG_LEVEL >= (level)) \
|
|
|
|
fprintf (stderr, "[" STRINGIFY(BACKEND_NAME) "] " msg, ##args); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
extern void sanei_init_debug (const char * backend, int * debug_level_var);
|
|
|
|
#else
|
|
|
|
# define DBG sanei_debug
|
|
|
|
#endif
|
2000-08-12 15:11:00 +00:00
|
|
|
|
1999-08-09 18:06:01 +00:00
|
|
|
# define IF_DBG(x) x
|
|
|
|
#endif
|