Add Doxygen to C voice for better support in Linux environment

Source: Internet
Author: User
Tags configuration settings doxygen egrep

Doxygen can automatically generate documents from comments in the code. Therefore, mastering Doxygen's annotation format, configuration method and usage mode can greatly place code reading, document making and code review. The use of Doxygen can be described in terms of software installation, configuration settings, and document generation.

1. Software Installation

For CentOS, for example, install Doxgyen first:

Install Doxygen

Yum Search Doxygen

Yum install doxygen-latex.x86_64 doxygen.x86_64 doxygen-doxywizard.x86_64 polkit-qt-doc.noarch

Then install the dependent Graphics drawing tool software: Grahpviz

Install Graphviz

Yum Search Graphviz

Yum install graphviz-devel.x86_64 graphviz-doc.x86_64 graphviz-gd.x86_64 graphviz-guile.x86_64 graphviz-java.x86_64 graphviz-lua.x86_64 graphviz-perl.x86_64 graphviz-php.x86_64 graphviz-python.x86_64 graphviz-ruby.x86_64 graphviz-tcl.i686 graphviz-tcl.x86_64 graphviz.x86_64 graphviz-guile.x86_64

In order to facilitate the direct generation of Doxygen-recognized annotations in Vim, it is necessary to add support for the VIM plugin:

First download the VIM plugin:

https://vim.sourceforge.io/scripts/script.php?script_id=987


from which to choose Doxygentoolkit.vim 0.2.13

Then execute the following commands and actions in turn:

CP Doxygentookkit.vim ~/root/.vim/plugin/

Add the following lines at the end of the ~/.VIMRC:

[Email protected] plugin]# tail-f/ROOT/.VIMRC

"Let Tlist_auto_open=1

"Let G:vimmake_mode = {' gcc ': ' quickfix ', ' Run ': ' Normal '}

Let G:vimmake_mode = {' gcc ': ' async ', ' Run ': ' Normal '}

Let g:doxygentoolkit_authorname= "Tishai Hua"

Let g:doxygentoolkit_brieftag_funcname= "yes"

Map <f2>a:D Oxauthor

Map <f2>f:D Ox

Map <f2>b:D Oxblock

Map <f2>c o/** */<left><left>

This allows you to use Dox/doxblock/doxauthor to generate annotations that can be doxygen understood by referring to the following instructions:

Below generated By:doxauthor

/**

* @file test.c

* @brief

* @author Hongmei

* @version 0.01

* @date 2017-09-21

*/

Below generated by: ' Dox ' command in VIM

/**

* @brief

*

* @param a

* @param b

*

* @return

*/

int test (int a, int b)

{

int c,i;

Below generated by: ' Doxblock ' command in VIM

/**

* @name

* @{ */

/**  @} */

c = i = 1;

a++;

return A;

}

2. Configuration settings

You can run the following command to generate the Doxygen configuration file:

Doxygen-g

Then edit doxyfile, add support for C Inline/static/typedef, implement recursive parsing of directories, files, functions, support production reference and called Analysis diagram. My main settings are as follows, for reference only:

[[Email protected]]# cat Doxyfile | Grep-v "#" | Egrep-v "^$" | Egrep-v "=$" | Grep-v "NO"

doxyfile_encoding = UTF-8

Project_Name = "Low-3-sistr"

Project_number = "0.01"

Output_directory = doc/

Output_language = Chinese

Brief_member_desc = YES

Repeat_brief = YES

Always_detailed_sec = YES

Full_path_names = YES

Optimize_output_for_c = YES

Markdown_support = YES

Autolink_support = YES

Idl_property_support = YES

Typedef_hides_struct = YES

Lookup_cache_size = 0

Extract_all = YES

Extract_private = YES

Extract_static = YES

Extract_local_classes = YES

Case_sense_names = YES

Show_include_files = YES

Inline_info = YES

Sort_member_docs = YES

Generate_todolist = YES

Generate_testlist = YES

Generate_buglist = YES

generate_deprecatedlist= YES

Max_initializer_lines = 30

Show_used_files = YES

Show_files = YES

Show_namespaces = YES

INPUT =/home/andigu

input_encoding = UTF-8

File_patterns = *.c *.cpp *.java *.h

RECURSIVE = YES

Source_browser = YES

Strip_code_comments = YES

Referenced_by_relation = YES

References_relation = YES

References_link_source = YES

Source_tooltips = YES

Verbatim_headers = YES

Alphabetical_index = YES

Cols_in_alpha_index = 5

generate_html = YES

Enum_values_per_line = 4

Treeview_width = 250

Formula_fontsize = 10

Formula_transparent = YES

Mathjax_format = Html-css

SearchEngine = YES

Generate_latex = YES

Latex_output = Latex

Latex_cmd_name = Latex

Makeindex_cmd_name = MakeIndex

Paper_type = A4

Pdf_hyperlinks = YES

Use_pdflatex = YES

Latex_bib_style = Plain

Rtf_output = RTF

Man_output = Man

Man_extension =. 3

Xml_output = XML

xml_programlisting = YES

Docbook_output = DOCBOOK

Perlmod_pretty = YES

enable_preprocessing = YES

Search_includes = YES

Class_diagrams = YES

Hide_undoc_relations = YES

Dot_num_threads = 0

Dot_fontsize = 10

Class_graph = YES

Collaboration_graph = YES

Group_graphs = YES

Uml_look = YES

Uml_limit_num_fields = 10

Include_graph = YES

Included_by_graph = YES

Call_graph = YES

Caller_graph = YES

Graphical_hierarchy = YES

Directory_graph = YES

Interactive_svg = YES

Max_dot_graph_depth = 8

3. Document Generation

Then go to the input directory of the configuration file settings above, execute "Doxygen", after the command is completed, you can see the production of the HTML directory and the Latex directory in the output-developed directory. If you need to look at the entire code in HTML, you can open annotated.html in IE or in Firefox, and you can see all the code structures and comments.

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/07/2E/wKiom1nEnn6jUBBHAADM8HStLOc172.png "title=" Doxygen_demo.png "alt=" Wkiom1nenn6jubbhaadm8hstloc172.png "/>

This article is from the "Store Chef" blog, so be sure to keep this source http://xiamachao.blog.51cto.com/10580956/1967738

Add Doxygen to C voice for better support in Linux environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.