Rescued by cscope

17 06 2008

I have been working on mozilla codebase quite sometime. Its a huge codebase with millions of lines of code. A simple counting on the numbers of lines in *.cpp files for 3.0b2 release accounts 1778818 lines of code[1]. Most of the time I need to search for function definitions – I used grep -r xyz * as that was the only option I know until recently I have started using cscope which came as a rescue. cscope maintains its own database of symbol definition of the code. You can find the symbol, find a symbol definition, a file , a text within source code. Configuration of the cscope database is simple.

Step 1 . Make a directory to store the cscope db say $HOME/mycscope/mozilla

Step 2. cd /

Step 3. say $HOME/mozilla is the home directory of the project that contains the source files(*.c,*.cpp,*.h)

run find $HOME/mozilla -name “*.cpp” >> $HOME/mycscope/mozilla/cscope.files

run find $HOME/mozilla -name “*.h” >> $HOME/mycscope/mozilla/cscope.files etc.

It will simply populate the cscope.files used by cscope to create the data with the desired filenames.

Step 4. run in $HOME/mycscope cscope -b -q -k which will create the database cscope.out

Step 5. run cscope -d from $HOME/myscope and start searching and browsing code.

In case you want to invoke it from vim add the following lines to your .vimrc

set nocsverb ; supress cscope logging messages
cscope add $HOME/mycscope/cscope.out

You should be able to invoke cscope from vim window now . eg try :cs find 1 XYZ

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

1. sum=0;for i in `find . -name “*.cpp” -exec wc -l {} \; |cut -d ‘ ‘ -f 1` ; do sum=`expr $sum + $i`; done; echo $sum





Copyright Vs Community w/ Richard Stallman

26 03 2008

Just got a chance to attend a seminar on Copyright Vs Community by Richard Stallman
I hope most of you are aware of this guy who pioneered the free software movement .
coined the term GNU is not UNIX , developed the most popular gcc compiler and emacs editors .

Stallman

Free software movement started in early eighties and by now its just as a dominant
race as the non-free softwares . Freedom is our right and proprietary softwares just
donot respect individual freedom . People are entitled to use only the way developer
design that software – there is no freedom to customize it to their need because the
source codes were not available. Stallman defined four degrees of freedom for a software
to be called a free software -
0 – they should be available freely for use \
1 – source code should be available for customized by the user
2 – user can distribute the custom software freely
3 – user can make as many copy of the software as he wants freely .

After this brief introduction he moved to the constraints that hinders the freedom of the users
Here comes the theme of the lecture . He mentioned how the copyright laws came into existence and how they
are helping the corporates to make money and comprising on the freedom of individual in a democratic society.
Example ranging from books to digital music got mention in his talk .
One example that worth mentioning is the music CDs prepared by Sony . Sony hides a copyright management
software in their music disks that runs automatically and and modifies some of the system parameters permanently so that
the software remains hidden from the user and prevent user from making copy of the music.
This caused a permanent security loophole in the system and computers became vulnerable to attacks.
Sony was finally forced to recall million of its CDs .

I personally feel that copyright should be there – but I believe this should not be the same way as they
are today . And when it comes to different category of copyright able subjects they
should be treated differently.He mentioned some innovative way publishers are making money
without sharing much of the revenue with the author or the composer. Stallman mentioned that books , musics
etc are subjected to a limited copyright. In case of softwares , he insisted that their non commercial use
should be free and the above four freedom should exists in the software world to help maintaining a democratic society.

He finally urge everyone to stand against the wave and support the freedom of software .
If you would like to participate in the movement here is a good point to start .