unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



cflow(1)							     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 indus-
  try standards	and associated tags.

OPTIONS

  -d number
      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.

  -D name[=def]
      Defines name, as if by a C-language #define directive. If	no =def	is
      given, a value of	1 is used.

  -i incl
      Changes the number of included symbols.  The incl	parameter is one of
      the following characters:

      _	  (Underscore).	 Includes names	that begin with	an underscore charac-
	  ter. By default, these functions are excluded	(and corresponding
	  data if -i x is used).

      p	  [Tru64 UNIX]	Disables ANSI function prototypes. By default, unde-
	  fined	function information is	filled in with available prototype
	  declarations.

      x	  Includes external and	static data symbols. By	default, only func-
	  tions	are included.

  -I dir
      Adds the directory specified by dir to the list of directories in	which
      the lint program searches	for #include files.

  -MA [Tru64 UNIX]  Specifies that the first pass of the modified lint com-
      mand is operated in ANSI mode. The default mode of operation is
      extended mode.

  -Ndnumber
      [Tru64 UNIX]  Changes the	dimension table	size to	number.	The default
      value of number is 2000.

  -Nlnumber
      [Tru64 UNIX]  Changes the	number of type nodes to	number.	The default
      value of number is 8000.

  -Nnnumber
      [Tru64 UNIX]  Changes the	symbol table size to number. The default
      value of number is 1500.

  -Ntnumber
      [Tru64 UNIX]  Changes the	number of tree nodes to	number.	The default
      value of number is 1000.

  -r  Produces an inverted listing that	shows the callers of each function,
      sorted by	called function.

  -U name
      Removes any initial definition of	name, where name is a reserved symbol
      that is predefined by the	particular preprocessor.

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 .l,	.y, .c,	and .i are processed by	lex and	yacc and
  preprocessed by the compiler preprocessor phase (bypassed for	.i files) as
  appropriate. The output is then run through a	modified first pass of lint.
  Files	suffixed with .s are assembled and information is extracted (as	in .o
  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	definition

  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 con-
  tain 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 out-
  put 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 .l or .y file to the	cflow command.







EXAMPLES

   1.  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, <&lt;file.c 4>&gt;
	    2		    f: () int, <&lt;file.c 11>&gt;
	    3			    h: <&lt;>&gt;
	    4			    i: int, <&lt;file.c 1>&gt;
	    5		    g: <&lt;>&gt;

   2.  To generate a default flow graph	of these C files that comprise a pro-
       gram, enter:
	    cflow timeout.c kill.c error.c

   3.  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

   4.  To generate a cflow graph of a lex program, enter:
	    cflow scan.l

   5.  To generate a cflow graph of a yacc program, enter:
	    cflow yaccfile.y

   6.  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:

  LANG
      Provides a default value for the locale category variables that are not
      set or null.

  LC_ALL
      If set, overrides	the values of all other	locale variables.

  LC_COLLATE
      Determines the order in which output is sorted for the -r	option.

  LC_CTYPE
      Determines the locale for	the interpretation of byte sequences as	char-
      acters (single-byte or multibyte)	in input parameters and	files.

  LC_MESSAGES
      Determines the locale used to affect the format and contents of diag-
      nostic messages displayed	by the command.

  NLSPATH
      Determines the location of message catalogs for processing of
      LC_MESSAGES.

SEE ALSO

  Commands:  lex(1), lint(1), nm(1), pr(1), yacc(1)

  Standards:  standards(5)