kopia lustrzana https://gitlab.com/sane-project/backends
Merge devel (v1.0.3) into head branch.
rodzic
5db918d2d2
commit
5420a147d5
|
@ -1,6 +1,9 @@
|
|||
#ifndef _SANEI_DEBUG_H
|
||||
#define _SANEI_DEBUG_H
|
||||
|
||||
#include <sane/sanei.h>
|
||||
|
||||
#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
|
||||
#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
|
||||
|
||||
/* The cpp that comes with GNU C 2.5 seems to have troubles understanding
|
||||
vararg macros. */
|
||||
|
@ -8,46 +11,46 @@
|
|||
# define HAVE_VARARG_MACROS
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VARARG_MACROS
|
||||
extern void sanei_debug (int level, const char *msg, ...);
|
||||
#endif
|
||||
extern void sanei_debug (int level, const char *msg, ...);
|
||||
|
||||
#ifdef NDEBUG
|
||||
# define DBG_INIT(backend, var)
|
||||
# define DBG_LEVEL (0)
|
||||
# define DBG_INIT()
|
||||
# ifdef HAVE_VARARG_MACROS
|
||||
# define DBG(level, msg, args...)
|
||||
# else
|
||||
# define DBG if (0) sanei_debug
|
||||
# define DBG if (0) sanei_debug
|
||||
# endif
|
||||
# define IF_DBG(x)
|
||||
#else
|
||||
# include <stdio.h>
|
||||
|
||||
#define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME)
|
||||
#define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME)
|
||||
|
||||
#if defined(BACKEND_NAME) && !defined(STUBS)
|
||||
int PASTE(sanei_debug_,BACKEND_NAME);
|
||||
int DBG_LEVEL;
|
||||
#endif
|
||||
|
||||
# define DBG_INIT() \
|
||||
sanei_init_debug (STRINGIFY(BACKEND_NAME), \
|
||||
&PASTE(sanei_debug_,BACKEND_NAME))
|
||||
# define DBG_INIT() \
|
||||
sanei_init_debug (STRINGIFY(BACKEND_NAME), &DBG_LEVEL)
|
||||
|
||||
/* 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); \
|
||||
fflush(stderr); \
|
||||
} \
|
||||
extern void sanei_debug_max (int level, int max_level, const char *msg, ...);
|
||||
|
||||
# define DBG(level, msg, args...) \
|
||||
do { \
|
||||
sanei_debug_max ( level, DBG_LEVEL, \
|
||||
"[" 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
|
||||
# define DBG sanei_debug
|
||||
#endif /* HAVE_VARARG_MACROS */
|
||||
|
||||
# define IF_DBG(x) x
|
||||
#endif
|
||||
# define IF_DBG(x) x
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#endif /* _SANEI_DEBUG_H */
|
||||
|
|
Ładowanie…
Reference in New Issue