File elements
Although some of the file queries operate on identifier properties,
all file queries produce file-list data as their result.
Clicking on an element of a file list leads you to a page
with a summary of the file.
File: /usr/include/stdio.h
Metrics
- Read-only: Yes
- Number of characters: 14935
- Comment characters: 6253
- Space characters: 1385
- Number of line comments: 0
- Number of block comments: 74
- Number of lines: 454
- Length of longest line: 77
- Number of C strings: 1
- Number of defined functions: 1
- Number of preprocessor directives: 124
- Number of directly included files: 2
- Number of C statements: 3
- Used in project(s):
Listings
Include Files
Main page
CScout 1.6 - 2003/06/04 15:14:51
|
The page contains some representative metrics for the given file,
the projects using this file, links for viewing the file's
source code, and links for listing include file dependencies.
You can view a file's source code in three different forms:
- The plain source code, will only provide you the file's code text
- Source code with identifier hyperlinks, will provide you with
a page of the file's code text where each identifier is represented as
a hyperlink leading to the identifier's page.
The following is a representative example.
- As the above display can be overwhelming, you may prefer
to browse the source code with hyperlinks only to project-global writable
identifiers, which are typically the most important identifiers.
Consider again how the above example would be displayed:
int
copy_fifo(from_stat, exists)
struct stat *from_stat;
int exists;
{
if (exists && unlink(to.p_path)) {
warn("unlink: %s", to.p_path);
return (1);
}
if (mkfifo(to.p_path, from_stat->st_mode)) {
warn("mkfifo: %s", to.p_path);
return (1);
}
return (pflag ? setfile(from_stat, 0) : 0);
}
|
File Metrics
File metrics produces a summary of the workspace's file-based
metrics like the following:
File Metrics
Writable Files
Number of files: 1
File metric | Total | Min | Max | Avg |
Number of characters | 2272 | 2272 | 2272 | 2272 |
Comment characters | 98 | 98 | 98 | 98 |
Space characters | 176 | 176 | 176 | 176 |
Number of line comments | 8 | 8 | 8 | 8 |
Number of block comments | 0 | 0 | 0 | 0 |
Number of lines | 86 | 86 | 86 | 86 |
Length of longest line | 47 | 47 | 47 | 47 |
Number of C strings | 44 | 44 | 44 | 44 |
Number of defined functions | 0 | 0 | 0 | 0 |
Number of preprocessor directives | 70 | 70 | 70 | 70 |
Number of directly included files | 12 | 12 | 12 | 12 |
Number of C statements | 0 | 0 | 0 | 0 |
Read-only Files
Number of files: 43
File metric | Total | Min | Max | Avg |
Number of characters | 246448 | 384 | 14935 | 5731 |
Comment characters | 134895 | 129 | 6820 | 3137 |
Space characters | 18580 | 5 | 1817 | 432 |
Number of line comments | 1 | 0 | 1 | 0 |
Number of block comments | 1229 | 1 | 114 | 28 |
Number of lines | 7064 | 16 | 484 | 164 |
Length of longest line | 3395 | 62 | 107 | 78 |
Number of C strings | 184 | 0 | 38 | 4 |
Number of defined functions | 0 | 0 | 0 | 0 |
Number of preprocessor directives | 1865 | 0 | 179 | 43 |
Number of directly included files | 90 | 0 | 13 | 2 |
Number of C statements | 0 | 0 | 0 | 0 |
Main page
CScout 1.6 - 2003/06/04 15:14:51
|
All files
The "All files" link will list all the project's files, including
source files, and directly and indirectly included files.
You can use this list to create a "bill of materials" for the files your
workspace requires to compile.
The following is an example of the output:
All Files
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
Read-only files
The "Read-only files" link will typically show you the system files your
project used.
The following output was generated using the "remove common path prefix in
file lists" option.
Read-only Files
- /usr/local/include/cscout/
- /usr/include/
- /usr/include/machine/
- /usr/include/
- /usr/include/sys/
- /usr/include/
- /vol/src/bin/cp/
- /vol/src/bin/date/
- /vol/src/bin/echo/
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
Writable files
Correspondingly the "Writable files" link will only show you all your
workspace's source files:
Writable Files
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
Files containing unused project-scoped writable identifiers
The link
``files containing unused project-scoped writable identifiers''
performs an identifier query, but lists as output files containing
matching identifiers.
Specifically, the link will produce a list of files containing
global (project-scoped) unused writable identifiers.
Modern compilers can detect unused block-local or even file-local
(static
) identifiers, but
detecting global identifiers is more tricky, since it requires
processing of all files that will be linked together.
The restriction to writable identifiers will filter-out noise
generated through the use of the system's library functions.
In our example, the following list is generated:
Files Containing Unused Project-scoped Writable Identifiers
Matching Files
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
The output contains the path to each file, and a link that will
generate the file's source code with the offending identifiers
marked as hyperlinks.
You can use the ``marked source'' link to inspect the identifiers in the
context of their source code;
simply follow the link with your browser and press tab
to go to each hyperlink.
In our example the identifier will appear as follows:
void
setthetime(fmt, p, jflag, nflag)
const char *fmt;
register const char *p;
int jflag, nflag;
{
register struct tm *lt;
struct timeval tv;
const char *dot, *t;
int century;
|
(In our case the function setthetime
is declared as
static
, but not defined as such.)
Files containing unused file-scoped writable identifiers
The link
``files containing unused file-scoped writable identifiers''
performs an identifier query, but lists as output files containing
matching identifiers.
Specifically, the link will produce a list of files containing
file-scoped (static
) unused writable identifiers.
Although some modern compilers can detect file-local
identifiers, they fail to detect macros and some types of
variable declarations.
The CScout query is more general and can be more reliable.
The restriction to writable identifiers will filter-out noise
generated through the use of the system's library functions.
In our example, the following list is generated:
Files Containing Unused File-scoped Writable Identifiers
Matching Files
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
In our case all identifiers located were the
copyright
and the rcsid
identifiers.
#ifndef lint
static char const copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)echo.c 8.1 (Berkeley) 5/31/93";
#endif
static const char rcsid[] =
"$FreeBSD: src/bin/echo/echo.c,v 1.8.2.1 2001/08/01 02:33:32 obrien Exp $";
#endif /* not lint */
|
Later on we will explain how an identifier query could have used a regular
expression to filter-out the noise generated by these two identifiers.
Writable .c files without any statements
The
``writable .c files without any statements''
will locate C files that do not contain any C statements.
You can use it to locate files that only contain variable definitions,
or files that are #ifdef
'd out.
In our example,
the result set only contains the compiled workspace definition file.
Writable .c Files Without Any Statments
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
The compiled workspace definition file follows the C syntax,
but only contains preprocessor directives
(mostly CScout-specific #pragma
commands)
to drive the CScout's source code analysis.
Writable files containing strings
The ``writable files containing strings'' link will present you
C files containing C strings.
In some applications user-messages are not supposed to be put
in the source code, to aid localization efforts.
This file query can then help you locate files that contain
strings.
In our case the results are:
Writable Files Containing Strings
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
Writable .h files with #include directives
Some coding conventions dictate against recursive #include
invocations.
This query can be used to find files that break such a guideline.
As usual, read-only system files are excluded; these typically
use recursive #include
invocations as a matter of course.
In our example, the result is:
Writable .h Files With #include directives
You can bookmark this page to save the respective query Main page
CScout 1.6 - 2003/06/04 15:14:51
|
Contents Previous Next (Generic file queries)
Last change: Thursday, August 21, 2003 10:48 pm
(C) Copyright 2000-2003 Diomidis Spinellis. May be freely viewed using web browsers and similar programs. All other rights reserved.