2 * $Id: debug.c 558 2007-06-15 19:17:02Z elliotth $
4 * Copyright (c) 1996-2002, Darren Hiebert
6 * This source code is released for free distribution under the terms of the
7 * GNU General Public License.
9 * This module contains debugging functions.
15 #include "general.h" /* must always come first */
25 * FUNCTION DEFINITIONS
30 extern void lineBreak (void) {} /* provides a line-specified break point */
32 extern void debugPrintf (
33 const enum eDebugLevels level
, const char *const format
, ... )
37 va_start (ap
, format
);
44 extern void debugPutc (const int level
, const int c
)
46 if (debug (level
) && c
!= EOF
)
48 if (c
== STRING_SYMBOL
) printf ("\"string\"");
49 else if (c
== CHAR_SYMBOL
) printf ("'c'");
56 extern void debugParseNest (const boolean increase
, const unsigned int level
)
58 debugPrintf (DEBUG_PARSE
, "<*%snesting:%d*>", increase
? "++" : "--", level
);
61 extern void debugCppNest (const boolean begin
, const unsigned int level
)
63 debugPrintf (DEBUG_CPP
, "<*cpp:%s level %d*>", begin
? "begin":"end", level
);
66 extern void debugCppIgnore (const boolean ignore
)
68 debugPrintf (DEBUG_CPP
, "<*cpp:%s ignore*>", ignore
? "begin":"end");
71 extern void debugEntry (const tagEntryInfo
*const tag
)
73 const char *const scope
= tag
->isFileScope
? "{fs}" : "";
75 if (debug (DEBUG_PARSE
))
77 printf ("<#%s%s:%s", scope
, tag
->kindName
, tag
->name
);
79 if (tag
->extensionFields
.scope
[0] != NULL
&&
80 tag
->extensionFields
.scope
[1] != NULL
)
81 printf (" [%s:%s]", tag
->extensionFields
.scope
[0],
82 tag
->extensionFields
.scope
[1]);
84 if (Option
.extensionFields
.inheritance
&&
85 tag
->extensionFields
.inheritance
!= NULL
)
86 printf (" [inherits:%s]", tag
->extensionFields
.inheritance
);
88 if (Option
.extensionFields
.fileScope
&&
89 tag
->isFileScope
&& ! isHeaderFile ())
92 if (Option
.extensionFields
.access
&&
93 tag
->extensionFields
.access
!= NULL
)
94 printf (" [access:%s]", tag
->extensionFields
.access
);
96 if (Option
.extensionFields
.implementation
&&
97 tag
->extensionFields
.implementation
!= NULL
)
98 printf (" [imp:%s]", tag
->extensionFields
.implementation
);
100 if (Option
.extensionFields
.typeRef
&&
101 tag
->extensionFields
.typeRef
[0] != NULL
&&
102 tag
->extensionFields
.typeRef
[1] != NULL
)
103 printf (" [%s:%s]", tag
->extensionFields
.typeRef
[0],
104 tag
->extensionFields
.typeRef
[1]);
113 /* vi:set tabstop=4 shiftwidth=4: */