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