cflow(1) General Commands Manual cflow(1)
NAME
cflow - Generates a C language flow graph of external references
SYNOPSIS
cflow [-r] [-d number] [-D name[=def]]... [-i incl] [-I dir]... [-U dir]... [-MA] [-Ndnumber] [-Nlnumber] [-Nnnumber] [-Ntnumber] file...
The token -- (double-dash) is accepted as a delimiter indicating the end of options. Any following arguments are treated as operands, even
if they begin with the - character.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
cflow: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Indicates the depth at which the flow graph is cut off. The argument number is a decimal integer. By default this is a very large number.
Attempts to set the cut-off depth to a nonpositive integer are ignored. Defines name, as if by a C-language #define directive. If no =def
is given, a value of 1 is used. Changes the number of included symbols. The incl parameter is one of the following characters: (Under-
score). Includes names that begin with an underscore character. By default, these functions are excluded (and corresponding data if -i x
is used). [Tru64 UNIX] Disables ANSI function prototypes. By default, undefined function information is filled in with available proto-
type declarations. Includes external and static data symbols. By default, only functions are included. Adds the directory specified by
dir to the list of directories in which the lint program searches for #include files. [Tru64 UNIX] Specifies that the first pass of the
modified lint command is operated in ANSI mode. The default mode of operation is extended mode. [Tru64 UNIX] Changes the dimension table
size to number. The default value of number is 2000. [Tru64 UNIX] Changes the number of type nodes to number. The default value of number
is 8000. [Tru64 UNIX] Changes the symbol table size to number. The default value of number is 1500. [Tru64 UNIX] Changes the number of
tree nodes to number. The default value of number is 1000. Produces an inverted listing that shows the callers of each function, sorted by
called function. Removes any initial definition of name, where name is a reserved symbol that is predefined by the particular preproces-
sor.
DESCRIPTION
The cflow command analyzes a collection of object files or assembler, C-language, lex, or yacc source files, and attempts to write a chart
of their external references to standard output.
Files suffixed in are processed by lex and yacc and preprocessed by the compiler preprocessor phase (bypassed for files) as appropriate.
The output is then run through a modified first pass of lint. Files suffixed with are assembled and information is extracted (as in files)
from the symbol table.
From this output, cflow() writes a flow graph to standard output. Each line of output provides the following information (in order from
left to right): A line number followed by sufficient tabs to indicate the level of nesting The name of the global, a colon, and its defini-
tion
The name is normally a function not defined as external and not beginning with an underline character (see the -i _ and -i x inclusion
options). For information extracted from C source files, the definition consists of an abstract type declaration (for example, char*), the
name of the source file surrounded by angle brackets, and the line number on which the definition was found. Definitions extracted from
object files contain the filename and section under which the symbol appeared, such as text or data. The cflow command deletes leading
underline characters in C-style external names.
Once the cflow command displays a name, later references to the name contain only the cflow line number where the definition can be found.
For undefined references, cflow displays only <> (angled brackets). If the nesting level becomes too deep to display in available space,
pipe the output from the cflow command to the pr command using the -e option to compress the tab expansion to less than eight spaces per
tab stop.
To ensure that the line numbers produced by cflow match your lex and yacc files, you must send the or file to the cflow command.
EXAMPLES
Given the following in file.c:
int i; main() {
f();
g();
f(); } f() {
i = h(); }
the command: cflow -i x file.c
produces the following output: 1 main: () int, <file.c 4> 2 f: () int, <file.c 11> 3 h: <>
4 i: int, <file.c 1> 5 g: <> To generate a default flow graph of these C files that comprise a
program, enter: cflow timeout.c kill.c error.c To produce a C flow graph with a single level of nesting of functions, enter: cflow
-d1 resam.c pptp.c ptpt.c rrr.c whn.c To generate a cflow graph of a lex program, enter: cflow scan.l To generate a cflow graph of a
yacc program, enter: cflow yaccfile.y To generate an inverted listing that shows the callers of each of the functions in the C files
used in the previous examples, enter: cflow -r resam.c pptp.c ptpt.c rrr.c whn.c
ENVIRONMENT VARIABLES
The following environment variables affect the behavior of cflow: Provides a default value for the locale category variables that are not
set or null. If set, overrides the values of all other locale variables. Determines the order in which output is sorted for the -r
option. Determines the locale for the interpretation of byte sequences as characters (single-byte or multibyte) in input parameters and
files. Determines the locale used to affect the format and contents of diagnostic messages displayed by the command. Determines the loca-
tion of message catalogs for processing of LC_MESSAGES.
SEE ALSO
Commands: lex(1), lint(1), nm(1), pr(1), yacc(1)
Standards: standards(5)
cflow(1)