sanei_debug.h

Go to the documentation of this file.
00001 
00007 #ifndef _SANEI_DEBUG_H
00008 #define _SANEI_DEBUG_H
00009 
00010 #include <sane/sanei.h>
00011 
00066 /* @} */
00067 
00068 
00070 #define ENTRY(name)     PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
00071 
00072 #ifdef NDEBUG
00073   
00074 extern void sanei_debug_ndebug (int level, const char *msg, ...);
00075         
00076 # define DBG_LEVEL      (0)
00077 # define DBG_INIT()
00078 # define DBG            sanei_debug_ndebug
00079 # define IF_DBG(x)
00080         
00081 #else /* !NDEBUG */
00082         
00084 # define DBG_LEVEL      PASTE(sanei_debug_,BACKEND_NAME)
00085 
00086 # if defined(BACKEND_NAME) && !defined(STUBS)
00087 #  ifdef DEBUG_DECLARE_ONLY
00088 extern int DBG_LEVEL;
00089 #  else /* !DEBUG_DECLARE_ONLY */
00090 int DBG_LEVEL = 0;
00091 #  endif /* DEBUG_DECLARE_ONLY */
00092 # endif /* BACKEND_NAME && !STUBS */
00093 
00095 # define DBG_INIT()                                     \
00096   sanei_init_debug (STRINGIFY(BACKEND_NAME), &DBG_LEVEL)
00097 
00099 # define DBG_LOCAL      PASTE(DBG_LEVEL,_call)
00100 
00101 
00102 # ifndef STUBS
00103 
00104 #  ifdef DEBUG_DECLARE_ONLY
00105 
00106 extern void DBG_LOCAL (int level, const char *msg, ...) 
00107 #ifdef __GNUC__
00108 __attribute__ ((format (printf, 2, 3)))
00109 #endif
00110 ;
00111 
00112 #  else /* !DEBUG_DECLARE_ONLY */
00113 
00114 #   include <stdarg.h>
00115         
00116 extern void sanei_debug_msg 
00117   (int level, int max_level, const char *be, const char *fmt, va_list ap);
00118 
00119 #ifdef __GNUC__
00120 #   ifndef DEBUG_NOT_STATIC
00121 static
00122 #   endif /* !DEBUG_NOT_STATIC */
00123 void DBG_LOCAL (int level, const char *msg, ...) __attribute__ ((format (printf, 2, 3)));
00124 #endif /* __GNUC__ */
00125 
00126 #   ifndef DEBUG_NOT_STATIC
00127 static
00128 #   endif /* !DEBUG_NOT_STATIC */
00129 void
00130 DBG_LOCAL (int level, const char *msg, ...)
00131 {
00132   va_list ap;
00133 
00134   va_start (ap, msg);
00135   sanei_debug_msg (level, DBG_LEVEL, STRINGIFY(BACKEND_NAME), msg, ap);
00136   va_end (ap);
00137 }
00138 
00139 #  endif /* DEBUG_DECLARE_ONLY */
00140 
00141 # endif /* !STUBS */
00142 
00144 # define DBG            DBG_LOCAL
00145 
00146 extern void sanei_init_debug (const char * backend, int * debug_level_var);
00147   
00149 # define IF_DBG(x)      x
00150 
00151 #endif /* NDEBUG */
00152 
00153 #endif /* _SANEI_DEBUG_H */

Generated on Sat Jul 26 05:45:27 2008 for SANEI by  doxygen 1.5.1