diff options
Diffstat (limited to 'usr.bin/ctags/C.c')
-rw-r--r-- | usr.bin/ctags/C.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/usr.bin/ctags/C.c b/usr.bin/ctags/C.c index 25c5db5d405b..725336d33e01 100644 --- a/usr.bin/ctags/C.c +++ b/usr.bin/ctags/C.c @@ -43,10 +43,10 @@ static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94"; #include "ctags.h" -static int func_entry(void); +static bool func_entry(void); static void hash_entry(void); static void skip_string(int); -static int str_entry(int); +static bool str_entry(int); /* * c_entries -- @@ -58,13 +58,13 @@ c_entries(void) int c; /* current character */ int level; /* brace level */ int token; /* if reading a token */ - int t_def; /* if reading a typedef */ + bool t_def; /* if reading a typedef */ int t_level; /* typedef's brace level */ char *sp; /* buffer pointer */ char tok[MAXTOKEN]; /* token buffer */ lineftell = ftell(inf); - sp = tok; token = t_def = NO; t_level = -1; level = 0; lineno = 1; + sp = tok; token = t_def = false; t_level = -1; level = 0; lineno = 1; while (GETC(!=, EOF)) { switch (c) { /* @@ -98,11 +98,11 @@ c_entries(void) */ endtok: if (sp > tok) { *sp = EOS; - token = YES; + token = true; sp = tok; } else - token = NO; + token = false; continue; /* @@ -180,7 +180,7 @@ c_entries(void) */ case ';': if (t_def && level == t_level) { - t_def = NO; + t_def = false; get_line(); if (sp != tok) *sp = EOS; @@ -213,7 +213,7 @@ c_entries(void) /* no typedefs inside typedefs */ if (!t_def && !memcmp(tok, "typedef",8)) { - t_def = YES; + t_def = true; t_level = level; break; } @@ -239,15 +239,15 @@ c_entries(void) if (sp == tok + sizeof tok - 1) /* Too long -- truncate it */ *sp = EOS; - else + else *sp++ = c; - token = YES; + token = true; } continue; } sp = tok; - token = NO; + token = false; } } @@ -255,7 +255,7 @@ c_entries(void) * func_entry -- * handle a function reference */ -static int +static bool func_entry(void) { int c; /* current character */ @@ -293,7 +293,7 @@ func_entry(void) SETLINE; } } - return (NO); + return (false); fnd: /* * we assume that the character after a function's right paren @@ -305,7 +305,7 @@ fnd: if (c == '\n') SETLINE; if (c == EOF) - return NO; + return false; /* * Recognize the gnu __attribute__ extension, which would * otherwise make the heuristic test DTWT @@ -317,7 +317,7 @@ fnd: } } else { if (intoken(c)) { - if (anext - maybe_attribute + if (anext - maybe_attribute < (ptrdiff_t)(sizeof attribute - 1)) *anext++ = c; else break; @@ -326,7 +326,7 @@ fnd: *anext++ = '\0'; if (strcmp(maybe_attribute, attribute) == 0) { (void)ungetc(c, inf); - return NO; + return false; } break; } @@ -337,12 +337,12 @@ fnd: skip_comment(c); else { /* don't ever "read" '/' */ (void)ungetc(c, inf); - return (NO); + return (false); } } if (c != '{') (void)skip_key('{'); - return (YES); + return (true); } /* @@ -371,7 +371,7 @@ hash_entry(void) if (sp == tok + sizeof tok - 1) /* Too long -- truncate it */ *sp = EOS; - else + else *sp++ = c; } *sp = EOS; @@ -387,7 +387,7 @@ hash_entry(void) if (sp == tok + sizeof tok - 1) /* Too long -- truncate it */ *sp = EOS; - else + else *sp++ = c; if (GETC(==, EOF)) return; @@ -415,7 +415,7 @@ skip: if (c == '\n') { /* get rid of rest of define */ * str_entry -- * handle a struct, union or enum entry */ -static int +static bool str_entry(int c) /* c is current character */ { int curline; /* line started on */ @@ -425,17 +425,17 @@ str_entry(int c) /* c is current character */ curline = lineno; while (iswhite(c)) if (GETC(==, EOF)) - return (NO); + return (false); if (c == '{') /* it was "struct {" */ - return (YES); + return (true); for (sp = tok;;) { /* get next token */ if (sp == tok + sizeof tok - 1) /* Too long -- truncate it */ *sp = EOS; - else + else *sp++ = c; if (GETC(==, EOF)) - return (NO); + return (false); if (!intoken(c)) break; } @@ -452,12 +452,12 @@ str_entry(int c) /* c is current character */ break; if (c != '{') { (void)ungetc(c, inf); - return (NO); + return (false); } } *sp = EOS; pfnote(tok, curline); - return (YES); + return (true); } /* @@ -474,7 +474,7 @@ skip_comment(int t) /* t is comment character */ switch(c) { /* comments don't nest, nor can they be escaped. */ case '*': - star = YES; + star = true; break; case '/': if (star && t == '*') @@ -486,7 +486,7 @@ skip_comment(int t) /* t is comment character */ return; /*FALLTHROUGH*/ default: - star = NO; + star = false; break; } } @@ -501,7 +501,7 @@ skip_string(int key) int c, skip; - for (skip = NO; GETC(!=, EOF); ) + for (skip = false; GETC(!=, EOF); ) switch (c) { case '\\': /* a backslash escapes anything */ skip = !skip; /* we toggle in case it's "\\" */ @@ -512,7 +512,7 @@ skip_string(int key) default: if (c == key && !skip) return; - skip = NO; + skip = false; } } @@ -520,21 +520,21 @@ skip_string(int key) * skip_key -- * skip to next char "key" */ -int +bool skip_key(int key) { - int c, - skip, - retval; + int c; + bool skip; + bool retval; - for (skip = retval = NO; GETC(!=, EOF);) + for (skip = retval = false; GETC(!=, EOF);) switch(c) { case '\\': /* a backslash escapes anything */ skip = !skip; /* we toggle in case it's "\\" */ break; case ';': /* special case for yacc; if one */ case '|': /* of these chars occurs, we may */ - retval = YES; /* have moved out of the rule */ + retval = true; /* have moved out of the rule */ break; /* not used by C */ case '\'': case '"': @@ -557,7 +557,7 @@ skip_key(int key) norm: if (c == key && !skip) return (retval); - skip = NO; + skip = false; } return (retval); } |