471,122 Members | 1,005 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

C++ cross referencer

Hello,

When reading source code, perhaps written by others and
consisting of a large number of files organized into a large
number of directories, several identifiers of unknown origin,
purpose, or use are encountered. In these cases it is nice
to be able to click on such an identifier to be able to bring
up a list of all files in the source code in which such an
identifier appears with the file path displayed as part of
the filename. Then it is nice to click on such filenames
to bring up the contents of the file with the line on which
the first occurrence of such an identifier appears displayed.
Such identifiers may be class names, function names,
enumerated values, data types, and so on. For instance
it may be that the header and source file for a member
function do not start with the same name and hence it
is difficult to find one given the other. We may want to
jump from header file to source file or vice versa. When
coming across an enumerated value in a class function,
it may not be clear where it is defined as it may be that
it is defined somewhere up in the class hierarchy for the
containing class, or perhaps in the global namespace.
Other times we may simply want to know in which
context a certain function is used so that when
rearranging code we don't break other code.
The number of situations is countless, but
what we need to do is quickly jump around,
from an identifier to other places in which it
appears, and from function definition to the
place where it is declared or from enumerated
value to the place where it is defined, or from
type definition to the place where it is typedef'd.
Anyone is welcome to add to the list. However,
what I would really like is some pointers to some
free cross-references that allowed you to do all of
this in one shot, allowing you to define the location
of the source code repository and let you jump from
place to place. Also, anyone know if a simple editor
like vim is able to support anything like that? I would
like to know about any other good free (or commercial)
tools or IDEs that can serve the purpose described.

Thanks,

JG

Oct 27 '06 #1
11 1614
John Goche wrote:
Hello,

When reading source code, perhaps written by others and
consisting of a large number of files organized into a large
number of directories, several identifiers of unknown origin,
purpose, or use are encountered. In these cases it is nice
to be able to click on such an identifier to be able to bring
up a list of all files in the source code in which such an
identifier appears with the file path displayed as part of
the filename. Then it is nice to click on such filenames
to bring up the contents of the file with the line on which
the first occurrence of such an identifier appears displayed.
Such identifiers may be class names, function names,
enumerated values, data types, and so on. For instance
it may be that the header and source file for a member
function do not start with the same name and hence it
is difficult to find one given the other. We may want to
jump from header file to source file or vice versa. When
coming across an enumerated value in a class function,
it may not be clear where it is defined as it may be that
it is defined somewhere up in the class hierarchy for the
containing class, or perhaps in the global namespace.
Other times we may simply want to know in which
context a certain function is used so that when
rearranging code we don't break other code.
The number of situations is countless, but
what we need to do is quickly jump around,
from an identifier to other places in which it
appears, and from function definition to the
place where it is declared or from enumerated
value to the place where it is defined, or from
type definition to the place where it is typedef'd.
Anyone is welcome to add to the list. However,
what I would really like is some pointers to some
free cross-references that allowed you to do all of
this in one shot, allowing you to define the location
of the source code repository and let you jump from
place to place. Also, anyone know if a simple editor
like vim is able to support anything like that? I would
like to know about any other good free (or commercial)
tools or IDEs that can serve the purpose described.
I use Microsoft Visual Studio (commercial) for C++ and NetBeans IDE
(free) for Java. Both have code browsing and refactoring tools similar
to what you describe.

Regards,
Bart.

Oct 27 '06 #2
John Goche wrote:
Hello,

When reading source code, perhaps written by others and
....
tools or IDEs that can serve the purpose described.
I sometimes run doxygen over an unknown codebase.
Oct 27 '06 #3
In comp.lang.c++ John Goche <jo*******@gmail.comwrote:
When reading source code, perhaps written by others and
consisting of a large number of files organized into a large
number of directories, several identifiers of unknown origin,
purpose, or use are encountered. In these cases it is nice
to be able to click on such an identifier to be able to bring
up a list of all files in the source code in which such an
identifier appears with the file path displayed as part of
the filename. Then it is nice to click on such filenames
to bring up the contents of the file with the line on which
the first occurrence of such an identifier appears displayed.
Such identifiers may be class names, function names,
enumerated values, data types, and so on. For instance
it may be that the header and source file for a member
function do not start with the same name and hence it
is difficult to find one given the other. We may want to
jump from header file to source file or vice versa. When
coming across an enumerated value in a class function,
it may not be clear where it is defined as it may be that
it is defined somewhere up in the class hierarchy for the
containing class, or perhaps in the global namespace.
Other times we may simply want to know in which
context a certain function is used so that when
rearranging code we don't break other code.
The number of situations is countless, but
what we need to do is quickly jump around,
from an identifier to other places in which it
appears, and from function definition to the
place where it is declared or from enumerated
value to the place where it is defined, or from
type definition to the place where it is typedef'd.
Anyone is welcome to add to the list. However,
what I would really like is some pointers to some
free cross-references that allowed you to do all of
this in one shot, allowing you to define the location
of the source code repository and let you jump from
place to place. Also, anyone know if a simple editor
like vim is able to support anything like that? I would
like to know about any other good free (or commercial)
tools or IDEs that can serve the purpose described.
You should look into ctags.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Oct 27 '06 #4
John Goche wrote:
Hello,

[source code analysis tool request redacted]
cscope is also nice.

Oct 27 '06 #5
On Fri, 27 Oct 2006 13:47:26 Marcus Kwok wrote:
>You should look into ctags.
Can it reasonably handle C++?
Oct 27 '06 #6
On Fri, 27 Oct 2006 14:53:18 GMT, red floyd <no*****@here.dudewrote:
>John Goche wrote:
>Hello,
[source code analysis tool request redacted]

cscope is also nice.
"The fuzzy parser supports C, but is flexible enough to be useful for
C++ and Java" (http://cscope.sourceforge.net/). What about the actual
support for C++?
Oct 27 '06 #7
Roland Pibinger wrote:
On Fri, 27 Oct 2006 14:53:18 GMT, red floyd <no*****@here.dudewrote:
>John Goche wrote:
>>Hello,
[source code analysis tool request redacted]
cscope is also nice.

"The fuzzy parser supports C, but is flexible enough to be useful for
C++ and Java" (http://cscope.sourceforge.net/). What about the actual
support for C++?
It's not bad. Not perfect, but not bad.
Oct 27 '06 #8
In comp.lang.c++ Roland Pibinger <rp*****@yahoo.comwrote:
On Fri, 27 Oct 2006 13:47:26 Marcus Kwok wrote:
>>You should look into ctags.

Can it reasonably handle C++?
Exuberant Ctags claims support for over 33 different languages,
including C++.

http://ctags.sourceforge.net/desire.html
What makes this implementation of ctags desirable?
....
2. It is capable of generating tags for all types of C/C++ language tags,
including all of the following:

- class names
- macro definitions
- enumeration names
- enumerators
- function definitions
- function prototypes/declarations
- class, interface, struct, and union data members
- structure names
- typedefs
- union names
- variables (definitions and external declarations)

Also, from http://ctags.sourceforge.net/faq.html#7 :

If you specify the --extra=+q option, then ctags will also generate
a second, class-qualified tag for each class member (data and
function/method) in the form class::member for C++

which allows you to jump to class-qualified identifiers as well.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Oct 27 '06 #9
Marcus Kwok wrote:
In comp.lang.c++ Roland Pibinger <rp*****@yahoo.comwrote:
On Fri, 27 Oct 2006 13:47:26 Marcus Kwok wrote:
>You should look into ctags.
Can it reasonably handle C++?

Exuberant Ctags claims support for over 33 different languages,
including C++.

http://ctags.sourceforge.net/desire.html
What makes this implementation of ctags desirable?
...
2. It is capable of generating tags for all types of C/C++ language tags,
including all of the following:

- class names
- macro definitions
- enumeration names
- enumerators
- function definitions
- function prototypes/declarations
- class, interface, struct, and union data members
- structure names
- typedefs
- union names
- variables (definitions and external declarations)

Also, from http://ctags.sourceforge.net/faq.html#7 :

If you specify the --extra=+q option, then ctags will also generate
a second, class-qualified tag for each class member (data and
function/method) in the form class::member for C++

which allows you to jump to class-qualified identifiers as well.
I have been using LXR from http://lxr.sourceforge.net/. This tool
is really not bad. However, it lacks the class-qualified tags you
describe.

Thanks,

JG

Oct 30 '06 #11
John Goche wrote:
Also, anyone know if a simple editor like vim is able to
support anything like that?
The Zeus for Windows IDE (shareware) can automatically manage
the creation of tags for a set of project files and it displays
the tags information in a class browsing tree:

http://www.zeusedit.com/features.html

It has options to search and navigate the tree, allowing you
to easily jump to the definition and implementation details
but the tree does not contains any xref details.

Jussi Jumppanen
Author: Zeus for Windows

Oct 30 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by rollasoc | last post: by
1 post views Thread by Rob Woodworth | last post: by
1 post views Thread by Mihamina Rakotomandimby (R12y) | last post: by
6 posts views Thread by ampo | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.