annotate DOCS/tech/code-documentation.txt @ 14186:5053490906c3

Initialize cutoff, too. Fixes crash when AF_CONTROL_COMMAND_LINE is not set.
author reimar
date Sun, 19 Dec 2004 16:28:34 +0000
parents 05d3254e05b1
children 335964188675
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13290
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
1 Code documentation guidelines
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
2 =============================
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
3
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
4 About this guide
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
5 ----------------
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
6
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
7 Due to the ever increasing complexity and size of MPlayer it became quite hard
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
8 to maintain the code and add new features. Part of this problem is the lack
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
9 of proper documentation what the code in question does and how it is doing it.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
10 To tackle this problem every part of MPlayer should follow these guidelines
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
11 on what and how code should be documented.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
12
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
13
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
14 Doxygen
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
15 -------
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
16
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
17 MPlayer uses doxygen for its code documentation. It generates HTML files
13302
05d3254e05b1 typos, wording
diego
parents: 13290
diff changeset
18 which contain specially tagged comment lines from the code including
13290
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
19 cross references. To generate it type `make doxygen` in the source root
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
20 directory. It will generate the files in DOCS/tech/doxygen. To clear them
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
21 again, you can use `make doxygen_clean`.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
22 For further information about doxygen and its sources please have a look
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
23 at their website: http://doxygen.sf.net
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
24
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
25
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
26 What should be documented?
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
27 --------------------------
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
28
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
29 - every function, no matter whether it is globally or just locally used
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
30 * what the function does
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
31 * all parameters and return values of the function and their valid ranges
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
32 * all side effects (to passed parameters, globals etc)
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
33 * all assumptions made within the function
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
34
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
35 - global, file local and important variables
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
36 * what it is used for
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
37 * its valid range
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
38 * where it is set (optional)
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
39 * where validity checking is done (optional, mandatory for variables which
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
40 are set by something external, eg user parameters, file information etc)
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
41
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
42 - #define, typedefs, structs
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
43 * all global definitions
13302
05d3254e05b1 typos, wording
diego
parents: 13290
diff changeset
44 * all local definitions whose use is not imediatly clear by their name
05d3254e05b1 typos, wording
diego
parents: 13290
diff changeset
45 (as a rule of thumb, it's better to document too much than not enough)
13290
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
46 * all dependencies
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
47
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
48 - non-trivial parts of the code
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
49 * tricky parts
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
50 * important parts
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
51 * special side effects
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
52 * assumptions of the code
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
53 * string operations and why they are safe
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
54
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
55 - workarounds
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
56 * why they are needed
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
57 * how they work
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
58 * what side effects they have
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
59
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
60 If you are unsure whether a comment is needed or not, add one.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
61
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
62
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
63 How should it be documented?
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
64 ----------------------------
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
65
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
66 All comments should be in correct and clear English. Any other language is
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
67 not allowed. The language used should be kept simple as the code will be
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
68 read mostly by non-native speakers. For function and variable documentation,
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
69 a style usable by doxygen should be used. See section 3 "Documenting the code"
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
70 of the doxygen manual for an introduction. A very short overview follows:
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
71
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
72 Doxygen includes only special comments in the documentation, those are:
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
73
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
74 /// This is a line used by doxygen.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
75
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
76 /** this one, too */
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
77
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
78 /** these
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
79 here
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
80 of
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
81 course,
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
82 too */
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
83
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
84 //! this form can be also used
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
85
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
86 // This line isn't included in doxygen documentation.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
87
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
88 /* Neither is this. */
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
89
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
90 There are a couple of special tags for doxygen:
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
91
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
92 \brief <one line text>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
93 Gives a brief description of a function.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
94 \param <parameter> <text>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
95 Describes a specific <parameter>.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
96 \return <text>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
97 Describes the return value.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
98 \a <word>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
99 Mark next word as a reference to a parameter.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
100 \e <word>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
101 Use italic font for the next word.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
102 \b <word>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
103 Use bold font for the next word.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
104 \c <word>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
105 Use typewriter font for the next word.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
106 \sa <references>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
107 Adds a section with crossreferences.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
108 \bug <text>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
109 Describe a known bug.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
110 \todo <text>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
111 Add a todo list.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
112 \attention <text>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
113 Add a section for something that needs attention.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
114 \warning <text>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
115 Add a section for a warning.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
116 \anchor <refname>
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
117 Set an invisible anchor which can be used to create a link with /ref.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
118 \ref <refname> [<text>]
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
119 Add a link to <refname>.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
120
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
121 For a complete list of tags please read section 20 "Special commands" of the
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
122 doxygen manual.
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
123
fb8f8882fb6a adding the code documentation guide lines
attila
parents:
diff changeset
124