aboutsummaryrefslogtreecommitdiff
path: root/Doc/Devel/plan-gsoc-2012.txt
blob: ac764fb2a29935922320ae792ffdf364543bcaed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
                                                                     
                                                                     
                                                                     
                                             
                   Project Plan
                   ============
                SWIG Code Comments
             Google Summer of Code 2012


This document describes goals for the Google Summer of Code 2012,
SWIG code documentation project.

Author: Marko Klopcic, Dmitry Kabak


Introduction
============

The goal of this project is _not_ to translate _any_ possible Doxygen
formatted comment to JavaDoc or PyDoc, but to make it possible to
translate a subset of comment types in C/C++ code to
JavaDoc and PyDoc. Covering all the Doxygen functionality would be to
complex for the limited time. However, the code must be flexible so
that implementing missing features would not require redesign of the
comment handling code in SWIG.

There will also be a possibility to add untranslated comments to Java
and Python code (## comments, see Doxygen manual), if the user will
prefer to use Doxygen on the generated code.

Note:
'-OK-' tick below means that the item is implemented, committed and
working.

Abbreviations:
    JD - JavaDoc
    PD - PyDoc


Functionality
=============

  Types of comments
  -----------------
  
  Note:
     See 'http://www.stack.nl/~dimitri/doxygen/docblocks.html' for
     the detailed description of Doxygen syntax and terms used in this
     section.

  1. -OK- Only JavaDoc (/** */) and Qt (/*! */) styles of comment blocks
     will be supported by SWIG translator.

  2. -OK- The following doc after members will be supported:
  
     int var; ///< Detailed description after the member
              //!< 

     int var; //!< Brief description after the member

     int var; ///< Brief description after the member
     

  3. -OK- Only comments before or after declaration/definition will be
     supported. Comments with structural commands will be ignored
     (warning will be written). (What about writing them to
     'package.info.java' for JD?)
  

  Tags
  ----

  This section contains all doxygen tags taken from 
  http://www.stack.nl/~dimitri/doxygen/commands.html. If a tag is
  marked as 'ignored', then the tag is ignored, but the text is copied
  to the destination documentation. 'Not implemented' means that the
  tag with it's contents is stripped out of the output.

    Doxygen tags:
    
    All tags: -OK-     

    \a - translated to <i></i> in JD, surrounded with _ in PD
    \addindex - ignored
    \addtogroup - ignored
    \anchor - ignored, not supported by JD and PD 
    \arg - equivalent to \li
    \attention - ignored
    \authors, \author - translated to @author in JD, 'Author:' in PD
    \b - <b></b> in JD, surrounded with __ in PD
    \brief - ignored
    \bug - ignored
    \c - translated to <code></code> in JD, ignored in PD
    \callgraph - ignored, not supported by JD and PD
    \callergraph - ignored, not supported by JD and PD
    \category - ignored, used only in Objective C
    \cite - translated to <i></i> in JD, single quotes in PD
    \class - ignored (structural command)
    \code - translated to {@code ...} in JD, ignored in PD
    \cond - translated to 'Conditional comment: <condition>'. Later
            SWIG may support definitions of conditions in config file.
    \copybrief - ignored. Later SWIG may support this command by
                  performing copy
    \copydetails - ignored. Later SWIG may support this command by
                   performing copy
    \copydoc - ignored. Later SWIG may support this command by
               performing copy
    \copyright - replaced with text 'Copyright' in PD and PD
    \date - ignored
    \def - ignored (structural command)
    \defgroup - not supported
    \deprecated - translated to @deprecated in JD, 'Deprecated:' in PD
    \details - ignored
    \dir - not supported
    \dontinclude - not supported
    \dot - not supported. Later SWIG may call dot and produce the graph image
           to include in JD and PD
    \dotfile - see note for \dot
    \e - equivalent \a
    \else - see note for \cond
    \elseif - see note for \cond
    \em - equivalent to \a
    \endcode - see note for \code
    \endcond - translated to 'End of conditional comment: <condition>'. Later
               SWIG may support definitions of conditions in config file.
    \enddot - see note for \dot
    \endhtmlonly - ignored
    \endif - see note for \cond
    \endinternal - ignored
    \endlatexonly - ignored
    \endlink - see note for \link
    \endmanonly - ignored
    \endmsc - see note for \msc
    \endrtfonly - ignored
    \endverbatim - see note for \verbatim
    \endxmlonly - ignored
    \enum - ignored (structural command)
    \example - translated to 'Example:' in JD and PD
    \exception - equivalent to throws, but translates to @exception in JD 
    \extends - not supported
    \f$ - ignored. Later swig may call LATeX to produce bitmaps with formulas
          to include in JD and PD
    \f[ - see note for \f$
    \f] - see note for \f$
    \f{ - see note for \f$
    \f} - see note for \f$
    \file - ignored (structural command)
    \fn - ignored (structural command)
    \headerfile - not supported
    \hideinitializer - not supported
    \htmlinclude - not supported
    \htmlonly - ignored
    \if - see note for \cond 
    \ifnot - see note for \cond
    \image - translated to <img/> in JD only when target=HTML, translated to
             'Image: filename(Title)'
    \implements - not supported
    \include - not supported
    \includelineno - not supported
    \ingroup - not supported. Later swig may print group names as plain text
               in comments like 'Code group: something' in both JD and PD
    \internal - ignored
    \invariant - ignored
    \interface - ignored (structural command)
    \latexonly - ignored
    \li - trabslated to <li></li> in JD, ignored in PD
    \line - not supported
    \link - translated to {@link ...} in JD, ignored in PD
    \mainpage - ignored
    \manonly - ignored
    \memberof - not supported
    \msc - not supported. Later SWIG may call dot and produce the graph image
           to include in JD and PD
    \mscfile - see note for \msc
    \n - prints the new line
    \name - ignored
    \namespace - included in package-info.java if nspace feature is enabled,
                 otherwise ignored, ignored in PD
    \nosubgrouping - ignored
    \note - translated to 'Note:' in both JD and PD
    \overload - prints 'This is an overloaded member function, provided for
                convenience. It differs from the above function only in what
                argument(s) it accepts.' to the output in both JD and PD
    \p - equivalent to \c
    \package - is kept same in JD (it is already a JD tag), ignored in PD
    \page - ignored
    \par - translated to <p alt='title'></p> in JD, 'Title: ...' in PD 
    \paragraph - ignored
    \param - translated to @param in JD, special formatting in PD
    \post - ignored
    \pre - ignored
    \private - ignored
    \privatesection - ignored
    \property - ignored
    \protected - ignored
    \protectedsection - ignored
    \protocol - ignored (Objective-C tag)
    \public - ignored
    \publicsection - ignored
    \ref - ignored, not supported by JD and PD
    \related - ignored 
    \relates - ignored
    \relatedalso - ignored
    \relatesalso - ignored
    \remark - translated to 'Remarks:' in both JD and PD
    \remarks - equivalent to remark
    \result - translated to @return in JD, 'Return:' in PD
    \return - equivalent to result
    \returns - equivalent to result
    \retval - ignored
    \rtfonly - ignored
    \sa - translated to @see in JD, 'See also:' in PD
    \section - not supported
    \see - equivalent to \sa
    \short - equivalent to \brief
    \showinitializer - not supported
    \since - translated to @since in JD, 'Since:' in PD
    \skip - not supported
    \skipline - not supported
    \snippet - not supported
    \struct - ignored (structural command)
    \subpage - not supported
    \subsection - not supported
    \subsubsection - not supported
    \tableofcontents - not supported
    \test - ignored
    \throw - translated to @throws in JD, 'Throws:' in PD 
    \throws - equivalent to \throw
    \todo - translated to 'TODO:' in both JD and PD
    \tparam - similar to \arg
    \typedef - ignored (structural command)
    \union - ignored (structural command)
    \until - not supported
    \var - ignored (structural command)
    \verbatim - translated to {@literal ...} in JD, ignored in PD
    \verbinclude - ignored
    \version - translated to @version in JD, 'Version:' in PD
    \warning - translated to 'Warning:' in both JD and PD
    \weakgroup - not supported
    \xmlonly - ignored
    \xrefitem - ignored
    \$ - this and all the others below: these commands insert single char,
         it is escaped as HTML char in JD, kept as-is in PD
    \@
    \\
    \&
    \~
    \<
    \>
    \#
    \%
    \"
    \.
    \::

Optional functionality
======================

That section describes some complex cases where the current code
does not behave really well. Like a short to-do list of special cases.

-OK- When translating functions with default parameters in swig to
java, it creates overloaded functions with all the parameters
except the default ones. We need to copy the doxygen comment to
such functions and correct the list of @param tags.

-OK- In doxygen there is a special tags (and even a special option)
to create links to some code members from the current comment.
Sometimes it needs a type of parameters specified because of the
overloaded functions. And the same linking tags are supported in JD,
but it has a completely different typesystem, so we need to translate
the types of function parameters in comments also. For example:
{@link MyClass#doSomething(const std::string &)}
does not make sense in Java, so the type should be converted.
{@link MyClass#doSomething(String)}
 
    
Tests
=====

The following test cases will be implemented:

-OK- Class comments.

-OK- Struct comments.
-OK- Enum comments.
-OK- Function comments.
-OK- Var comments.

-OK- Class attributes, comment before and after declaration.
-OK- Class methods, comment of parameters in function
  comment.
-OK- Class methods, comment of parameters
  after parameter declaration.
  
-OK- Struct attributes, comment before and after declaration.
-OK- Struct methods, comment of parameters in function
  comment.
-OK- Struct methods, comment of parameters 
  after parameter declaration.

-OK- Enum items JD and Qt style, comment before items
-OK- Enum items JD and Qt style, comment after items

-OK- Class comment, with all supported tags.
-OK- Class comment, with all doxygen tags, including
  ignored ones.
  
The list of all tests, in form of shell commands to make it simple
to test project by copying the text below into terminal program.
make doxygen_parsing.cpptest -s
make doxygen_translate.cpptest -s
make doxygen_translate_all_tags.cpptest -s
make doxygen_basic_translate.cpptest -s
make doxygen_basic_notranslate.cpptest -s
make doxygen_translate_links.cpptest -s
make doxygen_tricky_constructs.cpptest -s

  
Refactoring
===========

All the code in directory _Doxygen_ should be refactored:
-OK- all methods should be class members
-OK- most static methods should be normal members
-OK- replace C arrays of strings and sequential searches with STL data
  structures and algorithms.
-OK- use singletons instead of class instantiaion for each comment found.


Documentation
=============

SWIG documentation will contain:
-OK- command line options
-OK- list of implemented features (types and placements of comments)
-OK- list of unimplemented features (types and placements of comments)
-OK- list of tags and their translations (all Doxygen tags).
-OK- some amount of debugging and development information