You can customize GLOBAL using configuration file.
# cp gtags.conf /etc/gtags.conf # system wide config file. # vi /etc/gtags.conf $ cp gtags.conf $HOME/.globalrc # personal config file. $ vi $HOME/.globalrc
If `$HOME/.globalrc' exists then GLOBAL use it. Else if `/etc/gtags.conf' exists then GLOBAL use it. Otherwise default value will be used. The format of `gtags.conf' is resemble to termcap(5). By default, 'default' target is used. About the capabilities, please see each command manual. See section 5. Command References.
You can write new parser and use as a plug-in parser.
Copy `gtags.conf' to `/etc/gtags.conf' or `$HOME/.globalrc'.
If you would like to use exuberant ctags included by Vim editor,
$ cd /vim source directory/src/ctags $ cp Makefile.unix Makefile $ make # cp ctags /usr/local/bin/ctags-exuberant $ export GTAGSLABEL=ctags-exuberant # see gtags.conf $ gtags $ ls G* GPATH GTAGS
`GRTAGS' and `GSYMS' don't exist, simply because these parsers don't support the `-r' option and `-s' option like gtags-parser(1) does.
Plug-in parser must print tag information to standard output
in the same style as ctags -x
, ie.:
[1] [2] [3] [4] ---------------------------------------------------------------- main 20 ./main.c main(argc, argv) /* xxx */ [1] tag name [2] line number the tag appeared [3] path name. It must be equal to argument path name. [4] line image
Plug-in parser must process the files in the order they are given in the argument. In each file, any order is acceptable.
good-prog
does correct operation as a plug-in parser.
$ good-prog a.c b.c <= order: a.c -> b.c ~~~~~~~ main 25 a.c main(int argc, char *argv[]) func 45 a.c func(int a) { sub2 20 b.c sub2() { sub1 10 b.c sub1() { ^ | *** order: a.c -> b.c (Good!)
bad-prog
does wrong operation as a plug-in parser.
$ bad-prog a.c b.c <= order: a.c -> b.c main 25 a.c main(int argc, char *argv[]) sub2 20 b.c sub2() { sub1 10 b.c sub1() { func 45 a.c func(int a) { ^ | *** order: b.c -> a.c (BAD!!!)
Modifying some source files, you need not remake whole tag files. Instead, you can use incremental updating facility (`-u' option).
$ gtags $ cd kern $ vi tty.c # modify tty.c ... :wq $ global -vu # -v means verbose [Sun Dec 6 16:27:47 JST 1998] Gtags started Tag found in '/usr/src/sys'. Incremental update. [Sun Dec 6 16:28:48 JST 1998] Updating 'GTAGS'. [1/1] deleting tags of kern/tty.c [1/1] adding tags of kern/tty.c [Sun Dec 6 16:28:59 JST 1998] Updating 'GRTAGS'. [1/1] deleting tags of kern/tty.c [1/1] adding tags of kern/tty.c [Sun Dec 6 16:28:14 JST 1998] Updating 'GSYMS'. [1/1] deleting tags of kern/tty.c [1/1] adding tags of kern/tty.c Global databases have been modified. [Sun Dec 6 16:28:30 JST 1998] Done. $ global -vu # try again [Sun Dec 6 16:28:48 JST 1998] Gtags started Tag found in '/usr/src/sys'. Incremental update. Global databases are up to date. # do nothing [Sun Dec 6 16:28:52 JST 1998] Done.