📄 ctags.html
字号:
<li><p>Type definitions</p></li><li><p>Macros with arguments</p></li></ul><p>It may also produce output for any of the following objects:</p><ul><li><p>Function prototypes</p></li><li><p>Structures</p></li><li><p>Unions</p></li><li><p>Global variable definitions</p></li><li><p>Enumeration types</p></li><li><p>Macros without arguments</p></li><li><p><b>#define</b> statements</p></li><li><p><b>#line</b> statements</p></li></ul><p>Any <b>#if</b> and <b>#ifdef</b> statements shall produce no output. The tag <b>main</b> is treated specially in C programs. Thetag formed shall be created by prefixing <b>M</b> to the name of the file, with the trailing <b>.c</b>, and leading pathnamecomponents (if any) removed.</p><p>On systems that do not support the C-Language Development Utilities option, <i>ctags</i> produces unspecified results forC-language source code files. It should write to standard error a message identifying this condition and cause a non-zero exitstatus to be produced.</p><p>If the operand identifies FORTRAN source, the <i>ctags</i> utility shall produce an output line for each function definition. Itmay also produce output for any of the following objects:</p><ul><li><p>Subroutine definitions</p></li><li><p>COMMON statements</p></li><li><p>PARAMETER statements</p></li><li><p>DATA and BLOCK DATA statements</p></li><li><p>Statement numbers</p></li></ul><p>On systems that do not support the FORTRAN Development Utilities option, <i>ctags</i> produces unspecified results for FORTRANsource code files. It should write to standard error a message identifying this condition and cause a non-zero exit status to beproduced.</p><p>It is implementation-defined what other objects (including duplicate identifiers) produce output.</p></blockquote><h4><a name="tag_04_30_14"></a>EXIT STATUS</h4><blockquote><p>The following exit values shall be returned:</p><dl compact><dt> 0</dt><dd>Successful completion.</dd><dt>>0</dt><dd>An error occurred.</dd></dl></blockquote><h4><a name="tag_04_30_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_30_16"></a>APPLICATION USAGE</h4><blockquote><p>The output with <b>-x</b> is meant to be a simple index that can be written out as an off-line readable function index. If theinput files to <i>ctags</i> (such as <b>.c</b> files) were not created using the same locale as that in effect when <i>ctags</i><b>-x</b> is run, results might not be as expected.</p><p>The description of C-language processing says "attempts to" because the C language can be greatly confused, especially throughthe use of <b>#define</b>s, and this utility would be of no use if the real C preprocessor were run to identify them. The outputfrom <i>ctags</i> may be fooled and incorrect for various constructs.</p></blockquote><h4><a name="tag_04_30_17"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_30_18"></a>RATIONALE</h4><blockquote><p>The option list was significantly reduced from that provided by historical implementations. The <b>-F</b> option was omitted asredundant, since it is the default. The <b>-B</b> option was omitted as being of very limited usefulness. The <b>-t</b> option wasomitted since the recognition of <b>typedef</b>s is now required for C source files. The <b>-u</b> option was omitted because theupdate function was judged to be not only inefficient, but also rarely needed.</p><p>An early proposal included a <b>-w</b> option to suppress warning diagnostics. Since the types of such diagnostics could not bedescribed, the option was omitted as being not useful.</p><p>The text for <i>LC_CTYPE</i> about compatibility with the C locale acknowledges that the ISO C standard imposesrequirements on the locale used to process C source. This could easily be a superset of that known as "the C locale" by way ofimplementation extensions, or one of a few alternative locales for systems supporting different codesets. No statement is made forFORTRAN because the ANSI X3.9-1978 standard (FORTRAN 77) does not (yet) define a similar locale concept. However, a generalrule in this volume of IEEE Std 1003.1-2001 is that any time that locales do not match (preparing a file for one localeand processing it in another), the results are suspect.</p><p>The collation sequence of the tags file is not affected by <i>LC_COLLATE</i> because it is typically not used by human readers,but only by programs such as <a href="../utilities/vi.html"><i>vi</i></a> to locate the tag within the source files. Using thePOSIX locale eliminates some of the problems of coordinating locales between the <i>ctags</i> file creator and the <a href="../utilities/vi.html"><i>vi</i></a> file reader.</p><p>Historically, the tags file has been used only by <a href="../utilities/ex.html"><i>ex</i></a> and <a href="../utilities/vi.html"><i>vi</i></a>. However, the format of the tags file has been published to encourage other programs to usethe tags in new ways. The format allows either patterns or line numbers to find the identifiers because the historical <a href="../utilities/vi.html"><i>vi</i></a> recognizes either. The <i>ctags</i> utility does not produce the format using line numbersbecause it is not useful following any source file changes that add or delete lines. The documented search patterns matchhistorical practice. It should be noted that literal leading circumflex or trailing dollar-sign characters in the search patternwill only behave correctly if anchored to the beginning of the line or end of the line by an additional circumflex or dollar-signcharacter.</p><p>Historical implementations also understand the objects used by the languages Pascal and sometimes LISP, and they understand theC source output by <a href="../utilities/lex.html"><i>lex</i></a> and <a href="../utilities/yacc.html"><i>yacc</i></a>. The<i>ctags</i> utility is not required to accommodate these languages, although implementors are encouraged to do so.</p><p>The following historical option was not specified, as <i>vgrind</i> is not included in this volume ofIEEE Std 1003.1-2001:</p><dl compact><dt><b>-v</b></dt><dd>If the <b>-v</b> flag is given, an index of the form expected by <i>vgrind</i> is produced on the standard output. This listingcontains the function name, filename, and page number (assuming 64-line pages). Since the output is sorted into lexicographicorder, it may be desired to run the output through <a href="../utilities/sort.html"><i>sort</i></a> <b>-f</b>. Sample use: <pre><tt>ctags -v files | sort -f > index vgrind -x index</tt></pre></dd></dl><p>The special treatment of the tag <b>main</b> makes the use of <i>ctags</i> practical in directories with more than oneprogram.</p></blockquote><h4><a name="tag_04_30_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_30_20"></a>SEE ALSO</h4><blockquote><p><a href="c99.html"><i>c99</i></a>, <a href="fort77.html"><i>fort77</i></a>, <a href="vi.html"><i>vi</i></a></p></blockquote><h4><a name="tag_04_30_21"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4.</p></blockquote><h4><a name="tag_04_30_22"></a>Issue 5</h4><blockquote><p>The FUTURE DIRECTIONS section is added.</p></blockquote><h4><a name="tag_04_30_23"></a>Issue 6</h4><blockquote><p>This utility is marked as part of the User Portability Utilities option.</p><p>The OUTPUT FILES section is changed to align with the IEEE P1003.2b draft standard.</p><p>The normative text is reworded to avoid use of the term "must" for application requirements.</p><p>IEEE PASC Interpretation 1003.2 #168 is applied, changing "create" to "write" in the DESCRIPTION.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -