1 /** @file plustek-pp_dbg.c
2  *  @brief definition of some debug macros
3  *
4  * Copyright (C) 2000-2004 Gerhard Jaeger <gerhard@gjaeger.de>
5  *
6  * This file is part of the SANE package.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  *
21  * As a special exception, the authors of SANE give permission for
22  * additional uses of the libraries contained in this release of SANE.
23  *
24  * The exception is that, if you link a SANE library with other files
25  * to produce an executable, this does not by itself cause the
26  * resulting executable to be covered by the GNU General Public
27  * License.  Your use of that executable is in no way restricted on
28  * account of linking the SANE library code into it.
29  *
30  * This exception does not, however, invalidate any other reasons why
31  * the executable file might be covered by the GNU General Public
32  * License.
33  *
34  * If you submit changes to SANE to the maintainers to be included in
35  * a subsequent release, you agree by submitting the changes that
36  * those changes may be distributed with this exception intact.
37  *
38  * If you write modifications of your own for SANE, it is your choice
39  * whether to permit this exception to apply to your modifications.
40  * If you do not wish that, delete this exception notice.
41  * <hr>
42  */
43 #ifndef __DEBUG_H__
44 #define __DEBUG_H__
45 
46 /* uncomment this to have an SW-simulatet 98001 device - don't expect to scan*/
47 /* #define _ASIC_98001_SIM */
48 
49 /*
50  * some debug definitions
51  */
52 #ifdef DEBUG
53 #  include <assert.h>
54 #  define _ASSERT(x) assert(x)
55 
56 # ifndef DBG
57 #  define DBG(level, msg, args...)		if ((dbg_level) & (level)) {	\
58 											_PRINT(msg, ##args);		\
59 										}
60 # endif
61 #else
62 # define _ASSERT(x)
63 # ifndef DBG
64 #  define DBG(level, msg, args...)
65 # endif
66 #endif
67 
68 /* different debug level */
69 #define DBG_LOW         0x01
70 #define DBG_MEDIUM      0x02
71 #define DBG_HIGH        0x04
72 #define DBG_HELPERS     0x08
73 #define DBG_TIMEOUT     0x10
74 #define DBG_SCAN        0x20
75 #define DBG_IO          0x40
76 #define DBG_IOF         0x80
77 #define DBG_ALL         0xFF
78 
79 /*
80  * standard debug level
81  */
82 #ifdef DEBUG
83 static int dbg_level=(DBG_ALL & ~(DBG_IO | DBG_IOF));
84 #endif
85 
86 #endif /* guard __DEBUG_H__ */
87 
88 /* END PLUSTEK-PP_DBG.H .....................................................*/
89