home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim53os2.zip / vim-5.3 / doc / ctags.man < prev    next >
Text File  |  1998-08-30  |  36KB  |  991 lines

  1.  
  2.  
  3.  
  4. CTAGS(1)                                                 CTAGS(1)
  5.  
  6.  
  7. NAME
  8.        ctags - Generate C and C++ language tag files for use with
  9.        vi(1)
  10.  
  11.  
  12.  
  13. SYNOPSIS
  14.        ctags [-aBeFnNRux] [-f tagfile] [-h list] [-i  types]  [-I
  15.              ignorelist]  [-L  listfile]  [-p  path] [-o tagfile]
  16.              [--append] [--excmd=m|n|p] [--format=level] [--help]
  17.              [--if0]    [--lang=c|c++|java]    [--langmap=map(s)]
  18.              [--recurse]    [--sort]    [--totals]    [--version]
  19.              [file(s)]
  20.  
  21.  
  22.        etags [-aRx]   [-f  tagfile]  [-h  list]  [-i  types]  [-I
  23.              ignorelist] [-L listfile]  [-p  path]  [-o  tagfile]
  24.              [--append]   [--help]   [--if0]  [--lang=c|c++|java]
  25.              [--langmap=map(s)]  [--recurse]  [--totals]  [--ver-
  26.              sion] [file(s)]
  27.  
  28.  
  29.  
  30. DESCRIPTION
  31.        The  ctags  and  etags  programs (hereinafter collectively
  32.        referred to as ctags, except where distinguished) generate
  33.        an  index  (or  "tag")  file  for C, C++ and Java language
  34.        objects found in file(s) that allows  these  items  to  be
  35.        quickly and easily located by a text editor or other util-
  36.        ity. A "tag" signifies a C language object  for  which  an
  37.        index  entry  is  available  (or, alternatively, the index
  38.        entry created for that object).
  39.  
  40.        Alternatively, ctags can generate a cross  reference  file
  41.        which lists, in human readable form, information about the
  42.        various objects found in a set of C or C++ language files.
  43.  
  44.        Tag  index files are supported by the vi(1) editor and its
  45.        derivatives (such as vim, elvis, stevie, and xvi), and  by
  46.        the  emacs  editor  (see  the  HOW  TO  USE WITH sections,
  47.        below), all of which allow the user to locate  the  object
  48.        associated with a name appearing in a source file and jump
  49.        to the file and line which defines the name.
  50.  
  51.        The following types of tags are supported by  ctags  (some
  52.        are optional):
  53.  
  54.            macro definitions (names created by #define)
  55.            enumerators (values inside an enumeration)
  56.            function (method) definitions
  57.            class, enum, struct, and union names
  58.            interface names (Java)
  59.            namespace names (C++)
  60.            typedefs
  61.  
  62.  
  63.  
  64. Darren Hiebert             Version 2.3                          1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CTAGS(1)                                                 CTAGS(1)
  71.  
  72.  
  73.            variables (definitions and extern declarations)
  74.            function prototypes and declarations
  75.            data members
  76.  
  77.        Ctags  only  generates  tags for objects which have global
  78.        scoping (file-wide visibility). This means that, with  the
  79.        exception  of macro definitions, only objects defined out-
  80.        side of brace enclosed function blocks are candidates  for
  81.        a tag.
  82.  
  83.  
  84.  
  85. SOURCE FILES
  86.        Unless  the  --lang  option  is specified, the language of
  87.        each source file is automatically selected based upon  its
  88.        file  extension,  according  to the following default map-
  89.        ping.
  90.  
  91.            C       *.c
  92.            C++     *.C, *.c++, *.cc, *.cpp, *.cxx  and  any  file
  93.                    considered  a  header file according to the -h
  94.                    option.
  95.            Java    *.java
  96.  
  97.        All other files extensions are ignored. This permits  run-
  98.        ning ctags on all files in either a single directory (e.g.
  99.        "ctags *"), or all files in  an  entire  source  directory
  100.        tree  (e.g.  "ctags  -R"),  since  only  those files whose
  101.        extensions are  known  to  ctags  will  be  scanned.  This
  102.        default  mapping of file extensions to source language may
  103.        be changed by using the --langmap option. Automatic selec-
  104.        tion  of  the source language may be disabled by using the
  105.        --lang option.
  106.  
  107.  
  108.  
  109. OPTIONS
  110.        Despite the wealth of available options, defaults are  set
  111.        so  that  ctags  is  most  commonly  executed  without any
  112.        options (e.g. "ctags *"), which will create a tag file  in
  113.        the current directory for the specified files. The options
  114.        described below are provided merely to allow  custom  tai-
  115.        loring to meet special needs.
  116.  
  117.        Note that spaces separating the single-letter options from
  118.        their parameters are optional.
  119.  
  120.        Note also that the boolean parameters  to  the  long  form
  121.        options  (those  beginning  with  "--"  and  that  take  a
  122.        "=yes|no" parameter) may be omitted, in which case  "=yes"
  123.        is implied. (e.g. --sort is equivalent to --sort=yes).
  124.  
  125.  
  126.        -a   Append  the  tags to an existing tag file. Equivalent
  127.  
  128.  
  129.  
  130. Darren Hiebert             Version 2.3                          2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. CTAGS(1)                                                 CTAGS(1)
  137.  
  138.  
  139.             to --append.
  140.  
  141.  
  142.        -B   Use backward searching patterns (e.g. ?regexp?).
  143.  
  144.  
  145.        -e   Output tag file for use with Emacs. If  this  program
  146.             is  executed by the name etags, this option is set by
  147.             default. Selecting this option causes  the  following
  148.             options  to be ignored: -BFnNsuwW, --excmd, --format,
  149.             --sort.
  150.  
  151.  
  152.        -f tagfile
  153.             Use the name specified by tagfile for  the  tag  file
  154.             (default  is  "tags",  or  "TAGS"  when  using the -e
  155.             option). If tagfile is specified as "-", then the tag
  156.             file  is  written  to  standard output instead. Ctags
  157.             will stubbornly refuse  to  take  orders  if  tagfile
  158.             exists  and  its  first line contains something other
  159.             than a valid tags line. This will save your  neck  if
  160.             you  mistakenly type "ctags -f *.c", which would oth-
  161.             erwise overwrite your first C file with the tags gen-
  162.             erated by the rest!
  163.  
  164.  
  165.        -F   Use   forward   searching  patterns  (e.g.  /regexp/)
  166.             (default).
  167.  
  168.  
  169.        -h list
  170.             Specifies a list of file extensions used for headers,
  171.             separated  by  periods.   This option affects how the
  172.             scoping of tag types is interpreted (i.e. whether  or
  173.             not  they  are  considered  as static). All tag types
  174.             other than functions (methods) and variables are con-
  175.             sidered  static when they appear in a non-header file
  176.             (since they cannot be seen outside of that file)  and
  177.             non-static  when  they appear in a header file (since
  178.             they can be seen in other files wherever that  header
  179.             file is included). See also the S modifier of the  -i
  180.             option. The default list is ".h.H.hh.hpp.hxx.h++".
  181.  
  182.  
  183.        -i types
  184.             Specifies the list of tag types  to  include  in  the
  185.             output  file.   Types  is a group of one-letter flags
  186.             designating the types of tags affected.  Each  letter
  187.             or  group  of letters may be preceded by either a '+'
  188.             sign (default, if omitted) to add it to those already
  189.             included,  a  '-'  sign  to  exclude it from the list
  190.             (e.g. to exclude a default tag type), or an '='  sign
  191.             to  include  its corresponding tag type at the exclu-
  192.             sion of those not  listed.  Tags  for  the  following
  193.  
  194.  
  195.  
  196. Darren Hiebert             Version 2.3                          3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. CTAGS(1)                                                 CTAGS(1)
  203.  
  204.  
  205.             language  contructs  are  supported (default settings
  206.             are on except as noted):
  207.  
  208.                c   class names
  209.                d   macro definitions
  210.                e   enumerators
  211.                f   function (or method) definitions
  212.                g   enumeration names
  213.                i   interface names (Java only)
  214.                m   data members [off]
  215.                i   namespace names (C++ only)
  216.                p   function prototypes and declarations [off]
  217.                s   structure names
  218.                t   typedefs
  219.                u   union names
  220.                v   variable definitions
  221.                x   extern variable declarations [off]
  222.  
  223.             In addition to the above flags,  the  following  one-
  224.             letter modifiers are accepted:
  225.  
  226.                C   For  C++  and  Java,  include an extra, class-
  227.                    qualified tag  entry  for  each  class  member
  228.                    (function/method   and   data)   in  the  form
  229.                    "class::member"   (C++)   or    "class.member"
  230.                    (Java).  This  allows locating class-qualified
  231.                    tags (e.g.  ":tag  class::member"  in  vi(1)).
  232.                    This is disabled by default because this could
  233.                    potentially more than double the size  of  the
  234.                    tag file.
  235.                F   Include  tags  for the basename of each source
  236.                    file. This permits jumping to a  file  by  its
  237.                    name  (e.g.  ":tag  file.c" in vi(1)). This is
  238.                    disabled by default.
  239.                S   Include static tags (those not visible outside
  240.                    of  a single source file).  Function and vari-
  241.                    able definitions are  considered  static  only
  242.                    when  their  definitions are preceded with the
  243.                    "static" keyword. All other types of tags  are
  244.                    considered  static  when they appear in a non-
  245.                    header file, and non-static when  they  appear
  246.                    in a header file. See also the -h option. This
  247.                    is enabled by default.
  248.  
  249.  
  250.             The default value for types is "=cdefgintuvCS".
  251.  
  252.  
  253.        -I ignorelist
  254.             Reads a list of names which are to be  ignored  while
  255.             generating tags for the source files. The list may be
  256.             supplied directly on the command line or found  in  a
  257.             separate  file. Normally, the parameter ignorelist is
  258.             a list of names to be ignored, each separated with  a
  259.  
  260.  
  261.  
  262. Darren Hiebert             Version 2.3                          4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. CTAGS(1)                                                 CTAGS(1)
  269.  
  270.  
  271.             comma, a semicolon, or white space (in which case the
  272.             list should be quoted to keep the entire list as  one
  273.             command line argument). The parameter ignorelist will
  274.             be interpreted as a filename if its  first  character
  275.             is given as either a '.' or a pathname separator ('/'
  276.             or '\'). In order to specify a file found in the cur-
  277.             rent directory, use "./filename".
  278.  
  279.             This  feature  is useful when preprocessor macros are
  280.             used in such a way that they cause  syntactic  confu-
  281.             sion due to their presence. Some examples will illus-
  282.             trate this point.
  283.  
  284.               /* creates a global version  string  in  module  */
  285.               MODULE_VERSION("$Revision: 6.10 $")
  286.  
  287.             In  this  example, the macro invocation looks to much
  288.             like a function definition because it is not followed
  289.             by  a semicolon (indeed, it could even be followed by
  290.             a global variable definition that would look  exactly
  291.             like  a K&R style function parameter declaration). In
  292.             fact, this seeming function definition  would  likely
  293.             cause  the  rest of the file to be skipped over while
  294.             trying to complete  the  definition.  Ignoring  "MOD-
  295.             ULE_ID" would avoid such a problem.
  296.  
  297.               int foo ARGDECL2(void *, ptr, long int, nbytes)
  298.  
  299.             In  this  example, the macro "ARGDECL2" would be mis-
  300.             takenly interpreted to be the name  of  the  function
  301.             instead  of  the  correct name of "foo". Ignoring the
  302.             name "ARGDECL2" results in the correct behavior.
  303.  
  304.  
  305.        -L listfile
  306.             Read from listfile a list of  file  names  for  which
  307.             tags should be generated. If listfile is specified as
  308.             "-", then file names are read from standard input.
  309.  
  310.  
  311.        -n   Equivalent to --excmd=number.
  312.  
  313.  
  314.        -N   Equivalent to --excmd=pattern.
  315.  
  316.  
  317.        -o tagfile
  318.             Alternative for -f.
  319.  
  320.  
  321.        -p path
  322.             Use path as the default directory for  each  supplied
  323.             source  file (whether supplied on the command line or
  324.             in a file specified with the -L option),  unless  the
  325.  
  326.  
  327.  
  328. Darren Hiebert             Version 2.3                          5
  329.  
  330.  
  331.  
  332.  
  333.  
  334. CTAGS(1)                                                 CTAGS(1)
  335.  
  336.  
  337.             source file is already specified as an absolute path.
  338.             The supplied path is merely  prepended  to  the  each
  339.             non-absolute  source  file name, adding any necessary
  340.             path separator.
  341.  
  342.  
  343.        -R   Equivalent to --recurse=yes.
  344.  
  345.  
  346.        -u   Equivalent to --sort=no.
  347.  
  348.  
  349.        -x   Print  a  tabular,  human-readable  cross   reference
  350.             (xref)  file to standard output instead of generating
  351.             a tag file. The information contained in  the  output
  352.             includes:  the  tag  name;  the kind of tag; the line
  353.             number, file name, and source line (with extra  white
  354.             space  condensed)  of the file which defines the tag.
  355.             No tag file is written and the following options will
  356.             be  ignored: -aBefFno, and -i+P. Example applications
  357.             for this feature are  generating  a  listing  of  all
  358.             functions  (including  statics)  located  in a source
  359.             file (e.g. ctags -xi=fS file), or generating  a  list
  360.             of all externally visible global variables located in
  361.             a source file (e.g. ctags -xi=v file).
  362.  
  363.  
  364.        --append=yes|no
  365.             Indicates whether tags generated from  the  specified
  366.             files  should be appended to those already present in
  367.             the tag file or should replace them. If the parameter
  368.             is  omitted,  =yes  is implied. This option is off by
  369.             default.
  370.  
  371.  
  372.        --excmd=type
  373.             Determines the type of EX command used to locate tags
  374.             in  the  source  file.  The valid values for type are
  375.             (either the  entire  word  or  the  first  letter  is
  376.             accepted):
  377.  
  378.             number   Places into the tag file line numbers in the
  379.                      source file where tags  are  located  rather
  380.                      than  patterns  to be searched for. This has
  381.                      three advantages:
  382.                      1.  Significantly reduces the  size  of  the
  383.                          resulting tag file.
  384.                      2.  Eliminates failures to find tags because
  385.                          the line defining the tag  has  changed,
  386.                          causing  the pattern match to fail (note
  387.                          that some editors, such as vim, are able
  388.                          to recover in many such instances).
  389.                      3.  Eliminates  finding  identical matching,
  390.                          but incorrect, source lines  (see  BUGS,
  391.  
  392.  
  393.  
  394. Darren Hiebert             Version 2.3                          6
  395.  
  396.  
  397.  
  398.  
  399.  
  400. CTAGS(1)                                                 CTAGS(1)
  401.  
  402.  
  403.                          below).
  404.                      However,  this  option  has  one significant
  405.                      drawback: changes to the  source  files  can
  406.                      cause  the  line numbers recorded in the tag
  407.                      file to no longer correspond to the lines in
  408.                      the  source file, causing jumps to some tags
  409.                      to miss the target definition by one or more
  410.                      lines.  Basically,  this option is best used
  411.                      when the source code to which it is  applied
  412.                      is  not  subject  to  change. Selecting this
  413.                      option type causes the following options  to
  414.                      be ignored: -BF.
  415.  
  416.             pattern  Uses EX search patterns for all tags, rather
  417.                      than the line numbers usually used for macro
  418.                      definitions.  This  has the advantage of not
  419.                      referencing obsolete line numbers when lines
  420.                      have  been  added  or  removed since the tag
  421.                      file was generated.
  422.  
  423.             mixed    Uses line numbers for macro definition  tags
  424.                      and EX patterns for everything else. This is
  425.                      the default format generated by the original
  426.                      ctags  and  is,  therefore,  retained as the
  427.                      default for this option.
  428.  
  429.  
  430.        --format=level
  431.             Change the format of the output tag  file.  Currently
  432.             the  only  valid values for level are 1 or 2. Level 1
  433.             specifies the original tag file format  and  level  2
  434.             specifies  a new extended format containing extension
  435.             flags (but in a manner which retains backward compat-
  436.             ibility  with  original  vi(1)  implementations). The
  437.             default level is 2.
  438.  
  439.  
  440.        --help
  441.             Prints to standard output a detailed  usage  descrip-
  442.             tion.
  443.  
  444.  
  445.        --if0=yes|no
  446.             Indicates  a  preference as to whether code within an
  447.             "#if 0" branch of a preprocessor  conditional  should
  448.             be examined for non-macro tags (macro tags are always
  449.             included). Because the intent of this construct is to
  450.             disable  code,  the  default value of this options is
  451.             no. Note that this indicates a  preference  only  and
  452.             does  not  guarantee  skipping code within an "#if 0"
  453.             branch, since the fall-back algorithm used to  gener-
  454.             ate  tags when preprocessor conditionals are too com-
  455.             plex follows all branches of a  conditional.  If  the
  456.             parameter is omitted, =yes is implied. This option is
  457.  
  458.  
  459.  
  460. Darren Hiebert             Version 2.3                          7
  461.  
  462.  
  463.  
  464.  
  465.  
  466. CTAGS(1)                                                 CTAGS(1)
  467.  
  468.  
  469.             off by default.
  470.  
  471.  
  472.        --lang=c|c++|java
  473.             By default, ctags automatically selects the  language
  474.             of  a  source  file according to its file name exten-
  475.             sion,  ignoring  those  files  whose  extensions  are
  476.             unknown  to  ctags.  This option forces the specified
  477.             language to be used for every supplied file,  instead
  478.             of keying off of their extensions.
  479.  
  480.  
  481.        --langmap=map(s)
  482.             Overrides the default mapping between source language
  483.             and file extension. Each comma-separated map consists
  484.             of  the  source language name, a colon, and a list of
  485.             extensions separated  by  periods.  For  example,  to
  486.             specify  that  files  with extensions of .c, .ec, and
  487.             .xs are to  be  treated  as  C  language  files,  use
  488.             "--langmap=c:.c.ec.xs".  To  also  specify that files
  489.             with extensions of .j are to be treated as Java  lan-
  490.             guage files, use "--langmap=c:.c.ec.xs,java:.java.j".
  491.  
  492.  
  493.        --recurse=yes|no
  494.             Recurse into directories encountered in the  list  of
  495.             supplied  files.  If  the  list  of supplied files is
  496.             empty and no file  list  is  specified  with  the  -L
  497.             option,  then  the  current  directory  (i.e. ".") is
  498.             assumed.  On  Unix,  directories  named  "SCCS"   are
  499.             skipped,  because  files in these directories are not
  500.             source code, even though they have the same names  as
  501.             the  source  code  they relate to. Also on Unix, sym-
  502.             bolic links are followed; if  you  don't  like  this,
  503.             pipe  the  output  of find(1) into ctags -L- instead.
  504.             Note: This option is not supported on  all  platforms
  505.             at present.
  506.  
  507.  
  508.        --sort=yes|no
  509.             Indicates  whether  the  tag file should be sorted on
  510.             the tag name (default is yes). Note that the original
  511.             vi(1) requires sorted tags. If the parameter is omit-
  512.             ted, =yes is implied. This option is  on  by  default
  513.             for ctags, and ignored for etags.
  514.  
  515.  
  516.        --totals=yes|no
  517.             Prints statistics about the source files read and the
  518.             tag file written during  the  current  invocation  of
  519.             ctags.  If the parameter is omitted, =yes is implied.
  520.             This option is off by default.
  521.  
  522.  
  523.  
  524.  
  525.  
  526. Darren Hiebert             Version 2.3                          8
  527.  
  528.  
  529.  
  530.  
  531.  
  532. CTAGS(1)                                                 CTAGS(1)
  533.  
  534.  
  535.        --version
  536.             Prints a version identifier  for  ctags  to  standard
  537.             output.  This  is  guaranteed  to  always contain the
  538.             string "Exuberant Ctags".
  539.  
  540.  
  541.  
  542. OPERATIONAL DETAILS
  543.        For every one of the qualified objects which  are  discov-
  544.        ered  in  the  source  files supplied to ctags, a separate
  545.        line is added to the tag file, each looking like  this  in
  546.        the most general case:
  547.  
  548.            tag_name    file_name    ex_cmd;"    xflags
  549.  
  550.        The  fields and separators of these lines are specified as
  551.        follows:
  552.  
  553.            1.  tag name (a C language identifier)
  554.            2.  a single tab character
  555.            3.  the name of the file in which the  object  associ-
  556.                ated with the tag is located
  557.            4.  a single tab character
  558.            5.  an  EX  command to locate the tag within the file;
  559.                generally a search pattern  (either  /pattern/  or
  560.                ?pattern?)  or line number (see --excmd). Tag file
  561.                format 2 (see --format) extends  this  EX  command
  562.                under  certain  circumstances  to include a set of
  563.                extension  flags  (see  EXTENSION  FLAGS,   below)
  564.                embedded  in an EX comment immediately appended to
  565.                the EX command, which leaves it backwards compati-
  566.                ble with original vi(1) implemenations.
  567.  
  568.        A  few  special  tags  are  written  into the tag file for
  569.        internal purposes. These tags are composed in such  a  way
  570.        that  they always sort to the top of the file.  Therefore,
  571.        the first two characters of these tags are  used  a  magic
  572.        number  to  detect  a tag file for purposes of determining
  573.        whether a valid tag file is being overwritten rather  than
  574.        a source file.
  575.  
  576.        When  this  program  is invoked by the name etags, or with
  577.        the -e option, the output file is in  a  different  format
  578.        that is used by emacs(1).
  579.  
  580.        Note that the name of each source file will be recorded in
  581.        the tag file exactly as it appears on  the  command  line.
  582.        Therefore,  if  the path you specified on the command line
  583.        was relative to some directory, then it will  be  recorded
  584.        in that same manner in the tag file.
  585.  
  586.        This  version of ctags imposes no formatting requirements.
  587.        Other versions of ctags tended to rely upon  certain  for-
  588.        matting  assumptions  in  order  to help it resolve coding
  589.  
  590.  
  591.  
  592. Darren Hiebert             Version 2.3                          9
  593.  
  594.  
  595.  
  596.  
  597.  
  598. CTAGS(1)                                                 CTAGS(1)
  599.  
  600.  
  601.        dilemmas caused by preprocessor conditionals.
  602.  
  603.        In general, ctags tries to be smart about conditional pre-
  604.        processor  directives.  If  a  preprocessor conditional is
  605.        encountered within a statement which defines a tag,  ctags
  606.        follows  only the first branch of that conditional (except
  607.        in the special case of "#if 0", in which case  it  follows
  608.        only the last branch). The reason for this is that failing
  609.        to pursue only one branch can result in ambiguous  syntax,
  610.        as in the following example:
  611.  
  612.               #ifdef TWO_ALTERNATIVES
  613.               struct {
  614.               #else
  615.               union {
  616.               #endif
  617.                   short a;
  618.                   long b;
  619.               }
  620.  
  621.        Both  branches cannot be followed, or braces become unbal-
  622.        anced and ctags would be unable to make sense of the  syn-
  623.        tax.
  624.  
  625.        If  the  application  of  this heuristic fails to properly
  626.        parse a file, generally due to complicated  and  inconsis-
  627.        tent pairing within the conditionals, ctags will retry the
  628.        file using a different heuristic  which  does  not  selec-
  629.        tively   follow  conditional  preprocessor  branches,  but
  630.        instead falls back to relying upon a closing  brace  ("}")
  631.        in  column  1  as  indicating  the end of a block once any
  632.        brace imbalance results from following a  #if  conditional
  633.        branch.
  634.  
  635.        Ctags  will  also  try to specially handle arguments lists
  636.        enclosed in double sets of parentheses in order to  accept
  637.        the following conditional construct:
  638.  
  639.               extern void foo __ARGS((int one, char two));
  640.  
  641.        Any  name immediately preceding the "((" will be automati-
  642.        cally ignored and the previous name will be used.
  643.  
  644.        C++ operator definitions are  specially  handled.  In  the
  645.        case of operators beginning with a non-identifer character
  646.        (e.g. "operator ="), the name of the tag added to the  tag
  647.        file  will be the operator prefixed by "operator", with no
  648.        intervening white space (e.g. "operator="). In the case of
  649.        operators beginning with identifer characters (e.g. "oper-
  650.        ator new"), the name of the tag added to the tag file will
  651.        be simply the name of the operator, without a prefix (e.g.
  652.        "new").
  653.  
  654.        After creating or appending to the tag file, it is  sorted
  655.  
  656.  
  657.  
  658. Darren Hiebert             Version 2.3                         10
  659.  
  660.  
  661.  
  662.  
  663.  
  664. CTAGS(1)                                                 CTAGS(1)
  665.  
  666.  
  667.        by the tag name, removing identical tag lines.
  668.  
  669.        Note  that the path recorded for filenames in the tag file
  670.        and utilized by the editor to search for tags are  identi-
  671.        cal  to  the  paths  specified  for file(s) on the command
  672.        line. This means the if you want the paths for files to be
  673.        relative to some directory, you must invoke ctags with the
  674.        same pathnames for file(s) (this can  be  overridden  with
  675.        -p).
  676.  
  677.  
  678. EXTENSION FLAGS
  679.        Extension flags are tab-separated key-value pairs appended
  680.        to the end of the EX command as a  comment,  as  described
  681.        above  in  OPERATIONAL  DETAILS.   These  key  value pairs
  682.        appear in the general form "key:value".  The possible keys
  683.        and the meaning of their values are as follows:
  684.  
  685.  
  686.  
  687.        class       Indicates  that  this  tag  is a member of the
  688.                    class whose name is given by value.
  689.  
  690.  
  691.  
  692.        enum        Indicates that this tag is  a  member  of  the
  693.                    enumeration whose name is given by value.
  694.  
  695.  
  696.  
  697.        file        Indicates  that  the  tag  has  a file-limited
  698.                    scope (i.e. is static to the file).  This  key
  699.                    has no corresponding value.
  700.  
  701.  
  702.  
  703.        kind        Indicates  the  type  of the tag. Its value is
  704.                    one  of  the  corresponding  one-letter  flags
  705.                    described under the -i option, above. Alterna-
  706.                    tively, this key may be omitted, with only the
  707.                    value present (i.e. a field without a
  708.  
  709.  
  710.  
  711.        interface   Indicates  that  this  tag  is a member of the
  712.                    interface whose name is given by value.
  713.  
  714.  
  715.  
  716.        namespace   Indicates that this tag is  a  member  of  the
  717.                    namespace whose name is given by value.
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724. Darren Hiebert             Version 2.3                         11
  725.  
  726.  
  727.  
  728.  
  729.  
  730. CTAGS(1)                                                 CTAGS(1)
  731.  
  732.  
  733.        private     Indicates  the visibility of this class member
  734.                    is private.  This  key  has  no  corresponding
  735.                    value.
  736.  
  737.  
  738.        protected   Indicates  the visibility of this class member
  739.                    is protected.  This key has  no  corresponding
  740.                    value.
  741.  
  742.  
  743.        public      Indicates  the visibility of this class member
  744.                    is public.   This  key  has  no  corresponding
  745.                    value.
  746.  
  747.  
  748.        struct      Indicates  that  this  tag  is a member of the
  749.                    structure whose name is given by value.
  750.  
  751.  
  752.  
  753.        union       Indicates that this tag is  a  member  of  the
  754.                    union whose name is given by value.
  755.  
  756.  
  757.  
  758.  
  759. ENVIRONMENT VARIABLES
  760.        CTAGS   This  variable,  if found, will be assumed to con-
  761.                tain a set of custom  default  options  which  are
  762.                read  when  ctags  starts,  but before any command
  763.                line options are read. Options  in  this  variable
  764.                should be in the same form as those on the command
  765.                line. Command line options will  override  options
  766.                specified  in  this  variable. Only options may be
  767.                specified with this variable; no source file names
  768.                are read from its value.
  769.  
  770.  
  771.        ETAGS   Similar  to  the  CTAGS variable above, this vari-
  772.                able, if found, will be read when etags starts. If
  773.                this  variable is not found, etags will try to use
  774.                CTAGS instead.
  775.  
  776.  
  777. HOW TO USE WITH VI
  778.        Vi will, by default, expect a tag file by the name  "tags"
  779.        in  the current directory. Once the tag file is built, the
  780.        following commands exercise the tag indexing feature:
  781.  
  782.        vi -t tag   Start vi and position the cursor at  the  file
  783.                    and line where "tag" is defined.
  784.  
  785.        Control-]   Find the tag under the cursor.
  786.  
  787.  
  788.  
  789.  
  790. Darren Hiebert             Version 2.3                         12
  791.  
  792.  
  793.  
  794.  
  795.  
  796. CTAGS(1)                                                 CTAGS(1)
  797.  
  798.  
  799.        :ta tag     Find a tag.
  800.  
  801.        Control-T   Return to previous location before jump to tag
  802.                    (not widely implemented).
  803.  
  804.  
  805.  
  806. HOW TO USE WITH GNU EMACS
  807.        Emacs will, by default, expect a  tag  file  by  the  name
  808.        "TAGS"  in  the  current  directory.  Once the tag file is
  809.        built, the following commands exercise  the  tag  indexing
  810.        feature:
  811.  
  812.        Meta-x visit-tags-table
  813.                    Visit a TAGS file.
  814.  
  815.        Meta-.      Find  a definition for a tag.  The default tag
  816.                    is the identifier under the cursor.  There  is
  817.                    name completion in the minibuffer; typing "foo
  818.                    TAB" completes the  identifier  starting  with
  819.                    `foo'  (`foobar',  for  example)  or lists the
  820.                    alternatives.
  821.  
  822.        Meta-,      Find the next definition for the  tag.   Exact
  823.                    matches  are  found first, followed by fuzzier
  824.                    matches.
  825.  
  826.        For more commands, see the Tags topic in  the  Emacs  info
  827.        tree.
  828.  
  829.  
  830.  
  831. BUGS
  832.        Because ctags does not look inside brace-enclosed function
  833.        blocks, local definitions of  objects  within  a  function
  834.        will not have tags generated for them.
  835.  
  836.        Legacy  C  source code which uses C++ reserved keywords as
  837.        variable or parameter names  (e.g.  "class",  etc.)  in  a
  838.        header  file  may  fail to have correct tags generated for
  839.        the objects using them. In order to properly  handle  such
  840.        code, use the --lang option.
  841.  
  842.        Note  that when ctags generates uses patterns for locating
  843.        tags (see the --excmd option),  it  is  entirely  possible
  844.        that  the  wrong line may be found by your editor if there
  845.        exists another source line which is identical to the  line
  846.        containing  the  tag.  The  following example demonstrates
  847.        this condition:
  848.  
  849.               int variable;
  850.  
  851.               /* ... */
  852.               void foo(variable)
  853.  
  854.  
  855.  
  856. Darren Hiebert             Version 2.3                         13
  857.  
  858.  
  859.  
  860.  
  861.  
  862. CTAGS(1)                                                 CTAGS(1)
  863.  
  864.  
  865.               int variable;
  866.               {
  867.                   /* ... */
  868.               }
  869.  
  870.        Depending upon which editor you use and where in the  code
  871.        you  happen  to be, it is possible that the search pattern
  872.        may locate the local parameter declaration in foo() before
  873.        it  finds the actual global variable definition, since the
  874.        lines (and therefore their search patterns are identical).
  875.        This can be avoided by use of the --excmd=n option.
  876.  
  877.        Because  ctags  is  neither a preprocessor nor a compiler,
  878.        some complex or obscure constructs  can  fool  ctags  into
  879.        either  missing a tag or improperly generating an inappro-
  880.        priate tag. In particular, the use  of  preprocessor  con-
  881.        structs  which  alter  the  textual  syntax  of C can fool
  882.        ctags, as demonstrated by the following example:
  883.  
  884.               #ifdef GLOBAL
  885.               #define EXTERN
  886.               #define INIT(assign)  assign
  887.               #else
  888.               #define EXTERN extern
  889.               #define INIT(assign)
  890.               #endif
  891.  
  892.               EXTERN BUF *firstbuf INIT(= NULL);
  893.  
  894.        This looks too much like  a  declaration  for  a  function
  895.        called  "INIT",  which  returns  a  pointer  to  a typedef
  896.        "firstbuf", rather than  the  actual  variable  definition
  897.        that it is, since this distinction can only be resolved by
  898.        the preprocessor. The moral of the story: don't do this if
  899.        you  want  a tag generated for it, or use the -I option to
  900.        specify "INIT" as a keyword to be ignored.
  901.  
  902.  
  903.  
  904. FILES
  905.        tags      The default tag file created by ctags.
  906.  
  907.        TAGS      The default tag file created by etags.
  908.  
  909.  
  910. SEE ALSO
  911.        The official Exuberant Ctags web site at:
  912.  
  913.            http://darren.hiebert.com/ctags/index.html
  914.  
  915.        Also ex(1), vi(1), elvis, or, better yet, vim,  the  offi-
  916.        cial editor of ctags. For more information on vim, see the
  917.        VIM Pages web site at:
  918.  
  919.  
  920.  
  921.  
  922. Darren Hiebert             Version 2.3                         14
  923.  
  924.  
  925.  
  926.  
  927.  
  928. CTAGS(1)                                                 CTAGS(1)
  929.  
  930.  
  931.            http://www.vim.org/
  932.  
  933.  
  934.  
  935. AUTHOR
  936.        Darren Hiebert <darren@hiebert.com>, <darren@hiwaay.net>
  937.        http://darren.hiebert.com/
  938.  
  939.  
  940.  
  941. MOTIVATION
  942.        "Think ye at all times of rendering some service to  every
  943.        member of the human race."
  944.  
  945.        "All  effort  and exertion put forth by man from the full-
  946.        ness of his heart is worship, if it  is  prompted  by  the
  947.        highest motives and the will to do service to humanity."
  948.  
  949.                  -- From the Baha'i Writings
  950.  
  951.  
  952.  
  953. CREDITS
  954.        This  version  of  ctags  was  originally derived from and
  955.        inspired by the ctags program by Steve  Kirkendall  <kirk-
  956.        enda@cs.pdx.edu>  that  comes  with  the  Elvis  vi  clone
  957.        (though virtually none of the original code remains).
  958.  
  959.        Credit is  also  due  Bram  Moolenaar  <mool@oce.nl>,  the
  960.        author  of  vim,  who  has devoted so much of his time and
  961.        energy both to developing the editor as a service to  oth-
  962.        ers, and to helping the orphans of Uganda.
  963.  
  964.        The  section  entitled  "HOW  TO  USE  WITH GNU EMACS" was
  965.        shamelessly stolen from the man page for GNU etags.
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988. Darren Hiebert             Version 2.3                         15
  989.  
  990.  
  991.