


		SILENT BOB
"Silent Bob", actually, it can be drawn an analogy with three programs, which
leaded to its creation, ctags, cscope, ctree( first I'll describe them, and
their problems, and then - their differences from "Bob").

Description of some programs  ( on which motives SilentBob was written)

Let's take, for example, such well-known program as ctags, probably you've
used it and you know it's main point of work. It simply creates special file,
which stores information about some source files. Usually it's OS kernels and
other big programs, like sendmail or apache. This file contains:
1. "Addresses" of all functions, structures, macroses, etc. "Address" means
file name + string number (or regular expression, using which an appropriate
string can be found). That file, for example, in Vim, can be used to evaluate
":tag <name>" to make a quick switch. Also ctags allows to extract "goodies"
from files - simply to find out its contents.

csope - very useful program, it doesn't create file, described above, but can
do search and has some additional features:
1. Interface for "comfortable" search.
2. It can trace which functions called and what does they call (one layer
"lower")
3. It also can trace who calls certain functions  (one layer "upper")
And some other feature, which I have never used...

And at last - ctree. Theoreticaly, it can show all above described information
several layers "lower". Practically I couldn't turn it on.

Problems of existing software

ctags problems:
For "tags" file creation regular expressions are used, which allows to add
other languages, but places a substantial limits:
1. Quality of received information is quite low.
2. Information, which we receive, in "interactive" mode is not full enough.
3. Support for C++ is present, but not quite good.

cscope problems:
Actually, all ctags problems, plus:
1. Base, which actually doesn't needed anybody, but "weights" 150 Mbytes (for
Linux 2.6.14 for example)
2. Quality of "interactivity" is not good enough
3. Support for C++ is absent. This is not good, because problems, which this
kind of software is called to solve, lies down to different libraries,
including Qt3/GTK.

In SilentBob this problems are absent. Program uses preprocessor (written by
me) either than regular expressions.

Main ideas of SilentBob

Preprocessor, which is described above, is called "THE_TT" and placed in
appropriate file...
Actually it's quite simple: it removes all "extras" from C/C++ source. It
removes/minimizes all variants of C code notations, removes all extra space
symbols and comments, adds additional spaces where it's necessary (for
example, before brackets). THE_TT allows to take some part of code and
exactly (about 99%) tell you what is it, using minimum of checks.
All it works quite fast (for example, 1.6 GHz processor, 256 Mb of RAM - works
excellent), which allows to do some interesting things. As far as I know,
such kind of code usually is written only to compilers and isn't used for
other things, what, as for my view, isn't good enough.

Next SilentBob's level - "t_op", "what_is_this" and alike functions. First of
them simply allows to enumerate all "operators" of source code, second -
checks, what kind of operator do we met. Actually, "what_is_this" isn't
quite enough for all, so some additional functions exists... Now, THE_TT and
t_op are two separate parts of program. In future I plan to unite them...

It took from me for about one month to develop current version (1.0-rc1) and
two months for testing, finding out bugs, etc.

LYRICS
("life story", "blog" )

SilentBob was written one dark night, when one Siberian fellow tried to
understand how sys_poll system call works. After some time of digging the
sources and several tanks of drinked beer, this fellow understood, that
abilities of Gvim only isn't quite enough. Some tricks was made - they helped
a little, but this wasn't the solution.
Then, some other popular programs was used. After several tries fellow
understood, that he received the access to function he needs. But only one
function. If you take into account, that such calls, let's say, not only one
in program - you can imaging fellows indignation.


    Version 1.5
 - added -j N for --cgrep --grep --make-ctags --call-tags. Tags creation code (--make-ctags) is rewritten for new
engine (sblib/TT.cxx). gclib library was minimized to size needed only for SilentBob. Of course, you are able to 
download gclib2 separately.

    Version 1.4
 - Bug fixes. Bugs are caught, fryed and worn out
 - Removed support for ./tags file from exuberant-ctags. Now the project is autonomous and doesn't need it.
 - Added heapsort and [working] variant with paralleling.
 - All libs are in the one heap now




To build project you may use Scons (go to ./Scons), AAP (./AAP directory) or with plain ./configure

 -- Scripts:
  build_bob.bob  - used to create SConsturct, main.aap, build_bob.sh
             if you have bob and all plugins installed run as a
           ordinary script.
  build_bob.sh     - build all parts... with bash script. Very fast.
  install.sh     - alternative script for installing. It installs everything to /usr.
  make.sed     - SED script, which is used to automatize automake :-)
  package.sh     - alternative method for building SilentBob. It installs everything to ../package,
           removing all files in the current dir before.


To install plugins you must execute
$ make install_plugins
Plugins are installed to invariable directory
/usr/lib/silent_bob/
BUT you may manually copy files libplugin_* to the ~/.silent_bob/plugins/ directory.

  -- Building with alternative methods (non ./configure):
install.sh,package.sh,install.sh scripts are executed from build directory.
i.e. Executing from directories Scons or APP, you are to add "../scripts/".
Also it may be a bug (?) of changing the order in Scons. If you have such problem you may build needed targets in series (see the commands below).
<commands>
scons ligclib.so
scons libsblib.so
scons silent_bob
</commands>
Bug of incorrect compilation something non -O2 in CFLAGS was found in AAP 1.088.
Using scons, AAP or bash-script you must be in the first-level sub-directory, like:
./AAP ./SCons ./debug, or change top_srcdir= in build_bob.bob and recreate build files.
Of course, the second variant will work only if you have installed working version of Bob.

    HOW to USE:
Files for SilentBob are given as parameters or as file with filelist (every file is in the new line)
and option -L, i.e. -L <file with filelist>.

 -- Creating filelist:
$ bob --cfiles
or
$ bob -f

 -- Creating file ./tags
$ bob --make-ctags
or
$ bob -c
You may specify -j N --make-ctags, where N is the num of CPUs
*  templates are not indexed
** There is test option "--lang cpp" for C++. This option make Bob to use "C++" mode.
   In this mode global variables are not indexed. To search global vars in C++ code it's recommended
   to use --cgrep option.

If you have plugins installed (not from deb package), you may add for these options (--cfiles и --make-ctags) --perl or --python accordingly for Perl and Python, but this fitch is testing...
$ bob [--perl | --python] --files
$ bob [--perl | --python] --make-ctags
Created tag file is supported only by Vim, but you may use directly SilentBob to work with it.

 -- Creating ./call_tags file
$ bob <filelist> --call-tags
It creates tags file. But instead of start points of function it will be written where they are called.
You may rename it to ./tags, run Vi and go throw _functions_call_points with a plain usual command
	:tag

 -- Call-trees
./call_tags needed.

  -- Simple
$ bob <the name of function> [--depth N]
Where N is the maximum level (for huge projects).

  -- The reverse
$ bob -u <the name of function> [--depth N]
Сorrectness for C++ code functions is not guaranteed.
 
  -- Search in operators :
$ bob <filelist> --cgrep op1,op2...
Where op1 and op2 are required parts of _one operator_. I.e. to search the place of checking T variable
you may use, for example:
$ bob -L ./cfiles --cgrep if,T
Using -ts option (it may be used at once c>./tags) you may get tags-formatted output.

 -- Access to tags
$ bob --tags <function1> <function2> ... <functionN>
Where function1..functionN are needed symbol from ./tags file
The code if all listed functions will be reflected after this call

And also there are many another tasty things, not listed here.

                Other information
We need responses about working with Bob on another platforms.
Any thoughts on:
    Oleg Puchinin <graycardinalster@gmail.com>

Thanks for your attention.
Oleg.

Translation to English: Evgeniy Ivanov <lolkaantimat Angry_DOG gmail BIGdot com>
