home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / msc51 / example / cflow.doc < prev    next >
Encoding:
Text File  |  1988-08-11  |  3.7 KB  |  118 lines

  1. NAME
  2.         CFLOW - Generates text showing flow of function relationships
  3.                 for specified C source files
  4.  
  5. SYNTAX
  6.         CFLOW [-v] [-r] [-dnum] filelist
  7.  
  8. DESCRIPTION
  9.  
  10. CFLOW scans C source code, building a caller list and a callee list
  11. for each function reference. Both function prototypes and function
  12. definitions are scanned for return types. Macros are considered
  13. functions. CFLOW can also analyze source files for the XENIX yacc and
  14. lex utilities.
  15.  
  16. Each output line has the following elements separated by white space
  17. (from left to right):
  18.  
  19.     optional cross-reference number (for first occurence of function only)
  20.     current nesting level number followed by tabs to current level
  21.     function name:return type()
  22.     <source file name,reference line number>
  23.  
  24. For example:
  25.     (  0)   1               foo:int() <test.c,5>
  26.  
  27. The default format is to display calling functions followed by called
  28. functions starting with main if it exists, or in alphabetical order if
  29. there is no main. If a function is called cyclically, its relationship 
  30. is shown only once. Subsequent calls cross-reference the first call.
  31.  
  32. The output format can be varied with the following options:
  33.  
  34. -r      Reverses the caller:callee relationship and sorts the
  35.         functions in alphabetical order.
  36.  
  37. -v      Shows relations between functions as many times as they occur
  38.         regardless of nesting. No cross-references are shown.
  39.         Programs with cyclic relations print out their dependencies
  40.         multiple (maximum nesting level * maximum nesting level)
  41.         times.
  42.  
  43. -dnum   Sets the maximum nesting level to num (default is 35).
  44.  
  45. EXAMPLE
  46.  
  47. Given the following code for file TEST.C:
  48.  
  49. extern char far *moo();
  50.  
  51. main()
  52. {
  53.         foo();
  54.         bar();
  55.         moo();
  56. }
  57.  
  58. char *foo()
  59. {
  60.         mar();
  61.         bar();
  62.         mar();
  63. }
  64.  
  65. unsigned int mar()
  66. {
  67.         bar();
  68. }
  69.  
  70. The following results are generated:
  71.  
  72. > cflow test.c
  73. test.c
  74.    0    main:int() <test.c,3>
  75. (  0)   1               foo:int() <test.c,5>
  76. (  1)   2                       mar:int() <test.c,12>
  77. (  2)   3                               bar:int() <test.c,19>
  78.         2                       bar:int() <test.c,13>
  79.         2                       mar:int() <test.c,14>
  80.         3                               ...relations shown at (2)
  81.         1               bar:int() <test.c,6>
  82.         1               moo:extern char far *() <test.c,7>
  83.  
  84. > cflow -r test.c
  85. test.c
  86.    0    bar:int() <,>
  87. (  0)   1               main:int() <test.c,6>
  88.         1               foo:int() <test.c,13>
  89. (  1)   2                       main:int() <test.c,5>
  90.         1               mar:int() <test.c,19>
  91. (  2)   2                       foo:int() <test.c,12>
  92.         3                               ...relations shown at (1)
  93.         2                       foo:int() <test.c,14>
  94.         3                               ...relations shown at (1)
  95.  
  96.    0    foo:int() <test.c,10>
  97.         1               ...relations shown at (1)
  98.  
  99.    0    main:int() <test.c,3>
  100.  
  101.    0    mar:int() <test.c,17>
  102.         1               ...relations shown at (2)
  103.  
  104.    0    moo:extern char far *() <,>
  105. (  3)   1               main:int() <test.c,7>
  106.  
  107. > cflow -v test.c
  108. test.c
  109.    0    main:int() <test.c,3>
  110.         1               foo:int() <test.c,5>
  111.         2                       mar:int() <test.c,12>
  112.         3                               bar:int() <test.c,19>
  113.         2                       bar:int() <test.c,13>
  114.         2                       mar:int() <test.c,14>
  115.         3                               bar:int() <test.c,19>
  116.         1               bar:int() <test.c,6>
  117.         1               moo:extern char far *() <test.c,7>
  118.