1 Doxygen Internals {#mainpage}
7 This page provides a high-level overview of the internals of doxygen, with
8 links to the relevant parts of the code. This document is intended for
9 developers who want to work on doxygen. Users of doxygen are referred to the
10 [User Manual](http://www.doxygen.org/manual.html).
12 The generic starting point of the application is of course the main() function.
17 Configuration file data is stored in singleton class Config and can be
18 accessed using wrapper macros
19 Config_getString(), Config_getInt(), Config_getList(),
20 Config_getEnum(), and Config_getBool() depending on the type of the
23 The format of the configuration file (options and types) is defined
24 by the file `config.xml`. As part of the build process,
25 the python script `configgen.py` will create a file configoptions.cpp
26 from this, which serves as the input for the configuration file parser
27 that is invoked using Config::parse(). The script `configgen.py` will also
28 create the documentation for the configuration items, creating the file
34 After the configuration is known, the input files are searched using
35 searchInputFiles() and any tag files are read using readTagFile()
40 The function parseFiles() takes care of parsing all files.
41 It uses the ParserManager singleton factory to create a suitable parser object
42 for each file. Each parser implements the abstract interface ParserInterface.
44 If the parser indicates it needs preprocessing
45 via ParserInterface::needsPreprocessing(), doxygen will call preprocessFile()
48 A second step is to convert multiline C++-style comments into C style comments
49 for easier processing later on. As side effect of this step also
50 aliases (ALIASES option) are resolved. The function that performs these
51 2 tasks is called convertCppComments().
53 *Note:* Alias resolution should better be done in a separate step as it is
54 now coupled to C/C++ code and does not work automatically for other languages!
56 The third step is the actual language parsing and is done by calling
57 ParserInterface::parseInput() on the parser interface returned by
60 The result of parsing is a tree of Entry objects.
61 These Entry objects are wrapped in a EntryNav object and stored on disk using
62 Entry::createNavigationIndex() on the root node of the tree.
64 Each Entry object roughly contains the raw data for a symbol and is later
65 converted into a Definition object.
67 When a parser finds a special comment block in the input, it will do a first
68 pass parsing via parseCommentBlock(). During this pass the comment block
69 is split into multiple parts if needed. Some data that is later needed is
70 extracted like section labels, xref items, and formulas.
71 Also Markdown markup is processed using processMarkdown() during this pass.
76 The Entry objects created and filled during parsing are stored on disk
77 (to keep memory needs low). The name, parent/child relation, and
78 location on disk of each Entry is stored as a tree of EntryNav nodes, which is
81 Doxygen does a number of tree walks over the EntryNav nodes in the tree to
82 build up the data structures needed to produce the output.
84 The resulting data structures are all children of the generic base class
85 called Definition which holds all non-specific data for a symbol definition.
87 Definition is an abstract base class. Concrete subclasses are
88 - ClassDef: for storing class/struct/union related data
89 - NamespaceDef: for storing namespace related data
90 - FileDef: for storing file related data
91 - DirDef: for storing directory related data
93 For doxygen specific concepts the following subclasses are available
94 - GroupDef: for storing grouping related data
95 - PageDef: for storing page related data
97 Finally the data for members of classes, namespaces, and files is stored in
98 the subclass MemberDef.
100 Producing debug output
101 ----------------------
103 Within doxygen there are a number of ways to obtain debug output. Besides the
104 invasive method of putting print statements in the code there are a number of
105 easy ways to get debug information.
107 - Compilation of `.l` files<br>
108 This is also an invasive method but it will be automatically done by the
109 `flex / lex` command. The result is that of each input line the (lex) rule(s)
110 that are applied on it are shown.
112 - in the Visual C++ GUI
113 - find the required `.l` file
114 - select the `Properties` of this file
115 - set the item `Write used lex rules` to `Yes`
116 - see to it that the `.l` file is newer than the corresponding `.cpp` file
117 or remove the corresponding `.cpp` file
120 In the chapter "Doxygen's internals" a `perl` script is given to toggle the
121 possibility of having the rules debug information.
122 - command line change<br>
123 It is possible to the option `LEX="flex -d"` with the `make` command on the
124 command line. In this case the `.l` that are converted to the corresponding
125 `.cpp` files during this `make` get the rules debug information.<br>
126 To undo the rules debug information output just recompile the file with
128 Note this method applies for all the `.l` files that are rebuild to `.cpp`
129 files so be sure that only the `.l` files(s) of which you want to have the
130 rules debug information is (are) newer than the corresponding `.cpp`
132 - Running doxygen<br>
133 During a run of doxygen it is possible to specify the `-d` option with the
134 following possibilities (each option has to be preceded by `-d`):
136 Gives of global, class, module members its scope, arguments and other relevant information.
138 Gives of functions its scope, arguments and other relevant information.
140 Gives of variables its scope and other relevant information.
142 Gives of classes en modules its scope and other relevant information.
144 Shows the results of the preprocessing phase, i.e. results from include files,
145 <tt>\#define</tt> statements etc., definitions in the doxygen configuration file like:
146 `EXPAND_ONLY_PREDEF`, `PREDEFINED` and `MACRO_EXPANSION`.
148 Shows the results of the comment conversion, the comment conversion does the
150 - It converts multi-line C++ style comment blocks (that are aligned)
151 to C style comment blocks (if `MULTILINE_CPP_IS_BRIEF` is set to `NO`).
152 - It replaces aliases with their definition (see `ALIASES`)
153 - It handles conditional sections (<tt>\\cond ... \\endcond</tt> blocks)
155 Will print each comment block before and after the comment is interpreted by
158 Give the results in in pretty print way, i.e. in an XML like way with each
159 level indented by a `"."` (dot).
161 Provides information of the different stages of the doxygen process.
163 Shows which external commands are executed and which pipes are opened.
165 Will print each comment block before and after Markdown processing.
167 Gives the output of the output as result of the filter command (when a filter
168 command is specified)
172 Provide output of the `lex` files used. When a lexer is started and when a lexer
173 ends the name of the `lex` file is given so it is possible to see in which lexer the
174 problem occurs. This makes it easier to select the file to be compiled in `lex` debug mode.
183 - Grouping of files in Model / Parser / Generator categories
184 - Index files based on IndexIntf
187 - Documentation Sets (XCode)
196 - Various processing steps for a comment block
203 - Diagrams and Images
208 - Output formats: OutputGen, OutputList, and DocVisitor
209 - Html: HtmlGenerator and HtmlDocVisitor
210 - Latex: LatexGenerator and LatexDocVisitor
211 - RTF: RTFGenerator and RTFDocVisitor
212 - Man: ManGenerator and ManDocVisitor
213 - XML: generateXML() and XmlDocVisitor
214 - print: debugging via PrintDocVisitor
215 - text: TextDocVisitor for tooltips
217 - i18n via Translator and language.cpp
218 - Customizing the layout via LayoutDocManager
221 - const expression evaluation
228 - Marshaling to/from disk
229 - Portability functions