lua: fix reload with -Xlua_script
[metze/wireshark/wip.git] / epan / conversation_debug.h
1 /* conversation_debug.h
2  * A file of debug printing stuff for conversation-related things,
3  * although really anything can use this so long as it includes this
4  * header file and defines DEBUG_CONVERSATION in conversation.c
5  *
6  * define DEBUG_CONVERSATION before including this file to turn on printing
7  * and also define it in conversation.c (because it has the indent variable)
8  *
9  * By Hadriel Kaplan <hadrielk at yahoo dot com>
10  * Copyright 2014 Hadriel Kaplan
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  */
26
27 #ifndef _CONVERSATION_DEBUG_H
28 #define _CONVERSATION_DEBUG_H
29
30 #ifdef DEBUG_CONVERSATION
31
32 #include <stdio.h>
33 #include "to_str.h"
34
35 extern int _debug_conversation_indent; /* the instance is in conversation.c */
36
37 #define DINDENT() _debug_conversation_indent += 4
38 #define DENDENT() _debug_conversation_indent -= 4
39
40 #define DPRINT(arg) \
41           g_printerr("%*.*s%s: ", \
42                      _debug_conversation_indent,_debug_conversation_indent," ", \
43                      G_STRLOC); \
44           g_printerr arg; \
45           g_printerr("\n")
46
47 #define DPRINT2(arg) \
48           g_printerr("%*.*s", \
49                      _debug_conversation_indent,_debug_conversation_indent," "); \
50           g_printerr arg; \
51           g_printerr("\n")
52
53 #else /* !DEBUG_CONVERSATION */
54
55 /* a hack to let these defines be used with trailing semi-colon and not
56  * cause gcc extra-check pedantic warnings for extra colons
57  */
58 #define DINDENT() (void)0
59 #define DENDENT() (void)0
60 #define DPRINT(arg) (void)0
61 #define DPRINT2(arg) (void)0
62
63 #endif /* DEBUG_CONVERSATION */
64
65 #endif /* _CONVERSATION_DEBUG_H */