aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorFrancesco Potortì2001-01-14 20:48:05 +0000
committerFrancesco Potortì2001-01-14 20:48:05 +0000
commit89d57763af3564887725b721a8f45b7ce4dcd81f (patch)
tree2fab16b3fc8dfc7a86370f0ded870909bc1b7ab8 /lib-src
parent8d7ff9c80866921180302a7903807454b8d1f00e (diff)
downloademacs-89d57763af3564887725b721a8f45b7ce4dcd81f.tar.gz
emacs-89d57763af3564887725b721a8f45b7ce4dcd81f.zip
Changes for makefile support in etags.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.1132
-rw-r--r--lib-src/etags.c162
2 files changed, 186 insertions, 108 deletions
diff --git a/lib-src/etags.1 b/lib-src/etags.1
index 2a6c37592da..ab9a48e5524 100644
--- a/lib-src/etags.1
+++ b/lib-src/etags.1
@@ -1,6 +1,6 @@
1.\" Copyright (c) 1992 Free Software Foundation 1.\" Copyright (c) 1992 Free Software Foundation
2.\" See section COPYING for conditions for redistribution 2.\" See section COPYING for conditions for redistribution
3.TH etags 1 "19apr1994" "GNU Tools" "GNU Tools" 3.TH etags 1 "14gen2001" "GNU Tools" "GNU Tools"
4.de BP 4.de BP
5.sp 5.sp
6.ti -.2i 6.ti -.2i
@@ -12,24 +12,33 @@ etags, ctags \- generate tag file for Emacs, vi
12.SH SYNOPSIS 12.SH SYNOPSIS
13.hy 0 13.hy 0
14.na 14.na
15.B etags [\|\-aCDRSVh\|] [\|\-i \fIfile\fP\|] [\|\-l \fIlanguage\fP\|] [\|\-i \fIregexp\fP\|] [\|\-o \fItagfile\fP\|] 15.B etags [\|\-aCDGImRVh\|] [\|\-i \fIfile\fP\|] [\|\-l \fIlanguage\fP\|]
16.if n .br
17.B [\|\-o \fItagfile\fP\|] [\|\-r \fIregexp\fP\|]
16.br 18.br
17[\|\-\-c++\|] [\|\-\-no\-defines\|] [\|\-\-ignore\-indentation\|] 19[\|\-\-append\|] [\|\-\-c++\|] [\|\-\-no\-defines\|]
18[\|\-\-language=\fIlanguage\fP\|] [\|\-\-regex=\fIregexp\fP\|] 20[\|\-\-no\-globals\|] [\|\-\-include=\fIfile\fP\|]
19[\|\-\-no\-regexp\|] [\|\-\-help\|] [\|\-\-version\|] 21[\|\-\-ignore\-indentation\|] [\|\-\-language=\fIlanguage\fP\|]
20[\|\-\-include=\fIfile\fP\|] [\|\-\-output=\fItagfile\fP\|] 22[\|\-\-members\|] [\|\-\-output=\fItagfile\fP\|]
21[\|\-\-append\|] \fIfile\fP .\|.\|. 23[\|\-\-regex=\fIregexp\fP\|] [\|\-\-no\-regex\|]
24[\|\-\-ignore\-case\-regex=\fIregexp\fP\|]
25[\|\-\-help\|] [\|\-\-version\|]
26\fIfile\fP .\|.\|.
22 27
23.B ctags [\|\-aCdRSVh\|] [\|\-BtTuvwx\|] [\|\-l \fIlanguage\fP\|] 28.B ctags [\|\-aCdgImRVh\|] [\|\-BtTuvwx\|] [\|\-l \fIlanguage\fP\|]
29.if n .br
30.B [\|\-o \fItagfile\fP\|] [\|\-r \fIregexp\fP\|]
24.br 31.br
25[\|\-i \fIregexp\fP\|] [\|\-o \fItagfile\fP\|] 32[\|\-\-append\|] [\|\-\-backward\-search\|] [\|\-\-c++\|]
26[\|\-\-c++\|] [\|\-\-defines\|] [\|\-\-ignore\-indentation\|] 33[\|\-\-cxref\|] [\|\-\-defines\|] [\|\-\-forward\-search\|]
27[\|\-\-no\-warn\|] [\|\-\-cxref\|] [\|\-\-backward\-search\|] 34[\|\-\-globals\|] [\|\-\-ignore\-indentation\|]
28[\|\-\-forward\-search\|] [\|\-\-typedefs\|] [\|\-\-typedefs\-and\-c++\|] 35[\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|]
29[\|\-\-language=\fIlanguage\fP\|] [\|\-\-regex=\fIregexp\fP\|] 36[\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|]
37[\|\-\-ignore\-case\-regex=\fIregexp\fP\|]
38[\|\-\-typedefs\|] [\|\-\-typedefs\-and\-c++\|]
39[\|\-\-update\|] [\|\-\-no\-warn\|]
30[\|\-\-help\|] [\|\-\-version\|] 40[\|\-\-help\|] [\|\-\-version\|]
31.br 41\fIfile\fP .\|.\|.
32[\|\-\-output=\fItagfile\fP\|] [\|\-\-append\|] [\|\-\-update\|] \fIfile\fP .\|.\|.
33.ad b 42.ad b
34.hy 1 43.hy 1
35.SH DESCRIPTION 44.SH DESCRIPTION
@@ -40,8 +49,8 @@ understood by
40format understood by 49format understood by
41.BR vi ( 1 )\c 50.BR vi ( 1 )\c
42\&. Both forms of the program understand 51\&. Both forms of the program understand
43the syntax of C, Objective C, C++, Java, Fortran, Pascal, Cobol, 52the syntax of C, Objective C, C++, Java, Fortran, Pascal, Cobol, Ada, Perl,
44LaTeX, Scheme, Emacs Lisp/Common Lisp, Postscript, Erlang, Prolog and 53LaTeX, Scheme, Emacs Lisp/Common Lisp, Postscript, Erlang, Python, Prolog and
45most assembler\-like syntaxes. 54most assembler\-like syntaxes.
46Both forms read the files specified on the command line, and write a tag 55Both forms read the files specified on the command line, and write a tag
47table (defaults: `\|TAGS\|' for \fBetags\fP, `\|tags\|' for 56table (defaults: `\|TAGS\|' for \fBetags\fP, `\|tags\|' for
@@ -77,49 +86,73 @@ Treat files with `\|.c\|' and `\|.h\|' extensions as C++ code, not C
77code. Files with `\|.C\|', `\|.H\|', `\|.cxx\|', `\|.hxx\|', or 86code. Files with `\|.C\|', `\|.H\|', `\|.cxx\|', `\|.hxx\|', or
78`\|.cc\|' extensions are always assumed to be C++ code. 87`\|.cc\|' extensions are always assumed to be C++ code.
79.TP 88.TP
89.B \-\-declarations
90In C and derived languages, create tags for function declarations,
91and create tags for extern variables unless \-\-no\-globals is used.
92.TP
80.B \-d, \-\-defines 93.B \-d, \-\-defines
81Create tag entries for C preprocessor constant definitions 94Create tag entries for C preprocessor constant definitions
82and enum constants, too. This is the 95and enum constants, too. This is the
83default behavior for \fBetags\fP, so this option is only accepted 96default behavior for \fBetags\fP.
84by \fBctags\fP.
85.TP 97.TP
86.B \-D, \-\-no\-defines 98.B \-D, \-\-no\-defines
87Do not create tag entries for C preprocessor constant definitions 99Do not create tag entries for C preprocessor constant definitions
88and enum constants. 100and enum constants.
89This may make the tags file much smaller if many header files are tagged. 101This may make the tags file much smaller if many header files are tagged.
90This is the default behavior for \fBctags\fP, so this option is only 102This is the default behavior for \fBctags\fP.
91accepted by \fBetags\fP. 103.TP
104.B \-g, \-\-globals
105Create tag entries for global variables in C, C++, Objective C, Java,
106and Perl.
107This is the default behavior for \fBetags\fP.
108.TP
109.B \-G, \-\-no\-globals
110Do not tag global variables. Typically this reduces the file size by
111one fourth. This is the default behavior for \fBctags\fP.
112.TP
113\fB\-i\fP \fIfile\fP, \fB\-\-include=\fIfile\fP
114Include a note in the tag file indicating that, when searching for a
115tag, one should also consult the tags file \fIfile\fP after checking the
116current file. This options is only accepted by \fBetags\fP.
117.TP
118.B \-I, \-\-ignore\-indentation
119Don't rely on indentation as much as we normally do. Currently, this
120means not to assume that a closing brace in the first column is the
121final brace of a function or structure definition in C and C++.
92.TP 122.TP
93\fB\-l\fP \fIlanguage\fP, \fB\-\-language=\fIlanguage\fP 123\fB\-l\fP \fIlanguage\fP, \fB\-\-language=\fIlanguage\fP
94Parse the following files according to the given language. More than 124Parse the following files according to the given language. More than
95one such options may be intermixed with filenames. Use \fB\-\-help\fP 125one such options may be intermixed with filenames. Use \fB\-\-help\fP
96to get a list of the available languages and their default filename 126to get a list of the available languages and their default filename
97extensions. The `auto' language can be used to restore automatic 127extensions. The `auto' language can be used to restore automatic
98detection of language based on filename extension. The `none' 128detection of language based on the file name. The `none'
99language may be used to disable language parsing altogether; only 129language may be used to disable language parsing altogether; only
100regexp matching is done in this case (see the \fB\-\-regex\fP option). 130regexp matching is done in this case (see the \fB\-\-regex\fP option).
101.TP 131.TP
102\fB\-\-no_globals\fP 132.B \-m, \-\-members
103Do not tag global variables in C, C++, Objective C, Java. Typically 133Create tag entries for variables that are members of structure-like
104this reduces the file size by one fourth. 134constructs in C++, Objective C, Java.
105.TP 135.TP
106\fB\-\-members\fP 136.B \-M, \-\-no\-members
107Tag variables that are members of strucure-like constructs in C++, 137Do not tag member variables. This is the default behavior.
108Objective C, Java. 138.TP
139.B \-\-packages\-only
140Only tag packages in Ada files.
109.TP 141.TP
110\fB\-o\fP \fItagfile\fP, \fB\-\-output=\fItagfile\fP 142\fB\-o\fP \fItagfile\fP, \fB\-\-output=\fItagfile\fP
111Explicit name of file for tag table; overrides default `\|TAGS\|' or 143Explicit name of file for tag table; overrides default `\|TAGS\|' or
112`\|tags\|'. (But ignored with \fB\-v\fP or \fB\-x\fP.) 144`\|tags\|'. (But ignored with \fB\-v\fP or \fB\-x\fP.)
113.TP 145.TP
114\fB\-r\fP \fIregexp\fP, \fB\-\-regex=\fIregexp\fP 146\fB\-r\fP \fIregexp\fP, \fB\-\-regex=\fIregexp\fP
115Make tags based on regexp matching for each line of the files 147\fB\-\-ignore\-case\-regex=\fIregexp\fP\
116following this option, in addition to the tags made with the standard 148Make tags based on regexp matching for each line of the files following
117parsing based on language. May be freely intermixed with filenames 149this option, in addition to the tags made with the standard parsing based
118and the \fB\-R\fP option. The regexps are cumulative, i.e. each 150on language. When using \-\-regex, case is significant, while it is not
119option will add to the previous ones. The regexps are of the form: 151with \-\-ignore\-case\-regex. May be freely intermixed with filenames and
152the \fB\-R\fP option. The regexps are cumulative, i.e. each option will
153add to the previous ones. The regexps are of the form:
120.br 154.br
121 155 \fB/\fP\fItagregexp\fP[\fB/\fP\fInameregexp\fP]\fB/\fP
122 \fB/\fP\fItagregexp\fP[\fB/\fP\fInameregexp\fP]\fB/\fP
123.br 156.br
124 157
125where \fItagregexp\fP is used to match the lines that must be tagged. 158where \fItagregexp\fP is used to match the lines that must be tagged.
@@ -127,8 +160,8 @@ It should not match useless characters. If the match is
127such that more characters than needed are unavoidably matched by 160such that more characters than needed are unavoidably matched by
128\fItagregexp\fP, it may be useful to add a \fInameregexp\fP, to 161\fItagregexp\fP, it may be useful to add a \fInameregexp\fP, to
129narrow down the tag scope. \fBctags\fP ignores regexps without a 162narrow down the tag scope. \fBctags\fP ignores regexps without a
130\fInameregexp\fP. The syntax of regexps is the same as in emacs, 163\fInameregexp\fP. The syntax of regexps is the same as in emacs,
131augmented with intervals of the form \\{m,n\\}, as id ed or grep. 164augmented with intervals of the form \\{m,n\\}, as in ed or grep.
132.br 165.br
133Here are some examples. All the regexps are quoted to protect them 166Here are some examples. All the regexps are quoted to protect them
134from shell interpretation. 167from shell interpretation.
@@ -152,16 +185,25 @@ Tag TCL files (this last example shows the usage of a \fItagregexp\fP):
152.br 185.br
153\fI\-\-lang\=none \-\-regex\='/proc[\ \\t]+\\([^\ \\t]+\\)/\\1/'\fP 186\fI\-\-lang\=none \-\-regex\='/proc[\ \\t]+\\([^\ \\t]+\\)/\\1/'\fP
154 187
188.br
189A regexp can be preceded by {lang}, thus restriciting it to match lines of
190files of the specified language. Use \fBetags --help\bP to obtain a list
191of the recognised languages. This feature is particularly useful inside
192\fBregex files\fB. A regex file contains one regex per line. Empty lines,
193and those lines beginning with space or tab are ignored. Lines beginning
194with @ are references to regex files whose name follows the @ sign. Other
195lines are considered regular expressions like those following \-\-regex.
196.br
197For example, the command
198.br
199etags \-\-regex=@regex.file *.c
200.br
201reads the regexes contained in the file regex.file.
155.TP 202.TP
156.B \-R, \-\-no\-regex 203.B \-R, \-\-no\-regex
157Don't do any more regexp matching on the following files. May be 204Don't do any more regexp matching on the following files. May be
158freely intermixed with filenames and the \fB\-\-regex\fP option. 205freely intermixed with filenames and the \fB\-\-regex\fP option.
159.TP 206.TP
160.B \-S, \-\-ignore\-indentation
161Don't rely on indentation as much as we normally do. Currently, this
162means not to assume that a closing brace in the first column is the
163final brace of a function or structure definition in C and C++.
164.TP
165.B \-t, \-\-typedefs 207.B \-t, \-\-typedefs
166Record typedefs in C code as tags. Since this is the default behaviour 208Record typedefs in C code as tags. Since this is the default behaviour
167of \fBetags\fP, only \fBctags\fP accepts this option. 209of \fBetags\fP, only \fBctags\fP accepts this option.
@@ -192,7 +234,7 @@ allowed with it.
192Instead of generating a tag file, write a cross reference (in 234Instead of generating a tag file, write a cross reference (in
193\fBcxref\fP format) to standard output. Only \fBctags\fP accepts this option. 235\fBcxref\fP format) to standard output. Only \fBctags\fP accepts this option.
194.TP 236.TP
195.B \-H, \-\-help 237.B \-h, \-H, \-\-help
196Print usage information. 238Print usage information.
197.TP 239.TP
198.B \-V, \-\-version 240.B \-V, \-\-version
@@ -209,7 +251,7 @@ Stallman.
209.BR vi ( 1 ). 251.BR vi ( 1 ).
210 252
211.SH COPYING 253.SH COPYING
212Copyright (c) 1992 Free Software Foundation, Inc. 254Copyright (c) 1999 Free Software Foundation, Inc.
213.PP 255.PP
214Permission is granted to make and distribute verbatim copies of 256Permission is granted to make and distribute verbatim copies of
215this manual provided the copyright notice and this permission notice 257this manual provided the copyright notice and this permission notice
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 9685c7ab70d..77b28a73df1 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -31,7 +31,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
31 * Francesco Potorti` (pot@gnu.org) is the current maintainer. 31 * Francesco Potorti` (pot@gnu.org) is the current maintainer.
32 */ 32 */
33 33
34char pot_etags_version[] = "@(#) pot revision number is 13.44"; 34char pot_etags_version[] = "@(#) pot revision number is 13.47";
35 35
36#define TRUE 1 36#define TRUE 1
37#define FALSE 0 37#define FALSE 0
@@ -160,21 +160,21 @@ char pot_etags_version[] = "@(#) pot revision number is 13.44";
160#define strneq(s,t,n) ((DEBUG && (s) == NULL && (t) == NULL \ 160#define strneq(s,t,n) ((DEBUG && (s) == NULL && (t) == NULL \
161 && (abort (), 1)) || !strncmp (s, t, n)) 161 && (abort (), 1)) || !strncmp (s, t, n))
162 162
163#define lowcase(c) tolower ((unsigned char)(c))
164#define UPCASE(c) toupper ((unsigned char)(c))
165
166#define CHARS 256 /* 2^sizeof(char) */ 163#define CHARS 256 /* 2^sizeof(char) */
167#define CHAR(x) ((unsigned int)x & (CHARS - 1)) 164#define CHAR(x) ((unsigned int)(x) & (CHARS - 1))
168#define iswhite(c) (_wht[CHAR(c)]) /* c is white */ 165#define iswhite(c) (_wht[CHAR(c)]) /* c is white */
169#define notinname(c) (_nin[CHAR(c)]) /* c is not in a name */ 166#define notinname(c) (_nin[CHAR(c)]) /* c is not in a name */
170#define begtoken(c) (_btk[CHAR(c)]) /* c can start token */ 167#define begtoken(c) (_btk[CHAR(c)]) /* c can start token */
171#define intoken(c) (_itk[CHAR(c)]) /* c can be in token */ 168#define intoken(c) (_itk[CHAR(c)]) /* c can be in token */
172#define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens */ 169#define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens */
173 170
174#define ISALNUM(c) isalnum ((unsigned char) (c)) 171#define ISALNUM(c) isalnum (CHAR(c))
175#define ISALPHA(c) isalpha ((unsigned char) (c)) 172#define ISALPHA(c) isalpha (CHAR(c))
176#define ISDIGIT(c) isdigit ((unsigned char) (c)) 173#define ISDIGIT(c) isdigit (CHAR(c))
177#define ISLOWER(c) islower ((unsigned char) (c)) 174#define ISLOWER(c) islower (CHAR(c))
175
176#define lowcase(c) tolower (CHAR(c))
177#define upcase(c) toupper (CHAR(c))
178 178
179 179
180/* 180/*
@@ -208,6 +208,7 @@ typedef struct
208{ 208{
209 char *name; 209 char *name;
210 Lang_function *function; 210 Lang_function *function;
211 char **filenames;
211 char **suffixes; 212 char **suffixes;
212 char **interpreters; 213 char **interpreters;
213} language; 214} language;
@@ -254,14 +255,15 @@ static void Erlang_functions P_((FILE *));
254static void Fortran_functions P_((FILE *)); 255static void Fortran_functions P_((FILE *));
255static void Yacc_entries P_((FILE *)); 256static void Yacc_entries P_((FILE *));
256static void Lisp_functions P_((FILE *)); 257static void Lisp_functions P_((FILE *));
258static void Makefile_targets P_((FILE *));
257static void Pascal_functions P_((FILE *)); 259static void Pascal_functions P_((FILE *));
258static void Perl_functions P_((FILE *)); 260static void Perl_functions P_((FILE *));
259static void Postscript_functions P_((FILE *)); 261static void Postscript_functions P_((FILE *));
260static void Prolog_functions P_((FILE *)); 262static void Prolog_functions P_((FILE *));
261static void Python_functions P_((FILE *)); 263static void Python_functions P_((FILE *));
262static void Scheme_functions P_((FILE *)); 264static void Scheme_functions P_((FILE *));
263static void TeX_functions P_((FILE *)); 265static void TeX_commands P_((FILE *));
264static void Texinfo_functions P_ ((FILE *)); 266static void Texinfo_nodes P_((FILE *));
265static void just_read_file P_((FILE *)); 267static void just_read_file P_((FILE *));
266 268
267static void print_language_names P_((void)); 269static void print_language_names P_((void));
@@ -271,9 +273,9 @@ int main P_((int, char **));
271static int number_len P_((long)); 273static int number_len P_((long));
272 274
273static compressor *get_compressor_from_suffix P_((char *, char **)); 275static compressor *get_compressor_from_suffix P_((char *, char **));
274static language *get_language_from_name P_((char *)); 276static language *get_language_from_langname P_((char *));
275static language *get_language_from_interpreter P_((char *)); 277static language *get_language_from_interpreter P_((char *));
276static language *get_language_from_suffix P_((char *)); 278static language *get_language_from_filename P_((char *));
277static int total_size_of_entries P_((node *)); 279static int total_size_of_entries P_((node *));
278static long readline P_((linebuffer *, FILE *)); 280static long readline P_((linebuffer *, FILE *));
279static long readline_internal P_((linebuffer *, FILE *)); 281static long readline_internal P_((linebuffer *, FILE *));
@@ -476,7 +478,7 @@ char *default_C_suffixes [] =
476 { "c", "h", NULL }; 478 { "c", "h", NULL };
477 479
478char *Cplusplus_suffixes [] = 480char *Cplusplus_suffixes [] =
479 { "C", "H", "c++", "cc", "cpp", "cxx", "h++", "hh", "hpp", "hxx", 481 { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
480 "M", /* Objective C++ */ 482 "M", /* Objective C++ */
481 "pdb", /* Postscript with C syntax */ 483 "pdb", /* Postscript with C syntax */
482 NULL }; 484 NULL };
@@ -497,7 +499,10 @@ char *Fortran_suffixes [] =
497 { "F", "f", "f90", "for", NULL }; 499 { "F", "f", "f90", "for", NULL };
498 500
499char *Lisp_suffixes [] = 501char *Lisp_suffixes [] =
500 { "cl", "clisp", "el", "l", "lisp", "lsp", "ml", "LSP", NULL }; 502 { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
503
504char *Makefile_filenames [] =
505 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
501 506
502char *Pascal_suffixes [] = 507char *Pascal_suffixes [] =
503 { "p", "pas", NULL }; 508 { "p", "pas", NULL };
@@ -508,9 +513,9 @@ char *Perl_interpreters [] =
508 { "perl", "@PERL@", NULL }; 513 { "perl", "@PERL@", NULL };
509 514
510char *plain_C_suffixes [] = 515char *plain_C_suffixes [] =
511 { "pc", /* Pro*C file */ 516 { "lm", /* Objective lex file */
512 "m", /* Objective C file */ 517 "m", /* Objective C file */
513 "lm", /* Objective lex file */ 518 "pc", /* Pro*C file */
514 NULL }; 519 NULL };
515 520
516char *Postscript_suffixes [] = 521char *Postscript_suffixes [] =
@@ -524,16 +529,16 @@ char *Python_suffixes [] =
524 529
525/* Can't do the `SCM' or `scm' prefix with a version number. */ 530/* Can't do the `SCM' or `scm' prefix with a version number. */
526char *Scheme_suffixes [] = 531char *Scheme_suffixes [] =
527 { "SCM", "SM", "oak", "sch", "scheme", "scm", "sm", "ss", "t", NULL }; 532 { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
528 533
529char *TeX_suffixes [] = 534char *TeX_suffixes [] =
530 { "TeX", "bib", "clo", "cls", "ltx", "sty", "tex", NULL }; 535 { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
531 536
532char *Texinfo_suffixes [] = 537char *Texinfo_suffixes [] =
533 { "texi", "txi", "texinfo", NULL }; 538 { "texi", "texinfo", "txi", NULL };
534 539
535char *Yacc_suffixes [] = 540char *Yacc_suffixes [] =
536 { "y", "ym", "yy", "yxx", "y++", NULL }; /* .ym is Objective yacc file */ 541 { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */
537 542
538/* 543/*
539 * Table of languages. 544 * Table of languages.
@@ -544,26 +549,27 @@ char *Yacc_suffixes [] =
544 549
545language lang_names [] = 550language lang_names [] =
546{ 551{
547 { "ada", Ada_funcs, Ada_suffixes, NULL }, 552 { "ada", Ada_funcs, NULL, Ada_suffixes, NULL },
548 { "asm", Asm_labels, Asm_suffixes, NULL }, 553 { "asm", Asm_labels, NULL, Asm_suffixes, NULL },
549 { "c", default_C_entries, default_C_suffixes, NULL }, 554 { "c", default_C_entries, NULL, default_C_suffixes, NULL },
550 { "c++", Cplusplus_entries, Cplusplus_suffixes, NULL }, 555 { "c++", Cplusplus_entries, NULL, Cplusplus_suffixes, NULL },
551 { "c*", Cstar_entries, Cstar_suffixes, NULL }, 556 { "c*", Cstar_entries, NULL, Cstar_suffixes, NULL },
552 { "cobol", Cobol_paragraphs, Cobol_suffixes, NULL }, 557 { "cobol", Cobol_paragraphs, NULL, Cobol_suffixes, NULL },
553 { "erlang", Erlang_functions, Erlang_suffixes, NULL }, 558 { "erlang", Erlang_functions, NULL, Erlang_suffixes, NULL },
554 { "fortran", Fortran_functions, Fortran_suffixes, NULL }, 559 { "fortran", Fortran_functions, NULL, Fortran_suffixes, NULL },
555 { "java", Cjava_entries, Cjava_suffixes, NULL }, 560 { "java", Cjava_entries, NULL, Cjava_suffixes, NULL },
556 { "lisp", Lisp_functions, Lisp_suffixes, NULL }, 561 { "lisp", Lisp_functions, NULL, Lisp_suffixes, NULL },
557 { "pascal", Pascal_functions, Pascal_suffixes, NULL }, 562 { "makefile", Makefile_targets, Makefile_filenames, NULL, NULL },
558 { "perl", Perl_functions, Perl_suffixes, Perl_interpreters }, 563 { "pascal", Pascal_functions, NULL, Pascal_suffixes, NULL },
559 { "postscript", Postscript_functions, Postscript_suffixes, NULL }, 564 { "perl", Perl_functions, NULL, Perl_suffixes, Perl_interpreters },
560 { "proc", plain_C_entries, plain_C_suffixes, NULL }, 565 { "postscript", Postscript_functions, NULL, Postscript_suffixes, NULL },
561 { "prolog", Prolog_functions, Prolog_suffixes, NULL }, 566 { "proc", plain_C_entries, NULL, plain_C_suffixes, NULL },
562 { "python", Python_functions, Python_suffixes, NULL }, 567 { "prolog", Prolog_functions, NULL, Prolog_suffixes, NULL },
563 { "scheme", Scheme_functions, Scheme_suffixes, NULL }, 568 { "python", Python_functions, NULL, Python_suffixes, NULL },
564 { "tex", TeX_functions, TeX_suffixes, NULL }, 569 { "scheme", Scheme_functions, NULL, Scheme_suffixes, NULL },
565 { "texinfo", Texinfo_functions, Texinfo_suffixes, NULL }, 570 { "tex", TeX_commands, NULL, TeX_suffixes, NULL },
566 { "yacc", Yacc_entries, Yacc_suffixes, NULL }, 571 { "texinfo", Texinfo_nodes, NULL, Texinfo_suffixes, NULL },
572 { "yacc", Yacc_entries, NULL, Yacc_suffixes, NULL },
567 { "auto", NULL }, /* default guessing scheme */ 573 { "auto", NULL }, /* default guessing scheme */
568 { "none", just_read_file }, /* regexp matching only */ 574 { "none", just_read_file }, /* regexp matching only */
569 { NULL, NULL } /* end of list */ 575 { NULL, NULL } /* end of list */
@@ -988,7 +994,7 @@ main (argc, argv)
988 break; 994 break;
989 case 'l': 995 case 'l':
990 { 996 {
991 language *lang = get_language_from_name (optarg); 997 language *lang = get_language_from_langname (optarg);
992 if (lang != NULL) 998 if (lang != NULL)
993 { 999 {
994 argbuffer[current_arg].lang = lang; 1000 argbuffer[current_arg].lang = lang;
@@ -1251,7 +1257,7 @@ get_compressor_from_suffix (file, extptr)
1251 * Return a language given the name. 1257 * Return a language given the name.
1252 */ 1258 */
1253static language * 1259static language *
1254get_language_from_name (name) 1260get_language_from_langname (name)
1255 char *name; 1261 char *name;
1256{ 1262{
1257 language *lang; 1263 language *lang;
@@ -1297,12 +1303,20 @@ get_language_from_interpreter (interpreter)
1297 * Return a language given the file name. 1303 * Return a language given the file name.
1298 */ 1304 */
1299static language * 1305static language *
1300get_language_from_suffix (file) 1306get_language_from_filename (file)
1301 char *file; 1307 char *file;
1302{ 1308{
1303 language *lang; 1309 language *lang;
1304 char **ext, *suffix; 1310 char **name, **ext, *suffix;
1311
1312 /* Try whole file name first. */
1313 for (lang = lang_names; lang->name != NULL; lang++)
1314 if (lang->filenames != NULL)
1315 for (name = lang->filenames; *name != NULL; name++)
1316 if (streq (*name, file))
1317 return lang;
1305 1318
1319 /* If not found, try suffix after last dot. */
1306 suffix = etags_strrchr (file, '.'); 1320 suffix = etags_strrchr (file, '.');
1307 if (suffix == NULL) 1321 if (suffix == NULL)
1308 return NULL; 1322 return NULL;
@@ -1530,7 +1544,7 @@ find_entries (file, inf)
1530 } 1544 }
1531 1545
1532 /* Try to guess the language given the file name. */ 1546 /* Try to guess the language given the file name. */
1533 lang = get_language_from_suffix (file); 1547 lang = get_language_from_filename (file);
1534 if (lang != NULL && lang->function != NULL) 1548 if (lang != NULL && lang->function != NULL)
1535 { 1549 {
1536 curlang = lang; 1550 curlang = lang;
@@ -1575,7 +1589,7 @@ find_entries (file, inf)
1575 1589
1576 /* Try Fortran. */ 1590 /* Try Fortran. */
1577 old_last_node = last_node; 1591 old_last_node = last_node;
1578 curlang = get_language_from_name ("fortran"); 1592 curlang = get_language_from_langname ("fortran");
1579 Fortran_functions (inf); 1593 Fortran_functions (inf);
1580 1594
1581 /* No Fortran entries found. Try C. */ 1595 /* No Fortran entries found. Try C. */
@@ -1584,7 +1598,7 @@ find_entries (file, inf)
1584 /* We do not tag if rewind fails. 1598 /* We do not tag if rewind fails.
1585 Only the file name will be recorded in the tags file. */ 1599 Only the file name will be recorded in the tags file. */
1586 rewind (inf); 1600 rewind (inf);
1587 curlang = get_language_from_name (cplusplus ? "c++" : "c"); 1601 curlang = get_language_from_langname (cplusplus ? "c++" : "c");
1588 default_C_entries (inf); 1602 default_C_entries (inf);
1589 } 1603 }
1590 return; 1604 return;
@@ -3854,6 +3868,27 @@ Cobol_paragraphs (inf)
3854 } 3868 }
3855} 3869}
3856 3870
3871/*
3872 * Makefile support
3873 */
3874static void
3875Makefile_targets (inf)
3876 FILE *inf;
3877{
3878 register char *bp;
3879
3880 LOOP_ON_INPUT_LINES (inf, lb, bp)
3881 {
3882 if (*bp == '\t' || *bp == '#')
3883 continue;
3884 while (*bp != '\0' && *bp != '=' && *bp != ':')
3885 bp++;
3886 if (*bp == ':')
3887 pfnote (savenstr (lb.buffer, bp - lb.buffer), TRUE,
3888 lb.buffer, bp - lb.buffer + 1, lineno, linecharno);
3889 }
3890}
3891
3857/* Added by Mosur Mohan, 4/22/88 */ 3892/* Added by Mosur Mohan, 4/22/88 */
3858/* Pascal parsing */ 3893/* Pascal parsing */
3859 3894
@@ -4239,7 +4274,7 @@ char TEX_clgrp = '}';
4239 * TeX/LaTeX scanning loop. 4274 * TeX/LaTeX scanning loop.
4240 */ 4275 */
4241static void 4276static void
4242TeX_functions (inf) 4277TeX_commands (inf)
4243 FILE *inf; 4278 FILE *inf;
4244{ 4279{
4245 char *cp, *lasthit; 4280 char *cp, *lasthit;
@@ -4391,23 +4426,24 @@ TEX_Token (cp)
4391 4426
4392/* Texinfo support. Dave Love, Mar. 2000. */ 4427/* Texinfo support. Dave Love, Mar. 2000. */
4393static void 4428static void
4394Texinfo_functions (inf) 4429Texinfo_nodes (inf)
4395 FILE * inf; 4430 FILE * inf;
4396{ 4431{
4397 char *cp, *start; 4432 char *cp, *start;
4398 LOOP_ON_INPUT_LINES (inf, lb, cp) 4433 LOOP_ON_INPUT_LINES (inf, lb, cp)
4399 { 4434 {
4400 if ((*cp++ == '@' && *cp++ == 'n' && *cp++ == 'o' && *cp++ == 'd' 4435 if ((*cp++ == '@'
4401 && *cp++ == 'e' && iswhite (*cp++))) 4436 && *cp++ == 'n'
4437 && *cp++ == 'o'
4438 && *cp++ == 'd'
4439 && *cp++ == 'e' && iswhite (*cp++)))
4402 { 4440 {
4403 while (iswhite (*cp)) 4441 start = cp = skip_spaces(cp);
4404 cp++; 4442 while (*cp != '\0' && *cp != ',')
4405 start = cp; 4443 cp++;
4406 while (*cp != '\0' && *cp != ',') 4444 pfnote (savenstr (start, cp - start), TRUE,
4407 cp++; 4445 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4408 pfnote (savenstr (start, cp - start), TRUE, 4446 }
4409 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4410 }
4411 } 4447 }
4412} 4448}
4413 4449
@@ -4859,7 +4895,7 @@ analyse_regex (regex_arg, ignore_case)
4859 return; 4895 return;
4860 } 4896 }
4861 *cp = '\0'; 4897 *cp = '\0';
4862 lang = get_language_from_name (lang_name); 4898 lang = get_language_from_langname (lang_name);
4863 if (lang == NULL) 4899 if (lang == NULL)
4864 return; 4900 return;
4865 add_regex (cp + 1, ignore_case, lang); 4901 add_regex (cp + 1, ignore_case, lang);
@@ -5490,8 +5526,8 @@ canonicalize_filename (fn)
5490{ 5526{
5491#ifdef DOS_NT 5527#ifdef DOS_NT
5492 /* Canonicalize drive letter case. */ 5528 /* Canonicalize drive letter case. */
5493 if (fn[0] && fn[1] == ':' && ISLOWER (fn[0])) 5529 if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0]))
5494 fn[0] = UPCASE (fn[0]); 5530 fn[0] = upcase (fn[0]);
5495 /* Convert backslashes to slashes. */ 5531 /* Convert backslashes to slashes. */
5496 for (; *fn != '\0'; fn++) 5532 for (; *fn != '\0'; fn++)
5497 if (*fn == '\\') 5533 if (*fn == '\\')