summaryrefslogtreecommitdiff
path: root/include/sane/sanei_debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sane/sanei_debug.h')
-rw-r--r--include/sane/sanei_debug.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/include/sane/sanei_debug.h b/include/sane/sanei_debug.h
index 557f8a7..465d3e2 100644
--- a/include/sane/sanei_debug.h
+++ b/include/sane/sanei_debug.h
@@ -9,6 +9,10 @@
#include <sane/sanei.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** @name Public macros
* These macros can be used in backends and other SANE-related
* code.
@@ -16,14 +20,14 @@
* Before including sanei_debug.h, the following macros must be set:
*
* - BACKEND_NAME - The name of your backend without double-quotes (must be set in any case)
- * - STUBS - If this is defined, no macros will be included. Used in
+ * - STUBS - If this is defined, no macros will be included. Used in
* backends consisting of more than one .c file.
- * - DEBUG_DECLARE_ONLY - Generates prototypes instead of functions. Used in
+ * - DEBUG_DECLARE_ONLY - Generates prototypes instead of functions. Used in
* backends consisting of more than one .c file.
* - DEBUG_NOT_STATIC - Doesn't generate static functions. Used in header files if
* they are include in more than one .c file.
*
- * @{
+ * @{
*/
/** @def DBG_INIT()
@@ -44,7 +48,7 @@
/** @def IF_DBG(x)
* Compile code only if debugging is enabled.
*
- * Expands to x if debug support is enabled at compile-time. If NDEBUG is
+ * Expands to x if debug support is enabled at compile-time. If NDEBUG is
* defined at compile-time this macro expands to nothing.
*
* @param x code to expand when debugging is enabled
@@ -52,7 +56,7 @@
/**
* @def DBG_LEVEL
- * Current debug level.
+ * Current debug level.
*
* You can only read this "variable".
*/
@@ -70,16 +74,16 @@
#define ENTRY(name) PASTE(PASTE(PASTE(sane_,BACKEND_NAME),_),name)
#ifdef NDEBUG
-
+
extern void sanei_debug_ndebug (int level, const char *msg, ...);
-
+
# define DBG_LEVEL (0)
# define DBG_INIT()
# define DBG sanei_debug_ndebug
# define IF_DBG(x)
-
+
#else /* !NDEBUG */
-
+
/** @hideinitializer*/
# define DBG_LEVEL PASTE(sanei_debug_,BACKEND_NAME)
@@ -103,7 +107,7 @@ int DBG_LEVEL = 0;
# ifdef DEBUG_DECLARE_ONLY
-extern void DBG_LOCAL (int level, const char *msg, ...)
+extern void DBG_LOCAL (int level, const char *msg, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
#endif
@@ -112,8 +116,8 @@ __attribute__ ((format (printf, 2, 3)))
# else /* !DEBUG_DECLARE_ONLY */
# include <stdarg.h>
-
-extern void sanei_debug_msg
+
+extern void sanei_debug_msg
(int level, int max_level, const char *be, const char *fmt, va_list ap);
#ifdef __GNUC__
@@ -144,10 +148,14 @@ DBG_LOCAL (int level, const char *msg, ...)
# define DBG DBG_LOCAL
extern void sanei_init_debug (const char * backend, int * debug_level_var);
-
+
/** @hideinitializer*/
# define IF_DBG(x) x
#endif /* NDEBUG */
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif /* _SANEI_DEBUG_H */