up | Inhaltsverzeichniss | Kommentar

Manual page for CTAGS(1)

ctags - create a tags file

SYNOPSIS

ctags [ -abdgmrstuvwx ][ -f infile ][ -o output ][ -n maxrefs ] files ...

DESCRIPTION

Ctags creates a file called tags from the specified C, Objective-C, Yacc, Lex, Pascal, Fortran or Lisp source files. The tags file is a sorted index giving the locations of object declarations in files, as well as type information, cross references, etc. Objects include functions, procedures, global variables, macros, structs, typedefs, yacc tokens, methods, and classes. This information is used by ptags(1), and by the editors ex and vi to quickly find object declarations and trace calling relationships. Each line in the tags file contains the object name, the file in which it is declared, a location (regular expression or line number), the type of the object (function, macro, typedef, struct, global, method, class, null), the length of the object (in lines), a caller reference list, and a callee reference list. Fields are separated by whitespace (except for the address and the rest of the line, which are separated by "; to fool vi(1)), and caller/callee lists are enclosed in braces. Files whose names end in .c or .h are assumed to be C source files; .m are assumed to be Objective-C source files; .l implies Lisp or Lex source; .y implies Yacc source; Others are scanned for Pascal or Fortran definitions; if none are found, C is assumed. Tags for main are treated specially in C programs: the tag is named Mfile, making ctags useful in directories with more than one main program. The first main function found is also tagged simply as ``main.'' Multiple links to a file are only indexed once.

OPTIONS

-a
add references to the tags file (don't overwrite it).
-b
use backward searching patterns (?...?, instead of the forward /.../ default).
-d
create index entries for duplicate declarations (duplicates are ignored by default, except for Objective-C).
-f infile
read input file names from infile.
-g
suppress tags for global variables.
-m
suppress tags for parameterless #define macros.
-n maxrefs
limit the length of callee/caller reference lists to maxrefs (60 by default). Longer lists are truncated, with (etc) ending the list.
-o
write tags to the file output (tags by default).
-r
suppress generation of caller/callee reference lists, and printing of object lengths.
-s
suppress tags for structs, unions, and enums
-t
suppress tags for typedefs (Note: the sense of this is reversed in older versions of ctags).
-u
update the specified files; that is, delete all old references in the tags file and append any new ones. (Note: simply rebuilding the tags file is usually faster.)
-v
write an index for vgrind.1 on the standard output. This listing contains object name, file name, and page number (64 line pages are assumed). Output is sorted lexicographically, so sort -f may be useful:
	ctags -v files | sort -f > index
	vgrind -x index
This option implies -g, -m, -r, -s, -t, and -x.
-w
suppress warning diagnostics.
-x
print a list containing object names, the line number and file in which each is defined, and the text of that line on the standard output. This is a simple index fit for humans. This option implies -g, -m, -r, -s, and -t.

FILES

tags output tags file

SEE ALSO

ptags(1), ctree(1), ex(1), vi(1)

AUTHOR

Ken Arnold; FORTRAN added by Jim Kleckner; Bill Joy added Pascal and -x replacing cxref; C typedefs added by Ed Pelegri-Llopart; Ronen Barzel and Michael Hawley added object type and length, global variable and macro indexing, and callee/caller lists. Sam Leffler added yacc and lex knowledge.

BUGS

Non-C languages are processed in an unsophisticated way: in particular, Pascal and FORTRAN objects are crudely located; no attempt is made to deal with Pascal block structure; global variables and Pascal types are not tagged; and caller/callee references are not generated. Does not handle C structs' having a separate name space; If a struct shares a name with any other object, the struct declaration will not be tagged. Callee lists are generated in a shallow way; if a function references a local variable or structure field which has the same name as a tagged object, that object will be added to the function's callee list. There's a hack to ignore duplicate global variables named "sccsid". Does not know about #ifdefs. The -g, -m, -r, -s and -t options should not necessarily be implied for -v and -x; they are present for backward compatibility.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97