1 /* $NetBSD: debug.h,v 1.1.1.1 2015/07/08 15:37:48 christos Exp $ */ 2 3 /***************************************************************** 4 ** 5 ** @(#) debug.h -- macros for debug messages 6 ** 7 ** compile with cc -DDBG to activate 8 ** 9 ** Copyright (c) Jan 2005, Holger Zuleger HZnet. All rights reserved. 10 ** 11 ** This software is open source. 12 ** 13 ** Redistribution and use in source and binary forms, with or without 14 ** modification, are permitted provided that the following conditions 15 ** are met: 16 ** 17 ** Redistributions of source code must retain the above copyright notice, 18 ** this list of conditions and the following disclaimer. 19 ** 20 ** Redistributions in binary form must reproduce the above copyright notice, 21 ** this list of conditions and the following disclaimer in the documentation 22 ** and/or other materials provided with the distribution. 23 ** 24 ** Neither the name of Holger Zuleger HZnet nor the names of its contributors may 25 ** be used to endorse or promote products derived from this software without 26 ** specific prior written permission. 27 ** 28 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 ** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 31 ** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 32 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 ** POSSIBILITY OF SUCH DAMAGE. 39 ** 40 *****************************************************************/ 41 #ifndef DEBUG_H 42 # define DEBUG_H 43 44 # ifdef DBG 45 # define dbg_line() fprintf (stderr, "DBG: %s(%d) reached\n", __FILE__, __LINE__) 46 # define dbg_msg(msg) fprintf (stderr, "DBG: %s(%d) %s\n", __FILE__, __LINE__, msg) 47 # define dbg_val0(text) fprintf (stderr, "DBG: %s(%d) %s", __FILE__, __LINE__, text) 48 # define dbg_val1(fmt, var) dbg_val (fmt, var) 49 # define dbg_val(fmt, var) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, var) 50 # define dbg_val2(fmt, v1, v2) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2) 51 # define dbg_val3(fmt, v1, v2, v3) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3) 52 # define dbg_val4(fmt, v1, v2, v3, v4) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3, v4) 53 # define dbg_val5(fmt, v1, v2, v3, v4, v5) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3, v4, v5) 54 # define dbg_val6(fmt, v1, v2, v3, v4, v5, v6) fprintf (stderr, "DBG: %s(%d) " fmt, __FILE__, __LINE__, v1, v2, v3, v4, v5, v6) 55 # else 56 # define dbg_line() 57 # define dbg_msg(msg) 58 # define dbg_val0(text) 59 # define dbg_val1(fmt, var) 60 # define dbg_val(fmt, str) 61 # define dbg_val2(fmt, v1, v2) 62 # define dbg_val3(fmt, v1, v2, v3) 63 # define dbg_val4(fmt, v1, v2, v3, v4) 64 # define dbg_val5(fmt, v1, v2, v3, v4, v5) 65 # define dbg_val6(fmt, v1, v2, v3, v4, v5, v6) 66 # endif 67 68 #endif 69