* cflow

  1. system : linux path : /usr/bin/

  2. 不需要library

  3. description : 讀進一個程式檔,把function call 依呼叫的順序以階層式的形式列出 可一目了然的得知calling function和called function的關係

function在第一次被提及的時候,會以func {file.c n}的形式列出 ##func代表function name,file.c 為所讀入的filename,n為此function 出現在第幾行
之後function再被提及則以func {mm}的形式被印出 ## mm 表示這個function第一次被提到是在輸出結果的第幾行

global 的變數會以 var {v file.c n} 的形式列出 (需加-v 這個參數)

不在檔案內的function和變數(external function/variables)列出時

來源為空白的,如下
func {}


  1. 參數(option) -a 分別顯示各個function內的呼叫(function call) -A 消除ansi關鍵字 -P 消除POSIX關鍵字 -d nn 將nn層內(depth nn)的呼叫印出 -i 將function call反向印出(列出每個function會被哪些function呼叫) -r name 將name(function/variabel)設為開始的function(原本從main()開始) -v 顯示global 變數 -x function即使重複出現仍以func {file.c n}的形式印出 預設是以func {mm}的形式印出

-X header file

尋找所需的function時,把header file排除

  預設不尋找的header file有stdio.h, errno.h, ctypes.h,stdlib.h
-V 列出正在執行的指令

  1. example(程式碼在下方) cflow susi.c
                1       main {susi.c 14}
                2               fun1 {susi.c 4}
                3                       fun2 {susi.c 10}
                4               fun2 ... {3}
                5               printf {}
 
        cflow -a susi.c
                1       fun1 {susi.c 4}
                2               fun2 {susi.c 10}
                3       fun2 ... {2}
                4       main {susi.c 14}
                5               fun1 ... {1}
                6               fun2 ... {2}
                7               printf {}
                8       printf {}
 
        cflow -d 2 susi.c
                1       main {susi.c 14}
                2               fun1 {susi.c 4}
                3               fun2 {susi.c 10}
                4               printf {}
 
        cflow -i susi.c
                1       fun1 {susi.c 4}
                2               main {susi.c 14}
                3       fun2 {susi.c 10}
                4               fun1 {susi.c 4}
                5               main {susi.c 14}
                6       main {susi.c 14}
                7       printf {}
                8               main {susi.c 14}
 
        cflow -r fun1 susi.c
                1       fun1 {susi.c 4}
                2               fun2 {susi.c 10}

cflow -V susi.c

cpp susi.c
/usr/bin/cflow/prcc
/usr/bin/cflow/prcg

### 程式碼 ####

        susi.c
        #include
        init susi;
        void fun1()
        {
                fun2();
        }

        void fun2()
        {
        }

        void main ()
        {
                fun1();
                fun2();
                printf("a");
        }