help-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #line compiler directives in results.


From: Chris Grebeldinger
Subject: Re: #line compiler directives in results.
Date: Sat, 9 Feb 2008 09:46:32 -0500

I understand that I can add my special suffix, but what I really want is to process c++ files but have each tag point back to the original pre-processed file via the embedded #line directives:

/v/main/src/myclass.pre -special syntax c++
eg:
CLASSDECL myclass
CONSTRUCTOR myclass
ENDCLASSDECL


/v/main/work/myclass.cxx  - plain c++ with #line directives pointing back to myclass.pre
eg:
#line 1 "/v/main/src/myclass.pre"
class myclass {
public:
#line 2 "/v/main/src/myclass.pre"
  myclass();
#line 3 "/v/main/src/myclass.pre"
}

So I run gtags on myclass.cxx, which generates tags properly, but i want all the tags to respect the #line directives for file & line information in the tags file.

so that tag:
myclass::myclass() ---> myclass.pre, line 2
instead of myclass.cxx, line 5

Thanks!


On Feb 7, 2008 7:17 AM, Shigio YAMAGUCHI <address@hidden> wrote:
>   Many of the source files I am working with are pre-processed C++ with
> their own special syntax, and the resulting .cpp files have #line directives
> throughout which refer back to the un-processed source.  I am generating
> tags from the resulting .cpp files.  Is there any way to configure global to
> handle those directives, so that search results only include the
> un-processed files?

Hi,
You can configure it. Please copy and rewrite configuration file for gtags.
It is assumed that the suffix of your files is '.XYZ'.

$ cp /usr/local/share/gtags.conf $HOME/.globalrc        # copy configuration file into
                                                       # your home directory
$ vi $HOME/.globalrc                                    # rewrite cpp: entry

+------------------------------------------------------------------------------------
|:langmap=c\:.c.h,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.cpp.cxx.hxx.hpp.C.H,
                                                              |
                                                              v
+------------------------------------------------------------------------------------
|:langmap=c\:.c.h,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.XYZ.cxx.hxx.hpp.C.H,

$ cd [your source directory]
$ gtags

But I don't know whether gtags can treat the special syntax in your source file.
Luck is wished.
--
Shigio YAMAGUCHI <address@hidden> - GNU Project
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]