acd1c34850472d24d7d3ca70915eca5752ea165c
[gnushogi.git] / gnushogi / debug.h
1 /*
2  * FILE: debug.h
3  *
4  *       Various macros to help in debugging.
5  *
6  * ----------------------------------------------------------------------
7  * Copyright (c) 1993, 1994, 1995 Matthias Mutz
8  * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
9  *
10  * GNU SHOGI is based on GNU CHESS
11  *
12  * Copyright (c) 1988, 1989, 1990 John Stanback
13  * Copyright (c) 1992 Free Software Foundation
14  *
15  * This file is part of GNU SHOGI.
16  *
17  * GNU Shogi is free software; you can redistribute it and/or modify it
18  * under the terms of the GNU General Public License as published by the
19  * Free Software Foundation; either version 3 of the License,
20  * or (at your option) any later version.
21  *
22  * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
23  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25  * for more details.
26  *
27  * You should have received a copy of the GNU General Public License along
28  * with GNU Shogi; see the file COPYING. If not, see
29  * <http://www.gnu.org/licenses/>.
30  * ----------------------------------------------------------------------
31  *
32  */
33
34 /* Some of this code requires gcc. */
35
36
37 #ifndef _DEBUG_H_
38 #define _DEBUG_H_
39
40 /*
41  * Define simple macros PRINT_ENTER and PRINT_EXIT to print info when
42  * a function is entered or left.  They only work if DEBUG is #defined.
43  * This requires gcc.  You have to invoke them with a semicolon after them,
44  * like this:
45  *
46  * PRINT_ENTER;
47  * PRINT_EXIT;
48  *
49  * This is so as not to screw up automatic indentation in emacs.
50  */
51
52 #if (defined __GNUC__)
53
54 #  define PRINT_ENTER printf("Entering function:  %s().\n", __FUNCTION__)
55 #  define PRINT_EXIT  printf("Exiting function:   %s().\n", __FUNCTION__)
56
57 #else
58
59 #  define PRINT_ENTER
60 #  define PRINT_EXIT
61
62 #endif  /* __GNUC__ */
63
64 /* Function inlining; not all C compilers support this. */
65 #if (!defined __GNUC__)
66 #  define inline
67 #endif
68
69 #endif  /* _DEBUG_H_ */
70