sane-frontends  1.0.14
About: SANE (Scanner Access Now Easy) is a universal scanner interface - SANE (graphical) applications/frontends.
  Fossies Dox: sane-frontends-1.0.14.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

sanei_debug.h File Reference
#include <sane/sanei.h>
#include <stdarg.h>
Include dependency graph for sanei_debug.h:
This graph shows which files directly or indirectly include this file:

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)
 
#define DBG_LEVEL
 
#define DBG_INIT()
 
#define DBG
 
#define IF_DBG(x)
 

Functions

static void PASTE (PASTE(sanei_debug_, BACKEND_NAME), _call)(int level
 
static void const char va_start (ap, msg)
 
 sanei_debug_msg (level, PASTE(sanei_debug_, BACKEND_NAME), STRINGIFY(BACKEND_NAME), msg, ap)
 
 va_end (ap)
 

Variables

static void const char * msg
 

Internal macros and functions

Do not use in your own code.

#define DBG_LOCAL
 
void sanei_debug_msg (int level, int max_level, const char *be, const char *fmt, va_list ap)
 
void sanei_init_debug (const char *backend, int *debug_level_var)
 

Detailed Description

Support for printing debug messages.

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

Definition in file sanei_debug.h.

Macro Definition Documentation

◆ 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

Definition at line 167 of file sanei_debug.h.

◆ DBG_INIT

#define DBG_INIT ( )

Initialize sanei_debug.

Call this function before you use any DBG function.

Definition at line 118 of file sanei_debug.h.

◆ DBG_LEVEL

#define DBG_LEVEL

Current debug level.

You can only read this "variable".

Definition at line 107 of file sanei_debug.h.

◆ DBG_LOCAL

#define DBG_LOCAL

Do not use in backends directly.

Internal wrapper for printing function.

Definition at line 122 of file sanei_debug.h.

◆ ENTRY

#define ENTRY (   name)

Expands to sane_BACKEND_NAME_name.

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

Definition at line 93 of file sanei_debug.h.

◆ 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

Definition at line 172 of file sanei_debug.h.

Function Documentation

◆ PASTE()

static void PASTE ( PASTE(sanei_debug_, BACKEND_NAME ,
_call   
)
static

◆ sanei_debug_msg() [1/2]

void sanei_debug_msg ( int  level,
int  max_level,
const char *  be,
const char *  fmt,
va_list  ap 
)

Do not use in backends directly.

Actual printing function.

Definition at line 97 of file sanei_init_debug.c.

References isfdtype(), malloc(), msg, NULL, and vsyslog().

◆ sanei_debug_msg() [2/2]

sanei_debug_msg ( level  ,
PASTE(sanei_debug_, BACKEND_NAME ,
STRINGIFY(BACKEND_NAME ,
msg  ,
ap   
)

◆ sanei_init_debug()

void sanei_init_debug ( const char *  backend,
int *  debug_level_var 
)

Do not use in backends directly.

Actual init function.

Definition at line 69 of file sanei_init_debug.c.

References buf, DBG, and getenv().

◆ va_end()

va_end ( ap  )

◆ va_start()

static void const char va_start ( ap  ,
msg   
)

Variable Documentation

◆ msg

void const char* msg

Definition at line 153 of file sanei_debug.h.

Referenced by panel_build(), and sanei_debug_msg().