Debian Codegraph @

src/doc/manual/developer-guide/contributing-documentation.txi

raw
1 @node Documentation
2 @subsection Documentation
3
4 It is not an accident, that the documentation is the first chapter on
5 contributing to the @ecl – we believe that writing good documentation is
6 a cornerstone of any reliable software.
7
8 The second assumption is that people learn most from the examples, so
9 each concept should have illustration in code with a special entry in
10 the examples index.
11
12 @subsubsection Indexes
13 For the purpose of this manual we maintain a few indexes listed
14 below. They are meant to help navigate and search for information by the
15 reader.
16
17 @itemize @bullet
18 @item Concept index – concept covered by a documentation
19 @exindex Concept index
20 @verb{|@cindex User extensible streams|}
21
22 @item Configure option index – options available in configure script
23
24 Mark the default option with capital letters:
25 @exindex Configure option index
26 @verb{$--enable-clos-streams [YES|builtin|no]$}
27
28 @item Feature index – description of an item in @code{*FEATURES*}
29
30 @exindex Feature index
31 @verb{|@ftindex GRAY-STREAMS|}
32
33 @item Example index – example illustrating some use-case
34
35 @exindex Example index
36 @verb{|@exindex @code{gray:close} specializing function on @code{T}|}
37
38 @item Function index – covers both Lisp and C/C++ functions
39
40 Implicitly added by @verb{|@defun|}, @verb{|@defmac|} etc.
41
42 @item Variable index – covers both Lisp and C/C++ variables
43
44 Implicitly added by @verb{|@defvar|} etc.
45
46 @item Type index – both C/C++ and Lisp
47
48 @exindex Type indexes
49
50 Adding C/C++ type:
51 @verb{|@deftp {@cind} cl_env_struct|}
52
53 Adding Lisp type:
54 @verb{|@deftp {@lind} trivial-process|}
55
56 @item Common Lisp symbols – list of defined CL symbols (functions, variables etc.)
57
58 @exindex Common Lisp symbol index
59 @verb{|@lspindex gray:close|}
60 @verb{|@lspindex ffi:*has-dffi*|}
61
62 @item C/C++ index
63
64 @exindex C/C++ name index
65 @verb{|@cppindex cl_env_struct|}
66
67 @end itemize
68
69 @subsubheading Functions, macros and special forms
70
71 If function is from the Lisp ``world'', then we add it to the
72 @verb{|@lspindex|}, if from C/C++, then to the @verb{|@cppindex|}.
73
74 @exindex Documenting lisp operator
75 @verbatim
76 @lspindex ext:run-program
77 @defun ext:run-program ...
78 Short description
79 @table @var
80 @item arg-1
81 description
82 @item arg-2
83 description
84 @item returns
85 One value? More?
86 @end table
87 @subsubheading Description
88 Description here
89 @subsubheading Examples @c Omit section if none
90 Comment on the example if necessary.
91 @exindex @code{package:function} short summary
92 @lisp
93 (some-code-demonstrating-the-functionality)
94 @end lisp
95 @subsubheading Side effects @c Omit section if none
96 Side effects listed
97 @subsubheading Affected by @c Omit section if none
98 For instance: if the user has some privileges on the system
99 @end defun
100 @end verbatim
101
102 @subsubheading Typed functions
103
104 @exindex Documenting typed function
105 @verbatim
106 @deftypefun return-type name (type arg)*
107 description
108 @end deftypefun
109 @end verbatim
110
111 @subsubheading Variables
112
113 @exindex Documenting variables
114 @verbatim
115 @defvr {Constant} MOST_NEGATIVE_FIXNUM
116 @defvrx {Constant} MOST_POSITIVE_FIXNUM
117 These constants mark the limits of a fixnum.
118 @end defvr
119 @defvr Variable {ffi:*use-dffi*}
120 Description.
121 @end defvr
122 @end verbatim
123
124 @subsubheading Deprecated, obsolete and unused functions/variables
125
126 These shouldn't appear in the function index nor the variable index, but
127 should be listed in the C/C++ symbol index or/and Lisp index. Their
128 status should be marked with the @strong{keyword}.
129
130 @exindex Documenting deprecation and obsolescence
131 Example:
132 @verbatim
133 @cppindex ecl_fix
134 @cppindex ecl_unfix
135 @cppindex ecl_make_fixnum
136 @cppindex ecl_fixnum
137
138 @deftypefun cl_object ecl_fix (cl_fixnum n)
139 @deftypefunx cl_fixnum ecl_unfix (cl_object o)
140 @code{ecl_fix} converts from an integer to a lisp object, while the
141 @code{ecl_unfix} does the opposite (converts lisp object fixnum to integer).
142
143 @itemize @bullet
144 @item @strong{DEPRECATED} @code{cl_make_fixnum} – equivalent to @code{cl_fix}
145 @item @strong{DEPRECATED} @code{cl_fixnum} – equivalent to @code{cl_unfix}
146 @end itemize
147 @end deftypefun
148 @end verbatim
149
150 @cindex Deprecation and obsolescence
151 If symbol is deprecated, it will be marked as obsolete in the next
152 release, while obsolete symbols will be removed.
153
154 @subsubsection Examples
155 People learn by examples. New functions should have a usage example
156 listed in the examples index. When we want to illustrate some lisp code,
157 we should put it inside the @verb{|@lisp|} and @verb{|@end lisp|}
158 block, while if the code is in C/C++ put it in @verb{|@example|} and
159 @verb{|@end example|}.
160
161 Sometimes code contains invalid characters which confuse the texinfo. If
162 that's a case, then ode should be put additionally inside the
163 @verb{|@verbatim|} and @verb{|@end verbatim|} pair.
164
165 @exindex Examples in documentation
166 @verbatim
167 @lisp
168 (lambda () T)
169 @end lisp
170
171 @example
172 int i = 3;
173 @end example
174 @end verbatim
175
176 @subsubsection Concepts
177 Concepts are arguably the most important topic covered in any
178 documentation. They reflect the ideas behind the software with the
179 underlying implementation decisions motivation.
180
181 The main questions answered by the ``concepts'' are:
182 @itemize
183 @item What is a purpose of this interface?
184 @item Why it has been implemented that way?
185 @end itemize
186
187 @subsubsection Cross-references
188
189 References should be added like as follows:
190 @verbatim
191 [@ref{Standards}]
192 @end verbatim
193
194 Links:
195 @verbatim
196 @uref{http://example.org}
197 @uref{http://example.org, Example website}
198 @end verbatim