Software:Doxygen

From HandWiki
Short description: Free software for generating software documentation from source code
Doxygen
Doxygen.png
Doxygen-1.8.1.png
Developer(s)Dimitri van Heesch
Initial release26 October 1997; 26 years ago (1997-10-26)[1]
Stable release
1.10[2] / December 25, 2023; 6 months ago (2023-12-25)
Written inC++
Operating systemCross-platform
TypeDocumentation generator
LicenseGPLv2
Websitedoxygen.nl

Doxygen (/ˈdɒksiən/ DOK-see-jən)[3] is a documentation generator[4][5][6][7] and static analysis tool for software source trees. When used as a documentation generator, Doxygen extracts information from specially-formatted comments within the code. When used for analysis, Doxygen uses its parse tree to generate diagrams and charts of the code structure. Doxygen can cross reference documentation and code, so that the reader of a document can easily refer to the actual code.

Doxygen is free software, released under the terms of the GNU General Public License version 2 (GPLv2).

Design

Like Javadoc, Doxygen extracts documentation from source file comments. In addition to the Javadoc syntax, Doxygen supports the documentation tags used in the Qt toolkit and can generate output in HyperText Markup Language (HTML) as well as in Microsoft Compiled HTML Help (CHM), Rich Text Format (RTF), Portable Document Format (PDF), LaTeX, PostScript or man pages.

Uses

Programming languages supported by Doxygen include C,[8] C++, C#, D, Fortran, IDL, Java, Objective-C,[9] Perl,[10] PHP,[11] Python,[12][13] and VHDL.[11] Other languages can be supported with additional code.

Doxygen runs on most Unix-like systems, macOS, and Windows.

The first version of Doxygen borrowed code from an early version of DOC++, developed by Roland Wunderling and Malte Zöckler at Zuse Institute Berlin. Later, the Doxygen code was rewritten by Dimitri van Heesch.

Doxygen has built-in support to generate inheritance diagrams for C++ classes. For more advanced diagrams and graphs, Doxygen can use the "dot" tool from Graphviz.[14]

Example code

The generic syntax of documentation comments is to start a comment with an extra asterisk after the leading comment delimiter '/*':

/**
<A short one line description>

<Longer description>
<May span multiple lines or paragraphs as needed>

@param  Description of method's or function's input parameter
@param  ...
@return Description of the return value
*/

Many programmers like to mark the start of each line with space-asterisk-space, as follows, but that is not necessary.

/**
 * <A short one line description>
 * <Longer description>
 * <May span multiple lines or paragraphs as needed>
 * @param  Description of method's or function's input parameter
 * @param  ...
 * @return Description of the return value
 */

Many programmers avoid using C-style comments and instead use C++ style single line comments. Doxygen accepts comments with additional slash as Doxygen comments.

/// <A short one line description>
///
/// <Longer description>
/// <May span multiple lines or paragraphs as needed>
///
/// @param  Description of method's or function's input parameter
/// @param  ...
/// @return Description of the return value

The following illustrates how a C++ source file can be documented.

Error creating thumbnail: convert: no images defined `/tmp/transform_f856afeac81b.png' @ error/convert.c/ConvertImageCommand/3229. Error code: 1
A screenshot of what the output would look like in HTML
/**
 * @file
 * @author  John Doe <jdoe@example.com>
 * @version 1.0
 * @section LICENSE
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details at
 * https://www.gnu.org/copyleft/gpl.html
 * @section DESCRIPTION
 * The time class represents a moment of time.
 */

class Time {

    public:

       /**
        * Constructor that sets the time to a given value.
        * @param timemillis is a number of milliseconds
        *        passed since Jan 1, 1970.
        */
       Time (int timemillis) {
           // the code
       }

       /**
        * Get the current time.
        * @return A time object set to the current time.
        */
       static Time now () {
           // the code
       }
};

An alternative approach for documenting parameters is shown below. It will produce the same documentation.

/**
        * Constructor that sets the time to a given value.
        */
       Time (int timemillis ///< Number of milliseconds passed since Jan 1, 1970.>
            )
       {
           // the code
       }

Richer markup is also possible. For instance, add equations using LaTeX commands:

/**
 * An inline equation @f$ e^{\pi i}+1 = 0 @f$
 * A displayed equation: @f[ e^{\pi i}+1 = 0 @f]
 */

Doxygen source and development

The Doxygen sources are currently hosted at GitHub, where the main developer, Dimitri van Heesch, contributes under the user name "doxygen".[15] Doxygen is written in C++, and consists of around 300,000 source lines of code. For lexical analysis, the standard tool Lex (or its replacement Flex) is run via approximately 35,000 lines of lex script. The parsing tool Yacc (or its replacement Bison) is also used, but only for minor tasks; the bulk of language parsing is done by native C++ code. The build process is based on CMake and also involves some Python scripts.

See also

References

  1. ANNOUNCE: doxygen 0.1 , Announcing: the first release of Doxygen, a C++ documentation system. , From: Dimitri van Heesch, Date: Sun, 26 Oct 1997, Qt-interest Archive
  2. "Doxygen Manual: Changelog". https://www.doxygen.nl/manual/changelog.html#log_1_10_0. 
  3. "Doxygen Manual: Frequently Asked Questions". https://www.doxygen.nl/manual/faq.html. 
  4. Perkel, Jeffrey M. (2015-11-22). "Get With the Program: DIY tips for adding coding to your analysis arsenal". The Scientist. https://www.the-scientist.com/?articles.view/articleNo/43632/title/Get-With-the-Program/. 
  5. Sabin, Mihaela (2015-11-22). "Doxygen". University of New Hampshire. Archived from the original on 2015-11-23. https://web.archive.org/web/20151123030546/http://foss.unh.edu/resources/index.php/Doxygen. 
  6. "Doxygen". 2015-11-22. https://directory.fsf.org/wiki/Doxygen. 
  7. "Documentation". 2015-11-22. https://rosettacode.org/wiki/Documentation. 
  8. "Documentation: C". 2015-11-22. https://rosettacode.org/wiki/Documentation#C. 
  9. "Documentation: Objective-C". 2015-11-22. https://rosettacode.org/wiki/Documentation#Objective-C. 
  10. "Doxygen::Filter::Perl - A perl code pre-filter for Doxygen - metacpan.org". https://metacpan.org/pod/Doxygen::Filter::Perl. 
  11. 11.0 11.1 "Doxygen Manual: Getting started". https://www.doxygen.nl/manual/starting.html. 
  12. "Automatic Python API documentation generation tools". 2015-11-22. https://wiki.python.org/moin/DocumentationTools#Automatic_Python_API_documentation_generation_tools. 
  13. Brown, Eric W.. "doxypypy: A Doxygen filter for Python". https://github.com/Feneric/doxypypy. 
  14. "Doxygen Manual: Graphs and diagrams". https://www.doxygen.nl/manual/diagrams.html. 
  15. "doxygen/doxygen". June 9, 2021. https://github.com/doxygen/doxygen. 

External links