cMicroOrp  1.0.0
C code for microcontrollers - provides ORP remote interface
debug.h
Go to the documentation of this file.
1 /*
2 Copyright <2020> <J Thompson>
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7 */
8 
9 #ifndef DEBUG_H
10 #define DEBUG_H
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 
17 /* Control whether debugging macros are active at compile time */
18 #undef DB_ACTIVE
19 #ifdef DEBUG
20 #define DB_ACTIVE 1
21 #else
22 #define DB_ACTIVE 0
23 #endif /* DEBUG */
24 
25 void db_print(const char *fmt, ...);
26 
27 /*
28 ** Usage: TRACE((level, fmt, ...))
29 ** "level" is the debugging level which must be operational for the output
30 ** to appear. "fmt" is a printf format string. "..." is whatever extra
31 ** arguments fmt requires (possibly nothing).
32 ** The non-debug macro means that the code is validated but never called.
33 ** -- See chapter 8 of 'The Practice of Programming', by Kernighan and Pike.
34 */
35 
36 
37 #define TRACE(x) \
38  do { if (DB_ACTIVE) db_print x; } while (0)
39 
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* DEBUG_H */
db_print
void db_print(const char *fmt,...)
Definition: debug.c:20