Tuesday, June 19, 2007

cscope - the use

I am still learning on use of cscope. Basically I hope to use it with emacs, thus I put "(require xcscope)" in my .emacs file. First problem, is how to generate database index, xcscope uses cscope-indexer, but it seems has problem for me. so I prefer using the following script to generate my sourcecode index.

#!/bin/sh
HLX=/home/build/src/helix
CSC=/home/build/src/cscope_d
cd $CSC
find $HLX -regex ".*\.\(c\|h\|cc\|cpp\)" -print > cscope.files
cscope -b -q


Speaking about the script, I have another script (ec) that can share here,

#!/bin/bash
exec emacsclient --no-wait $@

then set variable "export CSCOPE_EDITOR=ec", and my emacs, I have to enable "(server-start)" in my .emacs configuration file. this provides a way that invoke emacs from cscope. Actually I am using the other way, invoke cscope from emacs, that's why I use "xcscope.el".

Now the question is cscope doing good on C++? I don't know, and on my test, with Helix source code and MicroQ source code tree, both works worse :-( For emample of Helix, I search IHXPlayer by symbol, I found 475+4, and by global definition, it is about 31+8. better, not good as I directly go through the SDK document.

I also tried to use Kscope, but after download, I don't know how to build, there is no configure script. is my environment Gnome?

Although I am not happy on source code navigation with cscope, I will continue use it for a while at least a lot of people recommend it.