navigating the sources (was Re: patch: do-again for Background Checks patch)


Subject: navigating the sources (was Re: patch: do-again for Background Checks patch)
From: WJCarpenter (bill-abisource@carpenter.ORG)
Date: Thu Jul 27 2000 - 01:16:14 CDT


>> important tools to keep track of the source are, in
>> order
>>
>> Emacs
>> CVS
>> LXR
>> grep
>> Bonsai

jc> You've forgotten (e)tags. It's a very *very* useful tool.

etags is pretty popular, but I've always found it cumbersome to use,
especially for big software bases. It's probably just some mental
block I have that keeps me from seeing how handy it is for everyone
else.

A tool that I use a lot when looking for things in source code (I'm
usually looking for a specific symbol or places where a particular
function is called) is "cscope". I heartily, heartily recommend you
take a look at it if you haven't before.

You can find sources for it at <http://cscope.sourceforge.net>.
Although it is an ancient tool that predates C++ by several years, but
it still does a pretty servicable job with the Abi code. (Get the
beta sources from sourceforge instead of the pre-packaged binaries or
accompanying "released" sources; the "released" stuff gave me fits for
reasons I never tracked down.)

If you're an emacs user (whatever the heck that is :-), there's more
good news. From the same sourceforge page, you can find a link to
cscope.el, which is a bitchin' interface to the cscope program. (Heh,
I wrote it 8 or 9 years ago. :-) Now, once we have that scripting
language for AbiSuite, we can have a cscope interface in AbiWord,
right? :-)

In case anyone wants to go down the cscope path, I've attached a
couple of things that may be useful. First, my simple script that
rebuilds the symbol database (I can never remember the command line
options). Second, my emacs customizations for using cscope.el.

-- 
bill@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3

cd /usr/local/src/abi-nightly find src -regex '.*\.cpp\|.*\.h\|.*\.c' > cscope.files cscope -q -b -f `pwd`/cscope.out

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'cscope-bind-keys "cscope" nil t) (setq-default cscope-id "abicscope") (setq cscope-master-info-table '( ("abicscope" ("/usr/local/bin/cscope" "-l" "-q" "-d" "-f" "/usr/local/src/abi-nightly/cscope.out") "/usr/local/src/abi-nightly" ) ("CSCOPE" ("cscope" "-l") nil nil) )) (setq cscope-master-info-default '("CSCOPE" ("cscope" "-l") nil nil))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; this is my hook for C++ mode (defun wjc:c-mode-hook () "my C mode hook" (setq tab-width 4) (c-set-style "bsd") ;; only bother doing the bindings first time ... they'll stick (or (where-is-internal 'cscope-find-c-symbol (current-local-map)) (cscope-bind-keys)) (and (boundp 'cscope-blurb) (makunbound 'cscope-blurb)) (local-set-key "\M-?" 'cscope-find-c-symbol) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



This archive was generated by hypermail 2b25 : Thu Jul 27 2000 - 11:23:15 CDT