X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/830e46e61ba1316e771c72a15e709d3d12e150b7..c16fbf67a040d3a1440cec001ba0de33f25559a4:/lib-src/etags.c diff --git a/lib-src/etags.c b/lib-src/etags.c index ec96f45fc9..66e7fbb467 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -1,4 +1,4 @@ -/* Tags file maker to go with GNU Emacs -*- coding: latin-1 -*- +/* Tags file maker to go with GNU Emacs -*- coding: utf-8 -*- Copyright (C) 1984 The Regents of the University of California @@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2013 Free Software +Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2014 Free Software Foundation, Inc. This file is not considered part of GNU Emacs. @@ -64,12 +64,12 @@ University of California, as described above. */ * 1985 Emacs TAGS format by Richard Stallman. * 1989 Sam Kendall added C++. * 1992 Joseph B. Wells improved C and C++ parsing. - * 1993 Francesco Potortì reorganized C and C++. + * 1993 Francesco Potortì reorganized C and C++. * 1994 Line-by-line regexp tags by Tom Tromey. - * 2001 Nested classes by Francesco Potortì (concept by Mykola Dzyuba). - * 2002 #line directives by Francesco Potortì. + * 2001 Nested classes by Francesco Potortì (concept by Mykola Dzyuba). + * 2002 #line directives by Francesco Potortì. * - * Francesco Potortì has maintained and improved it since 1993. + * Francesco Potortì has maintained and improved it since 1993. */ /* @@ -80,14 +80,11 @@ University of California, as described above. */ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; -#define TRUE 1 -#define FALSE 0 - #ifdef DEBUG # undef DEBUG -# define DEBUG TRUE +# define DEBUG true #else -# define DEBUG FALSE +# define DEBUG false # define NDEBUG /* disable assert */ #endif @@ -107,12 +104,12 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; #ifdef MSDOS # undef MSDOS -# define MSDOS TRUE +# define MSDOS true # include # include # include #else -# define MSDOS FALSE +# define MSDOS false #endif /* MSDOS */ #ifdef WINDOWSNT @@ -150,9 +147,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; tag tables and tags typedefs, #defines and struct/union/enum by default. */ #ifdef CTAGS # undef CTAGS -# define CTAGS TRUE +# define CTAGS true #else -# define CTAGS FALSE +# define CTAGS false #endif #define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t)) @@ -194,8 +191,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; (char *) (op), (n) * sizeof (Type))) #endif -#define bool int - typedef void Lang_function (FILE *); typedef struct @@ -316,15 +311,7 @@ static void Texinfo_nodes (FILE *); static void Yacc_entries (FILE *); static void just_read_file (FILE *); -static void print_language_names (void); -static void print_version (void); -static void print_help (argument *); -int main (int, char **); - -static compressor *get_compressor_from_suffix (char *, char **); static language *get_language_from_langname (const char *); -static language *get_language_from_interpreter (char *); -static language *get_language_from_filename (char *, bool); static void readline (linebuffer *, FILE *); static long readline_internal (linebuffer *, FILE *); static bool nocase_tail (const char *); @@ -346,7 +333,6 @@ static void find_entries (FILE *); static void free_tree (node *); static void free_fdesc (fdesc *); static void pfnote (char *, bool, char *, int, int, long); -static void make_tag (const char *, int, bool, char *, int, int, long); static void invalidate_nodes (fdesc *, node **); static void put_entries (node *); @@ -410,7 +396,7 @@ static const char *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; static bool append_to_tagfile; /* -a: append to tags */ -/* The next five default to TRUE in C and derived languages. */ +/* The next five default to true in C and derived languages. */ static bool typedefs; /* -t: create tags for C and Ada typedefs */ static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */ /* 0 struct/enum/union decls, and C++ */ @@ -418,18 +404,18 @@ static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */ static bool constantypedefs; /* -d: create tags for C #define, enum */ /* constants and variables. */ /* -D: opposite of -d. Default under ctags. */ -static bool globals; /* create tags for global variables */ -static bool members; /* create tags for C member variables */ -static bool declarations; /* --declarations: tag them and extern in C&Co*/ -static bool no_line_directive; /* ignore #line directives (undocumented) */ -static bool no_duplicates; /* no duplicate tags for ctags (undocumented) */ +static int globals; /* create tags for global variables */ +static int members; /* create tags for C member variables */ +static int declarations; /* --declarations: tag them and extern in C&Co*/ +static int no_line_directive; /* ignore #line directives (undocumented) */ +static int no_duplicates; /* no duplicate tags for ctags (undocumented) */ static bool update; /* -u: update tags */ static bool vgrind_style; /* -v: create vgrind style index output */ static bool no_warnings; /* -w: suppress warnings (undocumented) */ static bool cxref_style; /* -x: create cxref style output */ static bool cplusplus; /* .[hc] means C++, not C (undocumented) */ static bool ignoreindent; /* -I: ignore indentation in C */ -static bool packages_only; /* --packages-only: in Ada, only tag packages*/ +static int packages_only; /* --packages-only: in Ada, only tag packages*/ /* STDIN is defined in LynxOS system headers */ #ifdef STDIN @@ -445,17 +431,17 @@ static bool need_filebuf; /* some regexes are multi-line */ static struct option longopts[] = { { "append", no_argument, NULL, 'a' }, - { "packages-only", no_argument, &packages_only, TRUE }, + { "packages-only", no_argument, &packages_only, 1 }, { "c++", no_argument, NULL, 'C' }, - { "declarations", no_argument, &declarations, TRUE }, - { "no-line-directive", no_argument, &no_line_directive, TRUE }, - { "no-duplicates", no_argument, &no_duplicates, TRUE }, + { "declarations", no_argument, &declarations, 1 }, + { "no-line-directive", no_argument, &no_line_directive, 1 }, + { "no-duplicates", no_argument, &no_duplicates, 1 }, { "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'H' }, { "ignore-indentation", no_argument, NULL, 'I' }, { "language", required_argument, NULL, 'l' }, - { "members", no_argument, &members, TRUE }, - { "no-members", no_argument, &members, FALSE }, + { "members", no_argument, &members, 1 }, + { "no-members", no_argument, &members, 0 }, { "output", required_argument, NULL, 'o' }, { "regex", required_argument, NULL, 'r' }, { "no-regex", no_argument, NULL, 'R' }, @@ -467,7 +453,7 @@ static struct option longopts[] = { "backward-search", no_argument, NULL, 'B' }, { "cxref", no_argument, NULL, 'x' }, { "defines", no_argument, NULL, 'd' }, - { "globals", no_argument, &globals, TRUE }, + { "globals", no_argument, &globals, 1 }, { "typedefs", no_argument, NULL, 't' }, { "typedefs-and-c++", no_argument, NULL, 'T' }, { "update", no_argument, NULL, 'u' }, @@ -476,7 +462,7 @@ static struct option longopts[] = #else /* Etags options */ { "no-defines", no_argument, NULL, 'D' }, - { "no-globals", no_argument, &globals, FALSE }, + { "no-globals", no_argument, &globals, 0 }, { "include", required_argument, NULL, 'i' }, #endif { NULL } @@ -770,7 +756,7 @@ static language lang_names [] = { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, - { "yacc", Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,TRUE}, + { "yacc", Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,true}, { "auto", auto_help }, /* default guessing scheme */ { "none", none_help, just_read_file }, /* regexp matching only */ { NULL } /* end of list */ @@ -816,7 +802,7 @@ etags --help --lang=ada."); #ifndef VERSION # define VERSION "17.38.1.4" #endif -static void +static _Noreturn void print_version (void) { char emacs_copyright[] = COPYRIGHT; @@ -829,13 +815,13 @@ print_version (void) } #ifndef PRINT_UNDOCUMENTED_OPTIONS_HELP -# define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE +# define PRINT_UNDOCUMENTED_OPTIONS_HELP false #endif -static void +static _Noreturn void print_help (argument *argbuffer) { - bool help_for_lang = FALSE; + bool help_for_lang = false; for (; argbuffer->arg_type != at_end; argbuffer++) if (argbuffer->arg_type == at_language) @@ -843,7 +829,7 @@ print_help (argument *argbuffer) if (help_for_lang) puts (""); puts (argbuffer->lang->help); - help_for_lang = TRUE; + help_for_lang = true; } if (help_for_lang) @@ -1014,7 +1000,7 @@ main (int argc, char **argv) argument *argbuffer; int current_arg, file_count; linebuffer filename_lb; - bool help_asked = FALSE; + bool help_asked = false; ptrdiff_t len; char *optstring; int opt; @@ -1039,8 +1025,8 @@ main (int argc, char **argv) * Also default to find macro constants, enum constants, struct * members and global variables. Do it for both etags and ctags. */ - typedefs = typedefs_or_cplusplus = constantypedefs = TRUE; - globals = members = TRUE; + typedefs = typedefs_or_cplusplus = constantypedefs = true; + globals = members = true; /* When the optstring begins with a '-' getopt_long does not rearrange the non-options arguments to be at the end, but leaves them alone. */ @@ -1078,12 +1064,12 @@ main (int argc, char **argv) ++file_count; if (parsing_stdin) fatal ("cannot parse standard input more than once", (char *)NULL); - parsing_stdin = TRUE; + parsing_stdin = true; break; /* Common options. */ - case 'a': append_to_tagfile = TRUE; break; - case 'C': cplusplus = TRUE; break; + case 'a': append_to_tagfile = true; break; + case 'C': cplusplus = true; break; case 'f': /* for compatibility with old makefiles */ case 'o': if (tagfile) @@ -1096,7 +1082,7 @@ main (int argc, char **argv) break; case 'I': case 'S': /* for backward compatibility */ - ignoreindent = TRUE; + ignoreindent = true; break; case 'l': { @@ -1131,22 +1117,22 @@ main (int argc, char **argv) break; case 'h': case 'H': - help_asked = TRUE; + help_asked = true; break; /* Etags options */ - case 'D': constantypedefs = FALSE; break; + case 'D': constantypedefs = false; break; case 'i': included_files[nincluded_files++] = optarg; break; /* Ctags options. */ case 'B': searchar = '?'; break; - case 'd': constantypedefs = TRUE; break; - case 't': typedefs = TRUE; break; - case 'T': typedefs = typedefs_or_cplusplus = TRUE; break; - case 'u': update = TRUE; break; - case 'v': vgrind_style = TRUE; /*FALLTHRU*/ - case 'x': cxref_style = TRUE; break; - case 'w': no_warnings = TRUE; break; + case 'd': constantypedefs = true; break; + case 't': typedefs = true; break; + case 'T': typedefs = typedefs_or_cplusplus = true; break; + case 'u': update = true; break; + case 'v': vgrind_style = true; /*FALLTHRU*/ + case 'x': cxref_style = true; break; + case 'w': no_warnings = true; break; default: suggest_asking_for_help (); /* NOTREACHED */ @@ -1317,7 +1303,7 @@ main (int argc, char **argv) fatal ("failed to execute shell command", (char *)NULL); } free (cmd); - append_to_tagfile = TRUE; + append_to_tagfile = true; } tagf = fopen (tagfile, append_to_tagfile ? "a" : "w"); @@ -1614,9 +1600,9 @@ process_file (FILE *fh, char *fn, language *lang) to the directory of the tags file. */ fdp->taggedfname = relative_filename (fn, tagfiledir); } - fdp->usecharno = TRUE; /* use char position when making tags */ + fdp->usecharno = true; /* use char position when making tags */ fdp->prop = NULL; - fdp->written = FALSE; /* not written on tags file yet */ + fdp->written = false; /* not written on tags file yet */ fdhead = fdp; curfdp = fdhead; /* the current file description */ @@ -1662,26 +1648,27 @@ process_file (FILE *fh, char *fn, language *lang) * This routine sets up the boolean pseudo-functions which work * by setting boolean flags dependent upon the corresponding character. * Every char which is NOT in that string is not a white char. Therefore, - * all of the array "_wht" is set to FALSE, and then the elements - * subscripted by the chars in "white" are set to TRUE. Thus "_wht" - * of a char is TRUE if it is the string "white", else FALSE. + * all of the array "_wht" is set to false, and then the elements + * subscripted by the chars in "white" are set to true. Thus "_wht" + * of a char is true if it is the string "white", else false. */ static void init (void) { - register const char *sp; - register int i; + const char *sp; + int i; for (i = 0; i < CHARS; i++) - iswhite (i) = notinname (i) = begtoken (i) = intoken (i) = endtoken (i) = FALSE; - for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = TRUE; - for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = TRUE; + iswhite (i) = notinname (i) = begtoken (i) = intoken (i) = endtoken (i) + = false; + for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = true; + for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = true; notinname ('\0') = notinname ('\n'); - for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = TRUE; + for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = true; begtoken ('\0') = begtoken ('\n'); - for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = TRUE; + for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = true; intoken ('\0') = intoken ('\n'); - for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = TRUE; + for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = true; endtoken ('\0') = endtoken ('\n'); } @@ -1705,7 +1692,7 @@ find_entries (FILE *inf) /* Else try to guess the language given the file name. */ if (parser == NULL) { - lang = get_language_from_filename (curfdp->infname, TRUE); + lang = get_language_from_filename (curfdp->infname, true); if (lang != NULL && lang->function != NULL) { curfdp->lang = lang; @@ -1752,7 +1739,7 @@ find_entries (FILE *inf) /* Else try to guess the language given the case insensitive file name. */ if (parser == NULL) { - lang = get_language_from_filename (curfdp->infname, FALSE); + lang = get_language_from_filename (curfdp->infname, false); if (lang != NULL && lang->function != NULL) { curfdp->lang = lang; @@ -1850,7 +1837,7 @@ find_entries (FILE *inf) static void make_tag (const char *name, /* tag name, or NULL if unnamed */ int namelen, /* tag length */ - int is_func, /* tag is a function */ + bool is_func, /* tag is a function */ char *linestart, /* start of the line where tag is */ int linelen, /* length of the line where tag is */ int lno, /* line number */ @@ -1878,7 +1865,7 @@ make_tag (const char *name, /* tag name, or NULL if unnamed */ && (cp == linestart || notinname (cp[-1])) /* rule #3 */ && strneq (name, cp, namelen)) /* rule #2 */ - named = FALSE; /* use implicit tag name */ + named = false; /* use implicit tag name */ } } @@ -1890,7 +1877,8 @@ make_tag (const char *name, /* tag name, or NULL if unnamed */ /* Record a tag. */ static void -pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno) +pfnote (char *name, bool is_func, char *linestart, int linelen, int lno, + long int cno) /* tag name, or NULL if unnamed */ /* tag is a function */ /* start of the line where tag is */ @@ -1917,8 +1905,8 @@ pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int } else np->name = name; - np->valid = TRUE; - np->been_warned = FALSE; + np->valid = true; + np->been_warned = false; np->fdp = curfdp; np->is_func = is_func; np->lno = lno; @@ -2052,7 +2040,7 @@ add_node (node *np, node **cur_node_p) (stderr, "Duplicate entry in files %s and %s: %s (Warning only)\n", np->fdp->infname, cur_node->fdp->infname, np->name); - cur_node->been_warned = TRUE; + cur_node->been_warned = true; } return; } @@ -2080,7 +2068,7 @@ invalidate_nodes (fdesc *badfdp, node **npp) if (np->left != NULL) invalidate_nodes (badfdp, &np->left); if (np->fdp == badfdp) - np->valid = FALSE; + np->valid = false; if (np->right != NULL) invalidate_nodes (badfdp, &np->right); } @@ -2163,7 +2151,7 @@ put_entries (register node *np) fdp = np->fdp; fprintf (tagf, "\f\n%s,%d\n", fdp->taggedfname, total_size_of_entries (np)); - fdp->written = TRUE; + fdp->written = true; } fputs (np->regex, tagf); fputc ('\177', tagf); @@ -2249,10 +2237,6 @@ enum sym_type st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef }; -static unsigned int hash (const char *, unsigned int); -static struct C_stab_entry * in_word_set (const char *, unsigned int); -static enum sym_type C_symtype (char *, int, int); - /* Feed stuff between (but not including) %[ and %] lines to: gperf -m 5 %[ @@ -2311,10 +2295,10 @@ and replace lines between %< and %> with its output, then: struct C_stab_entry { const char *name; int c_ext; enum sym_type type; }; /* maximum key range = 33, duplicates = 0 */ -static inline unsigned int -hash (register const char *str, register unsigned int len) +static int +hash (const char *str, int len) { - static unsigned char asso_values[] = + static char const asso_values[] = { 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, @@ -2343,15 +2327,15 @@ hash (register const char *str, register unsigned int len) 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35 }; - register int hval = len; + int hval = len; switch (hval) { default: - hval += asso_values[(unsigned char)str[2]]; + hval += asso_values[(unsigned char) str[2]]; /*FALLTHROUGH*/ case 2: - hval += asso_values[(unsigned char)str[1]]; + hval += asso_values[(unsigned char) str[1]]; break; } return hval; @@ -2409,11 +2393,11 @@ in_word_set (register const char *str, register unsigned int len) if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int key = hash (str, len); + int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) { - register const char *s = wordlist[key].name; + const char *s = wordlist[key].name; if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') return &wordlist[key]; @@ -2638,7 +2622,7 @@ static void make_C_tag (bool); * function or variable, or corresponds to a typedef, or * is a struct/union/enum tag, or #define, or an enum constant. * - * *IS_FUNC gets TRUE if the token is a function or #define macro + * *IS_FUNC_OR_VAR gets true if the token is a function or #define macro * with args. C_EXTP points to which language we are looking at. * * Globals @@ -2650,7 +2634,8 @@ static void make_C_tag (bool); */ static bool -consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var) +consider_token (char *str, int len, int c, int *c_extp, + int bracelev, int parlev, bool *is_func_or_var) /* IN: token pointer */ /* IN: token length */ /* IN: first char after the token */ @@ -2674,8 +2659,8 @@ consider_token (register char *str, register int len, register int c, int *c_ext */ if (toktype == st_C_attribute) { - inattribute = TRUE; - return FALSE; + inattribute = true; + return false; } /* @@ -2688,7 +2673,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext if (toktype == st_C_gnumacro) { fvdef = fdefunkey; - return FALSE; + return false; } break; case dsharpseen: @@ -2700,20 +2685,20 @@ consider_token (register char *str, register int len, register int c, int *c_ext { definedef = dignorerest; } - return FALSE; + return false; case ddefineseen: /* * Make a tag for any macro, unless it is a constant - * and constantypedefs is FALSE. + * and constantypedefs is false. */ definedef = dignorerest; *is_func_or_var = (c == '('); if (!*is_func_or_var && !constantypedefs) - return FALSE; + return false; else - return TRUE; + return true; case dignorerest: - return FALSE; + return false; default: error ("internal error: definedef value."); } @@ -2728,9 +2713,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext { if (typedefs) typdef = tkeyseen; - fvextern = FALSE; + fvextern = false; fvdef = fvnone; - return FALSE; + return false; } break; case tkeyseen: @@ -2747,7 +2732,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext if (structdef == snone && fvdef == fvnone) { fvdef = fvnameseen; - return TRUE; + return true; } break; case tend: @@ -2756,9 +2741,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext case st_C_class: case st_C_struct: case st_C_enum: - return FALSE; + return false; } - return TRUE; + return true; } switch (toktype) @@ -2766,7 +2751,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext case st_C_javastruct: if (structdef == stagseen) structdef = scolonseen; - return FALSE; + return false; case st_C_template: case st_C_class: if ((*c_extp & C_AUTO) /* automatic detection of C++ language */ @@ -2790,13 +2775,13 @@ consider_token (register char *str, register int len, register int c, int *c_ext if (fvdef == fvnameseen) fvdef = fvnone; } - return FALSE; + return false; } if (structdef == skeyseen) { structdef = stagseen; - return TRUE; + return true; } if (typdef != tnone) @@ -2810,27 +2795,27 @@ consider_token (register char *str, register int len, register int c, int *c_ext { case st_C_objprot: objdef = oprotocol; - return FALSE; + return false; case st_C_objimpl: objdef = oimplementation; - return FALSE; + return false; } break; case oimplementation: /* Save the class tag for functions or variables defined inside. */ objtag = savenstr (str, len); objdef = oinbody; - return FALSE; + return false; case oprotocol: /* Save the class tag for categories. */ objtag = savenstr (str, len); objdef = otagseen; - *is_func_or_var = TRUE; - return TRUE; + *is_func_or_var = true; + return true; case oparenseen: objdef = ocatseen; - *is_func_or_var = TRUE; - return TRUE; + *is_func_or_var = true; + return true; case oinbody: break; case omethodsign: @@ -2841,13 +2826,13 @@ consider_token (register char *str, register int len, register int c, int *c_ext linebuffer_setlen (&token_name, len); memcpy (token_name.buffer, str, len); token_name.buffer[len] = '\0'; - return TRUE; + return true; } - return FALSE; + return false; case omethodcolon: if (parlev == 0) objdef = omethodparm; - return FALSE; + return false; case omethodparm: if (parlev == 0) { @@ -2857,9 +2842,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext linebuffer_setlen (&token_name, oldlen + len); memcpy (token_name.buffer + oldlen, str, len); token_name.buffer[oldlen + len] = '\0'; - return TRUE; + return true; } - return FALSE; + return false; case oignore: if (toktype == st_C_objend) { @@ -2871,14 +2856,14 @@ consider_token (register char *str, register int len, register int c, int *c_ext free (objtag); */ objdef = onone; } - return FALSE; + return false; } /* A function, variable or enum constant? */ switch (toktype) { case st_C_extern: - fvextern = TRUE; + fvextern = true; switch (fvdef) { case finlist: @@ -2889,39 +2874,39 @@ consider_token (register char *str, register int len, register int c, int *c_ext default: fvdef = fvnone; } - return FALSE; + return false; case st_C_ignore: - fvextern = FALSE; + fvextern = false; fvdef = vignore; - return FALSE; + return false; case st_C_operator: fvdef = foperator; - *is_func_or_var = TRUE; - return TRUE; + *is_func_or_var = true; + return true; case st_none: if (constantypedefs && structdef == snone && structtype == st_C_enum && bracelev > structbracelev) - return TRUE; /* enum constant */ + return true; /* enum constant */ switch (fvdef) { case fdefunkey: if (bracelev > 0) break; fvdef = fdefunname; /* GNU macro */ - *is_func_or_var = TRUE; - return TRUE; + *is_func_or_var = true; + return true; case fvnone: switch (typdef) { case ttypeseen: - return FALSE; + return false; case tnone: if ((strneq (str, "asm", 3) && endtoken (str[3])) || (strneq (str, "__asm__", 7) && endtoken (str[7]))) { fvdef = vignore; - return FALSE; + return false; } break; } @@ -2932,19 +2917,19 @@ consider_token (register char *str, register int len, register int c, int *c_ext if (*c_extp & C_AUTO) /* automatic detection of C++ */ *c_extp = (*c_extp | C_PLPL) & ~C_AUTO; fvdef = foperator; - *is_func_or_var = TRUE; - return TRUE; + *is_func_or_var = true; + return true; } if (bracelev > 0 && !instruct) break; fvdef = fvnameseen; /* function or variable */ - *is_func_or_var = TRUE; - return TRUE; + *is_func_or_var = true; + return true; } break; } - return FALSE; + return false; } @@ -2976,7 +2961,7 @@ do { \ curlinepos = charno; \ readline (&curlb, inf); \ lp = curlb.buffer; \ - quotednl = FALSE; \ + quotednl = false; \ newndx = curndx; \ } while (0) @@ -2986,16 +2971,16 @@ do { \ if (savetoken.valid) \ { \ token = savetoken; \ - savetoken.valid = FALSE; \ + savetoken.valid = false; \ } \ definedef = dnone; \ } while (0) static void -make_C_tag (int isfun) +make_C_tag (bool isfun) { - /* This function is never called when token.valid is FALSE, but + /* This function is never called when token.valid is false, but we must protect against invalid input or internal errors. */ if (token.valid) make_tag (token_name.buffer, token_name.len, isfun, token.line, @@ -3008,7 +2993,7 @@ make_C_tag (int isfun) error ("INVALID TOKEN"); } - token.valid = FALSE; + token.valid = false; } @@ -3056,11 +3041,11 @@ C_entries (int c_ext, FILE *inf) lp = curlb.buffer; *lp = 0; - fvdef = fvnone; fvextern = FALSE; typdef = tnone; + fvdef = fvnone; fvextern = false; typdef = tnone; structdef = snone; definedef = dnone; objdef = onone; - yacc_rules = FALSE; - midtoken = inquote = inchar = incomm = quotednl = FALSE; - token.valid = savetoken.valid = FALSE; + yacc_rules = false; + midtoken = inquote = inchar = incomm = quotednl = false; + token.valid = savetoken.valid = false; bracelev = bracketlev = parlev = attrparlev = templatelev = 0; if (cjava) { qualifier = "."; qlen = 1; } @@ -3078,7 +3063,7 @@ C_entries (int c_ext, FILE *inf) to read the next line. */ if (*lp == '\0') { - quotednl = TRUE; + quotednl = true; continue; } lp++; @@ -3092,7 +3077,7 @@ C_entries (int c_ext, FILE *inf) if (*lp == '/') { c = *lp++; - incomm = FALSE; + incomm = false; } break; case '\0': @@ -3108,7 +3093,7 @@ C_entries (int c_ext, FILE *inf) switch (c) { case '"': - inquote = FALSE; + inquote = false; break; case '\0': /* Newlines inside strings do not end macro definitions @@ -3128,7 +3113,7 @@ C_entries (int c_ext, FILE *inf) CNL (); /* FALLTHRU */ case '\'': - inchar = FALSE; + inchar = false; break; } continue; @@ -3136,7 +3121,7 @@ C_entries (int c_ext, FILE *inf) else switch (c) { case '"': - inquote = TRUE; + inquote = true; if (bracketlev > 0) continue; if (inattribute) @@ -3150,26 +3135,26 @@ C_entries (int c_ext, FILE *inf) case vignore: break; default: - fvextern = FALSE; + fvextern = false; fvdef = fvnone; } continue; case '\'': - inchar = TRUE; + inchar = true; if (bracketlev > 0) continue; if (inattribute) break; if (fvdef != finlist && fvdef != fignore && fvdef != vignore) { - fvextern = FALSE; + fvextern = false; fvdef = fvnone; } continue; case '/': if (*lp == '*') { - incomm = TRUE; + incomm = true; lp++; c = ' '; if (bracketlev > 0) @@ -3185,9 +3170,9 @@ C_entries (int c_ext, FILE *inf) { /* Entering or exiting rules section in yacc file. */ lp++; - definedef = dnone; fvdef = fvnone; fvextern = FALSE; + definedef = dnone; fvdef = fvnone; fvextern = false; typdef = tnone; structdef = snone; - midtoken = inquote = inchar = incomm = quotednl = FALSE; + midtoken = inquote = inchar = incomm = quotednl = false; bracelev = 0; yacc_rules = !yacc_rules; continue; @@ -3198,7 +3183,7 @@ C_entries (int c_ext, FILE *inf) if (definedef == dnone) { char *cp; - bool cpptoken = TRUE; + bool cpptoken = true; /* Look back on this line. If all blanks, or nonblanks followed by an end of comment, this is a preprocessor @@ -3209,10 +3194,10 @@ C_entries (int c_ext, FILE *inf) if (*cp == '*' && cp[1] == '/') { cp++; - cpptoken = TRUE; + cpptoken = true; } else - cpptoken = FALSE; + cpptoken = false; } if (cpptoken) definedef = dsharpseen; @@ -3261,7 +3246,7 @@ C_entries (int c_ext, FILE *inf) } else { - bool funorvar = FALSE; + bool funorvar = false; if (yacc_rules || consider_token (newlb.buffer + tokoff, toklen, c, @@ -3280,7 +3265,7 @@ C_entries (int c_ext, FILE *inf) c = *lp++; toklen += lp - oldlp; } - token.named = FALSE; + token.named = false; if (!plainc && nestlev > 0 && definedef == dnone) /* in struct body */ @@ -3291,7 +3276,7 @@ C_entries (int c_ext, FILE *inf) linebuffer_setlen (&token_name, len+qlen+toklen); sprintf (token_name.buffer + len, "%s%.*s", qualifier, toklen, newlb.buffer + tokoff); - token.named = TRUE; + token.named = true; } else if (objdef == ocatseen) /* Objective C category */ @@ -3300,13 +3285,13 @@ C_entries (int c_ext, FILE *inf) linebuffer_setlen (&token_name, len); sprintf (token_name.buffer, "%s(%.*s)", objtag, toklen, newlb.buffer + tokoff); - token.named = TRUE; + token.named = true; } else if (objdef == omethodtag || objdef == omethodparm) /* Objective C method */ { - token.named = TRUE; + token.named = true; } else if (fvdef == fdefunname) /* GNU DEFUN and similar macros */ @@ -3354,7 +3339,7 @@ C_entries (int c_ext, FILE *inf) token.length = toklen; token.line = newlb.buffer; token.linepos = newlinepos; - token.valid = TRUE; + token.valid = true; if (definedef == dnone && (fvdef == fvnameseen @@ -3382,7 +3367,7 @@ C_entries (int c_ext, FILE *inf) fvdef = fvnone; } } - midtoken = FALSE; + midtoken = false; } } /* if (endtoken (c)) */ else if (intoken (c)) @@ -3408,7 +3393,7 @@ C_entries (int c_ext, FILE *inf) case flistseen: if (plainc || declarations) { - make_C_tag (TRUE); /* a function */ + make_C_tag (true); /* a function */ fvdef = fignore; } break; @@ -3427,7 +3412,7 @@ C_entries (int c_ext, FILE *inf) { tokoff = lp - 1 - newlb.buffer; toklen = 1; - midtoken = TRUE; + midtoken = true; } continue; } /* if (begtoken) */ @@ -3443,7 +3428,7 @@ C_entries (int c_ext, FILE *inf) break; if (yacc_rules && token.offset == 0 && token.valid) { - make_C_tag (FALSE); /* a yacc function */ + make_C_tag (false); /* a yacc function */ break; } if (definedef != dnone) @@ -3452,7 +3437,7 @@ C_entries (int c_ext, FILE *inf) { case otagseen: objdef = oignore; - make_C_tag (TRUE); /* an Objective C class */ + make_C_tag (true); /* an Objective C class */ break; case omethodtag: case omethodparm: @@ -3469,7 +3454,7 @@ C_entries (int c_ext, FILE *inf) /* Should be useless, but may be work as a safety net. */ if (cplpl && fvdef == flistseen) { - make_C_tag (TRUE); /* a function */ + make_C_tag (true); /* a function */ fvdef = fignore; break; } @@ -3481,7 +3466,7 @@ C_entries (int c_ext, FILE *inf) { case tend: case ttypeseen: - make_C_tag (FALSE); /* a typedef */ + make_C_tag (false); /* a typedef */ typdef = tnone; fvdef = fvnone; break; @@ -3497,10 +3482,10 @@ C_entries (int c_ext, FILE *inf) case fvnameseen: if ((globals && bracelev == 0 && (!fvextern || declarations)) || (members && instruct)) - make_C_tag (FALSE); /* a variable */ - fvextern = FALSE; + make_C_tag (false); /* a variable */ + fvextern = false; fvdef = fvnone; - token.valid = FALSE; + token.valid = false; break; case flistseen: if ((declarations @@ -3508,16 +3493,16 @@ C_entries (int c_ext, FILE *inf) && (typdef == tnone || (typdef != tignore && instruct))) || (members && plainc && instruct)) - make_C_tag (TRUE); /* a function */ + make_C_tag (true); /* a function */ /* FALLTHRU */ default: - fvextern = FALSE; + fvextern = false; fvdef = fvnone; if (declarations && cplpl && structdef == stagseen) - make_C_tag (FALSE); /* forward declaration */ + make_C_tag (false); /* forward declaration */ else - token.valid = FALSE; + token.valid = false; } /* switch (fvdef) */ /* FALLTHRU */ default: @@ -3534,7 +3519,7 @@ C_entries (int c_ext, FILE *inf) { case omethodtag: case omethodparm: - make_C_tag (TRUE); /* an Objective C method */ + make_C_tag (true); /* an Objective C method */ objdef = oinbody; break; } @@ -3557,18 +3542,18 @@ C_entries (int c_ext, FILE *inf) && templatelev == 0 && (!fvextern || declarations)) || (members && instruct))) - make_C_tag (FALSE); /* a variable */ + make_C_tag (false); /* a variable */ break; case flistseen: if ((declarations && typdef == tnone && !instruct) || (members && typdef != tignore && instruct)) { - make_C_tag (TRUE); /* a function */ + make_C_tag (true); /* a function */ fvdef = fvnameseen; } else if (!declarations) fvdef = fvnone; - token.valid = FALSE; + token.valid = false; break; default: fvdef = fvnone; @@ -3586,7 +3571,7 @@ C_entries (int c_ext, FILE *inf) case ttypeseen: case tend: typdef = tignore; - make_C_tag (FALSE); /* a typedef */ + make_C_tag (false); /* a typedef */ break; case tnone: case tinbody: @@ -3601,7 +3586,7 @@ C_entries (int c_ext, FILE *inf) if ((members && bracelev == 1) || (globals && bracelev == 0 && (!fvextern || declarations))) - make_C_tag (FALSE); /* a variable */ + make_C_tag (false); /* a variable */ /* FALLTHRU */ default: fvdef = fvnone; @@ -3628,7 +3613,7 @@ C_entries (int c_ext, FILE *inf) { /* This handles constructs like: typedef void OperatorFun (int fun); */ - make_C_tag (FALSE); + make_C_tag (false); typdef = tignore; fvdef = fignore; break; @@ -3647,14 +3632,14 @@ C_entries (int c_ext, FILE *inf) if (inattribute) { if (--attrparlev == 0) - inattribute = FALSE; + inattribute = false; break; } if (definedef != dnone) break; if (objdef == ocatseen && parlev == 1) { - make_C_tag (TRUE); /* an Objective C category */ + make_C_tag (true); /* an Objective C category */ objdef = oignore; } if (--parlev == 0) @@ -3671,7 +3656,7 @@ C_entries (int c_ext, FILE *inf) || typdef == ttypeseen)) { typdef = tignore; - make_C_tag (FALSE); /* a typedef */ + make_C_tag (false); /* a typedef */ } } else if (parlev < 0) /* can happen due to ill-conceived #if's. */ @@ -3690,7 +3675,7 @@ C_entries (int c_ext, FILE *inf) switch (fvdef) { case flistseen: - make_C_tag (TRUE); /* a function */ + make_C_tag (true); /* a function */ /* FALLTHRU */ case fignore: fvdef = fvnone; @@ -3699,12 +3684,12 @@ C_entries (int c_ext, FILE *inf) switch (objdef) { case otagseen: - make_C_tag (TRUE); /* an Objective C class */ + make_C_tag (true); /* an Objective C class */ objdef = oignore; break; case omethodtag: case omethodparm: - make_C_tag (TRUE); /* an Objective C method */ + make_C_tag (true); /* an Objective C method */ objdef = oinbody; break; default: @@ -3725,7 +3710,7 @@ C_entries (int c_ext, FILE *inf) case scolonseen: /* a class */ pushclass_above (bracelev,token.line+token.offset, token.length); structdef = snone; - make_C_tag (FALSE); /* a struct or enum */ + make_C_tag (false); /* a struct or enum */ break; } bracelev += 1; @@ -3736,7 +3721,7 @@ C_entries (int c_ext, FILE *inf) if (fvdef == fstartlist) { fvdef = fvnone; /* avoid tagging `foo' in `foo (*bar()) ()' */ - token.valid = FALSE; + token.valid = false; } break; case '}': @@ -3746,13 +3731,13 @@ C_entries (int c_ext, FILE *inf) if (!ignoreindent && lp == newlb.buffer + 1) { if (bracelev != 0) - token.valid = FALSE; /* unexpected value, token unreliable */ + token.valid = false; /* unexpected value, token unreliable */ bracelev = 0; /* reset brace level if first column */ parlev = 0; /* also reset paren level, just in case... */ } else if (bracelev < 0) { - token.valid = FALSE; /* something gone amiss, token unreliable */ + token.valid = false; /* something gone amiss, token unreliable */ bracelev = 0; } if (bracelev == 0 && fvdef == vignore) @@ -3779,7 +3764,7 @@ C_entries (int c_ext, FILE *inf) case fvnameseen: if ((members && bracelev == 1) || (globals && bracelev == 0 && (!fvextern || declarations))) - make_C_tag (FALSE); /* a variable */ + make_C_tag (false); /* a variable */ /* FALLTHRU */ default: fvdef = vignore; @@ -3828,7 +3813,7 @@ C_entries (int c_ext, FILE *inf) case '\0': if (objdef == otagseen) { - make_C_tag (TRUE); /* an Objective C class */ + make_C_tag (true); /* an Objective C class */ objdef = oignore; } /* If a macro spans multiple lines don't reset its state. */ @@ -3898,18 +3883,18 @@ Yacc_entries (FILE *inf) && /* instructions at start of loop */ \ (readline (&line_buffer, file_pointer), \ char_pointer = line_buffer.buffer, \ - TRUE); \ + true); \ ) #define LOOKING_AT(cp, kw) /* kw is the keyword, a literal string */ \ - ((assert ("" kw), TRUE) /* syntax error if not a literal string */ \ + ((assert ("" kw), true) /* syntax error if not a literal string */ \ && strneq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \ && notinname ((cp)[sizeof (kw)-1]) /* end of kw */ \ && ((cp) = skip_spaces ((cp)+sizeof (kw)-1))) /* skip spaces */ /* Similar to LOOKING_AT but does not use notinname, does not skip */ #define LOOKING_AT_NOCASE(cp, kw) /* the keyword is a literal string */ \ - ((assert ("" kw), TRUE) /* syntax error if not a literal string */ \ + ((assert ("" kw), true) /* syntax error if not a literal string */ \ && strncaseeq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \ && ((cp) += sizeof (kw)-1)) /* skip spaces */ @@ -3972,7 +3957,7 @@ F_getit (FILE *inf) return; for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++) continue; - make_tag (dbp, cp-dbp, TRUE, + make_tag (dbp, cp-dbp, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } @@ -4049,7 +4034,7 @@ Fortran_functions (FILE *inf) { dbp = skip_spaces (dbp); if (*dbp == '\0') /* assume un-named */ - make_tag ("blockdata", 9, TRUE, + make_tag ("blockdata", 9, true, lb.buffer, dbp - lb.buffer, lineno, linecharno); else F_getit (inf); /* look for name */ @@ -4122,7 +4107,7 @@ Ada_getit (FILE *inf, const char *name_qualifier) *cp = '\0'; name = concat (dbp, name_qualifier, ""); *cp = c; - make_tag (name, strlen (name), TRUE, + make_tag (name, strlen (name), true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); free (name); if (c == '"') @@ -4134,8 +4119,8 @@ Ada_getit (FILE *inf, const char *name_qualifier) static void Ada_funcs (FILE *inf) { - bool inquote = FALSE; - bool skip_till_semicolumn = FALSE; + bool inquote = false; + bool skip_till_semicolumn = false; LOOP_ON_INPUT_LINES (inf, lb, dbp) { @@ -4147,13 +4132,13 @@ Ada_funcs (FILE *inf) dbp = etags_strchr (dbp + !inquote, '"'); if (dbp != NULL) { - inquote = FALSE; + inquote = false; dbp += 1; continue; /* advance char */ } else { - inquote = TRUE; + inquote = true; break; /* advance line */ } } @@ -4175,7 +4160,7 @@ Ada_funcs (FILE *inf) if (skip_till_semicolumn) { if (*dbp == ';') - skip_till_semicolumn = FALSE; + skip_till_semicolumn = false; dbp++; continue; /* advance char */ } @@ -4212,7 +4197,7 @@ Ada_funcs (FILE *inf) { /* when tagging types, avoid tagging use type Pack.Typename; for this, we will skip everything till a ; */ - skip_till_semicolumn = TRUE; + skip_till_semicolumn = true; continue; /* advance char */ } @@ -4261,7 +4246,7 @@ Asm_labels (FILE *inf) cp++; if (*cp == ':' || iswhite (*cp)) /* Found end of label, so copy it and add it to the table. */ - make_tag (lb.buffer, cp - lb.buffer, TRUE, + make_tag (lb.buffer, cp - lb.buffer, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } } @@ -4275,7 +4260,7 @@ Asm_labels (FILE *inf) * Perl variable names: /^(my|local).../ * Original code by Bart Robinson (1995) * Additions by Michael Ernst (1997) - * Ideas by Kai Großjohann (2001) + * Ideas by Kai Großjohann (2001) */ static void Perl_functions (FILE *inf) @@ -4305,7 +4290,7 @@ Perl_functions (FILE *inf) if ((pos = etags_strchr (sp, ':')) != NULL && pos < cp && pos[1] == ':') /* The name is already qualified. */ - make_tag (sp, cp - sp, TRUE, + make_tag (sp, cp - sp, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); else /* Qualify it. */ @@ -4316,7 +4301,7 @@ Perl_functions (FILE *inf) *cp = '\0'; name = concat (package, "::", sp); *cp = savechar; - make_tag (name, strlen (name), TRUE, + make_tag (name, strlen (name), true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); free (name); } @@ -4359,7 +4344,7 @@ Perl_functions (FILE *inf) else continue; - make_tag (varstart, cp - varstart, FALSE, + make_tag (varstart, cp - varstart, false, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } } @@ -4386,7 +4371,7 @@ Python_functions (FILE *inf) char *name = cp; while (!notinname (*cp) && *cp != ':') cp++; - make_tag (name, cp - name, TRUE, + make_tag (name, cp - name, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } } @@ -4406,8 +4391,8 @@ Python_functions (FILE *inf) static void PHP_functions (FILE *inf) { - register char *cp, *name; - bool search_identifier = FALSE; + char *cp, *name; + bool search_identifier = false; LOOP_ON_INPUT_LINES (inf, lb, cp) { @@ -4418,9 +4403,9 @@ PHP_functions (FILE *inf) { while (!notinname (*cp)) cp++; - make_tag (name, cp - name, TRUE, + make_tag (name, cp - name, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); - search_identifier = FALSE; + search_identifier = false; } else if (LOOKING_AT (cp, "function")) { @@ -4431,11 +4416,11 @@ PHP_functions (FILE *inf) name = cp; while (!notinname (*cp)) cp++; - make_tag (name, cp - name, TRUE, + make_tag (name, cp - name, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } else - search_identifier = TRUE; + search_identifier = true; } else if (LOOKING_AT (cp, "class")) { @@ -4444,11 +4429,11 @@ PHP_functions (FILE *inf) name = cp; while (*cp != '\0' && !iswhite (*cp)) cp++; - make_tag (name, cp - name, FALSE, + make_tag (name, cp - name, false, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } else - search_identifier = TRUE; + search_identifier = true; } else if (strneq (cp, "define", 6) && (cp = skip_spaces (cp+6)) @@ -4459,7 +4444,7 @@ PHP_functions (FILE *inf) name = cp; while (*cp != quote && *cp != '\0') cp++; - make_tag (name, cp - name, FALSE, + make_tag (name, cp - name, false, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } else if (members @@ -4469,7 +4454,7 @@ PHP_functions (FILE *inf) name = cp; while (!notinname (*cp)) cp++; - make_tag (name, cp - name, FALSE, + make_tag (name, cp - name, false, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } } @@ -4500,7 +4485,7 @@ Cobol_paragraphs (FILE *inf) for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++) continue; if (*ep++ == '.') - make_tag (bp, ep - bp, TRUE, + make_tag (bp, ep - bp, true, lb.buffer, ep - lb.buffer + 1, lineno, linecharno); } } @@ -4529,7 +4514,7 @@ Makefile_targets (FILE *inf) while (--bp > namestart) if (!notinname (*bp)) break; - make_tag (namestart, bp - namestart + 1, TRUE, + make_tag (namestart, bp - namestart + 1, true, lb.buffer, bp - lb.buffer + 2, lineno, linecharno); } } @@ -4553,7 +4538,7 @@ Pascal_functions (FILE *inf) int save_lineno, namelen, taglen; char c, *name; - bool /* each of these flags is TRUE if: */ + bool /* each of these flags is true if: */ incomment, /* point is inside a comment */ inquote, /* point is inside '..' string */ get_tagname, /* point is after PROCEDURE/FUNCTION @@ -4571,11 +4556,11 @@ Pascal_functions (FILE *inf) *dbp = '\0'; linebuffer_init (&tline); - incomment = inquote = FALSE; - found_tag = FALSE; /* have a proc name; check if extern */ - get_tagname = FALSE; /* found "procedure" keyword */ - inparms = FALSE; /* found '(' after "proc" */ - verify_tag = FALSE; /* check if "extern" is ahead */ + incomment = inquote = false; + found_tag = false; /* have a proc name; check if extern */ + get_tagname = false; /* found "procedure" keyword */ + inparms = false; /* found '(' after "proc" */ + verify_tag = false; /* check if "extern" is ahead */ while (!feof (inf)) /* long main loop to get next char */ @@ -4596,46 +4581,46 @@ Pascal_functions (FILE *inf) if (incomment) { if (c == '}') /* within { } comments */ - incomment = FALSE; + incomment = false; else if (c == '*' && *dbp == ')') /* within (* *) comments */ { dbp++; - incomment = FALSE; + incomment = false; } continue; } else if (inquote) { if (c == '\'') - inquote = FALSE; + inquote = false; continue; } else switch (c) { case '\'': - inquote = TRUE; /* found first quote */ + inquote = true; /* found first quote */ continue; case '{': /* found open { comment */ - incomment = TRUE; + incomment = true; continue; case '(': if (*dbp == '*') /* found open (* comment */ { - incomment = TRUE; + incomment = true; dbp++; } else if (found_tag) /* found '(' after tag, i.e., parm-list */ - inparms = TRUE; + inparms = true; continue; case ')': /* end of parms list */ if (inparms) - inparms = FALSE; + inparms = false; continue; case ';': if (found_tag && !inparms) /* end of proc or fn stmt */ { - verify_tag = TRUE; + verify_tag = true; break; } continue; @@ -4649,23 +4634,23 @@ Pascal_functions (FILE *inf) { if (nocase_tail ("extern")) /* superfluous, really! */ { - found_tag = FALSE; - verify_tag = FALSE; + found_tag = false; + verify_tag = false; } } else if (lowcase (*dbp) == 'f') { if (nocase_tail ("forward")) /* check for forward reference */ { - found_tag = FALSE; - verify_tag = FALSE; + found_tag = false; + verify_tag = false; } } if (found_tag && verify_tag) /* not external proc, so make tag */ { - found_tag = FALSE; - verify_tag = FALSE; - make_tag (name, namelen, TRUE, + found_tag = false; + verify_tag = false; + make_tag (name, namelen, true, tline.buffer, taglen, save_lineno, save_lcno); continue; } @@ -4691,8 +4676,8 @@ Pascal_functions (FILE *inf) taglen = cp - lb.buffer + 1; dbp = cp; /* set dbp to e-o-token */ - get_tagname = FALSE; - found_tag = TRUE; + get_tagname = false; + found_tag = true; continue; /* And proceed to check for "extern". */ @@ -4704,11 +4689,11 @@ Pascal_functions (FILE *inf) { case 'p': if (nocase_tail ("rocedure")) /* c = 'p', dbp has advanced */ - get_tagname = TRUE; + get_tagname = true; continue; case 'f': if (nocase_tail ("unction")) - get_tagname = TRUE; + get_tagname = true; continue; } } @@ -4837,7 +4822,7 @@ PS_functions (FILE *inf) *ep != '\0' && *ep != ' ' && *ep != '{'; ep++) continue; - make_tag (bp, ep - bp, TRUE, + make_tag (bp, ep - bp, true, lb.buffer, ep - lb.buffer + 1, lineno, linecharno); } else if (LOOKING_AT (bp, "defineps")) @@ -4967,14 +4952,14 @@ TeX_commands (FILE *inf) for (key = TEX_toktab; key->buffer != NULL; key++) if (strneq (cp, key->buffer, key->len)) { - register char *p; + char *p; int namelen, linelen; - bool opgrp = FALSE; + bool opgrp = false; cp = skip_spaces (cp + key->len); if (*cp == TEX_opgrp) { - opgrp = TRUE; + opgrp = true; cp++; } for (p = cp; @@ -4990,7 +4975,7 @@ TeX_commands (FILE *inf) p++; linelen = p - lb.buffer + 1; } - make_tag (cp, namelen, TRUE, + make_tag (cp, namelen, true, lb.buffer, linelen, lineno, linecharno); goto tex_next_line; /* We only tag a line once */ } @@ -5094,7 +5079,7 @@ Texinfo_nodes (FILE *inf) start = cp; while (*cp != '\0' && *cp != ',') cp++; - make_tag (start, cp - start, TRUE, + make_tag (start, cp - start, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } } @@ -5105,15 +5090,15 @@ Texinfo_nodes (FILE *inf) * Contents of , <h1>, <h2>, <h3> are tags. * Contents of <a name=xxx> are tags with name xxx. * - * Francesco Potortì, 2002. + * Francesco Potortì, 2002. */ static void HTML_labels (FILE *inf) { - bool getnext = FALSE; /* next text outside of HTML tags is a tag */ - bool skiptag = FALSE; /* skip to the end of the current HTML tag */ - bool intag = FALSE; /* inside an html tag, looking for ID= */ - bool inanchor = FALSE; /* when INTAG, is an anchor, look for NAME= */ + bool getnext = false; /* next text outside of HTML tags is a tag */ + bool skiptag = false; /* skip to the end of the current HTML tag */ + bool intag = false; /* inside an html tag, looking for ID= */ + bool inanchor = false; /* when INTAG, is an anchor, look for NAME= */ char *end; @@ -5129,7 +5114,7 @@ HTML_labels (FILE *inf) if (*dbp == '>') { dbp += 1; - skiptag = FALSE; + skiptag = false; continue; /* look on the same line */ } break; /* go to next line */ @@ -5145,7 +5130,7 @@ HTML_labels (FILE *inf) if (*dbp == '>') { dbp += 1; - intag = FALSE; + intag = false; continue; /* look on the same line */ } if ((inanchor && LOOKING_AT_NOCASE (dbp, "name=")) @@ -5164,9 +5149,9 @@ HTML_labels (FILE *inf) token_name.buffer[end - dbp] = '\0'; dbp = end; - intag = FALSE; /* we found what we looked for */ - skiptag = TRUE; /* skip to the end of the tag */ - getnext = TRUE; /* then grab the text */ + intag = false; /* we found what we looked for */ + skiptag = true; /* skip to the end of the tag */ + getnext = true; /* then grab the text */ continue; /* look on the same line */ } dbp += 1; @@ -5179,17 +5164,17 @@ HTML_labels (FILE *inf) break; /* go to next line */ if (*dbp == '<') { - intag = TRUE; + intag = true; inanchor = (lowcase (dbp[1]) == 'a' && !intoken (dbp[2])); continue; /* look on the same line */ } for (end = dbp + 1; *end != '\0' && *end != '<'; end++) continue; - make_tag (token_name.buffer, token_name.len, TRUE, + make_tag (token_name.buffer, token_name.len, true, dbp, end - dbp, lineno, linecharno); linebuffer_setlen (&token_name, 0); /* no name in buffer */ - getnext = FALSE; + getnext = false; break; /* go to next line */ } @@ -5199,10 +5184,10 @@ HTML_labels (FILE *inf) dbp++; if (*dbp == '\0') break; /* go to next line */ - intag = TRUE; + intag = true; if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2])) { - inanchor = TRUE; + inanchor = true; continue; /* look on the same line */ } else if (LOOKING_AT_NOCASE (dbp, "<title>") @@ -5210,8 +5195,8 @@ HTML_labels (FILE *inf) || LOOKING_AT_NOCASE (dbp, "<h2>") || LOOKING_AT_NOCASE (dbp, "<h3>")) { - intag = FALSE; - getnext = TRUE; + intag = false; + getnext = true; continue; /* look on the same line */ } dbp += 1; @@ -5316,7 +5301,7 @@ prolog_pr (char *s, char *last) || len != strlen (last) || !strneq (s, last, len))) { - make_tag (s, len, TRUE, s, pos, lineno, linecharno); + make_tag (s, len, true, s, pos, lineno, linecharno); return len; } else @@ -5472,7 +5457,7 @@ erlang_func (char *s, char *last) || len != (int)strlen (last) || !strneq (s, last, len))) { - make_tag (s, len, TRUE, s, pos, lineno, linecharno); + make_tag (s, len, true, s, pos, lineno, linecharno); return len; } @@ -5499,7 +5484,7 @@ erlang_attribute (char *s) { int len = erlang_atom (skip_spaces (cp)); if (len > 0) - make_tag (cp, len, TRUE, s, cp + len - s, lineno, linecharno); + make_tag (cp, len, true, s, cp + len - s, lineno, linecharno); } return; } @@ -5552,7 +5537,7 @@ scan_separators (char *name) { char sep = name[0]; char *copyto = name; - bool quoted = FALSE; + bool quoted = false; for (++name; *name != '\0'; ++name) { @@ -5580,10 +5565,10 @@ scan_separators (char *name) } break; } - quoted = FALSE; + quoted = false; } else if (*name == '\\') - quoted = TRUE; + quoted = true; else if (*name == sep) break; else @@ -5628,10 +5613,7 @@ analyse_regex (char *regex_arg) /* regexfile is a file containing regexps, one per line. */ regexfp = fopen (regexfile, "r"); if (regexfp == NULL) - { - pfatal (regexfile); - return; - } + pfatal (regexfile); linebuffer_init (®exbuf); while (readline_internal (®exbuf, regexfp) > 0) analyse_regex (regexbuf.buffer); @@ -5680,10 +5662,10 @@ add_regex (char *regexp_pattern, language *lang) struct re_pattern_buffer *patbuf; regexp *rp; bool - force_explicit_name = TRUE, /* do not use implicit tag names */ - ignore_case = FALSE, /* case is significant */ - multi_line = FALSE, /* matches are done one line at a time */ - single_line = FALSE; /* dot does not match newline */ + force_explicit_name = true, /* do not use implicit tag names */ + ignore_case = false, /* case is significant */ + multi_line = false, /* matches are done one line at a time */ + single_line = false; /* dot does not match newline */ if (strlen (regexp_pattern) < 3) @@ -5719,17 +5701,17 @@ add_regex (char *regexp_pattern, language *lang) case 'N': if (modifiers == name) error ("forcing explicit tag name but no name, ignoring"); - force_explicit_name = TRUE; + force_explicit_name = true; break; case 'i': - ignore_case = TRUE; + ignore_case = true; break; case 's': - single_line = TRUE; + single_line = true; /* FALLTHRU */ case 'm': - multi_line = TRUE; - need_filebuf = TRUE; + multi_line = true; + need_filebuf = true; break; default: error ("invalid regexp modifier `%c', ignoring", modifiers[0]); @@ -5773,7 +5755,7 @@ add_regex (char *regexp_pattern, language *lang) p_head->lang = lang; p_head->pat = patbuf; p_head->name = savestr (name); - p_head->error_signaled = FALSE; + p_head->error_signaled = false; p_head->force_explicit_name = force_explicit_name; p_head->ignore_case = ignore_case; p_head->multi_line = multi_line; @@ -5887,7 +5869,7 @@ regex_tag_multiline (void) { error ("regexp stack overflow while matching \"%s\"", rp->pattern); - rp->error_signaled = TRUE; + rp->error_signaled = true; } break; case -1: @@ -5900,7 +5882,7 @@ regex_tag_multiline (void) { error ("regexp matches the empty string: \"%s\"", rp->pattern); - rp->error_signaled = TRUE; + rp->error_signaled = true; } match = -3; /* exit from while loop */ break; @@ -5917,10 +5899,10 @@ regex_tag_multiline (void) name = substitute (buffer, rp->name, &rp->regs); if (rp->force_explicit_name) /* Force explicit tag name, if a name is there. */ - pfnote (name, TRUE, buffer + linecharno, + pfnote (name, true, buffer + linecharno, charno - linecharno + 1, lineno, linecharno); else - make_tag (name, strlen (name), TRUE, buffer + linecharno, + make_tag (name, strlen (name), true, buffer + linecharno, charno - linecharno + 1, lineno, linecharno); break; } @@ -5939,9 +5921,9 @@ nocase_tail (const char *cp) if (*cp == '\0' && !intoken (dbp[len])) { dbp += len; - return TRUE; + return true; } - return FALSE; + return false; } static void @@ -5954,7 +5936,7 @@ get_tag (register char *bp, char **namepp) /* Go till you get to white space or a syntactic break */ for (cp = bp + 1; !notinname (*cp); cp++) continue; - make_tag (bp, cp - bp, TRUE, + make_tag (bp, cp - bp, true, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); } @@ -6089,7 +6071,7 @@ readline (linebuffer *lbp, FILE *stream) char *taggedfname; /* name of original file as given */ char *name; /* temp var */ - discard_until_line_directive = FALSE; /* found it */ + discard_until_line_directive = false; /* found it */ name = lbp->buffer + start; *endp = '\0'; canonicalize_filename (name); @@ -6137,7 +6119,7 @@ readline (linebuffer *lbp, FILE *stream) for (fdp = fdhead; fdp != NULL; fdp = fdp->next) if (streq (fdp->infabsname, taggedabsname)) { - discard_until_line_directive = TRUE; + discard_until_line_directive = true; free (taggedfname); break; } @@ -6153,9 +6135,9 @@ readline (linebuffer *lbp, FILE *stream) fdhead->infabsname = savestr (curfdp->infabsname); fdhead->infabsdir = savestr (curfdp->infabsdir); fdhead->taggedfname = taggedfname; - fdhead->usecharno = FALSE; + fdhead->usecharno = false; fdhead->prop = NULL; - fdhead->written = FALSE; + fdhead->written = false; curfdp = fdhead; } } @@ -6178,7 +6160,7 @@ readline (linebuffer *lbp, FILE *stream) return; } /* End of file. */ - discard_until_line_directive = FALSE; + discard_until_line_directive = false; return; } } /* if #line directives should be considered */ @@ -6208,7 +6190,7 @@ readline (linebuffer *lbp, FILE *stream) { error ("regexp stack overflow while matching \"%s\"", rp->pattern); - rp->error_signaled = TRUE; + rp->error_signaled = true; } break; case -1: @@ -6219,7 +6201,7 @@ readline (linebuffer *lbp, FILE *stream) if (!rp->error_signaled) { error ("regexp matches the empty string: \"%s\"", rp->pattern); - rp->error_signaled = TRUE; + rp->error_signaled = true; } break; default: @@ -6231,9 +6213,9 @@ readline (linebuffer *lbp, FILE *stream) name = substitute (lbp->buffer, rp->name, &rp->regs); if (rp->force_explicit_name) /* Force explicit tag name, if a name is there. */ - pfnote (name, TRUE, lbp->buffer, match, lineno, linecharno); + pfnote (name, true, lbp->buffer, match, lineno, linecharno); else - make_tag (name, strlen (name), TRUE, + make_tag (name, strlen (name), true, lbp->buffer, match, lineno, linecharno); break; } @@ -6259,12 +6241,9 @@ savestr (const char *cp) static char * savenstr (const char *cp, int len) { - register char *dp; - - dp = xnew (len + 1, char); - memcpy (dp, cp, len); + char *dp = xnew (len + 1, char); dp[len] = '\0'; - return dp; + return memcpy (dp, cp, len); } /* @@ -6378,7 +6357,6 @@ concat (const char *s1, const char *s2, const char *s3) strcpy (result, s1); strcpy (result + len1, s2); strcpy (result + len1 + len2, s3); - result[len1 + len2 + len3] = '\0'; return result; }