fix wrongly interpreted >> in template
[arduino-ctags.git] / debug.c
blob6d44ad5c62f04701445913b3ebc60789c8b88039
1 /*
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.
13 * INCLUDE FILES
15 #include "general.h" /* must always come first */
17 #include <ctype.h>
18 #include <stdarg.h>
20 #include "debug.h"
21 #include "options.h"
22 #include "read.h"
25 * FUNCTION DEFINITIONS
28 #ifdef DEBUG
30 extern void lineBreak (void) {} /* provides a line-specified break point */
32 extern void debugPrintf (
33 const enum eDebugLevels level, const char *const format, ... )
35 va_list ap;
37 va_start (ap, format);
38 if (debug (level))
39 vprintf (format, ap);
40 fflush (stdout);
41 va_end (ap);
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'");
50 else putchar (c);
52 fflush (stdout);
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 ())
90 printf (" [file:]");
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]);
106 printf ("#>");
107 fflush (stdout);
111 #endif
113 /* vi:set tabstop=4 shiftwidth=4: */