| 1 |
/* |
| 2 |
* $Id: debug.h 558 2007-06-15 19:17:02Z elliotth $ |
| 3 |
* |
| 4 |
* Copyright (c) 1998-2002, Darren Hiebert |
| 5 |
* |
| 6 |
* This source code is released for free distribution under the terms of the |
| 7 |
* GNU General Public License. |
| 8 |
* |
| 9 |
* External interface to debug.c |
| 10 |
*/ |
| 11 |
#ifndef _DEBUG_H |
| 12 |
#define _DEBUG_H |
| 13 |
|
| 14 |
/* |
| 15 |
* Include files |
| 16 |
*/ |
| 17 |
#include "general.h" /* must always come first */ |
| 18 |
|
| 19 |
#ifdef DEBUG |
| 20 |
# include <assert.h> |
| 21 |
#endif |
| 22 |
#include "entry.h" |
| 23 |
|
| 24 |
/* |
| 25 |
* Macros |
| 26 |
*/ |
| 27 |
|
| 28 |
#ifdef DEBUG |
| 29 |
# define debug(level) ((Option.debugLevel & (long)(level)) != 0) |
| 30 |
# define DebugStatement(x) x |
| 31 |
# define PrintStatus(x) if (debug(DEBUG_STATUS)) printf x; |
| 32 |
# define Assert(c) assert(c) |
| 33 |
#else |
| 34 |
# define DebugStatement(x) |
| 35 |
# define PrintStatus(x) |
| 36 |
# define Assert(c) |
| 37 |
# ifndef NDEBUG |
| 38 |
# define NDEBUG |
| 39 |
# endif |
| 40 |
#endif |
| 41 |
|
| 42 |
/* |
| 43 |
* Data declarations |
| 44 |
*/ |
| 45 |
|
| 46 |
/* Defines the debugging levels. |
| 47 |
*/ |
| 48 |
enum eDebugLevels { |
| 49 |
DEBUG_READ = 0x01, /* echo raw (filtered) characters */ |
| 50 |
DEBUG_PARSE = 0x02, /* echo parsing results */ |
| 51 |
DEBUG_STATUS = 0x04, /* echo file status information */ |
| 52 |
DEBUG_OPTION = 0x08, /* echo option parsing */ |
| 53 |
DEBUG_CPP = 0x10, /* echo characters out of pre-processor */ |
| 54 |
DEBUG_RAW = 0x20 /* echo raw (filtered) characters */ |
| 55 |
}; |
| 56 |
|
| 57 |
/* |
| 58 |
* Function prototypes |
| 59 |
*/ |
| 60 |
extern void lineBreak (void); |
| 61 |
extern void debugPrintf (const enum eDebugLevels level, const char *const format, ...) __printf__ (2, 3); |
| 62 |
extern void debugPutc (const int level, const int c); |
| 63 |
extern void debugParseNest (const boolean increase, const unsigned int level); |
| 64 |
extern void debugCppNest (const boolean begin, const unsigned int level); |
| 65 |
extern void debugCppIgnore (const boolean ignore); |
| 66 |
extern void debugEntry (const tagEntryInfo *const tag); |
| 67 |
|
| 68 |
#endif /* _DEBUG_H */ |
| 69 |
|
| 70 |
/* vi:set tabstop=4 shiftwidth=4: */ |