Cbrowser is a graphical C/C++ source code searching and browsing tool, and a hierarchical function call viewer.
Cbrowser is a front end to the popular source code indexing and querying program cscope. It is also designed to work with the free alternative to cscope called cs. This can be obtained at ftp://cantor.informatik.rwth-aachen.de/pub/unix/.
Both of these tools have text based user interfaces, and have limited file viewing capabilities. Cbrowser provides a full featured file browser with syntax highlighing and full text searching.
Cbrowser helps manage the recursive process of searching through source code for usages by providing a history mechanism. Every query is recorded and can be recalled at any time, without the need of re-querying the database.
Cbrowser allows you to build and use multiple source code databases for individual software projects. Switching databases is as simple as selecting the file, and a history of all databases used is kept at all times.
Best of all, cbrowser provides a hierarchical function viewer. Functions may be expanded and contracted to show or hide the functions they call. The function's code itself is shown in an adjoining viewer. This feature is implemented using the megawidget Library by Jeff Hobbs which luckily for me comes with an unrestricted license.
Chances are if you have cscope on your machine, you are running Solaris and you have the workshop CD installed. In this case you also have sbrowser installed. In truth, cbrowser was partially inspired by sbrowser. I used to use it until I discovered cscope. Sbrowser has some nice features, but I felt that I could do better, and offer it as freeware, which Sun will most likely never do with sbrowser.
Sbrowser has the following features that cbrowser doesn't:
Cbrowser has the following features that sbrowser doesn't:
The most useful feature of sbrowser in my opinion is the call grapher. It's greatest use is for printing diagrams of function call flow. But unfortunately, there is no option to print! This leaves you stuck performing screen dumps which is tedious and often results in crappy output. Furthermore, for simply browsing, the call grapher is pretty cumbersome. You spend more time scrolling and expanding nodes than actually digesting the flow of the code.
Cbrowser will improve on these features. Currently, there is a function call hierarchical viewer. This is similar to the call grapher but more compact and easier to follow. It also has an adjoining viewer so the function code itself is available. For browsing, this is a great improvement over the grapher. In the future there will be options to exclude stdlib functions, and arbitrary lists of uninteresting functions to really streamline browsing.
Once the current feature set is stabilized, the next big push will be to implement the function call grapher. My plan is to use the hierarchy viewer to select what functions should be visible, and then generate the call graph from there. The call graph nodes will be movable, but not removable or expandable. Since the purpose of the call grapher will be primarily for printed trees, I will use Tk's PostScript generation features to generate output, and all graphs will be savable in source code form.
Another potential project is to actually use the sbrowser query engine as the backend to support the filtering features that sbrowser has. This is an extremely low priority, but wouldn't it be nice to have all of the features of both programs?
Cbrowser is implemented in Tcl/Tk. It requires at least version 7.6, and has been tested with Tcl 7.6/Tk4.2 and Tcl/Tk 8.0p2. I found a few minor problems with alpha releases of Tcl 8.0, so I strongly recommend using 8.0p2.
Cbrowser was designed to be used in a UNIX or UNIX-like environment, but it should be usable under Windows if that's what you really want... You may be able to adapt cs to function properly under Windows, but cscope is a UNIX tool only. Primarily cbrowser has been tested on a GNU-Linux x86 PC, but it has also been tested on SPARC Solaris 2.5.1 and x86 Solaris 2.6. There are no specific features of these operating systems used that should require any porting effort to other UNIX OSes or platforms.
I have chosen to distribute cbrowser under the GNU General Public License (aka "copyleft"). This means you can use it and abuse it as long as you don't try to sell it to someone else as if it were yours...
You can see a tclet demo of the program here. If you don't have the Tcl/Tk plugin go here to get it.
Now without further ado, you can obtain the full source code here:
Cbrowser is no longer a single source file. It is distributed as a gzip compressed UNIX tar file. It contains all of the necessary Tcl/Tk source for cbrowser, including the megawidgets provided by Jeff Hobbs.
Version 0.6 contains an important bug fix that caused hangups occasionally during long queries. It also has a new separate file viewer option, and scrollable history in entry fields. It is being released now primarily for the bug fix. The new features are still being ironed out.
Version 0.5 contains many, many new features. I worked far too many new things into 0.4, so I skipped a version and tried to work on mostly fixes for 0.5. But then I kept getting delayed, and more features got added. Here are some of the new things: