Lucent cscope home page

CSCOPE is the original C program browser for UNIX.

It provides the ability to answer "scoping" questions, like:

CSCOPE answers these questions from a symbol database that it builds the first time it is called on the source files. On a subsequent call, CSCOPE rebuilds the database only if a source file has changed or if the list of source files is different. When the database is built the data for the unchanged files is copied from the old database, which makes rebuilding much faster than the initial build.

After the database is ready CSCOPE will display these input fields:

Press the TAB key repeatedly to move to the desired input field, type the pattern to search for, and then press the RETURN key. For the first 5 and last 2 input fields, the pattern can be a regcmp(3X) regular expression. If the search is successful, you can use these command characters:

At any time you can use these command characters:

To use CSCOPE on all source files in the current directory just type:

Alternatively you can provide a list of source files by typing:

The separate build and access options are shown above.

To support large databases, which would make symbol searches slower, type:

This builds a SLIMMER inverted index for fast symbol searching.

To use CSCOPE with compressed databases, type:

This is aimed at large centralised database support, where access is provided to compressed databases. As such, CSCOPE will uncompress the database into a temporary directory and access it. If the database is already uncompressed in the temporary directory, it will just access it directly. This improves access time across multiple users of a large compressed database.

MLCSCOPE parses source files written in multiple languages at the same time, based on the file suffix. You can override the file suffix using the multi-lingual option:

The CSCOPE database provides more information than is accessible from the simple questions used by the normal menu. To emulate the CCALLS tool, an extended menu is available with the following input fields:

To use these fields, type: These is also a CSCALLS script to run the CSCOPE CCALLS.

To use an editor with CSCOPE, it must support the +linenum option, e.g.

CSCOPE and MLCSCOPE are both available from the WWEXPTOOLS web site.

CSCOPE has some older variants available publicly, which originated within Lucent (or AT&T prior to the divestiture), when CSCOPE was submitted to UNIX, when this was owned by AT&T. This early version was sold of as part of UNIX System Labs, which was bought by Santa Cruz Operation and subsequently released as Open Source. As such, version 11.4 was enhanced as Open Source and renamed as version 15. However, Lucent CSCOPE progressed within AT&T and Lucent over the past 15 years, as version 12 and 13 and has significantly more functionality through its use over many years. MLCSCOPE was created to adapt CSCOPE to a Multi-Lingual approach and providing JAVA support.

The public version of CSCOPE is available from SourceForge.

Implementation notes:

Within Lucent, CSCOPE was modified to be very tolerant of a mixture of source files. However, the LEX scanner is so highly tuned that it is rarely productive to change it now, without having other impacts. This was also part of the motivation towards writing MLCSCOPE which uses a separate FLEX scanner for each language, thus separating the concerns.

The source for CSCOPE is version 13. The MULTILINGUAL preprocessor define is used for MLCSCOPE which is version 14.

CSCOPE can be compiled for DOS or WINDOWS by using the PDCURSES package. See the notes.win32 file.


Mark Skeates
Lucent Technologies UK
mskeates@lucent.com