Doxygen 是一個document generator,可以將程式中的註解轉換成為說明文件。通常我們在寫程式時,或多或少都會寫上註解,如果在寫註解的時候能依據某種格式,接著就可以透過document generator產生出漂亮的文件。Doxygen支援的程式語言包含C++、C、Java、Objective-C、Python、IDL(Corba and Microsoft flavors)、Fortran、VHDL、PHP和C#等。而且可以產生出的格式有HTML、RTF(MS-Word)、PostScript、PDF、manpage等。
安裝步驟就不多說了,直接來看doxygen的格式。
doxygen支援C-style,如:
/** * ... text ... */
Qt-style
/*! * ... text ... */
C++-style
/// /// ... text ... ///或
//! //!... text ... //!簡單範例doxy.c
#includedoxygen指令必須搭配設定檔(config),要記住的tag=value需要查閱一番,所以,我們就用gui - doxywizard來設定並且產生文件吧。/** * sum of two integer * * @param a an integer * @param b an integer * @return the sum of two integer */ int sum(int a, int b) { return (a+b); } int main(int argc, char *argv[]) { int a = 5, b = 10; printf("%d\n", sum(a, b)); return 0; }
最重要的就是填入source所在的目錄(source code directory)以及檔案輸出的目錄(destination directory)。這邊還有輸入工作目錄(working directory)、專案名稱(project name)以及專案版本(Project version or id)。

這邊選擇您的程式用哪種語言寫的。

這邊選擇輸出的格式以及格式的設定。

這邊選擇要輸出的圖示有哪些。

最後切到執行(run)這個頁面,按下Run doxygen執行doxygen。





產出的文件真是讓我沒話說的好。
沒有留言:
張貼留言