| 1 |
/* |
| 2 |
* debug.h - Brute Force debugging utilities |
| 3 |
* Copyright (C) 1993 Petri Heinila |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 |
* |
| 19 |
* Author can be connected by email from hevi@lut.fi |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef _debug_h |
| 23 |
#define _debug_h |
| 24 |
|
| 25 |
#include <stdio.h> |
| 26 |
|
| 27 |
#ifdef DEBUG |
| 28 |
#undef DEBUG |
| 29 |
#endif |
| 30 |
|
| 31 |
#if defined(DEBUG) || defined(DebugBruteForce) |
| 32 |
#define debug(fmt) \ |
| 33 |
{(void)fprintf(stdout,fmt);(void)fflush(stdout);} |
| 34 |
|
| 35 |
#define debug0(fmt) \ |
| 36 |
{(void)fprintf(stdout,fmt);(void)fflush(stdout);} |
| 37 |
|
| 38 |
#define debug1(fmt,p1)\ |
| 39 |
{(void)fprintf(stdout,fmt,p1);(void)fflush(stdout);} |
| 40 |
|
| 41 |
#define debug2(fmt,p1,p2)\ |
| 42 |
{(void)fprintf(stdout,fmt,p1,p2);(void)fflush(stdout);} |
| 43 |
|
| 44 |
#define debug3(fmt,p1,p2,p3)\ |
| 45 |
{(void)fprintf(stdout,fmt,p1,p2,p3);(void)fflush(stdout);} |
| 46 |
|
| 47 |
#define debug4(fmt,p1,p2,p3,p4)\ |
| 48 |
{(void)fprintf(stdout,fmt,p1,p2,p3,p4);(void)fflush(stdout);} |
| 49 |
|
| 50 |
#define debug5(fmt,p1,p2,p3,p4,p5)\ |
| 51 |
{(void)fprintf(stdout,fmt,p1,p2,p3,p4,p5);(void)fflush(stdout);} |
| 52 |
|
| 53 |
#if defined(CrossFire) || defined(CrossEdit) |
| 54 |
#endif /* CrossFire || CrossEdit */ |
| 55 |
|
| 56 |
#define aborting() \ |
| 57 |
{(void)fprintf(stdout,"Aborting ...\n");fflush(stdout);(void)abort();} |
| 58 |
|
| 59 |
#else |
| 60 |
|
| 61 |
#define debug(fmt) |
| 62 |
#define debug0(fmt) |
| 63 |
#define debug1(fmt,p1) |
| 64 |
#define debug2(fmt,p1,p2) |
| 65 |
#define debug3(fmt,p1,p2,p3) |
| 66 |
#define debug4(fmt,p1,p2,p3,p4) |
| 67 |
#define debug5(fmt,p1,p2,p3,p4,p5) |
| 68 |
#define aborting() |
| 69 |
|
| 70 |
#endif /* DEBUG */ |
| 71 |
|
| 72 |
#endif /* _debug_h */ |
| 73 |
|
| 74 |
|