Cspot 0.0.5 review

Download
by rbytes.net on

Cspot is a semantic annotator designed only for the C programming language

License: GPL (GNU General Public License)
File size: 268K
Developer: Petr Susil
0 stars award from rbytes.net

Cspot is a semantic annotator designed only for the C programming language. It is quite similar to cscope, but some more functionality.

Cspot project can be used to find the declarations, definitions, and usages of functions, variables, macros, typedefs, and structs.

It can also find visible identifiers at some position in the source, functions called by a function, global variables used by a function, usages of local variable declarations, unused global variables, unused function definitions, and more. Because it uses sparse, cspot knows more about semantics than cscope.

cspot usage ( cspot -h )
cspot -db spot.db -regexp reg ;; prints all identifiers of project matching reg (extended regexp)
cspot -db spot.db -fc printf ;; prints all declarations of function printf
cspot -db spot.db -fu printf ;; prints all usages of function printf
cspot -db spot.db -vu stdout ;; prints all usages of variable stdout
cspot -db spot.db -sc my_sruct ;; prints places of forward declaration of struct my_struct
cspot -db spot.db -sf my_sruct ;; prints places of definition of struct my_struct
cspot -db spot.db -su my_sruct ;; prints places of usage of struct my_struct
cspot -db spot.db -si my_sruct ;; prints places of definition and variables in struct my_struct
etc.

cspot -va source.c 254 21 ;; prints all visible identifiers at source.c line 254 pos 21
cspot -vla source.c 254 21 ;; prints all visible identifiers (declared in file source.c) at source.c line 254 pos 21

commands for visible functions, macros, variable, called functions by function, global variables used by function ...

cspot -db spot.db -fu printf
printfs all usages of function printf in project (usage = call, assigning to variable)

printf at `base/cmd/commands.h' 249:7
printf at `base/cmd/commands.h' 327:8
printf at `base/cmd/commands.h' 337:8
printf at `base/cmd.c' 313:3
printf at `base/cmd.c' 318:7
printf at `base/cmd.c' 319:36
printf at `base/cmd.c' 321:36
printf at `base/cmd.c' 322:36
printf at `base/cmd.c' 323:36

Cspot 0.0.5 search tags