Robochameleon
v1.0
|
How to write and compile documentation using Doxygen
Robochameleon uses Doxygen to automatically generate API documentation. Doxygen integration into Matlab is accomplished using Fabrice's perl scripts, which are saved in the \doc\scripts folder. The Matlab Central project page is here.
In order to compile correctly, there are certain syntax rules the comments must obey. The basics are:
There is an example of a fully documented class below, and also some examples on the Matlab Central project page for the perl scripts.
For advanced formatting, see the Doxygen manual
The best way to start writing a unit is to use ClassTemplate_v1 as a template. You can see how doxygen displays the following code by clicking the above link, and the source code by opening it in matlab. The rest of this section goes through the comment structure and explains what the parts do.
The following three commands are used to add the unit to the list of files, classes, and module members, respectively. The text following the "brief" tag is the text that is put in the tables on those pages.
After the header comes the main description of the class, which will appear at the top of the the class reference page. Markdown syntax is used to create section headings and lists.
The class definition goes immediately after the comment header, with no white space in between. Class property definitions should be commented above where they are defined. This is not the most useful place to put notes about default values, as this information is displayed in table format. This information should go in the constructor documentation. Multi-line (word wrapped) expressions will not appear (at all) in the documentation.
Each member function (method) should have its own documentation. The constructor is where information about default property values should go. The syntax/format for method documentation is similar to the syntax for the class. The tags param and retval can be used to label input parameters and returned values - these will be displayed in tables.
Running Doxygen requires Doxygen software as well as Perl. There are installation instructions here, but we will reproduce them in case the link goes dead:
Note for Windows users : In certain circumstances, the association between .pl files and the perl executable is not well configured, leading to "Argument must contain filename -1 at C:\DoxygenMatlab\m2cpp.pl line 4" when running doxygen. To work around this issue, you should execute the following lines in a Windows command prompt ("cmd") :
(don't forget to replace the path to the perl.exe file with yours in the line above)
We have been running Doxygen on Windows through a linux emulator, Cygwin, with no issues. Installation instructions in this case are the same - install perl (all perl modules) and Doxygen using the Cygwin installer.
To update the Doxygen documentation run the following command from the doc folder:
then, to generate the PDF manual (refman.pdf), execute the following command from the folder doc/user manual/latex:
We have not gotten the PDF to compile successfully.
One line command to regenerate the documentation under Linux and MAC (pdflatex and a latex distribution are required). In folder doc/scripts execute:
WARNING The Doxygen configuration files uses relative path to find the source code and the necessary scripts. So if you move or rename the doc and scripts folders or the Doxyfile file and the scripts the documentation may not be generated correctly.
WARNING Before updating the documentation edit the parameter STRIP_FROM_PATH in the file Doxyfile from the doc folder by inserting the absolute path of the robochameleon root folder.
WARNING All the files in the folders base, devel, library, utils are documented, also the ones not tracked by git. Before updating the documentation it's better to temporary clone a vanilla version of the repository in a new directory and update the documentation from there so that there won't be any spurious files.