Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen output for C

Tags:

c

doxygen

I have used Doxygen for years with C++ code. I'd like to use it with some C code that I'm working on, but the output is less than optimal. The "Classes" tab in the top bar shows only the struct definitions, not the functions in the file. I have to click on the "Files" tab and then the name of the header file to view the functions it contains.

Is there any way to modify the output of Doxygen so that it is more suitable to code written in C? Or at the very least, remove the "Classes" tab and provide only the "Files" view?

like image 479
Paul Avatar asked Jul 14 '14 13:07

Paul


People also ask

How do you use doxygen C code?

The Doxygen structural command to use is “@mainpage” as shown in the example above. This tag on one of our markdown files will tell the Doxygen parser that a given markdown file is the main page for the project. This is the page shown when you click index. html from the HTML folder generated by Doxygen.

What is @brief in C?

Putting the command @brief will generate a short description of the function when you generate the doxygen documentation. That short description can be extended if you want.

Does doxygen work with C #?

Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, and to some extent D.

How do I comment out a code in doxygen C++?

Once specified, you can generate the comment stub by typing the respective “///” or “/**” above a function, or by using the (Ctrl+/) shortcut.


2 Answers

You can set

OPTIMIZE_OUTPUT_FOR_C = YES

in the config file, to get output that is more C oriented.

like image 138
doxygen Avatar answered Sep 20 '22 05:09

doxygen


If you create a layout file in addition to the normal config file:

doxygen -l layout.xml

You can edit that; this controls the basic format of the interface. If you want to remove the "Classes" tab, locate:

<tab type="classes" visible="yes" title="Types">
    [...]
</tab>

And remove it or change visible to "no".

C functions and datatypes are usually grouped together in files in a non-random way, so the "Files" tab alone may be sufficient for you. If not, use groups:

\ingroup foobar

Can be added to struct and function definitions, etc. You then need a

\defgroup foobar Description of foobar.

somewhere. This will then be used by

<tab type="modules" visible="yes" title="Modules" intro=""/>

From layout.xml, producing a possibly more intuitive interface than "Files" (e.g., struct documentation from a .h and function documentation from a .c are organized together if they are in the same group), akin to how "Classes" works with C++.

There's more about this stuff in the doxygen site.

like image 36
CodeClown42 Avatar answered Sep 22 '22 05:09

CodeClown42