United States-English |
|
|
HP-UX Reference > Cctags(1)HP-UX 11i Version 3: February 2007 |
|
NAMEctags — create a tags file DESCRIPTIONctags makes a tags file for ex(1) (or vi(1)) from the specified C, Pascal and FORTRAN sources. A tags file gives the locations of specified objects (for C, functions, macros with argments, and typedefs; Pascal, procedures, programs and functions; FORTRAN, subroutines, programs and functions) in a group of files. Each line of the tags file contains the object name, the file in which it is defined, and an address specification for the object definition. Output is sorted in ascending collation order (see Environment Variables below). All objects except C typedefs are searched with a pattern, typedefs with a line number. Specifiers are given in separate fields on the line, separated by spaces or tabs. Using the tags file, ex can quickly find these objects' definitions.
Files whose name ends in .c or .h are assumed to be C source files and are searched for C routine and macro definitions. Others are first examined to see if they contain any Pascal or FORTRAN routine definitions; if not, they are processed again looking for C definitions. Other options are:
The tag main is treated specially in C programs. The tag formed is created by adding M to the beginning of name of the file, with any trailing .c removed, and leading pathname components also removed. This makes use of ctags practical in directories with more than one program. EXTERNAL INFLUENCESEnvironment VariablesLC_COLLATE determines the order in which the output is sorted. LC_CTYPE determines the interpretation of the single- and/or multi-byte characters within comments and string literals. If LC_COLLATE or LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of ``C'' (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, ctags behaves as if all internationalization variables are set to ``C''. See environ(5). DIAGNOSTICS
EXAMPLESCreate a tags file named tags in the current directory for all C source (*.c) files and all header (*.h) files in the current directory: ctags *.[ch] Once the tags file exists in the current directory, it can be used with commands that support tag files (such as vi (see vi(1)). Use the tags file with vi to edit a particular function myfunc() located in one of the source files: vi -t myfunc While editing a C source file using vi, use the ex-mode tag command to edit function myfunc(): :tag myfunc Use vi to find main() in file myprog.c: vi -t Mmyprog While using vi, find main() in file myprog.c (does not have to be the file currently being edited): :tag Mmyprog WARNINGSRecognition of functions, subroutines, and procedures for FORTRAN and Pascal is done in a very simple way. No attempt is made to deal with block structure; if there are two Pascal procedures in different blocks with the same name, a warning message is generated. The method of deciding whether to look for C or Pascal and FORTRAN functions is an approximation, and can be fooled by unusual programs. ctags does not know about #ifdefs and Pascal types. It relies on the input being well formed to detect typedefs. Use of -tx shows only the last line of typedefs. ex is naive about tags files with several identical tags; it simply chooses the first entry its (non-linear) search finds with that tag. Such files can be created with either the -u or -a options or by editing a tags file. If more than one (function) definition appears on a single line, only the first definition is indexed. |
Printable version | ||
|