I think this is a great idea, as any changes moving forward are good.

Patching against 5.8 though isn't a good idea.
5.8 was release so long ago, certainly all the devs are running against trunk.

I guess it boils down to who are you writing this patch for?  ctag users or ctag developers?


On Tue, Nov 27, 2012 at 10:09 PM, Shigio YAMAGUCHI <shigio@gnu.org> wrote:
Hi all,

Since there was no contrary to my proposal :), I have made a patch
for ctags to integrate GNU GLOBAL.

Please apply attached patch by the following procedure if you like.
I'll make another patch for the latest source code if needed.

$ cd ctags-5.8
$ patch -p1 < ctags-5.8.patch

New option --gtags:
        Print a type string at the head of each tag record of cross reference file.
        This option is used to integrate ctags into GNU GLOBAL.

        $ ctags -x --format=1 test.c
        func                5 test.c           func() {

        $ ctags -x --format=1 --gtags test.c
        D func                5 test.c           func() {

        $ ctags -x --format=2 --gtags test.c
        D func             function      5 test.c           func() {

New function makeSimpleReferenceTag():
        Put a type string 'R' at the head of a tag record.
        If you want to treat a tag as a reference, please use this function
        instead of makeSimpleTag(). This function does not influence the output
        of Exuberant Ctags without --gtags option.

        Output of makeSimpleTag()
                D func                5 test.c           func() {

        Output of makeSimpleReferenceTag()
                R func               35 test.c               if (test() == 0) {

If a parser supports reference tags, then you can use global command like follows:
(cvs version GLOBAL is needed though)

$ gtags                               # invokes Exuberant Ctags internally
$ global -x func
5            test.c    func() {                         # definition
$ global -xr func
35           test.c           if (func() == 0) {        # reference

The GLOBAL in the CVS repository (http://cvs.savannah.gnu.org/viewvc/global/global/)
already includes the code which supports ctags --gtags option. I'm going to release it
if there is no contrary. The release will include this (attached) patch too.

Great Ctags!

Best Regards,

Keep yourself connected to Go Parallel:
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
Ctags-devel mailing list