diff options
| author | Francesco Potortì | 2001-01-14 20:48:05 +0000 |
|---|---|---|
| committer | Francesco Potortì | 2001-01-14 20:48:05 +0000 |
| commit | 89d57763af3564887725b721a8f45b7ce4dcd81f (patch) | |
| tree | 2fab16b3fc8dfc7a86370f0ded870909bc1b7ab8 /lib-src | |
| parent | 8d7ff9c80866921180302a7903807454b8d1f00e (diff) | |
| download | emacs-89d57763af3564887725b721a8f45b7ce4dcd81f.tar.gz emacs-89d57763af3564887725b721a8f45b7ce4dcd81f.zip | |
Changes for makefile support in etags.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.1 | 132 | ||||
| -rw-r--r-- | lib-src/etags.c | 162 |
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 | |||
| 40 | format understood by | 49 | format 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 |
| 43 | the syntax of C, Objective C, C++, Java, Fortran, Pascal, Cobol, | 52 | the syntax of C, Objective C, C++, Java, Fortran, Pascal, Cobol, Ada, Perl, |
| 44 | LaTeX, Scheme, Emacs Lisp/Common Lisp, Postscript, Erlang, Prolog and | 53 | LaTeX, Scheme, Emacs Lisp/Common Lisp, Postscript, Erlang, Python, Prolog and |
| 45 | most assembler\-like syntaxes. | 54 | most assembler\-like syntaxes. |
| 46 | Both forms read the files specified on the command line, and write a tag | 55 | Both forms read the files specified on the command line, and write a tag |
| 47 | table (defaults: `\|TAGS\|' for \fBetags\fP, `\|tags\|' for | 56 | table (defaults: `\|TAGS\|' for \fBetags\fP, `\|tags\|' for |
| @@ -77,49 +86,73 @@ Treat files with `\|.c\|' and `\|.h\|' extensions as C++ code, not C | |||
| 77 | code. Files with `\|.C\|', `\|.H\|', `\|.cxx\|', `\|.hxx\|', or | 86 | code. 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 | ||
| 90 | In C and derived languages, create tags for function declarations, | ||
| 91 | and create tags for extern variables unless \-\-no\-globals is used. | ||
| 92 | .TP | ||
| 80 | .B \-d, \-\-defines | 93 | .B \-d, \-\-defines |
| 81 | Create tag entries for C preprocessor constant definitions | 94 | Create tag entries for C preprocessor constant definitions |
| 82 | and enum constants, too. This is the | 95 | and enum constants, too. This is the |
| 83 | default behavior for \fBetags\fP, so this option is only accepted | 96 | default behavior for \fBetags\fP. |
| 84 | by \fBctags\fP. | ||
| 85 | .TP | 97 | .TP |
| 86 | .B \-D, \-\-no\-defines | 98 | .B \-D, \-\-no\-defines |
| 87 | Do not create tag entries for C preprocessor constant definitions | 99 | Do not create tag entries for C preprocessor constant definitions |
| 88 | and enum constants. | 100 | and enum constants. |
| 89 | This may make the tags file much smaller if many header files are tagged. | 101 | This may make the tags file much smaller if many header files are tagged. |
| 90 | This is the default behavior for \fBctags\fP, so this option is only | 102 | This is the default behavior for \fBctags\fP. |
| 91 | accepted by \fBetags\fP. | 103 | .TP |
| 104 | .B \-g, \-\-globals | ||
| 105 | Create tag entries for global variables in C, C++, Objective C, Java, | ||
| 106 | and Perl. | ||
| 107 | This is the default behavior for \fBetags\fP. | ||
| 108 | .TP | ||
| 109 | .B \-G, \-\-no\-globals | ||
| 110 | Do not tag global variables. Typically this reduces the file size by | ||
| 111 | one fourth. This is the default behavior for \fBctags\fP. | ||
| 112 | .TP | ||
| 113 | \fB\-i\fP \fIfile\fP, \fB\-\-include=\fIfile\fP | ||
| 114 | Include a note in the tag file indicating that, when searching for a | ||
| 115 | tag, one should also consult the tags file \fIfile\fP after checking the | ||
| 116 | current file. This options is only accepted by \fBetags\fP. | ||
| 117 | .TP | ||
| 118 | .B \-I, \-\-ignore\-indentation | ||
| 119 | Don't rely on indentation as much as we normally do. Currently, this | ||
| 120 | means not to assume that a closing brace in the first column is the | ||
| 121 | final 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 |
| 94 | Parse the following files according to the given language. More than | 124 | Parse the following files according to the given language. More than |
| 95 | one such options may be intermixed with filenames. Use \fB\-\-help\fP | 125 | one such options may be intermixed with filenames. Use \fB\-\-help\fP |
| 96 | to get a list of the available languages and their default filename | 126 | to get a list of the available languages and their default filename |
| 97 | extensions. The `auto' language can be used to restore automatic | 127 | extensions. The `auto' language can be used to restore automatic |
| 98 | detection of language based on filename extension. The `none' | 128 | detection of language based on the file name. The `none' |
| 99 | language may be used to disable language parsing altogether; only | 129 | language may be used to disable language parsing altogether; only |
| 100 | regexp matching is done in this case (see the \fB\-\-regex\fP option). | 130 | regexp 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 |
| 103 | Do not tag global variables in C, C++, Objective C, Java. Typically | 133 | Create tag entries for variables that are members of structure-like |
| 104 | this reduces the file size by one fourth. | 134 | constructs in C++, Objective C, Java. |
| 105 | .TP | 135 | .TP |
| 106 | \fB\-\-members\fP | 136 | .B \-M, \-\-no\-members |
| 107 | Tag variables that are members of strucure-like constructs in C++, | 137 | Do not tag member variables. This is the default behavior. |
| 108 | Objective C, Java. | 138 | .TP |
| 139 | .B \-\-packages\-only | ||
| 140 | Only 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 |
| 111 | Explicit name of file for tag table; overrides default `\|TAGS\|' or | 143 | Explicit 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 |
| 115 | Make tags based on regexp matching for each line of the files | 147 | \fB\-\-ignore\-case\-regex=\fIregexp\fP\ |
| 116 | following this option, in addition to the tags made with the standard | 148 | Make tags based on regexp matching for each line of the files following |
| 117 | parsing based on language. May be freely intermixed with filenames | 149 | this option, in addition to the tags made with the standard parsing based |
| 118 | and the \fB\-R\fP option. The regexps are cumulative, i.e. each | 150 | on language. When using \-\-regex, case is significant, while it is not |
| 119 | option will add to the previous ones. The regexps are of the form: | 151 | with \-\-ignore\-case\-regex. May be freely intermixed with filenames and |
| 152 | the \fB\-R\fP option. The regexps are cumulative, i.e. each option will | ||
| 153 | add 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 | ||
| 125 | where \fItagregexp\fP is used to match the lines that must be tagged. | 158 | where \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 | |||
| 127 | such that more characters than needed are unavoidably matched by | 160 | such 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 |
| 129 | narrow down the tag scope. \fBctags\fP ignores regexps without a | 162 | narrow 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, |
| 131 | augmented with intervals of the form \\{m,n\\}, as id ed or grep. | 164 | augmented with intervals of the form \\{m,n\\}, as in ed or grep. |
| 132 | .br | 165 | .br |
| 133 | Here are some examples. All the regexps are quoted to protect them | 166 | Here are some examples. All the regexps are quoted to protect them |
| 134 | from shell interpretation. | 167 | from 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 | ||
| 189 | A regexp can be preceded by {lang}, thus restriciting it to match lines of | ||
| 190 | files of the specified language. Use \fBetags --help\bP to obtain a list | ||
| 191 | of the recognised languages. This feature is particularly useful inside | ||
| 192 | \fBregex files\fB. A regex file contains one regex per line. Empty lines, | ||
| 193 | and those lines beginning with space or tab are ignored. Lines beginning | ||
| 194 | with @ are references to regex files whose name follows the @ sign. Other | ||
| 195 | lines are considered regular expressions like those following \-\-regex. | ||
| 196 | .br | ||
| 197 | For example, the command | ||
| 198 | .br | ||
| 199 | etags \-\-regex=@regex.file *.c | ||
| 200 | .br | ||
| 201 | reads the regexes contained in the file regex.file. | ||
| 155 | .TP | 202 | .TP |
| 156 | .B \-R, \-\-no\-regex | 203 | .B \-R, \-\-no\-regex |
| 157 | Don't do any more regexp matching on the following files. May be | 204 | Don't do any more regexp matching on the following files. May be |
| 158 | freely intermixed with filenames and the \fB\-\-regex\fP option. | 205 | freely intermixed with filenames and the \fB\-\-regex\fP option. |
| 159 | .TP | 206 | .TP |
| 160 | .B \-S, \-\-ignore\-indentation | ||
| 161 | Don't rely on indentation as much as we normally do. Currently, this | ||
| 162 | means not to assume that a closing brace in the first column is the | ||
| 163 | final brace of a function or structure definition in C and C++. | ||
| 164 | .TP | ||
| 165 | .B \-t, \-\-typedefs | 207 | .B \-t, \-\-typedefs |
| 166 | Record typedefs in C code as tags. Since this is the default behaviour | 208 | Record typedefs in C code as tags. Since this is the default behaviour |
| 167 | of \fBetags\fP, only \fBctags\fP accepts this option. | 209 | of \fBetags\fP, only \fBctags\fP accepts this option. |
| @@ -192,7 +234,7 @@ allowed with it. | |||
| 192 | Instead of generating a tag file, write a cross reference (in | 234 | Instead 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 |
| 196 | Print usage information. | 238 | Print 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 |
| 212 | Copyright (c) 1992 Free Software Foundation, Inc. | 254 | Copyright (c) 1999 Free Software Foundation, Inc. |
| 213 | .PP | 255 | .PP |
| 214 | Permission is granted to make and distribute verbatim copies of | 256 | Permission is granted to make and distribute verbatim copies of |
| 215 | this manual provided the copyright notice and this permission notice | 257 | this 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 | ||
| 34 | char pot_etags_version[] = "@(#) pot revision number is 13.44"; | 34 | char 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 *)); | |||
| 254 | static void Fortran_functions P_((FILE *)); | 255 | static void Fortran_functions P_((FILE *)); |
| 255 | static void Yacc_entries P_((FILE *)); | 256 | static void Yacc_entries P_((FILE *)); |
| 256 | static void Lisp_functions P_((FILE *)); | 257 | static void Lisp_functions P_((FILE *)); |
| 258 | static void Makefile_targets P_((FILE *)); | ||
| 257 | static void Pascal_functions P_((FILE *)); | 259 | static void Pascal_functions P_((FILE *)); |
| 258 | static void Perl_functions P_((FILE *)); | 260 | static void Perl_functions P_((FILE *)); |
| 259 | static void Postscript_functions P_((FILE *)); | 261 | static void Postscript_functions P_((FILE *)); |
| 260 | static void Prolog_functions P_((FILE *)); | 262 | static void Prolog_functions P_((FILE *)); |
| 261 | static void Python_functions P_((FILE *)); | 263 | static void Python_functions P_((FILE *)); |
| 262 | static void Scheme_functions P_((FILE *)); | 264 | static void Scheme_functions P_((FILE *)); |
| 263 | static void TeX_functions P_((FILE *)); | 265 | static void TeX_commands P_((FILE *)); |
| 264 | static void Texinfo_functions P_ ((FILE *)); | 266 | static void Texinfo_nodes P_((FILE *)); |
| 265 | static void just_read_file P_((FILE *)); | 267 | static void just_read_file P_((FILE *)); |
| 266 | 268 | ||
| 267 | static void print_language_names P_((void)); | 269 | static void print_language_names P_((void)); |
| @@ -271,9 +273,9 @@ int main P_((int, char **)); | |||
| 271 | static int number_len P_((long)); | 273 | static int number_len P_((long)); |
| 272 | 274 | ||
| 273 | static compressor *get_compressor_from_suffix P_((char *, char **)); | 275 | static compressor *get_compressor_from_suffix P_((char *, char **)); |
| 274 | static language *get_language_from_name P_((char *)); | 276 | static language *get_language_from_langname P_((char *)); |
| 275 | static language *get_language_from_interpreter P_((char *)); | 277 | static language *get_language_from_interpreter P_((char *)); |
| 276 | static language *get_language_from_suffix P_((char *)); | 278 | static language *get_language_from_filename P_((char *)); |
| 277 | static int total_size_of_entries P_((node *)); | 279 | static int total_size_of_entries P_((node *)); |
| 278 | static long readline P_((linebuffer *, FILE *)); | 280 | static long readline P_((linebuffer *, FILE *)); |
| 279 | static long readline_internal P_((linebuffer *, FILE *)); | 281 | static long readline_internal P_((linebuffer *, FILE *)); |
| @@ -476,7 +478,7 @@ char *default_C_suffixes [] = | |||
| 476 | { "c", "h", NULL }; | 478 | { "c", "h", NULL }; |
| 477 | 479 | ||
| 478 | char *Cplusplus_suffixes [] = | 480 | char *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 | ||
| 499 | char *Lisp_suffixes [] = | 501 | char *Lisp_suffixes [] = |
| 500 | { "cl", "clisp", "el", "l", "lisp", "lsp", "ml", "LSP", NULL }; | 502 | { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; |
| 503 | |||
| 504 | char *Makefile_filenames [] = | ||
| 505 | { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; | ||
| 501 | 506 | ||
| 502 | char *Pascal_suffixes [] = | 507 | char *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 | ||
| 510 | char *plain_C_suffixes [] = | 515 | char *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 | ||
| 516 | char *Postscript_suffixes [] = | 521 | char *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. */ |
| 526 | char *Scheme_suffixes [] = | 531 | char *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 | ||
| 529 | char *TeX_suffixes [] = | 534 | char *TeX_suffixes [] = |
| 530 | { "TeX", "bib", "clo", "cls", "ltx", "sty", "tex", NULL }; | 535 | { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; |
| 531 | 536 | ||
| 532 | char *Texinfo_suffixes [] = | 537 | char *Texinfo_suffixes [] = |
| 533 | { "texi", "txi", "texinfo", NULL }; | 538 | { "texi", "texinfo", "txi", NULL }; |
| 534 | 539 | ||
| 535 | char *Yacc_suffixes [] = | 540 | char *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 | ||
| 545 | language lang_names [] = | 550 | language 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 | */ |
| 1253 | static language * | 1259 | static language * |
| 1254 | get_language_from_name (name) | 1260 | get_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 | */ |
| 1299 | static language * | 1305 | static language * |
| 1300 | get_language_from_suffix (file) | 1306 | get_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 | */ | ||
| 3874 | static void | ||
| 3875 | Makefile_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 | */ |
| 4241 | static void | 4276 | static void |
| 4242 | TeX_functions (inf) | 4277 | TeX_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. */ |
| 4393 | static void | 4428 | static void |
| 4394 | Texinfo_functions (inf) | 4429 | Texinfo_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 == '\\') |