The DejaVU Framework -- hush 3.1
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?

Manual: INCL 1 "March 1995" "CIA User's Manual"


[.] [man] man1 man2 man3 man4 man5 man6 man7 man8 man9 manl mann ?

NAME

incl

SYNOPSIS


incl [ -e ][ .BR -i draw ][ .BR -l level ][ .BR -r draw ][ -F ][ .BR -G xsize,ysize ] [ .BR -I ] [ .BR -R xsize,ysize ] [ .BR -S "file,..." ][files]


slide: SYNOPSIS

DESCRIPTION


Given a set of .c or .A files, incl analyzes, for each file, the relationships among all files that are included directly or indirectly using the #include directive of the C preprocessor. Options are provided to output various textual lists or graphic drawings that show unnecessary include files and relationships among files in the same include hierarchy. incl performs the analysis by using the file inclusion and entity reference relationships stored in the CIA database (see .IR cia (1)). For example, let x.c be a source file that includes x.h and, in turn, x.h includes y.h and z.h. This simple include hierarchy can be shown in a textual form:

  .ft CW
          x.c
                x.h
                  y.h
                  z.h        
  .ft R
  
Suppose further that x.c uses no symbols in x.h and z.h, but does use symbols in y.h. Then, by definition, z.h is not necessary and y.h is necessary. x.h is also considered necessary because it is on the path to y.h. For ease of reference, we shall call include files of this type on-path files. By default, incl prints all unnecessary files in the output. Following are the options to incl (no space characters are allowed between an option character and its argument(s)):

Files given to incl must have suffices .c (C source code) or .A (CIA data). If the files reside in a directory other than the current directory, the respective directory should be given in the environment variable CIAODBDIR. The analysis done by incl is consistent with the conditional compilation flags given to cia during the construction of database files. If any of the flags is changed, then the analysis should be redone.


slide: DESCRIPTION

EXAMPLES


List unnecessary files included directly or indirectly by ciafan.c:

  .ft CW
  \$ incl ciafan.A
  ciafan.A :
          /usr/include/sys/stdtypes.h
          /usr/include/sys/sysmacros.h
          /usr/include/sys/types.h
          libpdb/buffer.h
          libpdb/pathmap.h
          libpdb/view.h
          user_format.h
  .ft R
  
Print the include hierarchy of util.c in a textual form. Use '~' to tag all unnecessary include files and '+' to tag all on-path files:
  .ft CW
  \$ incl -l util.c
  util.c
          incl.h
                  ../../../include/libcia/ciastream.h+
                          /usr/add-on/ast/include/ast/stdio.h
                                  /usr/add-on/ast/include/ast/sfio.h
                  tree.h~
          tree.h~
  .ft R
  
Generate an ed script and store it in ciafan.e, which can be used to remove the first-level #include statements in the original source file.
  .ft CW
  \$ incl -e ciafan.A
  \$ cat ciafan.e
  10d
  w
  \$ cp ciafan.c ciafan-new.c
  \$ ed ciafan-new.c < ciafan.e
  4574
  4549
  .ft R
  
Create a graphical view of the include hierarchy that shows the analysis results of ciafan.c. The DOT description is stored in ciafan.d. Also, replace all path prefixes of ../../../include by INC using sed(1). This helps increase the size of the fonts used in the incl picture.
  .ft CW
  \$ incl -R ciafan.A
  \$ sed -e 's,../../../include,INC,g' ciafan.d | dot -Tps > ciafan-1.ps
  \$ lpr ciafan-1.ps
  .ft R
  
Create the same incl graph, but only up to level 1. The original source file is at level 0. Set the size of the picture to 7.5 in. wide and 6 in. high.
  .ft CW
  \$ incl -R7.5,6 -l1 ciafan.A
  \$ dot -Tps ciafan.d > ciafan-2.ps
  \$ lpr ciafan-2.ps
  .ft R
  
Create a graphical view of the same include hierarchy without showing or considering any reference-only relationships (dashed edges). Also, force dot to utilize as much white space of the printed page as possible (filled).
  .ft CW
  \$ incl -R -i0 -f ciafan.A
  \$ dot -Tps ciafan.d > ciafan-3.ps
  \$ lpr ciafan-3.ps
  .ft R
  
Create a filled graphical view of a subset of the above picture by starting from two selected roots: ciafan.h and
  .ft CW
  \$ incl -R -Sciafan.h,../../../include/libpdb/infoview.h -i0 -f ciafan.A
  \$ dot -Tps ciafan.d > ciafan-4.ps
  \$ lpr ciafan-4.ps
  .ft R
  
Create the list of unnecessary include files for ciafan.c and store it in ciafan.u. Reduce the compilation time of ciafan.c by using Fowler's cpp to skip files listed in ciafan.u during C preprocessing. Supposing that cpp is installed in /usr/local/lib on a SUN Sparc station, the following commands will help reduce the compilation time of graphics.c
  .ft CW
  \$ incl -u ciafan.A
  \$ cc -Qpath /usr/local/lib -I../../../include -I-I-.u -c ciafan.c
  .ft R
  
The -I-I option instructs /usr/local/lib/cpp to read ciafan.u for a list of files that can be ignored during C preprocessing.
slide: EXAMPLES

SEE ALSO

Kiem-Phon Vo and Yih-Farn Chen, .IR "Incl: A Tool to Analyze Include Files", Summer 1992 USENIX Conference, San Antonio, Texas, pp. 199--208, June 1992. dot(1), cia(1), idb(1)

AUTHOR

Kiem-Phong Vo
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?
Hush Online Technology
hush@cs.vu.nl
09/24/99