Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > bbf8b69a7c5792df8049c96b78d19811 > files > 794

doxygen-1.7.4-2.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Doxygen manual: Getting started</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Doxygen manual</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">Getting started </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p>The executable <code>doxygen</code> is the main program that parses the sources and generates the documentation. See section <a class="el" href="doxygen_usage.html">Doxygen usage</a> for more detailed usage information.</p>
<p>The executable <code>doxytag</code> is only needed if you want to generate references to external documentation (i.e. documentation that was generated by doxygen) for which you do not have the sources. See section <a class="el" href="doxytag_usage.html">Doxytag usage</a> for more detailed usage information.</p>
<p>Optionally, the executable <code>doxywizard</code> can be used, which is a <a class="el" href="doxywizard_usage.html">graphical front-end</a> for editing the configuration file that is used by doxygen and for running doxygen in a graphical environment. For Mac OS X doxywizard will be started by clicking on the Doxygen application icon.</p>
<p>The following figure shows the relation between the tools and the flow of information between them (it looks complex but that's only because it tries to be complete):</p>
<div class="image">
<img src="infoflow.gif" alt="infoflow.gif"/>
<div class="caption">
Doxygen information flow</div></div>
 <h2><a class="anchor" id="step0"></a>
Step 0: Check if doxygen supports your programming language</h2>
<p>First, assure that your programming language has a reasonable chance of being recognized by Doxygen. These languages are supported by default: C, C++, C#, Objective-C, IDL, Java, VHDL, PHP, Python, Fortran, and D. It is possible to configure certain filetype extensions to use certain parsers: see the <a class="el" href="config.html#cfg_extension_mapping">Configuration/ExtensionMappings</a> for details. Also, completely different languages can be supported by using preprocessor programs: see the <a href="http://www.doxygen.org/helpers.html">Helpers page</a> for details.</p>
<h2><a class="anchor" id="step1"></a>
Step 1: Creating a configuration file</h2>
<p>Doxygen uses a configuration file to determine all of its settings. Each project should get its own configuration file. A project can consist of a single source file, but can also be an entire source tree that is recursively scanned.</p>
<p>To simplify the creation of a configuration file, doxygen can create a template configuration file for you. To do this call <code>doxygen</code> from the command line with the <code>-g</code> option: </p>
<div class="fragment"><pre class="fragment">
doxygen -g &lt;config-file&gt;
</pre></div><p>where &lt;config-file&gt; is the name of the configuration file. If you omit the file name, a file named <code>Doxyfile</code> will be created. If a file with the name &lt;config-file&gt; already exists, doxygen will rename it to &lt;config-file&gt;.bak before generating the configuration template. If you use <code>-</code> (i.e. the minus sign) as the file name then doxygen will try to read the configuration file from standard input (<code>stdin</code>), which can be useful for scripting.</p>
<p>The configuration file has a format that is similar to that of a (simple) Makefile. It consists of a number of assignments (tags) of the form:</p>
<p><code>TAGNAME = VALUE</code> or <br/>
 <code>TAGNAME = VALUE1 VALUE2 ... </code><br/>
</p>
<p>You can probably leave the values of most tags in a generated template configuration file to their default value. See section <a class="el" href="config.html">Configuration</a> for more details about the configuration file.</p>
<p>If you do not wish to edit the config file with a text editor, you should have a look at <a class="el" href="doxywizard_usage.html">doxywizard</a>, which is a GUI front-end that can create, read and write doxygen configuration files, and allows setting configuration options by entering them via dialogs.</p>
<p>For a small project consisting of a few C and/or C++ source and header files, you can leave <a class="el" href="config.html#cfg_input">INPUT</a> tag empty and doxygen will search for sources in the current directory.</p>
<p>If you have a larger project consisting of a source directory or tree you should assign the root directory or directories to the <a class="el" href="config.html#cfg_input">INPUT</a> tag, and add one or more file patterns to the <a class="el" href="config.html#cfg_file_patterns">FILE_PATTERNS</a> tag (for instance <code>*.cpp *.h</code>). Only files that match one of the patterns will be parsed (if the patterns are omitted a list of source extensions is used). For recursive parsing of a source tree you must set the <a class="el" href="config.html#cfg_recursive">RECURSIVE</a> tag to <code>YES</code>. To further fine-tune the list of files that is parsed the <a class="el" href="config.html#cfg_exclude">EXCLUDE</a> and <a class="el" href="config.html#cfg_exclude_patterns">EXCLUDE_PATTERNS</a> tags can be used. To omit all <code>test</code> directories from a source tree for instance, one could use: </p>
<div class="fragment"><pre class="fragment">EXCLUDE_PATTERNS = */test/* 
</pre></div><p>Doxygen looks at the file's extension to determine how to parse a file. If a file has an <code>.idl</code> or <code>.odl</code> extension it is treated as an IDL file. If it has a <code>.java</code> extension it is treated as a file written in Java. Files ending with <code>.cs</code> are treated as C# files and the <code>.py</code> extension selects the Python parser. Finally, files with the extensions <code>.php</code>, <code>.php4</code>, <code>.inc</code> or <code>.phtml</code> are treated as PHP sources. Any other extension is parsed as if it is a C/C++ file, where files that end with <code>.m</code> are treated as Objective-C source files.</p>
<p><a class="anchor" id="extract_all"></a> If you start using doxygen for an existing project (thus without any documentation that doxygen is aware of), you can still get an idea of what the structure is and how the documented result would look like. To do so, you must set the <a class="el" href="config.html#cfg_extract_all">EXTRACT_ALL</a> tag in the configuration file to <code>YES</code>. Then, doxygen will pretend everything in your sources is documented. Please note that as a consequence warnings about undocumented members will not be generated as long as <a class="el" href="config.html#cfg_extract_all">EXTRACT_ALL</a> is set to <code>YES</code>.</p>
<p>To analyze an existing piece of software it is useful to cross-reference a (documented) entity with its definition in the source files. Doxygen will generate such cross-references if you set the <a class="el" href="config.html#cfg_source_browser">SOURCE_BROWSER</a> tag to <code>YES</code>. It can also include the sources directly into the documentation by setting <a class="el" href="config.html#cfg_inline_sources">INLINE_SOURCES</a> to <code>YES</code> (this can be handy for code reviews for instance).</p>
<h2><a class="anchor" id="step2"></a>
Step 2: Running doxygen</h2>
<p>To generate the documentation you can now enter: </p>
<div class="fragment"><pre class="fragment">
doxygen &lt;config-file&gt;
</pre></div><p>Depending on your settings doxygen will create <code>html</code>, <code>rtf</code>, <code>latex</code>, <code>xml</code> and/or <code>man</code> directories inside the output directory. As the names suggest these directories contain the generated documentation in HTML, RTF, <img class="formulaInl" alt="$\mbox{\LaTeX}$" src="form_0.png"/>, XML and Unix-Man page format.</p>
<p>The default output directory is the directory in which <code>doxygen</code> is started. The root directory to which the output is written can be changed using the <a class="el" href="config.html#cfg_output_directory">OUTPUT_DIRECTORY</a>. The format specific directory within the output directory can be selected using the <a class="el" href="config.html#cfg_html_output">HTML_OUTPUT</a>, <a class="el" href="config.html#cfg_rtf_output">RTF_OUTPUT</a>, <a class="el" href="config.html#cfg_latex_output">LATEX_OUTPUT</a>, <a class="el" href="config.html#cfg_xml_output">XML_OUTPUT</a>, and <a class="el" href="config.html#cfg_man_output">MAN_OUTPUT</a> tags of the configuration file. If the output directory does not exist, <code>doxygen</code> will try to create it for you (but it will <em>not</em> try to create a whole path recursively, like <code>mkdir -p</code> does).</p>
<h3><a class="anchor" id="html_out"></a>
HTML output</h3>
<p><a name="browser"></a> The generated HTML documentation can be viewed by pointing a HTML browser to the <code>index.html</code> file in the <code>html</code> directory. For the best results a browser that supports cascading style sheets (CSS) should be used (I'm using Mozilla, Safari, Konqueror, and sometimes IE6 to test the generated output).</p>
<p>Some of the features the HTML section (such as <a class="el" href="config.html#cfg_generate_treeview">GENERATE_TREEVIEW</a> or the search engine) require a browser that supports DHTML and Javascript.</p>
<h3><a class="anchor" id="latex_out"></a>
LaTeX output</h3>
<p><a name="LaTeX"></a> The generated <img class="formulaInl" alt="$\mbox{\LaTeX}$" src="form_0.png"/> documentation must first be compiled by a <img class="formulaInl" alt="$\mbox{\LaTeX}$" src="form_0.png"/> compiler (I use a recent teTeX distribution for Linux and MacOSX and MikTex for Windows). To simplify the process of compiling the generated documentation, <code>doxygen</code> writes a <code>Makefile</code> into the <code>latex</code> directory.</p>
<p>The contents and targets in the <code>Makefile</code> depend on the setting of <a class="el" href="config.html#cfg_use_pdflatex">USE_PDFLATEX</a>. If it is disabled (set to <code>NO</code>), then typing <code>make</code> in the <code>latex</code> directory a dvi file called <code>refman.dvi</code> will be generated. This file can then be viewed using <code>xdvi</code> or converted into a PostScript file <code>refman.ps</code> by typing <code>make ps</code> (this requires <code>dvips</code>).</p>
<p>To put 2 pages on one physical page use <code>make ps_2on1</code> instead. The resulting PostScript file can be send to a PostScript printer. If you do not have a PostScript printer, you can try to use ghostscript to convert PostScript into something your printer understands.</p>
<p>Conversion to PDF is also possible if you have installed the ghostscript interpreter; just type <code>make pdf</code> (or <code>make pdf_2on1</code>).</p>
<p>To get the best results for PDF output you should set the <a class="el" href="config.html#cfg_pdf_hyperlinks">PDF_HYPERLINKS</a> and <a class="el" href="config.html#cfg_use_pdflatex">USE_PDFLATEX</a> tags to <code>YES</code>. In this case the <code>Makefile</code> will only contain a target to build <code>refman.pdf</code> directly.</p>
<h3><a class="anchor" id="rtf_out"></a>
RTF output</h3>
<p><a name="RTF"></a> Doxygen combines the RTF output to a single file called refman.rtf. This file is optimized for importing into the Microsoft Word. Certain information is encoded using field. To show the actual value you need to select all (Edit - select all) and then toggle fields (right click and select the option from the drop down menu).</p>
<h3><a class="anchor" id="xml_out"></a>
XML output</h3>
<p><a name="XML"></a> The XML output consists of a structured "dump" of the information gathered by doxygen. Each compound (class/namespace/file/...) has its own XML file and there is also an index file called index.xml.</p>
<p>A file called combine.xslt XSLT script is also generated and can be used to combine all XML files into a single file.</p>
<p>Doxygen also generates two XML schema files index.xsd (for the index file) and compound.xsd (for the compound files). This schema file describes the possible elements, their attributes and how they are structured, i.e. it the describes the grammar of the XML files and can be used for validation or to steer XSLT scripts.</p>
<p>In the addon/doxmlparser directory you can find a parser library for reading the XML output produced by doxygen in an incremental way (see addon/doxmlparser/include/doxmlintf.h for the interface of the library)</p>
<h3><a class="anchor" id="man_out"></a>
Man page output</h3>
<p>The generated man pages can be viewed using the <code>man</code> program. You do need to make sure the man directory is in the man path (see the <code>MANPATH</code> environment variable). Note that there are some limitations to the capabilities of the man page format, so some information (like class diagrams, cross references and formulas) will be lost.</p>
<h2><a class="anchor" id="step3"></a>
Step 3: Documenting the sources</h2>
<p>Although documenting the sources is presented as step 3, in a new project this should of course be step 1. Here I assume you already have some code and you want doxygen to generate a nice document describing the API and maybe the internals as well.</p>
<p>If the <a class="el" href="config.html#cfg_extract_all">EXTRACT_ALL</a> option is set to <code>NO</code> in the configuration file (the default), then doxygen will only generate documentation for <em>documented</em> members, files, classes and namespaces. So how do you document these? For members, classes and namespaces there are basically two options: </p>
<ol>
<li>
Place a <em>special</em> documentation block in front of the declaration or definition of the member, class or namespace. For file, class and namespace members it is also allowed to place the documentation directly after the member. See section <a class="el" href="docblocks.html#specialblock">Special documentation blocks</a> to learn more about special documentation blocks. </li>
<li>
Place a special documentation block somewhere else (another file or another location) <em>and</em> put a <em>structural command</em> in the documentation block. A structural command links a documentation block to a certain entity that can be documented (e.g. a member, class, namespace or file). See section <a class="el" href="docblocks.html#structuralcommands">Documentation at other places</a> to learn more about structural commands. </li>
</ol>
<p>Files can only be documented using the second option, since there is no way to put a documentation block before a file. Of course, file members (functions, variables, typedefs, defines) do not need an explicit structural command; just putting a special documentation block in front or behind them will do.</p>
<p>The text inside a special documentation block is parsed before it is written to the HTML and/or <img class="formulaInl" alt="$\mbox{\LaTeX}$" src="form_0.png"/> output files.</p>
<p><a name="parsing"></a> During parsing the following steps take place: </p>
<ul>
<li>
The special commands inside the documentation are executed. See section <a class="el" href="commands.html">Special Commands</a> for an overview of all commands. </li>
<li>
If a line starts with some whitespace followed by one or more asterisks (<code>*</code>) and then optionally more whitespace, then all whitespace and asterisks are removed. </li>
<li>
All resulting blank lines are treated as a paragraph separators. This saves you from placing new-paragraph commands yourself in order to make the generated documentation readable. </li>
<li>
Links are created for words corresponding to documented classes (unless the word is preceded by a %; then the word will not be linked and the % sign is removed). </li>
<li>
Links to members are created when certain patterns are found in the text. See section <a class="el" href="autolink.html">Automatic link generation</a> for more information on how the automatic link generation works. </li>
<li>
HTML tags that are in the documentation are interpreted and converted to <img class="formulaInl" alt="$\mbox{\LaTeX}$" src="form_0.png"/> equivalents for the <img class="formulaInl" alt="$\mbox{\LaTeX}$" src="form_0.png"/> output. See section <a class="el" href="htmlcmds.html">HTML Commands</a> for an overview of all supported HTML tags. </li>
</ul>
 
Go to the <a href="docblocks.html">next</a> section or return to the
 <a href="index.html">index</a>.
 </div></div>
<hr class="footer"/><address class="footer"><small>Generated on Mon Jun 27 2011 for Doxygen manual by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>