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