⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ctags.1

📁 ultraEdit的Ctag标签工具的实现源代码
💻 1
📖 第 1 页 / 共 4 页
字号:
.TH CTAGS 1 "Version 5.5.4" "Darren Hiebert" "Exuberant Ctags"


.SH "NAME"
ctags \- Generate tag files for source code


.SH SYNOPSIS
.TP 6
\fBctags\fP [\fBoptions\fP] [\fIfile(s)\fP]
.TP 6
\fBetags\fP [\fBoptions\fP] [\fIfile(s)\fP]


.SH "DESCRIPTION"
The \fBctags\fP and \fBetags\fP programs (hereinafter collectively referred to
as \fBctags\fP, except where distinguished) generate an index (or "tag") file
for a variety of language objects found in \fIfile(s)\fP.
This tag file allows these items to be quickly and easily located by a text
editor or other utility. A "tag" signifies a language object for which an
index entry is available (or, alternatively, the index entry created for that
object).

Alternatively, \fBctags\fP can generate a cross reference file which lists, in
human readable form, information about the various source objects found in a
set of language files.

Tag index files are supported by numerous editors, which allow the user to
locate the object associated with a name appearing in a source file and jump
to the file and line which defines the name. Those known about at the time of
this release are:

.RS 4
\fBVi\fP(1) and its derivatives (e.g. Elvis, Vim, Vile, Lemmy),
\fBCRiSP\fP,
\fBEmacs\fP,
\fBFTE\fP (Folding Text Editor),
\fBJED\fP,
\fBjEdit\fP,
\fBMined\fP,
\fBNEdit\fP (Nirvana Edit),
\fBTSE\fP (The SemWare Editor),
\fBUltraEdit\fP,
\fBWorkSpace\fP,
\fBX2\fP,
\fBZeus\fP
.RE

\fBCtags\fP is capable of generating different kinds of tags for each of many
different languages. For a complete list of supported languages, the names
by which they are recognized, and the kinds of tags which are generated for
each, see the \fB--list-languages\fP and \fB--list-kinds\fP options.


.SH "SOURCE FILES"

Unless the \fB--language-force\fP option is specified, the language of each
source file is automatically selected based upon a mapping of file names to
languages. The mappings in effect for each language may be display using the
\fB--list-maps\fP option and may be changed using the \fB--langmap\fP option.
On platforms which support it, if the name of a file is not mapped
to a language and the file is executable, the first line of the file is
checked to see if the file is a "#!" script for a recognized language.

By default, all other files names are ignored. This permits running
\fBctags\fP on all files in either a single directory (e.g. "ctags *"), or on
all files in an entire source directory tree (e.g. "ctags -R"), since only
those files whose names are mapped to languages will be scanned.

[The reason that .h extensions are mapped to C++ files rather than C files
is because it is common to use .h extensions in C++, and no harm results in
treating them as C++ files.]


.SH "OPTIONS"

Despite the wealth of available options, defaults are set so that \fBctags\fP
is most commonly executed without any options (e.g. "ctags *", or "ctags -R"),
which will create a tag file in the current directory for all recognized
source files. The options described below are provided merely to allow custom
tailoring to meet special needs.

Note that spaces separating the single-letter options from their parameters
are optional.

Note also that the boolean parameters to the long form options (those
beginning with "--" and that take a "\fI[=yes\fP|\fIno]\fP" parameter) may
be omitted, in which case "\fB=\fP\fIyes\fP" is implied. (e.g. \fB--sort\fP
is equivalent to \fB--sort\fP=\fIyes\fP). Note further that "=\fI1\fP" and
"=\fIon\fP" are considered synonyms for "=\fIyes\fP", and that "=\fI0\fP"
and "=\fIoff\fP" are considered synonyms for "=\fIno\fP".

Some options are either ignored or useful only when used while running in
etags mode (see \fB-e\fP option). Such options will be noted.

Most options may appear anywhere on the command line, affecting only those
files which follow the option. A few options, however, must appear before the
first file name and will be noted as such.

Options taking language names will accept those names in either upper or lower
case. See the \fB--list-languages\fP option for a complete list of the
built-in language names.

.TP 5
.B \-a
Equivalent to \fB--append\fP.

.TP 5
.B \-B
Use backward searching patterns (e.g. ?pattern?). [Ignored in etags mode]

.TP 5
.B \-e
Enable etags mode, which will create a tag file for use with the Emacs editor.
Alternatively, if \fBctags\fP is invoked by a name containing the string
"etags" (either by renaming, or creating a link to, the executable), etags
mode will be enabled. This option must appear before the first file name.

.TP 5
.BI \-f " tagfile"
Use the name specified by \fItagfile\fP for the tag file (default is "tags",
or "TAGS" when running in etags mode). If \fItagfile\fP is specified as
"-", then the tag file is written to standard output instead. \fBCtags\fP
will stubbornly refuse to take orders if \fItagfile\fP exists and its first
line contains something other than a valid tags line. This will save your neck
if you mistakenly type "ctags -f *.c", which would otherwise overwrite your
first C file with the tags generated by the rest! It will also refuse to
accept a multi character file name which begins with a '-' (dash) character,
since this most likely means that you left out the tag file name and this
option tried to grab the next option as the file name. If you really want to
name your output tag file "-ugly", specify it as "./-ugly". This option must
appear before the first file name. If this option is specified more than once,
only the last will apply.

.TP 5
.B \-F
Use forward searching patterns (e.g. /pattern/) (default).
[Ignored in etags mode]

.TP 5
.BI \-h  " list"
Specifies a list of file extensions, separated by periods, which are to be
interpreted as include (or header) files. To indicate files having no
extension, use a period not followed by a non-period character (e.g. ".",
"..x", ".x."). This option only affects how the scoping of a particular kinds
of tags is interpreted (i.e. whether or not they are considered as globally
visible or visible only within the file in which they are defined); it does
not map the extension to any particular language. Any tag which is located in
a non-include file and cannot be seen (e.g. linked to) from another file is
considered to have file-limited (e.g. static) scope. No kind of tag appearing
in an include file will be considered to have file-limited scope. If the first
character in the list is a plus sign, then the extensions in the list will be
appended to the current list; otherwise, the list will replace the current
list. See, also, the \fB--file-scope\fP option. The default list is
".h.H.hh.hpp.hxx.h++.inc.def". To restore the default list, specify \fB-h\fP
\fIdefault\fP. Note that if an extension supplied to this option is not
already mapped to a particular language (see \fBSOURCE FILES\fP, above), you
will also need to use either the \fB--langmap\fP or \fB--language-force\fP
option.

.TP 5
.BI \-I " identifier-list"
Specifies a list of identifiers which are to be specially handled while
parsing C and C++ source files. This option is specifically provided to handle
special cases arising through the use of preprocessor macros. When the
identifiers listed are simple identifiers, these identifiers will be ignored
during parsing of the source files. If an identifier is suffixed with a '+'
character, \fBctags\fP will also ignore any parenthesis-enclosed argument list
which may immediately follow the identifier in the source files. If two
identifiers are separated with the '=' character, the first identifiers is
replaced by the second identifiers for parsing purposes. The list of
identifiers may be supplied directly on the command line or read in from a
separate file. If the first character of \fIidentifier-list\fP is '@', '.' or
a pathname separator ('/' or '\\'), or the first two characters specify a
drive letter (e.g. "C:"), the parameter \fIidentifier-list\fP will be
interpreted as a filename from which to read a list of identifiers, one per
input line. Otherwise, \fIidentifier-list\fP is a list of identifiers (or
identifier pairs) to be specially handled, each delimited by a either a comma
or by white space (in which case the list should be quoted to keep the entire
list as one command line argument). Multiple \fB-I\fP options may be supplied.
To clear the list of ignore identifiers, supply a single dash ("-") for
\fIidentifier-list\fP.

This feature is useful when preprocessor macros are used in such a way that
they cause syntactic confusion due to their presence. Indeed, this is the best
way of working around a number of problems caused by the presence of
syntax-busting macros in source files (see \fBCAVEATS\fP, below). Some
examples will illustrate this point.

.RS 8
int foo ARGDECL4(void *, ptr, long int, nbytes)
.RE

.IP
In the above example, the macro "ARGDECL4" would be mistakenly interpreted to
be the name of the function instead of the correct name of "foo". Specifying
\fB-I\fP \fIARGDECL4\fP results in the correct behavior.

.RS 8
/* creates an RCS version string in module */
.br
MODULE_VERSION("$Revision: 1.38 $")
.RE

.IP
In the above example the macro invocation looks too much like a function
definition because it is not followed by a semicolon (indeed, it could even be
followed by a global variable definition that would look much like a K&R style
function parameter declaration). In fact, this seeming function definition
could possibly even cause the rest of the file to be skipped over while trying
to complete the definition. Specifying \fB-I\fP \fIMODULE_VERSION+\fP would
avoid such a problem.

.RS 8
CLASS Example {
.br
    // your content here
.br
};
.RE

.IP
The example above uses "CLASS" as a preprocessor macro which expands to
something different for each platform. For instance CLASS may be defined as
"class __declspec(dllexport)" on Win32 platforms and simply "class" on UNIX.
Normally, the absence of the C++ keyword "class" would cause the source file
to be incorrectly parsed. Correct behavior can be restored by specifying
\fB-I\fP \fICLASS=class\fP.

.TP 5
.BI \-L " file"
Read from \fIfile\fP a list of file names for which tags should be generated.
If \fIfile\fP is specified as "-", then file names are read from standard
input. File names read using this option are processed following file names
appearing on the command line. Options all also accepted in this input. If
this option is specified more than once, only the last will apply. \fBNote:\fP
\fIfile\fP is read in line-oriented mode, where a new line is the only
delimiter and spaces are considered significant, in order that file names
containing spaces may be supplied; this can affect how options are parsed if
included in the input.

.TP 5
.B \-n
Equivalent to \fB--excmd\fP=\fInumber\fP.

.TP 5
.B \-N
Equivalent to \fB--excmd\fP=\fIpattern\fP.

.TP 5
.BI \-o " tagfile"
Equivalent to \fB-f\fP \fItagfile\fP.

.TP 5
.B \-R
Equivalent to \fB--recurse\fP.

.TP 5
.B \-u
Equivalent to \fB--sort\fP=\fIno\fP (i.e. "unsorted").

.TP 5
.B \-V
Equivalent to \fB--verbose\fP.

.TP 5
.B \-w
This option is silently ignored for backward-compatibility with the ctags
of SVR4 Unix.

.TP 5
.B \-x
Print a tabular, human-readable cross reference (xref) file to standard output
instead of generating a tag file. The information contained in the output
includes: the tag name; the kind of tag; the line number, file name, and
source line (with extra white space condensed) of the file which defines the
tag. No tag file is written and all options affecting tag file output will be
ignored. Example applications for this feature are generating a listing of all
functions located in a source file (e.g. \fBctags -x --c-kinds\fP=\fIf\fP
\fIfile\fP), or generating a list of all externally visible global variables
located in a source file (e.g. \fBctags -x --c-kinds\fP=\fIv\fP
\fB--file-scope\fP=\fIno file\fP). This option must appear before the first
file name.

.TP 5
\fB--append\fP[=\fIyes\fP|\fIno\fP]
Indicates whether tags generated from the specified files should be appended
to those already present in the tag file or should replace them. This option
is off by default. This option must appear before the first file name.

.TP 5
\fB--etags-include\fP=\fIfile\fP
Include a reference to \fIfile\fP in the tag file. This option may be
specified as many times as desired. This supports Emacs' capability to use a
tag file which "includes" other tag files. [Available only in etags mode]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -