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 clearString (char *const string
, const int length
)
74 for (i
= 0 ; i
< length
; ++i
)
78 extern void debugEntry (const tagEntryInfo
*const tag
)
80 const char *const scope
= tag
->isFileScope
? "{fs}" : "";
82 if (debug (DEBUG_PARSE
))
84 printf ("<#%s%s:%s", scope
, tag
->kindName
, tag
->name
);
86 if (tag
->extensionFields
.scope
[0] != NULL
&&
87 tag
->extensionFields
.scope
[1] != NULL
)
88 printf (" [%s:%s]", tag
->extensionFields
.scope
[0],
89 tag
->extensionFields
.scope
[1]);
91 if (Option
.extensionFields
.inheritance
&&
92 tag
->extensionFields
.inheritance
!= NULL
)
93 printf (" [inherits:%s]", tag
->extensionFields
.inheritance
);
95 if (Option
.extensionFields
.fileScope
&&
96 tag
->isFileScope
&& ! isHeaderFile ())
99 if (Option
.extensionFields
.access
&&
100 tag
->extensionFields
.access
!= NULL
)
101 printf (" [access:%s]", tag
->extensionFields
.access
);
103 if (Option
.extensionFields
.implementation
&&
104 tag
->extensionFields
.implementation
!= NULL
)
105 printf (" [imp:%s]", tag
->extensionFields
.implementation
);
107 if (Option
.extensionFields
.typeRef
&&
108 tag
->extensionFields
.typeRef
[0] != NULL
&&
109 tag
->extensionFields
.typeRef
[1] != NULL
)
110 printf (" [%s:%s]", tag
->extensionFields
.typeRef
[0],
111 tag
->extensionFields
.typeRef
[1]);
120 /* vi:set tabstop=4 shiftwidth=4: */