SANEI  1.0.27-151-gc6bfe88c-dirty
sanei_debug.h File Reference

Support for printing debug messages. More...

Go to the source code of this file.

Macros

Public macros

These macros can be used in backends and other SANE-related code.

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 backends consisting of more than one .c file.
  • 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.
#define ENTRY(name)
 Expands to sane_BACKEND_NAME_name. More...
 
#define DBG_LEVEL
 Current debug level. More...
 
#define DBG_INIT()
 Initialize sanei_debug. More...
 
#define DBG
 Print a message at debug level `level' or higher using a printf-like function. More...
 
#define IF_DBG(x)
 Compile code only if debugging is enabled. More...
 

Detailed Description

Support for printing debug messages.

Use the functions of this header file to print debug or warning messages.

Macro Definition Documentation

◆ ENTRY

#define ENTRY (   name)

Expands to sane_BACKEND_NAME_name.

Example: ENTRY(init) in mustek.c will expand to sane_mustek_init.

◆ DBG_LEVEL

#define DBG_LEVEL

Current debug level.

You can only read this "variable".

◆ DBG_INIT

#define DBG_INIT ( )

Initialize sanei_debug.

Call this function before you use any DBG function.

◆ DBG

#define DBG

Print a message at debug level `level' or higher using a printf-like function.

Example: DBG(1, "sane_open: opening fd \%d\\n", fd).

Parameters
leveldebug level
fmtformat (see man 3 printf for details)
...additional arguments

◆ IF_DBG

#define IF_DBG (   x)

Compile code only if debugging is enabled.

Expands to x if debug support is enabled at compile-time. If NDEBUG is defined at compile-time this macro expands to nothing.

Parameters
xcode to expand when debugging is enabled