1
1
/******************************************************************************
2
2
*
3
- *
3
+ *
4
4
*
5
5
* Copyright (C) 1997-2015 by Dimitri van Heesch.
6
6
*
7
7
* Permission to use, copy, modify, and distribute this software and its
8
- * documentation under the terms of the GNU General Public License is hereby
9
- * granted. No representations are made about the suitability of this software
8
+ * documentation under the terms of the GNU General Public License is hereby
9
+ * granted. No representations are made about the suitability of this software
10
10
* for any purpose. It is provided "as is" without express or implied warranty.
11
11
* See the GNU General Public License for more details.
12
12
*
22
22
23
23
The following picture shows how source files are processed by doxygen.
24
24
25
- \image html archoverview.gif "Data flow overview"
25
+ \image html archoverview.svg "Data flow overview"
26
26
\image latex archoverview.eps "Data flow overview" width=14cm
27
27
28
28
The following sections explain the steps above in more detail.
29
29
30
30
<h3>Config parser</h3>
31
31
32
32
The configuration file that controls the settings of a project is parsed
33
- and the settings are stored in the singleton class \c Config
34
- in <code>src/config.h</code>. The parser itself is written using \c flex
35
- and can be found in <code>src/config.l</code>. This parser is also used
33
+ and the settings are stored in the singleton class \c Config
34
+ in <code>src/config.h</code>. The parser itself is written using \c flex
35
+ and can be found in <code>src/config.l</code>. This parser is also used
36
36
directly by \c doxywizard, so it is put in a separate library.
37
37
38
- Each configuration option has one of 5 possible types: \c String,
38
+ Each configuration option has one of 5 possible types: \c String,
39
39
\c List, \c Enum, \c Int, or \c Bool. The values of these options are
40
40
available through the global functions \c Config_getXXX(), where \c XXX is the
41
41
type of the option. The argument of these function is a string naming
42
- the option as it appears in the configuration file. For instance:
42
+ the option as it appears in the configuration file. For instance:
43
43
\c Config_getBool("GENERATE_TESTLIST") returns a reference to a boolean
44
- value that is \c TRUE if the test list was enabled in the configuration file.
44
+ value that is \c TRUE if the test list was enabled in the configuration file.
45
45
46
- The function \c readConfiguration() in \c src/doxygen.cpp
46
+ The function \c readConfiguration() in \c src/doxygen.cpp
47
47
reads the command line options and then calls the configuration parser.
48
48
49
49
<h3>C Preprocessor</h3>
@@ -54,29 +54,29 @@ C Preprocessor (after being piped through a user defined filter if available).
54
54
The way the preprocessor works differs somewhat from a standard C Preprocessor.
55
55
By default it does not do macro expansion, although it can be configured to
56
56
expand all macros. Typical usage is to only expand a user specified set
57
- of macros. This is to allow macro names to appear in the type of
57
+ of macros. This is to allow macro names to appear in the type of
58
58
function parameters for instance.
59
59
60
- Another difference is that the preprocessor parses, but not actually includes
60
+ Another difference is that the preprocessor parses, but not actually includes
61
61
code when it encounters a \c \#include (with the exception of \c \#include
62
- found inside { ... } blocks). The reasons behind this deviation from
63
- the standard is to prevent feeding multiple definitions of the
64
- same functions/classes to doxygen's parser. If all source files would
65
- include a common header file for instance, the class and type
66
- definitions (and their documentation) would be present in each
67
- translation unit.
62
+ found inside { ... } blocks). The reasons behind this deviation from
63
+ the standard is to prevent feeding multiple definitions of the
64
+ same functions/classes to doxygen's parser. If all source files would
65
+ include a common header file for instance, the class and type
66
+ definitions (and their documentation) would be present in each
67
+ translation unit.
68
68
69
69
The preprocessor is written using \c flex and can be found in
70
- \c src/pre.l. For condition blocks (\c \#if) evaluation of constant expressions
71
- is needed. For this a \c yacc based parser is used, which can be found
70
+ \c src/pre.l. For condition blocks (\c \#if) evaluation of constant expressions
71
+ is needed. For this a \c yacc based parser is used, which can be found
72
72
in \c src/constexp.y and \c src/constexp.l.
73
73
74
- The preprocessor is invoked for each file using the \c preprocessFile()
75
- function declared in \c src/pre.h, and will append the preprocessed result
74
+ The preprocessor is invoked for each file using the \c preprocessFile()
75
+ function declared in \c src/pre.h, and will append the preprocessed result
76
76
to a character buffer. The format of the character buffer is
77
77
78
78
\verbatim
79
- 0x06 file name 1
79
+ 0x06 file name 1
80
80
0x06 preprocessed contents of file 1
81
81
...
82
82
0x06 file name n
@@ -85,17 +85,17 @@ to a character buffer. The format of the character buffer is
85
85
86
86
<h3>Language parser</h3>
87
87
88
- The preprocessed input buffer is fed to the language parser, which is
89
- implemented as a big state machine using \c flex. It can be found
90
- in the file \c src/scanner.l. There is one parser for all
91
- languages (C/C++/Java/IDL). The state variables \c insideIDL
92
- and \c insideJava are uses at some places for language specific choices.
88
+ The preprocessed input buffer is fed to the language parser, which is
89
+ implemented as a big state machine using \c flex. It can be found
90
+ in the file \c src/scanner.l. There is one parser for all
91
+ languages (C/C++/Java/IDL). The state variables \c insideIDL
92
+ and \c insideJava are uses at some places for language specific choices.
93
93
94
- The task of the parser is to convert the input buffer into a tree of entries
95
- (basically an abstract syntax tree). An entry is defined in \c src/entry.h
96
- and is a blob of loosely structured information. The most important field
94
+ The task of the parser is to convert the input buffer into a tree of entries
95
+ (basically an abstract syntax tree). An entry is defined in \c src/entry.h
96
+ and is a blob of loosely structured information. The most important field
97
97
is \c section which specifies the kind of information contained in the entry.
98
-
98
+
99
99
Possible improvements for future versions:
100
100
- Use one scanner/parser per language instead of one big scanner.
101
101
- Move the first pass parsing of documentation blocks to a separate module.
@@ -104,8 +104,8 @@ Possible improvements for future versions:
104
104
105
105
<h3>Data organizer</h3>
106
106
107
- This step consists of many smaller steps, that build
108
- dictionaries of the extracted classes, files, namespaces,
107
+ This step consists of many smaller steps, that build
108
+ dictionaries of the extracted classes, files, namespaces,
109
109
variables, functions, packages, pages, and groups. Besides building
110
110
dictionaries, during this step relations (such as inheritance relations),
111
111
between the extracted entities are computed.
@@ -117,15 +117,15 @@ on the tree of entries, built during language parsing. Look at the
117
117
The result of this step is a number of dictionaries, which can be
118
118
found in the doxygen "namespace" defined in \c src/doxygen.h. Most
119
119
elements of these dictionaries are derived from the class \c Definition;
120
- The class \c MemberDef, for instance, holds all information for a member.
121
- An instance of such a class can be part of a file ( class \c FileDef ),
122
- a class ( class \c ClassDef ), a namespace ( class \c NamespaceDef ),
120
+ The class \c MemberDef, for instance, holds all information for a member.
121
+ An instance of such a class can be part of a file ( class \c FileDef ),
122
+ a class ( class \c ClassDef ), a namespace ( class \c NamespaceDef ),
123
123
a group ( class \c GroupDef ), or a Java package ( class \c PackageDef ).
124
124
125
125
<h3>Tag file parser</h3>
126
126
127
127
If tag files are specified in the configuration file, these are parsed
128
- by a SAX based XML parser, which can be found in \c src/tagreader.cpp.
128
+ by a SAX based XML parser, which can be found in \c src/tagreader.cpp.
129
129
The result of parsing a tag file is the insertion of \c Entry objects in the
130
130
entry tree. The field \c Entry::tagInfo is used to mark the entry as
131
131
external, and holds information about the tag file.
@@ -136,15 +136,15 @@ Special comment blocks are stored as strings in the entities that they
136
136
document. There is a string for the brief description and a string
137
137
for the detailed description. The documentation parser reads these
138
138
strings and executes the commands it finds in it (this is the second pass
139
- in parsing the documentation). It writes the result directly to the output
139
+ in parsing the documentation). It writes the result directly to the output
140
140
generators.
141
141
142
142
The parser is written in C++ and can be found in \c src/docparser.cpp. The
143
143
tokens that are eaten by the parser come from \c src/doctokenizer.l.
144
144
Code fragments found in the comment blocks are passed on to the source parser.
145
145
146
146
The main entry point for the documentation parser is \c validatingParseDoc()
147
- declared in \c src/docparser.h. For simple texts with special
147
+ declared in \c src/docparser.h. For simple texts with special
148
148
commands \c validatingParseText() is used.
149
149
150
150
<h3>Source parser</h3>
@@ -156,13 +156,13 @@ The code parser tries to cross-reference to source code it parses with
156
156
documented entities. It also does syntax highlighting of the sources. The
157
157
output is directly written to the output generators.
158
158
159
- The main entry point for the code parser is \c parseCode()
159
+ The main entry point for the code parser is \c parseCode()
160
160
declared in \c src/code.h.
161
161
162
162
<h3>Output generators</h3>
163
163
164
- After data is gathered and cross-referenced, doxygen generates
165
- output in various formats. For this it uses the methods provided by
164
+ After data is gathered and cross-referenced, doxygen generates
165
+ output in various formats. For this it uses the methods provided by
166
166
the abstract class \c OutputGenerator. In order to generate output
167
167
for multiple formats at once, the methods of \c OutputList are called
168
168
instead. This class maintains a list of concrete output generators,
@@ -171,15 +171,15 @@ where each method called is delegated to all generators in the list.
171
171
To allow small deviations in what is written to the output for each
172
172
concrete output generator, it is possible to temporarily disable certain
173
173
generators. The OutputList class contains various \c disable() and \c enable()
174
- methods for this. The methods \c OutputList::pushGeneratorState() and
174
+ methods for this. The methods \c OutputList::pushGeneratorState() and
175
175
\c OutputList::popGeneratorState() are used to temporarily save the
176
- set of enabled/disabled output generators on a stack.
176
+ set of enabled/disabled output generators on a stack.
177
177
178
178
The XML is generated directly from the gathered data structures. In the
179
179
future XML will be used as an intermediate language (IL). The output
180
180
generators will then use this IL as a starting point to generate the
181
181
specific output formats. The advantage of having an IL is that various
182
- independently developed tools written in various languages,
182
+ independently developed tools written in various languages,
183
183
could extract information from the XML output. Possible tools could be:
184
184
- an interactive source browser
185
185
- a class diagram generator
@@ -188,18 +188,18 @@ could extract information from the XML output. Possible tools could be:
188
188
<h3>Debugging</h3>
189
189
190
190
Since doxygen uses a lot of \c flex code it is important to understand
191
- how \c flex works (for this one should read the \c man page)
192
- and to understand what it is doing when \c flex is parsing some input.
191
+ how \c flex works (for this one should read the \c man page)
192
+ and to understand what it is doing when \c flex is parsing some input.
193
193
Fortunately, when \c flex is used with the `-d` option it outputs what rules
194
- matched. This makes it quite easy to follow what is going on for a
195
- particular input fragment.
194
+ matched. This makes it quite easy to follow what is going on for a
195
+ particular input fragment.
196
196
197
197
To make it easier to toggle debug information for a given \c flex file I
198
198
wrote the following \c perl script, which automatically adds or removes `-d`
199
199
from the correct line in the \c Makefile:
200
200
201
201
\verbatim
202
- #!/usr/bin/perl
202
+ #!/usr/bin/perl
203
203
204
204
$file = shift @ARGV;
205
205
print "Toggle debugging mode for $file\n";
@@ -232,7 +232,7 @@ if (open(F,"<src/CMakeFiles/_doxygen.dir/build.make.old")) {
232
232
unlink "src/CMakeFiles/_doxygen.dir/build.make.old";
233
233
}
234
234
else {
235
- print STDERR "Warning file src/CMakeFiles/_doxygen.dir/build.make does not exist!\n";
235
+ print STDERR "Warning file src/CMakeFiles/_doxygen.dir/build.make does not exist!\n";
236
236
}
237
237
238
238
# touch the file
@@ -242,7 +242,7 @@ utime $now, $now, $file;
242
242
Another way to get rules matching / debugging information
243
243
from the \c flex code is setting \c LEX_FLAGS with \c make (`make LEX_FLAGS=-d`).
244
244
245
- Note that by running doxygen with `-d lex` you get information about which
245
+ Note that by running doxygen with `-d lex` you get information about which
246
246
`flex codefile` is used.
247
247
248
248
<h3>Testing</h3>
@@ -258,7 +258,7 @@ Studio projects), e.g. `setenv TEST_FLAGS "--id 5 --id 7"` and `make tests`.
258
258
259
259
<h3>Doxyfile differences</h3>
260
260
261
- In case one has to communicate through e.g. a forum the configuration settings that
261
+ In case one has to communicate through e.g. a forum the configuration settings that
262
262
are different from the standard doxygen configuration file settings one can run the
263
263
doxygen command: with the `-x` option and the name of the configuration file (default
264
264
is `Doxyfile`). The output will be a list of the not default settings (in `Doxyfile`
0 commit comments